diff mbox series

[03/23] iio: accel: bma400: Convert to i2c's .probe_new

Message ID 20221023132302.911644-4-u.kleine-koenig@pengutronix.de (mailing list archive)
State Changes Requested
Headers show
Series iio: accel: Convert to i2c's .probe_new | expand

Commit Message

Uwe Kleine-König Oct. 23, 2022, 1:22 p.m. UTC
.probe_new() doesn't get the i2c_device_id * parameter, so determine
that explicitly in .probe(). The device_id array has to move up for that
to work.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/iio/accel/bma400_i2c.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)
diff mbox series

Patch

diff --git a/drivers/iio/accel/bma400_i2c.c b/drivers/iio/accel/bma400_i2c.c
index 1ba2a982ea73..cf7a830d6baf 100644
--- a/drivers/iio/accel/bma400_i2c.c
+++ b/drivers/iio/accel/bma400_i2c.c
@@ -13,10 +13,16 @@ 
 
 #include "bma400.h"
 
-static int bma400_i2c_probe(struct i2c_client *client,
-			    const struct i2c_device_id *id)
+static const struct i2c_device_id bma400_i2c_ids[] = {
+	{ "bma400", 0 },
+	{ }
+};
+MODULE_DEVICE_TABLE(i2c, bma400_i2c_ids);
+
+static int bma400_i2c_probe(struct i2c_client *client)
 {
 	struct regmap *regmap;
+	const struct i2c_device_id *id = i2c_match_id(bma400_i2c_ids, client);
 
 	regmap = devm_regmap_init_i2c(client, &bma400_regmap_config);
 	if (IS_ERR(regmap)) {
@@ -27,12 +33,6 @@  static int bma400_i2c_probe(struct i2c_client *client,
 	return bma400_probe(&client->dev, regmap, client->irq, id->name);
 }
 
-static const struct i2c_device_id bma400_i2c_ids[] = {
-	{ "bma400", 0 },
-	{ }
-};
-MODULE_DEVICE_TABLE(i2c, bma400_i2c_ids);
-
 static const struct of_device_id bma400_of_i2c_match[] = {
 	{ .compatible = "bosch,bma400" },
 	{ }
@@ -44,7 +44,7 @@  static struct i2c_driver bma400_i2c_driver = {
 		.name = "bma400",
 		.of_match_table = bma400_of_i2c_match,
 	},
-	.probe    = bma400_i2c_probe,
+	.probe_new = bma400_i2c_probe,
 	.id_table = bma400_i2c_ids,
 };