Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp3401644rwr; Sat, 29 Apr 2023 06:37:25 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ56wb++XAL9/2J4iSAf5z8aKlcfR790pqKhIR1XN4Hws2rcUaQIYkjm3xbHO1+wiKsK0cVd X-Received: by 2002:a05:6a20:7da6:b0:f1:1ab5:5076 with SMTP id v38-20020a056a207da600b000f11ab55076mr6204320pzj.2.1682775445428; Sat, 29 Apr 2023 06:37:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682775445; cv=none; d=google.com; s=arc-20160816; b=WmKsfTNWqRAixr8s9atBR0qwxu5wvEXH3WEkcRaUL4OCJH+gFGyc1CdWKz9gajnc69 yz+8O6ZFRZvqhIz99mF7FxUk5XWgJcaWPPUSBw83q2BzJhZEL1NU933Ar7e8HQzs1dWN XmFcI/AIgpY7jOFZMHUsrxxACKPOC/T3fHmemDCAIivkTHu9HvB9dTh4VaU5i/XRbzkg GVCYey1DXHWI25Tmw4p9SZ6QFZh3Vz465hNGFfxjgus4a/XA+K3Z4qeGGZuIn3NO3EXE ybVsEKv92ASoIUQhpoi/ir7kXARvwi28Qxu7Xget882KIKkb8V6Ag15RzASVx3OMQ5Wi b5+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=Zy6Rvq9bqkrVluCQhbYqXIojqy7upXVbuz0T3nnyYcg=; b=rE8KkDbpG8lnHW3/F9kf7EftgPY7FDLtH8Ucq48WjFdULcc3HcEIf8uA0YVM8sDxJj QBdp3e24STRc7AkENk9Jyaefi6EHGW8tpB4ZXIyWKRBUnuUEeFzEGTFEY063WEKs4dh1 Xq3LKBy/EC1Qk1/ejVDB4giMuzpYkXBO9Pw5ikersphCS+VnipbnqmBLvNcOF5xGwZDa hdxphqlvG8pv6NDxUh5rgMokDV/BZ4kRCd8ppzDpDfEhKuwp69I+sMjJ17UuQTwbryJ0 Z/mUwyXLA75tx35IQI3Y0qIKnQ9ZW4OdTOAKmkBUg2pu4y5wG9dpbLZdSmFJWrQpDd7k v05A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=dz7Tz2bi; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 36-20020a630a24000000b005203991145dsi23264750pgk.473.2023.04.29.06.37.10; Sat, 29 Apr 2023 06:37:25 -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=@gmail.com header.s=20221208 header.b=dz7Tz2bi; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229581AbjD2NHy (ORCPT + 99 others); Sat, 29 Apr 2023 09:07:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44288 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231218AbjD2NHw (ORCPT ); Sat, 29 Apr 2023 09:07:52 -0400 Received: from mail-ej1-x629.google.com (mail-ej1-x629.google.com [IPv6:2a00:1450:4864:20::629]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BD9AD1FD5; Sat, 29 Apr 2023 06:07:50 -0700 (PDT) Received: by mail-ej1-x629.google.com with SMTP id a640c23a62f3a-94f109b1808so167224266b.1; Sat, 29 Apr 2023 06:07:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1682773669; x=1685365669; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=Zy6Rvq9bqkrVluCQhbYqXIojqy7upXVbuz0T3nnyYcg=; b=dz7Tz2biN/oixLALLMmxbDY3SPRv9OGTTTiwFtW0lFyoWjnSwBgBwjpg9QKToW6II4 f2Ai0KZ6agm9DhilEJVoSI+M1A/p54YCr3f2vfxng8SJbhfiZrq9pEzxe91ID0KBv4wa 1vefHuP28XIFRPrhoAsJrHGsPm9WN68eultJiSm73ysGo1HdFOIjnH4yoykevd1/gkLM er6UXnYMNxwZX2aUvIe/AyBpHlDi55EPN0gz3phC3hjMJ0U4f/of3YEO3Y4bSarcrgVu kqZg7+wibJ6apHqryGmR4OsCyh0CsAqWRPfn/YYRlhSWSI1CurSC89hqrvrOcVQRJlV7 LK9A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682773669; x=1685365669; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=Zy6Rvq9bqkrVluCQhbYqXIojqy7upXVbuz0T3nnyYcg=; b=D6M0vkeYAb+HpxX6BOPKN+0Xll3mjwn3ICpZ7wNXTTy6MQiSUi/Qx7BhR9tTgBwEE5 Vg2sNTR/ygB8LWMjvC1ZR+KMqlHasbPe8UCEvldwSXdCCPaI15nUmxvl1qX5tbkWETC0 d4X0FVeHb2s2IaDizqaZhTaal6iLu1kZUHqZXWqrzPQmIEjrerhj01Oxl4ItAI3Kx2JK mdT5GtlYq+cZ96ruvRrGgM6C51s5Z4KKDMbJFgE5Ozn/DSqa/3CIFtOIpKUUgGCYpOTz QNeOE5uhX8IhhVbr7ikMdJt33U2WLdqenhTiqRc6yPane2su9ex8cH8Y/5XrOKoL+3Lb 8SDA== X-Gm-Message-State: AC+VfDygR98gZXplx9cSWVHnz5232EV+t2tlVZS/HZanZPER1FAxZ4rW pBY9+drr7JutCbmNqhbHVUs5hpGxqho= X-Received: by 2002:a17:907:6e8d:b0:93b:5f2:36c with SMTP id sh13-20020a1709076e8d00b0093b05f2036cmr8848904ejc.61.1682773669089; Sat, 29 Apr 2023 06:07:49 -0700 (PDT) Received: from carbian ([2a02:8109:aa3f:ead8::2d16]) by smtp.gmail.com with ESMTPSA id y21-20020a17090614d500b0094b87711c9fsm12501293ejc.99.2023.04.29.06.07.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 29 Apr 2023 06:07:48 -0700 (PDT) Date: Sat, 29 Apr 2023 15:07:46 +0200 From: Mehdi Djait To: Andi Shyti Cc: jic23@kernel.org, mazziesaccount@gmail.com, krzysztof.kozlowski+dt@linaro.org, andriy.shevchenko@linux.intel.com, robh+dt@kernel.org, lars@metafoo.de, linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org Subject: Re: [PATCH v3 5/7] iio: accel: kionix-kx022a: Refactor driver and add chip_info structure Message-ID: References: <20230425155734.ywdle4pv6y2wjk2s@intel.intel> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230425155734.ywdle4pv6y2wjk2s@intel.intel> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,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 Andi, Thank you for the review. On Tue, Apr 25, 2023 at 05:57:34PM +0200, Andi Shyti wrote: > Hi Mehdi, > > On Tue, Apr 25, 2023 at 12:22:25AM +0200, Mehdi Djait wrote: > > Add the chip_info structure to the driver's private data to hold all > > the device specific infos. > > Refactor the kx022a driver implementation to make it more generic and > > extensible. > > Could you please split this in different patches? Add id in one > patch and refactor in a different patch. Please, also the > refactorings need to be split. > > I see here that this is a general code cleanup, plus some other > stuff. Looking at the diff and considering the comments from Jonathan in the previous versions, the only thing that can separated from this patch would be the changes related to: -#define KX022A_ACCEL_CHAN(axis, index) \ +#define KX022A_ACCEL_CHAN(axis, reg, index) \ > > [...] > > > @@ -22,22 +23,28 @@ static int kx022a_spi_probe(struct spi_device *spi) > > return -EINVAL; > > } > > > > - regmap = devm_regmap_init_spi(spi, &kx022a_regmap); > > + chip_info = device_get_match_data(&spi->dev); > > + if (!chip_info) { > > + const struct spi_device_id *id = spi_get_device_id(spi); > > + chip_info = (const struct kx022a_chip_info *)id->driver_data; > > you don't need the cast here... if you don't find it messy, I > wouldn't mind this form... some hate it, I find it easier to > read: > > chip_info = spi_get_device_id(spi)->driver_data; > > your choice. I don't really have any strong opinion about this other than keeping the same style used in iio drivers Again thank you for the review -- Kind Regards Mehdi Djait