Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932555AbcLAJmZ (ORCPT ); Thu, 1 Dec 2016 04:42:25 -0500 Received: from mx0a-001ae601.pphosted.com ([67.231.149.25]:49341 "EHLO mx0b-001ae601.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1757418AbcLAJln (ORCPT ); Thu, 1 Dec 2016 04:41:43 -0500 Authentication-Results: ppops.net; spf=none smtp.mailfrom=ckeepax@opensource.wolfsonmicro.com Date: Thu, 1 Dec 2016 09:42:00 +0000 From: Charles Keepax To: Florian Vaussard CC: Brian Austin , Paul Handrigan , , Liam Girdwood , , Florian Vaussard , Takashi Iwai , Mark Brown Subject: Re: [alsa-devel] [PATCH] ASoC: cs42l56: Fix misuse of regmap_update_bits Message-ID: <20161201094200.GK1867@localhost.localdomain> References: <1480439449-15975-1-git-send-email-florian.vaussard@heig-vd.ch> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <1480439449-15975-1-git-send-email-florian.vaussard@heig-vd.ch> User-Agent: Mutt/1.5.23 (2014-03-12) X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1011 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1609300000 definitions=main-1612010173 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 916 Lines: 23 On Tue, Nov 29, 2016 at 06:10:49PM +0100, Florian Vaussard wrote: > Using regmap_update_bits(..., mask, 1) with 'mask' following (1 << k) > and k greater than 0 is wrong. Indeed, _regmap_update_bits will perform > (mask & 1), which results in 0 if LSB of mask is 0. Thus the call > regmap_update_bits(..., mask, 1) is in reality equivalent to > regmap_update_bits(..., mask, 0). > > In such a case, the correct use is regmap_update_bits(..., mask, mask). > > This driver is performing such a mistake with the CS42L56_AIN*_REF_MASK > masks, which equal 0x10, 0x20, 0x40 and 0x80. Fix the driver to make it > consistent with the API. Please note that this change is untested, > as I do not have this piece of hardware. Testers are welcome! > > Signed-off-by: Florian Vaussard > --- Looks good to me: Reviewed-by: Charles Keepax Thanks, Charles