Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp2130929pxb; Sat, 14 Nov 2020 14:53:25 -0800 (PST) X-Google-Smtp-Source: ABdhPJwBTh91w+J4IVh9mR6SfLHDB87EXZv8BrwwjchVQ9LimLoPacxiqCGWTD+5IkW+j457PIOL X-Received: by 2002:a05:6402:79a:: with SMTP id d26mr8962238edy.113.1605394405802; 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=Me28gNN8X8l35U252b7dLRiBO52hsg650DlFcYEbOmqlOzx+FcOnW848mbMMtM+OYP Z2dkhRK/a9RasrOrAKoaS4mSRK8INCbRARgYaLxr0PiZLuqwccdIGnplelHNFb7DjVH/ lfbgzYyX+QzRlyu++jooRoaVHRwlTpjfYt10DM0ZuafPd35+X0MypoOSpGq9EqTjrLR9 Nz9ObBeameQZPX9lE60chio8G9Mg+ovABy+08qwEVPejk1UDCVbQhBg6MuH85gqxvi1W pd6k06EbcdAsP7vkTKsEjhsl1yBPqETEV3QsKt7YCyKKEP/2LnnCC4w6OchGgtaZ2chm MAAA== 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=aCdnQgxs/KNnthhBjBxNOgGtDysF1PcZPnhjrOvXI9M=; b=DMP2XrhNjQ8Xciw+YG4+1vn0/LUsFFtOzydxYYmAsGZ1ImW86VnMpP2yn7pUvDi7wJ mn733o6QMSLUTR/pdaqTRg/kiQoHcA3MsZv4Wfg7ULi4jH0/PZyU24duiAfc9Nb2t/xY 6Joc0s5C+0ibVJhiJfZor9WSqWJqI7W0WPImwVw5GRYo9BawOdov1UcA8V784Le4Yf/t 9xMDMqwV9oG7WvW23fBiRIDo3NJujy5n58HoaSdOYf4bvRNZVAZRaqT1Y/tnppG9Mhfc sSdzC0XbnFxw82QgK7xxi+xfr0aH5Rc+Rh/RuSQx3P4LvFUl9K4waoslCVYtjQuHcUeJ N1HA== 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 b14si1402370ejc.581.2020.11.14.14.52.56; 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 S1726231AbgKNWvQ (ORCPT + 99 others); Sat, 14 Nov 2020 17:51:16 -0500 Received: from relay9-d.mail.gandi.net ([217.70.183.199]:43355 "EHLO relay9-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726140AbgKNWvQ (ORCPT ); Sat, 14 Nov 2020 17:51:16 -0500 X-Originating-IP: 86.194.74.19 Received: from localhost (lfbn-lyo-1-997-19.w86-194.abo.wanadoo.fr [86.194.74.19]) (Authenticated sender: alexandre.belloni@bootlin.com) by relay9-d.mail.gandi.net (Postfix) with ESMTPSA id 0182CFF802; Sat, 14 Nov 2020 22:51:13 +0000 (UTC) Date: Sat, 14 Nov 2020 23:51:13 +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: <20201114225113.GR4556@piout.net> References: <20201111163807.10201-1-vilhelm.gray@gmail.com> <20201114224827.GQ4556@piout.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201114224827.GQ4556@piout.net> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 14/11/2020 23:48:28+0100, Alexandre Belloni wrote: > 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) { BTW, this could be simply ATMEL_TC_ETRGEDG which is the mask. > > + 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 -- Alexandre Belloni, Bootlin Embedded Linux and Kernel engineering https://bootlin.com