Received: by 2002:a05:7412:b10a:b0:f3:1519:9f41 with SMTP id az10csp2840151rdb; Mon, 4 Dec 2023 08:52:14 -0800 (PST) X-Google-Smtp-Source: AGHT+IESmJV9C98oIB5rnizkozvMv+XORkELEbPxxzAv7O0GnMgXLVzAp9HsCbxE8Ifzdrk2nvG8 X-Received: by 2002:a05:6a20:1aaa:b0:18a:e0de:dd51 with SMTP id ci42-20020a056a201aaa00b0018ae0dedd51mr1411719pzb.26.1701708734399; Mon, 04 Dec 2023 08:52:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701708734; cv=none; d=google.com; s=arc-20160816; b=AmosmSwMhyFT5TRlClD2oB7+h2F+2lEYPVCxKkZhf1wo+ee2t8XWIR1GdZj9arYtyP RhJi+6beotoG5SMrQZLClqLRkj+xVtI3MWWnmDaNAQz/OjMJvVmYmYNT5SyqMZ/xirDi nGYEyiok+cSbciS4B7lqIdP+a4k1VFYOrKkZmlka5fsVL+bgAvU7+VFg9bHVf5QPNEPx CpjffVYXFslWar1btw+MZi3OXjfSxJBUUC+uspkCTvLSXCLNF7maE+5u4fsZudHQr+5H wY88gGfbvyrBetHFA+lLBmvNCaYwRPVAiw0Kbf1e/fDG9ztmyH+bGSJrxH+DhxkzmL9b lfKQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=4Vg70WJqdTvxOGPYd99KVdxDdrS3Wyod2RSP+B1nCxA=; fh=c/tkLwzY7yoFknOAoBhSdsKcnVJX4MRdVht2WXVpnsk=; b=zdFVXq2Hao8ZObLg7Vj+OsJGj7yt/a8yahg5WKvPRj3rHtvcqdkM1GkHOIx5yjtpCC 3Lq1op1VF9Bm7s9UGaimj7QmgnC+YauKngv0U8jorzn4a4fCIGudk+HtjtJMvgl1K/bd rLEa/GLmWPsEMWz04HeFFPwctUTzK7EFNRbq/v9N60noxv8Y70G2uZFluN4zeZUb9Oy1 nWp/LHmQp+a/x+5AoMEdktkeJbI6q+MRBBExJ3x9I9+QJKm6sr4cepCRkkM+3IKlXHF9 8NaEUpR7JL8xhDlqzUomjTY1KGP8yyYJ8ktikedjIjel67s7alq47Q16Icg6bfSm69q6 ROVw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Ba7t9+j+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id fb21-20020a056a002d9500b006cd84368e8dsi8198342pfb.190.2023.12.04.08.52.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Dec 2023 08:52:14 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) client-ip=23.128.96.38; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Ba7t9+j+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id B52F880615D1; Mon, 4 Dec 2023 08:52:08 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231341AbjLDQvh (ORCPT + 99 others); Mon, 4 Dec 2023 11:51:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35334 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229513AbjLDQvd (ORCPT ); Mon, 4 Dec 2023 11:51:33 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 86EA7AC for ; Mon, 4 Dec 2023 08:51:40 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 45BDCC433C7; Mon, 4 Dec 2023 16:51:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1701708700; bh=fFXmEBT5AMl/e+v8v12kevHaf03zfjvJ1t3IxHwqbNU=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=Ba7t9+j+aC25aU7nX6xksyw/rfPPpMj8n/VfYLO3TpnArg0UAv+E45421nE8y0/MD X/gOjv+U2EF1gFDddOk4wwf1RH2PkfuK7S4A0l8V4DZOOM/QRmWZRuQKeIdMjPjZYq +48Nn6abrEeP3GxF0y2czaNjOvlsx+Ui2CNXmL9ztENe4cWVShNwgwUtcIvaZRd+C3 XVe9xHXL0/5+Mzx3NiNSr+N8KWkW6mUYUAEP0ZT4EK+qFJsLUbcDyBSSap4l6FeqAV FWW4fvXp4I65VA03n8S1icgb0ke9JYVz+nBnRAdwp7ekbD+PKW0ugEa0hGxlwpX3FH lc0IBcv3zSBww== Date: Mon, 4 Dec 2023 16:51:29 +0000 From: Jonathan Cameron To: Nuno =?UTF-8?B?U8Oh?= Cc: Nuno Sa via B4 Relay , nuno.sa@analog.com, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-iio@vger.kernel.org, Olivier MOYSAN , Greg Kroah-Hartman , "Rafael J. Wysocki" , Rob Herring , Frank Rowand , Lars-Peter Clausen , Michael Hennerich Subject: Re: [PATCH 06/12] iio: adc: ad9467: add mutex to struct ad9467_state Message-ID: <20231204165129.130e189c@jic23-huawei> In-Reply-To: <69a7ca77055fc57cff6d6be95fb5796723171230.camel@gmail.com> References: <20231121-dev-iio-backend-v1-0-6a3d542eba35@analog.com> <20231121-dev-iio-backend-v1-6-6a3d542eba35@analog.com> <20231204152301.6c212539@jic23-huawei> <69a7ca77055fc57cff6d6be95fb5796723171230.camel@gmail.com> X-Mailer: Claws Mail 4.1.1 (GTK 3.24.38; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Mon, 04 Dec 2023 08:52:09 -0800 (PST) On Mon, 04 Dec 2023 17:10:01 +0100 Nuno S=C3=A1 wrote: > On Mon, 2023-12-04 at 15:23 +0000, Jonathan Cameron wrote: > > On Tue, 21 Nov 2023 11:20:19 +0100 > > Nuno Sa via B4 Relay wrote: > > =20 > > > From: Nuno Sa > > >=20 > > > When calling ad9467_set_scale(), multiple calls to ad9467_spi_write() > > > are done which means we need to properly protect the whole operation = so > > > we are sure we will be in a sane state if two concurrent calls occur. > > >=20 > > > Fixes: ad6797120238 ("iio: adc: ad9467: add support AD9467 ADC") > > > Signed-off-by: Nuno Sa > > > --- > > > =C2=A0drivers/iio/adc/ad9467.c | 6 +++++- > > > =C2=A01 file changed, 5 insertions(+), 1 deletion(-) > > >=20 > > > diff --git a/drivers/iio/adc/ad9467.c b/drivers/iio/adc/ad9467.c > > > index 04474dbfa631..91821dee03b7 100644 > > > --- a/drivers/iio/adc/ad9467.c > > > +++ b/drivers/iio/adc/ad9467.c > > > @@ -4,7 +4,7 @@ > > > =C2=A0 * > > > =C2=A0 * Copyright 2012-2020 Analog Devices Inc. > > > =C2=A0 */ > > > - > > > +#include > > > =C2=A0#include > > > =C2=A0#include > > > =C2=A0#include > > > @@ -122,6 +122,8 @@ struct ad9467_state { > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0unsigned int=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0output_mode; > > > =C2=A0 > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0struct gpio_desc=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0*pwrdown_gpio; > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0/* protect against concurr= ent accesses to the device */ =20 > > Not very specific.=C2=A0 Concurrent access usually fine at granularity = of > > individual read/write as the bus locks protect it.=C2=A0 What state > > is actually being protected?=C2=A0 A shared buffer or some state that we > > need to ensure remains consistent between driver and device? =20 >=20 > At this point not any buffer/data... Just making sure things remain consi= stent > (typical case when you have multiple reads/writes to the device). That's = why a tried > to emphasize "accesses to the device". Maybe I should make it explicit I'= m speaking > about multiple reads/writes. Talk about the data or state rather than the access to it. Something like 'ensure consistent state obtained on multiple related accesses.' Or if it's RMW then say that. >=20 > - Nuno S=C3=A1 > > =20 >=20