Commit 19f2c059 authored by Guenter Roeck's avatar Guenter Roeck Committed by Guenter Roeck

hwmon: (ds1621) Fix checkpatch issues

Fixed:
ERROR: code indent should use tabs where possible
ERROR: do not use assignment in if condition
ERROR: trailing whitespace
WARNING: labels should not be indented
WARNING: please, no spaces at the start of a line
WARNING: simple_strtol is obsolete, use kstrtol instead

Also modified multi-line comments to follow Documentation/CodingStyle.
Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
Acked-by: default avatarJean Delvare <khali@linux-fr.org>
parent 91efffe2
/* /*
ds1621.c - Part of lm_sensors, Linux kernel modules for hardware * ds1621.c - Part of lm_sensors, Linux kernel modules for hardware
monitoring * monitoring
Christian W. Zuckschwerdt <zany@triq.net> 2000-11-23 * Christian W. Zuckschwerdt <zany@triq.net> 2000-11-23
based on lm75.c by Frodo Looijaard <frodol@dds.nl> * based on lm75.c by Frodo Looijaard <frodol@dds.nl>
Ported to Linux 2.6 by Aurelien Jarno <aurelien@aurel32.net> with * Ported to Linux 2.6 by Aurelien Jarno <aurelien@aurel32.net> with
the help of Jean Delvare <khali@linux-fr.org> * the help of Jean Delvare <khali@linux-fr.org>
*
This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or * the Free Software Foundation; either version 2 of the License, or
(at your option) any later version. * (at your option) any later version.
*
This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. * GNU General Public License for more details.
*
You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
#include <linux/module.h> #include <linux/module.h>
#include <linux/init.h> #include <linux/init.h>
...@@ -155,10 +155,15 @@ static ssize_t set_temp(struct device *dev, struct device_attribute *da, ...@@ -155,10 +155,15 @@ static ssize_t set_temp(struct device *dev, struct device_attribute *da,
struct sensor_device_attribute *attr = to_sensor_dev_attr(da); struct sensor_device_attribute *attr = to_sensor_dev_attr(da);
struct i2c_client *client = to_i2c_client(dev); struct i2c_client *client = to_i2c_client(dev);
struct ds1621_data *data = i2c_get_clientdata(client); struct ds1621_data *data = i2c_get_clientdata(client);
u16 val = LM75_TEMP_TO_REG(simple_strtol(buf, NULL, 10)); long val;
int err;
err = kstrtol(buf, 10, &val);
if (err)
return err;
mutex_lock(&data->update_lock); mutex_lock(&data->update_lock);
data->temp[attr->index] = val; data->temp[attr->index] = LM75_TEMP_TO_REG(val);
i2c_smbus_write_word_swapped(client, DS1621_REG_TEMP[attr->index], i2c_smbus_write_word_swapped(client, DS1621_REG_TEMP[attr->index],
data->temp[attr->index]); data->temp[attr->index]);
mutex_unlock(&data->update_lock); mutex_unlock(&data->update_lock);
...@@ -217,9 +222,12 @@ static int ds1621_detect(struct i2c_client *client, ...@@ -217,9 +222,12 @@ static int ds1621_detect(struct i2c_client *client,
| I2C_FUNC_SMBUS_WRITE_BYTE)) | I2C_FUNC_SMBUS_WRITE_BYTE))
return -ENODEV; return -ENODEV;
/* Now, we do the remaining detection. It is lousy. */ /*
/* The NVB bit should be low if no EEPROM write has been requested * Now, we do the remaining detection. It is lousy.
during the latest 10ms, which is highly improbable in our case. */ *
* The NVB bit should be low if no EEPROM write has been requested
* during the latest 10ms, which is highly improbable in our case.
*/
conf = i2c_smbus_read_byte_data(client, DS1621_REG_CONF); conf = i2c_smbus_read_byte_data(client, DS1621_REG_CONF);
if (conf < 0 || conf & DS1621_REG_CONFIG_NVB) if (conf < 0 || conf & DS1621_REG_CONFIG_NVB)
return -ENODEV; return -ENODEV;
...@@ -254,7 +262,8 @@ static int ds1621_probe(struct i2c_client *client, ...@@ -254,7 +262,8 @@ static int ds1621_probe(struct i2c_client *client,
ds1621_init_client(client); ds1621_init_client(client);
/* Register sysfs hooks */ /* Register sysfs hooks */
if ((err = sysfs_create_group(&client->dev.kobj, &ds1621_group))) err = sysfs_create_group(&client->dev.kobj, &ds1621_group);
if (err)
goto exit_free; goto exit_free;
data->hwmon_dev = hwmon_device_register(&client->dev); data->hwmon_dev = hwmon_device_register(&client->dev);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment