Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp2093950pxb; Sat, 21 Nov 2020 08:34:24 -0800 (PST) X-Google-Smtp-Source: ABdhPJyufevg1KmezYP7L5xbgkkffjfQqmdvOEuXQ4PpFvhP0TLceDW9zF2FBPummyvB4Txpcdzl X-Received: by 2002:a17:906:7cc6:: with SMTP id h6mr35847815ejp.161.1605976464490; Sat, 21 Nov 2020 08:34:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605976464; cv=none; d=google.com; s=arc-20160816; b=aGgtYHFjDvBVeqcxNZr3d703O4HUm0c4SX7EGpf699PaBe5cnTQyQM+3UsQh2XnDXK Ux3aWp+u5CSSsKocFHOW5dzB1RlWTjGdfB1kBvO0RiV76OQJUp8+Nki3tu8bkz7si7M3 MXGZhcd05G/tkVfgoZuv1sidEBr/c5U8Y9/tZOiDx2PBZoTVGacQgL2qHBb/1e9fXvxC jrvMGpv6VsG6o8t+xBV/1q2CWBXdeBwC4mHwxmd8zA8M+gT1djtZ1quSrXpQcAFO9OYm qCBHJ2u9jGI+ZaXoyfqqGI5k1OC+x5p95gPfTajx77Zhae50Yma3+q48HRaqdB+fBZ2e Fd6g== 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=DtoX+1SRn0VFFP6K1lVSXhxvuiD/JSSM8kb4jv38uq0=; b=XzeaK2wOHG4HNg6ptbYedIr0i/OydRdrl3Gp0V8NTpie5wBHR5vb1cFbsOMo8qckql 7cKZOeDS9Nm2zwdYaU7KGIkD6E+auYpyAd4WIeFdTvtCdyYJhexfbe20dgrAra8OFJzn 5+PGKyOsnNWFuyHteRm75Z9CgUx4XYGABeM8Cb/rOTtcIxN9njhDhhMNP4aOlDKMXgbA O1GD/PhlFI2MeWymWGCDqsSrb4hIA6tzjJc553Xba4brGGOk1vevHLWlQRJDO9k7lbgL l0xJja5U2w3bND6CNwtTKbzSk9DKBff33JA9o1lkBTXW9KbGOuLUJAN+q93xTub2SM8e h/gg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Oq3tI8Oz; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bu10si1257948ejb.483.2020.11.21.08.33.59; Sat, 21 Nov 2020 08:34:24 -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; dkim=pass header.i=@kernel.org header.s=default header.b=Oq3tI8Oz; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726433AbgKUQcF (ORCPT + 99 others); Sat, 21 Nov 2020 11:32:05 -0500 Received: from mail.kernel.org ([198.145.29.99]:58070 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725914AbgKUQcD (ORCPT ); Sat, 21 Nov 2020 11:32:03 -0500 Received: from archlinux (cpc108967-cmbg20-2-0-cust86.5-4.cable.virginm.net [81.101.6.87]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id E8E9522206; Sat, 21 Nov 2020 16:32:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1605976323; bh=hvZKMfDT45SrrDndTb88nBfj/K+dMn9SERmCh1poRBU=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=Oq3tI8Oz4rEXwir+kMVZH4uUSC7r4JxdX82Fi3ATqi4vr+Scc/oeUSxJyRGELne6v nabUVSzoXO0peaa0KabLXJmrdkKYWLhEFWh4JBY3H5h10VsIliDa5mt1JqWtbQTnXP cxi76GPl/rZeZny8fKb5bG11F9BSFj+Zyizb+md8= Date: Sat, 21 Nov 2020 16:31:57 +0000 From: Jonathan Cameron To: Kamel Bouhara Cc: William Breathitt Gray , robh+dt@kernel.org, alexandre.belloni@bootlin.com, linux-arm-kernel@lists.infradead.org, linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] counter: microchip-tcb-capture: Fix CMR value check Message-ID: <20201121163157.086ae03b@archlinux> In-Reply-To: <20201115152617.GB2233@kb-xps> References: <20201114232805.253108-1-vilhelm.gray@gmail.com> <20201115152617.GB2233@kb-xps> X-Mailer: Claws Mail 3.17.8 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, 15 Nov 2020 16:26:17 +0100 Kamel Bouhara wrote: > On Sat, Nov 14, 2020 at 06:28:05PM -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 > > Acked-by: Alexandre Belloni > > Signed-off-by: William Breathitt Gray > > --- > > Acked-by: Kamel Bouhara > Applied to the fixes-togreg branch of iio.git and marked for stable. Thanks, Jonathan > > 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..710acc0a3704 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) { > > + 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 > > > > -- > Kamel Bouhara, Bootlin > Embedded Linux and kernel engineering > https://bootlin.com