forked from luck/tmp_suning_uos_patched
hwmon: (pmbus) Convert to use hwmon_device_register_with_groups
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
This commit is contained in:
parent
9a85d53cfc
commit
c3b7cddc70
|
@ -97,6 +97,7 @@ struct pmbus_data {
|
||||||
int max_attributes;
|
int max_attributes;
|
||||||
int num_attributes;
|
int num_attributes;
|
||||||
struct attribute_group group;
|
struct attribute_group group;
|
||||||
|
const struct attribute_group *groups[2];
|
||||||
|
|
||||||
struct pmbus_sensor *sensors;
|
struct pmbus_sensor *sensors;
|
||||||
|
|
||||||
|
@ -348,7 +349,7 @@ static struct _pmbus_status {
|
||||||
|
|
||||||
static struct pmbus_data *pmbus_update_device(struct device *dev)
|
static struct pmbus_data *pmbus_update_device(struct device *dev)
|
||||||
{
|
{
|
||||||
struct i2c_client *client = to_i2c_client(dev);
|
struct i2c_client *client = to_i2c_client(dev->parent);
|
||||||
struct pmbus_data *data = i2c_get_clientdata(client);
|
struct pmbus_data *data = i2c_get_clientdata(client);
|
||||||
const struct pmbus_driver_info *info = data->info;
|
const struct pmbus_driver_info *info = data->info;
|
||||||
struct pmbus_sensor *sensor;
|
struct pmbus_sensor *sensor;
|
||||||
|
@ -733,7 +734,7 @@ static ssize_t pmbus_set_sensor(struct device *dev,
|
||||||
struct device_attribute *devattr,
|
struct device_attribute *devattr,
|
||||||
const char *buf, size_t count)
|
const char *buf, size_t count)
|
||||||
{
|
{
|
||||||
struct i2c_client *client = to_i2c_client(dev);
|
struct i2c_client *client = to_i2c_client(dev->parent);
|
||||||
struct pmbus_data *data = i2c_get_clientdata(client);
|
struct pmbus_data *data = i2c_get_clientdata(client);
|
||||||
struct pmbus_sensor *sensor = to_pmbus_sensor(devattr);
|
struct pmbus_sensor *sensor = to_pmbus_sensor(devattr);
|
||||||
ssize_t rv = count;
|
ssize_t rv = count;
|
||||||
|
@ -1768,22 +1769,16 @@ int pmbus_do_probe(struct i2c_client *client, const struct i2c_device_id *id,
|
||||||
goto out_kfree;
|
goto out_kfree;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Register sysfs hooks */
|
data->groups[0] = &data->group;
|
||||||
ret = sysfs_create_group(&dev->kobj, &data->group);
|
data->hwmon_dev = hwmon_device_register_with_groups(dev, client->name,
|
||||||
if (ret) {
|
data, data->groups);
|
||||||
dev_err(dev, "Failed to create sysfs entries\n");
|
|
||||||
goto out_kfree;
|
|
||||||
}
|
|
||||||
data->hwmon_dev = hwmon_device_register(dev);
|
|
||||||
if (IS_ERR(data->hwmon_dev)) {
|
if (IS_ERR(data->hwmon_dev)) {
|
||||||
ret = PTR_ERR(data->hwmon_dev);
|
ret = PTR_ERR(data->hwmon_dev);
|
||||||
dev_err(dev, "Failed to register hwmon device\n");
|
dev_err(dev, "Failed to register hwmon device\n");
|
||||||
goto out_hwmon_device_register;
|
goto out_kfree;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
out_hwmon_device_register:
|
|
||||||
sysfs_remove_group(&dev->kobj, &data->group);
|
|
||||||
out_kfree:
|
out_kfree:
|
||||||
kfree(data->group.attrs);
|
kfree(data->group.attrs);
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -1794,7 +1789,6 @@ int pmbus_do_remove(struct i2c_client *client)
|
||||||
{
|
{
|
||||||
struct pmbus_data *data = i2c_get_clientdata(client);
|
struct pmbus_data *data = i2c_get_clientdata(client);
|
||||||
hwmon_device_unregister(data->hwmon_dev);
|
hwmon_device_unregister(data->hwmon_dev);
|
||||||
sysfs_remove_group(&client->dev.kobj, &data->group);
|
|
||||||
kfree(data->group.attrs);
|
kfree(data->group.attrs);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user