Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp962896ybf; Thu, 27 Feb 2020 02:46:46 -0800 (PST) X-Google-Smtp-Source: APXvYqwWcqxcbieQi+Qfxt3jURwXMFpJzLYhQKvHH0YzaSICz1KfRhb0xFrNrw9FCrnO3Mn2MWqO X-Received: by 2002:a9d:6288:: with SMTP id x8mr2706767otk.2.1582800406037; Thu, 27 Feb 2020 02:46:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582800406; cv=none; d=google.com; s=arc-20160816; b=EYINZ6dThJrV8ZSpGCAo3kWAsPrfMoKJvLDoQXwS7SsE3obeeyuDH+yHzD60CT6tyi 623kWGA3FoLtCjHwPX/mz4HMRJVHwuthywTjhtdaRBPrwGg+Ep0HMyXYxk+7rFeYY/HA UNVufO6+C8BkyvKfcV+d1gkKdst8VIR+JE/y/navGjV/2UqDd4C3iRKh+iEajuGMOHDL HTWy/T5R4L4s30Iecs+DeZ6dc0KyCr3O07NLTLf/iPi5pfbKCab9aqpbDTEJzmseHwoS QgdLeRpGgpJe2HWt66YDsi9PnEZdVlm8IKYR4BFMBafU0O99kWhucDYJkjuxQ6GkmiCt J78g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=Se+bZ8RqEMXC90GOY7QyUtKGDm5ngu2TA1QhA/buyK4=; b=md9yhcjOF5Y/ORpkudY3USL1Yn/Qrcy+dUkNSmqeSPQHU1IneP4MTpXzu58qLe8YAD JenvJfmCkcRxiw0//DdtzXfxKyX70ME6mbMVs3v/DXI96Ll5B44fgqMvyaLhqVgm23xD vUzQQRDZAsR/AjWUT/fmxE6ovxGavbufGxeABRO3jnYh9DpRnGmIPIfPwZa69qswhItU Q4NiEMvhHe7aAolX/6+cbgDaWDvfbzIHq6YN3kbNe4po2mZfQsroU7VXM1PNPI5NyDRl VU3vSHdJWylmbYT19lpYFOGBBWjj5YUfFKk6zeLtVHxnHwk7BVa4s+tJMSwYAZDr3740 Ny9A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n7si1119184otk.277.2020.02.27.02.46.33; Thu, 27 Feb 2020 02:46:46 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728845AbgB0KqH (ORCPT + 99 others); Thu, 27 Feb 2020 05:46:07 -0500 Received: from metis.ext.pengutronix.de ([85.220.165.71]:40727 "EHLO metis.ext.pengutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728680AbgB0KqH (ORCPT ); Thu, 27 Feb 2020 05:46:07 -0500 Received: from dude02.hi.pengutronix.de ([2001:67c:670:100:1d::28] helo=dude02.lab.pengutronix.de) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1j7Gfv-0004MP-4D; Thu, 27 Feb 2020 11:45:51 +0100 Received: from mfe by dude02.lab.pengutronix.de with local (Exim 4.92) (envelope-from ) id 1j7Gft-0008Vq-Ch; Thu, 27 Feb 2020 11:45:49 +0100 From: Marco Felsch To: gregkh@linuxfoundation.org, rafael@kernel.org, rmk+kernel@arm.linux.org.uk, linux@armlinux.org.uk Cc: linux-kernel@vger.kernel.org, kernel@pengutronix.de, Philipp Zabel Subject: [PATCH] component: allow missing unbind callback Date: Thu, 27 Feb 2020 11:45:47 +0100 Message-Id: <20200227104547.30085-1-m.felsch@pengutronix.de> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SA-Exim-Connect-IP: 2001:67c:670:100:1d::28 X-SA-Exim-Mail-From: mfe@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The component framework reuses the devres managed functions. There is no need to specify an unbind() callback if the driver only wants to release the devres managed resources. The bind/unbind is like the probe/remove pair. The bind/probe is necessary and the unbind/remove is optional. Signed-off-by: Marco Felsch Reviewed-by: Philipp Zabel --- drivers/base/component.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/base/component.c b/drivers/base/component.c index c7879f5ae2fb..e97704104784 100644 --- a/drivers/base/component.c +++ b/drivers/base/component.c @@ -528,7 +528,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->ops->unbind(component->dev, master->dev, data); component->bound = false; /* Release all resources claimed in the binding of this component */ -- 2.20.1