diff options
Diffstat (limited to 'drivers/hwmon/adm1177.c')
| -rw-r--r-- | drivers/hwmon/adm1177.c | 34 |
1 files changed, 6 insertions, 28 deletions
diff --git a/drivers/hwmon/adm1177.c b/drivers/hwmon/adm1177.c index 0c5dbc5e33b4..8b2c965480e3 100644 --- a/drivers/hwmon/adm1177.c +++ b/drivers/hwmon/adm1177.c @@ -26,14 +26,12 @@ /** * struct adm1177_state - driver instance specific data * @client: pointer to i2c client - * @reg: regulator info for the power supply of the device * @r_sense_uohm: current sense resistor value * @alert_threshold_ua: current limit for shutdown * @vrange_high: internal voltage divider */ struct adm1177_state { struct i2c_client *client; - struct regulator *reg; u32 r_sense_uohm; u32 alert_threshold_ua; bool vrange_high; @@ -170,7 +168,7 @@ static umode_t adm1177_is_visible(const void *data, return 0; } -static const struct hwmon_channel_info *adm1177_info[] = { +static const struct hwmon_channel_info * const adm1177_info[] = { HWMON_CHANNEL_INFO(curr, HWMON_C_INPUT | HWMON_C_MAX_ALARM), HWMON_CHANNEL_INFO(in, @@ -189,13 +187,6 @@ static const struct hwmon_chip_info adm1177_chip_info = { .info = adm1177_info, }; -static void adm1177_remove(void *data) -{ - struct adm1177_state *st = data; - - regulator_disable(st->reg); -} - static int adm1177_probe(struct i2c_client *client) { struct device *dev = &client->dev; @@ -210,21 +201,9 @@ static int adm1177_probe(struct i2c_client *client) st->client = client; - st->reg = devm_regulator_get_optional(&client->dev, "vref"); - if (IS_ERR(st->reg)) { - if (PTR_ERR(st->reg) == -EPROBE_DEFER) - return -EPROBE_DEFER; - - st->reg = NULL; - } else { - ret = regulator_enable(st->reg); - if (ret) - return ret; - ret = devm_add_action_or_reset(&client->dev, adm1177_remove, - st); - if (ret) - return ret; - } + ret = devm_regulator_get_enable_optional(&client->dev, "vref"); + if (ret == -EPROBE_DEFER) + return -EPROBE_DEFER; if (device_property_read_u32(dev, "shunt-resistor-micro-ohms", &st->r_sense_uohm)) @@ -259,7 +238,7 @@ static int adm1177_probe(struct i2c_client *client) } static const struct i2c_device_id adm1177_id[] = { - {"adm1177", 0}, + {"adm1177"}, {} }; MODULE_DEVICE_TABLE(i2c, adm1177_id); @@ -271,12 +250,11 @@ static const struct of_device_id adm1177_dt_ids[] = { MODULE_DEVICE_TABLE(of, adm1177_dt_ids); static struct i2c_driver adm1177_driver = { - .class = I2C_CLASS_HWMON, .driver = { .name = "adm1177", .of_match_table = adm1177_dt_ids, }, - .probe_new = adm1177_probe, + .probe = adm1177_probe, .id_table = adm1177_id, }; module_i2c_driver(adm1177_driver); |
