[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230528180501.4cb28a76@jic23-huawei>
Date: Sun, 28 May 2023 18:05:01 +0100
From: Jonathan Cameron <jic23@...nel.org>
To: Matti Vaittinen <mazziesaccount@...il.com>
Cc: Matti Vaittinen <matti.vaittinen@...rohmeurope.com>,
Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
Daniel Scally <djrscally@...il.com>,
Heikki Krogerus <heikki.krogerus@...ux.intel.com>,
Sakari Ailus <sakari.ailus@...ux.intel.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
"Rafael J. Wysocki" <rafael@...nel.org>,
Wolfram Sang <wsa@...nel.org>,
Lars-Peter Clausen <lars@...afoo.de>,
Michael Hennerich <Michael.Hennerich@...log.com>,
Andreas Klinger <ak@...klinger.de>,
Marcin Wojtas <mw@...ihalf.com>,
Russell King <linux@...linux.org.uk>,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>,
Jonathan Neuschäfer <j.neuschaefer@....net>,
Linus Walleij <linus.walleij@...aro.org>,
Paul Cercueil <paul@...pouillou.net>,
Akhil R <akhilrajeev@...dia.com>, linux-acpi@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-i2c@...r.kernel.org,
linux-iio@...r.kernel.org, netdev@...r.kernel.org,
openbmc@...ts.ozlabs.org, linux-gpio@...r.kernel.org,
linux-mips@...r.kernel.org
Subject: Re: [PATCH v6 7/8] iio: cdc: ad7150: relax return value check for
IRQ get
On Fri, 26 May 2023 09:39:14 +0300
Matti Vaittinen <mazziesaccount@...il.com> wrote:
> fwnode_irq_get[_byname]() were changed to not return 0 anymore. The
> special error case where device-tree based IRQ mapping fails can't no
> longer be reliably detected from this return value. This yields a
> functional change in the driver where the mapping failure is treated as
> an error.
>
> The mapping failure can occur for example when the device-tree IRQ
> information translation call-back(s) (xlate) fail, IRQ domain is not
> found, IRQ type conflicts, etc. In most cases this indicates an error in
> the device-tree and special handling is not really required.
>
> One more thing to note is that ACPI APIs do not return zero for any
> failures so this special handling did only apply on device-tree based
> systems.
>
> Drop the special handling for DT mapping failures as these can no longer
> be separated from other errors at driver side. Change all failures in
> IRQ getting to be handled by continuing without the events instead of
> aborting the probe upon certain errors.
>
> Signed-off-by: Matti Vaittinen <mazziesaccount@...il.com>
I think this is the best we can do, though ideally I'd like to have
seen errors due to not being provided by firmware passed through and
firmware bug issues (where it provides an irq we can't get for some reason
shouted about - with the driver failing to probe.)
Still, it's an improvement and for some FW old code wouldn't have
done this either. Hence let's go with this approach.
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@...wei.com>
>
> ---
> Revision history:
> v5 => v6:
> - Never abort the probe when IRQ getting fails but continue without
> events.
>
> Please note that I don't have the hardware to test this change.
> Furthermore, testing this type of device-tree error cases is not
> trivial, as the question we probably dive in is "what happens with the
> existing users who have errors in the device-tree". Answering to this
> question is not simple.
>
> The first patch of the series changes the fwnode_irq_get() so this depends
> on the first patch of the series and should not be applied alone.
> ---
> drivers/iio/cdc/ad7150.c | 10 +++++-----
> 1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/iio/cdc/ad7150.c b/drivers/iio/cdc/ad7150.c
> index 79aeb0aaea67..c05e078bba16 100644
> --- a/drivers/iio/cdc/ad7150.c
> +++ b/drivers/iio/cdc/ad7150.c
> @@ -541,6 +541,7 @@ static int ad7150_probe(struct i2c_client *client)
> const struct i2c_device_id *id = i2c_client_get_device_id(client);
> struct ad7150_chip_info *chip;
> struct iio_dev *indio_dev;
> + bool use_irq = true;
> int ret;
>
> indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*chip));
> @@ -561,14 +562,13 @@ static int ad7150_probe(struct i2c_client *client)
>
> chip->interrupts[0] = fwnode_irq_get(dev_fwnode(&client->dev), 0);
> if (chip->interrupts[0] < 0)
> - return chip->interrupts[0];
> - if (id->driver_data == AD7150) {
> + use_irq = false;
> + else if (id->driver_data == AD7150) {
> chip->interrupts[1] = fwnode_irq_get(dev_fwnode(&client->dev), 1);
> if (chip->interrupts[1] < 0)
> - return chip->interrupts[1];
> + use_irq = false;
> }
> - if (chip->interrupts[0] &&
> - (id->driver_data == AD7151 || chip->interrupts[1])) {
> + if (use_irq) {
> irq_set_status_flags(chip->interrupts[0], IRQ_NOAUTOEN);
> ret = devm_request_threaded_irq(&client->dev,
> chip->interrupts[0],
Powered by blists - more mailing lists