hwmon: (lm80) fixed checkpatch errors
PATCH 1/2 hwmon: (lm80) fixed checkpatch errors
fixed:
WARNING: simple_strtol is obsolete, use kstrtol instead
WARNING: simple_strtoul is obsolete, use kstrtoul instead
--- drivers/hwmon/lm80.c | 20 ++++++++++++++++---- 1 files changed, 16 insertions(+), 4 deletions(-)
drivers/hwmon/lm80.c +16 -4
@@ -185,7 +185,10 @@ static ssize_t set_in_##suffix(struct device *dev, \int nr =to_sensor_dev_attr (attr)->index; \struct i2c_client *client =to_i2c_client (dev); \struct lm80_data *data =i2c_get_clientdata (client); \ -long val =simple_strtol (buf,NULL ,10 ); \ +long val; \ +int err =kstrtol (buf,10 , &val); \ +if (err <0 ) \ +return err; \ \mutex_lock (&data->update_lock);\ data->value[nr] =IN_TO_REG (val); \
@@ -226,7 +229,10 @@ static ssize_t set_fan_min(struct device *dev, struct device_attribute *attr,int nr =to_sensor_dev_attr (attr)->index;struct i2c_client *client =to_i2c_client (dev);struct lm80_data *data =i2c_get_clientdata (client); -long val =simple_strtoul (buf,NULL ,10 ); +long val; +int err =kstrtol (buf,10 , &val); +if (err <0 ) +return err;mutex_lock (&data->update_lock); data->fan_min[nr] =FAN_TO_REG (val,DIV_FROM_REG (data->fan_div[nr]));
@@ -245,8 +251,11 @@ static ssize_t set_fan_div(struct device *dev, struct device_attribute *attr,int nr =to_sensor_dev_attr (attr)->index;struct i2c_client *client =to_i2c_client (dev);struct lm80_data *data =i2c_get_clientdata (client); -unsigned long min, val =simple_strtoul (buf,NULL ,10 ); +unsigned long min, val;u8 reg; +int err =kstrtoul (buf,10 , &val); +if (err <0 ) +return err;/* Save fan_min */ mutex_lock (&data->update_lock);
@@ -314,7 +323,10 @@ static ssize_t set_temp_##suffix(struct device *dev, \ { \struct i2c_client *client =to_i2c_client (dev); \struct lm80_data *data =i2c_get_clientdata (client); \ -long val =simple_strtoul (buf,NULL ,10 ); \ +long val; \ +int err =kstrtol (buf,10 , &val); \ +if (err <0 ) \ +return err; \ \mutex_lock (&data->update_lock); \ data->value =TEMP_LIMIT_TO_REG (val); \
Signature · 7 lines
1.7.0.4 _______________________________________________ lm-sensors mailing list [email protected] http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
Hi Frans,
Quoted 26 lines · Frans Meulenbroeks
fixed:
WARNING:simple_strtolis obsolete, use kstrtol instead
WARNING:simple_strtoulis obsolete, use kstrtoul insteadSigned-off-by Frans Meulenbroeks <[email protected]>--- drivers/hwmon/lm80.c | 20 ++++++++++++++++---- 1 files changed, 16 insertions(+), 4 deletions(-)drivers/hwmon/lm80.c +4
-1@@ -185,7 +185,10 @@ static ssize_t set_in_##suffix(struct device *dev, \int nr =to_sensor_dev_attr (attr)->index; \struct i2c_client *client =to_i2c_client (dev); \struct lm80_data *data =i2c_get_clientdata (client); \ -long val =simple_strtol (buf,NULL ,10 ); \ +long val; \ +int err =kstrtol (buf,10 , &val); \ +if (err <0 ) \ +return err; \ \mutex_lock (&data->update_lock);\ data->value[nr] =IN_TO_REG (val); \
drivers/hwmon/lm80.c static ssize_t set_fan_min(struct device *dev, struct device_attribute *attr, · line 236
Quoted 9 lines
drivers/hwmon/lm80.c +4
-1@@ -226,7 +229,10 @@ static ssize_t set_fan_min(struct device *dev, struct device_attribute *attr,int nr =to_sensor_dev_attr (attr)->index;struct i2c_client *client =to_i2c_client (dev);struct lm80_data *data =i2c_get_clientdata (client); -long val =simple_strtoul (buf,NULL ,10 ); +long val; +int err =kstrtol (buf,10 , &val); +if (err <0 ) +return err;
You replaced simple_strtoul() with kstrtol(). Should have been unsigned long and kstrtoul(). No need to resubmit, I fixed that. Queued for -rc2.
Thanks,
Guenter
_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
2012/1/10 Guenter Roeck <[email protected]>
Quoted 39 lines
Hi Frans,
drivers/hwmon/lm80.c static ssize_t set_fan_min(struct device *dev,
Quoted 26 lines · Frans Meulenbroeks
fixed:
WARNING:simple_strtolis obsolete, use kstrtol instead
WARNING:simple_strtoulis obsolete, use kstrtoul insteadSigned-off-by Frans Meulenbroeks <[email protected]>--- drivers/hwmon/lm80.c | 20 ++++++++++++++++---- 1 files changed, 16 insertions(+), 4 deletions(-)drivers/hwmon/lm80.c +4
-1@@ -185,7 +185,10 @@ static ssize_t set_in_##suffix(struct device *dev, \int nr =to_sensor_dev_attr (attr)->index; \struct i2c_client *client =to_i2c_client (dev); \struct lm80_data *data =i2c_get_clientdata (client); \ -long val =simple_strtol (buf,NULL ,10 ); \ +long val; \ +int err =kstrtol (buf,10 , &val); \ +if (err <0 ) \ +return err; \ \mutex_lock (&data->update_lock);\ data->value[nr] =IN_TO_REG (val); \@@ -226,7 +229,10 @@ static ssize_t set_fan_min(struct device *dev,struct
device_attribute*attr,drivers/hwmon/lm80.c static ssize_t set_fan_min(struct device *dev, struct device_attribute *attr, · line 236
Quoted 9 lines
drivers/hwmon/lm80.c +4
-1int nr =to_sensor_dev_attr (attr)->index;struct i2c_client *client =to_i2c_client (dev);struct lm80_data *data =i2c_get_clientdata (client); -long val =simple_strtoul (buf,NULL ,10 ); +long val; +int err =kstrtol (buf,10 , &val); +if (err <0 ) +return err;
Quoted 6 lines
You replaced
simple_strtoul()withkstrtol(). Should have been unsigned long andkstrtoul(). No need to resubmit, I fixed that. Queued for -rc2.Thanks,
Guenter
Hi Guenter,
The change was on two places and intentional.
The original code reads:
long val = simple_strtoul(buf, NULL, 10);
I feel this is a flaw and that simple_strtol should have been used here (and eventually kstrtol.
(or alternately the variable should have been an unsigned long)
(and yes, I agree that this should have been made explicit in the commit message).
Can you revert your fix on both places (and probably add a line or two to the commit message)
Thanks. Frans.
_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
Quoted 55 lines · Frans Meulenbroeks
2012/1/10 Guenter Roeck <[email protected]>
Hi Frans, On Tue, 2012-01-10 at 09:49 -0500, Frans Meulenbroeks wrote: > fixed: > WARNING: simple_strtol is obsolete, use kstrtol instead > WARNING: simple_strtoul is obsolete, use kstrtoul instead > > Signed-off-by: Frans Meulenbroeks <[email protected]> > --- > drivers/hwmon/lm80.c | 20 ++++++++++++++++---- > 1 files changed, 16 insertions(+), 4 deletions(-) > > diff --git a/drivers/hwmon/lm80.c b/drivers/hwmon/lm80.c > index 616f470..18e5ea4 100644 > --- a/drivers/hwmon/lm80.c > +++ b/drivers/hwmon/lm80.c > @@ -185,7 +185,10 @@ static ssize_t set_in_##suffix(struct device *dev, \ > int nr = to_sensor_dev_attr(attr)->index; \ > struct i2c_client *client = to_i2c_client(dev); \ > struct lm80_data *data = i2c_get_clientdata(client); \ > - long val = simple_strtol(buf, NULL, 10); \ > + long val; \ > + int err = kstrtol(buf, 10, &val); \ > + if (err < 0) \ > + return err; \ > \ > mutex_lock(&data->update_lock);\ > data->value[nr] = IN_TO_REG(val); \ > @@ -226,7 +229,10 @@ static ssize_t set_fan_min(struct device *dev, struct device_attribute *attr, > int nr = to_sensor_dev_attr(attr)->index; > struct i2c_client *client = to_i2c_client(dev); > struct lm80_data *data = i2c_get_clientdata(client); > - long val = simple_strtoul(buf, NULL, 10); > + long val; > + int err = kstrtol(buf, 10, &val); > + if (err < 0) > + return err; > You replaced simple_strtoul() with kstrtol(). Should have been unsigned long and kstrtoul(). No need to resubmit, I fixed that. Queued for -rc2. Thanks, GuenterHi Guenter,
Quoted 8 lines
The change was on two places and intentional.
The original code reads:
long val =simple_strtoul(buf, NULL, 10);
I feel this is a flaw and thatsimple_strtolshould have been used here (and eventually kstrtol.
(or alternately the variable should have been an unsigned long)
Frans,
I am lost. Why, and what do you think is the flaw ? You said yourself in the other thread that negative values don't make sense here. Why do you want to successfully parse negative values if they are not supported.?
I'll drop the two patches for now until that is resolved.
Guenter
_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
PATCH 1/2 hwmon: (lm80) fixed checkpatch errors
In reply to Frans MeulenbroeksOops, forgot to cc the list.
---------- Forwarded message ----------
From: Frans Meulenbroeks <[email protected]>
Date: 2012/1/10
Subject: Re: [lm-sensors] [PATCH 1/2] hwmon: (lm80) fixed checkpatch errors
To: [email protected]
2012/1/10 Guenter Roeck <[email protected]>
Quoted 66 lines · Frans Meulenbroeks
Quoted 55 lines
2012/1/10 Guenter Roeck <[email protected]>
Hi Frans, On Tue, 2012-01-10 at 09:49 -0500, Frans Meulenbroeks wrote: > fixed: > WARNING: simple_strtol is obsolete, use kstrtol instead > WARNING: simple_strtoul is obsolete, use kstrtoul instead > > Signed-off-by: Frans Meulenbroeks <[email protected]> > --- > drivers/hwmon/lm80.c | 20 ++++++++++++++++---- > 1 files changed, 16 insertions(+), 4 deletions(-) > > diff --git a/drivers/hwmon/lm80.c b/drivers/hwmon/lm80.c > index 616f470..18e5ea4 100644 > --- a/drivers/hwmon/lm80.c > +++ b/drivers/hwmon/lm80.c > @@ -185,7 +185,10 @@ static ssize_t set_in_##suffix(struct device *dev, \ > int nr = to_sensor_dev_attr(attr)->index; \ > struct i2c_client *client = to_i2c_client(dev); \ > struct lm80_data *data = i2c_get_clientdata(client); \ > - long val = simple_strtol(buf, NULL, 10); \ > + long val; \ > + int err = kstrtol(buf, 10, &val); \ > + if (err < 0) \ > + return err; \ > \ > mutex_lock(&data->update_lock);\ > data->value[nr] = IN_TO_REG(val); \ > @@ -226,7 +229,10 @@ static ssize_t set_fan_min(struct device *dev, struct device_attribute *attr, > int nr = to_sensor_dev_attr(attr)->index; > struct i2c_client *client = to_i2c_client(dev); > struct lm80_data *data = i2c_get_clientdata(client); > - long val = simple_strtoul(buf, NULL, 10); > + long val; > + int err = kstrtol(buf, 10, &val); > + if (err < 0) > + return err; > You replaced simple_strtoul() with kstrtol(). Should have been unsigned long and kstrtoul(). No need to resubmit, I fixed that. Queued for -rc2. Thanks, GuenterHi Guenter,
Quoted 8 lines
The change was on two places and intentional.
The original code reads:
long val =simple_strtoul(buf, NULL, 10);
I feel this is a flaw and thatsimple_strtolshould have been used here (and eventually kstrtol.
(or alternately the variable should have been an unsigned long)Frans,
Quoted 8 lines
I am lost. Why, and what do you think is the flaw ? You said yourself in the other thread that negative values don't make sense here. Why do you want to successfully parse negative values if they are not supported.?
I'll drop the two patches for now until that is resolved.
Hi Guenter,
Actually I misread your original email.
Quoted 4 lines · You
You replaced
simple_strtoul()withkstrtol(). Should have been unsigned
long andkstrtoul(). No need to resubmit, I fixed that. Queued
Actually I overlooked that you changed long to unsigned long too.
Quoted 1 line · That is also why I
(or alternately the variable should have been an unsigned long)
I just had the impression that you only changed simple_strol into kstrtoul without changing the var.
Your change to kstrtoul and changing val to unsigned long at the same time is of course ok.
Apologies for the confusion caused.
Please apply with your fixes.
As penitentiary I'll resolve the checkpatch errors in a drivers/hwmon file of your choice :-)
Best regards, Frans
_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
Quoted 119 lines · Frans Meulenbroeks
Oops, forgot to cc the list.
---------- Forwarded message ----------
From: Frans Meulenbroeks <[email protected]>
Date: 2012/1/10
Subject: Re: [lm-sensors] [PATCH 1/2] hwmon: (lm80) fixed checkpatch errors
To: [email protected]2012/1/10 Guenter Roeck <[email protected]>
On Tue, 2012-01-10 at 13:50 -0500, Frans Meulenbroeks wrote: > > > 2012/1/10 Guenter Roeck <[email protected]> > Hi Frans, > > On Tue, 2012-01-10 at 09:49 -0500, Frans Meulenbroeks wrote: > > fixed: > > WARNING: simple_strtol is obsolete, use kstrtol instead > > WARNING: simple_strtoul is obsolete, use kstrtoul instead > > > > Signed-off-by: Frans Meulenbroeks > <[email protected]> > > --- > > drivers/hwmon/lm80.c | 20 ++++++++++++++++---- > > 1 files changed, 16 insertions(+), 4 deletions(-) > > > > diff --git a/drivers/hwmon/lm80.c b/drivers/hwmon/lm80.c > > index 616f470..18e5ea4 100644 > > --- a/drivers/hwmon/lm80.c > > +++ b/drivers/hwmon/lm80.c > > @@ -185,7 +185,10 @@ static ssize_t set_in_##suffix(struct > device *dev, \ > > int nr = to_sensor_dev_attr(attr)->index; \ > > struct i2c_client *client > to_i2c_client(dev); \ > > struct lm80_data *data > i2c_get_clientdata(client); \ > > - long val = simple_strtol(buf, NULL, 10); \ > > + long val; \ > > + int err = kstrtol(buf, 10, &val); \ > > + if (err < 0) \ > > + return err; \ > > \ > > mutex_lock(&data->update_lock);\ > > data->value[nr] = IN_TO_REG(val); \ > > @@ -226,7 +229,10 @@ static ssize_t set_fan_min(struct > device *dev, struct device_attribute *attr, > > int nr = to_sensor_dev_attr(attr)->index; > > struct i2c_client *client > to_i2c_client(dev); > > struct lm80_data *data > i2c_get_clientdata(client); > > - long val = simple_strtoul(buf, NULL, 10); > > + long val; > > + int err = kstrtol(buf, 10, &val); > > + if (err < 0) > > + return err; > > > > You replaced simple_strtoul() with kstrtol(). Should have been > unsigned > long and kstrtoul(). No need to resubmit, I fixed that. Queued > for -rc2. > > Thanks, > Guenter > > Hi Guenter, > > The change was on two places and intentional. > > The original code reads: > long val = simple_strtoul(buf, NULL, 10); > I feel this is a flaw and that simple_strtol should have been used > here (and eventually kstrtol. > (or alternately the variable should have been an unsigned long) > Frans, I am lost. Why, and what do you think is the flaw ? You said yourself in the other thread that negative values don't make sense here. Why do you want to successfully parse negative values if they are not supported.? I'll drop the two patches for now until that is resolved.Hi Guenter,
Actually I misread your original email.
Quoted 2 lines · You
You replaced
simple_strtoul()withkstrtol(). Should havebeen
Quoted 2 lines
unsigned
long andkstrtoul(). No need to resubmit, I fixed that.Queued
Actually I overlooked that you changed long to unsigned long too.
Quoted 1 line · That is also why I
(or alternately the variable should have been an unsigned long)
Quoted 9 lines
I just had the impression that you only changed
simple_strolinto kstrtoul without changing the var.Your change to kstrtoul and changing val to unsigned long at the same time is of course ok.
Apologies for the confusion caused.
Please apply with your fixes.
Ok, makes sense. Done.
Thanks,
Guenter
_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors