diff options
author | Biju Das <biju.das.jz@bp.renesas.com> | 2023-09-03 11:00:50 +0200 |
---|---|---|
committer | Jonathan Cameron <jonathan.cameron@huawei.com> | 2023-09-12 11:42:04 +0200 |
commit | 7d0ba6dbf8356d20b69cfd042800d5d51ac00bd7 (patch) | |
tree | 80916ae88efcb4fabeb0abf35e5bb6810abd220e /drivers/iio/accel/adxl345_i2c.c | |
parent | iio: adc: ltc2497: Simplify probe() (diff) | |
download | linux-7d0ba6dbf8356d20b69cfd042800d5d51ac00bd7.tar.xz linux-7d0ba6dbf8356d20b69cfd042800d5d51ac00bd7.zip |
iio: accel: adxl345: Convert enum->pointer for data in match data table
Convert enum->pointer for data in match data table, so that
device_get_match_data() can do match against OF/ACPI/I2C tables, once i2c
bus type match support added to it.
Add struct adxl345_chip_info and replace enum->adxl345_chip_info in the
match table and simplify adxl345_probe().
Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
Link: https://lore.kernel.org/r/20230903090051.39274-2-biju.das.jz@bp.renesas.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Diffstat (limited to 'drivers/iio/accel/adxl345_i2c.c')
-rw-r--r-- | drivers/iio/accel/adxl345_i2c.c | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/drivers/iio/accel/adxl345_i2c.c b/drivers/iio/accel/adxl345_i2c.c index e47d12f19602..8cb6254297f7 100644 --- a/drivers/iio/accel/adxl345_i2c.c +++ b/drivers/iio/accel/adxl345_i2c.c @@ -30,22 +30,32 @@ static int adxl345_i2c_probe(struct i2c_client *client) return adxl345_core_probe(&client->dev, regmap); } +static const struct adxl345_chip_info adxl345_i2c_info = { + .name = "adxl345", + .type = ADXL345, +}; + +static const struct adxl345_chip_info adxl375_i2c_info = { + .name = "adxl375", + .type = ADXL375, +}; + static const struct i2c_device_id adxl345_i2c_id[] = { - { "adxl345", ADXL345 }, - { "adxl375", ADXL375 }, + { "adxl345", (kernel_ulong_t)&adxl345_i2c_info }, + { "adxl375", (kernel_ulong_t)&adxl375_i2c_info }, { } }; MODULE_DEVICE_TABLE(i2c, adxl345_i2c_id); static const struct of_device_id adxl345_of_match[] = { - { .compatible = "adi,adxl345", .data = (const void *)ADXL345 }, - { .compatible = "adi,adxl375", .data = (const void *)ADXL375 }, + { .compatible = "adi,adxl345", .data = &adxl345_i2c_info }, + { .compatible = "adi,adxl375", .data = &adxl375_i2c_info }, { } }; MODULE_DEVICE_TABLE(of, adxl345_of_match); static const struct acpi_device_id adxl345_acpi_match[] = { - { "ADS0345", ADXL345 }, + { "ADS0345", (kernel_ulong_t)&adxl345_i2c_info }, { } }; MODULE_DEVICE_TABLE(acpi, adxl345_acpi_match); |