firmware: arm_ffa: Emit modalias for FF-A devices

In order to enable libkmod lookups for FF-A device objects to their
corresponding module, add 'modalias' to the base attribute of FF-A
devices.

Tested-by: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
Link: https://lore.kernel.org/r/20231005175640.379631-1-sudeep.holla@arm.com
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
This commit is contained in:
Sudeep Holla 2023-10-05 18:56:40 +01:00
parent 2d698e8b4f
commit 22779149e9

View File

@ -15,6 +15,8 @@
#include "common.h" #include "common.h"
#define SCMI_UEVENT_MODALIAS_FMT "arm_ffa:%04x:%pUb"
static DEFINE_IDA(ffa_bus_id); static DEFINE_IDA(ffa_bus_id);
static int ffa_device_match(struct device *dev, struct device_driver *drv) static int ffa_device_match(struct device *dev, struct device_driver *drv)
@ -63,10 +65,20 @@ static int ffa_device_uevent(const struct device *dev, struct kobj_uevent_env *e
{ {
const struct ffa_device *ffa_dev = to_ffa_dev(dev); const struct ffa_device *ffa_dev = to_ffa_dev(dev);
return add_uevent_var(env, "MODALIAS=arm_ffa:%04x:%pUb", return add_uevent_var(env, "MODALIAS=" SCMI_UEVENT_MODALIAS_FMT,
ffa_dev->vm_id, &ffa_dev->uuid); ffa_dev->vm_id, &ffa_dev->uuid);
} }
static ssize_t modalias_show(struct device *dev,
struct device_attribute *attr, char *buf)
{
struct ffa_device *ffa_dev = to_ffa_dev(dev);
return sysfs_emit(buf, SCMI_UEVENT_MODALIAS_FMT, ffa_dev->vm_id,
&ffa_dev->uuid);
}
static DEVICE_ATTR_RO(modalias);
static ssize_t partition_id_show(struct device *dev, static ssize_t partition_id_show(struct device *dev,
struct device_attribute *attr, char *buf) struct device_attribute *attr, char *buf)
{ {
@ -88,6 +100,7 @@ static DEVICE_ATTR_RO(uuid);
static struct attribute *ffa_device_attributes_attrs[] = { static struct attribute *ffa_device_attributes_attrs[] = {
&dev_attr_partition_id.attr, &dev_attr_partition_id.attr,
&dev_attr_uuid.attr, &dev_attr_uuid.attr,
&dev_attr_modalias.attr,
NULL, NULL,
}; };
ATTRIBUTE_GROUPS(ffa_device_attributes); ATTRIBUTE_GROUPS(ffa_device_attributes);