linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Lars-Peter Clausen <lars@metafoo.de>,
	Roberta Dobrescu <roberta.dobrescu@gmail.com>,
	linux-iio@vger.kernel.org
Cc: daniel.baluta@intel.com, octavian.purdila@intel.com,
	knaack.h@gmx.de, pmeerw@pmeerw.net, vlad.dogaru@intel.com
Subject: Re: [PATCH] iio: accel: mma9551: Check gpiod_to_irq return value
Date: Sat, 07 Mar 2015 19:08:47 +0000	[thread overview]
Message-ID: <54FB4CBF.3070408@kernel.org> (raw)
In-Reply-To: <54F4471E.1090705@metafoo.de>

On 02/03/15 11:18, Lars-Peter Clausen wrote:
> On 03/02/2015 11:39 AM, Roberta Dobrescu wrote:
>> The return value of gpiod_to_irq should be checked before giving
>> it to devm_request_threaded_irq in order to not pass an error
>> code in case it fails.
>>
>> Signed-off-by: Roberta Dobrescu <roberta.dobrescu@gmail.com>
>> Reviewed-by: Vlad Dogaru <vlad.dogaru@intel.com>
>> ---
>> gpiod_to_irq also appears in the following drivers:
>>     * drivers/iio/accel/bmc150-accel.c
>>     * drivers/iio/accel/kxcjk-1013.c
>>     * drivers/iio/accel/mma9553.c
>>     * drivers/iio/gyro/bmg160.c
>>     * drivers/iio/imu/kmx61.c
>>     * drivers/iio/proximity/sx9500.c,
>>
>> something like this:
>>
>> <code>
>>     ret = gpiod_to_irq(gpio);
>>
>>     dev_dbg(dev, "GPIO resource, no:%d irq:%d\n", desc_to_gpio(gpio), ret);
>>
>>     return ret;
>> </code>
> 
> Only slightly related, but why are these drivers even using GPIOs to
> get the IRQs. As far as I can see the GPIOs are not used otherwise in
> which case they should rather request the IRQ directly than going
> making the detour via the GPIO.
My understanding of this is that it's down to the ACPI provided data
which gives us a gpio rather than the more correct irqs. I don't know
if there is a simple way of avoiding this silliness and getting the irq
directly.  We keep ending up with the same bit of code so certainly
feels like there should be (whatever ACPI itself is providing).

Jonathan
> 
> - Lars
> 
> -- 
> To unsubscribe from this list: send the line "unsubscribe linux-iio" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html


  reply	other threads:[~2015-03-07 19:08 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-02 10:39 [PATCH] iio: accel: mma9551: Check gpiod_to_irq return value Roberta Dobrescu
2015-03-02 11:18 ` Lars-Peter Clausen
2015-03-07 19:08   ` Jonathan Cameron [this message]
2015-03-02 14:09 ` Daniel Baluta
2015-03-02 16:15   ` Uwe Kleine-König
2015-03-03  7:02     ` Vlad Dogaru
2015-03-08 11:03       ` Jonathan Cameron
2015-03-09 12:34         ` Vlad Dogaru
2015-03-09 13:29           ` 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=54FB4CBF.3070408@kernel.org \
    --to=jic23@kernel.org \
    --cc=daniel.baluta@intel.com \
    --cc=knaack.h@gmx.de \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=octavian.purdila@intel.com \
    --cc=pmeerw@pmeerw.net \
    --cc=roberta.dobrescu@gmail.com \
    --cc=vlad.dogaru@intel.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;
as well as URLs for NNTP newsgroup(s).