Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp1018335rwr; Thu, 20 Apr 2023 09:00:07 -0700 (PDT) X-Google-Smtp-Source: AKy350YEi+NmeXvK3eaRa8ZLHfKwSuvU/MewMyZFMm5mh1uaNqEMjSx/OPZQQoFIz7w7nN5yQ/vQ X-Received: by 2002:a17:902:b084:b0:1a1:ce05:9ba with SMTP id p4-20020a170902b08400b001a1ce0509bamr1741869plr.52.1682006406850; Thu, 20 Apr 2023 09:00:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682006406; cv=none; d=google.com; s=arc-20160816; b=W0l4edOAmzyw4J3ePCEdQvnAn0W3ThVGQ+1DN0YZ1ZlkcqrWrUfuUxR4CHWlFCfpud bgQ6kRhzQOsPuIbMQCcXAhPI/3MuCkGwUETUx8OVo8wbBrlZb5C87Vs7grFk/htTTzK3 ln8/nWnxaPcdmesIisKSjf5UYK00VAh/3Ps03/072798QbShrYe79aTFvLbcqBC+WIPV WdVUnqiQDTxRWGDtq8XaVAu418YlpT6xUwIqvgqmkUYPW6SyOHdP9DQNoYYddbI6FMJg pO8mJLesTEhr/LzxiRcx03bzszt1M8x9JkqNn1Vhx5eM5o3wEazGCETZp9lRZ2LYnGpC ChWg== 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 :organization:references:in-reply-to:message-id:subject:cc:to:from :date:dkim-signature; bh=xQDee/z2XFFx22IZQpnFIHOpdjrphmkJhT/9/bX1Hfw=; b=dxQI4oVK162FtbP5qsrGopS50QMJTh2soS/bEITytqnrGhJfouYyKXpew3wRS5RINb /pgsnfHGcDT8TFamSSGUlIocAOdbRRSQzSwQztNlBkshVy+ODJZbE9f6A4I3no4b+cz/ EUVe3MJpMjpFVc4M2mp+ZptNmJ9YJy8n1QYwYBhI5ThBFDf1qqnSnH/zJlRy2S5pLihB SgJPw2xfN3HAmm2zTf8sjIitsRRLy2t29NKwB/RRN/yPzIAzY/2RxXnq7GhjUYgEzlpx UTTwWXCuWlAtHIeRMjWoibffOnEhURd/E4YgOBkhquQ6nKNUtmYzafXMsAbSiLcBf41b eoeA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=MZIrzR5v; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k2-20020a170902d58200b001a69cb5f7besi2015096plh.525.2023.04.20.08.59.52; Thu, 20 Apr 2023 09:00:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=MZIrzR5v; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231700AbjDTPz7 (ORCPT + 99 others); Thu, 20 Apr 2023 11:55:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50494 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230033AbjDTPz6 (ORCPT ); Thu, 20 Apr 2023 11:55:58 -0400 Received: from relay1-d.mail.gandi.net (relay1-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::221]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7A276110; Thu, 20 Apr 2023 08:55:55 -0700 (PDT) Received: (Authenticated sender: herve.codina@bootlin.com) by mail.gandi.net (Postfix) with ESMTPSA id B9ECF24000D; Thu, 20 Apr 2023 15:55:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1682006154; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=xQDee/z2XFFx22IZQpnFIHOpdjrphmkJhT/9/bX1Hfw=; b=MZIrzR5vcXk+QIdU0DBYFiZ8VpLh3+pN+/9gahku9fhSPxd4xeQxLbNko7Ng5fOKSLx6DZ m7Ha6qpLN9luRExbHmVyqzfl/5j2ef5lDZP7zQyAjfo6YD/nZtDdwxmgJIWJsPrIRyVb1o OjZ2/fcekT5xGQzTWlJH/QSVNyUlsJHUGnC4qbSNNzUaGOJsmyJ39BgAGra6UjLPJHIV60 1sKP93jU6l2efIowgo+cWhvpdSSWGfyV0l9i7mHPcP8IGcoN+/qQvCJkhP9uyEsCB9tHX5 wtn0MakQvi/8cmFlF9RLk2anCQDf10I+2/dQLplWmVkO2vWMpO0qMVrSyZbouQ== Date: Thu, 20 Apr 2023 17:55:52 +0200 From: Herve Codina To: Lars-Peter Clausen Cc: Jonathan Cameron , Rob Herring , Krzysztof Kozlowski , linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Christophe Leroy , Thomas Petazzoni Subject: Re: [PATCH 2/3] iio: potentiometer: Add support for the Renesas X9250 potentiometers Message-ID: <20230420175552.58b15819@bootlin.com> In-Reply-To: <85e214c8-b639-5197-70a1-7279f9418f66@metafoo.de> References: <20230420121320.252884-1-herve.codina@bootlin.com> <20230420121320.252884-3-herve.codina@bootlin.com> <85e214c8-b639-5197-70a1-7279f9418f66@metafoo.de> Organization: Bootlin X-Mailer: Claws Mail 4.1.1 (GTK 3.24.37; x86_64-redhat-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 20 Apr 2023 06:47:32 -0700 Lars-Peter Clausen wrote: > On 4/20/23 05:13, Herve Codina wrote: > > The Renesas X9250 integrates four digitally controlled potentiometers. > > On each potentiometer, the X9250T has a 100 kOhms total resistance and > > the X9250U has a 50 kOhms total resistance. > > > > Signed-off-by: Herve Codina > > Hi, > > Looks perfect! Just one small comment. > > > +static int x9250_write8(struct x9250 *x9250, u8 cmd, u8 val) > > +{ > > + struct spi_transfer xfer = { > > + .tx_buf = &x9250->spi_tx_buf, > > + .len = 3, > > + }; > > + int ret; > > + > > + BUILD_BUG_ON(sizeof(x9250->spi_tx_buf) < 3); > > + > > + mutex_lock(&x9250->lock); > > + > > + x9250->spi_tx_buf[0] = 0x50; > The 0x50 shows up as a magic constant in multiple places, a define for > it would be nice. Sure, a define will be present in next iteration. > > + x9250->spi_tx_buf[1] = cmd; > > + x9250->spi_tx_buf[2] = val; > > + > > + ret = spi_sync_transfer(x9250->spi, &xfer, 1); > > + > > + mutex_unlock(&x9250->lock); > > + > > + return ret; > > +} Thanks for the review, Hervé -- Hervé Codina, Bootlin Embedded Linux and Kernel engineering https://bootlin.com