From: Jonathan Cameron <jic23@kernel.org>
To: Petre Rodan <petre.rodan@subdimension.ro>
Cc: "David Lechner" <dlechner@baylibre.com>,
"Nuno Sá" <nuno.sa@analog.com>,
"Andy Shevchenko" <andy@kernel.org>,
"Rob Herring" <robh@kernel.org>,
"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
"Conor Dooley" <conor+dt@kernel.org>,
"Jonathan Cameron" <Jonathan.Cameron@huawei.com>,
linux-iio@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 04/14] iio: accel: bma220: split original driver
Date: Wed, 10 Sep 2025 18:56:46 +0100 [thread overview]
Message-ID: <20250910185646.7b62133f@jic23-huawei> (raw)
In-Reply-To: <20250910-bma220_improvements-v2-4-e23f4f2b9745@subdimension.ro>
On Wed, 10 Sep 2025 10:57:09 +0300
Petre Rodan <petre.rodan@subdimension.ro> wrote:
> In preparation for the i2c module, move the original code into multiple
> source files without any other functional change.
I'd add a note here that you are not even making the interfaces
bus type independent as you are doing that in later regmap patch.
Feels odd to have spi calls in common code!
>
> Create the additional bma220_core module.
> Fix checkpatch warning about GPL v2 license in bma220_spi.c.
Also mention fixing a few includes in bma220_spi.c whilst you
were here.
A few really trivial comments.
>
> Signed-off-by: Petre Rodan <petre.rodan@subdimension.ro>
> ---
> Changes:
> - split out open firmware table modification into separate patch
> - bma220_write_raw() exits without dev_err() based on similar feedback
> from David
> - change includes in bma220.h
> - include bma220.h in bma220_core.c
> - add mutex.h and pm.h includes to bma220_core.c
> - cleanup struct spacing in bma220_spi.c
> ---
> drivers/iio/accel/Kconfig | 9 +-
> drivers/iio/accel/Makefile | 3 +-
> drivers/iio/accel/bma220.h | 19 +++
> drivers/iio/accel/bma220_core.c | 313 ++++++++++++++++++++++++++++++++++++++++
> drivers/iio/accel/bma220_spi.c | 307 ++-------------------------------------
> 5 files changed, 354 insertions(+), 297 deletions(-)
>
> diff --git a/drivers/iio/accel/Kconfig b/drivers/iio/accel/Kconfig
> index 8c3f7cf55d5fa432a4d4662b184a46cd59c3ebca..2cc3075e26883df60b5068c73b0551e1dd02c32e 100644
> --- a/drivers/iio/accel/Kconfig
> +++ b/drivers/iio/accel/Kconfig
> @@ -218,15 +218,20 @@ config BMA180
>
> config BMA220
> tristate "Bosch BMA220 3-Axis Accelerometer Driver"
> - depends on SPI
> select IIO_BUFFER
> select IIO_TRIGGERED_BUFFER
> + select BMA220_SPI if SPI
> help
> Say yes here to add support for the Bosch BMA220 triaxial
> acceleration sensor.
>
> To compile this driver as a module, choose M here: the
> - module will be called bma220_spi.
> + module will be called bma220_core and you will also get
> + bma220_spi if SPI is enabled.
> +
> +config BMA220_SPI
> + tristate
> + depends on BMA220
>
> config BMA400
> tristate "Bosch BMA400 3-Axis Accelerometer Driver"
> diff --git a/drivers/iio/accel/Makefile b/drivers/iio/accel/Makefile
> index ca8569e25aba31c3ae3437abf8506addbf5edffa..56a9f848f7f913633bc2a628c1ac5c9190774b9d 100644
> --- a/drivers/iio/accel/Makefile
> +++ b/drivers/iio/accel/Makefile
> @@ -25,7 +25,8 @@ obj-$(CONFIG_ADXL380) += adxl380.o
> obj-$(CONFIG_ADXL380_I2C) += adxl380_i2c.o
> obj-$(CONFIG_ADXL380_SPI) += adxl380_spi.o
> obj-$(CONFIG_BMA180) += bma180.o
> -obj-$(CONFIG_BMA220) += bma220_spi.o
> +obj-$(CONFIG_BMA220) += bma220_core.o
> +obj-$(CONFIG_BMA220_SPI) += bma220_spi.o
> obj-$(CONFIG_BMA400) += bma400_core.o
> obj-$(CONFIG_BMA400_I2C) += bma400_i2c.o
> obj-$(CONFIG_BMA400_SPI) += bma400_spi.o
> diff --git a/drivers/iio/accel/bma220.h b/drivers/iio/accel/bma220.h
> new file mode 100644
> index 0000000000000000000000000000000000000000..eb311183ebfe37d1a75d858d435eac777efc4ed8
> --- /dev/null
> +++ b/drivers/iio/accel/bma220.h
> @@ -0,0 +1,19 @@
> +/* SPDX-License-Identifier: GPL-2.0-only */
> +/*
> + * Forward declarations needed by the bma220 sources.
> + *
> + * Copyright 2025 Petre Rodan <petre.rodan@subdimension.ro>
> + */
> +
> +#ifndef _BMA220_H
> +#define _BMA220_H
> +
> +#include <linux/pm.h>
> +#include <linux/spi/spi.h>
Don't need spi.h here. The forward declaration of spi_device
deals with only reason it would otherwise be needed.
> +
> +extern const struct dev_pm_ops bma220_pm_ops;
> +struct spi_device;
> +
> +int bma220_common_probe(struct spi_device *dev);
> +
> +#endif
> diff --git a/drivers/iio/accel/bma220_core.c b/drivers/iio/accel/bma220_core.c
> new file mode 100644
> index 0000000000000000000000000000000000000000..6bc2e5c3fb6cebd50209acbcc2d5340630c27cd1
> --- /dev/null
> +++ b/drivers/iio/accel/bma220_core.c
> diff --git a/drivers/iio/accel/bma220_spi.c b/drivers/iio/accel/bma220_spi.c
> index 01592eebf05bb6b002d44c41cca1d2dd5f28350c..3ad5e43aae496d265a8cf198595bf824f8e73692 100644
> --- a/drivers/iio/accel/bma220_spi.c
> +++ b/drivers/iio/accel/bma220_spi.c
> @@ -5,326 +5,45 @@
> * Copyright (c) 2016,2020 Intel Corporation.
> */
>
> -#include <linux/bits.h>
> -#include <linux/kernel.h>
> +#include <linux/device.h>
> +#include <linux/errno.h>
As mentioned above, these additions are good but I think not strictly
related to rest of the change. That's fine. Just mention them in the commit description
> #include <linux/mod_devicetable.h>
> #include <linux/module.h>
> #include <linux/types.h>
> #include <linux/spi/spi.h>
>
next prev parent reply other threads:[~2025-09-10 17:56 UTC|newest]
Thread overview: 41+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-10 7:57 [PATCH v2 00/14] iio: accel: bma220 improvements Petre Rodan
2025-09-10 7:57 ` [PATCH v2 01/14] dt-bindings: iio: accel: bosch,bma220 cleanup typo Petre Rodan
2025-09-11 7:31 ` Krzysztof Kozlowski
2025-09-10 7:57 ` [PATCH v2 02/14] dt-bindings: iio: accel: bosch,bma220 setup SPI clock mode Petre Rodan
2025-09-10 17:48 ` Jonathan Cameron
2025-09-11 7:31 ` Krzysztof Kozlowski
2025-09-10 7:57 ` [PATCH v2 03/14] dt-bindings: iio: accel: bosch,bma220 change irq type Petre Rodan
2025-09-11 7:33 ` Krzysztof Kozlowski
2025-09-11 9:53 ` Petre Rodan
2025-09-10 7:57 ` [PATCH v2 04/14] iio: accel: bma220: split original driver Petre Rodan
2025-09-10 17:56 ` Jonathan Cameron [this message]
2025-09-11 19:01 ` David Lechner
2025-09-10 7:57 ` [PATCH v2 05/14] iio: accel: bma220: add open firmware table Petre Rodan
2025-09-10 7:57 ` [PATCH v2 06/14] iio: accel: bma220: add get regulator check Petre Rodan
2025-09-10 17:58 ` Jonathan Cameron
2025-09-10 18:51 ` Petre Rodan
2025-09-10 20:28 ` Andy Shevchenko
2025-09-10 7:57 ` [PATCH v2 07/14] iio: accel: bma220: reset registers during init stage Petre Rodan
2025-09-10 18:01 ` Jonathan Cameron
2025-09-11 7:35 ` Krzysztof Kozlowski
2025-09-11 12:36 ` Petre Rodan
2025-09-11 13:07 ` Krzysztof Kozlowski
2025-09-11 13:52 ` Petre Rodan
2025-09-11 13:59 ` Andy Shevchenko
2025-09-11 13:44 ` David Lechner
2025-09-12 14:24 ` Jonathan Cameron
2025-09-11 19:14 ` David Lechner
2025-09-10 7:57 ` [PATCH v2 08/14] iio: accel: bma220: migrate to regmap API Petre Rodan
2025-09-10 18:12 ` Jonathan Cameron
2025-09-12 14:54 ` Petre Rodan
2025-09-13 12:22 ` Jonathan Cameron
2025-09-10 7:57 ` [PATCH v2 09/14] iio: accel: bma220: add i2c module Petre Rodan
2025-09-11 19:23 ` David Lechner
2025-09-10 7:57 ` [PATCH v2 10/14] iio: accel: bma220: add i2c watchdog feature Petre Rodan
2025-09-10 7:57 ` [PATCH v2 11/14] iio: accel: bma220: add interrupt trigger Petre Rodan
2025-09-10 18:15 ` Jonathan Cameron
2025-09-10 7:57 ` [PATCH v2 12/14] iio: accel: bma220: add LPF cut-off frequency mapping Petre Rodan
2025-09-10 18:16 ` Jonathan Cameron
2025-09-10 7:57 ` [PATCH v2 13/14] iio: accel: bma220: add debugfs reg access Petre Rodan
2025-09-10 7:57 ` [PATCH v2 14/14] iio: accel: bma220: add maintainer Petre Rodan
2025-09-10 18:18 ` [PATCH v2 00/14] iio: accel: bma220 improvements 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=20250910185646.7b62133f@jic23-huawei \
--to=jic23@kernel.org \
--cc=Jonathan.Cameron@huawei.com \
--cc=andy@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=dlechner@baylibre.com \
--cc=krzk+dt@kernel.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nuno.sa@analog.com \
--cc=petre.rodan@subdimension.ro \
--cc=robh@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