Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp7179547rwr; Tue, 25 Apr 2023 09:07:32 -0700 (PDT) X-Google-Smtp-Source: AKy350azRGE9hoN8aWvbNAAByYCbH85t607LglrUbAJv477XYuIXdM+8IAH2PaN9E/NNdDvnvuyW X-Received: by 2002:a17:902:e943:b0:1a6:5fa2:3293 with SMTP id b3-20020a170902e94300b001a65fa23293mr18514789pll.56.1682438851691; Tue, 25 Apr 2023 09:07:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682438851; cv=none; d=google.com; s=arc-20160816; b=o/jYihaaO2Xt+g9RZVbDaNK2lokn+ynZFkLjZ1eZyZHgFjk2ux7rkktTNId1hJLFou IQnaTY0rMOpveEbgCZM5sxKNTnvUmPAtO7/GvzjlDVAEf2+ZFarGS2g74XnDe8nzBHWy 2Byyf7hZiwaEedO4HUonOlEr+J26BzuhgMeIWth1yXJLBkfklDGj6f+ckXqqYDOTx+m4 uO9iUImWf25rCxz1o2AyXuwYUwfsJU3IdLc1ElnynRgkYTO0pTJHlND3GIdST015QP3t jXFC52zACK2wOV26Ay8PmvGmfpYND7YlThKC6dCxl5oB8aBK/XnWlemGJ1QNkk51oJYF l+Qg== 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=wjI0aqj/1HeMyUfKXegtzcp0LTFMNz0ql9BkEO+l3fY=; b=xei0HcTrqcfTeDqkpVaWNqExHMsRVUpuFchxodOLihlt9Z5jgRBhf+osdadQMphh6u UZonRhQt577jXKL1CEH83k4fpVq6W3Az3DEV5vgrLpl4GbxI+YWEEPcH/dfveVIB5l0p rWk7higNi4sdvLv+HKLPJZYPnju4g7UGLt3Oe35MzsOWAB5DdV9o7B0/LhAbRSpZ4cPA ULLoM4amvtCGc6SCiaLTeH4HuKT1NzZd647MEMWdh1Wut8e0aIoojcZKDFdPET9wfOef T7Lypg+rOvtsGtjWUzNz7J8eL50iS6x1qmCB5OYG0Pu/OtvZbuszeh7wY6vqxWxlE7Gx vE9A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Hzj48BJD; 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=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w1-20020a170902904100b001a64476e1eesi13857414plz.185.2023.04.25.09.07.09; Tue, 25 Apr 2023 09:07:31 -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=@kernel.org header.s=k20201202 header.b=Hzj48BJD; 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=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234599AbjDYP5l (ORCPT + 99 others); Tue, 25 Apr 2023 11:57:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37472 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234320AbjDYP5j (ORCPT ); Tue, 25 Apr 2023 11:57:39 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3EF26C17A; Tue, 25 Apr 2023 08:57:39 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id CD3DC62F86; Tue, 25 Apr 2023 15:57:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AEC6DC433EF; Tue, 25 Apr 2023 15:57:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1682438258; bh=KcEPijgDMdf9nIE4sARugIAJD7IOSpJYhKwFnLJ3HO4=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Hzj48BJD7HDVIcCpfUAUlKgOQpEObIOdSRuNksz8vCQ1nOnYUAGrvLUym8/OUEMzj Ih+eGIDjtCiX8nISHz2EVQ/+iE2otHFIBlXsNdYXOW6v6RJolKIoKdf8BEUgvfOZa9 67uhMXFemFrfr6MSBdF/hJmkDFA8dXeNxj620oLBGIRXFuWpcbwejz+ilygabxrwXy k8pXvk3Up/uYnD05ZvKTdjV6mWT624P/u6dBx4OTG3s5VEFnIV/8AYpeUPn7Tdtupw c0sWU3EHpdiOclNtXkVpwdT6pl+swQk4CrWwoLQslxB6qu84KEy/5QdIHpV+Mh6qZh M4+PR51atzXTA== Date: Tue, 25 Apr 2023 17:57:34 +0200 From: Andi Shyti To: Mehdi Djait 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: <20230425155734.ywdle4pv6y2wjk2s@intel.intel> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-7.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, 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 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. [...] > @@ -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. Andi