summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2015-01-25 08:27:06 -0700
committerSimon Glass <sjg@chromium.org>2015-01-29 17:09:55 -0700
commitdac8db2ce66944828e441cccf25703b262a256cd (patch)
tree44a5625d8577254adb38364944372b55ad2549df /include
parent9cc36a2b89ebe5148d69d521745c1e1d26365c3a (diff)
downloadu-boot-imx-dac8db2ce66944828e441cccf25703b262a256cd.zip
u-boot-imx-dac8db2ce66944828e441cccf25703b262a256cd.tar.gz
u-boot-imx-dac8db2ce66944828e441cccf25703b262a256cd.tar.bz2
dm: core: Allow uclasses to specify private data for a device's children
In many cases the per-child private data for a device's children is defined by the uclass rather than the individual driver. For example, a SPI bus needs to store information about each of its children, but all SPI drivers store the same information. It makes sense to allow the uclass to define this data. If the driver provides a size value for its per-child private data, then use it. Failng that, fall back to that provided by the uclass. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Diffstat (limited to 'include')
-rw-r--r--include/dm/uclass.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/include/dm/uclass.h b/include/dm/uclass.h
index 9000b22..ac6c850 100644
--- a/include/dm/uclass.h
+++ b/include/dm/uclass.h
@@ -63,6 +63,9 @@ struct udevice;
* @per_device_auto_alloc_size: Each device can hold private data owned
* by the uclass. If required this will be automatically allocated if this
* value is non-zero.
+ * @per_child_auto_alloc_size: Each child device (of a parent in this
+ * uclass) can hold parent data for the device/uclass. This value is only
+ * used as a falback if this member is 0 in the driver.
* @per_child_platdata_auto_alloc_size: A bus likes to store information about
* its children. If non-zero this is the size of this data, to be allocated
* in the child device's parent_platdata pointer. This value is only used as
@@ -82,6 +85,7 @@ struct uclass_driver {
int (*destroy)(struct uclass *class);
int priv_auto_alloc_size;
int per_device_auto_alloc_size;
+ int per_child_auto_alloc_size;
int per_child_platdata_auto_alloc_size;
const void *ops;
uint32_t flags;