[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAHp75VfHkKC81EinO+oN1b0=NRkwmNBLPky=HkrvPJCmt4njDQ@mail.gmail.com>
Date: Wed, 23 Apr 2025 00:03:38 +0300
From: Andy Shevchenko <andy.shevchenko@...il.com>
To: David Lechner <dlechner@...libre.com>
Cc: Jonathan Cameron <jic23@...nel.org>, Nuno Sá <nuno.sa@...log.com>,
Andy Shevchenko <andy@...nel.org>, Lars-Peter Clausen <lars@...afoo.de>,
Michael Hennerich <Michael.Hennerich@...log.com>, Guillaume Ranquet <granquet@...libre.com>,
Jonathan Cameron <Jonathan.Cameron@...wei.com>, linux-iio@...r.kernel.org,
linux-kernel@...r.kernel.org, kernel test robot <lkp@...el.com>
Subject: Re: [PATCH] iio: adc: ad7173: fix compiling without gpiolib
On Tue, Apr 22, 2025 at 11:12 PM David Lechner <dlechner@...libre.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.
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists