Re: [PATCH RESEND v3 12/17] iio: adc: ad7768-1: Add GPIO controller support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2/28/25 2:52 AM, Linus Walleij wrote:
> On Thu, Feb 20, 2025 at 11:27 PM David Lechner <dlechner@xxxxxxxxxxxx> 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.





[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux