mirror of https://gitee.com/openkylin/linux.git
hwmon: (max6639) Introduce local dev variable, and reduce noisiness
Introduce local variable 'dev' in probe function to make code easier to read. Also drop dev_info message in probe to reduce noisiness during boot. Signed-off-by: Guenter Roeck <linux@roeck-us.net> Reviewed-by: Jean Delvare <jdelvare@suse.de>
This commit is contained in:
parent
71ba0f315c
commit
c1ea0a0431
|
@ -545,11 +545,11 @@ static int max6639_detect(struct i2c_client *client,
|
||||||
static int max6639_probe(struct i2c_client *client,
|
static int max6639_probe(struct i2c_client *client,
|
||||||
const struct i2c_device_id *id)
|
const struct i2c_device_id *id)
|
||||||
{
|
{
|
||||||
|
struct device *dev = &client->dev;
|
||||||
struct max6639_data *data;
|
struct max6639_data *data;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
data = devm_kzalloc(&client->dev, sizeof(struct max6639_data),
|
data = devm_kzalloc(dev, sizeof(struct max6639_data), GFP_KERNEL);
|
||||||
GFP_KERNEL);
|
|
||||||
if (!data)
|
if (!data)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
|
@ -562,22 +562,20 @@ static int max6639_probe(struct i2c_client *client,
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
/* Register sysfs hooks */
|
/* Register sysfs hooks */
|
||||||
err = sysfs_create_group(&client->dev.kobj, &max6639_group);
|
err = sysfs_create_group(&dev->kobj, &max6639_group);
|
||||||
if (err)
|
if (err)
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
data->hwmon_dev = hwmon_device_register(&client->dev);
|
data->hwmon_dev = hwmon_device_register(dev);
|
||||||
if (IS_ERR(data->hwmon_dev)) {
|
if (IS_ERR(data->hwmon_dev)) {
|
||||||
err = PTR_ERR(data->hwmon_dev);
|
err = PTR_ERR(data->hwmon_dev);
|
||||||
goto error_remove;
|
goto error_remove;
|
||||||
}
|
}
|
||||||
|
|
||||||
dev_info(&client->dev, "temperature sensor and fan control found\n");
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
error_remove:
|
error_remove:
|
||||||
sysfs_remove_group(&client->dev.kobj, &max6639_group);
|
sysfs_remove_group(&dev->kobj, &max6639_group);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue