[PATCH v3 1/2] drivers/base: permit base components to omit the bind/unbind ops (original) (raw)

Thierry Reding thierry.reding at gmail.com
Mon Feb 10 04:53:08 PST 2014


On Fri, Feb 07, 2014 at 04:55:00PM +0100, Jean-Francois Moine wrote:

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 <moinejf at free.fr> --- 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 componentunbind(struct component *component, { WARNON(!component->bound); - component->ops->unbind(component->dev, master->dev, data); + if (component->ops) + component->ops->unbind(component->dev, master->dev, data);

This doesn't actually do what the commit message says. This makes component->ops optional, not component->ops->unbind().

A more correct check would be:

if (component->ops && component->ops->unbind)

component->bound = false;

/* Release all resources claimed in the binding of this component */ @@ -274,7 +275,11 @@ static int componentbind(struct component *component, struct master *master, devdbg(master->dev, "binding %s (ops %ps)\n", devname(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);

Same here.

Thierry -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 836 bytes Desc: not available URL: <http://lists.freedesktop.org/archives/dri-devel/attachments/20140210/0969c543/attachment.pgp>



More information about the dri-devel mailing list