Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp1959653pxb; Sat, 14 Nov 2020 08:06:04 -0800 (PST) X-Google-Smtp-Source: ABdhPJylPqNWb3G0Trt51ScvKwn1CNnhbn1l3jNTrl4JPmE6bUSJM8LE9m+5YhqpGZcqKBYvIJjy X-Received: by 2002:aa7:dc52:: with SMTP id g18mr7964093edu.369.1605369964153; Sat, 14 Nov 2020 08:06:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605369964; cv=none; d=google.com; s=arc-20160816; b=yBWfteYl8c4976I5xCs6aLovKvxrONYBlBxSWD3vzvr1yRC9sEbyleBF9lgzRvt/yJ ZCtSVKZNi/5tewu8uhP0sixBiXAw4kF631cd16Mx5ue8wLb3M/K2yKvJShiwzGv8Tsn+ rwolTahcrzq8r1eAt9kISRb6ZRkKuMH/ckKYoCqEYGZZvGphtMgRkWjpLo1fq69fxZb1 TCpE2BNepE6e0Vclry+FiU8N2nsKpp0bH4vhibPj6bDsAQwvidjHpDrECJBmvU8Zvugq /n0n5MghBUmstBBi8GfB9Y2y+mL/c7sIEVtwQJ0mQJGX4PcDhB/cwro0YSFGpHZBtAXc gH2Q== 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=qk6SyJ+jjXv6djwRy9XuOCLVL9OsDXjz4E7meFiw0SE=; b=fs113YLaQaJ/+EAj0dwJ/U+SmZ0ywTO5NDcrO4ALGFFvTxmUQxpEGhWHC4tXDZpGmp 06xKPesEQKTPOCETY5qZ1RuXs/wsmqlQSzMWZg8WMbiSr26zSgkL03kwHBPElqs16rTH ivBM4hcymyPc24h/YOVLvISpIqt8koRvO/hWshDEFZVmpXTSZcfluC/Jg7/Sd0les4uz 2IcW7KDqvn+4mCRB2CjlcvJ3P6DWikoEngOOvH+7zZxAdvboJlZJVaCuF820FUDshJCq x5cPCuUJhIzDgP0fQ14waItrf/8zk91dHlBSc788s74owO3lmyT64yFBa8s79yaTeo6a DlNw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=fUvVti4I; 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 df7si10898606edb.44.2020.11.14.08.05.40; Sat, 14 Nov 2020 08:06:04 -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=fUvVti4I; 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 S1727107AbgKNQDo (ORCPT + 99 others); Sat, 14 Nov 2020 11:03:44 -0500 Received: from mail.kernel.org ([198.145.29.99]:52570 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726356AbgKNQDn (ORCPT ); Sat, 14 Nov 2020 11:03:43 -0500 Received: from archlinux (cpc149474-cmbg20-2-0-cust94.5-4.cable.virginm.net [82.4.196.95]) (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 9B3EF20665; Sat, 14 Nov 2020 16:03:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1605369823; bh=UITx00zAcB1ZwANInVsxHvLlr4TN0cqsz0W9nq0Fyfo=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=fUvVti4IZGwyHeRf61jppFlImIY5Ro7vn13y/OLV9gX6sgcZhMuFM4SgBSWj2W9q9 8IOXY9jLerAw1cURZCTJF2XO+ghUU3Y0ysEh+cauKrjiE41uLWkdex/ggEBE3f3DQk AOzGO4hG8XSn2r+YI1jtf17QDp3b3mYvuKDDkcqA= Date: Sat, 14 Nov 2020 16:03:38 +0000 From: Jonathan Cameron To: William Breathitt Gray Cc: robh+dt@kernel.org, alexandre.belloni@bootlin.com, 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: <20201114160338.29a178f6@archlinux> In-Reply-To: <20201111163807.10201-1-vilhelm.gray@gmail.com> References: <20201111163807.10201-1-vilhelm.gray@gmail.com> X-Mailer: Claws Mail 3.17.7 (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 Wed, 11 Nov 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 Looks fine to me, but ideally after an ack from Kamel 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..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; > }