diff mbox series

[U-Boot,01/45] dm: core: Alloc uclass-private data to be cache-aligned

Message ID 20181001182249.129565-2-sjg@chromium.org
State Accepted
Commit c7a3accc3f6a288ecbf9d62966792c93732060f2
Delegated to: Simon Glass
Headers show
Series Various fixes and improvements | expand

Commit Message

Simon Glass Oct. 1, 2018, 6:22 p.m. UTC
There is no reason why this feature should not be supported for uclass-
private data. Update the code accordingly.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 drivers/core/device.c | 3 ++-
 include/dm/uclass.h   | 3 +++
 2 files changed, 5 insertions(+), 1 deletion(-)

Comments

Simon Glass Oct. 9, 2018, 11:55 p.m. UTC | #1
There is no reason why this feature should not be supported for uclass-
private data. Update the code accordingly.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 drivers/core/device.c | 3 ++-
 include/dm/uclass.h   | 3 +++
 2 files changed, 5 insertions(+), 1 deletion(-)

Applied to u-boot-dm
diff mbox series

Patch

diff --git a/drivers/core/device.c b/drivers/core/device.c
index feed43c8c3e..73c99d1a65a 100644
--- a/drivers/core/device.c
+++ b/drivers/core/device.c
@@ -331,7 +331,8 @@  int device_probe(struct udevice *dev)
 	/* Allocate private data if requested and not reentered */
 	size = dev->uclass->uc_drv->per_device_auto_alloc_size;
 	if (size && !dev->uclass_priv) {
-		dev->uclass_priv = calloc(1, size);
+		dev->uclass_priv = alloc_priv(size,
+					      dev->uclass->uc_drv->flags);
 		if (!dev->uclass_priv) {
 			ret = -ENOMEM;
 			goto fail;
diff --git a/include/dm/uclass.h b/include/dm/uclass.h
index 6e7c1cd3e8b..eebf2d5614c 100644
--- a/include/dm/uclass.h
+++ b/include/dm/uclass.h
@@ -44,6 +44,9 @@  struct udevice;
 /* Members of this uclass sequence themselves with aliases */
 #define DM_UC_FLAG_SEQ_ALIAS			(1 << 0)
 
+/* Same as DM_FLAG_ALLOC_PRIV_DMA */
+#define DM_UC_FLAG_ALLOC_PRIV_DMA		(1 << 5)
+
 /**
  * struct uclass_driver - Driver for the uclass
  *