From: "Nuno Sá" <noname.nuno@gmail.com>
To: Lothar Rubusch <l.rubusch@gmail.com>,
lars@metafoo.de, Michael.Hennerich@analog.com, jic23@kernel.org
Cc: linux-iio@vger.kernel.org, eraretuya@gmail.com
Subject: Re: [PATCH 1/2] iio: adxl345: add spi-3wire
Date: Wed, 20 Mar 2024 11:34:20 +0100 [thread overview]
Message-ID: <95b4f98948f1c3a802d185e947ad0bbcfef0a779.camel@gmail.com> (raw)
In-Reply-To: <20240319212713.257600-2-l.rubusch@gmail.com>
On Tue, 2024-03-19 at 21:27 +0000, Lothar Rubusch wrote:
> Adds the spi-3wire feature and adds general refactoring to the
> iio driver.
>
> The patch moves driver wide constants and fields into the
> header. Thereby reduces redundant info struct definitions.
> Allows to pass a function pointer from SPI/I2C specific probe,
> and smaller refactorings. A regmap_update_bits() in the core
> file replaces the regmap_write() to format_data.
>
> Signed-off-by: Lothar Rubusch <l.rubusch@gmail.com>
> ---
On top of what Krzysztof already said I would also like for you to split the
spi-3wire (which is adding a new feature) from the refactor in two different
patches. One more comment inline...
> drivers/iio/accel/adxl345.h | 44 +++++++++++-
> drivers/iio/accel/adxl345_core.c | 116 +++++++++++++++++--------------
> drivers/iio/accel/adxl345_i2c.c | 30 ++++----
> drivers/iio/accel/adxl345_spi.c | 50 ++++++++-----
> 4 files changed, 153 insertions(+), 87 deletions(-)
>
...
> diff --git a/drivers/iio/accel/adxl345_spi.c b/drivers/iio/accel/adxl345_spi.c
> index 93ca349f1..e456b61c6 100644
> --- a/drivers/iio/accel/adxl345_spi.c
> +++ b/drivers/iio/accel/adxl345_spi.c
> @@ -20,48 +20,62 @@ static const struct regmap_config
> adxl345_spi_regmap_config = {
> .read_flag_mask = BIT(7) | BIT(6),
> };
>
> +static int adxl345_spi_setup(struct device *dev, struct regmap *regmap)
> +{
> + struct spi_device *spi = container_of(dev, struct spi_device, dev);
> + int ret;
> +
> + if (spi->mode & SPI_3WIRE) {
> + ret = regmap_write(regmap, ADXL345_REG_DATA_FORMAT,
> + ADXL345_DATA_FORMAT_SPI);
> + if (ret)
> + return ret;
> + }
> +
> + return 0;
I think this would be neater:
if (!(spi->mode & SPI_3WIRE))
return 0;
return regmap_write(regmap, ADXL345_REG_DATA_FORMAT,
ADXL345_DATA_FORMAT_SPI);
- Nuno Sá
next prev parent reply other threads:[~2024-03-20 10:30 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-19 21:27 [PATCH 0/2] iio: adxl345: add spi-3wire and refac Lothar Rubusch
2024-03-19 21:27 ` [PATCH 1/2] iio: adxl345: add spi-3wire Lothar Rubusch
2024-03-20 9:37 ` Krzysztof Kozlowski
2024-03-22 0:32 ` Lothar Rubusch
2024-03-22 5:37 ` Krzysztof Kozlowski
2024-03-22 6:58 ` Nuno Sá
2024-03-24 13:14 ` Jonathan Cameron
2024-03-20 10:34 ` Nuno Sá [this message]
2024-03-22 0:33 ` Lothar Rubusch
2024-03-19 21:27 ` [PATCH 2/2] iio: adxl345: update documentation for spi-3wire Lothar Rubusch
2024-03-20 9:34 ` Krzysztof Kozlowski
2024-03-22 0:27 ` Lothar Rubusch
2024-03-22 5:36 ` Krzysztof Kozlowski
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=95b4f98948f1c3a802d185e947ad0bbcfef0a779.camel@gmail.com \
--to=noname.nuno@gmail.com \
--cc=Michael.Hennerich@analog.com \
--cc=eraretuya@gmail.com \
--cc=jic23@kernel.org \
--cc=l.rubusch@gmail.com \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.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