* [PATCH v3 1/2] iio: accel: adxl313: Fix adxl313_i2c_id[] table
2023-07-25 17:16 [PATCH v3 0/2] Use i2c_get_match_data() instead of device_get_match_data() Biju Das
@ 2023-07-25 17:16 ` Biju Das
2023-07-25 17:16 ` [PATCH v3 2/2] iio: accel: adxl313: Use i2c_get_match_data Biju Das
2023-07-29 11:31 ` [PATCH v3 0/2] Use i2c_get_match_data() instead of device_get_match_data() Jonathan Cameron
2 siblings, 0 replies; 4+ messages in thread
From: Biju Das @ 2023-07-25 17:16 UTC (permalink / raw)
To: Jonathan Cameron
Cc: Biju Das, Lucas Stankus, Lars-Peter Clausen, Michael Hennerich,
George Mois, linux-iio, Geert Uytterhoeven, linux-renesas-soc
The .driver_data in adxl313_i2c_id[] for adxl312 and adxl314 is
wrong. Fix this issue by adding corresponding adxl31x_chip_info
data.
Reported-by: Jonathan Cameron <jic23@kernel.org>
Closes: https://lore.kernel.org/all/20230722172832.04ad7738@jic23-huawei
Fixes: a7a1c60bc4c9 ("drivers: iio: accel: adxl312 and adxl314 support")
Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
v2->v3:
* Added Rb tag from Geert.
* Added link to lore for Closes tag.
---
drivers/iio/accel/adxl313_i2c.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/iio/accel/adxl313_i2c.c b/drivers/iio/accel/adxl313_i2c.c
index 524327ea3663..e0a860ab9e58 100644
--- a/drivers/iio/accel/adxl313_i2c.c
+++ b/drivers/iio/accel/adxl313_i2c.c
@@ -40,8 +40,8 @@ static const struct regmap_config adxl31x_i2c_regmap_config[] = {
static const struct i2c_device_id adxl313_i2c_id[] = {
{ .name = "adxl312", .driver_data = (kernel_ulong_t)&adxl31x_chip_info[ADXL312] },
- { .name = "adxl313", .driver_data = (kernel_ulong_t)&adxl31x_chip_info[ADXL312] },
- { .name = "adxl314", .driver_data = (kernel_ulong_t)&adxl31x_chip_info[ADXL312] },
+ { .name = "adxl313", .driver_data = (kernel_ulong_t)&adxl31x_chip_info[ADXL313] },
+ { .name = "adxl314", .driver_data = (kernel_ulong_t)&adxl31x_chip_info[ADXL314] },
{ }
};
--
2.25.1
^ permalink raw reply related [flat|nested] 4+ messages in thread* [PATCH v3 2/2] iio: accel: adxl313: Use i2c_get_match_data
2023-07-25 17:16 [PATCH v3 0/2] Use i2c_get_match_data() instead of device_get_match_data() Biju Das
2023-07-25 17:16 ` [PATCH v3 1/2] iio: accel: adxl313: Fix adxl313_i2c_id[] table Biju Das
@ 2023-07-25 17:16 ` Biju Das
2023-07-29 11:31 ` [PATCH v3 0/2] Use i2c_get_match_data() instead of device_get_match_data() Jonathan Cameron
2 siblings, 0 replies; 4+ messages in thread
From: Biju Das @ 2023-07-25 17:16 UTC (permalink / raw)
To: Jonathan Cameron
Cc: Biju Das, Lars-Peter Clausen, Michael Hennerich, Lucas Stankus,
linux-iio, Geert Uytterhoeven, linux-renesas-soc
Replace device_get_match_data() and i2c_match_id() by i2c_get_match
_data() as we have similar I2C and DT-based matching table.
Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
v2->v3:
* No change.
v1->v2:
* Added Rb tag from Geert
* Removed error check as all tables have data pointers.
* retained Rb tag as the change is trivial.
---
drivers/iio/accel/adxl313_i2c.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/iio/accel/adxl313_i2c.c b/drivers/iio/accel/adxl313_i2c.c
index e0a860ab9e58..a4cf0cf2c5aa 100644
--- a/drivers/iio/accel/adxl313_i2c.c
+++ b/drivers/iio/accel/adxl313_i2c.c
@@ -65,9 +65,7 @@ static int adxl313_i2c_probe(struct i2c_client *client)
* Retrieves device specific data as a pointer to a
* adxl313_chip_info structure
*/
- chip_data = device_get_match_data(&client->dev);
- if (!chip_data)
- chip_data = (const struct adxl313_chip_info *)i2c_match_id(adxl313_i2c_id, client)->driver_data;
+ chip_data = i2c_get_match_data(client);
regmap = devm_regmap_init_i2c(client,
&adxl31x_i2c_regmap_config[chip_data->type]);
--
2.25.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v3 0/2] Use i2c_get_match_data() instead of device_get_match_data()
2023-07-25 17:16 [PATCH v3 0/2] Use i2c_get_match_data() instead of device_get_match_data() Biju Das
2023-07-25 17:16 ` [PATCH v3 1/2] iio: accel: adxl313: Fix adxl313_i2c_id[] table Biju Das
2023-07-25 17:16 ` [PATCH v3 2/2] iio: accel: adxl313: Use i2c_get_match_data Biju Das
@ 2023-07-29 11:31 ` Jonathan Cameron
2 siblings, 0 replies; 4+ messages in thread
From: Jonathan Cameron @ 2023-07-29 11:31 UTC (permalink / raw)
To: Biju Das
Cc: Lucas Stankus, Lars-Peter Clausen, Michael Hennerich, George Mois,
linux-iio, Geert Uytterhoeven, linux-renesas-soc
On Tue, 25 Jul 2023 18:16:22 +0100
Biju Das <biju.das.jz@bp.renesas.com> wrote:
> Use i2c_get_match_data() to get match data for I2C, ACPI and
> DT-based matching instead of device_get_match_data() the one for
> ACPI/DT-based matching.
>
> This patch series is only compile tested.
Even though one of these is a fix I'll take them the slow route
to avoid having to hold on to the second patch.
Applied to the togreg branch of iio.git and pushed out as testing
for all the normal reasons.
Jonathan
>
> v2->v3:
> * Added Rb tag from Geert for patch#1.
> * Added link to lore for Closes tag.
> v1->v2:
> * Added patch#1 for fixing adxl313_i2c_id[] table.
> * Added Rb tag from Geert
> * Removed error check as all tables have data pointers.
> * retained Rb tag as the change is trivial.
>
> Biju Das (2):
> iio: accel: adxl313: Fix adxl313_i2c_id[] table
> iio: accel: adxl313: Use i2c_get_match_data
>
> drivers/iio/accel/adxl313_i2c.c | 8 +++-----
> 1 file changed, 3 insertions(+), 5 deletions(-)
>
^ permalink raw reply [flat|nested] 4+ messages in thread