Re: [PATCH v2 2/7] iio: fix devm_iio_trigger_alloc with parent.cocci

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 11 Dec 2020 09:47:58 +0200
Alexandru Ardelean <ardeleanalex@xxxxxxxxx> wrote:

> On Thu, Dec 10, 2020 at 10:42 PM Gwendal Grignou <gwendal@xxxxxxxxxxxx> wrote:
> >
> > Use cocci semantic patch:
> > @@
> > expression trigger, P, name;
> > @@
> >    trigger = devm_iio_trigger_alloc(P, ...);
> >    ...
> > -  trigger->dev.parent = P;
> >
> > To remove trigger->dev.parent, since it is set by default.
> >  
> 
> Reviewed-by: Alexandru Ardelean <alexandru.ardelean@xxxxxxxxxx>
> 
> > Signed-off-by: Gwendal Grignou <gwendal@xxxxxxxxxxxx>

There's a bonus one in here :)

Otherwise looks good.

Jonathan




> > diff --git a/drivers/iio/light/vcnl4035.c b/drivers/iio/light/vcnl4035.c
> > index 765c44adac57..e732d308ac4e 100644
> > --- a/drivers/iio/light/vcnl4035.c
> > +++ b/drivers/iio/light/vcnl4035.c
> > @@ -511,7 +511,6 @@ static int vcnl4035_probe_trigger(struct iio_dev *indio_dev)
> >         if (!data->drdy_trigger0)
> >                 return -ENOMEM;
> >
> > -       data->drdy_trigger0->dev.parent = indio_dev->dev.parent;
> >         data->drdy_trigger0->ops = &vcnl4035_trigger_ops;
> >         iio_trigger_set_drvdata(data->drdy_trigger0, indio_dev);
> >         ret = devm_iio_trigger_register(indio_dev->dev.parent,

This one is a bit obscured by the code.  I wonder it it would be sensible to
just pass the client->dev directly into vcnl4035_probe_trigger rather than
somewhat making us guess where it goes. Unrelated to your patch though.

> > diff --git a/drivers/iio/proximity/sx932x.c b/drivers/iio/proximity/sx932x.c
> > index 26503348ce85..95ad49e627c6 100644
> > --- a/drivers/iio/proximity/sx932x.c
> > +++ b/drivers/iio/proximity/sx932x.c
> > @@ -1336,7 +1336,6 @@ static int sx932x_probe(struct i2c_client *client,
> >                 if (!data->trig)
> >                         return -ENOMEM;
> >
> > -               data->trig->dev.parent = &client->dev;
> >                 data->trig->ops = &sx932x_trigger_ops;
> >                 iio_trigger_set_drvdata(data->trig, indio_dev);

There is no such driver in mainline yet.

I had the sudden horror that I'd let another wild card name in without
noticing and checked :)  We had a v1 of the patch, but currently
waiting for v2.

Jonathan

> >
> > --
> > 2.29.2.576.ga3fc446d84-goog
> >  




[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux