summaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/ads7828.c
diff options
context:
space:
mode:
authorStephen Kitt <steve@sk2.org>2020-08-21 18:03:54 +0200
committerGuenter Roeck <linux@roeck-us.net>2020-09-23 09:42:40 -0700
commit673afe466166cda94053d2d2400e669fe19f8050 (patch)
tree358bd6aa76103330dd02854a6eacd61780dc4680 /drivers/hwmon/ads7828.c
parentc1e60c0d571b6c0264ae18f5e2cfdb34569da762 (diff)
downloadlinux-673afe466166cda94053d2d2400e669fe19f8050.tar.gz
linux-673afe466166cda94053d2d2400e669fe19f8050.tar.bz2
linux-673afe466166cda94053d2d2400e669fe19f8050.zip
hwmon: use simple i2c probe function (take 2)
Many hwmon drivers don't use the id information provided by the old i2c probe function, and the remainder can easily be adapted to the new form ("probe_new") by calling i2c_match_id explicitly. This avoids scanning the identifier tables during probes. Drivers which didn't use the id are converted as-is; drivers which did are modified to call i2c_match_id() with the same level of error-handling (if any) as before. This patch wraps up the transition for hwmon, with four stragglers not included in the previous large patch. Signed-off-by: Stephen Kitt <steve@sk2.org> Link: https://lore.kernel.org/r/20200821160354.594715-1-steve@sk2.org Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Diffstat (limited to 'drivers/hwmon/ads7828.c')
-rw-r--r--drivers/hwmon/ads7828.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/hwmon/ads7828.c b/drivers/hwmon/ads7828.c
index d895b73fde6f..7246198f0901 100644
--- a/drivers/hwmon/ads7828.c
+++ b/drivers/hwmon/ads7828.c
@@ -99,8 +99,9 @@ static const struct regmap_config ads2830_regmap_config = {
.val_bits = 8,
};
-static int ads7828_probe(struct i2c_client *client,
- const struct i2c_device_id *id)
+static const struct i2c_device_id ads7828_device_ids[];
+
+static int ads7828_probe(struct i2c_client *client)
{
struct device *dev = &client->dev;
struct ads7828_platform_data *pdata = dev_get_platdata(dev);
@@ -141,7 +142,7 @@ static int ads7828_probe(struct i2c_client *client,
chip = (enum ads7828_chips)
of_device_get_match_data(&client->dev);
else
- chip = id->driver_data;
+ chip = i2c_match_id(ads7828_device_ids, client)->driver_data;
/* Bound Vref with min/max values */
vref_mv = clamp_val(vref_mv, ADS7828_EXT_VREF_MV_MIN,
@@ -207,7 +208,7 @@ static struct i2c_driver ads7828_driver = {
},
.id_table = ads7828_device_ids,
- .probe = ads7828_probe,
+ .probe_new = ads7828_probe,
};
module_i2c_driver(ads7828_driver);