dm: core: Alloc uclass-private data to be cache-aligned
authorSimon Glass <sjg@chromium.org>
Mon, 1 Oct 2018 18:22:05 +0000 (12:22 -0600)
committerSimon Glass <sjg@chromium.org>
Tue, 9 Oct 2018 10:40:27 +0000 (04:40 -0600)
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
include/dm/uclass.h

index feed43c8c3eb6724dda154952e01d780dca7898a..73c99d1a65a9ae5a27e10f38250c9708cfb9520e 100644 (file)
@@ -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;
index 6e7c1cd3e8bc43986b5d91135895b8858cd9c9c3..eebf2d5614c40a1f360081f95aca499b6cfe9b83 100644 (file)
@@ -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
  *