[U-Boot] [PATCH v2 06/26] dm: core: Allocate platform data when binding a device

Masahiro Yamada yamada.m at jp.panasonic.com
Fri Jan 23 10:20:24 CET 2015


Hi Simon, 


On Mon, 19 Jan 2015 20:12:35 -0700
Simon Glass <sjg at chromium.org> wrote:

> When using allocated platform data, allocate it when we bind the device.
> This makes it possible to fill in this information before the device is
> probed.
> 
> This fits with the platform data model (when not using device tree),
> since platform data exists at bind-time.
> 
> Signed-off-by: Simon Glass <sjg at chromium.org>


Looks like you have changed your mind
to allocate platdata in device_bind() rather than device_probe().


Could you explain why you think this should be done?

I might have missed something, but your motivation is still unclear to me.

I thought one reason is consistency with platform data.

But drv->ofdata_to_platdata() is still called from device_probe(),
i.e. it is just like zero-filled memory is allocated at the binding stage.
Filling it with real device properties is delayed until the device is probed.
What is the difference from the before and what does it buy us?

Its disadvantage are clear:
 - We need more malloc memory for devices that may or may not be used.
 - The boot sequence becomes slower.

I want good reasons to compensate these disadvantages.






BTW, you missed to fix the comment in device_probe_child():

	/* Allocate private data and platdata if requested */


Best Regards
Masahiro Yamada



More information about the U-Boot mailing list