[U-Boot] [Driver Model] post_bind() and pre_unbind() handler

Simon Glass sjg at chromium.org
Tue Dec 2 18:47:06 CET 2014


Hi Masahiro,

On 1 December 2014 at 22:31, Masahiro Yamada <yamada.m at jp.panasonic.com> wrote:
> Hi Simon,
>
>
> I have a question about handlers of struct uclass_driver.
>
>
> When binding a device,
>  "uc->uc_drv->post_bind()"  is called *before*  "drv->bind()",
> so  the name "pre_bind()" is more suitable than "post_bind()", isn't it?
>

The uclass post_bind() is called after the device is bound to the
uclass. The device's bind() call is made last, so that it can do any
last-minute adjustments, and can rely on any uclass setup having
occurred.

The 'bind' step does not rely on calling the device's bind(). In fact
the bind has already happened. This is just offering the device an
opportunity to do a little after-processing.

>
> Likewise, when unbinding a device,
> "uc->uc_drv->pre_unbind()" is called *after*  "drv->unbind()"
> so  the name "post_unbind()" is more suitable than "pre_unbind()".
>

Similar to the above.

>
>
> I think  pre_  and post_  is opposite here, and it looks confusing to me.
>
> Am I misunderstanding something?

Do you have a need to change the ordering?

Regards,
Simon


More information about the U-Boot mailing list