From: Marco Felsch Date: Thu, 27 Feb 2020 10:45:47 +0000 (+0100) Subject: component: allow missing unbind callback X-Git-Tag: v5.10.7~2991^2~16 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=14422f14da818a3f12344dceee47b4206870a24d;p=platform%2Fkernel%2Flinux-rpi.git component: allow missing unbind callback 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 Link: https://lore.kernel.org/r/20200227104547.30085-1-m.felsch@pengutronix.de Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/base/component.c b/drivers/base/component.c index c7879f5..e977041 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 */