[PATCH v2 16/16] iio: core: move 'mlock' to 'struct iio_dev_opaque'

Jonathan Cameron jic23 at kernel.org
Sun Oct 9 04:48:15 PDT 2022


On Wed, 05 Oct 2022 10:40:03 +0200
Nuno Sá <noname.nuno at gmail.com> wrote:

> On Tue, 2022-10-04 at 17:21 +0300, Andy Shevchenko wrote:
> > On Tue, Oct 4, 2022 at 4:49 PM Nuno Sá <nuno.sa at analog.com> wrote:  
> > > 
> > > Now that there are no more users accessing 'mlock' directly, we can
> > > move
> > > it to the iio_dev private structure. Hence, it's now explicit that
> > > new
> > > driver's should not directly this lock.  
> > 
> > use this
> > 
> > 
> > I like the end result!
> > Reviewed-by: Andy Shevchenko <andy.shevchenko at gmail.com>
> > 
> > P.S. Shouldn't we annotate the respective APIs with might_sleep() and
> > Co (if it's not done yet)?
> > 
> >   
> 
> Hmm, I would say this is the same story as with sparse annotations... I
> guess, at least, might_sleep() would make sense but I think we should
> probably do it for the complete IIO subsystem where it makes sense
> instead of having it in just this new API.

We definitely could add such annotations.

From a documentation point of view that might be useful. 
From a protection / bug catching point of view the calls to mutex_lock()
should fire off much the same error reports, just one level down.

Jonathan

> 
> - Nuno Sá 
> 




More information about the linux-amlogic mailing list