Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp2130930pxb; Sat, 14 Nov 2020 14:53:26 -0800 (PST) X-Google-Smtp-Source: ABdhPJz4rokczkdl86woNXFp4XuExkPenUQM/+sB9GWEVWjZfHTNvX1gFLCTYA0Qa8rKPD3vsj9X X-Received: by 2002:a50:fc89:: with SMTP id f9mr9809728edq.89.1605394405826; Sat, 14 Nov 2020 14:53:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605394405; cv=none; d=google.com; s=arc-20160816; b=tGSrt+RngA0nP7tvtlp0TrVoXr0xARQw/O28hp1EvZ5tS7CXsHE54TLkVE/Uw+/nBb lhqiv8yYlIzJWDkk0ldJ4E/OZ/kDH96NQBQ7L8N3ipH/JavPOQwQWTq1BMT4h4ySmEwD N3PT93T8a4OIKIi4UnH6v3Qn0NHkOViEZkLwS6CflqIlq2SNq6sS4nxT/qF46LUVFiZ+ qlaaTZep2sZX41YaCjHZ4vKiEcoZ1ihvIt7g1k6xQm35rBLNYIG0EFmYR51R63y75oNd AWxoSCNs5di0pBrkDU2njmLm9n6rJCDiJF0vWIEAv2TCNTu7kKBuFF8xCa6aTpHtHshW OByw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=Az/Jg6wCXkT1CW4+XlQFtsxV5UNGin2UV/j3v4QLSD0=; b=Dslm+s2jU1ztVxkPcMwxKnGQ/ftS7ddLktwiGwQB0iJOPDwIpWxAv3VjidCZU0GaHi IghFlsU4G6ApTA0GEwkZW/XjjaFrlxJIMywZ+3+4EZK7C1SnyCiVXCQo/BeTpaqpBjhl 1fQN+rBBV/q93yO8fV11mfkn1P061VG86/ogyyk5LsWYWBgEJfmnSP7BfclJINLlnce/ kqvChteRqXJFUP6cwFMqIjcd8ZvmcjpPG8BN4a/ub52tZB4HT6vpDH9FKUGPvdPA+oVW bu5sA1JfZYAvEjR4CgjRd7d2bT7WXqSFGIjxTAO021/XQdpJbcdvLWC4pjp3qIR1y7dV XZ0Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id pj22si8663901ejb.513.2020.11.14.14.52.48; Sat, 14 Nov 2020 14:53:25 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726203AbgKNWsb (ORCPT + 99 others); Sat, 14 Nov 2020 17:48:31 -0500 Received: from relay10.mail.gandi.net ([217.70.178.230]:35451 "EHLO relay10.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726125AbgKNWsa (ORCPT ); Sat, 14 Nov 2020 17:48:30 -0500 Received: from localhost (lfbn-lyo-1-997-19.w86-194.abo.wanadoo.fr [86.194.74.19]) (Authenticated sender: alexandre.belloni@bootlin.com) by relay10.mail.gandi.net (Postfix) with ESMTPSA id 341E3240004; Sat, 14 Nov 2020 22:48:28 +0000 (UTC) Date: Sat, 14 Nov 2020 23:48:27 +0100 From: Alexandre Belloni To: William Breathitt Gray Cc: jic23@kernel.org, robh+dt@kernel.org, linux-arm-kernel@lists.infradead.org, linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, Kamel Bouhara Subject: Re: [PATCH] counter: microchip-tcb-capture: Fix CMR value check Message-ID: <20201114224827.GQ4556@piout.net> References: <20201111163807.10201-1-vilhelm.gray@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201111163807.10201-1-vilhelm.gray@gmail.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 11/11/2020 11:38:07-0500, William Breathitt Gray wrote: > The ATMEL_TC_ETRGEDG_* defines are not masks but rather possible values > for CMR. This patch fixes the action_get() callback to properly check > for these values rather than mask them. > > Fixes: 106b104137fd ("counter: Add microchip TCB capture counter") > Cc: Kamel Bouhara > Signed-off-by: William Breathitt Gray Acked-by: Alexandre Belloni > --- > drivers/counter/microchip-tcb-capture.c | 16 ++++++++++------ > 1 file changed, 10 insertions(+), 6 deletions(-) > > diff --git a/drivers/counter/microchip-tcb-capture.c b/drivers/counter/microchip-tcb-capture.c > index 039c54a78aa5..142b389fc9db 100644 > --- a/drivers/counter/microchip-tcb-capture.c > +++ b/drivers/counter/microchip-tcb-capture.c > @@ -183,16 +183,20 @@ static int mchp_tc_count_action_get(struct counter_device *counter, > > regmap_read(priv->regmap, ATMEL_TC_REG(priv->channel[0], CMR), &cmr); > > - *action = MCHP_TC_SYNAPSE_ACTION_NONE; > - > - if (cmr & ATMEL_TC_ETRGEDG_NONE) > + switch (cmr & ATMEL_TC_ETRGEDG_BOTH) { > + default: > *action = MCHP_TC_SYNAPSE_ACTION_NONE; > - else if (cmr & ATMEL_TC_ETRGEDG_RISING) > + break; > + case ATMEL_TC_ETRGEDG_RISING: > *action = MCHP_TC_SYNAPSE_ACTION_RISING_EDGE; > - else if (cmr & ATMEL_TC_ETRGEDG_FALLING) > + break; > + case ATMEL_TC_ETRGEDG_FALLING: > *action = MCHP_TC_SYNAPSE_ACTION_FALLING_EDGE; > - else if (cmr & ATMEL_TC_ETRGEDG_BOTH) > + break; > + case ATMEL_TC_ETRGEDG_BOTH: > *action = MCHP_TC_SYNAPSE_ACTION_BOTH_EDGE; > + break; > + } > > return 0; > } > -- > 2.29.2 > -- Alexandre Belloni, Bootlin Embedded Linux and Kernel engineering https://bootlin.com