Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp899130rwd; Sun, 14 May 2023 08:28:52 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7KDJrUhHMlaEzDTlPXMjRGTXEA62kp7ia1lMSRsaSN7lblBvkCTdYR8NrWDchrAoM4LZ6p X-Received: by 2002:a17:902:ecc3:b0:1aa:f818:7a24 with SMTP id a3-20020a170902ecc300b001aaf8187a24mr40238521plh.1.1684078131782; Sun, 14 May 2023 08:28:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684078131; cv=none; d=google.com; s=arc-20160816; b=D5w+mngdacOh561TWsWOS/CDuNJarqJANaIEDE/2LMaSwuTHW1a043hDETOJ5ttZj0 Gkp8CeFPuaJK92ITyxDAAjjfYRzJLoO+E4Jz7hvvAacfAfLS0TP0DXcETka61HN6xyj7 F2Hu6YOLgCVZ5FBGPI93H90v/qOq9nGDaV5IAwbpUoKlF2p/DaR3m1btttiP/hD0ABak WDsPqQC58QIvUcOme6a4ddPzL0mW0S1ffoNVSo823zeyHs79c3Xu5B9Cp3/pjaQC1Gzn Vw8l3PxFaDw9XbPxOWC+wByDliDIlyqzDvKIGNES2QZEy58bNxCxRH6xfkC1os/KTnKT yOnw== 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=06LiB1m/4S1iJljwF5Stm/gW1yfN4Sr7PAjYl+bydro=; b=NDIm+QQB4GeVwqRQHrhBs5VjQHGgow5lWC8qit5VcFtn1bL3f0Kl2hvsRoLHe7Iy53 aJHwrhhGkWfTTzL6ZNzaoqD+pSNOEUoPPjwK1hxSUD3i+2QLnexB18reCuJiJTQLzLlx NpHlMkd+9hvFug4sfwEGnyW2zzj0d+uEKey5CqqedFP6BgUfe2BfY8qEpfZFJ3p+ceun X7ZL0ZCyNuMLg9FV8Bj4EX7wqDLd/vT9lgB5PIqiA34/3cY/m/v9bRVXLPwaJmZPvwhn cV+72nPHWLcrIVmjTNQRBrHdJ3l7LZU1EGlysN/ZQDYxVHYXyZX2tBpbPQ/3ws7yODFP 5nhA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=oRX4C2sf; 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 h12-20020a170902704c00b001ac6d52d936si13054113plt.87.2023.05.14.08.28.31; Sun, 14 May 2023 08:28:51 -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=oRX4C2sf; 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 S233931AbjENOcl (ORCPT + 99 others); Sun, 14 May 2023 10:32:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36498 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229808AbjENOcj (ORCPT ); Sun, 14 May 2023 10:32:39 -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 85D6F30CF; Sun, 14 May 2023 07:32:36 -0700 (PDT) Received: (Authenticated sender: herve.codina@bootlin.com) by mail.gandi.net (Postfix) with ESMTPSA id E6AC7240004; Sun, 14 May 2023 14:32:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1684074755; 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=06LiB1m/4S1iJljwF5Stm/gW1yfN4Sr7PAjYl+bydro=; b=oRX4C2sfa8AW337aNspq7cKxaA35IxPUkIlUxc5b+IPYxoAdgMXsLx6TVB0uiJSGG31X9m 1AOErvwKA+JWuz/wGLKlhB3qAZpHWpN/nD1TeUXx2fWZnbPUH5Y83eGh7RGcnmtWFFljqI NioNCWcqchJkeqEdfhmre7AIW23+PCzaTO2LEJrZeTdphz0jpjv0YEFEL6qiE9nynNzvBs OXbs+G2eS7dXLYr5pt4XGn18/EbDqFgMd4KuR+6J/+vDqcM7uUuhVK+uTHbWhKAIWoL0+y XpKjBl5I3CUFqEdqjw7jm7bxWc1Cie7qBG5R2yY3GWuNdJckTcQLqGHTrsoajw== Date: Sun, 14 May 2023 16:32:33 +0200 From: Herve Codina To: Jonathan Cameron Cc: Lars-Peter Clausen , 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 v4 2/3] iio: potentiometer: Add support for the Renesas X9250 potentiometers Message-ID: <20230514163233.0c048256@bootlin.com> In-Reply-To: <20230513193525.43a4475f@jic23-huawei> References: <20230509160852.158101-1-herve.codina@bootlin.com> <20230509160852.158101-3-herve.codina@bootlin.com> <20230513193525.43a4475f@jic23-huawei> 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 Hi Jonathan, On Sat, 13 May 2023 19:35:25 +0100 Jonathan Cameron wrote: > On Tue, 9 May 2023 18:08:51 +0200 > 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 > > As I only noticed one trivial thing I made the change whilst applying. > diff --git a/drivers/iio/potentiometer/x9250.c b/drivers/iio/potentiometer/x9250.c > index 3d4ca18d1f14..7e145d7d14f1 100644 > --- a/drivers/iio/potentiometer/x9250.c > +++ b/drivers/iio/potentiometer/x9250.c > @@ -176,10 +176,7 @@ static int x9250_probe(struct spi_device *spi) > > x9250 = iio_priv(indio_dev); > x9250->spi = spi; > - x9250->cfg = device_get_match_data(&spi->dev); > - if (!x9250->cfg) > - x9250->cfg = &x9250_cfg[spi_get_device_id(spi)->driver_data]; > - > + x9250->cfg = spi_get_device_match_data(spi); > x9250->wp_gpio = devm_gpiod_get_optional(&spi->dev, "wp", GPIOD_OUT_LOW); > if (IS_ERR(x9250->wp_gpio)) > return dev_err_probe(&spi->dev, PTR_ERR(x9250->wp_gpio), > Are you sure about your modification ? I am not sure (maybe I am wrong) that x9250->cfg = spi_get_device_match_data(spi); is equivalent to x9250->cfg = &x9250_cfg[spi_get_device_id(spi)->driver_data]; The spi_get_device_id(spi)->driver_data value I used is a simple integer (X9250T or X9250U) and not the x9250_cfg item. Maybe the x9250_id_table should be modified to replace X9250T by &x9250_cfg[X9250T] to have your modification working. The data defined in the driver are the following: --- 8< --- static const struct x9250_cfg x9250_cfg[] = { [X9250T] = { .name = "x9250t", .kohms = 100, }, [X9250U] = { .name = "x9250u", .kohms = 50, }, }; ... static const struct of_device_id x9250_of_match[] = { { .compatible = "renesas,x9250t", &x9250_cfg[X9250T]}, { .compatible = "renesas,x9250u", &x9250_cfg[X9250U]}, { } }; MODULE_DEVICE_TABLE(of, x9250_of_match); static const struct spi_device_id x9250_id_table[] = { { "x9250t", X9250T }, { "x9250u", X9250U }, { } }; MODULE_DEVICE_TABLE(spi, x9250_id_table); static struct spi_driver x9250_spi_driver = { .driver = { .name = "x9250", .of_match_table = x9250_of_match, }, .id_table = x9250_id_table, .probe = x9250_probe, }; --- 8< --- Best regards, Hervé -- Hervé Codina, Bootlin Embedded Linux and Kernel engineering https://bootlin.com