Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751626AbdF2Bux (ORCPT ); Wed, 28 Jun 2017 21:50:53 -0400 Received: from mail-lf0-f68.google.com ([209.85.215.68]:33148 "EHLO mail-lf0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751541AbdF2Buq (ORCPT ); Wed, 28 Jun 2017 21:50:46 -0400 MIME-Version: 1.0 In-Reply-To: <20170628234458.7917-1-bjorn.andersson@linaro.org> References: <20170628234458.7917-1-bjorn.andersson@linaro.org> From: Rob Clark Date: Wed, 28 Jun 2017 21:50:44 -0400 Message-ID: Subject: Re: [PATCH] spmi: Include OF based modalias in device uevent To: Bjorn Andersson Cc: Stephen Boyd , Linux Kernel Mailing List , linux-arm-msm Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1531 Lines: 51 On Wed, Jun 28, 2017 at 7:44 PM, 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 > Signed-off-by: Bjorn Andersson Tested-by: Rob Clark > --- > > 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 >