summaryrefslogtreecommitdiffstats
path: root/drivers/rpmsg
diff options
context:
space:
mode:
authorBjorn Andersson <bjorn.andersson@linaro.org>2017-06-28 14:53:23 -0700
committerBjorn Andersson <bjorn.andersson@linaro.org>2017-06-28 21:49:24 -0700
commitf4ce85281139214cd50900d0ff38b7d97766318f (patch)
tree997573742e93b02c14df766bc912a751a6ffdb68 /drivers/rpmsg
parent82e484dfef0bb29ca1a82740f2b8100cd0a64df3 (diff)
downloadlinux-f4ce85281139214cd50900d0ff38b7d97766318f.tar.bz2
rpmsg: Make modalias work for DeviceTree based devices
When rpmsg devices are expected to be matched based on their compatible the modalias should reflect this, so that module autoloading has a chance to match and load the appropriate module. Tested-by: Rob Clark <robdclark@gmail.com> Reported-by: Rob Clark <robdclark@gmail.com> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Diffstat (limited to 'drivers/rpmsg')
-rw-r--r--drivers/rpmsg/rpmsg_core.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/rpmsg/rpmsg_core.c b/drivers/rpmsg/rpmsg_core.c
index c89edaf6133b..c8a1327bf144 100644
--- a/drivers/rpmsg/rpmsg_core.c
+++ b/drivers/rpmsg/rpmsg_core.c
@@ -342,6 +342,11 @@ static ssize_t modalias_show(struct device *dev,
struct device_attribute *attr, char *buf)
{
struct rpmsg_device *rpdev = to_rpmsg_device(dev);
+ ssize_t len;
+
+ len = of_device_modalias(dev, buf, PAGE_SIZE);
+ if (len != -ENODEV)
+ return len;
return sprintf(buf, RPMSG_DEVICE_MODALIAS_FMT "\n", rpdev->id.name);
}
@@ -384,6 +389,11 @@ static int rpmsg_dev_match(struct device *dev, struct device_driver *drv)
static int rpmsg_uevent(struct device *dev, struct kobj_uevent_env *env)
{
struct rpmsg_device *rpdev = to_rpmsg_device(dev);
+ int ret;
+
+ ret = of_device_uevent_modalias(dev, env);
+ if (ret != -ENODEV)
+ return ret;
return add_uevent_var(env, "MODALIAS=" RPMSG_DEVICE_MODALIAS_FMT,
rpdev->id.name);