Re: [PATCH next v2] iio: sca3000: simplify with spi_get_device_match_data()
From: Harshit Mogalapalli
Date: Fri Feb 20 2026 - 06:45:29 EST
Hi Jonathan,
On 20/02/26 16:21, Jonathan Cameron wrote:
On Mon, 16 Feb 2026 02:24:48 -0800
Harshit Mogalapalli <harshit.m.mogalapalli@xxxxxxxxxx> wrote:
Refactor each sca3000 variant with it's own chip_info struct, update the
sca3000_probe() to use spi_get_device_match_data().
Suggested-by: David Lechner <dlechner@xxxxxxxxxxxx>
Suggested-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxx>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxx>
Signed-off-by: Harshit Mogalapalli <harshit.m.mogalapalli@xxxxxxxxxx>
I made a couple of white space tweaks whilst applying.
Applied to the testing branch of iio.git. There was quite
a bit of fuzz (line changes) but was all straight forward.
Oh, sorry for that. Maybe because these patches: https://lore.kernel.org/all/20260205195845.4e108117@jic23-huawei/ were not present ?
I don't see them here: https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git/log/drivers/iio/accel/sca3000.c?h=testing , so asking.
This patch might have applied cleaner with the above series applied.
thanks,...
Jonathan
---
Only compile tested.
v1->v2: Andy suggested we drop a NULL check on
spi_get_device_match_data() failure. Also added Andy's RB.
---
drivers/iio/accel/sca3000.c | 127 +++++++++++++++++-------------------
1 file changed, 59 insertions(+), 68 deletions(-)
diff --git a/drivers/iio/accel/sca3000.c b/drivers/iio/accel/sca3000.c
index d4c117f54a07..eeb313056259 100644
--- a/drivers/iio/accel/sca3000.c
+++ b/drivers/iio/accel/sca3000.c
@@ -172,6 +172,7 @@ struct sca3000_state {
static const struct spi_device_id sca3000_id[] = {Similarly let's add some spaces to these.
- {"sca3000_d01", d01},
- {"sca3000_e02", e02},
- {"sca3000_e04", e04},
- {"sca3000_e05", e05},
+ {"sca3000_d01", (kernel_ulong_t)&sca3000_chip_info_d01},
+ {"sca3000_e02", (kernel_ulong_t)&sca3000_chip_info_e02},
+ {"sca3000_e04", (kernel_ulong_t)&sca3000_chip_info_e04},
+ {"sca3000_e05", (kernel_ulong_t)&sca3000_chip_info_e05},
I didn't add the space mostly because there were not there before. Will check for other similar drivers next time, thanks a lot for dealing with them by yourself.
Thanks,
Harshit
{ }
};
MODULE_DEVICE_TABLE(spi, sca3000_id);