From: "Ardelean, Alexandru" <alexandru.Ardelean@analog.com>
To: "lars@metafoo.de" <lars@metafoo.de>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"knaack.h@gmx.de" <knaack.h@gmx.de>,
"jic23@kernel.org" <jic23@kernel.org>,
"Hennerich, Michael" <Michael.Hennerich@analog.com>,
"linux-iio@vger.kernel.org" <linux-iio@vger.kernel.org>,
"devel@driverdev.osuosl.org" <devel@driverdev.osuosl.org>,
"pmeerw@pmeerw.net" <pmeerw@pmeerw.net>,
"gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>,
"shreeya.patel23498@gmail.com" <shreeya.patel23498@gmail.com>
Subject: Re: [PATCH v2 5/5] Staging: iio: adt7316: Use device tree data to assign irq_type
Date: Wed, 21 Nov 2018 08:21:28 +0000 [thread overview]
Message-ID: <8f659e4351a9b2511658b01c0b18bed94ef72802.camel@analog.com> (raw)
In-Reply-To: <20181120170036.7403-1-shreeya.patel23498@gmail.com>
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@gmail.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(chip-
> >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.
>
> ret = devm_request_threaded_irq(dev, chip->bus.irq,
> NULL,
next prev parent reply other threads:[~2018-11-21 8:21 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-20 17:00 Shreeya Patel
2018-11-21 8:21 ` Ardelean, Alexandru [this message]
2018-11-21 9:32 ` Shreeya Patel
2018-11-25 11:53 ` Jonathan Cameron
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8f659e4351a9b2511658b01c0b18bed94ef72802.camel@analog.com \
--to=alexandru.ardelean@analog.com \
--cc=Michael.Hennerich@analog.com \
--cc=devel@driverdev.osuosl.org \
--cc=gregkh@linuxfoundation.org \
--cc=jic23@kernel.org \
--cc=knaack.h@gmx.de \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pmeerw@pmeerw.net \
--cc=shreeya.patel23498@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®