[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <ddb448f0-1cfc-497b-ac1f-9f3d9e9fcc3a@baylibre.com>
Date: Fri, 28 Feb 2025 09:55:59 -0600
From: David Lechner <dlechner@...libre.com>
To: Linus Walleij <linus.walleij@...aro.org>
Cc: Jonathan Santos <Jonathan.Santos@...log.com>, linux-iio@...r.kernel.org,
devicetree@...r.kernel.org, linux-kernel@...r.kernel.org,
Sergiu Cuciurean <sergiu.cuciurean@...log.com>, lars@...afoo.de,
Michael.Hennerich@...log.com, marcelo.schmitt@...log.com, jic23@...nel.org,
robh@...nel.org, krzk+dt@...nel.org, conor+dt@...nel.org,
jonath4nns@...il.com, marcelo.schmitt1@...il.com
Subject: Re: [PATCH RESEND v3 12/17] iio: adc: ad7768-1: Add GPIO controller
support
On 2/28/25 2:52 AM, Linus Walleij wrote:
> On Thu, Feb 20, 2025 at 11:27 PM David Lechner <dlechner@...libre.com> wrote:
>> On 2/19/25 2:34 PM, Linus Walleij wrote:
>
>>> Is it not possible to use the gpio regmap library in this driver
>>> like we do in drivers/iio/addac/stx104.c?
>>>
>>> It cuts down the code size of simple GPIO chips on random
>>> chips quite a lot.
>>
>> I think the answer is "no" since we need to hold a conditional lock
>> while accessing registers. Namely: iio_device_claim_direct_mode()/
>> iio_device_release_direct_mode().
>
> Sorry for potentially dumb question, but if this is required to access
> the registers, why is it not done in the regmap abstraction itself?
> It's kind of that stuff regmap is supposed to hide.
>
> Yours,
> Linus Walleij
In some cases, we need to do multiple regmap operations while
holding the lock. Moving it to the regmap abstraction would only
allow the lock to be held for each individual regmap_x() call.
That would leave us vulnerable to race conditions.
regmap_multi_reg_write() couldn't be used for this currently
either because regmap_lock does not allow for a conditional
lock.
Powered by blists - more mailing lists