dm: devres: Add a new OFDATA phase
Since the ofdata_to_platdata() method can allocate resources, add it as a
new devres phase.
Signed-off-by: Simon Glass <sjg@chromium.org>
diff --git a/test/dm/test-fdt.c b/test/dm/test-fdt.c
index bbac377..d59c449 100644
--- a/test/dm/test-fdt.c
+++ b/test/dm/test-fdt.c
@@ -159,6 +159,7 @@
struct dm_testdevres_priv {
void *ptr;
+ void *ptr_ofdata;
};
static int testdevres_drv_bind(struct udevice *dev)
@@ -170,6 +171,15 @@
return 0;
}
+static int testdevres_drv_ofdata_to_platdata(struct udevice *dev)
+{
+ struct dm_testdevres_priv *priv = dev_get_priv(dev);
+
+ priv->ptr_ofdata = devm_kmalloc(dev, TEST_DEVRES_SIZE3, 0);
+
+ return 0;
+}
+
static int testdevres_drv_probe(struct udevice *dev)
{
struct dm_testdevres_priv *priv = dev_get_priv(dev);
@@ -189,6 +199,7 @@
.of_match = testdevres_ids,
.id = UCLASS_TEST_DEVRES,
.bind = testdevres_drv_bind,
+ .ofdata_to_platdata = testdevres_drv_ofdata_to_platdata,
.probe = testdevres_drv_probe,
.platdata_auto_alloc_size = sizeof(struct dm_testdevres_pdata),
.priv_auto_alloc_size = sizeof(struct dm_testdevres_priv),