]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
firmware: arm_ffa: Set the core device as FF-A device parent
authorSudeep Holla <sudeep.holla@kernel.org>
Fri, 8 May 2026 17:54:17 +0000 (18:54 +0100)
committerSudeep Holla <sudeep.holla@kernel.org>
Sun, 17 May 2026 11:42:37 +0000 (12:42 +0100)
Pass a parent device into ffa_device_register() and use the synthetic
arm-ffa platform device as the parent for each registered FF-A device.

This keeps the enumerated FF-A partition devices anchored below the FF-A
core device in the driver model, matching the platform-driver conversion
of the core transport.

Suggested-by: Yeoreum Yun <yeoreum.yun@arm.com>
Reviewed-by: Yeoreum Yun <yeoreum.yun@arm.com>
Link: https://patch.msgid.link/20260508-b4-ffa_plat_dev-v1-3-c5a30f8cf7b8@kernel.org
Signed-off-by: Sudeep Holla <sudeep.holla@kernel.org>
drivers/firmware/arm_ffa/bus.c
drivers/firmware/arm_ffa/driver.c
include/linux/arm_ffa.h

index 601c3418e0d927e72943b631c889a8dc7285e2bb..4df5c3b3fe4349835d1d348348183a18be556953 100644 (file)
@@ -192,7 +192,7 @@ bool ffa_device_is_valid(struct ffa_device *ffa_dev)
 
 struct ffa_device *
 ffa_device_register(const struct ffa_partition_info *part_info,
-                   const struct ffa_ops *ops)
+                   const struct ffa_ops *ops, struct device *parent)
 {
        int id, ret;
        struct device *dev;
@@ -212,6 +212,7 @@ ffa_device_register(const struct ffa_partition_info *part_info,
        }
 
        dev = &ffa_dev->dev;
+       dev->parent = parent;
        dev->bus = &ffa_bus_type;
        dev->release = ffa_release_device;
        dev->dma_mask = &dev->coherent_dma_mask;
index dd74f6c79749b2ea23b435658ba2873ab15dafc3..4bb6b138497830ca69da66d1e92f7fada40eb917 100644 (file)
@@ -1738,7 +1738,7 @@ static int ffa_setup_host_partition(int vm_id)
        int ret;
 
        buf.id = vm_id;
-       ffa_dev = ffa_device_register(&buf, &ffa_drv_ops);
+       ffa_dev = ffa_device_register(&buf, &ffa_drv_ops, &ffa_pdev->dev);
        if (!ffa_dev) {
                pr_err("%s: failed to register host partition ID 0x%x\n",
                       __func__, vm_id);
@@ -1813,7 +1813,8 @@ static int ffa_setup_partitions(void)
                 * provides UUID here for each partition as part of the
                 * discovery API and the same is passed.
                 */
-               ffa_dev = ffa_device_register(tpbuf, &ffa_drv_ops);
+               ffa_dev = ffa_device_register(tpbuf, &ffa_drv_ops,
+                                             &ffa_pdev->dev);
                if (!ffa_dev) {
                        pr_err("%s: failed to register partition ID 0x%x\n",
                               __func__, tpbuf->id);
index 81e603839c4a51873090b7e22edbe7b33a7e94df..17eca3dfc59e257d64e2dd52eb66b42ecb9a095e 100644 (file)
@@ -173,7 +173,7 @@ struct ffa_partition_info;
 #if IS_REACHABLE(CONFIG_ARM_FFA_TRANSPORT)
 struct ffa_device *
 ffa_device_register(const struct ffa_partition_info *part_info,
-                   const struct ffa_ops *ops);
+                   const struct ffa_ops *ops, struct device *parent);
 void ffa_device_unregister(struct ffa_device *ffa_dev);
 int ffa_driver_register(struct ffa_driver *driver, struct module *owner,
                        const char *mod_name);
@@ -184,7 +184,7 @@ bool ffa_device_is_valid(struct ffa_device *ffa_dev);
 #else
 static inline struct ffa_device *
 ffa_device_register(const struct ffa_partition_info *part_info,
-                   const struct ffa_ops *ops)
+                   const struct ffa_ops *ops, struct device *parent)
 {
        return NULL;
 }