From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Mehdi Djait <mehdi.djait.k@gmail.com>
Cc: jic23@kernel.org, mazziesaccount@gmail.com,
krzysztof.kozlowski+dt@linaro.org, robh+dt@kernel.org,
lars@metafoo.de, linux-iio@vger.kernel.org,
linux-kernel@vger.kernel.org, devicetree@vger.kernel.org
Subject: Re: [PATCH v7 5/7] iio: accel: kionix-kx022a: Refactor driver and add chip_info structure
Date: Fri, 11 Aug 2023 12:46:19 +0300 [thread overview]
Message-ID: <ZNYDa+Un5bl5y9vT@smile.fi.intel.com> (raw)
In-Reply-To: <8fb74f21bda4949a862bcb4bb1ed4f0acb135948.1691607526.git.mehdi.djait.k@gmail.com>
On Wed, Aug 09, 2023 at 09:11:36PM +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.
...
> + chip_info = device_get_match_data(&i2c->dev);
> + if (!chip_info) {
> + const struct i2c_device_id *id = i2c_client_get_device_id(i2c);
Missing blank line.
> + chip_info = (const struct kx022a_chip_info *)id->driver_data;
> + if (!chip_info)
> + return -EINVAL;
> + }
...
> - if (val > KX022A_FIFO_LENGTH)
> - val = KX022A_FIFO_LENGTH;
> + val = min_t(unsigned int, data->chip_info->fifo_length, val);
min_t() is a beast. Please, use min() if no special requirement for
min_t() here, otherwise explain why.
...
> + data->fifo_buffer = kmalloc(data->chip_info->fifo_length *
> + KX022A_FIFO_SAMPLES_SIZE_BYTES, GFP_KERNEL);
kmalloc_array()
> + if (!data->fifo_buffer)
> + return -ENOMEM;
--
With Best Regards,
Andy Shevchenko
next prev parent reply other threads:[~2023-08-11 9:46 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-09 19:21 [PATCH v7 0/7] iio: accel: Add support for Kionix/ROHM KX132-1211 accelerometer Mehdi Djait
2023-08-09 19:11 ` Mehdi Djait
2023-08-09 19:11 ` [PATCH v7 1/7] dt-bindings: iio: Add " Mehdi Djait
2023-08-09 19:11 ` [PATCH v7 2/7] iio: accel: kionix-kx022a: Remove blank lines Mehdi Djait
2023-08-09 19:11 ` [PATCH v7 3/7] iio: accel: kionix-kx022a: Warn on failed matches and assume compatibility Mehdi Djait
2023-08-09 19:11 ` [PATCH v7 4/7] iio: accel: kionix-kx022a: Add an i2c_device_id table Mehdi Djait
2023-08-09 19:11 ` [PATCH v7 6/7] iio: accel: kionix-kx022a: Add a function to retrieve number of bytes in buffer Mehdi Djait
2023-08-09 19:11 ` [PATCH v7 7/7] iio: accel: Add support for Kionix/ROHM KX132-1211 accelerometer Mehdi Djait
2023-08-10 5:51 ` Matti Vaittinen
2023-08-09 21:05 ` [PATCH v7 5/7] iio: accel: kionix-kx022a: Refactor driver and add chip_info structure Mehdi Djait
2023-08-09 19:11 ` Mehdi Djait
2023-08-11 9:46 ` Andy Shevchenko [this message]
2023-08-11 10:01 ` Mehdi Djait
2023-08-11 10:08 ` Andy Shevchenko
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=ZNYDa+Un5bl5y9vT@smile.fi.intel.com \
--to=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).