[PATCH 0/7] iio: dac: Convert several drivers to devm_mutex_init()

David Carlier posted 7 patches 2 months, 1 week ago
drivers/iio/addac/ad74115.c | 5 ++++-
drivers/iio/dac/ad3552r.c   | 4 +++-
drivers/iio/dac/ad5686.c    | 4 +++-
drivers/iio/dac/ad5755.c    | 5 +++--
drivers/iio/dac/ad5758.c    | 4 +++-
drivers/iio/dac/ad7303.c    | 4 +++-
drivers/iio/dac/ltc2664.c   | 4 +++-
7 files changed, 22 insertions(+), 8 deletions(-)
[PATCH 0/7] iio: dac: Convert several drivers to devm_mutex_init()
Posted by David Carlier 2 months, 1 week ago
This series converts seven iio DAC/ADDAC drivers to use devm_mutex_init()
instead of mutex_init(). These drivers currently call mutex_init() in
probe but have no .remove() callback, so mutex_destroy() is never called
on device unbind.

Same pattern already accepted in iio for other drivers (e.g. ad5446,
ltc2688, ad7124, ad7606, vcnl4000, etc.).

David Carlier (7):
  iio: dac: ad3552r: Use devm_mutex_init()
  iio: dac: ad7303: Use devm_mutex_init()
  iio: dac: ad5758: Use devm_mutex_init()
  iio: dac: ad5755: Use devm_mutex_init()
  iio: dac: ad5686: Use devm_mutex_init()
  iio: dac: ltc2664: Use devm_mutex_init()
  iio: addac: ad74115: Use devm_mutex_init()

 drivers/iio/addac/ad74115.c | 5 ++++-
 drivers/iio/dac/ad3552r.c   | 4 +++-
 drivers/iio/dac/ad5686.c    | 4 +++-
 drivers/iio/dac/ad5755.c    | 5 +++--
 drivers/iio/dac/ad5758.c    | 4 +++-
 drivers/iio/dac/ad7303.c    | 4 +++-
 drivers/iio/dac/ltc2664.c   | 4 +++-
 7 files changed, 22 insertions(+), 8 deletions(-)

-- 
2.53.0
Re: [PATCH 0/7] iio: dac: Convert several drivers to devm_mutex_init()
Posted by David Lechner 2 months, 1 week ago
On 4/10/26 2:37 PM, David Carlier wrote:
> 
> This series converts seven iio DAC/ADDAC drivers to use devm_mutex_init()
> instead of mutex_init(). These drivers currently call mutex_init() in
> probe but have no .remove() callback, so mutex_destroy() is never called
> on device unbind.
> 
> Same pattern already accepted in iio for other drivers (e.g. ad5446,
> ltc2688, ad7124, ad7606, vcnl4000, etc.).
> 
> David Carlier (7):
>   iio: dac: ad3552r: Use devm_mutex_init()
>   iio: dac: ad7303: Use devm_mutex_init()
>   iio: dac: ad5758: Use devm_mutex_init()
>   iio: dac: ad5755: Use devm_mutex_init()
>   iio: dac: ad5686: Use devm_mutex_init()
>   iio: dac: ltc2664: Use devm_mutex_init()
>   iio: addac: ad74115: Use devm_mutex_init()
> 

Jonathan has mentioned before that he doesn't care to take patches like this
unless we are making other cleanups to the driver too. So we'll see what he
says this time.
Re: [PATCH 0/7] iio: dac: Convert several drivers to devm_mutex_init()
Posted by Jonathan Cameron 2 months ago
On Fri, 10 Apr 2026 15:03:33 -0500
David Lechner <dlechner@baylibre.com> wrote:

> On 4/10/26 2:37 PM, David Carlier wrote:
> > 
> > This series converts seven iio DAC/ADDAC drivers to use devm_mutex_init()
> > instead of mutex_init(). These drivers currently call mutex_init() in
> > probe but have no .remove() callback, so mutex_destroy() is never called
> > on device unbind.
> > 
> > Same pattern already accepted in iio for other drivers (e.g. ad5446,
> > ltc2688, ad7124, ad7606, vcnl4000, etc.).
> > 
> > David Carlier (7):
> >   iio: dac: ad3552r: Use devm_mutex_init()
> >   iio: dac: ad7303: Use devm_mutex_init()
> >   iio: dac: ad5758: Use devm_mutex_init()
> >   iio: dac: ad5755: Use devm_mutex_init()
> >   iio: dac: ad5686: Use devm_mutex_init()
> >   iio: dac: ltc2664: Use devm_mutex_init()
> >   iio: addac: ad74115: Use devm_mutex_init()
> >   
> 
> Jonathan has mentioned before that he doesn't care to take patches like this
> unless we are making other cleanups to the driver too. So we'll see what he
> says this time.
> 

The one time I'm more flexible on taking small changes is when they come
from someone new to the kernel.  A quick look suggests that's not quite true
of David, but David also doesn't seem to be an old hand.  So I'll take
this set, but no more of these please unless part of a more general
cleanup of a driver.  Maybe at somepoint in the future we'll have few enough
of these that it makes sense to do this for all of them, but right now there
are ~300 mutex_init() calls in IIO and don't want anywhere near that level
of churn when there are more useful things to do!

Applied to the testing branch of iio.git.

Thanks,

Jonathan
Re: [PATCH 0/7] iio: dac: Convert several drivers to devm_mutex_init()
Posted by David CARLIER 2 months ago
Hi Jonathan and thanks for your review, I ll remember for next times. Cheers.

On Mon, 20 Apr 2026 at 14:22, Jonathan Cameron <jic23@kernel.org> wrote:
>
> On Fri, 10 Apr 2026 15:03:33 -0500
> David Lechner <dlechner@baylibre.com> wrote:
>
> > On 4/10/26 2:37 PM, David Carlier wrote:
> > >
> > > This series converts seven iio DAC/ADDAC drivers to use devm_mutex_init()
> > > instead of mutex_init(). These drivers currently call mutex_init() in
> > > probe but have no .remove() callback, so mutex_destroy() is never called
> > > on device unbind.
> > >
> > > Same pattern already accepted in iio for other drivers (e.g. ad5446,
> > > ltc2688, ad7124, ad7606, vcnl4000, etc.).
> > >
> > > David Carlier (7):
> > >   iio: dac: ad3552r: Use devm_mutex_init()
> > >   iio: dac: ad7303: Use devm_mutex_init()
> > >   iio: dac: ad5758: Use devm_mutex_init()
> > >   iio: dac: ad5755: Use devm_mutex_init()
> > >   iio: dac: ad5686: Use devm_mutex_init()
> > >   iio: dac: ltc2664: Use devm_mutex_init()
> > >   iio: addac: ad74115: Use devm_mutex_init()
> > >
> >
> > Jonathan has mentioned before that he doesn't care to take patches like this
> > unless we are making other cleanups to the driver too. So we'll see what he
> > says this time.
> >
>
> The one time I'm more flexible on taking small changes is when they come
> from someone new to the kernel.  A quick look suggests that's not quite true
> of David, but David also doesn't seem to be an old hand.  So I'll take
> this set, but no more of these please unless part of a more general
> cleanup of a driver.  Maybe at somepoint in the future we'll have few enough
> of these that it makes sense to do this for all of them, but right now there
> are ~300 mutex_init() calls in IIO and don't want anywhere near that level
> of churn when there are more useful things to do!
>
> Applied to the testing branch of iio.git.
>
> Thanks,
>
> Jonathan