[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20181125115320.08833521@archlinux>
Date: Sun, 25 Nov 2018 11:53:20 +0000
From: Jonathan Cameron <jic23@...nel.org>
To: Shreeya Patel <shreeya.patel23498@...il.com>
Cc: "Ardelean, Alexandru" <alexandru.Ardelean@...log.com>,
"lars@...afoo.de" <lars@...afoo.de>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"knaack.h@....de" <knaack.h@....de>,
"Hennerich, Michael" <Michael.Hennerich@...log.com>,
"linux-iio@...r.kernel.org" <linux-iio@...r.kernel.org>,
"devel@...verdev.osuosl.org" <devel@...verdev.osuosl.org>,
"pmeerw@...erw.net" <pmeerw@...erw.net>,
"gregkh@...uxfoundation.org" <gregkh@...uxfoundation.org>
Subject: Re: [PATCH v2 5/5] Staging: iio: adt7316: Use device tree data to
assign irq_type
On Wed, 21 Nov 2018 15:02:52 +0530
Shreeya Patel <shreeya.patel23498@...il.com> wrote:
> On Wed, 2018-11-21 at 08:21 +0000, Ardelean, Alexandru wrote:
> > On Tue, 2018-11-20 at 22:30 +0530, Shreeya Patel wrote:
> > > ADT7316 driver no more uses platform data and hence use device tree
> > > data instead of platform data for assigning irq_type field.
> > > Switch case figures out the type of irq and if it's the default
> > > case
> > > then assign the default value to the irq_type i.e.
> > > irq_type = IRQF_TRIGGER_LOW
> > >
> >
> > 1 comment inline
> >
> > > Signed-off-by: Shreeya Patel <shreeya.patel23498@...il.com>
> > > ---
> > > drivers/staging/iio/addac/adt7316.c | 21 +++++++++++++++++----
> > > 1 file changed, 17 insertions(+), 4 deletions(-)
> > >
> > > diff --git a/drivers/staging/iio/addac/adt7316.c
> > > b/drivers/staging/iio/addac/adt7316.c
> > > index 9c72538baf9e..c647875a64f5 100644
> > > --- a/drivers/staging/iio/addac/adt7316.c
> > > +++ b/drivers/staging/iio/addac/adt7316.c
> > > @@ -2101,8 +2101,7 @@ int adt7316_probe(struct device *dev, struct
> > > adt7316_bus *bus,
> > > {
> > > struct adt7316_chip_info *chip;
> > > struct iio_dev *indio_dev;
> > > - unsigned short *adt7316_platform_data = dev-
> > > >platform_data;
> > > - int irq_type = IRQF_TRIGGER_LOW;
> > > + int irq_type;
> > > int ret = 0;
> > >
> > > indio_dev = devm_iio_device_alloc(dev, sizeof(*chip));
> > > @@ -2146,8 +2145,22 @@ int adt7316_probe(struct device *dev, struct
> > > adt7316_bus *bus,
> > > indio_dev->modes = INDIO_DIRECT_MODE;
> > >
> > > if (chip->bus.irq > 0) {
> > > - if (adt7316_platform_data[0])
> > > - irq_type = adt7316_platform_data[0];
> > > + irq_type =
> > > + irqd_get_trigger_type(irq_get_irq_data(chi
> > > p-
> > > > bus.irq));
> > >
> > > +
> > > + switch (irq_type) {
> > > + case IRQF_TRIGGER_HIGH:
> > > + case IRQF_TRIGGER_RISING:
> > > + break;
> > > + case IRQF_TRIGGER_LOW:
> > > + case IRQF_TRIGGER_FALLING:
> > > + break;
> > > + default:
> > > + dev_info(dev, "mode %d unsupported, using
> > > IRQF_TRIGGER_LOW\n",
> > > + irq_type);
> > > + irq_type = IRQF_TRIGGER_LOW;
> > > + break;
> > > + }
> >
> > It would be an idea to move this part [together with
> > devm_request_threaded_irq()] into a "adt7316_setup_irq()" function.
> > To un-
> > clutter the code in the adt7316_probe() function.
> >
>
> Yes, seems like a good idea!
> Even other drivers are doing the same as you told me to do...thanks :)
>
> I'll do the change after Jonathan picks up the other patches and will
> wait for some other reviews to come up if there are any.
Agreed. This suggested change is good, so I'll leave this patch for now
on the basis it probably makes sense to do it as a short series focused
on that one element.
Thanks,
Jonathan
>
> Thanks
>
> > >
> > > ret = devm_request_threaded_irq(dev, chip-
> > > >bus.irq,
> > > NULL,
Powered by blists - more mailing lists