From: Jonathan Cameron <jic23@kernel.org>
To: Mehdi Djait <mehdi.djait.k@gmail.com>
Cc: 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 v9 6/7] iio: accel: kionix-kx022a: Add a function to retrieve number of bytes in buffer
Date: Sun, 17 Sep 2023 10:45:58 +0100 [thread overview]
Message-ID: <20230917104558.19179dbc@jic23-huawei> (raw)
In-Reply-To: <9c550fb28e34915d473e379f812c7753f7643bae.1694867379.git.mehdi.djait.k@gmail.com>
On Sat, 16 Sep 2023 14:38:52 +0200
Mehdi Djait <mehdi.djait.k@gmail.com> wrote:
> Since Kionix accelerometers use various numbers of bits to report data, a
> device-specific function is required.
> Implement the function as a callback in the device-specific chip_info structure
>
> Reviewed-by: Matti Vaittinen <mazziesaccount@gmail.com>
> Signed-off-by: Mehdi Djait <mehdi.djait.k@gmail.com>
> const struct kx022a_chip_info kx022a_chip_info = {
> - .name = "kx022-accel",
> - .regmap_config = &kx022a_regmap_config,
> - .channels = kx022a_channels,
> - .num_channels = ARRAY_SIZE(kx022a_channels),
> - .fifo_length = KX022A_FIFO_LENGTH,
> - .who = KX022A_REG_WHO,
> - .id = KX022A_ID,
> - .cntl = KX022A_REG_CNTL,
> - .cntl2 = KX022A_REG_CNTL2,
> - .odcntl = KX022A_REG_ODCNTL,
> - .buf_cntl1 = KX022A_REG_BUF_CNTL1,
> - .buf_cntl2 = KX022A_REG_BUF_CNTL2,
> - .buf_clear = KX022A_REG_BUF_CLEAR,
> - .buf_status1 = KX022A_REG_BUF_STATUS_1,
> - .buf_read = KX022A_REG_BUF_READ,
> - .inc1 = KX022A_REG_INC1,
> - .inc4 = KX022A_REG_INC4,
> - .inc5 = KX022A_REG_INC5,
> - .inc6 = KX022A_REG_INC6,
> - .xout_l = KX022A_REG_XOUT_L,
This is a very good illustration of why aligning value assignments is not
(in my opinion) a good idea. I'll tweak the earlier patch whilst
applying to add the extra indent.
However, in future look through your complete series for cases where
code added in an earlier patch is simply reformatted in a later one.
Same applies to the structure kdoc below.
> + .name = "kx022-accel",
> + .regmap_config = &kx022a_regmap_config,
> + .channels = kx022a_channels,
> + .num_channels = ARRAY_SIZE(kx022a_channels),
> + .fifo_length = KX022A_FIFO_LENGTH,
> + .who = KX022A_REG_WHO,
> + .id = KX022A_ID,
> + .cntl = KX022A_REG_CNTL,
> + .cntl2 = KX022A_REG_CNTL2,
> + .odcntl = KX022A_REG_ODCNTL,
> + .buf_cntl1 = KX022A_REG_BUF_CNTL1,
> + .buf_cntl2 = KX022A_REG_BUF_CNTL2,
> + .buf_clear = KX022A_REG_BUF_CLEAR,
> + .buf_status1 = KX022A_REG_BUF_STATUS_1,
> + .buf_read = KX022A_REG_BUF_READ,
> + .inc1 = KX022A_REG_INC1,
> + .inc4 = KX022A_REG_INC4,
> + .inc5 = KX022A_REG_INC5,
> + .inc6 = KX022A_REG_INC6,
> + .xout_l = KX022A_REG_XOUT_L,
> + .get_fifo_bytes_available = kx022a_get_fifo_bytes_available,
> };
> EXPORT_SYMBOL_NS_GPL(kx022a_chip_info, IIO_KX022A);
>
> diff --git a/drivers/iio/accel/kionix-kx022a.h b/drivers/iio/accel/kionix-kx022a.h
> index 0e5026019213..7ca48e6f2c49 100644
> --- a/drivers/iio/accel/kionix-kx022a.h
> +++ b/drivers/iio/accel/kionix-kx022a.h
> @@ -76,29 +76,34 @@
>
> struct device;
>
> +struct kx022a_data;
> +
> /**
> * struct kx022a_chip_info - Kionix accelerometer chip specific information
> *
> - * @name: name of the device
> - * @regmap_config: pointer to register map configuration
> - * @channels: pointer to iio_chan_spec array
> - * @num_channels: number of iio_chan_spec channels
> - * @fifo_length: number of 16-bit samples in a full buffer
> - * @who: WHO_AM_I register
> - * @id: WHO_AM_I register value
> - * @cntl: control register 1
> - * @cntl2: control register 2
> - * @odcntl: output data control register
> - * @buf_cntl1: buffer control register 1
> - * @buf_cntl2: buffer control register 2
> - * @buf_clear: buffer clear register
> - * @buf_status1: buffer status register 1
> - * @buf_read: buffer read register
> - * @inc1: interrupt control register 1
> - * @inc4: interrupt control register 4
> - * @inc5: interrupt control register 5
> - * @inc6: interrupt control register 6
> - * @xout_l: x-axis output least significant byte
> + * @name: name of the device
> + * @regmap_config: pointer to register map configuration
> + * @channels: pointer to iio_chan_spec array
> + * @num_channels: number of iio_chan_spec channels
> + * @fifo_length: number of 16-bit samples in a full buffer
> + * @who: WHO_AM_I register
> + * @id: WHO_AM_I register value
> + * @cntl: control register 1
> + * @cntl2: control register 2
> + * @odcntl: output data control register
> + * @buf_cntl1: buffer control register 1
> + * @buf_cntl2: buffer control register 2
> + * @buf_clear: buffer clear register
> + * @buf_status1: buffer status register 1
> + * @buf_read: buffer read register
> + * @inc1: interrupt control register 1
> + * @inc4: interrupt control register 4
> + * @inc5: interrupt control register 5
> + * @inc6: interrupt control register 6
> + * @xout_l: x-axis output least significant byte
> + * @get_fifo_bytes_available: function pointer to get amount of acceleration
> + * data bytes currently stored in the sensor's FIFO
> + * buffer
> */
> struct kx022a_chip_info {
> const char *name;
> @@ -121,6 +126,7 @@ struct kx022a_chip_info {
> u8 inc5;
> u8 inc6;
> u8 xout_l;
> + int (*get_fifo_bytes_available)(struct kx022a_data *);
> };
>
> int kx022a_probe_internal(struct device *dev, const struct kx022a_chip_info *chip_info);
next prev parent reply other threads:[~2023-09-17 9:46 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-16 12:38 [PATCH v9 0/7] iio: accel: Add support for Kionix/ROHM KX132-1211 accelerometer Mehdi Djait
2023-09-16 12:38 ` [PATCH v9 1/7] dt-bindings: iio: Add " Mehdi Djait
2023-09-16 12:38 ` [PATCH v9 2/7] iio: accel: kionix-kx022a: Remove blank lines Mehdi Djait
2023-09-16 12:38 ` [PATCH v9 3/7] iio: accel: kionix-kx022a: Warn on failed matches and assume compatibility Mehdi Djait
2023-09-16 12:38 ` [PATCH v9 4/7] iio: accel: kionix-kx022a: Add an i2c_device_id table Mehdi Djait
2023-09-16 12:38 ` [PATCH v9 5/7] iio: accel: kionix-kx022a: Refactor driver and add chip_info structure Mehdi Djait
2023-09-16 12:38 ` [PATCH v9 6/7] iio: accel: kionix-kx022a: Add a function to retrieve number of bytes in buffer Mehdi Djait
2023-09-17 9:45 ` Jonathan Cameron [this message]
2023-09-16 12:38 ` [PATCH v9 7/7] iio: accel: Add support for Kionix/ROHM KX132-1211 accelerometer Mehdi Djait
2023-09-17 9:47 ` [PATCH v9 0/7] " 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=20230917104558.19179dbc@jic23-huawei \
--to=jic23@kernel.org \
--cc=andriy.shevchenko@linux.intel.com \
--cc=devicetree@vger.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).