lkml.org 
[lkml]   [2017]   [Dec]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH] regmap: allow to disable all locking mechanisms
On Sun, Dec 10, 2017 at 5:14 PM, Bartosz Golaszewski <brgl@bgdev.pl> wrote:
> 2017-12-10 14:10 GMT+01:00 Andy Shevchenko <andy.shevchenko@gmail.com>:
>> On Wed, Dec 6, 2017 at 4:26 PM, Bartosz Golaszewski <brgl@bgdev.pl> wrote:
>>> We have a use case in the at24 EEPROM driver (recently converted to
>>> using regmap instead of raw i2c/smbus calls) where we read from/write
>>> to the regmap in a loop, while protecting the entire loop with
>>> a mutex.
>>>
>>> Currently this implicitly makes us use two mutexes - one in the driver
>>> and one in regmap. While browsing the code for similar use cases I
>>> noticed a significant number of places where locking *seems* redundant.
>>>
>>> Allow users to completely disable any locking mechanisms in regmap
>>> config.
>>
>>> +static void regmap_lock_unlock_empty(void *__map)
>>
>> ..._none()?
>>
>
> Too late, Mark already applied it.

Ah, Mark always works at speed of light!

>> Why not to introduce positive switch, namely
>> bool mutex_lock; // choose better name
>> and assign ..._none() by default?
>
> Because we don't want to break all the existing regmaps, if map->lock
> or map->unlock is empty, regmap core decides internally whether to use
> a mutex or a spinlock.

Good point.
So, it means the options like: nomutex (false — mutex is in use) or
nolock (true — disable locking).
From those the latter looks better to me and IIUC you went that way.

--
With Best Regards,
Andy Shevchenko

\
 
 \ /
  Last update: 2017-12-12 12:13    [W:0.048 / U:1.068 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site