Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp2122120lqp; Sun, 24 Mar 2024 04:20:23 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXEGnCDENg6opVCNqaak+HyCf2uzus0iWeoVZRZPbslIyeXMcmE7PfJLJtsSvIOGvHRsxBclG7Db3ZlqW+eEt0wBGIas5719WslwkmJ3Q== X-Google-Smtp-Source: AGHT+IF2T0EXh3yRjJ8xtL+YlD37JYcowVdEvDZuUTpTgU1sd29F1GrR/bsKnas22fBDSED1FPfZ X-Received: by 2002:a50:cc49:0:b0:56b:f54a:6eee with SMTP id n9-20020a50cc49000000b0056bf54a6eeemr2940217edi.0.1711279223390; Sun, 24 Mar 2024 04:20:23 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711279223; cv=pass; d=google.com; s=arc-20160816; b=S6JbPZn/f+C9+UBxck8/TefKuDdi3ZDknH7bC8I1JpZ85Re8RCF30DmkbEEkp94Z5Z ThW3PGzw2Xq7+3Gvv/PRw7sky8ZAGumS2JmZDZ76fRNnMyZzbTSmG2bNkLOLLwgRKD6y 7iaS4U9tXVVaQOeFQCiLUVzYqidWd6FUqxmJK+Kq6MPkc1Azh0ZGg27hLApzc3P1oHMa sxcvaqvQGfnKeR9W4tmM04g8G9/pQEB0pJDGBferot2ShmalPXcS3w9+Vfqfomi+cfcj iHv/uCmEaA+1I9e/NI3Ef3SPkkOuvtBbao7O6dhmAjNawDUB7C0liPmtoFMrjiK7AQGZ CAtQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :subject:cc:to:from:date:dkim-signature; bh=r0hyTO6VYi6RDdXruNldojW85WS1I2uS+Av5MvE5tZc=; fh=5qz+MjtH+DgodhGlQ6KpQbQDfbWjmtLGh9743vD1Hjs=; b=DrQOHHk/oPcLjgCWpuTC/G3a23kU9eNK1J2keel3xXOwC4zW/MCBU2BjDoMpyt/fDa lyikoQQIb8a3VYsHyh0Mes+Yrcr5IJkFbLRL1M+SIC9ql9nnragEOOGksFv9DbSm60sB 7L9oGodkowB2xuTQG98k3Ck6neYFB4vQo5FZpNWfGCyNanb2cKSVpqlMMKdcSSL3ba5E LpdO/HyM+EGId6jdNf9G8RSX5XnAEfQtYgH6vT9UZXlOt5qn63s+j4cT3SaEUvM5Gjhc FuPYw6JyzV1xPkPaPUZeEsudc6yAvz71K80EfTPCq49V3MlP4Yef56XyGV/dPaK33Lv5 ykdw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="rwv+bzx/"; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-112646-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-112646-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id w3-20020a056402268300b0056ba8b69020si1658562edd.35.2024.03.24.04.20.23 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 Mar 2024 04:20:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-112646-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="rwv+bzx/"; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-112646-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-112646-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 2140A1F211CC for ; Sun, 24 Mar 2024 11:20:23 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 40DA517730; Sun, 24 Mar 2024 11:20:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="rwv+bzx/" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 67A9A28E7; Sun, 24 Mar 2024 11:20:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711279215; cv=none; b=PWTwXoumwp7ivPUY9Pr3ws/loKrNJ1JL03BwR2uIaU42TzfDSwRaa21dPWmfTk899oogeCzO/SvC8y1IVpi70gx6OaV36Tg5USs2Qx3hCFsU/ZiGw4Yuy26K29TFI29wKJ7+mqGGNaxAn1+aMme9zskl1pFWOl/Yfz/gLIXjtac= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711279215; c=relaxed/simple; bh=tmuQFbjp+AOm8Ex/TvUHeaP+sZtrLKa6c/OkabdzZxg=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=HMNjwVHN0CXgKcCrwrNWCB+flm2b3v/Jzwaq1pukSpFit6jptI585BPi9pswjotWXWlbV8wf7MgwMX5OBmUgXsS0tTr3cL5QytX5GUhw2gOFkMdrJvGC4XyC1Fi7UBbOKcbk56Bzse3j/rtQGFL5C+Qyn+ZCN8rZyiKuABL6ri8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=rwv+bzx/; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6856FC433F1; Sun, 24 Mar 2024 11:20:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711279215; bh=tmuQFbjp+AOm8Ex/TvUHeaP+sZtrLKa6c/OkabdzZxg=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=rwv+bzx/sbIxAuXRyodp1ZxWf0xB3UWVIxNAYP5sjm7r/iawgLbbrxiPkvLEtZiAi z7WDnfoS5peNVZz0n++f1YdCuQqMJiObJ8fCeSQXj2Usei815kWl1tnXdYbvDie3gX nxJxoglWj1mscsEerJFo5xrQRBqDzJTpn3/vH7hnU6ovQeOYl6lGquk5zVvF5jDykr 8bG5kHggwxIw5IbH8uZJwV7hYTLIvdX3JRoetIvjHiGtoX86LZtt/Eo7fbbCmroUY9 W3MXiwLiiNXBXeFsvZDkmtmhNSEhxOH4lxhdIRfguFN77myUEtSvVOYoZQR5xo3ZN3 5+RtyAADZRINQ== Date: Sun, 24 Mar 2024 11:20:02 +0000 From: Jonathan Cameron To: Vasileios Amoiridis Cc: lars@metafoo.de, andriy.shevchenko@linux.intel.com, ang.iglesiasg@gmail.com, mazziesaccount@gmail.com, ak@it-klinger.de, petre.rodan@subdimension.ro, phil@raspberrypi.com, 579lpy@gmail.com, linus.walleij@linaro.org, semen.protsenko@linaro.org, linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, Jonathan Cameron Subject: Re: [PATCH v3 2/6] iio: pressure: Introduce new cleanup routines to BMP280 driver *_raw() functions Message-ID: <20240324112002.3173a269@jic23-huawei> In-Reply-To: <20240319002925.2121016-3-vassilisamir@gmail.com> References: <20240319002925.2121016-1-vassilisamir@gmail.com> <20240319002925.2121016-3-vassilisamir@gmail.com> X-Mailer: Claws Mail 4.2.0 (GTK 3.24.41; x86_64-pc-linux-gnu) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Tue, 19 Mar 2024 01:29:21 +0100 Vasileios Amoiridis wrote: > Introduce the new linux/cleanup.h with the guard(mutex) functionality > in the {read/write}_raw() functions > > Suggested-by: Andy Shevchenko > Suggested-by: Jonathan Cameron > Signed-off-by: Vasileios Amoiridis > --- > drivers/iio/pressure/bmp280-core.c | 125 +++++++++++++---------------- > 1 file changed, 58 insertions(+), 67 deletions(-) > > diff --git a/drivers/iio/pressure/bmp280-core.c b/drivers/iio/pressure/bmp280-core.c > index 871b2214121b..f7a13ff6f26c 100644 > --- a/drivers/iio/pressure/bmp280-core.c > +++ b/drivers/iio/pressure/bmp280-core.c > @@ -460,77 +460,74 @@ static int bmp280_read_humid(struct bmp280_data *data, int *val, int *val2) > return IIO_VAL_INT; > } > > -static int bmp280_read_raw(struct iio_dev *indio_dev, > - struct iio_chan_spec const *chan, > - int *val, int *val2, long mask) > +static int bmp280_read_raw_guarded(struct iio_dev *indio_dev, Why do we need the guarded naming? It always took the lock, no change just because we are doing that in a neater fashion. I don't see a reason for that name. Better to use something like _impl, or _internal as the prefix. I don't want to see people calling every function that uses guard _guarded(). > + struct iio_chan_spec const *chan, > + int *val, int *val2, long mask) Otherwise, I didn't find anything beyond what Andy already pointed out. So looks good in general. Jonathan