From patchwork Fri Feb 7 15:55:00 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jean-Francois Moine X-Patchwork-Id: 3607041 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 444519F2D6 for ; Fri, 7 Feb 2014 17:26:47 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 7A13C2010B for ; Fri, 7 Feb 2014 17:26:46 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 8E390200FE for ; Fri, 7 Feb 2014 17:26:45 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WBpBS-0002xT-6m; Fri, 07 Feb 2014 17:25:46 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WBp6Z-0001I0-6x; Fri, 07 Feb 2014 17:20:43 +0000 Received: from smtp5-g21.free.fr ([2a01:e0c:1:1599::14]) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WBp6H-0001CP-QL for linux-arm-kernel@lists.infradead.org; Fri, 07 Feb 2014 17:20:29 +0000 Received: from localhost (unknown [IPv6:2a01:e35:2f5c:9de0:212:bfff:fe1e:9ce4]) by smtp5-g21.free.fr (Postfix) with ESMTP id D8018D480EE; Fri, 7 Feb 2014 18:19:53 +0100 (CET) X-Mailbox-Line: From 9b3c3c2c982f31b026fd1516a2b608026d55b1e9 Mon Sep 17 00:00:00 2001 Message-Id: <9b3c3c2c982f31b026fd1516a2b608026d55b1e9.1391793068.git.moinejf@free.fr> In-Reply-To: References: From: Jean-Francois Moine Date: Fri, 7 Feb 2014 16:55:00 +0100 Subject: [PATCH RFC 1/2] drivers/base: permit base components to omit the bind/unbind ops To: Russell King , devel@driverdev.osuosl.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140207_122026_595541_84F6D0CC X-CRM114-Status: GOOD ( 10.18 ) X-Spam-Score: -1.9 (-) Cc: alsa-devel@alsa-project.org, Daniel Vetter , Takashi Iwai , Greg Kroah-Hartman , dri-devel@lists.freedesktop.org, Sascha Hauer , linux-arm-kernel@lists.infradead.org, linux-media@vger.kernel.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.7 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Some simple components don't need to do any specific action on bind to / unbind from a master component. This patch permits such components to omit the bind/unbind operations. Signed-off-by: Jean-Francois Moine --- drivers/base/component.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/base/component.c b/drivers/base/component.c index c53efe6..0a39d7a 100644 --- a/drivers/base/component.c +++ b/drivers/base/component.c @@ -225,7 +225,8 @@ static void component_unbind(struct component *component, { WARN_ON(!component->bound); - component->ops->unbind(component->dev, master->dev, data); + if (component->ops) + component->ops->unbind(component->dev, master->dev, data); component->bound = false; /* Release all resources claimed in the binding of this component */ @@ -274,7 +275,11 @@ static int component_bind(struct component *component, struct master *master, dev_dbg(master->dev, "binding %s (ops %ps)\n", dev_name(component->dev), component->ops); - ret = component->ops->bind(component->dev, master->dev, data); + if (component->ops) + ret = component->ops->bind(component->dev, master->dev, data); + else + ret = 0; + if (!ret) { component->bound = true;