[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250907132902.0286cbe7@jic23-huawei>
Date: Sun, 7 Sep 2025 13:29:02 +0100
From: Jonathan Cameron <jic23@...nel.org>
To: Petre Rodan <petre.rodan@...dimension.ro>
Cc: linux-iio@...r.kernel.org, linux-kernel@...r.kernel.org, David Lechner
<dlechner@...libre.com>, Nuno Sá <nuno.sa@...log.com>, Andy
Shevchenko <andy@...nel.org>
Subject: Re: [PATCH 02/10] iio: accel: BMA220 split original spi driver
On Mon, 1 Sep 2025 22:47:28 +0300
Petre Rodan <petre.rodan@...dimension.ro> wrote:
> Split original driver from bma220_spi.c into bma220_core.c and bma220.h
> with a minimal number of changes in preparation for the next patches.
>
> Signed-off-by: Petre Rodan <petre.rodan@...dimension.ro>
Hi Petre,
A few comments inline.
Jonathan
> diff --git a/drivers/iio/accel/bma220.h b/drivers/iio/accel/bma220.h
> new file mode 100644
> index 000000000000..0606cf478f5f
> --- /dev/null
> +++ b/drivers/iio/accel/bma220.h
> @@ -0,0 +1,17 @@
> +/* SPDX-License-Identifier: GPL-2.0-only */
> +/*
> + * Forward declarations needed by the bma220 sources.
> + *
> + * Copyright 2025 Petre Rodan <petre.rodan@...dimension.ro>
> + */
> +
> +#ifndef _BMA220_H
> +#define _BMA220_H
> +
> +#include <linux/iio/iio.h>
Not used so far so don't include it in this header.
> +
> +extern const struct dev_pm_ops bma220_pm_ops;
Probably want a header for that, though I'm not 100% sure if needed
for an extern or not...
> +
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 000000000000..60fd35637d2d
> --- /dev/null
> +++ b/drivers/iio/accel/bma220_core.c
> @@ -0,0 +1,310 @@
> +// SPDX-License-Identifier: GPL-2.0-only
> +/*
> + * BMA220 Digital triaxial acceleration sensor driver
> + *
> + * Copyright (c) 2016,2020 Intel Corporation.
> + */
> +
> +#include <linux/bits.h>
> +#include <linux/kernel.h>
> +#include <linux/mod_devicetable.h>
> +#include <linux/module.h>
> +#include <linux/types.h>
> +#include <linux/spi/spi.h>
> +
> +#include <linux/iio/buffer.h>
> +#include <linux/iio/iio.h>
> +#include <linux/iio/sysfs.h>
> +#include <linux/iio/trigger_consumer.h>
> +#include <linux/iio/triggered_buffer.h>
Would expect to see this including the new header.
> +
> static const struct spi_device_id bma220_spi_id[] = {
> {"bma220", 0},
> { }
> @@ -314,17 +33,25 @@ static const struct acpi_device_id bma220_acpi_id[] = {
> };
> MODULE_DEVICE_TABLE(spi, bma220_spi_id);
>
> -static struct spi_driver bma220_driver = {
> +static const struct of_device_id bma220_of_spi_match[] = {
This looks like an unrelated change. Do this in a separate patch.
> + { .compatible = "bosch,bma220" },
> + { }
> +};
> +MODULE_DEVICE_TABLE(of, bma220_of_spi_match);
> +
> +static struct spi_driver bma220_spi_driver = {
> .driver = {
> .name = "bma220_spi",
> .pm = pm_sleep_ptr(&bma220_pm_ops),
> + .of_match_table = bma220_of_spi_match,
> .acpi_match_table = bma220_acpi_id,
> },
> - .probe = bma220_probe,
> + .probe = bma220_spi_probe,
> .id_table = bma220_spi_id,
> };
> -module_spi_driver(bma220_driver);
> +module_spi_driver(bma220_spi_driver);
>
> MODULE_AUTHOR("Tiberiu Breana <tiberiu.a.breana@...el.com>");
> -MODULE_DESCRIPTION("BMA220 acceleration sensor driver");
> -MODULE_LICENSE("GPL v2");
> +MODULE_DESCRIPTION("BMA220 triaxial acceleration sensor spi driver");
> +MODULE_LICENSE("GPL");
> +MODULE_IMPORT_NS("IIO_BOSCH_BMA220");
> --
> 2.49.1
>
>
Powered by blists - more mailing lists