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>
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;
}
dev = &ffa_dev->dev;
+ dev->parent = parent;
dev->bus = &ffa_bus_type;
dev->release = ffa_release_device;
dev->dma_mask = &dev->coherent_dma_mask;
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);
* 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);
#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);
#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;
}