mirror of
https://github.com/lkl/linux.git
synced 2025-12-19 16:13:19 +09:00
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>
This commit is contained in:
@@ -17,6 +17,7 @@ struct ffa_device {
|
||||
bool mode_32bit;
|
||||
uuid_t uuid;
|
||||
struct device dev;
|
||||
const struct ffa_dev_ops *ops;
|
||||
};
|
||||
|
||||
#define to_ffa_dev(d) container_of(d, struct ffa_device, dev)
|
||||
@@ -47,7 +48,8 @@ static inline void *ffa_dev_get_drvdata(struct ffa_device *fdev)
|
||||
}
|
||||
|
||||
#if IS_REACHABLE(CONFIG_ARM_FFA_TRANSPORT)
|
||||
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);
|
||||
void ffa_device_unregister(struct ffa_device *ffa_dev);
|
||||
int ffa_driver_register(struct ffa_driver *driver, struct module *owner,
|
||||
const char *mod_name);
|
||||
@@ -57,7 +59,8 @@ const struct ffa_dev_ops *ffa_dev_ops_get(struct ffa_device *dev);
|
||||
|
||||
#else
|
||||
static inline
|
||||
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)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user