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 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id AC710C48BF6 for ; Mon, 4 Mar 2024 13:28:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Content-Type: List-Subscribe:List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: In-Reply-To:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date: Reply-To:Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date :Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=ICKB37nDCLslkCeCj7BTBnY5BuB7iHF+8emTjiTJd2c=; b=cKMivWe2dGnJPjMxsHoSck46yw /mX3TU8+RegRROpvhQ1Kj2KTGdtuw9Fv7/Vs7g0XHqcNPktaa3wy6PQpupCafDGKWuYmfIRM0zbTp NjMbBFCsI9d/1C4HYFyEd1f89yviuNHilT+ApBUmu2S4Qzr1SS6IjhqDDBK7hmQCPtFz+PqYlvIdg Xev1iIK+Zrrr4UZn1yN2WvCCviFiuRBej6QuJG60+/lsiUEteBuskgxvVx7BK5iAM9Rg7Kfccr6Dw Zy4gPYHBfcquxGmNLYc6cOpjVTl96Ia/m7rpAYrJ/2gKG9WTfF+m6iQ1VcGTVB+S1wM6jviR2Kl5S qSKgj5bw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rh8Mk-000000099t7-06jd; Mon, 04 Mar 2024 13:28:26 +0000 Received: from mail-vs1-xe29.google.com ([2607:f8b0:4864:20::e29]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rh8Mg-000000099sC-3aGL for linux-arm-kernel@lists.infradead.org; Mon, 04 Mar 2024 13:28:25 +0000 Received: by mail-vs1-xe29.google.com with SMTP id ada2fe7eead31-4725acb539cso1195714137.3 for ; Mon, 04 Mar 2024 05:28:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1709558901; x=1710163701; darn=lists.infradead.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=NjMraSVWoQYij9IimFaQDDJ/jZpfa59SCn64UX2Kn1w=; b=Iyu+GQpVFTdTCf440Tcgp62V9slO8+xekHXfgqfkey50HqoavA5lWyAjsYNKaMblyu /YbJEaVmnC0DqrOcAZblFIaCka6Sdlhv5g9IOD2i8RXBUI/7hvP8yjORoQf21HdiADMi QNQEAbPMUZbypvCVvCr2fOMbcW90GszazUOPIltN3pFwZfO2Iy+G02sjY1SPXagG8kRa HnPp8DxTNzjLrThEhoykbPJQezktYsoG9Nl90hlM+vncKXurB/OhV41BhADHBgxdFyIa OEnVc67L04TetfNQkJ6HbxqjTyrxBBAvq34AAUph+81FDBx99iZ3aR21g0ArjIW6qVWe Yakw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709558901; x=1710163701; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=NjMraSVWoQYij9IimFaQDDJ/jZpfa59SCn64UX2Kn1w=; b=GKvtb4QB3eKBPt8m/no3RjDNTjsSIjB25kefxZCO5jeWIJcQvnUP1zhfvDx0V4W+4G QpLDsWo4qy5QuK5Fe/GHfnnj7g7ogiPpSuPJn4mj68hKOXWDiDs3HbFJV7ZdUmRMxPO1 OfNoNUjuIQBoXtFUCidRGv6T6Ra8i83e+JDo607lF/Ir6NqtRshI99oHHX4LwlFwX6Bg /2N1HSPByjVhiRr0xA93sYriG2VboPZZ9W9zVUHmwOCwwRxJdthzJFAsGIKYKf09I31j a3aFebgFHGejrmEuTt9JB/pHafo4sY/dd1rHEUQYokLrwwILzQFINfOwQ5hBmOh3ZVZx elRg== X-Forwarded-Encrypted: i=1; AJvYcCVfXhSaNYZhw9yjI0Uzv7/svlQCYeHpks+LC/u5OVNo49dMtS472EBEoBgqu43UxXh728glibRJNCP2eJ2vJzUaNO3lVbYqbKynk+tvLBQJQaNaz88= X-Gm-Message-State: AOJu0YzPV4iBRgU6N5J5ZujXLRO1A19rXFDIYf2hC/CCvEZB/DzYwf6a r4PRYOrfMeQOIFGTD0wwcqiBJXaRTLQiNwWfKH7vl9yfTfNi648HBvqEQcPWNQAAMgV5mp0kBUD 4UeU= X-Google-Smtp-Source: AGHT+IFNUcp5lCuJw/WrmiIEhGGpeoh92Mwt0K7neBcsKMFMWsKmNTMDAXJGVmmNz1sh8R24IW8udQ== X-Received: by 2002:a05:6102:35a:b0:471:f1a2:13c8 with SMTP id e26-20020a056102035a00b00471f1a213c8mr5222143vsa.11.1709558900667; Mon, 04 Mar 2024 05:28:20 -0800 (PST) Received: from ishi (072-189-067-006.res.spectrum.com. [72.189.67.6]) by smtp.gmail.com with ESMTPSA id fv5-20020a0561301a8500b007da5d981866sm1279109uab.31.2024.03.04.05.28.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Mar 2024 05:28:20 -0800 (PST) Date: Mon, 4 Mar 2024 08:28:17 -0500 From: William Breathitt Gray To: Fabrice Gasnier Cc: syednwaris@gmail.com, vigneshr@ti.com, jpanis@baylibre.com, alexandre.torgue@foss.st.com, linux-iio@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v5] counter: Introduce the COUNTER_COMP_FREQUENCY() macro Message-ID: References: <20240301102505.591918-1-fabrice.gasnier@foss.st.com> <562cdbfe-9353-4f5d-a804-34e158a190a7@foss.st.com> MIME-Version: 1.0 In-Reply-To: <562cdbfe-9353-4f5d-a804-34e158a190a7@foss.st.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240304_052822_970671_C1AB0FEF X-CRM114-Status: GOOD ( 30.53 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: multipart/mixed; boundary="===============6582921907735214287==" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org --===============6582921907735214287== Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="/Mh9QAouw/rxE4EG" Content-Disposition: inline --/Mh9QAouw/rxE4EG Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Mar 04, 2024 at 09:41:14AM +0100, Fabrice Gasnier wrote: > On 3/1/24 16:55, William Breathitt Gray wrote: > > On Fri, Mar 01, 2024 at 11:25:05AM +0100, Fabrice Gasnier wrote: > >> Now that there are two users for the "frequency" extension, introduce a > >> new COUNTER_COMP_FREQUENCY() macro. > >> This extension is intended to be a read-only signal attribute. > >> > >> Suggested-by: William Breathitt Gray > >> Signed-off-by: Fabrice Gasnier > >> --- > >> Changes in v5 > >> - "frequency" extension is read-only, so there's no need to provide > >> a write parameter. > >> - patch sent separately from "counter: Add stm32 timer events support"= [1] > >> [1] https://lore.kernel.org/lkml/20240227173803.53906-2-fabrice.gasnie= r@foss.st.com/ > >> --- > >> include/linux/counter.h | 7 +++++++ > >> 1 file changed, 7 insertions(+) > >> > >> diff --git a/include/linux/counter.h b/include/linux/counter.h > >> index 702e9108bbb4..0ac36f815b7d 100644 > >> --- a/include/linux/counter.h > >> +++ b/include/linux/counter.h > >> @@ -602,6 +602,13 @@ struct counter_array { > >> #define COUNTER_COMP_FLOOR(_read, _write) \ > >> COUNTER_COMP_COUNT_U64("floor", _read, _write) > >> =20 > >> +#define COUNTER_COMP_FREQUENCY(_read) \ > >> +{ \ > >> + .type =3D COUNTER_COMP_U64, \ > >> + .name =3D "frequency", \ > >> + .signal_u64_read =3D (_read), \ > >> +} > >> + > >> #define COUNTER_COMP_POLARITY(_read, _write, _available) \ > >> { \ > >> .type =3D COUNTER_COMP_SIGNAL_POLARITY, \ > >> --=20 > >> 2.25.1 > >=20 > > Hi Fabrice, > >=20 > > Setting the structure members directly works, but why not use > > COUNTER_COMP_SIGNAL_U64("frequency", _read, NULL) instead to keep the > > code more succinct? >=20 > Hi William, >=20 > I originally wrote it this way, but I had a doubt since some macros use > the structure members directly. Ah yes, the macros that use the members directly are typically the ones that are unique for their particular type. For example, the enum constant type COUNTER_COMP_COUNT_DIRECTION will only ever be used with the COUNTER_COMP_DIRECTION() macro. For macros that are based on general types such as COUNTER_COMP_U64, it's better to use the respective base macro such as COUNTER_COMP_SIGNAL_U64(). Not only is this more succinct and clearer of the intent, if the need arises in the future it allows us to upgrade the the underlying base macro and have those changes propagate to the macros that utilize it. >=20 > I can update to use COUNTER_COMP_SIGNAL_U64() instead, that will spare > few lines. >=20 > Please let me know what you prefer (I guess your proposal above ?). >=20 > Best Regards, > Thanks, > Fabrice Update to use COUNTER_COMP_SIGNAL_U64() instead, and I should be able to pick it up quickly. Thanks, William Breathitt Gray --/Mh9QAouw/rxE4EG Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEARYKAB0WIQSNN83d4NIlKPjon7a1SFbKvhIjKwUCZeXMcQAKCRC1SFbKvhIj Kzu7AP9WkIVlQ1Jh+lBJDYsKAObw8kanQFNcLxQXqxQ3J9C7vgEAgbCKLZ/Qmpz7 xlUG50p0PKnSqTAKM66jyp3VikL6xAY= =7J/c -----END PGP SIGNATURE----- --/Mh9QAouw/rxE4EG-- --===============6582921907735214287== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel --===============6582921907735214287==--