Message ID | 1439222732-28983-2-git-send-email-yamada.masahiro@socionext.com |
---|---|
State | Superseded |
Delegated to: | Simon Glass |
Headers | show |
Hi Masahiro, On 10 August 2015 at 10:05, Masahiro Yamada <yamada.masahiro@socionext.com> wrote: > This is useful when we want to bind a device, but do not need the > device pointer. Could adjust the subject to something shorter, like "dm: core: Allow device_bind() to not return the device" > > Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> > --- > > drivers/core/device.c | 6 ++++-- > 1 file changed, 4 insertions(+), 2 deletions(-) > > diff --git a/drivers/core/device.c b/drivers/core/device.c > index e23a872..634070c 100644 > --- a/drivers/core/device.c > +++ b/drivers/core/device.c > @@ -32,7 +32,8 @@ int device_bind(struct udevice *parent, const struct driver *drv, > struct uclass *uc; > int size, ret = 0; > > - *devp = NULL; > + if (devp) > + *devp = NULL; > if (!name) > return -EINVAL; > > @@ -133,7 +134,8 @@ int device_bind(struct udevice *parent, const struct driver *drv, > > if (parent) > dm_dbg("Bound device %s to %s\n", dev->name, parent->name); > - *devp = dev; > + if (devp) > + *devp = dev; > > dev->flags |= DM_FLAG_BOUND; > > -- > 1.9.1 > Please can you update the function comments for device_bind()? Regards, Simon
Hi Simon, 2015-08-12 23:15 GMT+09:00 Simon Glass <sjg@chromium.org>: > Hi Masahiro, > > On 10 August 2015 at 10:05, Masahiro Yamada > <yamada.masahiro@socionext.com> wrote: >> This is useful when we want to bind a device, but do not need the >> device pointer. > > Could adjust the subject to something shorter, like "dm: core: Allow > device_bind() to not return the device" Done. Thanks. eturn -EINVAL; >> >> @@ -133,7 +134,8 @@ int device_bind(struct udevice *parent, const struct driver *drv, >> >> if (parent) >> dm_dbg("Bound device %s to %s\n", dev->name, parent->name); >> - *devp = dev; >> + if (devp) >> + *devp = dev; >> >> dev->flags |= DM_FLAG_BOUND; >> >> -- >> 1.9.1 >> > > Please can you update the function comments for device_bind()? Done for device_bind() and others.
diff --git a/drivers/core/device.c b/drivers/core/device.c index e23a872..634070c 100644 --- a/drivers/core/device.c +++ b/drivers/core/device.c @@ -32,7 +32,8 @@ int device_bind(struct udevice *parent, const struct driver *drv, struct uclass *uc; int size, ret = 0; - *devp = NULL; + if (devp) + *devp = NULL; if (!name) return -EINVAL; @@ -133,7 +134,8 @@ int device_bind(struct udevice *parent, const struct driver *drv, if (parent) dm_dbg("Bound device %s to %s\n", dev->name, parent->name); - *devp = dev; + if (devp) + *devp = dev; dev->flags |= DM_FLAG_BOUND;
This is useful when we want to bind a device, but do not need the device pointer. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> --- drivers/core/device.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)