summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSudeep Holla <sudeep.holla@arm.com>2023-10-05 18:56:40 +0100
committerSudeep Holla <sudeep.holla@arm.com>2023-10-06 15:32:47 +0100
commit22779149e93d956e9d266f545b26e548bf5b132d (patch)
tree520438453e1085537177b8ff5cc097bcea49e988
parent2d698e8b4fd22374dac0a2d5150ab24d57a222ab (diff)
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>
-rw-r--r--drivers/firmware/arm_ffa/bus.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/drivers/firmware/arm_ffa/bus.c b/drivers/firmware/arm_ffa/bus.c
index 7865438b3696..1c7940ba5539 100644
--- a/drivers/firmware/arm_ffa/bus.c
+++ b/drivers/firmware/arm_ffa/bus.c
@@ -15,6 +15,8 @@
#include "common.h"
+#define SCMI_UEVENT_MODALIAS_FMT "arm_ffa:%04x:%pUb"
+
static DEFINE_IDA(ffa_bus_id);
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);
- 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);
}
+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,
struct device_attribute *attr, char *buf)
{
@@ -88,6 +100,7 @@ static DEVICE_ATTR_RO(uuid);
static struct attribute *ffa_device_attributes_attrs[] = {
&dev_attr_partition_id.attr,
&dev_attr_uuid.attr,
+ &dev_attr_modalias.attr,
NULL,
};
ATTRIBUTE_GROUPS(ffa_device_attributes);