Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1677281 > unrolled thread

[PATCH] spmi: Include OF based modalias in device uevent

Started byBjorn Andersson <bjorn.andersson@linaro.org>
First post2017-06-29 01:50 +0200
Last post2017-06-29 23:40 +0200
Articles 4 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] spmi: Include OF based modalias in device uevent Bjorn Andersson <bjorn.andersson@linaro.org> - 2017-06-29 01:50 +0200
    Re: [PATCH] spmi: Include OF based modalias in device uevent Rob Clark <robdclark@gmail.com> - 2017-06-29 04:00 +0200
    Re: [PATCH] spmi: Include OF based modalias in device uevent Stephen Boyd <sboyd@codeaurora.org> - 2017-06-29 23:10 +0200
      Re: [PATCH] spmi: Include OF based modalias in device uevent Bjorn Andersson <bjorn.andersson@linaro.org> - 2017-06-29 23:40 +0200

#1677281 — [PATCH] spmi: Include OF based modalias in device uevent

FromBjorn Andersson <bjorn.andersson@linaro.org>
Date2017-06-29 01:50 +0200
Subject[PATCH] spmi: Include OF based modalias in device uevent
Message-ID<tXuSD-1JD-11@gated-at.bofh.it>
Include the OF-based modalias in the uevent sent when registering SPMI
devices, so that user space has a chance to autoload the kernel module
for the device.

Reported-by: Rob Clark <robdclark@gmail.com>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
---

Based on the MODULE_ALIAS in the qcom-spmi-pmic it's likely that the original
author expected that the spmi-pmic-arb would create devices by the identifier
"pmic" and the spmi code would include a MODALIAS="spmi:pmic" in the uevent.

 drivers/spmi/spmi.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/drivers/spmi/spmi.c b/drivers/spmi/spmi.c
index 2b9b0941d9eb..6d23226e5f69 100644
--- a/drivers/spmi/spmi.c
+++ b/drivers/spmi/spmi.c
@@ -365,11 +365,23 @@ static int spmi_drv_remove(struct device *dev)
 	return 0;
 }
 
+static int spmi_drv_uevent(struct device *dev, struct kobj_uevent_env *env)
+{
+	int ret;
+
+	ret = of_device_uevent_modalias(dev, env);
+	if (ret != -ENODEV)
+		return ret;
+
+	return 0;
+}
+
 static struct bus_type spmi_bus_type = {
 	.name		= "spmi",
 	.match		= spmi_device_match,
 	.probe		= spmi_drv_probe,
 	.remove		= spmi_drv_remove,
+	.uevent		= spmi_drv_uevent,
 };
 
 /**
-- 
2.12.0

[toc] | [next] | [standalone]


#1677316

FromRob Clark <robdclark@gmail.com>
Date2017-06-29 04:00 +0200
Message-ID<tXwUq-1c2-13@gated-at.bofh.it>
In reply to#1677281
On Wed, Jun 28, 2017 at 7:44 PM, Bjorn Andersson
<bjorn.andersson@linaro.org> wrote:
> Include the OF-based modalias in the uevent sent when registering SPMI
> devices, so that user space has a chance to autoload the kernel module
> for the device.
>
> Reported-by: Rob Clark <robdclark@gmail.com>
> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>

Tested-by: Rob Clark <robdclark@gmail.com>

> ---
>
> Based on the MODULE_ALIAS in the qcom-spmi-pmic it's likely that the original
> author expected that the spmi-pmic-arb would create devices by the identifier
> "pmic" and the spmi code would include a MODALIAS="spmi:pmic" in the uevent.
>
>  drivers/spmi/spmi.c | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
>
> diff --git a/drivers/spmi/spmi.c b/drivers/spmi/spmi.c
> index 2b9b0941d9eb..6d23226e5f69 100644
> --- a/drivers/spmi/spmi.c
> +++ b/drivers/spmi/spmi.c
> @@ -365,11 +365,23 @@ static int spmi_drv_remove(struct device *dev)
>         return 0;
>  }
>
> +static int spmi_drv_uevent(struct device *dev, struct kobj_uevent_env *env)
> +{
> +       int ret;
> +
> +       ret = of_device_uevent_modalias(dev, env);
> +       if (ret != -ENODEV)
> +               return ret;
> +
> +       return 0;
> +}
> +
>  static struct bus_type spmi_bus_type = {
>         .name           = "spmi",
>         .match          = spmi_device_match,
>         .probe          = spmi_drv_probe,
>         .remove         = spmi_drv_remove,
> +       .uevent         = spmi_drv_uevent,
>  };
>
>  /**
> --
> 2.12.0
>

[toc] | [prev] | [next] | [standalone]


#1678201

FromStephen Boyd <sboyd@codeaurora.org>
Date2017-06-29 23:10 +0200
Message-ID<tXORk-4sl-11@gated-at.bofh.it>
In reply to#1677281
On 06/28, Bjorn Andersson wrote:
> Include the OF-based modalias in the uevent sent when registering SPMI
> devices, so that user space has a chance to autoload the kernel module
> for the device.
> 
> Reported-by: Rob Clark <robdclark@gmail.com>
> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
> ---

Reviewed-by: Stephen Boyd <sboyd@codeaurora.org>

I suppose we can delete the MODALIAS in the qcom-spmi-pmic file
too? That doesn't look like it could ever work

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project

[toc] | [prev] | [next] | [standalone]


#1678217

FromBjorn Andersson <bjorn.andersson@linaro.org>
Date2017-06-29 23:40 +0200
Message-ID<tXPkm-4Jc-23@gated-at.bofh.it>
In reply to#1678201
On Thu 29 Jun 14:04 PDT 2017, Stephen Boyd wrote:

> On 06/28, Bjorn Andersson wrote:
> > Include the OF-based modalias in the uevent sent when registering SPMI
> > devices, so that user space has a chance to autoload the kernel module
> > for the device.
> > 
> > Reported-by: Rob Clark <robdclark@gmail.com>
> > Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
> > ---
> 
> Reviewed-by: Stephen Boyd <sboyd@codeaurora.org>
> 
> I suppose we can delete the MODALIAS in the qcom-spmi-pmic file
> too? That doesn't look like it could ever work
> 

Right, it has never worked. Potentially we would like some SPMI based
modalias thing, but I'm not sure we have enough information about the
found device to create a meaningful alias.

Regards,
Bjorn

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web