Re: [PATCH v3 4/5] iio: accel: mc3230: add multiple devices support
From: Krzysztof Kozlowski
Date: Mon Jan 13 2025 - 03:51:50 EST
On Sun, Jan 12, 2025 at 03:25:38PM +0300, Vasiliy Doylov wrote:
> This patch allows to add new devices to this driver.
>
> Signed-off-by: Vasiliy Doylov <nekodevelopper@xxxxxxxxx>
> ---
> drivers/iio/accel/mc3230.c | 50 ++++++++++++++++++++++++++++++++++------------
> 1 file changed, 37 insertions(+), 13 deletions(-)
>
> diff --git a/drivers/iio/accel/mc3230.c b/drivers/iio/accel/mc3230.c
> index ba30c904d3f67002deeb3ca5a7e12bfae312e05f..1b58f3ea50655b6563a78a2531b16a8088e8f8d5 100644
> --- a/drivers/iio/accel/mc3230.c
> +++ b/drivers/iio/accel/mc3230.c
> @@ -22,20 +22,29 @@
> #define MC3230_MODE_OPCON_STANDBY 0x03
>
> #define MC3230_REG_CHIP_ID 0x18
> -#define MC3230_CHIP_ID 0x01
> -
> #define MC3230_REG_PRODUCT_CODE 0x3b
> -#define MC3230_PRODUCT_CODE 0x19
>
> /*
> * The accelerometer has one measurement range:
> *
> * -1.5g - +1.5g (8-bit, signed)
> *
> - * scale = (1.5 + 1.5) * 9.81 / (2^8 - 1) = 0.115411765
> */
>
> -static const int mc3230_nscale = 115411765;
> +struct mc3230_chip_info {
> + const u8 chip_id;
> + const char *name;
> + const u8 product_code;
> + const int scale;
> +};
> +
> +static struct mc3230_chip_info mc3230_chip_info = {
Why this cannot be const?
Best regards,
Krzysztof