* [lm-sensors] [PATCH 11/39] hwmon: (ds1621 Fix checkpatch issues
@ 2012-01-16 8:49 Guenter Roeck
2012-01-20 13:47 ` Jean Delvare
2012-01-20 14:44 ` Guenter Roeck
0 siblings, 2 replies; 3+ messages in thread
From: Guenter Roeck @ 2012-01-16 8:49 UTC (permalink / raw)
To: lm-sensors
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
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
---
drivers/hwmon/ds1621.c | 32 +++++++++++++++++++-------------
1 files changed, 19 insertions(+), 13 deletions(-)
diff --git a/drivers/hwmon/ds1621.c b/drivers/hwmon/ds1621.c
index ef1ac996..e23a8ab 100644
--- a/drivers/hwmon/ds1621.c
+++ b/drivers/hwmon/ds1621.c
@@ -1,9 +1,9 @@
/*
ds1621.c - Part of lm_sensors, Linux kernel modules for hardware
- monitoring
+ monitoring
Christian W. Zuckschwerdt <zany@triq.net> 2000-11-23
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>
This program is free software; you can redistribute it and/or modify
@@ -67,7 +67,7 @@ static const u8 DS1621_REG_TEMP[3] = {
/* Conversions */
#define ALARMS_FROM_REG(val) ((val) & \
- (DS1621_ALARM_TEMP_HIGH | DS1621_ALARM_TEMP_LOW))
+ (DS1621_ALARM_TEMP_HIGH | DS1621_ALARM_TEMP_LOW))
/* Each client has this additional data */
struct ds1621_data {
@@ -93,10 +93,10 @@ static void ds1621_init_client(struct i2c_client *client)
new_conf &= ~DS1621_REG_CONFIG_POLARITY;
else if (polarity = 1)
new_conf |= DS1621_REG_CONFIG_POLARITY;
-
+
if (conf != new_conf)
i2c_smbus_write_byte_data(client, DS1621_REG_CONF, new_conf);
-
+
/* start conversion */
i2c_smbus_write_byte(client, DS1621_COM_START);
}
@@ -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 i2c_client *client = to_i2c_client(dev);
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);
- 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],
data->temp[attr->index]);
mutex_unlock(&data->update_lock);
@@ -212,8 +217,8 @@ static int ds1621_detect(struct i2c_client *client,
int conf, temp;
int i;
- if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA
- | I2C_FUNC_SMBUS_WORD_DATA
+ if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA
+ | I2C_FUNC_SMBUS_WORD_DATA
| I2C_FUNC_SMBUS_WRITE_BYTE))
return -ENODEV;
@@ -254,7 +259,8 @@ static int ds1621_probe(struct i2c_client *client,
ds1621_init_client(client);
/* 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;
data->hwmon_dev = hwmon_device_register(&client->dev);
@@ -265,11 +271,11 @@ static int ds1621_probe(struct i2c_client *client,
return 0;
- exit_remove_files:
+exit_remove_files:
sysfs_remove_group(&client->dev.kobj, &ds1621_group);
- exit_free:
+exit_free:
kfree(data);
- exit:
+exit:
return err;
}
--
1.7.5.4
_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [lm-sensors] [PATCH 11/39] hwmon: (ds1621 Fix checkpatch issues
2012-01-16 8:49 [lm-sensors] [PATCH 11/39] hwmon: (ds1621 Fix checkpatch issues Guenter Roeck
@ 2012-01-20 13:47 ` Jean Delvare
2012-01-20 14:44 ` Guenter Roeck
1 sibling, 0 replies; 3+ messages in thread
From: Jean Delvare @ 2012-01-20 13:47 UTC (permalink / raw)
To: lm-sensors
On Mon, 16 Jan 2012 00:49:13 -0800, Guenter Roeck wrote:
> 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
>
> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
> ---
> drivers/hwmon/ds1621.c | 32 +++++++++++++++++++-------------
> 1 files changed, 19 insertions(+), 13 deletions(-)
>
> diff --git a/drivers/hwmon/ds1621.c b/drivers/hwmon/ds1621.c
> index ef1ac996..e23a8ab 100644
> --- a/drivers/hwmon/ds1621.c
> +++ b/drivers/hwmon/ds1621.c
> (...)
> @@ -265,11 +271,11 @@ static int ds1621_probe(struct i2c_client *client,
>
> return 0;
>
> - exit_remove_files:
> +exit_remove_files:
> sysfs_remove_group(&client->dev.kobj, &ds1621_group);
> - exit_free:
> +exit_free:
> kfree(data);
> - exit:
> +exit:
> return err;
> }
>
It is generally accepted to indent labels with a single space. This
avoids breaking the -p option of diff. I think checkpatch would be
happy with this, and I'd prefer this to no indentation at all as you
did.
All other changes look good, tested OK too. If you fix adjust the
labels as suggested above, you can add:
Acked-by: Jean Delvare <khali@linux-fr.org>
--
Jean Delvare
_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [lm-sensors] [PATCH 11/39] hwmon: (ds1621 Fix checkpatch issues
2012-01-16 8:49 [lm-sensors] [PATCH 11/39] hwmon: (ds1621 Fix checkpatch issues Guenter Roeck
2012-01-20 13:47 ` Jean Delvare
@ 2012-01-20 14:44 ` Guenter Roeck
1 sibling, 0 replies; 3+ messages in thread
From: Guenter Roeck @ 2012-01-20 14:44 UTC (permalink / raw)
To: lm-sensors
On Fri, Jan 20, 2012 at 08:47:34AM -0500, Jean Delvare wrote:
> On Mon, 16 Jan 2012 00:49:13 -0800, Guenter Roeck wrote:
> > 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
> >
> > Signed-off-by: Guenter Roeck <linux@roeck-us.net>
> > ---
> > drivers/hwmon/ds1621.c | 32 +++++++++++++++++++-------------
> > 1 files changed, 19 insertions(+), 13 deletions(-)
> >
> > diff --git a/drivers/hwmon/ds1621.c b/drivers/hwmon/ds1621.c
> > index ef1ac996..e23a8ab 100644
> > --- a/drivers/hwmon/ds1621.c
> > +++ b/drivers/hwmon/ds1621.c
> > (...)
> > @@ -265,11 +271,11 @@ static int ds1621_probe(struct i2c_client *client,
> >
> > return 0;
> >
> > - exit_remove_files:
> > +exit_remove_files:
> > sysfs_remove_group(&client->dev.kobj, &ds1621_group);
> > - exit_free:
> > +exit_free:
> > kfree(data);
> > - exit:
> > +exit:
> > return err;
> > }
> >
>
> It is generally accepted to indent labels with a single space. This
> avoids breaking the -p option of diff. I think checkpatch would be
> happy with this, and I'd prefer this to no indentation at all as you
> did.
>
Yes, it is.
> All other changes look good, tested OK too. If you fix adjust the
> labels as suggested above, you can add:
>
> Acked-by: Jean Delvare <khali@linux-fr.org>
>
Will do.
Thanks,
Guenter
_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-01-20 14:44 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-01-16 8:49 [lm-sensors] [PATCH 11/39] hwmon: (ds1621 Fix checkpatch issues Guenter Roeck
2012-01-20 13:47 ` Jean Delvare
2012-01-20 14:44 ` Guenter Roeck
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.