summaryrefslogtreecommitdiff
path: root/drivers/firmware/arm_ffa/bus.c
diff options
context:
space:
mode:
authorSudeep Holla <sudeep.holla@arm.com>2022-09-07 15:52:31 +0100
committerSudeep Holla <sudeep.holla@arm.com>2022-09-08 11:30:34 +0100
commitd01387fc16421cbbf95d1fda8fe1258195396c64 (patch)
tree59b73775b6d93f6339683775111ff9a5cb28ecbb /drivers/firmware/arm_ffa/bus.c
parent568035b01cfb107af8d2e4bd2fb9aea22cf5b868 (diff)
firmware: arm_ffa: Add pointer to the ffa_dev_ops in struct ffa_dev
Currently ffa_dev_ops_get() is the way to fetch the ffa_dev_ops pointer. It checks if the ffa_dev structure pointer is valid before returning the ffa_dev_ops pointer. Instead, the pointer can be made part of the ffa_dev structure and since the core driver is incharge of creating ffa_device for each identified partition, there is no need to check for the validity explicitly if the pointer is embedded in the structure. Add the pointer to the ffa_dev_ops in the ffa_dev structure itself and initialise the same as part of creation of the device. Link: https://lore.kernel.org/r/20220907145240.1683088-2-sudeep.holla@arm.com Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org> Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
Diffstat (limited to 'drivers/firmware/arm_ffa/bus.c')
-rw-r--r--drivers/firmware/arm_ffa/bus.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/firmware/arm_ffa/bus.c b/drivers/firmware/arm_ffa/bus.c
index 641a91819088..69328041fbc3 100644
--- a/drivers/firmware/arm_ffa/bus.c
+++ b/drivers/firmware/arm_ffa/bus.c
@@ -167,7 +167,8 @@ bool ffa_device_is_valid(struct ffa_device *ffa_dev)
return valid;
}
-struct ffa_device *ffa_device_register(const uuid_t *uuid, int vm_id)
+struct ffa_device *ffa_device_register(const uuid_t *uuid, int vm_id,
+ const struct ffa_dev_ops *ops)
{
int ret;
struct device *dev;
@@ -183,6 +184,7 @@ struct ffa_device *ffa_device_register(const uuid_t *uuid, int vm_id)
dev_set_name(&ffa_dev->dev, "arm-ffa-%04x", vm_id);
ffa_dev->vm_id = vm_id;
+ ffa_dev->ops = ops;
uuid_copy(&ffa_dev->uuid, uuid);
ret = device_register(&ffa_dev->dev);