@@ -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,
};
.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(-)