From: Jonathan Cameron <jic23@kernel.org>
To: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: "David Lechner" <dlechner@baylibre.com>,
"Nuno Sá" <nuno.sa@analog.com>,
"Andy Shevchenko" <andy@kernel.org>,
"Lars-Peter Clausen" <lars@metafoo.de>,
"Michael Hennerich" <Michael.Hennerich@analog.com>,
"Guillaume Ranquet" <granquet@baylibre.com>,
"Jonathan Cameron" <Jonathan.Cameron@huawei.com>,
linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org,
"kernel test robot" <lkp@intel.com>
Subject: Re: [PATCH] iio: adc: ad7173: fix compiling without gpiolib
Date: Sat, 26 Apr 2025 16:18:14 +0100 [thread overview]
Message-ID: <20250426161814.1bbf7f82@jic23-huawei> (raw)
In-Reply-To: <CAHp75VfHkKC81EinO+oN1b0=NRkwmNBLPky=HkrvPJCmt4njDQ@mail.gmail.com>
On Wed, 23 Apr 2025 00:03:38 +0300
Andy Shevchenko <andy.shevchenko@gmail.com> wrote:
> On Tue, Apr 22, 2025 at 11:12 PM David Lechner <dlechner@baylibre.com> wrote:
> >
> > Fix compiling the ad7173 driver when CONFIG_GPIOLIB is not set by
> > selecting GPIOLIB to be always enabled and remove the #if.
>
> I'm not sure we need to select GPIOLIB. If you want it, depend on it.
> GPIOLIB is not a hidden symbol, so why "select"?
>
> > Commit 031bdc8aee01 ("iio: adc: ad7173: add calibration support") placed
> > unrelated code in the middle of the #if IS_ENABLED(CONFIG_GPIOLIB) block
> > which caused the reported compile error.
> >
> > However, later commit 7530ed2aaa3f ("iio: adc: ad7173: add openwire
> > detection support for single conversions") makes use of the gpio regmap
> > even when we aren't providing gpio controller support. So it makes more
> > sense to always enable GPIOLIB rather than trying to make it optional.
>
> ...
>
> > Not related to the fix, but I also question the use of the regmap here.
> > This is one of the ad_sigma_delta drivers that does funny things with
> > the SPI bus, like keeping it locked during the entire time a buffer is
> > enabled. So, if someone tried to use a GPIO during a buffered read, the
> > GPIO call could block (waiting for the SPI bus mutex) until the buffer
> > is disabled, which could be an indefinitely long time. And to make it
> > even worse, this is not an interruptible wait, so the GPIO consumer
> > would effectively be deadlocked.
>
> I would say either the entire buffer mode is broken (in software), or
> hardware is broken and GPIO shouldn't be supported at all if the
> buffer mode is enabled. I think the best solution here is to remove
> the GPIO chip before enabling buffered mode. If GPIO is in use, fail
> the buffer mode.
I'd kind of assume that anyone using these GPIOs is doing it in a fashion
related closely to the ADC itself.
Can we make any other use fail more cleanly?
J
>
next prev parent reply other threads:[~2025-04-26 15:18 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-22 20:12 [PATCH] iio: adc: ad7173: fix compiling without gpiolib David Lechner
2025-04-22 21:03 ` Andy Shevchenko
2025-04-25 16:55 ` David Lechner
2025-04-25 18:08 ` Andy Shevchenko
2025-04-26 15:18 ` Jonathan Cameron [this message]
2025-04-26 22:45 ` David Lechner
2025-04-27 10:18 ` Jonathan Cameron
2025-04-26 15:15 ` 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=20250426161814.1bbf7f82@jic23-huawei \
--to=jic23@kernel.org \
--cc=Jonathan.Cameron@huawei.com \
--cc=Michael.Hennerich@analog.com \
--cc=andy.shevchenko@gmail.com \
--cc=andy@kernel.org \
--cc=dlechner@baylibre.com \
--cc=granquet@baylibre.com \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lkp@intel.com \
--cc=nuno.sa@analog.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