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 D0A11C27C6E for ; Fri, 14 Jun 2024 09:31:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:In-Reply-To: Content-Transfer-Encoding:Content-Type:MIME-Version:References:Message-ID: Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=H2Y2s5Iu12sGLzQChgZsfSfUT2Pn+c+CaAzNngYFmWI=; b=wpAs8F/I8vjOQdX0KoAX+8G8mt 3LkwyNRhsgwW3E6TJ1ebppsvRk4Y1i6HiFSf59No3EeDA3fI0tM75997R89L//ZbA56Ut507WZlUu LSoOLOB//jjrgJsol5y+IoobG897S2J2Y5xI7oXte/YwjYIJojL0lCJNona1MTE3f4dmhxVNU8E9s gcCo3AzlQcSWFnbRLEBMRumMd7PdT0kDv6+q4NmpSVyGvyGKe+j8yxA7qkApZXydbtDsz7CnD4nws l4+XpYXI0hCpnFiMrc9mbwT0JfgthGWsS9hTDYXpRjsjj0lroOlyETdR5PGl43Z53xw03BLoO5bYj rEaQQu7A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sI3HS-00000002C7z-02qT; Fri, 14 Jun 2024 09:31:34 +0000 Received: from dfw.source.kernel.org ([139.178.84.217]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sI3HO-00000002C6S-1HQ4 for linux-arm-kernel@lists.infradead.org; Fri, 14 Jun 2024 09:31:32 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 8684A61ECF; Fri, 14 Jun 2024 09:31:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 27173C2BD10; Fri, 14 Jun 2024 09:31:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1718357489; bh=GHeElqe8VrB34C9wBIcEMogZsFo2aeiU/M3nJbLyXxQ=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=uVyVB1Q13OgHfxDgorVlgcTtPWWke8R6tnuozRHFZqo8a9Jwd3zF/iajHtabIgDSN fJUC450HjXueTqfpKmdaFk4pP+C4KBHDWlioCDY9YSYiGfcFB+zVJlUQ32lyPuIv8e 76fCrocYx59ivwY2AKivgZ4sRrf5zE1DDrhTAmqu8BcWI9cyHo7+iaQoit+LazNjKb YMF/Poqeivz7CbcPm3E7T3vqy2luQaTwMisOR5oM6ltsy6SOO8arAfb5zwxClBDPii skZhlEj4yjnBBPfaXF/cEw445MAyEu3lmkliENODUC/MChs81QWnQdksjcSBDoYOww w7id1AERN7VGA== Date: Fri, 14 Jun 2024 10:31:24 +0100 From: Lee Jones To: Uwe =?iso-8859-1?Q?Kleine-K=F6nig?= Cc: Fabrice Gasnier , William Breathitt Gray , Maxime Coquelin , Alexandre Torgue , linux-iio@vger.kernel.org, linux-pwm@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 3/4] mfd: stm32-timers: Drop TIM_DIER_CC_IE(x) in favour of TIM_DIER_CCxIE(x) Message-ID: <20240614093124.GD3029315@google.com> References: <0735860960b1b38570bffa5b0de81a97f6e3230e.1718352022.git.u.kleine-koenig@baylibre.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <0735860960b1b38570bffa5b0de81a97f6e3230e.1718352022.git.u.kleine-koenig@baylibre.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240614_023130_497126_0C668BBB X-CRM114-Status: GOOD ( 24.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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Fri, 14 Jun 2024, Uwe Kleine-König wrote: > These two defines have the same purpose and this change doesn't > introduce any differences in drivers/counter/stm32-timer-cnt.o. > > The only difference between the two is that > > TIM_DIER_CC_IE(1) == TIM_DIER_CC2IE > > while > > TIM_DIER_CCxIE(1) == TIM_DIER_CC1IE > > . That makes it necessary to have an explicit "+ 1" in the user code, > but IMHO this is a good thing as this is the code locatation that > "knows" that for software channel 1 you have to use TIM_DIER_CC2IE > (because software guys start counting at 0, while the relevant hardware > designer started at 1). > > Signed-off-by: Uwe Kleine-König > --- > drivers/counter/stm32-timer-cnt.c | 4 ++-- The subject should be renamed. > include/linux/mfd/stm32-timers.h | 1 - > 2 files changed, 2 insertions(+), 3 deletions(-) > > diff --git a/drivers/counter/stm32-timer-cnt.c b/drivers/counter/stm32-timer-cnt.c > index 0664ef969f79..186e73d6ccb4 100644 > --- a/drivers/counter/stm32-timer-cnt.c > +++ b/drivers/counter/stm32-timer-cnt.c > @@ -465,7 +465,7 @@ static int stm32_count_events_configure(struct counter_device *counter) > ret = stm32_count_capture_configure(counter, event_node->channel, true); > if (ret) > return ret; > - dier |= TIM_DIER_CC_IE(event_node->channel); > + dier |= TIM_DIER_CCxIE(event_node->channel + 1); > break; > default: > /* should never reach this path */ > @@ -478,7 +478,7 @@ static int stm32_count_events_configure(struct counter_device *counter) > > /* check for disabled capture events */ > for (i = 0 ; i < priv->nchannels; i++) { > - if (!(dier & TIM_DIER_CC_IE(i))) { > + if (!(dier & TIM_DIER_CCxIE(i + 1))) { > ret = stm32_count_capture_configure(counter, i, false); > if (ret) > return ret; > diff --git a/include/linux/mfd/stm32-timers.h b/include/linux/mfd/stm32-timers.h > index 92b45a559656..f09ba598c97a 100644 > --- a/include/linux/mfd/stm32-timers.h > +++ b/include/linux/mfd/stm32-timers.h > @@ -47,7 +47,6 @@ > #define TIM_DIER_CC2IE TIM_DIER_CCxIE(2) /* CC2 Interrupt Enable */ > #define TIM_DIER_CC3IE TIM_DIER_CCxIE(3) /* CC3 Interrupt Enable */ > #define TIM_DIER_CC4IE TIM_DIER_CCxIE(4) /* CC4 Interrupt Enable */ > -#define TIM_DIER_CC_IE(x) BIT((x) + 1) /* CC1, CC2, CC3, CC4 interrupt enable */ > #define TIM_DIER_UDE BIT(8) /* Update DMA request Enable */ > #define TIM_DIER_CCxDE(x) BIT(9 + ((x) - 1)) /* CCx DMA request Enable (x ∈ {1, .. 4}) */ > #define TIM_DIER_CC1DE TIM_DIER_CCxDE(1) /* CC1 DMA request Enable */ > -- > 2.43.0 > -- Lee Jones [李琼斯]