From: Andi Shyti <andi.shyti@kernel.org>
To: Mehdi Djait <mehdi.djait.k@gmail.com>
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
Date: Tue, 25 Apr 2023 17:57:34 +0200 [thread overview]
Message-ID: <20230425155734.ywdle4pv6y2wjk2s@intel.intel> (raw)
In-Reply-To: <bf0269aff66483f2323914170707203749b33f0f.1682373451.git.mehdi.djait.k@gmail.com>
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
next prev parent reply other threads:[~2023-04-25 15:57 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-24 22:22 [PATCH v3 0/7] iio: accel: Add support for Kionix/ROHM KX132-1211 accelerometer Mehdi Djait
2023-04-24 22:22 ` [PATCH v3 1/7] dt-bindings: iio: Add " Mehdi Djait
2023-04-24 22:22 ` [PATCH v3 2/7] iio: accel: kionix-kx022a: Remove blank lines Mehdi Djait
2023-04-25 5:26 ` Matti Vaittinen
2023-04-24 22:22 ` [PATCH v3 3/7] iio: accel: kionix-kx022a: Warn on failed matches and assume compatibility Mehdi Djait
2023-04-24 22:22 ` [PATCH v3 4/7] iio: accel: kionix-kx022a: Add an i2c_device_id table Mehdi Djait
2023-04-25 5:31 ` Matti Vaittinen
2023-05-01 14:42 ` Jonathan Cameron
2023-04-25 13:40 ` Andy Shevchenko
2023-04-29 13:10 ` Mehdi Djait
2023-04-24 22:22 ` [PATCH v3 5/7] iio: accel: kionix-kx022a: Refactor driver and add chip_info structure Mehdi Djait
2023-04-25 6:50 ` Matti Vaittinen
2023-04-25 7:24 ` Mehdi Djait
2023-04-25 8:12 ` Matti Vaittinen
2023-04-29 12:59 ` Mehdi Djait
2023-04-29 13:56 ` Matti Vaittinen
2023-05-01 14:50 ` Jonathan Cameron
2023-05-07 20:45 ` Mehdi Djait
2023-05-08 6:12 ` Matti Vaittinen
2023-04-25 15:57 ` Andi Shyti [this message]
2023-04-29 13:07 ` Mehdi Djait
2023-04-30 17:49 ` Jonathan Cameron
2023-05-02 19:41 ` Andy Shevchenko
2023-05-05 18:12 ` Mehdi Djait
2023-04-24 22:22 ` [PATCH v3 6/7] iio: accel: kionix-kx022a: Add a function to retrieve number of bytes in buffer Mehdi Djait
2023-04-25 7:07 ` Matti Vaittinen
2023-04-25 7:26 ` Mehdi Djait
2023-04-24 22:22 ` [PATCH v3 7/7] iio: accel: Add support for Kionix/ROHM KX132-1211 accelerometer Mehdi Djait
2023-04-25 8:06 ` Matti Vaittinen
2023-05-01 15:04 ` Jonathan Cameron
2023-05-01 14:56 ` Jonathan Cameron
2023-05-05 18:11 ` Mehdi Djait
2023-05-06 16:46 ` Jonathan Cameron
2023-05-07 14:56 ` Mehdi Djait
2023-05-13 17:13 ` Jonathan Cameron
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230425155734.ywdle4pv6y2wjk2s@intel.intel \
--to=andi.shyti@kernel.org \
--cc=andriy.shevchenko@linux.intel.com \
--cc=devicetree@vger.kernel.org \
--cc=jic23@kernel.org \
--cc=krzysztof.kozlowski+dt@linaro.org \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mazziesaccount@gmail.com \
--cc=mehdi.djait.k@gmail.com \
--cc=robh+dt@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).