From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.5 required=3.0 tests=BAYES_00,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_2 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2BCE6C433DB for ; Sun, 24 Jan 2021 13:30:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DCC69227BF for ; Sun, 24 Jan 2021 13:30:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725789AbhAXNat convert rfc822-to-8bit (ORCPT ); Sun, 24 Jan 2021 08:30:49 -0500 Received: from mail.kernel.org ([198.145.29.99]:44538 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725788AbhAXNas (ORCPT ); Sun, 24 Jan 2021 08:30:48 -0500 Received: from archlinux (cpc108967-cmbg20-2-0-cust86.5-4.cable.virginm.net [81.101.6.87]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 9F9E322583; Sun, 24 Jan 2021 13:30:06 +0000 (UTC) Date: Sun, 24 Jan 2021 13:30:03 +0000 From: Jonathan Cameron To: Nuno =?UTF-8?B?U8Oh?= Cc: , , Rob Herring , Peter Meerwald-Stadler , Lars-Peter Clausen , Michael Hennerich , Alexandru Ardelean Subject: Re: [PATCH 1/4] iio: adis: add helpers for locking Message-ID: <20210124133003.6005f9e6@archlinux> In-Reply-To: <20210121114954.64156-2-nuno.sa@analog.com> References: <20210121114954.64156-1-nuno.sa@analog.com> <20210121114954.64156-2-nuno.sa@analog.com> X-Mailer: Claws Mail 3.17.8 (GTK+ 2.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org On Thu, 21 Jan 2021 12:49:51 +0100 Nuno Sá wrote: > Add some helpers to lock and unlock the device. > > Signed-off-by: Nuno Sá Hi Nuno For a patch like this I'd also expect to see it immediately used in all relevant places in the driver. I don't want a mixture going forwards of this vs direct access to the lock. No need to separate that into two patches for such a simple case just introduce this and put it to use. There aren't that many call sites anyway from a quick grep. Thanks, Jonathan > --- > include/linux/iio/imu/adis.h | 10 ++++++++++ > 1 file changed, 10 insertions(+) > > diff --git a/include/linux/iio/imu/adis.h b/include/linux/iio/imu/adis.h > index 04e96d688ba9..f9b728d490b1 100644 > --- a/include/linux/iio/imu/adis.h > +++ b/include/linux/iio/imu/adis.h > @@ -428,6 +428,16 @@ static inline int adis_initial_startup(struct adis *adis) > return ret; > } > > +static inline void adis_dev_lock(struct adis *adis) > +{ > + mutex_lock(&adis->state_lock); > +} > + > +static inline void adis_dev_unlock(struct adis *adis) > +{ > + mutex_unlock(&adis->state_lock); > +} > + > int adis_single_conversion(struct iio_dev *indio_dev, > const struct iio_chan_spec *chan, unsigned int error_mask, > int *val);