* [PATCH v2] rpmsg: Make modalias work for DeviceTree based devices
@ 2017-06-28 21:53 Bjorn Andersson
2017-06-29 23:06 ` Rob Clark
0 siblings, 1 reply; 2+ messages in thread
From: Bjorn Andersson @ 2017-06-28 21:53 UTC (permalink / raw)
To: Ohad Ben-Cohen, Bjorn Andersson; +Cc: linux-remoteproc, linux-kernel, Rob Clark
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>
---
Changes since v1:
- Also update rpmsg_uevent()
drivers/rpmsg/rpmsg_core.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/drivers/rpmsg/rpmsg_core.c b/drivers/rpmsg/rpmsg_core.c
index ad3d2a9df287..067650c5bcb6 100644
--- a/drivers/rpmsg/rpmsg_core.c
+++ b/drivers/rpmsg/rpmsg_core.c
@@ -343,6 +343,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);
}
@@ -387,6 +392,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);
--
2.12.0
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH v2] rpmsg: Make modalias work for DeviceTree based devices
2017-06-28 21:53 [PATCH v2] rpmsg: Make modalias work for DeviceTree based devices Bjorn Andersson
@ 2017-06-29 23:06 ` Rob Clark
0 siblings, 0 replies; 2+ messages in thread
From: Rob Clark @ 2017-06-29 23:06 UTC (permalink / raw)
To: Bjorn Andersson
Cc: Ohad Ben-Cohen, linux-remoteproc, Linux Kernel Mailing List
On Wed, Jun 28, 2017 at 5:53 PM, Bjorn Andersson
<bjorn.andersson@linaro.org> wrote:
> 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>
and also probably:
Cc: <stable@vger.kernel.org>
> ---
>
> Changes since v1:
> - Also update rpmsg_uevent()
>
> drivers/rpmsg/rpmsg_core.c | 10 ++++++++++
> 1 file changed, 10 insertions(+)
>
> diff --git a/drivers/rpmsg/rpmsg_core.c b/drivers/rpmsg/rpmsg_core.c
> index ad3d2a9df287..067650c5bcb6 100644
> --- a/drivers/rpmsg/rpmsg_core.c
> +++ b/drivers/rpmsg/rpmsg_core.c
> @@ -343,6 +343,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);
> }
> @@ -387,6 +392,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);
> --
> 2.12.0
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-06-29 23:06 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-28 21:53 [PATCH v2] rpmsg: Make modalias work for DeviceTree based devices Bjorn Andersson
2017-06-29 23:06 ` Rob Clark
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®