hwmon: tmp421: handle I2C errors
Subsystems (21)
PATCH 1/3 hwmon: tmp421: handle I2C errors
Function i2c_smbus_read_byte_data() can return a negative error number instead of the data read if I2C transaction failed for whatever reason.
I consider this fix to be stable material as lack of error checking here leads to serious issues on production hardware. Errors treated as temperatures produce spurious critical temperature-crossed-threshold errors in BMC logs for OCP server hardware. The patch was tested with Mellanox OCP Mezzanine card emulating TMP421 protocol for temperature sensing which sometimes leads to I2C protocol error during early boot up stage.
--- drivers/hwmon/tmp421.c | 31 ++++++++++++++++++++++--------- 1 file changed, 22 insertions(+), 9 deletions(-)
drivers/hwmon/tmp421.c +22 -9
@@ -93,7 +93,7 @@ struct tmp421_data {struct hwmon_channel_info temp_info;const struct hwmon_channel_info *info[2 ];struct hwmon_chip_info chip; -char valid; +int last_errno;unsigned long last_updated;unsigned long channels;u8 config;
@@ -128,20 +128,30 @@ static struct tmp421_data *tmp421_update_device(struct device *dev)mutex_lock (&data->update_lock);if (time_after (jiffies, data->last_updated + (HZ /2 )) || - !data->valid) { - data->config =i2c_smbus_read_byte_data (client, -TMP421_CONFIG_REG_1 ); + data->last_errno) { + data->last_errno =i2c_smbus_read_byte_data (client, +TMP421_CONFIG_REG_1 ); +if (data->last_errno <0 ) + goto exit; + data->config = data->last_errno;for (i =0 ; i < data->channels; i++) { - data->temp[i] =i2c_smbus_read_byte_data (client, -TMP421_TEMP_MSB [i]) <<8 ; - data->temp[i] |=i2c_smbus_read_byte_data (client, -TMP421_TEMP_LSB [i]); + data->last_errno =i2c_smbus_read_byte_data (client, +TMP421_TEMP_MSB [i]); +if (data->last_errno <0 ) + goto exit; + data->temp[i] = data->last_errno <<8 ; + data->last_errno =i2c_smbus_read_byte_data (client, +TMP421_TEMP_LSB [i]); +if (data->last_errno <0 ) + goto exit; + data->temp[i] |= data->last_errno; } data->last_updated = jiffies; - data->valid =1 ; + data->last_errno =0 ; } +exit:mutex_unlock (&data->update_lock);return data;
@@ -152,6 +162,9 @@ static int tmp421_read(struct device *dev, enum hwmon_sensor_types type, {struct tmp421_data *tmp421 =tmp421_update_device (dev); +if (tmp421->last_errno) +return tmp421->last_errno; +switch (attr) {case hwmon_temp_input:if (tmp421->config &TMP421_CONFIG_RANGE )
Signature · 1 line
2.17.1
PATCH 2/3 hwmon: tmp421: report /PVLD condition
For both local and remote sensors all the supported ICs can report an "undervoltage lockout" condition which means the conversion wasn't properly performed due to insufficient power supply voltage and so the measurement results can't be trusted.
--- drivers/hwmon/tmp421.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-)
drivers/hwmon/tmp421.c +3 -6
@@ -174,10 +174,10 @@ static int tmp421_read(struct device *dev, enum hwmon_sensor_types type,return 0 ;case hwmon_temp_fault:/* -* The OPEN bit signals a fault. This is bit 0 of the temperature -* register (low byte). +* Any of OPEN or /PVLD bits indicate a hardware mulfunction +* and the conversion result may be incorrect */ - *val = tmp421->temp[channel] &0x01 ; + *val = !!(tmp421->temp[channel] &0x03 );return 0 ;default :return -EOPNOTSUPP ;
@@ -190,9 +190,6 @@ static umode_t tmp421_is_visible(const void *data, enum hwmon_sensor_types type, {switch (attr) {case hwmon_temp_fault: -if (channel ==0 ) -return 0 ; -return 0444 ;case hwmon_temp_input:return 0444 ;default :
Signature · 1 line
2.17.1
PATCH 3/3 hwmon: tmp421: fix rounding for negative values
In reply to Paul FertserCurrent code produces -24999 for 0b1110011100000000 input in standard format due to always rounding up rather than "away from zero". Use the common macro for division, unify and simplify the conversion code along the way.
--- drivers/hwmon/tmp421.c | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-)
drivers/hwmon/tmp421.c +8 -16
@@ -100,23 +100,17 @@ struct tmp421_data {s16 temp[4 ]; }; -static int temp_from_s16 (s16 reg) +static int temp_from_raw (u16 reg,bool extended) {/* Mask out status bits */ int temp = reg & ~0xf ; -return (temp *1000 +128 ) /256 ; -} - -static int temp_from_u16 (u16 reg) -{ -/* Mask out status bits */ -int temp = reg & ~0xf ; - -/* Add offset for extended temperature range. */ - temp -=64 *256 ; +if (extended) + temp = temp -64 *256 ; +else + temp = (s16 )temp; -return (temp *1000 +128 ) /256 ; +return DIV_ROUND_CLOSEST (temp *1000 ,256 ); }static struct tmp421_data *tmp421_update_device (struct device *dev)
@@ -167,10 +161,8 @@ static int tmp421_read(struct device *dev, enum hwmon_sensor_types type,switch (attr) {case hwmon_temp_input: -if (tmp421->config &TMP421_CONFIG_RANGE ) - *val =temp_from_u16 (tmp421->temp[channel]); -else - *val =temp_from_s16 (tmp421->temp[channel]); + *val =temp_from_raw (tmp421->temp[channel], + tmp421->config &TMP421_CONFIG_RANGE );return 0 ;case hwmon_temp_fault:/*
Signature · 1 line
2.17.1
Guenter Roeck
maintainerQuoted 31 lines · Paul Fertser
Function
i2c_smbus_read_byte_data()can return a negative error number instead of the data read if I2C transaction failed for whatever reason.I consider this fix to be stable material as lack of error checking here leads to serious issues on production hardware. Errors treated as temperatures produce spurious critical temperature-crossed-threshold errors in BMC logs for OCP server hardware. The patch was tested with Mellanox OCP Mezzanine card emulating TMP421 protocol for temperature sensing which sometimes leads to I2C protocol error during early boot up stage.
Signed-off-by Paul Fertser <[email protected]>--- drivers/hwmon/tmp421.c | 31 ++++++++++++++++++++++--------- 1 file changed, 22 insertions(+), 9 deletions(-)drivers/hwmon/tmp421.c +1
-1@@ -93,7 +93,7 @@ struct tmp421_data {struct hwmon_channel_info temp_info;const struct hwmon_channel_info *info[2 ];struct hwmon_chip_info chip; -char valid; +int last_errno;unsigned long last_updated;unsigned long channels;u8 config;
drivers/hwmon/tmp421.c static struct tmp421_data *tmp421_update_device(struct device *dev) · line 133
Quoted 9 lines
drivers/hwmon/tmp421.c +3
-3@@ -128,20 +128,30 @@ static struct tmp421_data *tmp421_update_device(struct device *dev)mutex_lock (&data->update_lock);if (time_after (jiffies, data->last_updated + (HZ /2 )) || - !data->valid) { - data->config =i2c_smbus_read_byte_data (client, -TMP421_CONFIG_REG_1 ); + data->last_errno) { + data->last_errno =i2c_smbus_read_byte_data (client, +TMP421_CONFIG_REG_1 );
No. The function should return an ERR_PTR after an error. Something like
int ret = 0; ... ret = i2c_smbus_read_byte_data(client, TMP421_CONFIG_REG_1); if (ret < 0) goto exit; data->config = ret; ... exit: mutex_unlock(...); return ret < 0 ? ERR_PTR(ret) : data;
Or, even better, let tmp421_update_device() return an error code instead of data, and let the caller get the data pointer.
int tmp421_update_device(struct tmp421_data *data)
{
struct i2c_client *client = data->client;
int ret = 0;
...
return ret < 0 ? ret : 0;
}...
struct tmp421_data *data = dev_get_drvdata(dev); ret = tmp421_update_device(data); if (ret) return ret;
Guenter
Quoted 42 lines
drivers/hwmon/tmp421.c +18
-5+if (data->last_errno <0 ) + goto exit; + data->config = data->last_errno;for (i =0 ; i < data->channels; i++) { - data->temp[i] =i2c_smbus_read_byte_data (client, -TMP421_TEMP_MSB [i]) <<8 ; - data->temp[i] |=i2c_smbus_read_byte_data (client, -TMP421_TEMP_LSB [i]); + data->last_errno =i2c_smbus_read_byte_data (client, +TMP421_TEMP_MSB [i]); +if (data->last_errno <0 ) + goto exit; + data->temp[i] = data->last_errno <<8 ; + data->last_errno =i2c_smbus_read_byte_data (client, +TMP421_TEMP_LSB [i]); +if (data->last_errno <0 ) + goto exit; + data->temp[i] |= data->last_errno; } data->last_updated = jiffies; - data->valid =1 ; + data->last_errno =0 ; } +exit:mutex_unlock (&data->update_lock);return data;@@ -152,6 +162,9 @@ static int tmp421_read(struct device *dev, enum hwmon_sensor_types type, {struct tmp421_data *tmp421 =tmp421_update_device (dev); +if (tmp421->last_errno) +return tmp421->last_errno; +switch (attr) {case hwmon_temp_input:if (tmp421->config &TMP421_CONFIG_RANGE )Signature · 1 line
2.17.1
PATCH v2 1/3 hwmon: tmp421: handle I2C errors
Function i2c_smbus_read_byte_data() can return a negative error number instead of the data read if I2C transaction failed for whatever reason.
I consider this fix to be stable material as lack of error checking here leads to serious issues on production hardware. Errors treated as temperatures produce spurious critical temperature-crossed-threshold errors in BMC logs for OCP server hardware. The patch was tested with Mellanox OCP Mezzanine card emulating TMP421 protocol for temperature sensing which sometimes leads to I2C protocol error during early boot up stage.
---
Changes from v1:
- Reorganise code following excellent suggestion by Guenter Roeck to use tagged errors consistently
drivers/hwmon/tmp421.c | 45 +++++++++++++++++++++++++++++++----------- 1 file changed, 33 insertions(+), 12 deletions(-)
drivers/hwmon/tmp421.c +33 -12
@@ -93,7 +93,7 @@ struct tmp421_data {struct hwmon_channel_info temp_info;const struct hwmon_channel_info *info[2 ];struct hwmon_chip_info chip; -char valid; +bool valid;unsigned long last_updated;unsigned long channels;u8 config;
@@ -119,38 +119,59 @@ static int temp_from_u16(u16 reg)return (temp *1000 +128 ) /256 ; } -static struct tmp421_data *tmp421_update_device (struct device *dev) +static int tmp421_update_device (struct tmp421_data *data) { -struct tmp421_data *data =dev_get_drvdata (dev);struct i2c_client *client = data->client; +int ret =0 ;int i;mutex_lock (&data->update_lock);if (time_after (jiffies, data->last_updated + (HZ /2 )) || !data->valid) { - data->config =i2c_smbus_read_byte_data (client, -TMP421_CONFIG_REG_1 ); + ret =i2c_smbus_read_byte_data (client, +TMP421_CONFIG_REG_1 ); +if (ret <0 ) + goto exit; + data->config = ret;for (i =0 ; i < data->channels; i++) { - data->temp[i] =i2c_smbus_read_byte_data (client, -TMP421_TEMP_MSB [i]) <<8 ; - data->temp[i] |=i2c_smbus_read_byte_data (client, -TMP421_TEMP_LSB [i]); + ret =i2c_smbus_read_byte_data (client, +TMP421_TEMP_MSB [i]); +if (ret <0 ) + goto exit; + data->temp[i] = ret <<8 ; + + ret =i2c_smbus_read_byte_data (client, +TMP421_TEMP_LSB [i]); +if (ret <0 ) + goto exit; + data->temp[i] |= ret; } data->last_updated = jiffies; - data->valid =1 ; + data->valid = true; } +exit:mutex_unlock (&data->update_lock); -return data; +if (ret <0 ) { + data->valid = false; +return ret; + } + +return 0 ; }static int tmp421_read (struct device *dev,enum hwmon_sensor_types type,u32 attr,int channel,long *val) { -struct tmp421_data *tmp421 =tmp421_update_device (dev); +struct tmp421_data *tmp421 =dev_get_drvdata (dev); +int ret =0 ; + + ret =tmp421_update_device (tmp421); +if (ret) +return ret;switch (attr) {case hwmon_temp_input:
Signature · 1 line
2.17.1
PATCH v2 2/3 hwmon: tmp421: report /PVLD condition
For both local and remote sensors all the supported ICs can report an "undervoltage lockout" condition which means the conversion wasn't properly performed due to insufficient power supply voltage and so the measurement results can't be trusted.
---
Changes from v1:
- Trivial rebase
drivers/hwmon/tmp421.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-)
drivers/hwmon/tmp421.c +3 -6
@@ -182,10 +182,10 @@ static int tmp421_read(struct device *dev, enum hwmon_sensor_types type,return 0 ;case hwmon_temp_fault:/* -* The OPEN bit signals a fault. This is bit 0 of the temperature -* register (low byte). +* Any of OPEN or /PVLD bits indicate a hardware mulfunction +* and the conversion result may be incorrect */ - *val = tmp421->temp[channel] &0x01 ; + *val = !!(tmp421->temp[channel] &0x03 );return 0 ;default :return -EOPNOTSUPP ;
@@ -198,9 +198,6 @@ static umode_t tmp421_is_visible(const void *data, enum hwmon_sensor_types type, {switch (attr) {case hwmon_temp_fault: -if (channel ==0 ) -return 0 ; -return 0444 ;case hwmon_temp_input:return 0444 ;default :
Signature · 1 line
2.17.1
PATCH v2 3/3 hwmon: tmp421: fix rounding for negative values
In reply to Paul FertserCurrent code produces -24999 for 0b1110011100000000 input in standard format due to always rounding up rather than "away from zero". Use the common macro for division, unify and simplify the conversion code along the way.
---
Changes from v1:
- Trivial rebase
drivers/hwmon/tmp421.c | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-)
drivers/hwmon/tmp421.c +8 -16
@@ -100,23 +100,17 @@ struct tmp421_data {s16 temp[4 ]; }; -static int temp_from_s16 (s16 reg) +static int temp_from_raw (u16 reg,bool extended) {/* Mask out status bits */ int temp = reg & ~0xf ; -return (temp *1000 +128 ) /256 ; -} - -static int temp_from_u16 (u16 reg) -{ -/* Mask out status bits */ -int temp = reg & ~0xf ; - -/* Add offset for extended temperature range. */ - temp -=64 *256 ; +if (extended) + temp = temp -64 *256 ; +else + temp = (s16 )temp; -return (temp *1000 +128 ) /256 ; +return DIV_ROUND_CLOSEST (temp *1000 ,256 ); }static int tmp421_update_device (struct tmp421_data *data)
@@ -175,10 +169,8 @@ static int tmp421_read(struct device *dev, enum hwmon_sensor_types type,switch (attr) {case hwmon_temp_input: -if (tmp421->config &TMP421_CONFIG_RANGE ) - *val =temp_from_u16 (tmp421->temp[channel]); -else - *val =temp_from_s16 (tmp421->temp[channel]); + *val =temp_from_raw (tmp421->temp[channel], + tmp421->config &TMP421_CONFIG_RANGE );return 0 ;case hwmon_temp_fault:/*
Signature · 1 line
2.17.1
Guenter Roeck
maintainerQuoted 10 lines · Paul Fertser
Function
i2c_smbus_read_byte_data()can return a negative error number instead of the data read if I2C transaction failed for whatever reason.I consider this fix to be stable material as lack of error checking here leads to serious issues on production hardware. Errors treated as temperatures produce spurious critical temperature-crossed-threshold errors in BMC logs for OCP server hardware. The patch was tested with Mellanox OCP Mezzanine card emulating TMP421 protocol for temperature sensing which sometimes leads to I2C protocol error during early boot up stage.
Possibly, but this doesn't belong into the commit log but after --- as written. I'd suggest to leave the "I consider this fix to be stable material" off, rephrase to "Lack of error checking can lead to serious..." which does belong in the commit description, and add a Fixes: tag which marks the patch for stable releases. Also, drop the char -> bool change from the bug fix; it is unrelated and should be a separate cleanup patch.
Quoted 17 lines
Signed-off-by Paul Fertser <[email protected]>---
Changes from v1:
- Reorganise code following excellent suggestion by Guenter Roeck to use tagged errors consistentlydrivers/hwmon/tmp421.c | 45 +++++++++++++++++++++++++++++++----------- 1 file changed, 33 insertions(+), 12 deletions(-)drivers/hwmon/tmp421.c +0
-0
drivers/hwmon/tmp421.c struct tmp421_data { · line 96
Quoted 5 lines
drivers/hwmon/tmp421.c +1
-1@@ -93,7 +93,7 @@ struct tmp421_data {struct hwmon_channel_info temp_info;const struct hwmon_channel_info *info[2 ];struct hwmon_chip_info chip; -char valid; +bool valid;
This is a cleanup, not a bug fix, and it isn't even mentioned in the patch description.
Quoted 74 lines
drivers/hwmon/tmp421.c +32
-11unsigned long last_updated;unsigned long channels;u8 config;@@ -119,38 +119,59 @@ static int temp_from_u16(u16 reg)return (temp *1000 +128 ) /256 ; } -static struct tmp421_data *tmp421_update_device (struct device *dev) +static int tmp421_update_device (struct tmp421_data *data) { -struct tmp421_data *data =dev_get_drvdata (dev);struct i2c_client *client = data->client; +int ret =0 ;int i;mutex_lock (&data->update_lock);if (time_after (jiffies, data->last_updated + (HZ /2 )) || !data->valid) { - data->config =i2c_smbus_read_byte_data (client, -TMP421_CONFIG_REG_1 ); + ret =i2c_smbus_read_byte_data (client, +TMP421_CONFIG_REG_1 ); +if (ret <0 ) + goto exit; + data->config = ret;for (i =0 ; i < data->channels; i++) { - data->temp[i] =i2c_smbus_read_byte_data (client, -TMP421_TEMP_MSB [i]) <<8 ; - data->temp[i] |=i2c_smbus_read_byte_data (client, -TMP421_TEMP_LSB [i]); + ret =i2c_smbus_read_byte_data (client, +TMP421_TEMP_MSB [i]); +if (ret <0 ) + goto exit; + data->temp[i] = ret <<8 ; + + ret =i2c_smbus_read_byte_data (client, +TMP421_TEMP_LSB [i]); +if (ret <0 ) + goto exit; + data->temp[i] |= ret; } data->last_updated = jiffies; - data->valid =1 ; + data->valid = true; } +exit:mutex_unlock (&data->update_lock); -return data; +if (ret <0 ) { + data->valid = false; +return ret; + } + +return 0 ; }static int tmp421_read (struct device *dev,enum hwmon_sensor_types type,u32 attr,int channel,long *val) { -struct tmp421_data *tmp421 =tmp421_update_device (dev); +struct tmp421_data *tmp421 =dev_get_drvdata (dev); +int ret =0 ; + + ret =tmp421_update_device (tmp421); +if (ret) +return ret;switch (attr) {case hwmon_temp_input:
Guenter Roeck
maintainerRe: [PATCH v2 3/3] hwmon: tmp421: fix rounding for negative values
In reply to Paul FertserQuoted 6 lines · Paul Fertser
Current code produces -24999 for
0b1110011100000000input in standard format due to always rounding up rather than "away from zero". Use the common macro for division, unify and simplify the conversion code along the way.Signed-off-by Paul Fertser <[email protected]>
This patch should probably have a Fixes: tag.
Guenter
Quoted 55 lines
---
Changes from v1:
- Trivial rebasedrivers/hwmon/tmp421.c | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-)drivers/hwmon/tmp421.c +8
-16@@ -100,23 +100,17 @@ struct tmp421_data {s16 temp[4 ]; }; -static int temp_from_s16 (s16 reg) +static int temp_from_raw (u16 reg,bool extended) {/* Mask out status bits */ int temp = reg & ~0xf ; -return (temp *1000 +128 ) /256 ; -} - -static int temp_from_u16 (u16 reg) -{ -/* Mask out status bits */ -int temp = reg & ~0xf ; - -/* Add offset for extended temperature range. */ - temp -=64 *256 ; +if (extended) + temp = temp -64 *256 ; +else + temp = (s16 )temp; -return (temp *1000 +128 ) /256 ; +return DIV_ROUND_CLOSEST (temp *1000 ,256 ); }static int tmp421_update_device (struct tmp421_data *data)@@ -175,10 +169,8 @@ static int tmp421_read(struct device *dev, enum hwmon_sensor_types type,switch (attr) {case hwmon_temp_input: -if (tmp421->config &TMP421_CONFIG_RANGE ) - *val =temp_from_u16 (tmp421->temp[channel]); -else - *val =temp_from_s16 (tmp421->temp[channel]); + *val =temp_from_raw (tmp421->temp[channel], + tmp421->config &TMP421_CONFIG_RANGE );return 0 ;case hwmon_temp_fault:/*
Hello Guenter,
Quoted 11 lines · Guenter Roeck
drivers/hwmon/tmp421.c struct tmp421_data { · line 96
Quoted 8 lines
drivers/hwmon/tmp421.c +1
-1@@ -93,7 +93,7 @@ struct tmp421_data {struct hwmon_channel_info temp_info;const struct hwmon_channel_info *info[2 ];struct hwmon_chip_info chip; -char valid; +bool valid;This is a cleanup, not a bug fix, and it isn't even mentioned in the patch description.
For the bug fix I needed to add a line setting data->valid to false and was reluctant to assign 0 instead as it would be adding more wrong (type-wise) code. But since you say that's the way to go, sure, will do.
Regarding the cleanup, I see hwmon has many examples of "char valid" and so it might make sense to do them all at once. What would be the procedure here, is that a desired change at all and if yes, how to approach doing it?
Signature · 2 lines
Be free, use free (http://www.gnu.org/philosophy/free-sw.html) software! mailto:[email protected]
PATCH v3 1/3 hwmon: tmp421: handle I2C errors
In reply to Guenter RoeckFunction i2c_smbus_read_byte_data() can return a negative error number instead of the data read if I2C transaction failed for whatever reason.
Lack of error checking can lead to serious issues on production hardware, e.g. errors treated as temperatures produce spurious critical temperature-crossed-threshold errors in BMC logs for OCP server hardware. The patch was tested with Mellanox OCP Mezzanine card emulating TMP421 protocol for temperature sensing which sometimes leads to I2C protocol error during early boot up stage.
---
Changes from v2:
- Do not change data->valid type as that's an unrelated cleanup
- Add Fixes: tag
- Remove clutter from the commit message
Changes from v1:
- Reorganise code following excellent suggestion by Guenter Roeck to use tagged errors consistently
drivers/hwmon/tmp421.c | 41 +++++++++++++++++++++++++++++++---------- 1 file changed, 31 insertions(+), 10 deletions(-)
drivers/hwmon/tmp421.c +31 -10
@@ -119,38 +119,59 @@ static int temp_from_u16(u16 reg)return (temp *1000 +128 ) /256 ; } -static struct tmp421_data *tmp421_update_device (struct device *dev) +static int tmp421_update_device (struct tmp421_data *data) { -struct tmp421_data *data =dev_get_drvdata (dev);struct i2c_client *client = data->client; +int ret =0 ;int i;mutex_lock (&data->update_lock);if (time_after (jiffies, data->last_updated + (HZ /2 )) || !data->valid) { - data->config =i2c_smbus_read_byte_data (client, -TMP421_CONFIG_REG_1 ); + ret =i2c_smbus_read_byte_data (client, +TMP421_CONFIG_REG_1 ); +if (ret <0 ) + goto exit; + data->config = ret;for (i =0 ; i < data->channels; i++) { - data->temp[i] =i2c_smbus_read_byte_data (client, -TMP421_TEMP_MSB [i]) <<8 ; - data->temp[i] |=i2c_smbus_read_byte_data (client, -TMP421_TEMP_LSB [i]); + ret =i2c_smbus_read_byte_data (client, +TMP421_TEMP_MSB [i]); +if (ret <0 ) + goto exit; + data->temp[i] = ret <<8 ; + + ret =i2c_smbus_read_byte_data (client, +TMP421_TEMP_LSB [i]); +if (ret <0 ) + goto exit; + data->temp[i] |= ret; } data->last_updated = jiffies; data->valid =1 ; } +exit:mutex_unlock (&data->update_lock); -return data; +if (ret <0 ) { + data->valid =0 ; +return ret; + } + +return 0 ; }static int tmp421_read (struct device *dev,enum hwmon_sensor_types type,u32 attr,int channel,long *val) { -struct tmp421_data *tmp421 =tmp421_update_device (dev); +struct tmp421_data *tmp421 =dev_get_drvdata (dev); +int ret =0 ; + + ret =tmp421_update_device (tmp421); +if (ret) +return ret;switch (attr) {case hwmon_temp_input:
Signature · 1 line
2.17.1
PATCH v3 2/3 hwmon: tmp421: report /PVLD condition as fault
For both local and remote sensors all the supported ICs can report an "undervoltage lockout" condition which means the conversion wasn't properly performed due to insufficient power supply voltage and so the measurement results can't be trusted.
---
Changes from v2:
- Add Fixes: tag
Changes from v1:
- Trivial rebase
drivers/hwmon/tmp421.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-)
drivers/hwmon/tmp421.c +3 -6
@@ -182,10 +182,10 @@ static int tmp421_read(struct device *dev, enum hwmon_sensor_types type,return 0 ;case hwmon_temp_fault:/* -* The OPEN bit signals a fault. This is bit 0 of the temperature -* register (low byte). +* Any of OPEN or /PVLD bits indicate a hardware mulfunction +* and the conversion result may be incorrect */ - *val = tmp421->temp[channel] &0x01 ; + *val = !!(tmp421->temp[channel] &0x03 );return 0 ;default :return -EOPNOTSUPP ;
@@ -198,9 +198,6 @@ static umode_t tmp421_is_visible(const void *data, enum hwmon_sensor_types type, {switch (attr) {case hwmon_temp_fault: -if (channel ==0 ) -return 0 ; -return 0444 ;case hwmon_temp_input:return 0444 ;default :
Signature · 1 line
2.17.1
PATCH v3 3/3 hwmon: tmp421: fix rounding for negative values
In reply to Paul FertserOld code produces -24999 for 0b1110011100000000 input in standard format due to always rounding up rather than "away from zero".
Use the common macro for division, unify and simplify the conversion code along the way.
---
Changes from v2:
- Add Fixes: tag
Changes from v1:
- Trivial rebase
drivers/hwmon/tmp421.c | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-)
drivers/hwmon/tmp421.c +8 -16
@@ -100,23 +100,17 @@ struct tmp421_data {s16 temp[4 ]; }; -static int temp_from_s16 (s16 reg) +static int temp_from_raw (u16 reg,bool extended) {/* Mask out status bits */ int temp = reg & ~0xf ; -return (temp *1000 +128 ) /256 ; -} - -static int temp_from_u16 (u16 reg) -{ -/* Mask out status bits */ -int temp = reg & ~0xf ; - -/* Add offset for extended temperature range. */ - temp -=64 *256 ; +if (extended) + temp = temp -64 *256 ; +else + temp = (s16 )temp; -return (temp *1000 +128 ) /256 ; +return DIV_ROUND_CLOSEST (temp *1000 ,256 ); }static int tmp421_update_device (struct tmp421_data *data)
@@ -175,10 +169,8 @@ static int tmp421_read(struct device *dev, enum hwmon_sensor_types type,switch (attr) {case hwmon_temp_input: -if (tmp421->config &TMP421_CONFIG_RANGE ) - *val =temp_from_u16 (tmp421->temp[channel]); -else - *val =temp_from_s16 (tmp421->temp[channel]); + *val =temp_from_raw (tmp421->temp[channel], + tmp421->config &TMP421_CONFIG_RANGE );return 0 ;case hwmon_temp_fault:/*
Signature · 1 line
2.17.1
Guenter Roeck
maintainerQuoted 15 lines · Paul Fertser
Hello Guenter,
Quoted 11 lines · Guenter Roeck
drivers/hwmon/tmp421.c struct tmp421_data { · line 96
Quoted 8 lines
drivers/hwmon/tmp421.c +1
-1@@ -93,7 +93,7 @@ struct tmp421_data {struct hwmon_channel_info temp_info;const struct hwmon_channel_info *info[2 ];struct hwmon_chip_info chip; -char valid; +bool valid;This is a cleanup, not a bug fix, and it isn't even mentioned in the patch description.
Quoted 4 lines
For the bug fix I needed to add a line setting
data->validto false and was reluctant to assign 0 instead as it would be adding more wrong (type-wise) code. But since you say that's the way to go, sure, will do.
I figured that much, but it is still an unrelated change. I don't object to making that change, but it should still be a separate patch. FWIW, I don't mind if it is in a single patch if the code won't be applied to stable releases, but it should still be mentioned in the description (eg: while at it, convert 'valid' to boolean).
Quoted 5 lines
Regarding the cleanup, I see hwmon has many examples of "char valid" and so it might make sense to do them all at once. What would be the procedure here, is that a desired change at all and if yes, how to approach doing it?
You could write a coccinelle script to detect and convert all uses, then submit a single patch to convert all drivers, with the cocconelle script as reference in the commit log.
Guenter
Quoted 10 lines · Paul Fertser
Function
i2c_smbus_read_byte_data()can return a negative error number instead of the data read if I2C transaction failed for whatever reason.Lack of error checking can lead to serious issues on production hardware, e.g. errors treated as temperatures produce spurious critical temperature-crossed-threshold errors in BMC logs for OCP server hardware. The patch was tested with Mellanox OCP Mezzanine card emulating TMP421 protocol for temperature sensing which sometimes leads to I2C protocol error during early boot up stage.
Quoted 3 lines
Fixes 9410700b881f ("hwmon: Add driver for Texas Instruments TMP421/422/423 sensor chips")Signed-off-by Paul Fertser <[email protected]>
Applied.
Thanks,
Guenter
Quoted 88 lines
---
Changes from v2:
- Do not changedata->validtype as that's an unrelated cleanup
- Add Fixes: tag
- Remove clutter from the commit messageChanges from v1:
- Reorganise code following excellent suggestion by Guenter Roeck to use tagged errors consistentlydrivers/hwmon/tmp421.c | 41 +++++++++++++++++++++++++++++++---------- 1 file changed, 31 insertions(+), 10 deletions(-)drivers/hwmon/tmp421.c +31
-10@@ -119,38 +119,59 @@ static int temp_from_u16(u16 reg)return (temp *1000 +128 ) /256 ; } -static struct tmp421_data *tmp421_update_device (struct device *dev) +static int tmp421_update_device (struct tmp421_data *data) { -struct tmp421_data *data =dev_get_drvdata (dev);struct i2c_client *client = data->client; +int ret =0 ;int i;mutex_lock (&data->update_lock);if (time_after (jiffies, data->last_updated + (HZ /2 )) || !data->valid) { - data->config =i2c_smbus_read_byte_data (client, -TMP421_CONFIG_REG_1 ); + ret =i2c_smbus_read_byte_data (client, +TMP421_CONFIG_REG_1 ); +if (ret <0 ) + goto exit; + data->config = ret;for (i =0 ; i < data->channels; i++) { - data->temp[i] =i2c_smbus_read_byte_data (client, -TMP421_TEMP_MSB [i]) <<8 ; - data->temp[i] |=i2c_smbus_read_byte_data (client, -TMP421_TEMP_LSB [i]); + ret =i2c_smbus_read_byte_data (client, +TMP421_TEMP_MSB [i]); +if (ret <0 ) + goto exit; + data->temp[i] = ret <<8 ; + + ret =i2c_smbus_read_byte_data (client, +TMP421_TEMP_LSB [i]); +if (ret <0 ) + goto exit; + data->temp[i] |= ret; } data->last_updated = jiffies; data->valid =1 ; } +exit:mutex_unlock (&data->update_lock); -return data; +if (ret <0 ) { + data->valid =0 ; +return ret; + } + +return 0 ; }static int tmp421_read (struct device *dev,enum hwmon_sensor_types type,u32 attr,int channel,long *val) { -struct tmp421_data *tmp421 =tmp421_update_device (dev); +struct tmp421_data *tmp421 =dev_get_drvdata (dev); +int ret =0 ; + + ret =tmp421_update_device (tmp421); +if (ret) +return ret;switch (attr) {case hwmon_temp_input:
Re: [PATCH v3 2/3] hwmon: tmp421: report /PVLD condition as fault
In reply to Paul FertserQuoted 7 lines · Paul Fertser
For both local and remote sensors all the supported ICs can report an "undervoltage lockout" condition which means the conversion wasn't properly performed due to insufficient power supply voltage and so the measurement results can't be trusted.
Fixes 9410700b881f ("hwmon: Add driver for Texas Instruments TMP421/422/423 sensor chips")Signed-off-by Paul Fertser <[email protected]>
Applied.
Thanks,
Guenter
Quoted 39 lines
---
Changes from v2:
- Add Fixes: tagChanges from v1:
- Trivial rebasedrivers/hwmon/tmp421.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-)drivers/hwmon/tmp421.c +3
-6@@ -182,10 +182,10 @@ static int tmp421_read(struct device *dev, enum hwmon_sensor_types type,return 0 ;case hwmon_temp_fault:/* -* The OPEN bit signals a fault. This is bit 0 of the temperature -* register (low byte). +* Any of OPEN or /PVLD bits indicate a hardware mulfunction +* and the conversion result may be incorrect */ - *val = tmp421->temp[channel] &0x01 ; + *val = !!(tmp421->temp[channel] &0x03 );return 0 ;default :return -EOPNOTSUPP ;@@ -198,9 +198,6 @@ static umode_t tmp421_is_visible(const void *data, enum hwmon_sensor_types type, {switch (attr) {case hwmon_temp_fault: -if (channel ==0 ) -return 0 ; -return 0444 ;case hwmon_temp_input:return 0444 ;default :
Re: [PATCH v3 3/3] hwmon: tmp421: fix rounding for negative values
In reply to Paul FertserQuoted 8 lines · Paul Fertser
Old code produces -24999 for
0b1110011100000000input in standard format due to always rounding up rather than "away from zero".Use the common macro for division, unify and simplify the conversion code along the way.
Fixes 9410700b881f ("hwmon: Add driver for Texas Instruments TMP421/422/423 sensor chips")Signed-off-by Paul Fertser <[email protected]>
Applied.
Thanks,
Guenter
Quoted 58 lines
---
Changes from v2:
- Add Fixes: tagChanges from v1:
- Trivial rebasedrivers/hwmon/tmp421.c | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-)drivers/hwmon/tmp421.c +8
-16@@ -100,23 +100,17 @@ struct tmp421_data {s16 temp[4 ]; }; -static int temp_from_s16 (s16 reg) +static int temp_from_raw (u16 reg,bool extended) {/* Mask out status bits */ int temp = reg & ~0xf ; -return (temp *1000 +128 ) /256 ; -} - -static int temp_from_u16 (u16 reg) -{ -/* Mask out status bits */ -int temp = reg & ~0xf ; - -/* Add offset for extended temperature range. */ - temp -=64 *256 ; +if (extended) + temp = temp -64 *256 ; +else + temp = (s16 )temp; -return (temp *1000 +128 ) /256 ; +return DIV_ROUND_CLOSEST (temp *1000 ,256 ); }static int tmp421_update_device (struct tmp421_data *data)@@ -175,10 +169,8 @@ static int tmp421_read(struct device *dev, enum hwmon_sensor_types type,switch (attr) {case hwmon_temp_input: -if (tmp421->config &TMP421_CONFIG_RANGE ) - *val =temp_from_u16 (tmp421->temp[channel]); -else - *val =temp_from_s16 (tmp421->temp[channel]); + *val =temp_from_raw (tmp421->temp[channel], + tmp421->config &TMP421_CONFIG_RANGE );return 0 ;case hwmon_temp_fault:/*
PATCH 1/1 hwmon: cleanup non-bool "valid" data fields
In reply to Guenter RoeckWe have bool so use it consistently in all the drivers.
The following Coccinelle script was used:
@@
identifier T;
type t = { char, int };
@@
struct T {
...
- t valid;
+ bool valid;
...
}
@@
identifier v;
@@
(
- v->valid = 0
+ v->valid = false
|
- v->valid = 1
+ v->valid = true
)
followed by sed to fixup the comments:
sed '/bool valid;/{s/!=0/true/;s/zero/false/}'
Few whitespace changes were fixed manually. All modified drivers were compile-tested.
---
This was generated against hwmon-next branch.
drivers/hwmon/abituguru3.c | 6 +++--- drivers/hwmon/ad7414.c | 4 ++-- drivers/hwmon/ad7418.c | 6 +++--- drivers/hwmon/adm1021.c | 4 ++-- drivers/hwmon/adm1025.c | 4 ++-- drivers/hwmon/adm1026.c | 4 ++-- drivers/hwmon/adm1029.c | 4 ++-- drivers/hwmon/adm1031.c | 6 +++--- drivers/hwmon/amc6821.c | 8 ++++---- drivers/hwmon/applesmc.c | 2 +- drivers/hwmon/asb100.c | 4 ++-- drivers/hwmon/asc7621.c | 4 ++-- drivers/hwmon/atxp1.c | 8 ++++---- drivers/hwmon/coretemp.c | 2 +- drivers/hwmon/dme1737.c | 4 ++-- drivers/hwmon/ds1621.c | 4 ++-- drivers/hwmon/ds620.c | 4 ++-- drivers/hwmon/emc6w201.c | 4 ++-- drivers/hwmon/f71805f.c | 4 ++-- drivers/hwmon/f71882fg.c | 4 ++-- drivers/hwmon/f75375s.c | 4 ++-- drivers/hwmon/fschmd.c | 4 ++-- drivers/hwmon/g760a.c | 2 +- drivers/hwmon/gl518sm.c | 4 ++-- drivers/hwmon/gl520sm.c | 4 ++-- drivers/hwmon/ibmaem.c | 2 +- drivers/hwmon/ibmpex.c | 4 ++-- drivers/hwmon/it87.c | 12 ++++++------ drivers/hwmon/lineage-pem.c | 2 +- drivers/hwmon/lm63.c | 6 +++--- drivers/hwmon/lm77.c | 4 ++-- drivers/hwmon/lm78.c | 4 ++-- drivers/hwmon/lm80.c | 6 +++--- drivers/hwmon/lm83.c | 4 ++-- drivers/hwmon/lm85.c | 4 ++-- drivers/hwmon/lm87.c | 4 ++-- drivers/hwmon/lm92.c | 4 ++-- drivers/hwmon/lm93.c | 4 ++-- drivers/hwmon/lm95241.c | 8 ++++---- drivers/hwmon/ltc4151.c | 2 +- drivers/hwmon/ltc4215.c | 2 +- drivers/hwmon/ltc4261.c | 4 ++-- drivers/hwmon/max16065.c | 2 +- drivers/hwmon/max1619.c | 4 ++-- drivers/hwmon/max1668.c | 4 ++-- drivers/hwmon/max6639.c | 4 ++-- drivers/hwmon/max6642.c | 2 +- drivers/hwmon/pc87360.c | 4 ++-- drivers/hwmon/sch5636.c | 4 ++-- drivers/hwmon/sht21.c | 4 ++-- drivers/hwmon/sis5595.c | 4 ++-- drivers/hwmon/smm665.c | 2 +- drivers/hwmon/smsc47b397.c | 4 ++-- drivers/hwmon/smsc47m192.c | 4 ++-- drivers/hwmon/thmc50.c | 4 ++-- drivers/hwmon/tmp401.c | 6 +++--- drivers/hwmon/tmp421.c | 6 +++--- drivers/hwmon/via686a.c | 4 ++-- drivers/hwmon/vt1211.c | 4 ++-- drivers/hwmon/vt8231.c | 4 ++-- drivers/hwmon/w83627ehf.c | 8 ++++---- drivers/hwmon/w83627hf.c | 6 +++--- drivers/hwmon/w83781d.c | 4 ++-- drivers/hwmon/w83791d.c | 4 ++-- drivers/hwmon/w83792d.c | 6 +++--- drivers/hwmon/w83793.c | 6 +++--- drivers/hwmon/w83795.c | 6 +++--- drivers/hwmon/w83l785ts.c | 4 ++-- drivers/hwmon/w83l786ng.c | 4 ++-- 69 files changed, 151 insertions(+), 151 deletions(-)
drivers/hwmon/abituguru3.c +3 -3
@@ -145,7 +145,7 @@ struct abituguru3_data {struct device *hwmon_dev;/* hwmon registered device */ struct mutex update_lock;/* protect access to data and uGuru */ unsigned short addr;/* uguru base address */ -char valid;/* !=0 if following fields are valid */ +bool valid;/* true if following fields are valid */ unsigned long last_updated;/* In jiffies */ /*
@@ -1083,7 +1083,7 @@ static struct abituguru3_data *abituguru3_update_device(struct device *dev)mutex_lock (&data->update_lock);if (!data->valid ||time_after (jiffies, data->last_updated +HZ )) {/* Clear data->valid while updating */ - data->valid =0 ; + data->valid = false;/* Read alarms */ if (abituguru3_read_increment_offset(data, ABIT_UGURU3_SETTINGS_BANK,
@@ -1117,7 +1117,7 @@ static struct abituguru3_data *abituguru3_update_device(struct device *dev) goto LEAVE_UPDATE; } data->last_updated = jiffies; - data->valid =1 ; + data->valid = true; } LEAVE_UPDATE:mutex_unlock (&data->update_lock);
drivers/hwmon/ad7414.c +2 -2
@@ -37,7 +37,7 @@ static u8 AD7414_REG_LIMIT[] = { AD7414_REG_T_HIGH, AD7414_REG_T_LOW };struct ad7414_data {struct i2c_client *client;struct mutex lock;/* atomic read data updates */ -char valid;/* !=0 if following fields are valid */ +bool valid;/* true if following fields are valid */ unsigned long next_update;/* In jiffies */ s16 temp_input;/* Register values */ s8 temps[ARRAY_SIZE (AD7414_REG_LIMIT )];
@@ -95,7 +95,7 @@ static struct ad7414_data *ad7414_update_device(struct device *dev) } data->next_update = jiffies +HZ +HZ /2 ; - data->valid =1 ; + data->valid = true; }mutex_unlock (&data->lock);
drivers/hwmon/ad7418.c +3 -3
@@ -46,7 +46,7 @@ struct ad7418_data {enum chips type;struct mutex lock;int adc_max;/* number of ADC channels */ -char valid; +bool valid;unsigned long last_updated;/* In jiffies */ s16 temp[3 ];/* Register values */ u16 in[4 ];
@@ -111,14 +111,14 @@ static int ad7418_update_device(struct device *dev) goto abort; data->last_updated = jiffies; - data->valid =1 ; + data->valid = true; }mutex_unlock (&data->lock);return 0 ; abort: - data->valid =0 ; + data->valid = false;mutex_unlock (&data->lock);return val; }
drivers/hwmon/adm1021.c +2 -2
@@ -72,7 +72,7 @@ struct adm1021_data {const struct attribute_group *groups[3 ];struct mutex update_lock; -char valid;/* !=0 if following fields are valid */ +bool valid;/* true if following fields are valid */ char low_power;/* !=0 if device in low power mode */ unsigned long last_updated;/* In jiffies */
@@ -135,7 +135,7 @@ static struct adm1021_data *adm1021_update_device(struct device *dev) ADM1023_REG_REM_OFFSET_PREC); } data->last_updated = jiffies; - data->valid =1 ; + data->valid = true; }mutex_unlock (&data->update_lock);
drivers/hwmon/adm1025.c +2 -2
@@ -97,7 +97,7 @@ struct adm1025_data {struct i2c_client *client;const struct attribute_group *groups[3 ];struct mutex update_lock; -char valid;/* zero until following fields are valid */ +bool valid;/* false until following fields are valid */ unsigned long last_updated;/* in jiffies */ u8 in[6 ];/* register value */
@@ -148,7 +148,7 @@ static struct adm1025_data *adm1025_update_device(struct device *dev) ADM1025_REG_VID4) & 0x01) << 4); data->last_updated = jiffies; - data->valid =1 ; + data->valid = true; }mutex_unlock (&data->update_lock);
drivers/hwmon/adm1026.c +2 -2
@@ -259,7 +259,7 @@ struct adm1026_data {const struct attribute_group *groups[3 ];struct mutex update_lock; -int valid;/* !=0 if following fields are valid */ +bool valid;/* true if following fields are valid */ unsigned long last_reading;/* In jiffies */ unsigned long last_config;/* In jiffies */
@@ -459,7 +459,7 @@ static struct adm1026_data *adm1026_update_device(struct device *dev) data->last_config = jiffies; }/* last_config */ - data->valid =1 ; + data->valid = true;mutex_unlock (&data->update_lock);return data; }
drivers/hwmon/adm1029.c +2 -2
@@ -99,7 +99,7 @@ static const u8 ADM1029_REG_FAN_DIV[] = {struct adm1029_data {struct i2c_client *client;struct mutex update_lock;/* protect register access */ -char valid;/* zero until following fields are valid */ +bool valid;/* false until following fields are valid */ unsigned long last_updated;/* in jiffies */ /* registers values, signed for temperature, unsigned for other stuff */
@@ -143,7 +143,7 @@ static struct adm1029_data *adm1029_update_device(struct device *dev) } data->last_updated = jiffies; - data->valid =1 ; + data->valid = true; }mutex_unlock (&data->update_lock);
drivers/hwmon/adm1031.c +3 -3
@@ -65,7 +65,7 @@ struct adm1031_data {const struct attribute_group *groups[3 ];struct mutex update_lock;int chip_type; -char valid;/* !=0 if following fields are valid */ +bool valid;/* true if following fields are valid */ unsigned long last_updated;/* In jiffies */ unsigned int update_interval;/* In milliseconds */ /*
@@ -187,7 +187,7 @@ static struct adm1031_data *adm1031_update_device(struct device *dev) ADM1031_REG_PWM) >> (4 * chan)) & 0x0f; } data->last_updated = jiffies; - data->valid =1 ; + data->valid = true; }mutex_unlock (&data->update_lock);
@@ -650,7 +650,7 @@ static ssize_t fan_div_store(struct device *dev, data->fan_min[nr]);/* Invalidate the cache: fan speed is no longer valid */ - data->valid =0 ; + data->valid = false;mutex_unlock (&data->update_lock);return count; }
drivers/hwmon/amc6821.c +4 -4
@@ -141,7 +141,7 @@ static const u8 fan_reg_hi[] = {AMC6821_REG_TDATA_HI,struct amc6821_data {struct i2c_client *client;struct mutex update_lock; -char valid;/* zero until following fields are valid */ +bool valid;/* false until following fields are valid */ unsigned long last_updated;/* in jiffies */ /* register values */
@@ -258,7 +258,7 @@ static struct amc6821_data *amc6821_update_device(struct device *dev) } data->last_updated = jiffies; - data->valid =1 ; + data->valid = true; }mutex_unlock (&data->update_lock);return data;
@@ -511,7 +511,7 @@ static ssize_t temp_auto_point_temp_store(struct device *dev, }mutex_lock (&data->update_lock); - data->valid =0 ; + data->valid = false;switch (ix) {case 0 :
@@ -584,7 +584,7 @@ static ssize_t pwm1_auto_point_pwm_store(struct device *dev, } EXIT: - data->valid =0 ; + data->valid = false;mutex_unlock (&data->update_lock);return count; }
drivers/hwmon/applesmc.c +1 -1
@@ -391,7 +391,7 @@ static const struct applesmc_entry *applesmc_get_entry_by_index(int index) cache->len = info[0 ];memcpy (cache->type, &info[1 ],4 ); cache->flags = info[5 ]; - cache->valid =1 ; + cache->valid = true; out:mutex_unlock (&smcreg.mutex);
drivers/hwmon/asb100.c +2 -2
@@ -186,7 +186,7 @@ struct asb100_data {/* array of 2 pointers to subclients */ struct i2c_client *lm75[2 ]; -char valid;/* !=0 if following fields are valid */ +bool valid;/* true if following fields are valid */ u8 in[7 ];/* Register value */ u8 in_max[7 ];/* Register value */ u8 in_min[7 ];/* Register value */
@@ -993,7 +993,7 @@ static struct asb100_data *asb100_update_device(struct device *dev) (asb100_read_value (client,ASB100_REG_ALARM2 ) <<8 ); data->last_updated = jiffies; - data->valid =1 ; + data->valid = true;dev_dbg (&client->dev,"... device update complete\n" ); }
drivers/hwmon/asc7621.c +2 -2
@@ -77,7 +77,7 @@ struct asc7621_data {struct i2c_client client;struct device *class_dev;struct mutex update_lock; -int valid;/* !=0 if following fields are valid */ +bool valid;/* true if following fields are valid */ unsigned long last_high_reading;/* In jiffies */ unsigned long last_low_reading;/* In jiffies */ /*
@@ -1032,7 +1032,7 @@ static struct asc7621_data *asc7621_update_device(struct device *dev) data->last_low_reading = jiffies; }/* last_reading */ - data->valid =1 ; + data->valid = true;mutex_unlock (&data->update_lock);
drivers/hwmon/atxp1.c +4 -4
@@ -63,7 +63,7 @@ static struct atxp1_data *atxp1_update_device(struct device *dev) data->reg.gpio1 =i2c_smbus_read_byte_data (client,ATXP1_GPIO1 ); data->reg.gpio2 =i2c_smbus_read_byte_data (client,ATXP1_GPIO2 ); - data->valid =1 ; + data->valid = true; }mutex_unlock (&data->update_lock);
@@ -136,7 +136,7 @@ static ssize_t cpu0_vid_store(struct device *dev, ATXP1_VID, cvid | ATXP1_VIDENA); } - data->valid =0 ; + data->valid = false;return count; }
@@ -180,7 +180,7 @@ static ssize_t gpio1_store(struct device *dev, struct device_attribute *attr,i2c_smbus_write_byte_data (client,ATXP1_GPIO1 , value); - data->valid =0 ; + data->valid = false; }return count;
@@ -224,7 +224,7 @@ static ssize_t gpio2_store(struct device *dev, struct device_attribute *attr,i2c_smbus_write_byte_data (client,ATXP1_GPIO2 , value); - data->valid =0 ; + data->valid = false; }return count;
drivers/hwmon/coretemp.c +1 -1
@@ -167,7 +167,7 @@ static ssize_t show_temp(struct device *dev,* really help at all. */ tdata->temp = tdata->tjmax - ((eax >>16 ) &0x7f ) *1000 ; - tdata->valid =1 ; + tdata->valid = true; tdata->last_updated = jiffies; }
drivers/hwmon/dme1737.c +2 -2
@@ -203,7 +203,7 @@ struct dme1737_data {unsigned int addr;/* for ISA devices only */ struct mutex update_lock; -int valid;/* !=0 if following fields are valid */ +bool valid;/* true if following fields are valid */ unsigned long last_update;/* in jiffies */ unsigned long last_vbat;/* in jiffies */ enum chips type;
@@ -778,7 +778,7 @@ static struct dme1737_data *dme1737_update_device(struct device *dev) } data->last_update = jiffies; - data->valid =1 ; + data->valid = true; }mutex_unlock (&data->update_lock);
drivers/hwmon/ds1621.c +2 -2
@@ -109,7 +109,7 @@ static const u8 DS1621_REG_TEMP[3] = {struct ds1621_data {struct i2c_client *client;struct mutex update_lock; -char valid;/* !=0 if following fields are valid */ +bool valid;/* true if following fields are valid */ unsigned long last_updated;/* In jiffies */ enum chips kind;/* device type */
@@ -213,7 +213,7 @@ static struct ds1621_data *ds1621_update_client(struct device *dev) new_conf); data->last_updated = jiffies; - data->valid =1 ; + data->valid = true; }mutex_unlock (&data->update_lock);
drivers/hwmon/ds620.c +2 -2
@@ -56,7 +56,7 @@ static const u8 DS620_REG_TEMP[3] = {struct ds620_data {struct i2c_client *client;struct mutex update_lock; -char valid;/* !=0 if following fields are valid */ +bool valid;/* true if following fields are valid */ unsigned long last_updated;/* In jiffies */ s16 temp[3 ];/* Register values, word */
@@ -118,7 +118,7 @@ static struct ds620_data *ds620_update_client(struct device *dev) } data->last_updated = jiffies; - data->valid =1 ; + data->valid = true; } abort:mutex_unlock (&data->update_lock);
drivers/hwmon/emc6w201.c +2 -2
@@ -45,7 +45,7 @@ enum subfeature { input, min, max };struct emc6w201_data {struct i2c_client *client;struct mutex update_lock; -char valid;/* zero until following fields are valid */ +bool valid;/* false until following fields are valid */ unsigned long last_updated;/* in jiffies */ /* registers values */
@@ -162,7 +162,7 @@ static struct emc6w201_data *emc6w201_update_device(struct device *dev) } data->last_updated = jiffies; - data->valid =1 ; + data->valid = true; }mutex_unlock (&data->update_lock);
drivers/hwmon/f71805f.c +2 -2
@@ -165,7 +165,7 @@ struct f71805f_data {struct device *hwmon_dev;struct mutex update_lock; -char valid;/* !=0 if following fields are valid */ +bool valid;/* true if following fields are valid */ unsigned long last_updated;/* In jiffies */ unsigned long last_limits;/* In jiffies */
@@ -404,7 +404,7 @@ static struct f71805f_data *f71805f_update_device(struct device *dev) + (f71805f_read8 (data,F71805F_REG_STATUS (2 )) <<16 ); data->last_updated = jiffies; - data->valid =1 ; + data->valid = true; }mutex_unlock (&data->update_lock);
drivers/hwmon/f71882fg.c +2 -2
@@ -253,7 +253,7 @@ struct f71882fg_data {struct mutex update_lock;int temp_start;/* temp numbering start (0 or 1) */ -char valid;/* !=0 if following fields are valid */ +bool valid;/* true if following fields are valid */ char auto_point_temp_signed;unsigned long last_updated;/* In jiffies */ unsigned long last_limits;/* In jiffies */
@@ -1359,7 +1359,7 @@ static struct f71882fg_data *f71882fg_update_device(struct device *dev) F71882FG_REG_IN(nr)); data->last_updated = jiffies; - data->valid =1 ; + data->valid = true; }mutex_unlock (&data->update_lock);
drivers/hwmon/f75375s.c +2 -2
@@ -85,7 +85,7 @@ struct f75375_data {const char *name;int kind;struct mutex update_lock;/* protect register access */ -char valid; +bool valid;unsigned long last_updated;/* In jiffies */ unsigned long last_limits;/* In jiffies */
@@ -228,7 +228,7 @@ static struct f75375_data *f75375_update_device(struct device *dev)f75375_read8 (client,F75375_REG_VOLT (nr)); data->last_updated = jiffies; - data->valid =1 ; + data->valid = true; }mutex_unlock (&data->update_lock);
drivers/hwmon/fschmd.c +2 -2
@@ -264,7 +264,7 @@ struct fschmd_data {unsigned long watchdog_is_open;char watchdog_expect_close;char watchdog_name[10 ];/* must be unique to avoid sysfs conflict */ -char valid;/* zero until following fields are valid */ +bool valid;/* false until following fields are valid */ unsigned long last_updated;/* in jiffies */ /* register values */
@@ -1356,7 +1356,7 @@ static struct fschmd_data *fschmd_update_device(struct device *dev) FSCHMD_REG_VOLT[data->kind][i]); data->last_updated = jiffies; - data->valid =1 ; + data->valid = true; }mutex_unlock (&data->update_lock);
drivers/hwmon/g760a.c +1 -1
@@ -95,7 +95,7 @@ static struct g760a_data *g760a_update_client(struct device *dev) data->fan_sta =g760a_read_value (client,G760A_REG_FAN_STA ); data->last_updated = jiffies; - data->valid =1 ; + data->valid = true; }mutex_unlock (&data->update_lock);
drivers/hwmon/gl518sm.c +2 -2
@@ -107,7 +107,7 @@ struct gl518_data {enum chips type;struct mutex update_lock; -char valid;/* !=0 if following fields are valid */ +bool valid;/* true if following fields are valid */ unsigned long last_updated;/* In jiffies */ u8 voltage_in[4 ];/* Register values; [0] = VDD */
@@ -211,7 +211,7 @@ static struct gl518_data *gl518_update_device(struct device *dev)gl518_read_value (client,GL518_REG_VIN3 ); data->last_updated = jiffies; - data->valid =1 ; + data->valid = true; }mutex_unlock (&data->update_lock);
drivers/hwmon/gl520sm.c +2 -2
@@ -64,7 +64,7 @@ struct gl520_data {struct i2c_client *client;const struct attribute_group *groups[3 ];struct mutex update_lock; -char valid;/* zero until the following fields are valid */ +bool valid;/* false until the following fields are valid */ unsigned long last_updated;/* in jiffies */ u8 vid;
@@ -174,7 +174,7 @@ static struct gl520_data *gl520_update_device(struct device *dev) } data->last_updated = jiffies; - data->valid =1 ; + data->valid = true; }mutex_unlock (&data->update_lock);
drivers/hwmon/ibmaem.c +1 -1
@@ -127,7 +127,7 @@ struct aem_data {struct device *hwmon_dev;struct platform_device *pdev;struct mutex lock; -char valid; +bool valid;unsigned long last_updated;/* In jiffies */ u8 ver_major;u8 ver_minor;
drivers/hwmon/ibmpex.c +2 -2
@@ -66,7 +66,7 @@ struct ibmpex_bmc_data {struct device *hwmon_dev;struct device *bmc_device;struct mutex lock; -char valid; +bool valid;unsigned long last_updated;/* In jiffies */ struct ipmi_addr address;
@@ -239,7 +239,7 @@ static void ibmpex_update_device(struct ibmpex_bmc_data *data) } data->last_updated = jiffies; - data->valid =1 ; + data->valid = true; out:mutex_unlock (&data->lock);
drivers/hwmon/it87.c +6 -6
@@ -519,7 +519,7 @@ struct it87_data {unsigned short addr;const char *name;struct mutex update_lock; -char valid;/* !=0 if following fields are valid */ +bool valid;/* true if following fields are valid */ unsigned long last_updated;/* In jiffies */ u16 in_scaled;/* Internal voltage sensors are scaled */
@@ -844,7 +844,7 @@ static struct it87_data *it87_update_device(struct device *dev) data->vid &=0x3f ; } data->last_updated = jiffies; - data->valid =1 ; + data->valid = true; }mutex_unlock (&data->update_lock);
@@ -980,7 +980,7 @@ static ssize_t set_temp(struct device *dev, struct device_attribute *attr, regval |=0x80 ;it87_write_value (data,IT87_REG_BEEP_ENABLE , regval); } - data->valid =0 ; + data->valid = false; reg =IT87_REG_TEMP_OFFSET [nr];break ; }
@@ -1079,7 +1079,7 @@ static ssize_t set_temp_type(struct device *dev, struct device_attribute *attr,it87_write_value (data,IT87_REG_TEMP_ENABLE , data->sensor);if (has_temp_old_peci (data, nr))it87_write_value (data,IT87_REG_TEMP_EXTRA , data->extra); - data->valid =0 ;/* Force cache refresh */ + data->valid = false;/* Force cache refresh */ mutex_unlock (&data->update_lock);return count; }
@@ -1834,7 +1834,7 @@ static ssize_t clear_intrusion(struct device *dev, config |=BIT (5 );it87_write_value (data,IT87_REG_CONFIG , config);/* Invalidate cache to force re-read */ - data->valid =0 ; + data->valid = false; }mutex_unlock (&data->update_lock);
@@ -3229,7 +3229,7 @@ static int __maybe_unused it87_resume(struct device *dev)it87_start_monitoring (data);/* force update */ - data->valid =0 ; + data->valid = false;mutex_unlock (&data->update_lock);
drivers/hwmon/lineage-pem.c +1 -1
@@ -191,7 +191,7 @@ static struct pem_data *pem_update_device(struct device *dev)i2c_smbus_write_byte (client,PEM_CLEAR_INFO_FLAGS ); data->last_updated = jiffies; - data->valid =1 ; + data->valid = true; } abort:mutex_unlock (&data->update_lock);
drivers/hwmon/lm63.c +3 -3
@@ -139,7 +139,7 @@ struct lm63_data {struct i2c_client *client;struct mutex update_lock;const struct attribute_group *groups[5 ]; -char valid;/* zero until following fields are valid */ +bool valid;/* false until following fields are valid */ char lut_valid;/* zero until lut fields are valid */ unsigned long last_updated;/* in jiffies */ unsigned long lut_last_updated;/* in jiffies */
@@ -289,7 +289,7 @@ static struct lm63_data *lm63_update_device(struct device *dev) LM63_REG_ALERT_STATUS) & 0x7F; data->last_updated = jiffies; - data->valid =1 ; + data->valid = true; }lm63_update_lut (data);
@@ -714,7 +714,7 @@ static ssize_t temp2_type_store(struct device *dev, reg =i2c_smbus_read_byte_data (client,LM96163_REG_TRUTHERM ) & ~0x02 ;i2c_smbus_write_byte_data (client,LM96163_REG_TRUTHERM , reg | (data->trutherm ?0x02 :0x00 )); - data->valid =0 ; + data->valid = false;mutex_unlock (&data->update_lock);return count;
drivers/hwmon/lm77.c +2 -2
@@ -55,7 +55,7 @@ static const u8 temp_regs[t_num_temp] = {struct lm77_data {struct i2c_client *client;struct mutex update_lock; -char valid; +bool valid;unsigned long last_updated;/* In jiffies */ int temp[t_num_temp];/* index using temp_index */ u8 alarms;
@@ -118,7 +118,7 @@ static struct lm77_data *lm77_update_device(struct device *dev) data->alarms =lm77_read_value (client,LM77_REG_TEMP ) &0x0007 ; data->last_updated = jiffies; - data->valid =1 ; + data->valid = true; }mutex_unlock (&data->update_lock);
drivers/hwmon/lm78.c +2 -2
@@ -117,7 +117,7 @@ struct lm78_data {int isa_addr;struct mutex update_lock; -char valid;/* !=0 if following fields are valid */ +bool valid;/* true if following fields are valid */ unsigned long last_updated;/* In jiffies */ u8 in[7 ];/* Register value */
@@ -772,7 +772,7 @@ static struct lm78_data *lm78_update_device(struct device *dev) data->alarms =lm78_read_value (data,LM78_REG_ALARM1 ) + (lm78_read_value (data,LM78_REG_ALARM2 ) <<8 ); data->last_updated = jiffies; - data->valid =1 ; + data->valid = true; data->fan_div[2 ] =1 ; }
drivers/hwmon/lm80.c +3 -3
@@ -117,7 +117,7 @@ struct lm80_data {struct i2c_client *client;struct mutex update_lock;char error;/* !=0 if error occurred during last update */ -char valid;/* !=0 if following fields are valid */ +bool valid;/* true if following fields are valid */ unsigned long last_updated;/* In jiffies */ u8 in[i_num_in][7 ];/* Register value, 1st index is enum in_index */
@@ -236,14 +236,14 @@ static struct lm80_data *lm80_update_device(struct device *dev) data->alarms = prev_rv + (rv <<8 ); data->last_updated = jiffies; - data->valid =1 ; + data->valid = true; data->error =0 ; } goto done; abort: ret =ERR_PTR (rv); - data->valid =0 ; + data->valid = false; data->error =1 ; done:
drivers/hwmon/lm83.c +2 -2
@@ -105,7 +105,7 @@ struct lm83_data {struct i2c_client *client;const struct attribute_group *groups[3 ];struct mutex update_lock; -char valid;/* zero until following fields are valid */ +bool valid;/* false until following fields are valid */ unsigned long last_updated;/* in jiffies */ /* registers values */
@@ -137,7 +137,7 @@ static struct lm83_data *lm83_update_device(struct device *dev) << 8); data->last_updated = jiffies; - data->valid =1 ; + data->valid = true; }mutex_unlock (&data->update_lock);
drivers/hwmon/lm85.c +2 -2
@@ -294,7 +294,7 @@ struct lm85_data {bool has_vid5;/* true if VID5 is configured for ADT7463 or ADT7468 */ struct mutex update_lock; -int valid;/* !=0 if following fields are valid */ +bool valid;/* true if following fields are valid */ unsigned long last_reading;/* In jiffies */ unsigned long last_config;/* In jiffies */
@@ -541,7 +541,7 @@ static struct lm85_data *lm85_update_device(struct device *dev) data->last_config = jiffies; }/* last_config */ - data->valid =1 ; + data->valid = true;mutex_unlock (&data->update_lock);
drivers/hwmon/lm87.c +2 -2
@@ -141,7 +141,7 @@ static u8 LM87_REG_TEMP_LOW[3] = { 0x3A, 0x38, 0x2C };struct lm87_data {struct mutex update_lock; -char valid;/* zero until following fields are valid */ +bool valid;/* false until following fields are valid */ unsigned long last_updated;/* In jiffies */ u8 channel;/* register value */
@@ -251,7 +251,7 @@ static struct lm87_data *lm87_update_device(struct device *dev) data->aout =lm87_read_value (client,LM87_REG_AOUT ); data->last_updated = jiffies; - data->valid =1 ; + data->valid = true; }mutex_unlock (&data->update_lock);
drivers/hwmon/lm92.c +2 -2
@@ -99,7 +99,7 @@ static const u8 regs[t_num_regs] = {struct lm92_data {struct i2c_client *client;struct mutex update_lock; -char valid;/* zero until following fields are valid */ +bool valid;/* false until following fields are valid */ unsigned long last_updated;/* in jiffies */ /* registers values */
@@ -126,7 +126,7 @@ static struct lm92_data *lm92_update_device(struct device *dev)i2c_smbus_read_word_swapped (client, regs[i]); } data->last_updated = jiffies; - data->valid =1 ; + data->valid = true; }mutex_unlock (&data->update_lock);
drivers/hwmon/lm93.c +2 -2
@@ -202,7 +202,7 @@ struct lm93_data {/* client update function */ void (*update)(struct lm93_data *,struct i2c_client *); -char valid;/* !=0 if following fields are valid */ +bool valid;/* true if following fields are valid */ /* register values, arranged by block read groups */ struct block1_t block1;
@@ -917,7 +917,7 @@ static struct lm93_data *lm93_update_device(struct device *dev) data->update (data, client); data->last_updated = jiffies; - data->valid =1 ; + data->valid = true; }mutex_unlock (&data->update_lock);
drivers/hwmon/lm95241.c +4 -4
@@ -78,7 +78,7 @@ struct lm95241_data {struct mutex update_lock;unsigned long last_updated;/* in jiffies */ unsigned long interval;/* in milli-seconds */ -char valid;/* zero until following fields are valid */ +bool valid;/* false until following fields are valid */ /* registers values */ u8 temp[ARRAY_SIZE (lm95241_reg_address)];u8 status, config, model, trutherm;
@@ -118,7 +118,7 @@ static struct lm95241_data *lm95241_update_device(struct device *dev) data->status =i2c_smbus_read_byte_data (client,LM95241_REG_R_STATUS ); data->last_updated = jiffies; - data->valid =1 ; + data->valid = true; }mutex_unlock (&data->update_lock);
@@ -257,7 +257,7 @@ static int lm95241_write_temp(struct device *dev, u32 attr, int channel,else data->config &= ~R2DF_MASK ; } - data->valid =0 ; + data->valid = false; ret =i2c_smbus_write_byte_data (client,LM95241_REG_RW_CONFIG , data->config);break ;
@@ -273,7 +273,7 @@ static int lm95241_write_temp(struct device *dev, u32 attr, int channel,else data->config &= ~R2DF_MASK ; } - data->valid =0 ; + data->valid = false; ret =i2c_smbus_write_byte_data (client,LM95241_REG_RW_CONFIG , data->config);break ;
drivers/hwmon/ltc4151.c +1 -1
@@ -77,7 +77,7 @@ static struct ltc4151_data *ltc4151_update_device(struct device *dev) data->regs[i] = val; } data->last_updated = jiffies; - data->valid =1 ; + data->valid = true; } abort:mutex_unlock (&data->update_lock);
drivers/hwmon/ltc4215.c +1 -1
@@ -64,7 +64,7 @@ static struct ltc4215_data *ltc4215_update_device(struct device *dev) } data->last_updated = jiffies; - data->valid =1 ; + data->valid = true; }mutex_unlock (&data->update_lock);
drivers/hwmon/ltc4261.c +2 -2
@@ -73,13 +73,13 @@ static struct ltc4261_data *ltc4261_update_device(struct device *dev)"Failed to read ADC value: error %d\n" , val); ret =ERR_PTR (val); - data->valid =0 ; + data->valid = false; goto abort; } data->regs[i] = val; } data->last_updated = jiffies; - data->valid =1 ; + data->valid = true; } abort:mutex_unlock (&data->update_lock);
drivers/hwmon/max16065.c +1 -1
@@ -166,7 +166,7 @@ static struct max16065_data *max16065_update_device(struct device *dev) = i2c_smbus_read_byte_data(client, MAX16065_FAULT(i)); data->last_updated = jiffies; - data->valid =1 ; + data->valid = true; }mutex_unlock (&data->update_lock);return data;
drivers/hwmon/max1619.c +2 -2
@@ -79,7 +79,7 @@ enum temp_index {struct max1619_data {struct i2c_client *client;struct mutex update_lock; -char valid;/* zero until following fields are valid */ +bool valid;/* false until following fields are valid */ unsigned long last_updated;/* in jiffies */ /* registers values */
@@ -124,7 +124,7 @@ static struct max1619_data *max1619_update_device(struct device *dev) data->alarms ^=0x02 ; data->last_updated = jiffies; - data->valid =1 ; + data->valid = true; }mutex_unlock (&data->update_lock);
drivers/hwmon/max1668.c +2 -2
@@ -58,7 +58,7 @@ struct max1668_data {enum chips type;struct mutex update_lock; -char valid;/* !=0 if following fields are valid */ +bool valid;/* true if following fields are valid */ unsigned long last_updated;/* In jiffies */ /* 1x local and 4x remote */
@@ -120,7 +120,7 @@ static struct max1668_data *max1668_update_device(struct device *dev) data->alarms |= val; data->last_updated = jiffies; - data->valid =1 ; + data->valid = true; abort:mutex_unlock (&data->update_lock);
drivers/hwmon/max6639.c +2 -2
@@ -69,7 +69,7 @@ static const int rpm_ranges[] = { 2000, 4000, 8000, 16000 };struct max6639_data {struct i2c_client *client;struct mutex update_lock; -char valid;/* !=0 if following fields are valid */ +bool valid;/* true if following fields are valid */ unsigned long last_updated;/* In jiffies */ /* Register values sampled regularly */
@@ -141,7 +141,7 @@ static struct max6639_data *max6639_update_device(struct device *dev) } data->last_updated = jiffies; - data->valid =1 ; + data->valid = true; } abort:mutex_unlock (&data->update_lock);
drivers/hwmon/max6642.c +1 -1
@@ -181,7 +181,7 @@ static struct max6642_data *max6642_update_device(struct device *dev) MAX6642_REG_R_STATUS); data->last_updated = jiffies; - data->valid =1 ; + data->valid = true; }mutex_unlock (&data->update_lock);
drivers/hwmon/pc87360.c +2 -2
@@ -178,7 +178,7 @@ struct pc87360_data {struct device *hwmon_dev;struct mutex lock;struct mutex update_lock; -char valid;/* !=0 if following fields are valid */ +bool valid;/* true if following fields are valid */ unsigned long last_updated;/* In jiffies */ int address[3 ];
@@ -1673,7 +1673,7 @@ static struct pc87360_data *pc87360_update_device(struct device *dev) } data->last_updated = jiffies; - data->valid =1 ; + data->valid = true; }mutex_unlock (&data->update_lock);
drivers/hwmon/sch5636.c +2 -2
@@ -56,7 +56,7 @@ struct sch5636_data {struct device *hwmon_dev;struct mutex update_lock; -char valid;/* !=0 if following fields are valid */ +bool valid;/* true if following fields are valid */ unsigned long last_updated;/* In jiffies */ u8 in[SCH5636_NO_INS ];u8 temp_val[SCH5636_NO_TEMPS ];
@@ -140,7 +140,7 @@ static struct sch5636_data *sch5636_update_device(struct device *dev) } data->last_updated = jiffies; - data->valid =1 ; + data->valid = true; abort:mutex_unlock (&data->update_lock);return ret;
drivers/hwmon/sht21.c +2 -2
@@ -41,7 +41,7 @@ struct sht21 {unsigned long last_update;int temperature;int humidity; -char valid; +bool valid;char eic[18 ]; };
@@ -105,7 +105,7 @@ static int sht21_update_measurements(struct device *dev) goto out; sht21->humidity =sht21_rh_ticks_to_per_cent_mille (ret); sht21->last_update = jiffies; - sht21->valid =1 ; + sht21->valid = true; } out:mutex_unlock (&sht21->lock);
drivers/hwmon/sis5595.c +2 -2
@@ -172,7 +172,7 @@ struct sis5595_data {struct mutex lock;struct mutex update_lock; -char valid;/* !=0 if following fields are valid */ +bool valid;/* true if following fields are valid */ unsigned long last_updated;/* In jiffies */ char maxins;/* == 3 if temp enabled, otherwise == 4 */ u8 revision;/* Reg. value */
@@ -728,7 +728,7 @@ static struct sis5595_data *sis5595_update_device(struct device *dev)sis5595_read_value (data,SIS5595_REG_ALARM1 ) | (sis5595_read_value (data,SIS5595_REG_ALARM2 ) <<8 ); data->last_updated = jiffies; - data->valid =1 ; + data->valid = true; }mutex_unlock (&data->update_lock);
drivers/hwmon/smm665.c +1 -1
@@ -265,7 +265,7 @@ static struct smm665_data *smm665_update_device(struct device *dev) data->adc[i] = val; } data->last_updated = jiffies; - data->valid =1 ; + data->valid = true; } abort:mutex_unlock (&data->update_lock);
drivers/hwmon/smsc47b397.c +2 -2
@@ -96,7 +96,7 @@ struct smsc47b397_data {struct mutex update_lock;unsigned long last_updated;/* in jiffies */ -int valid; +bool valid;/* register values */ u16 fan[4 ];
@@ -137,7 +137,7 @@ static struct smsc47b397_data *smsc47b397_update_device(struct device *dev) } data->last_updated = jiffies; - data->valid =1 ; + data->valid = true;dev_dbg (dev,"... device update complete\n" ); }
drivers/hwmon/smsc47m192.c +2 -2
@@ -86,7 +86,7 @@ struct smsc47m192_data {struct i2c_client *client;const struct attribute_group *groups[3 ];struct mutex update_lock; -char valid;/* !=0 if following fields are valid */ +bool valid;/* true if following fields are valid */ unsigned long last_updated;/* In jiffies */ u8 in[8 ];/* Register value */
@@ -157,7 +157,7 @@ static struct smsc47m192_data *smsc47m192_update_device(struct device *dev) SMSC47M192_REG_ALARM2) << 8); data->last_updated = jiffies; - data->valid =1 ; + data->valid = true; }mutex_unlock (&data->update_lock);
drivers/hwmon/thmc50.c +2 -2
@@ -62,7 +62,7 @@ struct thmc50_data {enum chips type;unsigned long last_updated;/* In jiffies */ char has_temp3;/* !=0 if it is ADM1022 in temp3 mode */ -char valid;/* !=0 if following fields are valid */ +bool valid;/* true if following fields are valid */ /* Register values */ s8 temp_input[3 ];
@@ -107,7 +107,7 @@ static struct thmc50_data *thmc50_update_device(struct device *dev) data->alarms =i2c_smbus_read_byte_data (client,THMC50_REG_INTR ); data->last_updated = jiffies; - data->valid =1 ; + data->valid = true; }mutex_unlock (&data->update_lock);
drivers/hwmon/tmp401.c +3 -3
@@ -136,7 +136,7 @@ struct tmp401_data {struct i2c_client *client;const struct attribute_group *groups[3 ];struct mutex update_lock; -char valid;/* zero until following fields are valid */ +bool valid;/* false until following fields are valid */ unsigned long last_updated;/* in jiffies */ enum chips kind;
@@ -267,7 +267,7 @@ static struct tmp401_data *tmp401_update_device(struct device *dev) data->temp_crit_hyst = val; data->last_updated = jiffies; - data->valid =1 ; + data->valid = true; } abort:
@@ -413,7 +413,7 @@ static ssize_t reset_temp_history_store(struct device *dev, }mutex_lock (&data->update_lock);i2c_smbus_write_byte_data (client,TMP401_TEMP_MSB_WRITE [5 ][0 ], val); - data->valid =0 ; + data->valid = false;mutex_unlock (&data->update_lock);return count;
drivers/hwmon/tmp421.c +3 -3
@@ -93,7 +93,7 @@ struct tmp421_data {struct hwmon_channel_info temp_info;const struct hwmon_channel_info *info[2 ];struct hwmon_chip_info chip; -char valid; +bool valid;unsigned long last_updated;unsigned long channels;u8 config;
@@ -140,14 +140,14 @@ static int tmp421_update_device(struct tmp421_data *data) data->temp[i] |= ret; } data->last_updated = jiffies; - data->valid =1 ; + data->valid = true; } exit:mutex_unlock (&data->update_lock);if (ret <0 ) { - data->valid =0 ; + data->valid = false;return ret; }
drivers/hwmon/via686a.c +2 -2
@@ -304,7 +304,7 @@ struct via686a_data {const char *name;struct device *hwmon_dev;struct mutex update_lock; -char valid;/* !=0 if following fields are valid */ +bool valid;/* true if following fields are valid */ unsigned long last_updated;/* In jiffies */ u8 in[5 ];/* Register value */
@@ -800,7 +800,7 @@ static struct via686a_data *via686a_update_device(struct device *dev) VIA686A_REG_ALARM1) | (via686a_read_value (data,VIA686A_REG_ALARM2 ) <<8 ); data->last_updated = jiffies; - data->valid =1 ; + data->valid = true; }mutex_unlock (&data->update_lock);
drivers/hwmon/vt1211.c +2 -2
@@ -105,7 +105,7 @@ struct vt1211_data {struct device *hwmon_dev;struct mutex update_lock; -char valid;/* !=0 if following fields are valid */ +bool valid;/* true if following fields are valid */ unsigned long last_updated;/* In jiffies */ /* Register values */
@@ -319,7 +319,7 @@ static struct vt1211_data *vt1211_update_device(struct device *dev)vt1211_read8 (data,VT1211_REG_ALARM1 ); data->last_updated = jiffies; - data->valid =1 ; + data->valid = true; }mutex_unlock (&data->update_lock);
drivers/hwmon/vt8231.c +2 -2
@@ -145,7 +145,7 @@ struct vt8231_data {struct mutex update_lock;struct device *hwmon_dev; -char valid;/* !=0 if following fields are valid */ +bool valid;/* true if following fields are valid */ unsigned long last_updated;/* In jiffies */ u8 in[6 ];/* Register value */
@@ -929,7 +929,7 @@ static struct vt8231_data *vt8231_update_device(struct device *dev) data->alarms &= ~0x80 ; data->last_updated = jiffies; - data->valid =1 ; + data->valid = true; }mutex_unlock (&data->update_lock);
drivers/hwmon/w83627ehf.c +4 -4
@@ -320,7 +320,7 @@ struct w83627ehf_data {const u16 *scale_in;struct mutex update_lock; -char valid;/* !=0 if following fields are valid */ +bool valid;/* true if following fields are valid */ unsigned long last_updated;/* In jiffies */ /* Register values */
@@ -688,7 +688,7 @@ static struct w83627ehf_data *w83627ehf_update_device(struct device *dev) W83627EHF_REG_CASEOPEN_DET); data->last_updated = jiffies; - data->valid =1 ; + data->valid = true; }mutex_unlock (&data->update_lock);
@@ -1099,7 +1099,7 @@ clear_caseopen(struct device *dev, struct w83627ehf_data *data, int channel, reg =w83627ehf_read_value (data,W83627EHF_REG_CASEOPEN_CLR );w83627ehf_write_value (data,W83627EHF_REG_CASEOPEN_CLR , reg | mask);w83627ehf_write_value (data,W83627EHF_REG_CASEOPEN_CLR , reg & ~mask); - data->valid =0 ;/* Force cache refresh */ + data->valid = false;/* Force cache refresh */ mutex_unlock (&data->update_lock);return 0 ;
@@ -2004,7 +2004,7 @@ static int __maybe_unused w83627ehf_resume(struct device *dev)w83627ehf_write_value (data,W83627EHF_REG_VBAT , data->vbat);/* Force re-reading all values */ - data->valid =0 ; + data->valid = false;mutex_unlock (&data->update_lock);return 0 ;
drivers/hwmon/w83627hf.c +3 -3
@@ -355,7 +355,7 @@ struct w83627hf_data {enum chips type;struct mutex update_lock; -char valid;/* !=0 if following fields are valid */ +bool valid;/* true if following fields are valid */ unsigned long last_updated;/* In jiffies */ u8 in[9 ];/* Register value */
@@ -448,7 +448,7 @@ static int w83627hf_resume(struct device *dev)w83627hf_write_value (data,W83781D_REG_SCFG2 , data->scfg2);/* Force re-reading all values */ - data->valid =0 ; + data->valid = false;mutex_unlock (&data->update_lock);return 0 ;
@@ -1905,7 +1905,7 @@ static struct w83627hf_data *w83627hf_update_device(struct device *dev)w83627hf_read_value (data,W83781D_REG_BEEP_INTS1 ) |w83627hf_read_value (data,W83781D_REG_BEEP_INTS3 ) <<16 ; data->last_updated = jiffies; - data->valid =1 ; + data->valid = true; }mutex_unlock (&data->update_lock);
drivers/hwmon/w83781d.c +2 -2
@@ -203,7 +203,7 @@ struct w83781d_data {int isa_addr;struct mutex update_lock; -char valid;/* !=0 if following fields are valid */ +bool valid;/* true if following fields are valid */ unsigned long last_updated;/* In jiffies */ struct i2c_client *lm75[2 ];/* for secondary I2C addresses */
@@ -1554,7 +1554,7 @@ static struct w83781d_data *w83781d_update_device(struct device *dev) W83781D_REG_BEEP_INTS3) << 16; } data->last_updated = jiffies; - data->valid =1 ; + data->valid = true; }mutex_unlock (&data->update_lock);
drivers/hwmon/w83791d.c +2 -2
@@ -270,7 +270,7 @@ struct w83791d_data {struct device *hwmon_dev;struct mutex update_lock; -char valid;/* !=0 if following fields are valid */ +bool valid;/* true if following fields are valid */ unsigned long last_updated;/* In jiffies */ /* array of 2 pointers to subclients */
@@ -1603,7 +1603,7 @@ static struct w83791d_data *w83791d_update_device(struct device *dev) << 4; data->last_updated = jiffies; - data->valid =1 ; + data->valid = true; }mutex_unlock (&data->update_lock);
drivers/hwmon/w83792d.c +3 -3
@@ -261,7 +261,7 @@ struct w83792d_data {struct device *hwmon_dev;struct mutex update_lock; -char valid;/* !=0 if following fields are valid */ +bool valid;/* true if following fields are valid */ unsigned long last_updated;/* In jiffies */ /* array of 2 pointers to subclients */
@@ -743,7 +743,7 @@ intrusion0_alarm_store(struct device *dev, struct device_attribute *attr,mutex_lock (&data->update_lock); reg =w83792d_read_value (client,W83792D_REG_CHASSIS_CLR );w83792d_write_value (client,W83792D_REG_CHASSIS_CLR , reg |0x80 ); - data->valid =0 ;/* Force cache refresh */ + data->valid = false;/* Force cache refresh */ mutex_unlock (&data->update_lock);return count;
@@ -1595,7 +1595,7 @@ static struct w83792d_data *w83792d_update_device(struct device *dev) } data->last_updated = jiffies; - data->valid =1 ; + data->valid = true; }mutex_unlock (&data->update_lock);
drivers/hwmon/w83793.c +3 -3
@@ -205,7 +205,7 @@ struct w83793_data {struct i2c_client *lm75[2 ];struct device *hwmon_dev;struct mutex update_lock; -char valid;/* !=0 if following fields are valid */ +bool valid;/* true if following fields are valid */ unsigned long last_updated;/* In jiffies */ unsigned long last_nonvolatile;/* In jiffies, last time we update the * nonvolatile registers
@@ -453,7 +453,7 @@ store_chassis_clear(struct device *dev,mutex_lock (&data->update_lock); reg =w83793_read_value (client,W83793_REG_CLR_CHASSIS );w83793_write_value (client,W83793_REG_CLR_CHASSIS , reg |0x80 ); - data->valid =0 ;/* Force cache refresh */ + data->valid = false;/* Force cache refresh */ mutex_unlock (&data->update_lock);return count; }
@@ -2081,7 +2081,7 @@ static struct w83793_data *w83793_update_device(struct device *dev) data->vid[1 ] =w83793_read_value (client,W83793_REG_VID_INB );w83793_update_nonvolatile (dev); data->last_updated = jiffies; - data->valid =1 ; + data->valid = true; END:mutex_unlock (&data->update_lock);
drivers/hwmon/w83795.c +3 -3
@@ -379,7 +379,7 @@ struct w83795_data {u8 enable_beep;u8 beeps[6 ];/* Register value */ -char valid; +bool valid;char valid_limits;char valid_pwm_config; };
@@ -684,7 +684,7 @@ static struct w83795_data *w83795_update_device(struct device *dev) tmp & ~ALARM_CTRL_RTSACS); data->last_updated = jiffies; - data->valid =1 ; + data->valid = true; END:mutex_unlock (&data->update_lock);
@@ -764,7 +764,7 @@ store_chassis_clear(struct device *dev,/* Clear status and force cache refresh */ w83795_read (client,W83795_REG_ALARM (5 )); - data->valid =0 ; + data->valid = false;mutex_unlock (&data->update_lock);return count; }
drivers/hwmon/w83l785ts.c +2 -2
@@ -98,7 +98,7 @@ static struct i2c_driver w83l785ts_driver = {struct w83l785ts_data {struct device *hwmon_dev;struct mutex update_lock; -char valid;/* zero until following fields are valid */ +bool valid;/* false until following fields are valid */ unsigned long last_updated;/* in jiffies */ /* registers values */
@@ -270,7 +270,7 @@ static struct w83l785ts_data *w83l785ts_update_device(struct device *dev) W83L785TS_REG_TEMP_OVER, data->temp[1]); data->last_updated = jiffies; - data->valid =1 ; + data->valid = true; }mutex_unlock (&data->update_lock);
drivers/hwmon/w83l786ng.c +2 -2
@@ -113,7 +113,7 @@ DIV_TO_REG(long val)struct w83l786ng_data {struct i2c_client *client;struct mutex update_lock; -char valid;/* !=0 if following fields are valid */ +bool valid;/* true if following fields are valid */ unsigned long last_updated;/* In jiffies */ unsigned long last_nonvolatile;/* In jiffies, last time we update the * nonvolatile registers */
@@ -209,7 +209,7 @@ static struct w83l786ng_data *w83l786ng_update_device(struct device *dev) data->tolerance[1 ] = (reg_tmp >>4 ) &0x0f ; data->last_updated = jiffies; - data->valid =1 ; + data->valid = true; }
Signature · 1 line
2.17.1
Guenter Roeck
maintainerRe: [PATCH] hwmon: cleanup non-bool "valid" data fields
Quoted 2 lines · Paul Fertser
We have bool so use it consistently in all the drivers.
Please _never_ send a patch as reply to a previous patch, unless you want it to get lost.
I have limited internet access right now, for the next week or so. I'll review your patch afterwards.
Guenter
Quoted 1,739 lines
The following Coccinelle script was used:
@@
identifier T;
type t = { char, int };
@@
struct T {
...(quoted diff) +1
-1- t valid; + bool valid;}
@@
identifier v;
@@
(
-v->valid= 0
+v->valid= false
|
-v->valid= 1
+v->valid= true
)followed by sed to fixup the comments:
sed '/bool valid;/{s/!=0/true/;s/zero/false/}'Few whitespace changes were fixed manually. All modified drivers were compile-tested.
Signed-off-by Paul Fertser <[email protected]>---
This was generated against hwmon-next branch.
drivers/hwmon/abituguru3.c | 6 +++--- drivers/hwmon/ad7414.c | 4 ++-- drivers/hwmon/ad7418.c | 6 +++--- drivers/hwmon/adm1021.c | 4 ++-- drivers/hwmon/adm1025.c | 4 ++-- drivers/hwmon/adm1026.c | 4 ++-- drivers/hwmon/adm1029.c | 4 ++-- drivers/hwmon/adm1031.c | 6 +++--- drivers/hwmon/amc6821.c | 8 ++++---- drivers/hwmon/applesmc.c | 2 +- drivers/hwmon/asb100.c | 4 ++-- drivers/hwmon/asc7621.c | 4 ++-- drivers/hwmon/atxp1.c | 8 ++++---- drivers/hwmon/coretemp.c | 2 +- drivers/hwmon/dme1737.c | 4 ++-- drivers/hwmon/ds1621.c | 4 ++-- drivers/hwmon/ds620.c | 4 ++-- drivers/hwmon/emc6w201.c | 4 ++-- drivers/hwmon/f71805f.c | 4 ++-- drivers/hwmon/f71882fg.c | 4 ++-- drivers/hwmon/f75375s.c | 4 ++-- drivers/hwmon/fschmd.c | 4 ++-- drivers/hwmon/g760a.c | 2 +- drivers/hwmon/gl518sm.c | 4 ++-- drivers/hwmon/gl520sm.c | 4 ++-- drivers/hwmon/ibmaem.c | 2 +- drivers/hwmon/ibmpex.c | 4 ++-- drivers/hwmon/it87.c | 12 ++++++------ drivers/hwmon/lineage-pem.c | 2 +- drivers/hwmon/lm63.c | 6 +++--- drivers/hwmon/lm77.c | 4 ++-- drivers/hwmon/lm78.c | 4 ++-- drivers/hwmon/lm80.c | 6 +++--- drivers/hwmon/lm83.c | 4 ++-- drivers/hwmon/lm85.c | 4 ++-- drivers/hwmon/lm87.c | 4 ++-- drivers/hwmon/lm92.c | 4 ++-- drivers/hwmon/lm93.c | 4 ++-- drivers/hwmon/lm95241.c | 8 ++++---- drivers/hwmon/ltc4151.c | 2 +- drivers/hwmon/ltc4215.c | 2 +- drivers/hwmon/ltc4261.c | 4 ++-- drivers/hwmon/max16065.c | 2 +- drivers/hwmon/max1619.c | 4 ++-- drivers/hwmon/max1668.c | 4 ++-- drivers/hwmon/max6639.c | 4 ++-- drivers/hwmon/max6642.c | 2 +- drivers/hwmon/pc87360.c | 4 ++-- drivers/hwmon/sch5636.c | 4 ++-- drivers/hwmon/sht21.c | 4 ++-- drivers/hwmon/sis5595.c | 4 ++-- drivers/hwmon/smm665.c | 2 +- drivers/hwmon/smsc47b397.c | 4 ++-- drivers/hwmon/smsc47m192.c | 4 ++-- drivers/hwmon/thmc50.c | 4 ++-- drivers/hwmon/tmp401.c | 6 +++--- drivers/hwmon/tmp421.c | 6 +++--- drivers/hwmon/via686a.c | 4 ++-- drivers/hwmon/vt1211.c | 4 ++-- drivers/hwmon/vt8231.c | 4 ++-- drivers/hwmon/w83627ehf.c | 8 ++++---- drivers/hwmon/w83627hf.c | 6 +++--- drivers/hwmon/w83781d.c | 4 ++-- drivers/hwmon/w83791d.c | 4 ++-- drivers/hwmon/w83792d.c | 6 +++--- drivers/hwmon/w83793.c | 6 +++--- drivers/hwmon/w83795.c | 6 +++--- drivers/hwmon/w83l785ts.c | 4 ++-- drivers/hwmon/w83l786ng.c | 4 ++-- 69 files changed, 151 insertions(+), 151 deletions(-)drivers/hwmon/abituguru3.c +3
-3@@ -145,7 +145,7 @@ struct abituguru3_data {struct device *hwmon_dev;/* hwmon registered device */ struct mutex update_lock;/* protect access to data and uGuru */ unsigned short addr;/* uguru base address */ -char valid;/* !=0 if following fields are valid */ +bool valid;/* true if following fields are valid */ unsigned long last_updated;/* In jiffies */ /* @@ -1083,7 +1083,7 @@ static struct abituguru3_data *abituguru3_update_device(struct device *dev)mutex_lock (&data->update_lock);if (!data->valid ||time_after (jiffies, data->last_updated +HZ )) {/* Clear data->valid while updating */ - data->valid =0 ; + data->valid = false;/* Read alarms */ if (abituguru3_read_increment_offset(data, ABIT_UGURU3_SETTINGS_BANK,@@ -1117,7 +1117,7 @@ static struct abituguru3_data *abituguru3_update_device(struct device *dev) goto LEAVE_UPDATE; } data->last_updated = jiffies; - data->valid =1 ; + data->valid = true; } LEAVE_UPDATE:mutex_unlock (&data->update_lock);drivers/hwmon/ad7414.c +2
-2@@ -37,7 +37,7 @@ static u8 AD7414_REG_LIMIT[] = { AD7414_REG_T_HIGH, AD7414_REG_T_LOW };struct ad7414_data {struct i2c_client *client;struct mutex lock;/* atomic read data updates */ -char valid;/* !=0 if following fields are valid */ +bool valid;/* true if following fields are valid */ unsigned long next_update;/* In jiffies */ s16 temp_input;/* Register values */ s8 temps[ARRAY_SIZE (AD7414_REG_LIMIT )];@@ -95,7 +95,7 @@ static struct ad7414_data *ad7414_update_device(struct device *dev) } data->next_update = jiffies +HZ +HZ /2 ; - data->valid =1 ; + data->valid = true; }mutex_unlock (&data->lock);drivers/hwmon/ad7418.c +3
-3@@ -46,7 +46,7 @@ struct ad7418_data {enum chips type;struct mutex lock;int adc_max;/* number of ADC channels */ -char valid; +bool valid;unsigned long last_updated;/* In jiffies */ s16 temp[3 ];/* Register values */ u16 in[4 ];@@ -111,14 +111,14 @@ static int ad7418_update_device(struct device *dev) goto abort; data->last_updated = jiffies; - data->valid =1 ; + data->valid = true; }mutex_unlock (&data->lock);return 0 ; abort: - data->valid =0 ; + data->valid = false;mutex_unlock (&data->lock);return val; }drivers/hwmon/adm1021.c +2
-2@@ -72,7 +72,7 @@ struct adm1021_data {const struct attribute_group *groups[3 ];struct mutex update_lock; -char valid;/* !=0 if following fields are valid */ +bool valid;/* true if following fields are valid */ char low_power;/* !=0 if device in low power mode */ unsigned long last_updated;/* In jiffies */ @@ -135,7 +135,7 @@ static struct adm1021_data *adm1021_update_device(struct device *dev) ADM1023_REG_REM_OFFSET_PREC); } data->last_updated = jiffies; - data->valid =1 ; + data->valid = true; }mutex_unlock (&data->update_lock);drivers/hwmon/adm1025.c +2
-2@@ -97,7 +97,7 @@ struct adm1025_data {struct i2c_client *client;const struct attribute_group *groups[3 ];struct mutex update_lock; -char valid;/* zero until following fields are valid */ +bool valid;/* false until following fields are valid */ unsigned long last_updated;/* in jiffies */ u8 in[6 ];/* register value */ @@ -148,7 +148,7 @@ static struct adm1025_data *adm1025_update_device(struct device *dev) ADM1025_REG_VID4) & 0x01) << 4); data->last_updated = jiffies; - data->valid =1 ; + data->valid = true; }mutex_unlock (&data->update_lock);drivers/hwmon/adm1026.c +2
-2@@ -259,7 +259,7 @@ struct adm1026_data {const struct attribute_group *groups[3 ];struct mutex update_lock; -int valid;/* !=0 if following fields are valid */ +bool valid;/* true if following fields are valid */ unsigned long last_reading;/* In jiffies */ unsigned long last_config;/* In jiffies */ @@ -459,7 +459,7 @@ static struct adm1026_data *adm1026_update_device(struct device *dev) data->last_config = jiffies; }/* last_config */ - data->valid =1 ; + data->valid = true;mutex_unlock (&data->update_lock);return data; }drivers/hwmon/adm1029.c +2
-2@@ -99,7 +99,7 @@ static const u8 ADM1029_REG_FAN_DIV[] = {struct adm1029_data {struct i2c_client *client;struct mutex update_lock;/* protect register access */ -char valid;/* zero until following fields are valid */ +bool valid;/* false until following fields are valid */ unsigned long last_updated;/* in jiffies */ /* registers values, signed for temperature, unsigned for other stuff */ @@ -143,7 +143,7 @@ static struct adm1029_data *adm1029_update_device(struct device *dev) } data->last_updated = jiffies; - data->valid =1 ; + data->valid = true; }mutex_unlock (&data->update_lock);drivers/hwmon/adm1031.c +3
-3@@ -65,7 +65,7 @@ struct adm1031_data {const struct attribute_group *groups[3 ];struct mutex update_lock;int chip_type; -char valid;/* !=0 if following fields are valid */ +bool valid;/* true if following fields are valid */ unsigned long last_updated;/* In jiffies */ unsigned int update_interval;/* In milliseconds */ /* @@ -187,7 +187,7 @@ static struct adm1031_data *adm1031_update_device(struct device *dev) ADM1031_REG_PWM) >> (4 * chan)) & 0x0f; } data->last_updated = jiffies; - data->valid =1 ; + data->valid = true; }mutex_unlock (&data->update_lock);@@ -650,7 +650,7 @@ static ssize_t fan_div_store(struct device *dev, data->fan_min[nr]);/* Invalidate the cache: fan speed is no longer valid */ - data->valid =0 ; + data->valid = false;mutex_unlock (&data->update_lock);return count; }drivers/hwmon/amc6821.c +4
-4@@ -141,7 +141,7 @@ static const u8 fan_reg_hi[] = {AMC6821_REG_TDATA_HI,struct amc6821_data {struct i2c_client *client;struct mutex update_lock; -char valid;/* zero until following fields are valid */ +bool valid;/* false until following fields are valid */ unsigned long last_updated;/* in jiffies */ /* register values */ @@ -258,7 +258,7 @@ static struct amc6821_data *amc6821_update_device(struct device *dev) } data->last_updated = jiffies; - data->valid =1 ; + data->valid = true; }mutex_unlock (&data->update_lock);return data;@@ -511,7 +511,7 @@ static ssize_t temp_auto_point_temp_store(struct device *dev, }mutex_lock (&data->update_lock); - data->valid =0 ; + data->valid = false;switch (ix) {case 0 :@@ -584,7 +584,7 @@ static ssize_t pwm1_auto_point_pwm_store(struct device *dev, } EXIT: - data->valid =0 ; + data->valid = false;mutex_unlock (&data->update_lock);return count; }drivers/hwmon/applesmc.c +1
-1@@ -391,7 +391,7 @@ static const struct applesmc_entry *applesmc_get_entry_by_index(int index) cache->len = info[0 ];memcpy (cache->type, &info[1 ],4 ); cache->flags = info[5 ]; - cache->valid =1 ; + cache->valid = true; out:mutex_unlock (&smcreg.mutex);drivers/hwmon/asb100.c +2
-2@@ -186,7 +186,7 @@ struct asb100_data {/* array of 2 pointers to subclients */ struct i2c_client *lm75[2 ]; -char valid;/* !=0 if following fields are valid */ +bool valid;/* true if following fields are valid */ u8 in[7 ];/* Register value */ u8 in_max[7 ];/* Register value */ u8 in_min[7 ];/* Register value */ @@ -993,7 +993,7 @@ static struct asb100_data *asb100_update_device(struct device *dev) (asb100_read_value (client,ASB100_REG_ALARM2 ) <<8 ); data->last_updated = jiffies; - data->valid =1 ; + data->valid = true;dev_dbg (&client->dev,"... device update complete\n" ); }drivers/hwmon/asc7621.c +2
-2@@ -77,7 +77,7 @@ struct asc7621_data {struct i2c_client client;struct device *class_dev;struct mutex update_lock; -int valid;/* !=0 if following fields are valid */ +bool valid;/* true if following fields are valid */ unsigned long last_high_reading;/* In jiffies */ unsigned long last_low_reading;/* In jiffies */ /* @@ -1032,7 +1032,7 @@ static struct asc7621_data *asc7621_update_device(struct device *dev) data->last_low_reading = jiffies; }/* last_reading */ - data->valid =1 ; + data->valid = true;mutex_unlock (&data->update_lock);drivers/hwmon/atxp1.c +4
-4@@ -63,7 +63,7 @@ static struct atxp1_data *atxp1_update_device(struct device *dev) data->reg.gpio1 =i2c_smbus_read_byte_data (client,ATXP1_GPIO1 ); data->reg.gpio2 =i2c_smbus_read_byte_data (client,ATXP1_GPIO2 ); - data->valid =1 ; + data->valid = true; }mutex_unlock (&data->update_lock);@@ -136,7 +136,7 @@ static ssize_t cpu0_vid_store(struct device *dev, ATXP1_VID, cvid | ATXP1_VIDENA); } - data->valid =0 ; + data->valid = false;return count; }@@ -180,7 +180,7 @@ static ssize_t gpio1_store(struct device *dev, struct device_attribute *attr,i2c_smbus_write_byte_data (client,ATXP1_GPIO1 , value); - data->valid =0 ; + data->valid = false; }return count;@@ -224,7 +224,7 @@ static ssize_t gpio2_store(struct device *dev, struct device_attribute *attr,i2c_smbus_write_byte_data (client,ATXP1_GPIO2 , value); - data->valid =0 ; + data->valid = false; }return count;drivers/hwmon/coretemp.c +1
-1@@ -167,7 +167,7 @@ static ssize_t show_temp(struct device *dev,* really help at all. */ tdata->temp = tdata->tjmax - ((eax >>16 ) &0x7f ) *1000 ; - tdata->valid =1 ; + tdata->valid = true; tdata->last_updated = jiffies; }drivers/hwmon/dme1737.c +2
-2@@ -203,7 +203,7 @@ struct dme1737_data {unsigned int addr;/* for ISA devices only */ struct mutex update_lock; -int valid;/* !=0 if following fields are valid */ +bool valid;/* true if following fields are valid */ unsigned long last_update;/* in jiffies */ unsigned long last_vbat;/* in jiffies */ enum chips type;@@ -778,7 +778,7 @@ static struct dme1737_data *dme1737_update_device(struct device *dev) } data->last_update = jiffies; - data->valid =1 ; + data->valid = true; }mutex_unlock (&data->update_lock);drivers/hwmon/ds1621.c +2
-2@@ -109,7 +109,7 @@ static const u8 DS1621_REG_TEMP[3] = {struct ds1621_data {struct i2c_client *client;struct mutex update_lock; -char valid;/* !=0 if following fields are valid */ +bool valid;/* true if following fields are valid */ unsigned long last_updated;/* In jiffies */ enum chips kind;/* device type */ @@ -213,7 +213,7 @@ static struct ds1621_data *ds1621_update_client(struct device *dev) new_conf); data->last_updated = jiffies; - data->valid =1 ; + data->valid = true; }mutex_unlock (&data->update_lock);drivers/hwmon/ds620.c +2
-2@@ -56,7 +56,7 @@ static const u8 DS620_REG_TEMP[3] = {struct ds620_data {struct i2c_client *client;struct mutex update_lock; -char valid;/* !=0 if following fields are valid */ +bool valid;/* true if following fields are valid */ unsigned long last_updated;/* In jiffies */ s16 temp[3 ];/* Register values, word */ @@ -118,7 +118,7 @@ static struct ds620_data *ds620_update_client(struct device *dev) } data->last_updated = jiffies; - data->valid =1 ; + data->valid = true; } abort:mutex_unlock (&data->update_lock);drivers/hwmon/emc6w201.c +2
-2@@ -45,7 +45,7 @@ enum subfeature { input, min, max };struct emc6w201_data {struct i2c_client *client;struct mutex update_lock; -char valid;/* zero until following fields are valid */ +bool valid;/* false until following fields are valid */ unsigned long last_updated;/* in jiffies */ /* registers values */ @@ -162,7 +162,7 @@ static struct emc6w201_data *emc6w201_update_device(struct device *dev) } data->last_updated = jiffies; - data->valid =1 ; + data->valid = true; }mutex_unlock (&data->update_lock);drivers/hwmon/f71805f.c +2
-2@@ -165,7 +165,7 @@ struct f71805f_data {struct device *hwmon_dev;struct mutex update_lock; -char valid;/* !=0 if following fields are valid */ +bool valid;/* true if following fields are valid */ unsigned long last_updated;/* In jiffies */ unsigned long last_limits;/* In jiffies */ @@ -404,7 +404,7 @@ static struct f71805f_data *f71805f_update_device(struct device *dev) + (f71805f_read8 (data,F71805F_REG_STATUS (2 )) <<16 ); data->last_updated = jiffies; - data->valid =1 ; + data->valid = true; }mutex_unlock (&data->update_lock);drivers/hwmon/f71882fg.c +2
-2@@ -253,7 +253,7 @@ struct f71882fg_data {struct mutex update_lock;int temp_start;/* temp numbering start (0 or 1) */ -char valid;/* !=0 if following fields are valid */ +bool valid;/* true if following fields are valid */ char auto_point_temp_signed;unsigned long last_updated;/* In jiffies */ unsigned long last_limits;/* In jiffies */ @@ -1359,7 +1359,7 @@ static struct f71882fg_data *f71882fg_update_device(struct device *dev) F71882FG_REG_IN(nr)); data->last_updated = jiffies; - data->valid =1 ; + data->valid = true; }mutex_unlock (&data->update_lock);drivers/hwmon/f75375s.c +2
-2@@ -85,7 +85,7 @@ struct f75375_data {const char *name;int kind;struct mutex update_lock;/* protect register access */ -char valid; +bool valid;unsigned long last_updated;/* In jiffies */ unsigned long last_limits;/* In jiffies */ @@ -228,7 +228,7 @@ static struct f75375_data *f75375_update_device(struct device *dev)f75375_read8 (client,F75375_REG_VOLT (nr)); data->last_updated = jiffies; - data->valid =1 ; + data->valid = true; }mutex_unlock (&data->update_lock);drivers/hwmon/fschmd.c +2
-2@@ -264,7 +264,7 @@ struct fschmd_data {unsigned long watchdog_is_open;char watchdog_expect_close;char watchdog_name[10 ];/* must be unique to avoid sysfs conflict */ -char valid;/* zero until following fields are valid */ +bool valid;/* false until following fields are valid */ unsigned long last_updated;/* in jiffies */ /* register values */ @@ -1356,7 +1356,7 @@ static struct fschmd_data *fschmd_update_device(struct device *dev) FSCHMD_REG_VOLT[data->kind][i]); data->last_updated = jiffies; - data->valid =1 ; + data->valid = true; }mutex_unlock (&data->update_lock);drivers/hwmon/g760a.c +1
-1@@ -95,7 +95,7 @@ static struct g760a_data *g760a_update_client(struct device *dev) data->fan_sta =g760a_read_value (client,G760A_REG_FAN_STA ); data->last_updated = jiffies; - data->valid =1 ; + data->valid = true; }mutex_unlock (&data->update_lock);drivers/hwmon/gl518sm.c +2
-2@@ -107,7 +107,7 @@ struct gl518_data {enum chips type;struct mutex update_lock; -char valid;/* !=0 if following fields are valid */ +bool valid;/* true if following fields are valid */ unsigned long last_updated;/* In jiffies */ u8 voltage_in[4 ];/* Register values; [0] = VDD */ @@ -211,7 +211,7 @@ static struct gl518_data *gl518_update_device(struct device *dev)gl518_read_value (client,GL518_REG_VIN3 ); data->last_updated = jiffies; - data->valid =1 ; + data->valid = true; }mutex_unlock (&data->update_lock);drivers/hwmon/gl520sm.c +2
-2@@ -64,7 +64,7 @@ struct gl520_data {struct i2c_client *client;const struct attribute_group *groups[3 ];struct mutex update_lock; -char valid;/* zero until the following fields are valid */ +bool valid;/* false until the following fields are valid */ unsigned long last_updated;/* in jiffies */ u8 vid;@@ -174,7 +174,7 @@ static struct gl520_data *gl520_update_device(struct device *dev) } data->last_updated = jiffies; - data->valid =1 ; + data->valid = true; }mutex_unlock (&data->update_lock);drivers/hwmon/ibmaem.c +1
-1@@ -127,7 +127,7 @@ struct aem_data {struct device *hwmon_dev;struct platform_device *pdev;struct mutex lock; -char valid; +bool valid;unsigned long last_updated;/* In jiffies */ u8 ver_major;u8 ver_minor;drivers/hwmon/ibmpex.c +2
-2@@ -66,7 +66,7 @@ struct ibmpex_bmc_data {struct device *hwmon_dev;struct device *bmc_device;struct mutex lock; -char valid; +bool valid;unsigned long last_updated;/* In jiffies */ struct ipmi_addr address;@@ -239,7 +239,7 @@ static void ibmpex_update_device(struct ibmpex_bmc_data *data) } data->last_updated = jiffies; - data->valid =1 ; + data->valid = true; out:mutex_unlock (&data->lock);drivers/hwmon/it87.c +6
-6@@ -519,7 +519,7 @@ struct it87_data {unsigned short addr;const char *name;struct mutex update_lock; -char valid;/* !=0 if following fields are valid */ +bool valid;/* true if following fields are valid */ unsigned long last_updated;/* In jiffies */ u16 in_scaled;/* Internal voltage sensors are scaled */ @@ -844,7 +844,7 @@ static struct it87_data *it87_update_device(struct device *dev) data->vid &=0x3f ; } data->last_updated = jiffies; - data->valid =1 ; + data->valid = true; }mutex_unlock (&data->update_lock);@@ -980,7 +980,7 @@ static ssize_t set_temp(struct device *dev, struct device_attribute *attr, regval |=0x80 ;it87_write_value (data,IT87_REG_BEEP_ENABLE , regval); } - data->valid =0 ; + data->valid = false; reg =IT87_REG_TEMP_OFFSET [nr];break ; }@@ -1079,7 +1079,7 @@ static ssize_t set_temp_type(struct device *dev, struct device_attribute *attr,it87_write_value (data,IT87_REG_TEMP_ENABLE , data->sensor);if (has_temp_old_peci (data, nr))it87_write_value (data,IT87_REG_TEMP_EXTRA , data->extra); - data->valid =0 ;/* Force cache refresh */ + data->valid = false;/* Force cache refresh */ mutex_unlock (&data->update_lock);return count; }@@ -1834,7 +1834,7 @@ static ssize_t clear_intrusion(struct device *dev, config |=BIT (5 );it87_write_value (data,IT87_REG_CONFIG , config);/* Invalidate cache to force re-read */ - data->valid =0 ; + data->valid = false; }mutex_unlock (&data->update_lock);@@ -3229,7 +3229,7 @@ static int __maybe_unused it87_resume(struct device *dev)it87_start_monitoring (data);/* force update */ - data->valid =0 ; + data->valid = false;mutex_unlock (&data->update_lock);drivers/hwmon/lineage-pem.c +1
-1@@ -191,7 +191,7 @@ static struct pem_data *pem_update_device(struct device *dev)i2c_smbus_write_byte (client,PEM_CLEAR_INFO_FLAGS ); data->last_updated = jiffies; - data->valid =1 ; + data->valid = true; } abort:mutex_unlock (&data->update_lock);drivers/hwmon/lm63.c +3
-3@@ -139,7 +139,7 @@ struct lm63_data {struct i2c_client *client;struct mutex update_lock;const struct attribute_group *groups[5 ]; -char valid;/* zero until following fields are valid */ +bool valid;/* false until following fields are valid */ char lut_valid;/* zero until lut fields are valid */ unsigned long last_updated;/* in jiffies */ unsigned long lut_last_updated;/* in jiffies */ @@ -289,7 +289,7 @@ static struct lm63_data *lm63_update_device(struct device *dev) LM63_REG_ALERT_STATUS) & 0x7F; data->last_updated = jiffies; - data->valid =1 ; + data->valid = true; }lm63_update_lut (data);@@ -714,7 +714,7 @@ static ssize_t temp2_type_store(struct device *dev, reg =i2c_smbus_read_byte_data (client,LM96163_REG_TRUTHERM ) & ~0x02 ;i2c_smbus_write_byte_data (client,LM96163_REG_TRUTHERM , reg | (data->trutherm ?0x02 :0x00 )); - data->valid =0 ; + data->valid = false;mutex_unlock (&data->update_lock);return count;drivers/hwmon/lm77.c +2
-2@@ -55,7 +55,7 @@ static const u8 temp_regs[t_num_temp] = {struct lm77_data {struct i2c_client *client;struct mutex update_lock; -char valid; +bool valid;unsigned long last_updated;/* In jiffies */ int temp[t_num_temp];/* index using temp_index */ u8 alarms;@@ -118,7 +118,7 @@ static struct lm77_data *lm77_update_device(struct device *dev) data->alarms =lm77_read_value (client,LM77_REG_TEMP ) &0x0007 ; data->last_updated = jiffies; - data->valid =1 ; + data->valid = true; }mutex_unlock (&data->update_lock);drivers/hwmon/lm78.c +2
-2@@ -117,7 +117,7 @@ struct lm78_data {int isa_addr;struct mutex update_lock; -char valid;/* !=0 if following fields are valid */ +bool valid;/* true if following fields are valid */ unsigned long last_updated;/* In jiffies */ u8 in[7 ];/* Register value */ @@ -772,7 +772,7 @@ static struct lm78_data *lm78_update_device(struct device *dev) data->alarms =lm78_read_value (data,LM78_REG_ALARM1 ) + (lm78_read_value (data,LM78_REG_ALARM2 ) <<8 ); data->last_updated = jiffies; - data->valid =1 ; + data->valid = true; data->fan_div[2 ] =1 ; }drivers/hwmon/lm80.c +3
-3@@ -117,7 +117,7 @@ struct lm80_data {struct i2c_client *client;struct mutex update_lock;char error;/* !=0 if error occurred during last update */ -char valid;/* !=0 if following fields are valid */ +bool valid;/* true if following fields are valid */ unsigned long last_updated;/* In jiffies */ u8 in[i_num_in][7 ];/* Register value, 1st index is enum in_index */ @@ -236,14 +236,14 @@ static struct lm80_data *lm80_update_device(struct device *dev) data->alarms = prev_rv + (rv <<8 ); data->last_updated = jiffies; - data->valid =1 ; + data->valid = true; data->error =0 ; } goto done; abort: ret =ERR_PTR (rv); - data->valid =0 ; + data->valid = false; data->error =1 ; done:drivers/hwmon/lm83.c +2
-2@@ -105,7 +105,7 @@ struct lm83_data {struct i2c_client *client;const struct attribute_group *groups[3 ];struct mutex update_lock; -char valid;/* zero until following fields are valid */ +bool valid;/* false until following fields are valid */ unsigned long last_updated;/* in jiffies */ /* registers values */ @@ -137,7 +137,7 @@ static struct lm83_data *lm83_update_device(struct device *dev) << 8); data->last_updated = jiffies; - data->valid =1 ; + data->valid = true; }mutex_unlock (&data->update_lock);drivers/hwmon/lm85.c +2
-2@@ -294,7 +294,7 @@ struct lm85_data {bool has_vid5;/* true if VID5 is configured for ADT7463 or ADT7468 */ struct mutex update_lock; -int valid;/* !=0 if following fields are valid */ +bool valid;/* true if following fields are valid */ unsigned long last_reading;/* In jiffies */ unsigned long last_config;/* In jiffies */ @@ -541,7 +541,7 @@ static struct lm85_data *lm85_update_device(struct device *dev) data->last_config = jiffies; }/* last_config */ - data->valid =1 ; + data->valid = true;mutex_unlock (&data->update_lock);drivers/hwmon/lm87.c +2
-2@@ -141,7 +141,7 @@ static u8 LM87_REG_TEMP_LOW[3] = { 0x3A, 0x38, 0x2C };struct lm87_data {struct mutex update_lock; -char valid;/* zero until following fields are valid */ +bool valid;/* false until following fields are valid */ unsigned long last_updated;/* In jiffies */ u8 channel;/* register value */ @@ -251,7 +251,7 @@ static struct lm87_data *lm87_update_device(struct device *dev) data->aout =lm87_read_value (client,LM87_REG_AOUT ); data->last_updated = jiffies; - data->valid =1 ; + data->valid = true; }mutex_unlock (&data->update_lock);drivers/hwmon/lm92.c +2
-2@@ -99,7 +99,7 @@ static const u8 regs[t_num_regs] = {struct lm92_data {struct i2c_client *client;struct mutex update_lock; -char valid;/* zero until following fields are valid */ +bool valid;/* false until following fields are valid */ unsigned long last_updated;/* in jiffies */ /* registers values */ @@ -126,7 +126,7 @@ static struct lm92_data *lm92_update_device(struct device *dev)i2c_smbus_read_word_swapped (client, regs[i]); } data->last_updated = jiffies; - data->valid =1 ; + data->valid = true; }mutex_unlock (&data->update_lock);drivers/hwmon/lm93.c +2
-2@@ -202,7 +202,7 @@ struct lm93_data {/* client update function */ void (*update)(struct lm93_data *,struct i2c_client *); -char valid;/* !=0 if following fields are valid */ +bool valid;/* true if following fields are valid */ /* register values, arranged by block read groups */ struct block1_t block1;@@ -917,7 +917,7 @@ static struct lm93_data *lm93_update_device(struct device *dev) data->update (data, client); data->last_updated = jiffies; - data->valid =1 ; + data->valid = true; }mutex_unlock (&data->update_lock);drivers/hwmon/lm95241.c +4
-4@@ -78,7 +78,7 @@ struct lm95241_data {struct mutex update_lock;unsigned long last_updated;/* in jiffies */ unsigned long interval;/* in milli-seconds */ -char valid;/* zero until following fields are valid */ +bool valid;/* false until following fields are valid */ /* registers values */ u8 temp[ARRAY_SIZE (lm95241_reg_address)];u8 status, config, model, trutherm;@@ -118,7 +118,7 @@ static struct lm95241_data *lm95241_update_device(struct device *dev) data->status =i2c_smbus_read_byte_data (client,LM95241_REG_R_STATUS ); data->last_updated = jiffies; - data->valid =1 ; + data->valid = true; }mutex_unlock (&data->update_lock);@@ -257,7 +257,7 @@ static int lm95241_write_temp(struct device *dev, u32 attr, int channel,else data->config &= ~R2DF_MASK ; } - data->valid =0 ; + data->valid = false; ret =i2c_smbus_write_byte_data (client,LM95241_REG_RW_CONFIG , data->config);break ;@@ -273,7 +273,7 @@ static int lm95241_write_temp(struct device *dev, u32 attr, int channel,else data->config &= ~R2DF_MASK ; } - data->valid =0 ; + data->valid = false; ret =i2c_smbus_write_byte_data (client,LM95241_REG_RW_CONFIG , data->config);break ;drivers/hwmon/ltc4151.c +1
-1@@ -77,7 +77,7 @@ static struct ltc4151_data *ltc4151_update_device(struct device *dev) data->regs[i] = val; } data->last_updated = jiffies; - data->valid =1 ; + data->valid = true; } abort:mutex_unlock (&data->update_lock);drivers/hwmon/ltc4215.c +1
-1@@ -64,7 +64,7 @@ static struct ltc4215_data *ltc4215_update_device(struct device *dev) } data->last_updated = jiffies; - data->valid =1 ; + data->valid = true; }mutex_unlock (&data->update_lock);drivers/hwmon/ltc4261.c +2
-2@@ -73,13 +73,13 @@ static struct ltc4261_data *ltc4261_update_device(struct device *dev)"Failed to read ADC value: error %d\n" , val); ret =ERR_PTR (val); - data->valid =0 ; + data->valid = false; goto abort; } data->regs[i] = val; } data->last_updated = jiffies; - data->valid =1 ; + data->valid = true; } abort:mutex_unlock (&data->update_lock);drivers/hwmon/max16065.c +1
-1@@ -166,7 +166,7 @@ static struct max16065_data *max16065_update_device(struct device *dev) = i2c_smbus_read_byte_data(client, MAX16065_FAULT(i)); data->last_updated = jiffies; - data->valid =1 ; + data->valid = true; }mutex_unlock (&data->update_lock);return data;drivers/hwmon/max1619.c +2
-2@@ -79,7 +79,7 @@ enum temp_index {struct max1619_data {struct i2c_client *client;struct mutex update_lock; -char valid;/* zero until following fields are valid */ +bool valid;/* false until following fields are valid */ unsigned long last_updated;/* in jiffies */ /* registers values */ @@ -124,7 +124,7 @@ static struct max1619_data *max1619_update_device(struct device *dev) data->alarms ^=0x02 ; data->last_updated = jiffies; - data->valid =1 ; + data->valid = true; }mutex_unlock (&data->update_lock);drivers/hwmon/max1668.c +2
-2@@ -58,7 +58,7 @@ struct max1668_data {enum chips type;struct mutex update_lock; -char valid;/* !=0 if following fields are valid */ +bool valid;/* true if following fields are valid */ unsigned long last_updated;/* In jiffies */ /* 1x local and 4x remote */ @@ -120,7 +120,7 @@ static struct max1668_data *max1668_update_device(struct device *dev) data->alarms |= val; data->last_updated = jiffies; - data->valid =1 ; + data->valid = true; abort:mutex_unlock (&data->update_lock);drivers/hwmon/max6639.c +2
-2@@ -69,7 +69,7 @@ static const int rpm_ranges[] = { 2000, 4000, 8000, 16000 };struct max6639_data {struct i2c_client *client;struct mutex update_lock; -char valid;/* !=0 if following fields are valid */ +bool valid;/* true if following fields are valid */ unsigned long last_updated;/* In jiffies */ /* Register values sampled regularly */ @@ -141,7 +141,7 @@ static struct max6639_data *max6639_update_device(struct device *dev) } data->last_updated = jiffies; - data->valid =1 ; + data->valid = true; } abort:mutex_unlock (&data->update_lock);drivers/hwmon/max6642.c +1
-1@@ -181,7 +181,7 @@ static struct max6642_data *max6642_update_device(struct device *dev) MAX6642_REG_R_STATUS); data->last_updated = jiffies; - data->valid =1 ; + data->valid = true; }mutex_unlock (&data->update_lock);drivers/hwmon/pc87360.c +2
-2@@ -178,7 +178,7 @@ struct pc87360_data {struct device *hwmon_dev;struct mutex lock;struct mutex update_lock; -char valid;/* !=0 if following fields are valid */ +bool valid;/* true if following fields are valid */ unsigned long last_updated;/* In jiffies */ int address[3 ];@@ -1673,7 +1673,7 @@ static struct pc87360_data *pc87360_update_device(struct device *dev) } data->last_updated = jiffies; - data->valid =1 ; + data->valid = true; }mutex_unlock (&data->update_lock);drivers/hwmon/sch5636.c +2
-2@@ -56,7 +56,7 @@ struct sch5636_data {struct device *hwmon_dev;struct mutex update_lock; -char valid;/* !=0 if following fields are valid */ +bool valid;/* true if following fields are valid */ unsigned long last_updated;/* In jiffies */ u8 in[SCH5636_NO_INS ];u8 temp_val[SCH5636_NO_TEMPS ];@@ -140,7 +140,7 @@ static struct sch5636_data *sch5636_update_device(struct device *dev) } data->last_updated = jiffies; - data->valid =1 ; + data->valid = true; abort:mutex_unlock (&data->update_lock);return ret;drivers/hwmon/sht21.c +2
-2@@ -41,7 +41,7 @@ struct sht21 {unsigned long last_update;int temperature;int humidity; -char valid; +bool valid;char eic[18 ]; };@@ -105,7 +105,7 @@ static int sht21_update_measurements(struct device *dev) goto out; sht21->humidity =sht21_rh_ticks_to_per_cent_mille (ret); sht21->last_update = jiffies; - sht21->valid =1 ; + sht21->valid = true; } out:mutex_unlock (&sht21->lock);drivers/hwmon/sis5595.c +2
-2@@ -172,7 +172,7 @@ struct sis5595_data {struct mutex lock;struct mutex update_lock; -char valid;/* !=0 if following fields are valid */ +bool valid;/* true if following fields are valid */ unsigned long last_updated;/* In jiffies */ char maxins;/* == 3 if temp enabled, otherwise == 4 */ u8 revision;/* Reg. value */ @@ -728,7 +728,7 @@ static struct sis5595_data *sis5595_update_device(struct device *dev)sis5595_read_value (data,SIS5595_REG_ALARM1 ) | (sis5595_read_value (data,SIS5595_REG_ALARM2 ) <<8 ); data->last_updated = jiffies; - data->valid =1 ; + data->valid = true; }mutex_unlock (&data->update_lock);drivers/hwmon/smm665.c +1
-1@@ -265,7 +265,7 @@ static struct smm665_data *smm665_update_device(struct device *dev) data->adc[i] = val; } data->last_updated = jiffies; - data->valid =1 ; + data->valid = true; } abort:mutex_unlock (&data->update_lock);drivers/hwmon/smsc47b397.c +2
-2@@ -96,7 +96,7 @@ struct smsc47b397_data {struct mutex update_lock;unsigned long last_updated;/* in jiffies */ -int valid; +bool valid;/* register values */ u16 fan[4 ];@@ -137,7 +137,7 @@ static struct smsc47b397_data *smsc47b397_update_device(struct device *dev) } data->last_updated = jiffies; - data->valid =1 ; + data->valid = true;dev_dbg (dev,"... device update complete\n" ); }drivers/hwmon/smsc47m192.c +2
-2@@ -86,7 +86,7 @@ struct smsc47m192_data {struct i2c_client *client;const struct attribute_group *groups[3 ];struct mutex update_lock; -char valid;/* !=0 if following fields are valid */ +bool valid;/* true if following fields are valid */ unsigned long last_updated;/* In jiffies */ u8 in[8 ];/* Register value */ @@ -157,7 +157,7 @@ static struct smsc47m192_data *smsc47m192_update_device(struct device *dev) SMSC47M192_REG_ALARM2) << 8); data->last_updated = jiffies; - data->valid =1 ; + data->valid = true; }mutex_unlock (&data->update_lock);drivers/hwmon/thmc50.c +2
-2@@ -62,7 +62,7 @@ struct thmc50_data {enum chips type;unsigned long last_updated;/* In jiffies */ char has_temp3;/* !=0 if it is ADM1022 in temp3 mode */ -char valid;/* !=0 if following fields are valid */ +bool valid;/* true if following fields are valid */ /* Register values */ s8 temp_input[3 ];@@ -107,7 +107,7 @@ static struct thmc50_data *thmc50_update_device(struct device *dev) data->alarms =i2c_smbus_read_byte_data (client,THMC50_REG_INTR ); data->last_updated = jiffies; - data->valid =1 ; + data->valid = true; }mutex_unlock (&data->update_lock);drivers/hwmon/tmp401.c +3
-3@@ -136,7 +136,7 @@ struct tmp401_data {struct i2c_client *client;const struct attribute_group *groups[3 ];struct mutex update_lock; -char valid;/* zero until following fields are valid */ +bool valid;/* false until following fields are valid */ unsigned long last_updated;/* in jiffies */ enum chips kind;@@ -267,7 +267,7 @@ static struct tmp401_data *tmp401_update_device(struct device *dev) data->temp_crit_hyst = val; data->last_updated = jiffies; - data->valid =1 ; + data->valid = true; } abort:@@ -413,7 +413,7 @@ static ssize_t reset_temp_history_store(struct device *dev, }mutex_lock (&data->update_lock);i2c_smbus_write_byte_data (client,TMP401_TEMP_MSB_WRITE [5 ][0 ], val); - data->valid =0 ; + data->valid = false;mutex_unlock (&data->update_lock);return count;drivers/hwmon/tmp421.c +3
-3@@ -93,7 +93,7 @@ struct tmp421_data {struct hwmon_channel_info temp_info;const struct hwmon_channel_info *info[2 ];struct hwmon_chip_info chip; -char valid; +bool valid;unsigned long last_updated;unsigned long channels;u8 config;@@ -140,14 +140,14 @@ static int tmp421_update_device(struct tmp421_data *data) data->temp[i] |= ret; } data->last_updated = jiffies; - data->valid =1 ; + data->valid = true; } exit:mutex_unlock (&data->update_lock);if (ret <0 ) { - data->valid =0 ; + data->valid = false;return ret; }drivers/hwmon/via686a.c +2
-2@@ -304,7 +304,7 @@ struct via686a_data {const char *name;struct device *hwmon_dev;struct mutex update_lock; -char valid;/* !=0 if following fields are valid */ +bool valid;/* true if following fields are valid */ unsigned long last_updated;/* In jiffies */ u8 in[5 ];/* Register value */ @@ -800,7 +800,7 @@ static struct via686a_data *via686a_update_device(struct device *dev) VIA686A_REG_ALARM1) | (via686a_read_value (data,VIA686A_REG_ALARM2 ) <<8 ); data->last_updated = jiffies; - data->valid =1 ; + data->valid = true; }mutex_unlock (&data->update_lock);drivers/hwmon/vt1211.c +2
-2@@ -105,7 +105,7 @@ struct vt1211_data {struct device *hwmon_dev;struct mutex update_lock; -char valid;/* !=0 if following fields are valid */ +bool valid;/* true if following fields are valid */ unsigned long last_updated;/* In jiffies */ /* Register values */ @@ -319,7 +319,7 @@ static struct vt1211_data *vt1211_update_device(struct device *dev)vt1211_read8 (data,VT1211_REG_ALARM1 ); data->last_updated = jiffies; - data->valid =1 ; + data->valid = true; }mutex_unlock (&data->update_lock);drivers/hwmon/vt8231.c +2
-2@@ -145,7 +145,7 @@ struct vt8231_data {struct mutex update_lock;struct device *hwmon_dev; -char valid;/* !=0 if following fields are valid */ +bool valid;/* true if following fields are valid */ unsigned long last_updated;/* In jiffies */ u8 in[6 ];/* Register value */ @@ -929,7 +929,7 @@ static struct vt8231_data *vt8231_update_device(struct device *dev) data->alarms &= ~0x80 ; data->last_updated = jiffies; - data->valid =1 ; + data->valid = true; }mutex_unlock (&data->update_lock);drivers/hwmon/w83627ehf.c +4
-4@@ -320,7 +320,7 @@ struct w83627ehf_data {const u16 *scale_in;struct mutex update_lock; -char valid;/* !=0 if following fields are valid */ +bool valid;/* true if following fields are valid */ unsigned long last_updated;/* In jiffies */ /* Register values */ @@ -688,7 +688,7 @@ static struct w83627ehf_data *w83627ehf_update_device(struct device *dev) W83627EHF_REG_CASEOPEN_DET); data->last_updated = jiffies; - data->valid =1 ; + data->valid = true; }mutex_unlock (&data->update_lock);@@ -1099,7 +1099,7 @@ clear_caseopen(struct device *dev, struct w83627ehf_data *data, int channel, reg =w83627ehf_read_value (data,W83627EHF_REG_CASEOPEN_CLR );w83627ehf_write_value (data,W83627EHF_REG_CASEOPEN_CLR , reg | mask);w83627ehf_write_value (data,W83627EHF_REG_CASEOPEN_CLR , reg & ~mask); - data->valid =0 ;/* Force cache refresh */ + data->valid = false;/* Force cache refresh */ mutex_unlock (&data->update_lock);return 0 ;@@ -2004,7 +2004,7 @@ static int __maybe_unused w83627ehf_resume(struct device *dev)w83627ehf_write_value (data,W83627EHF_REG_VBAT , data->vbat);/* Force re-reading all values */ - data->valid =0 ; + data->valid = false;mutex_unlock (&data->update_lock);return 0 ;drivers/hwmon/w83627hf.c +3
-3@@ -355,7 +355,7 @@ struct w83627hf_data {enum chips type;struct mutex update_lock; -char valid;/* !=0 if following fields are valid */ +bool valid;/* true if following fields are valid */ unsigned long last_updated;/* In jiffies */ u8 in[9 ];/* Register value */ @@ -448,7 +448,7 @@ static int w83627hf_resume(struct device *dev)w83627hf_write_value (data,W83781D_REG_SCFG2 , data->scfg2);/* Force re-reading all values */ - data->valid =0 ; + data->valid = false;mutex_unlock (&data->update_lock);return 0 ;@@ -1905,7 +1905,7 @@ static struct w83627hf_data *w83627hf_update_device(struct device *dev)w83627hf_read_value (data,W83781D_REG_BEEP_INTS1 ) |w83627hf_read_value (data,W83781D_REG_BEEP_INTS3 ) <<16 ; data->last_updated = jiffies; - data->valid =1 ; + data->valid = true; }mutex_unlock (&data->update_lock);drivers/hwmon/w83781d.c +2
-2@@ -203,7 +203,7 @@ struct w83781d_data {int isa_addr;struct mutex update_lock; -char valid;/* !=0 if following fields are valid */ +bool valid;/* true if following fields are valid */ unsigned long last_updated;/* In jiffies */ struct i2c_client *lm75[2 ];/* for secondary I2C addresses */ @@ -1554,7 +1554,7 @@ static struct w83781d_data *w83781d_update_device(struct device *dev) W83781D_REG_BEEP_INTS3) << 16; } data->last_updated = jiffies; - data->valid =1 ; + data->valid = true; }mutex_unlock (&data->update_lock);drivers/hwmon/w83791d.c +2
-2@@ -270,7 +270,7 @@ struct w83791d_data {struct device *hwmon_dev;struct mutex update_lock; -char valid;/* !=0 if following fields are valid */ +bool valid;/* true if following fields are valid */ unsigned long last_updated;/* In jiffies */ /* array of 2 pointers to subclients */ @@ -1603,7 +1603,7 @@ static struct w83791d_data *w83791d_update_device(struct device *dev) << 4; data->last_updated = jiffies; - data->valid =1 ; + data->valid = true; }mutex_unlock (&data->update_lock);drivers/hwmon/w83792d.c +3
-3@@ -261,7 +261,7 @@ struct w83792d_data {struct device *hwmon_dev;struct mutex update_lock; -char valid;/* !=0 if following fields are valid */ +bool valid;/* true if following fields are valid */ unsigned long last_updated;/* In jiffies */ /* array of 2 pointers to subclients */ @@ -743,7 +743,7 @@ intrusion0_alarm_store(struct device *dev, struct device_attribute *attr,mutex_lock (&data->update_lock); reg =w83792d_read_value (client,W83792D_REG_CHASSIS_CLR );w83792d_write_value (client,W83792D_REG_CHASSIS_CLR , reg |0x80 ); - data->valid =0 ;/* Force cache refresh */ + data->valid = false;/* Force cache refresh */ mutex_unlock (&data->update_lock);return count;@@ -1595,7 +1595,7 @@ static struct w83792d_data *w83792d_update_device(struct device *dev) } data->last_updated = jiffies; - data->valid =1 ; + data->valid = true; }mutex_unlock (&data->update_lock);drivers/hwmon/w83793.c +3
-3@@ -205,7 +205,7 @@ struct w83793_data {struct i2c_client *lm75[2 ];struct device *hwmon_dev;struct mutex update_lock; -char valid;/* !=0 if following fields are valid */ +bool valid;/* true if following fields are valid */ unsigned long last_updated;/* In jiffies */ unsigned long last_nonvolatile;/* In jiffies, last time we update the * nonvolatile registers @@ -453,7 +453,7 @@ store_chassis_clear(struct device *dev,mutex_lock (&data->update_lock); reg =w83793_read_value (client,W83793_REG_CLR_CHASSIS );w83793_write_value (client,W83793_REG_CLR_CHASSIS , reg |0x80 ); - data->valid =0 ;/* Force cache refresh */ + data->valid = false;/* Force cache refresh */ mutex_unlock (&data->update_lock);return count; }@@ -2081,7 +2081,7 @@ static struct w83793_data *w83793_update_device(struct device *dev) data->vid[1 ] =w83793_read_value (client,W83793_REG_VID_INB );w83793_update_nonvolatile (dev); data->last_updated = jiffies; - data->valid =1 ; + data->valid = true; END:mutex_unlock (&data->update_lock);drivers/hwmon/w83795.c +3
-3@@ -379,7 +379,7 @@ struct w83795_data {u8 enable_beep;u8 beeps[6 ];/* Register value */ -char valid; +bool valid;char valid_limits;char valid_pwm_config; };@@ -684,7 +684,7 @@ static struct w83795_data *w83795_update_device(struct device *dev) tmp & ~ALARM_CTRL_RTSACS); data->last_updated = jiffies; - data->valid =1 ; + data->valid = true; END:mutex_unlock (&data->update_lock);@@ -764,7 +764,7 @@ store_chassis_clear(struct device *dev,/* Clear status and force cache refresh */ w83795_read (client,W83795_REG_ALARM (5 )); - data->valid =0 ; + data->valid = false;mutex_unlock (&data->update_lock);return count; }drivers/hwmon/w83l785ts.c +2
-2@@ -98,7 +98,7 @@ static struct i2c_driver w83l785ts_driver = {struct w83l785ts_data {struct device *hwmon_dev;struct mutex update_lock; -char valid;/* zero until following fields are valid */ +bool valid;/* false until following fields are valid */ unsigned long last_updated;/* in jiffies */ /* registers values */ @@ -270,7 +270,7 @@ static struct w83l785ts_data *w83l785ts_update_device(struct device *dev) W83L785TS_REG_TEMP_OVER, data->temp[1]); data->last_updated = jiffies; - data->valid =1 ; + data->valid = true; }mutex_unlock (&data->update_lock);drivers/hwmon/w83l786ng.c +2
-2@@ -113,7 +113,7 @@ DIV_TO_REG(long val)struct w83l786ng_data {struct i2c_client *client;struct mutex update_lock; -char valid;/* !=0 if following fields are valid */ +bool valid;/* true if following fields are valid */ unsigned long last_updated;/* In jiffies */ unsigned long last_nonvolatile;/* In jiffies, last time we update the * nonvolatile registers */ @@ -209,7 +209,7 @@ static struct w83l786ng_data *w83l786ng_update_device(struct device *dev) data->tolerance[1 ] = (reg_tmp >>4 ) &0x0f ; data->last_updated = jiffies; - data->valid =1 ; + data->valid = true; }Signature · 1 line
2.17.1
Re: [PATCH] hwmon: cleanup non-bool "valid" data fields
In reply to Paul FertserQuoted 26 lines · Paul Fertser
We have bool so use it consistently in all the drivers.
The following Coccinelle script was used:
@@
identifier T;
type t = { char, int };
@@
struct T {
...(quoted diff) +1
-1- t valid; + bool valid;}
@@
identifier v;
@@
(
-v->valid= 0
+v->valid= false
|
-v->valid= 1
+v->valid= true
)
Quoted 7 lines
followed by sed to fixup the comments:
sed '/bool valid;/{s/!=0/true/;s/zero/false/}'Few whitespace changes were fixed manually. All modified drivers were compile-tested.
Signed-off-by Paul Fertser <[email protected]>
Applied.
Thanks,
Guenter
Quoted 1,705 lines
---
This was generated against hwmon-next branch.
drivers/hwmon/abituguru3.c | 6 +++--- drivers/hwmon/ad7414.c | 4 ++-- drivers/hwmon/ad7418.c | 6 +++--- drivers/hwmon/adm1021.c | 4 ++-- drivers/hwmon/adm1025.c | 4 ++-- drivers/hwmon/adm1026.c | 4 ++-- drivers/hwmon/adm1029.c | 4 ++-- drivers/hwmon/adm1031.c | 6 +++--- drivers/hwmon/amc6821.c | 8 ++++---- drivers/hwmon/applesmc.c | 2 +- drivers/hwmon/asb100.c | 4 ++-- drivers/hwmon/asc7621.c | 4 ++-- drivers/hwmon/atxp1.c | 8 ++++---- drivers/hwmon/coretemp.c | 2 +- drivers/hwmon/dme1737.c | 4 ++-- drivers/hwmon/ds1621.c | 4 ++-- drivers/hwmon/ds620.c | 4 ++-- drivers/hwmon/emc6w201.c | 4 ++-- drivers/hwmon/f71805f.c | 4 ++-- drivers/hwmon/f71882fg.c | 4 ++-- drivers/hwmon/f75375s.c | 4 ++-- drivers/hwmon/fschmd.c | 4 ++-- drivers/hwmon/g760a.c | 2 +- drivers/hwmon/gl518sm.c | 4 ++-- drivers/hwmon/gl520sm.c | 4 ++-- drivers/hwmon/ibmaem.c | 2 +- drivers/hwmon/ibmpex.c | 4 ++-- drivers/hwmon/it87.c | 12 ++++++------ drivers/hwmon/lineage-pem.c | 2 +- drivers/hwmon/lm63.c | 6 +++--- drivers/hwmon/lm77.c | 4 ++-- drivers/hwmon/lm78.c | 4 ++-- drivers/hwmon/lm80.c | 6 +++--- drivers/hwmon/lm83.c | 4 ++-- drivers/hwmon/lm85.c | 4 ++-- drivers/hwmon/lm87.c | 4 ++-- drivers/hwmon/lm92.c | 4 ++-- drivers/hwmon/lm93.c | 4 ++-- drivers/hwmon/lm95241.c | 8 ++++---- drivers/hwmon/ltc4151.c | 2 +- drivers/hwmon/ltc4215.c | 2 +- drivers/hwmon/ltc4261.c | 4 ++-- drivers/hwmon/max16065.c | 2 +- drivers/hwmon/max1619.c | 4 ++-- drivers/hwmon/max1668.c | 4 ++-- drivers/hwmon/max6639.c | 4 ++-- drivers/hwmon/max6642.c | 2 +- drivers/hwmon/pc87360.c | 4 ++-- drivers/hwmon/sch5636.c | 4 ++-- drivers/hwmon/sht21.c | 4 ++-- drivers/hwmon/sis5595.c | 4 ++-- drivers/hwmon/smm665.c | 2 +- drivers/hwmon/smsc47b397.c | 4 ++-- drivers/hwmon/smsc47m192.c | 4 ++-- drivers/hwmon/thmc50.c | 4 ++-- drivers/hwmon/tmp401.c | 6 +++--- drivers/hwmon/tmp421.c | 6 +++--- drivers/hwmon/via686a.c | 4 ++-- drivers/hwmon/vt1211.c | 4 ++-- drivers/hwmon/vt8231.c | 4 ++-- drivers/hwmon/w83627ehf.c | 8 ++++---- drivers/hwmon/w83627hf.c | 6 +++--- drivers/hwmon/w83781d.c | 4 ++-- drivers/hwmon/w83791d.c | 4 ++-- drivers/hwmon/w83792d.c | 6 +++--- drivers/hwmon/w83793.c | 6 +++--- drivers/hwmon/w83795.c | 6 +++--- drivers/hwmon/w83l785ts.c | 4 ++-- drivers/hwmon/w83l786ng.c | 4 ++-- 69 files changed, 151 insertions(+), 151 deletions(-)drivers/hwmon/abituguru3.c +3
-3@@ -145,7 +145,7 @@ struct abituguru3_data {struct device *hwmon_dev;/* hwmon registered device */ struct mutex update_lock;/* protect access to data and uGuru */ unsigned short addr;/* uguru base address */ -char valid;/* !=0 if following fields are valid */ +bool valid;/* true if following fields are valid */ unsigned long last_updated;/* In jiffies */ /* @@ -1083,7 +1083,7 @@ static struct abituguru3_data *abituguru3_update_device(struct device *dev)mutex_lock (&data->update_lock);if (!data->valid ||time_after (jiffies, data->last_updated +HZ )) {/* Clear data->valid while updating */ - data->valid =0 ; + data->valid = false;/* Read alarms */ if (abituguru3_read_increment_offset(data, ABIT_UGURU3_SETTINGS_BANK,@@ -1117,7 +1117,7 @@ static struct abituguru3_data *abituguru3_update_device(struct device *dev) goto LEAVE_UPDATE; } data->last_updated = jiffies; - data->valid =1 ; + data->valid = true; } LEAVE_UPDATE:mutex_unlock (&data->update_lock);drivers/hwmon/ad7414.c +2
-2@@ -37,7 +37,7 @@ static u8 AD7414_REG_LIMIT[] = { AD7414_REG_T_HIGH, AD7414_REG_T_LOW };struct ad7414_data {struct i2c_client *client;struct mutex lock;/* atomic read data updates */ -char valid;/* !=0 if following fields are valid */ +bool valid;/* true if following fields are valid */ unsigned long next_update;/* In jiffies */ s16 temp_input;/* Register values */ s8 temps[ARRAY_SIZE (AD7414_REG_LIMIT )];@@ -95,7 +95,7 @@ static struct ad7414_data *ad7414_update_device(struct device *dev) } data->next_update = jiffies +HZ +HZ /2 ; - data->valid =1 ; + data->valid = true; }mutex_unlock (&data->lock);drivers/hwmon/ad7418.c +3
-3@@ -46,7 +46,7 @@ struct ad7418_data {enum chips type;struct mutex lock;int adc_max;/* number of ADC channels */ -char valid; +bool valid;unsigned long last_updated;/* In jiffies */ s16 temp[3 ];/* Register values */ u16 in[4 ];@@ -111,14 +111,14 @@ static int ad7418_update_device(struct device *dev) goto abort; data->last_updated = jiffies; - data->valid =1 ; + data->valid = true; }mutex_unlock (&data->lock);return 0 ; abort: - data->valid =0 ; + data->valid = false;mutex_unlock (&data->lock);return val; }drivers/hwmon/adm1021.c +2
-2@@ -72,7 +72,7 @@ struct adm1021_data {const struct attribute_group *groups[3 ];struct mutex update_lock; -char valid;/* !=0 if following fields are valid */ +bool valid;/* true if following fields are valid */ char low_power;/* !=0 if device in low power mode */ unsigned long last_updated;/* In jiffies */ @@ -135,7 +135,7 @@ static struct adm1021_data *adm1021_update_device(struct device *dev) ADM1023_REG_REM_OFFSET_PREC); } data->last_updated = jiffies; - data->valid =1 ; + data->valid = true; }mutex_unlock (&data->update_lock);drivers/hwmon/adm1025.c +2
-2@@ -97,7 +97,7 @@ struct adm1025_data {struct i2c_client *client;const struct attribute_group *groups[3 ];struct mutex update_lock; -char valid;/* zero until following fields are valid */ +bool valid;/* false until following fields are valid */ unsigned long last_updated;/* in jiffies */ u8 in[6 ];/* register value */ @@ -148,7 +148,7 @@ static struct adm1025_data *adm1025_update_device(struct device *dev) ADM1025_REG_VID4) & 0x01) << 4); data->last_updated = jiffies; - data->valid =1 ; + data->valid = true; }mutex_unlock (&data->update_lock);drivers/hwmon/adm1026.c +2
-2@@ -259,7 +259,7 @@ struct adm1026_data {const struct attribute_group *groups[3 ];struct mutex update_lock; -int valid;/* !=0 if following fields are valid */ +bool valid;/* true if following fields are valid */ unsigned long last_reading;/* In jiffies */ unsigned long last_config;/* In jiffies */ @@ -459,7 +459,7 @@ static struct adm1026_data *adm1026_update_device(struct device *dev) data->last_config = jiffies; }/* last_config */ - data->valid =1 ; + data->valid = true;mutex_unlock (&data->update_lock);return data; }drivers/hwmon/adm1029.c +2
-2@@ -99,7 +99,7 @@ static const u8 ADM1029_REG_FAN_DIV[] = {struct adm1029_data {struct i2c_client *client;struct mutex update_lock;/* protect register access */ -char valid;/* zero until following fields are valid */ +bool valid;/* false until following fields are valid */ unsigned long last_updated;/* in jiffies */ /* registers values, signed for temperature, unsigned for other stuff */ @@ -143,7 +143,7 @@ static struct adm1029_data *adm1029_update_device(struct device *dev) } data->last_updated = jiffies; - data->valid =1 ; + data->valid = true; }mutex_unlock (&data->update_lock);drivers/hwmon/adm1031.c +3
-3@@ -65,7 +65,7 @@ struct adm1031_data {const struct attribute_group *groups[3 ];struct mutex update_lock;int chip_type; -char valid;/* !=0 if following fields are valid */ +bool valid;/* true if following fields are valid */ unsigned long last_updated;/* In jiffies */ unsigned int update_interval;/* In milliseconds */ /* @@ -187,7 +187,7 @@ static struct adm1031_data *adm1031_update_device(struct device *dev) ADM1031_REG_PWM) >> (4 * chan)) & 0x0f; } data->last_updated = jiffies; - data->valid =1 ; + data->valid = true; }mutex_unlock (&data->update_lock);@@ -650,7 +650,7 @@ static ssize_t fan_div_store(struct device *dev, data->fan_min[nr]);/* Invalidate the cache: fan speed is no longer valid */ - data->valid =0 ; + data->valid = false;mutex_unlock (&data->update_lock);return count; }drivers/hwmon/amc6821.c +4
-4@@ -141,7 +141,7 @@ static const u8 fan_reg_hi[] = {AMC6821_REG_TDATA_HI,struct amc6821_data {struct i2c_client *client;struct mutex update_lock; -char valid;/* zero until following fields are valid */ +bool valid;/* false until following fields are valid */ unsigned long last_updated;/* in jiffies */ /* register values */ @@ -258,7 +258,7 @@ static struct amc6821_data *amc6821_update_device(struct device *dev) } data->last_updated = jiffies; - data->valid =1 ; + data->valid = true; }mutex_unlock (&data->update_lock);return data;@@ -511,7 +511,7 @@ static ssize_t temp_auto_point_temp_store(struct device *dev, }mutex_lock (&data->update_lock); - data->valid =0 ; + data->valid = false;switch (ix) {case 0 :@@ -584,7 +584,7 @@ static ssize_t pwm1_auto_point_pwm_store(struct device *dev, } EXIT: - data->valid =0 ; + data->valid = false;mutex_unlock (&data->update_lock);return count; }drivers/hwmon/applesmc.c +1
-1@@ -391,7 +391,7 @@ static const struct applesmc_entry *applesmc_get_entry_by_index(int index) cache->len = info[0 ];memcpy (cache->type, &info[1 ],4 ); cache->flags = info[5 ]; - cache->valid =1 ; + cache->valid = true; out:mutex_unlock (&smcreg.mutex);drivers/hwmon/asb100.c +2
-2@@ -186,7 +186,7 @@ struct asb100_data {/* array of 2 pointers to subclients */ struct i2c_client *lm75[2 ]; -char valid;/* !=0 if following fields are valid */ +bool valid;/* true if following fields are valid */ u8 in[7 ];/* Register value */ u8 in_max[7 ];/* Register value */ u8 in_min[7 ];/* Register value */ @@ -993,7 +993,7 @@ static struct asb100_data *asb100_update_device(struct device *dev) (asb100_read_value (client,ASB100_REG_ALARM2 ) <<8 ); data->last_updated = jiffies; - data->valid =1 ; + data->valid = true;dev_dbg (&client->dev,"... device update complete\n" ); }drivers/hwmon/asc7621.c +2
-2@@ -77,7 +77,7 @@ struct asc7621_data {struct i2c_client client;struct device *class_dev;struct mutex update_lock; -int valid;/* !=0 if following fields are valid */ +bool valid;/* true if following fields are valid */ unsigned long last_high_reading;/* In jiffies */ unsigned long last_low_reading;/* In jiffies */ /* @@ -1032,7 +1032,7 @@ static struct asc7621_data *asc7621_update_device(struct device *dev) data->last_low_reading = jiffies; }/* last_reading */ - data->valid =1 ; + data->valid = true;mutex_unlock (&data->update_lock);drivers/hwmon/atxp1.c +4
-4@@ -63,7 +63,7 @@ static struct atxp1_data *atxp1_update_device(struct device *dev) data->reg.gpio1 =i2c_smbus_read_byte_data (client,ATXP1_GPIO1 ); data->reg.gpio2 =i2c_smbus_read_byte_data (client,ATXP1_GPIO2 ); - data->valid =1 ; + data->valid = true; }mutex_unlock (&data->update_lock);@@ -136,7 +136,7 @@ static ssize_t cpu0_vid_store(struct device *dev, ATXP1_VID, cvid | ATXP1_VIDENA); } - data->valid =0 ; + data->valid = false;return count; }@@ -180,7 +180,7 @@ static ssize_t gpio1_store(struct device *dev, struct device_attribute *attr,i2c_smbus_write_byte_data (client,ATXP1_GPIO1 , value); - data->valid =0 ; + data->valid = false; }return count;@@ -224,7 +224,7 @@ static ssize_t gpio2_store(struct device *dev, struct device_attribute *attr,i2c_smbus_write_byte_data (client,ATXP1_GPIO2 , value); - data->valid =0 ; + data->valid = false; }return count;drivers/hwmon/coretemp.c +1
-1@@ -167,7 +167,7 @@ static ssize_t show_temp(struct device *dev,* really help at all. */ tdata->temp = tdata->tjmax - ((eax >>16 ) &0x7f ) *1000 ; - tdata->valid =1 ; + tdata->valid = true; tdata->last_updated = jiffies; }drivers/hwmon/dme1737.c +2
-2@@ -203,7 +203,7 @@ struct dme1737_data {unsigned int addr;/* for ISA devices only */ struct mutex update_lock; -int valid;/* !=0 if following fields are valid */ +bool valid;/* true if following fields are valid */ unsigned long last_update;/* in jiffies */ unsigned long last_vbat;/* in jiffies */ enum chips type;@@ -778,7 +778,7 @@ static struct dme1737_data *dme1737_update_device(struct device *dev) } data->last_update = jiffies; - data->valid =1 ; + data->valid = true; }mutex_unlock (&data->update_lock);drivers/hwmon/ds1621.c +2
-2@@ -109,7 +109,7 @@ static const u8 DS1621_REG_TEMP[3] = {struct ds1621_data {struct i2c_client *client;struct mutex update_lock; -char valid;/* !=0 if following fields are valid */ +bool valid;/* true if following fields are valid */ unsigned long last_updated;/* In jiffies */ enum chips kind;/* device type */ @@ -213,7 +213,7 @@ static struct ds1621_data *ds1621_update_client(struct device *dev) new_conf); data->last_updated = jiffies; - data->valid =1 ; + data->valid = true; }mutex_unlock (&data->update_lock);drivers/hwmon/ds620.c +2
-2@@ -56,7 +56,7 @@ static const u8 DS620_REG_TEMP[3] = {struct ds620_data {struct i2c_client *client;struct mutex update_lock; -char valid;/* !=0 if following fields are valid */ +bool valid;/* true if following fields are valid */ unsigned long last_updated;/* In jiffies */ s16 temp[3 ];/* Register values, word */ @@ -118,7 +118,7 @@ static struct ds620_data *ds620_update_client(struct device *dev) } data->last_updated = jiffies; - data->valid =1 ; + data->valid = true; } abort:mutex_unlock (&data->update_lock);drivers/hwmon/emc6w201.c +2
-2@@ -45,7 +45,7 @@ enum subfeature { input, min, max };struct emc6w201_data {struct i2c_client *client;struct mutex update_lock; -char valid;/* zero until following fields are valid */ +bool valid;/* false until following fields are valid */ unsigned long last_updated;/* in jiffies */ /* registers values */ @@ -162,7 +162,7 @@ static struct emc6w201_data *emc6w201_update_device(struct device *dev) } data->last_updated = jiffies; - data->valid =1 ; + data->valid = true; }mutex_unlock (&data->update_lock);drivers/hwmon/f71805f.c +2
-2@@ -165,7 +165,7 @@ struct f71805f_data {struct device *hwmon_dev;struct mutex update_lock; -char valid;/* !=0 if following fields are valid */ +bool valid;/* true if following fields are valid */ unsigned long last_updated;/* In jiffies */ unsigned long last_limits;/* In jiffies */ @@ -404,7 +404,7 @@ static struct f71805f_data *f71805f_update_device(struct device *dev) + (f71805f_read8 (data,F71805F_REG_STATUS (2 )) <<16 ); data->last_updated = jiffies; - data->valid =1 ; + data->valid = true; }mutex_unlock (&data->update_lock);drivers/hwmon/f71882fg.c +2
-2@@ -253,7 +253,7 @@ struct f71882fg_data {struct mutex update_lock;int temp_start;/* temp numbering start (0 or 1) */ -char valid;/* !=0 if following fields are valid */ +bool valid;/* true if following fields are valid */ char auto_point_temp_signed;unsigned long last_updated;/* In jiffies */ unsigned long last_limits;/* In jiffies */ @@ -1359,7 +1359,7 @@ static struct f71882fg_data *f71882fg_update_device(struct device *dev) F71882FG_REG_IN(nr)); data->last_updated = jiffies; - data->valid =1 ; + data->valid = true; }mutex_unlock (&data->update_lock);drivers/hwmon/f75375s.c +2
-2@@ -85,7 +85,7 @@ struct f75375_data {const char *name;int kind;struct mutex update_lock;/* protect register access */ -char valid; +bool valid;unsigned long last_updated;/* In jiffies */ unsigned long last_limits;/* In jiffies */ @@ -228,7 +228,7 @@ static struct f75375_data *f75375_update_device(struct device *dev)f75375_read8 (client,F75375_REG_VOLT (nr)); data->last_updated = jiffies; - data->valid =1 ; + data->valid = true; }mutex_unlock (&data->update_lock);drivers/hwmon/fschmd.c +2
-2@@ -264,7 +264,7 @@ struct fschmd_data {unsigned long watchdog_is_open;char watchdog_expect_close;char watchdog_name[10 ];/* must be unique to avoid sysfs conflict */ -char valid;/* zero until following fields are valid */ +bool valid;/* false until following fields are valid */ unsigned long last_updated;/* in jiffies */ /* register values */ @@ -1356,7 +1356,7 @@ static struct fschmd_data *fschmd_update_device(struct device *dev) FSCHMD_REG_VOLT[data->kind][i]); data->last_updated = jiffies; - data->valid =1 ; + data->valid = true; }mutex_unlock (&data->update_lock);drivers/hwmon/g760a.c +1
-1@@ -95,7 +95,7 @@ static struct g760a_data *g760a_update_client(struct device *dev) data->fan_sta =g760a_read_value (client,G760A_REG_FAN_STA ); data->last_updated = jiffies; - data->valid =1 ; + data->valid = true; }mutex_unlock (&data->update_lock);drivers/hwmon/gl518sm.c +2
-2@@ -107,7 +107,7 @@ struct gl518_data {enum chips type;struct mutex update_lock; -char valid;/* !=0 if following fields are valid */ +bool valid;/* true if following fields are valid */ unsigned long last_updated;/* In jiffies */ u8 voltage_in[4 ];/* Register values; [0] = VDD */ @@ -211,7 +211,7 @@ static struct gl518_data *gl518_update_device(struct device *dev)gl518_read_value (client,GL518_REG_VIN3 ); data->last_updated = jiffies; - data->valid =1 ; + data->valid = true; }mutex_unlock (&data->update_lock);drivers/hwmon/gl520sm.c +2
-2@@ -64,7 +64,7 @@ struct gl520_data {struct i2c_client *client;const struct attribute_group *groups[3 ];struct mutex update_lock; -char valid;/* zero until the following fields are valid */ +bool valid;/* false until the following fields are valid */ unsigned long last_updated;/* in jiffies */ u8 vid;@@ -174,7 +174,7 @@ static struct gl520_data *gl520_update_device(struct device *dev) } data->last_updated = jiffies; - data->valid =1 ; + data->valid = true; }mutex_unlock (&data->update_lock);drivers/hwmon/ibmaem.c +1
-1@@ -127,7 +127,7 @@ struct aem_data {struct device *hwmon_dev;struct platform_device *pdev;struct mutex lock; -char valid; +bool valid;unsigned long last_updated;/* In jiffies */ u8 ver_major;u8 ver_minor;drivers/hwmon/ibmpex.c +2
-2@@ -66,7 +66,7 @@ struct ibmpex_bmc_data {struct device *hwmon_dev;struct device *bmc_device;struct mutex lock; -char valid; +bool valid;unsigned long last_updated;/* In jiffies */ struct ipmi_addr address;@@ -239,7 +239,7 @@ static void ibmpex_update_device(struct ibmpex_bmc_data *data) } data->last_updated = jiffies; - data->valid =1 ; + data->valid = true; out:mutex_unlock (&data->lock);drivers/hwmon/it87.c +6
-6@@ -519,7 +519,7 @@ struct it87_data {unsigned short addr;const char *name;struct mutex update_lock; -char valid;/* !=0 if following fields are valid */ +bool valid;/* true if following fields are valid */ unsigned long last_updated;/* In jiffies */ u16 in_scaled;/* Internal voltage sensors are scaled */ @@ -844,7 +844,7 @@ static struct it87_data *it87_update_device(struct device *dev) data->vid &=0x3f ; } data->last_updated = jiffies; - data->valid =1 ; + data->valid = true; }mutex_unlock (&data->update_lock);@@ -980,7 +980,7 @@ static ssize_t set_temp(struct device *dev, struct device_attribute *attr, regval |=0x80 ;it87_write_value (data,IT87_REG_BEEP_ENABLE , regval); } - data->valid =0 ; + data->valid = false; reg =IT87_REG_TEMP_OFFSET [nr];break ; }@@ -1079,7 +1079,7 @@ static ssize_t set_temp_type(struct device *dev, struct device_attribute *attr,it87_write_value (data,IT87_REG_TEMP_ENABLE , data->sensor);if (has_temp_old_peci (data, nr))it87_write_value (data,IT87_REG_TEMP_EXTRA , data->extra); - data->valid =0 ;/* Force cache refresh */ + data->valid = false;/* Force cache refresh */ mutex_unlock (&data->update_lock);return count; }@@ -1834,7 +1834,7 @@ static ssize_t clear_intrusion(struct device *dev, config |=BIT (5 );it87_write_value (data,IT87_REG_CONFIG , config);/* Invalidate cache to force re-read */ - data->valid =0 ; + data->valid = false; }mutex_unlock (&data->update_lock);@@ -3229,7 +3229,7 @@ static int __maybe_unused it87_resume(struct device *dev)it87_start_monitoring (data);/* force update */ - data->valid =0 ; + data->valid = false;mutex_unlock (&data->update_lock);drivers/hwmon/lineage-pem.c +1
-1@@ -191,7 +191,7 @@ static struct pem_data *pem_update_device(struct device *dev)i2c_smbus_write_byte (client,PEM_CLEAR_INFO_FLAGS ); data->last_updated = jiffies; - data->valid =1 ; + data->valid = true; } abort:mutex_unlock (&data->update_lock);drivers/hwmon/lm63.c +3
-3@@ -139,7 +139,7 @@ struct lm63_data {struct i2c_client *client;struct mutex update_lock;const struct attribute_group *groups[5 ]; -char valid;/* zero until following fields are valid */ +bool valid;/* false until following fields are valid */ char lut_valid;/* zero until lut fields are valid */ unsigned long last_updated;/* in jiffies */ unsigned long lut_last_updated;/* in jiffies */ @@ -289,7 +289,7 @@ static struct lm63_data *lm63_update_device(struct device *dev) LM63_REG_ALERT_STATUS) & 0x7F; data->last_updated = jiffies; - data->valid =1 ; + data->valid = true; }lm63_update_lut (data);@@ -714,7 +714,7 @@ static ssize_t temp2_type_store(struct device *dev, reg =i2c_smbus_read_byte_data (client,LM96163_REG_TRUTHERM ) & ~0x02 ;i2c_smbus_write_byte_data (client,LM96163_REG_TRUTHERM , reg | (data->trutherm ?0x02 :0x00 )); - data->valid =0 ; + data->valid = false;mutex_unlock (&data->update_lock);return count;drivers/hwmon/lm77.c +2
-2@@ -55,7 +55,7 @@ static const u8 temp_regs[t_num_temp] = {struct lm77_data {struct i2c_client *client;struct mutex update_lock; -char valid; +bool valid;unsigned long last_updated;/* In jiffies */ int temp[t_num_temp];/* index using temp_index */ u8 alarms;@@ -118,7 +118,7 @@ static struct lm77_data *lm77_update_device(struct device *dev) data->alarms =lm77_read_value (client,LM77_REG_TEMP ) &0x0007 ; data->last_updated = jiffies; - data->valid =1 ; + data->valid = true; }mutex_unlock (&data->update_lock);drivers/hwmon/lm78.c +2
-2@@ -117,7 +117,7 @@ struct lm78_data {int isa_addr;struct mutex update_lock; -char valid;/* !=0 if following fields are valid */ +bool valid;/* true if following fields are valid */ unsigned long last_updated;/* In jiffies */ u8 in[7 ];/* Register value */ @@ -772,7 +772,7 @@ static struct lm78_data *lm78_update_device(struct device *dev) data->alarms =lm78_read_value (data,LM78_REG_ALARM1 ) + (lm78_read_value (data,LM78_REG_ALARM2 ) <<8 ); data->last_updated = jiffies; - data->valid =1 ; + data->valid = true; data->fan_div[2 ] =1 ; }drivers/hwmon/lm80.c +3
-3@@ -117,7 +117,7 @@ struct lm80_data {struct i2c_client *client;struct mutex update_lock;char error;/* !=0 if error occurred during last update */ -char valid;/* !=0 if following fields are valid */ +bool valid;/* true if following fields are valid */ unsigned long last_updated;/* In jiffies */ u8 in[i_num_in][7 ];/* Register value, 1st index is enum in_index */ @@ -236,14 +236,14 @@ static struct lm80_data *lm80_update_device(struct device *dev) data->alarms = prev_rv + (rv <<8 ); data->last_updated = jiffies; - data->valid =1 ; + data->valid = true; data->error =0 ; } goto done; abort: ret =ERR_PTR (rv); - data->valid =0 ; + data->valid = false; data->error =1 ; done:drivers/hwmon/lm83.c +2
-2@@ -105,7 +105,7 @@ struct lm83_data {struct i2c_client *client;const struct attribute_group *groups[3 ];struct mutex update_lock; -char valid;/* zero until following fields are valid */ +bool valid;/* false until following fields are valid */ unsigned long last_updated;/* in jiffies */ /* registers values */ @@ -137,7 +137,7 @@ static struct lm83_data *lm83_update_device(struct device *dev) << 8); data->last_updated = jiffies; - data->valid =1 ; + data->valid = true; }mutex_unlock (&data->update_lock);drivers/hwmon/lm85.c +2
-2@@ -294,7 +294,7 @@ struct lm85_data {bool has_vid5;/* true if VID5 is configured for ADT7463 or ADT7468 */ struct mutex update_lock; -int valid;/* !=0 if following fields are valid */ +bool valid;/* true if following fields are valid */ unsigned long last_reading;/* In jiffies */ unsigned long last_config;/* In jiffies */ @@ -541,7 +541,7 @@ static struct lm85_data *lm85_update_device(struct device *dev) data->last_config = jiffies; }/* last_config */ - data->valid =1 ; + data->valid = true;mutex_unlock (&data->update_lock);drivers/hwmon/lm87.c +2
-2@@ -141,7 +141,7 @@ static u8 LM87_REG_TEMP_LOW[3] = { 0x3A, 0x38, 0x2C };struct lm87_data {struct mutex update_lock; -char valid;/* zero until following fields are valid */ +bool valid;/* false until following fields are valid */ unsigned long last_updated;/* In jiffies */ u8 channel;/* register value */ @@ -251,7 +251,7 @@ static struct lm87_data *lm87_update_device(struct device *dev) data->aout =lm87_read_value (client,LM87_REG_AOUT ); data->last_updated = jiffies; - data->valid =1 ; + data->valid = true; }mutex_unlock (&data->update_lock);drivers/hwmon/lm92.c +2
-2@@ -99,7 +99,7 @@ static const u8 regs[t_num_regs] = {struct lm92_data {struct i2c_client *client;struct mutex update_lock; -char valid;/* zero until following fields are valid */ +bool valid;/* false until following fields are valid */ unsigned long last_updated;/* in jiffies */ /* registers values */ @@ -126,7 +126,7 @@ static struct lm92_data *lm92_update_device(struct device *dev)i2c_smbus_read_word_swapped (client, regs[i]); } data->last_updated = jiffies; - data->valid =1 ; + data->valid = true; }mutex_unlock (&data->update_lock);drivers/hwmon/lm93.c +2
-2@@ -202,7 +202,7 @@ struct lm93_data {/* client update function */ void (*update)(struct lm93_data *,struct i2c_client *); -char valid;/* !=0 if following fields are valid */ +bool valid;/* true if following fields are valid */ /* register values, arranged by block read groups */ struct block1_t block1;@@ -917,7 +917,7 @@ static struct lm93_data *lm93_update_device(struct device *dev) data->update (data, client); data->last_updated = jiffies; - data->valid =1 ; + data->valid = true; }mutex_unlock (&data->update_lock);drivers/hwmon/lm95241.c +4
-4@@ -78,7 +78,7 @@ struct lm95241_data {struct mutex update_lock;unsigned long last_updated;/* in jiffies */ unsigned long interval;/* in milli-seconds */ -char valid;/* zero until following fields are valid */ +bool valid;/* false until following fields are valid */ /* registers values */ u8 temp[ARRAY_SIZE (lm95241_reg_address)];u8 status, config, model, trutherm;@@ -118,7 +118,7 @@ static struct lm95241_data *lm95241_update_device(struct device *dev) data->status =i2c_smbus_read_byte_data (client,LM95241_REG_R_STATUS ); data->last_updated = jiffies; - data->valid =1 ; + data->valid = true; }mutex_unlock (&data->update_lock);@@ -257,7 +257,7 @@ static int lm95241_write_temp(struct device *dev, u32 attr, int channel,else data->config &= ~R2DF_MASK ; } - data->valid =0 ; + data->valid = false; ret =i2c_smbus_write_byte_data (client,LM95241_REG_RW_CONFIG , data->config);break ;@@ -273,7 +273,7 @@ static int lm95241_write_temp(struct device *dev, u32 attr, int channel,else data->config &= ~R2DF_MASK ; } - data->valid =0 ; + data->valid = false; ret =i2c_smbus_write_byte_data (client,LM95241_REG_RW_CONFIG , data->config);break ;drivers/hwmon/ltc4151.c +1
-1@@ -77,7 +77,7 @@ static struct ltc4151_data *ltc4151_update_device(struct device *dev) data->regs[i] = val; } data->last_updated = jiffies; - data->valid =1 ; + data->valid = true; } abort:mutex_unlock (&data->update_lock);drivers/hwmon/ltc4215.c +1
-1@@ -64,7 +64,7 @@ static struct ltc4215_data *ltc4215_update_device(struct device *dev) } data->last_updated = jiffies; - data->valid =1 ; + data->valid = true; }mutex_unlock (&data->update_lock);drivers/hwmon/ltc4261.c +2
-2@@ -73,13 +73,13 @@ static struct ltc4261_data *ltc4261_update_device(struct device *dev)"Failed to read ADC value: error %d\n" , val); ret =ERR_PTR (val); - data->valid =0 ; + data->valid = false; goto abort; } data->regs[i] = val; } data->last_updated = jiffies; - data->valid =1 ; + data->valid = true; } abort:mutex_unlock (&data->update_lock);drivers/hwmon/max16065.c +1
-1@@ -166,7 +166,7 @@ static struct max16065_data *max16065_update_device(struct device *dev) = i2c_smbus_read_byte_data(client, MAX16065_FAULT(i)); data->last_updated = jiffies; - data->valid =1 ; + data->valid = true; }mutex_unlock (&data->update_lock);return data;drivers/hwmon/max1619.c +2
-2@@ -79,7 +79,7 @@ enum temp_index {struct max1619_data {struct i2c_client *client;struct mutex update_lock; -char valid;/* zero until following fields are valid */ +bool valid;/* false until following fields are valid */ unsigned long last_updated;/* in jiffies */ /* registers values */ @@ -124,7 +124,7 @@ static struct max1619_data *max1619_update_device(struct device *dev) data->alarms ^=0x02 ; data->last_updated = jiffies; - data->valid =1 ; + data->valid = true; }mutex_unlock (&data->update_lock);drivers/hwmon/max1668.c +2
-2@@ -58,7 +58,7 @@ struct max1668_data {enum chips type;struct mutex update_lock; -char valid;/* !=0 if following fields are valid */ +bool valid;/* true if following fields are valid */ unsigned long last_updated;/* In jiffies */ /* 1x local and 4x remote */ @@ -120,7 +120,7 @@ static struct max1668_data *max1668_update_device(struct device *dev) data->alarms |= val; data->last_updated = jiffies; - data->valid =1 ; + data->valid = true; abort:mutex_unlock (&data->update_lock);drivers/hwmon/max6639.c +2
-2@@ -69,7 +69,7 @@ static const int rpm_ranges[] = { 2000, 4000, 8000, 16000 };struct max6639_data {struct i2c_client *client;struct mutex update_lock; -char valid;/* !=0 if following fields are valid */ +bool valid;/* true if following fields are valid */ unsigned long last_updated;/* In jiffies */ /* Register values sampled regularly */ @@ -141,7 +141,7 @@ static struct max6639_data *max6639_update_device(struct device *dev) } data->last_updated = jiffies; - data->valid =1 ; + data->valid = true; } abort:mutex_unlock (&data->update_lock);drivers/hwmon/max6642.c +1
-1@@ -181,7 +181,7 @@ static struct max6642_data *max6642_update_device(struct device *dev) MAX6642_REG_R_STATUS); data->last_updated = jiffies; - data->valid =1 ; + data->valid = true; }mutex_unlock (&data->update_lock);drivers/hwmon/pc87360.c +2
-2@@ -178,7 +178,7 @@ struct pc87360_data {struct device *hwmon_dev;struct mutex lock;struct mutex update_lock; -char valid;/* !=0 if following fields are valid */ +bool valid;/* true if following fields are valid */ unsigned long last_updated;/* In jiffies */ int address[3 ];@@ -1673,7 +1673,7 @@ static struct pc87360_data *pc87360_update_device(struct device *dev) } data->last_updated = jiffies; - data->valid =1 ; + data->valid = true; }mutex_unlock (&data->update_lock);drivers/hwmon/sch5636.c +2
-2@@ -56,7 +56,7 @@ struct sch5636_data {struct device *hwmon_dev;struct mutex update_lock; -char valid;/* !=0 if following fields are valid */ +bool valid;/* true if following fields are valid */ unsigned long last_updated;/* In jiffies */ u8 in[SCH5636_NO_INS ];u8 temp_val[SCH5636_NO_TEMPS ];@@ -140,7 +140,7 @@ static struct sch5636_data *sch5636_update_device(struct device *dev) } data->last_updated = jiffies; - data->valid =1 ; + data->valid = true; abort:mutex_unlock (&data->update_lock);return ret;drivers/hwmon/sht21.c +2
-2@@ -41,7 +41,7 @@ struct sht21 {unsigned long last_update;int temperature;int humidity; -char valid; +bool valid;char eic[18 ]; };@@ -105,7 +105,7 @@ static int sht21_update_measurements(struct device *dev) goto out; sht21->humidity =sht21_rh_ticks_to_per_cent_mille (ret); sht21->last_update = jiffies; - sht21->valid =1 ; + sht21->valid = true; } out:mutex_unlock (&sht21->lock);drivers/hwmon/sis5595.c +2
-2@@ -172,7 +172,7 @@ struct sis5595_data {struct mutex lock;struct mutex update_lock; -char valid;/* !=0 if following fields are valid */ +bool valid;/* true if following fields are valid */ unsigned long last_updated;/* In jiffies */ char maxins;/* == 3 if temp enabled, otherwise == 4 */ u8 revision;/* Reg. value */ @@ -728,7 +728,7 @@ static struct sis5595_data *sis5595_update_device(struct device *dev)sis5595_read_value (data,SIS5595_REG_ALARM1 ) | (sis5595_read_value (data,SIS5595_REG_ALARM2 ) <<8 ); data->last_updated = jiffies; - data->valid =1 ; + data->valid = true; }mutex_unlock (&data->update_lock);drivers/hwmon/smm665.c +1
-1@@ -265,7 +265,7 @@ static struct smm665_data *smm665_update_device(struct device *dev) data->adc[i] = val; } data->last_updated = jiffies; - data->valid =1 ; + data->valid = true; } abort:mutex_unlock (&data->update_lock);drivers/hwmon/smsc47b397.c +2
-2@@ -96,7 +96,7 @@ struct smsc47b397_data {struct mutex update_lock;unsigned long last_updated;/* in jiffies */ -int valid; +bool valid;/* register values */ u16 fan[4 ];@@ -137,7 +137,7 @@ static struct smsc47b397_data *smsc47b397_update_device(struct device *dev) } data->last_updated = jiffies; - data->valid =1 ; + data->valid = true;dev_dbg (dev,"... device update complete\n" ); }drivers/hwmon/smsc47m192.c +2
-2@@ -86,7 +86,7 @@ struct smsc47m192_data {struct i2c_client *client;const struct attribute_group *groups[3 ];struct mutex update_lock; -char valid;/* !=0 if following fields are valid */ +bool valid;/* true if following fields are valid */ unsigned long last_updated;/* In jiffies */ u8 in[8 ];/* Register value */ @@ -157,7 +157,7 @@ static struct smsc47m192_data *smsc47m192_update_device(struct device *dev) SMSC47M192_REG_ALARM2) << 8); data->last_updated = jiffies; - data->valid =1 ; + data->valid = true; }mutex_unlock (&data->update_lock);drivers/hwmon/thmc50.c +2
-2@@ -62,7 +62,7 @@ struct thmc50_data {enum chips type;unsigned long last_updated;/* In jiffies */ char has_temp3;/* !=0 if it is ADM1022 in temp3 mode */ -char valid;/* !=0 if following fields are valid */ +bool valid;/* true if following fields are valid */ /* Register values */ s8 temp_input[3 ];@@ -107,7 +107,7 @@ static struct thmc50_data *thmc50_update_device(struct device *dev) data->alarms =i2c_smbus_read_byte_data (client,THMC50_REG_INTR ); data->last_updated = jiffies; - data->valid =1 ; + data->valid = true; }mutex_unlock (&data->update_lock);drivers/hwmon/tmp401.c +3
-3@@ -136,7 +136,7 @@ struct tmp401_data {struct i2c_client *client;const struct attribute_group *groups[3 ];struct mutex update_lock; -char valid;/* zero until following fields are valid */ +bool valid;/* false until following fields are valid */ unsigned long last_updated;/* in jiffies */ enum chips kind;@@ -267,7 +267,7 @@ static struct tmp401_data *tmp401_update_device(struct device *dev) data->temp_crit_hyst = val; data->last_updated = jiffies; - data->valid =1 ; + data->valid = true; } abort:@@ -413,7 +413,7 @@ static ssize_t reset_temp_history_store(struct device *dev, }mutex_lock (&data->update_lock);i2c_smbus_write_byte_data (client,TMP401_TEMP_MSB_WRITE [5 ][0 ], val); - data->valid =0 ; + data->valid = false;mutex_unlock (&data->update_lock);return count;drivers/hwmon/tmp421.c +3
-3@@ -93,7 +93,7 @@ struct tmp421_data {struct hwmon_channel_info temp_info;const struct hwmon_channel_info *info[2 ];struct hwmon_chip_info chip; -char valid; +bool valid;unsigned long last_updated;unsigned long channels;u8 config;@@ -140,14 +140,14 @@ static int tmp421_update_device(struct tmp421_data *data) data->temp[i] |= ret; } data->last_updated = jiffies; - data->valid =1 ; + data->valid = true; } exit:mutex_unlock (&data->update_lock);if (ret <0 ) { - data->valid =0 ; + data->valid = false;return ret; }drivers/hwmon/via686a.c +2
-2@@ -304,7 +304,7 @@ struct via686a_data {const char *name;struct device *hwmon_dev;struct mutex update_lock; -char valid;/* !=0 if following fields are valid */ +bool valid;/* true if following fields are valid */ unsigned long last_updated;/* In jiffies */ u8 in[5 ];/* Register value */ @@ -800,7 +800,7 @@ static struct via686a_data *via686a_update_device(struct device *dev) VIA686A_REG_ALARM1) | (via686a_read_value (data,VIA686A_REG_ALARM2 ) <<8 ); data->last_updated = jiffies; - data->valid =1 ; + data->valid = true; }mutex_unlock (&data->update_lock);drivers/hwmon/vt1211.c +2
-2@@ -105,7 +105,7 @@ struct vt1211_data {struct device *hwmon_dev;struct mutex update_lock; -char valid;/* !=0 if following fields are valid */ +bool valid;/* true if following fields are valid */ unsigned long last_updated;/* In jiffies */ /* Register values */ @@ -319,7 +319,7 @@ static struct vt1211_data *vt1211_update_device(struct device *dev)vt1211_read8 (data,VT1211_REG_ALARM1 ); data->last_updated = jiffies; - data->valid =1 ; + data->valid = true; }mutex_unlock (&data->update_lock);drivers/hwmon/vt8231.c +2
-2@@ -145,7 +145,7 @@ struct vt8231_data {struct mutex update_lock;struct device *hwmon_dev; -char valid;/* !=0 if following fields are valid */ +bool valid;/* true if following fields are valid */ unsigned long last_updated;/* In jiffies */ u8 in[6 ];/* Register value */ @@ -929,7 +929,7 @@ static struct vt8231_data *vt8231_update_device(struct device *dev) data->alarms &= ~0x80 ; data->last_updated = jiffies; - data->valid =1 ; + data->valid = true; }mutex_unlock (&data->update_lock);drivers/hwmon/w83627ehf.c +4
-4@@ -320,7 +320,7 @@ struct w83627ehf_data {const u16 *scale_in;struct mutex update_lock; -char valid;/* !=0 if following fields are valid */ +bool valid;/* true if following fields are valid */ unsigned long last_updated;/* In jiffies */ /* Register values */ @@ -688,7 +688,7 @@ static struct w83627ehf_data *w83627ehf_update_device(struct device *dev) W83627EHF_REG_CASEOPEN_DET); data->last_updated = jiffies; - data->valid =1 ; + data->valid = true; }mutex_unlock (&data->update_lock);@@ -1099,7 +1099,7 @@ clear_caseopen(struct device *dev, struct w83627ehf_data *data, int channel, reg =w83627ehf_read_value (data,W83627EHF_REG_CASEOPEN_CLR );w83627ehf_write_value (data,W83627EHF_REG_CASEOPEN_CLR , reg | mask);w83627ehf_write_value (data,W83627EHF_REG_CASEOPEN_CLR , reg & ~mask); - data->valid =0 ;/* Force cache refresh */ + data->valid = false;/* Force cache refresh */ mutex_unlock (&data->update_lock);return 0 ;@@ -2004,7 +2004,7 @@ static int __maybe_unused w83627ehf_resume(struct device *dev)w83627ehf_write_value (data,W83627EHF_REG_VBAT , data->vbat);/* Force re-reading all values */ - data->valid =0 ; + data->valid = false;mutex_unlock (&data->update_lock);return 0 ;drivers/hwmon/w83627hf.c +3
-3@@ -355,7 +355,7 @@ struct w83627hf_data {enum chips type;struct mutex update_lock; -char valid;/* !=0 if following fields are valid */ +bool valid;/* true if following fields are valid */ unsigned long last_updated;/* In jiffies */ u8 in[9 ];/* Register value */ @@ -448,7 +448,7 @@ static int w83627hf_resume(struct device *dev)w83627hf_write_value (data,W83781D_REG_SCFG2 , data->scfg2);/* Force re-reading all values */ - data->valid =0 ; + data->valid = false;mutex_unlock (&data->update_lock);return 0 ;@@ -1905,7 +1905,7 @@ static struct w83627hf_data *w83627hf_update_device(struct device *dev)w83627hf_read_value (data,W83781D_REG_BEEP_INTS1 ) |w83627hf_read_value (data,W83781D_REG_BEEP_INTS3 ) <<16 ; data->last_updated = jiffies; - data->valid =1 ; + data->valid = true; }mutex_unlock (&data->update_lock);drivers/hwmon/w83781d.c +2
-2@@ -203,7 +203,7 @@ struct w83781d_data {int isa_addr;struct mutex update_lock; -char valid;/* !=0 if following fields are valid */ +bool valid;/* true if following fields are valid */ unsigned long last_updated;/* In jiffies */ struct i2c_client *lm75[2 ];/* for secondary I2C addresses */ @@ -1554,7 +1554,7 @@ static struct w83781d_data *w83781d_update_device(struct device *dev) W83781D_REG_BEEP_INTS3) << 16; } data->last_updated = jiffies; - data->valid =1 ; + data->valid = true; }mutex_unlock (&data->update_lock);drivers/hwmon/w83791d.c +2
-2@@ -270,7 +270,7 @@ struct w83791d_data {struct device *hwmon_dev;struct mutex update_lock; -char valid;/* !=0 if following fields are valid */ +bool valid;/* true if following fields are valid */ unsigned long last_updated;/* In jiffies */ /* array of 2 pointers to subclients */ @@ -1603,7 +1603,7 @@ static struct w83791d_data *w83791d_update_device(struct device *dev) << 4; data->last_updated = jiffies; - data->valid =1 ; + data->valid = true; }mutex_unlock (&data->update_lock);drivers/hwmon/w83792d.c +3
-3@@ -261,7 +261,7 @@ struct w83792d_data {struct device *hwmon_dev;struct mutex update_lock; -char valid;/* !=0 if following fields are valid */ +bool valid;/* true if following fields are valid */ unsigned long last_updated;/* In jiffies */ /* array of 2 pointers to subclients */ @@ -743,7 +743,7 @@ intrusion0_alarm_store(struct device *dev, struct device_attribute *attr,mutex_lock (&data->update_lock); reg =w83792d_read_value (client,W83792D_REG_CHASSIS_CLR );w83792d_write_value (client,W83792D_REG_CHASSIS_CLR , reg |0x80 ); - data->valid =0 ;/* Force cache refresh */ + data->valid = false;/* Force cache refresh */ mutex_unlock (&data->update_lock);return count;@@ -1595,7 +1595,7 @@ static struct w83792d_data *w83792d_update_device(struct device *dev) } data->last_updated = jiffies; - data->valid =1 ; + data->valid = true; }mutex_unlock (&data->update_lock);drivers/hwmon/w83793.c +3
-3@@ -205,7 +205,7 @@ struct w83793_data {struct i2c_client *lm75[2 ];struct device *hwmon_dev;struct mutex update_lock; -char valid;/* !=0 if following fields are valid */ +bool valid;/* true if following fields are valid */ unsigned long last_updated;/* In jiffies */ unsigned long last_nonvolatile;/* In jiffies, last time we update the * nonvolatile registers @@ -453,7 +453,7 @@ store_chassis_clear(struct device *dev,mutex_lock (&data->update_lock); reg =w83793_read_value (client,W83793_REG_CLR_CHASSIS );w83793_write_value (client,W83793_REG_CLR_CHASSIS , reg |0x80 ); - data->valid =0 ;/* Force cache refresh */ + data->valid = false;/* Force cache refresh */ mutex_unlock (&data->update_lock);return count; }@@ -2081,7 +2081,7 @@ static struct w83793_data *w83793_update_device(struct device *dev) data->vid[1 ] =w83793_read_value (client,W83793_REG_VID_INB );w83793_update_nonvolatile (dev); data->last_updated = jiffies; - data->valid =1 ; + data->valid = true; END:mutex_unlock (&data->update_lock);drivers/hwmon/w83795.c +3
-3@@ -379,7 +379,7 @@ struct w83795_data {u8 enable_beep;u8 beeps[6 ];/* Register value */ -char valid; +bool valid;char valid_limits;char valid_pwm_config; };@@ -684,7 +684,7 @@ static struct w83795_data *w83795_update_device(struct device *dev) tmp & ~ALARM_CTRL_RTSACS); data->last_updated = jiffies; - data->valid =1 ; + data->valid = true; END:mutex_unlock (&data->update_lock);@@ -764,7 +764,7 @@ store_chassis_clear(struct device *dev,/* Clear status and force cache refresh */ w83795_read (client,W83795_REG_ALARM (5 )); - data->valid =0 ; + data->valid = false;mutex_unlock (&data->update_lock);return count; }drivers/hwmon/w83l785ts.c +2
-2@@ -98,7 +98,7 @@ static struct i2c_driver w83l785ts_driver = {struct w83l785ts_data {struct device *hwmon_dev;struct mutex update_lock; -char valid;/* zero until following fields are valid */ +bool valid;/* false until following fields are valid */ unsigned long last_updated;/* in jiffies */ /* registers values */ @@ -270,7 +270,7 @@ static struct w83l785ts_data *w83l785ts_update_device(struct device *dev) W83L785TS_REG_TEMP_OVER, data->temp[1]); data->last_updated = jiffies; - data->valid =1 ; + data->valid = true; }mutex_unlock (&data->update_lock);drivers/hwmon/w83l786ng.c +2
-2@@ -113,7 +113,7 @@ DIV_TO_REG(long val)struct w83l786ng_data {struct i2c_client *client;struct mutex update_lock; -char valid;/* !=0 if following fields are valid */ +bool valid;/* true if following fields are valid */ unsigned long last_updated;/* In jiffies */ unsigned long last_nonvolatile;/* In jiffies, last time we update the * nonvolatile registers */ @@ -209,7 +209,7 @@ static struct w83l786ng_data *w83l786ng_update_device(struct device *dev) data->tolerance[1 ] = (reg_tmp >>4 ) &0x0f ; data->last_updated = jiffies; - data->valid =1 ; + data->valid = true; }