[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAE=gft7c8y7isdkoC6Bte6o5KPdzrgCVRAPje72CZcO5+VMdrQ@mail.gmail.com>
Date: Fri, 21 Dec 2018 09:56:37 -0800
From: Evan Green <evgreen@...omium.org>
To: Brian Norris <briannorris@...omium.org>
Cc: Andy Gross <andy.gross@...aro.org>,
Bjorn Andersson <bjorn.andersson@...aro.org>,
Ben Chan <benchan@...omium.org>, linux-arm-msm@...r.kernel.org,
David Brown <david.brown@...aro.org>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v1 1/2] soc: qcom: rmtfs-mem: Add class to enable uevents
On Thu, Dec 20, 2018 at 5:19 PM Brian Norris <briannorris@...omium.org> wrote:
>
> Hi Evan,
>
> On Mon, Dec 17, 2018 at 04:08:33PM -0800, Evan Green wrote:
> > Currently the qcom_rmtfs_memN devices are entirely invisible to the udev world.
> > Add a class to the rmtfs device so that uevents fire when the device is added.
> >
> > Signed-off-by: Evan Green <evgreen@...omium.org>
> > ---
> >
> > drivers/soc/qcom/rmtfs_mem.c | 23 ++++++++++++++++++-----
> > 1 file changed, 18 insertions(+), 5 deletions(-)
> >
> > diff --git a/drivers/soc/qcom/rmtfs_mem.c b/drivers/soc/qcom/rmtfs_mem.c
> > index 97bb5989aa211..0bf800ee2a978 100644
> > --- a/drivers/soc/qcom/rmtfs_mem.c
> > +++ b/drivers/soc/qcom/rmtfs_mem.c
> > @@ -132,6 +132,11 @@ static int qcom_rmtfs_mem_release(struct inode *inode, struct file *filp)
> > return 0;
> > }
> >
> > +static struct class rmtfs_class = {
> > + .owner = THIS_MODULE,
> > + .name = "rmtfs",
> > +};
> > +
> > static const struct file_operations qcom_rmtfs_mem_fops = {
> > .owner = THIS_MODULE,
> > .open = qcom_rmtfs_mem_open,
> > @@ -173,9 +178,15 @@ static int qcom_rmtfs_mem_probe(struct platform_device *pdev)
> >
> > }
> >
> > + ret = class_register(&rmtfs_class);
> > + if (ret)
> > + return ret;
>
> Hmm, is this how classes are supposed to work? Usually, you have the
> possibility of more than 1 device per class, and therefore you don't
> register the class in the driver probe -- you register it in the init()
> routine, or something similar. As it is, I expect this will break if
> there were ever a second rmtfs device.
>
Fair enough. I'll move this to an init routine.
Powered by blists - more mailing lists