diff options
author | Paul Fertser <fercerpav@gmail.com> | 2021-09-24 22:52:02 +0300 |
---|---|---|
committer | Guenter Roeck <linux@roeck-us.net> | 2021-10-12 07:22:41 -0700 |
commit | 952a11ca32a6046ab86bf885a7805c935f71d5c8 (patch) | |
tree | 1bb2b287dc4ec029e6a5587bfe62bd3d6e413d7e | |
parent | b87783e855599efb93c8ce3d597bdcba8223f3b0 (diff) | |
download | linux-952a11ca32a6046ab86bf885a7805c935f71d5c8.tar.gz linux-952a11ca32a6046ab86bf885a7805c935f71d5c8.tar.bz2 linux-952a11ca32a6046ab86bf885a7805c935f71d5c8.zip |
hwmon: cleanup non-bool "valid" data fields
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 {
...
- 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 <fercerpav@gmail.com>
Link: https://lore.kernel.org/r/20210924195202.27917-1-fercerpav@gmail.com
[groeck: Fixed up 'u8 valid' to 'boool valid' in atxp1.c]
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
69 files changed, 152 insertions, 152 deletions
diff --git a/drivers/hwmon/abituguru3.c b/drivers/hwmon/abituguru3.c index 112dd0d9377c..8229ad30c909 100644 --- a/drivers/hwmon/abituguru3.c +++ b/drivers/hwmon/abituguru3.c @@ -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); diff --git a/drivers/hwmon/ad7414.c b/drivers/hwmon/ad7414.c index 6a765755d061..0afb89c4629d 100644 --- a/drivers/hwmon/ad7414.c +++ b/drivers/hwmon/ad7414.c @@ -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); diff --git a/drivers/hwmon/ad7418.c b/drivers/hwmon/ad7418.c index d618f6b2f382..22bdb7e5b9e0 100644 --- a/drivers/hwmon/ad7418.c +++ b/drivers/hwmon/ad7418.c @@ -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; } diff --git a/drivers/hwmon/adm1021.c b/drivers/hwmon/adm1021.c index 71deb2cd20f5..38b447c6e8cd 100644 --- a/drivers/hwmon/adm1021.c +++ b/drivers/hwmon/adm1021.c @@ -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); diff --git a/drivers/hwmon/adm1025.c b/drivers/hwmon/adm1025.c index de51e01c061b..4352f6a884e8 100644 --- a/drivers/hwmon/adm1025.c +++ b/drivers/hwmon/adm1025.c @@ -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); diff --git a/drivers/hwmon/adm1026.c b/drivers/hwmon/adm1026.c index 49cefbadb156..69b3ec752944 100644 --- a/drivers/hwmon/adm1026.c +++ b/drivers/hwmon/adm1026.c @@ -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; } diff --git a/drivers/hwmon/adm1029.c b/drivers/hwmon/adm1029.c index 50b1df7b008c..3e1999413f32 100644 --- a/drivers/hwmon/adm1029.c +++ b/drivers/hwmon/adm1029.c @@ -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); diff --git a/drivers/hwmon/adm1031.c b/drivers/hwmon/adm1031.c index b538ace2d292..257ec53ae723 100644 --- a/drivers/hwmon/adm1031.c +++ b/drivers/hwmon/adm1031.c @@ -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; } diff --git a/drivers/hwmon/amc6821.c b/drivers/hwmon/amc6821.c index 6b1ce2242c61..0c16face3fd3 100644 --- a/drivers/hwmon/amc6821.c +++ b/drivers/hwmon/amc6821.c @@ -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; } diff --git a/drivers/hwmon/applesmc.c b/drivers/hwmon/applesmc.c index c31759794a29..fc6d6a9053ce 100644 --- a/drivers/hwmon/applesmc.c +++ b/drivers/hwmon/applesmc.c @@ -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); diff --git a/drivers/hwmon/asb100.c b/drivers/hwmon/asb100.c index ba9fcf6f9264..8cf0bcb85eb4 100644 --- a/drivers/hwmon/asb100.c +++ b/drivers/hwmon/asb100.c @@ -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"); } diff --git a/drivers/hwmon/asc7621.c b/drivers/hwmon/asc7621.c index 600ffc7e1900..e835605a7456 100644 --- a/drivers/hwmon/asc7621.c +++ b/drivers/hwmon/asc7621.c @@ -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); diff --git a/drivers/hwmon/atxp1.c b/drivers/hwmon/atxp1.c index 1e08a5431f12..4fd8de8022bc 100644 --- a/drivers/hwmon/atxp1.c +++ b/drivers/hwmon/atxp1.c @@ -37,7 +37,7 @@ struct atxp1_data { struct i2c_client *client; struct mutex update_lock; unsigned long last_updated; - u8 valid; + bool valid; struct { u8 vid; /* VID output register */ u8 cpu_vid; /* VID input from CPU */ @@ -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; diff --git a/drivers/hwmon/coretemp.c b/drivers/hwmon/coretemp.c index bb9211215a68..ccf0af5b988a 100644 --- a/drivers/hwmon/coretemp.c +++ b/drivers/hwmon/coretemp.c @@ -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; } diff --git a/drivers/hwmon/dme1737.c b/drivers/hwmon/dme1737.c index c1e4cfb40c3d..e3ad4c2d0038 100644 --- a/drivers/hwmon/dme1737.c +++ b/drivers/hwmon/dme1737.c @@ -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); diff --git a/drivers/hwmon/ds1621.c b/drivers/hwmon/ds1621.c index bf1c4b7ecb40..0886abf6ebab 100644 --- a/drivers/hwmon/ds1621.c +++ b/drivers/hwmon/ds1621.c @@ -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); diff --git a/drivers/hwmon/ds620.c b/drivers/hwmon/ds620.c index 9ec722798c4a..82d7c3d58f49 100644 --- a/drivers/hwmon/ds620.c +++ b/drivers/hwmon/ds620.c @@ -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); diff --git a/drivers/hwmon/emc6w201.c b/drivers/hwmon/emc6w201.c index ec5c98702bf5..29082c8463f4 100644 --- a/drivers/hwmon/emc6w201.c +++ b/drivers/hwmon/emc6w201.c @@ -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); diff --git a/drivers/hwmon/f71805f.c b/drivers/hwmon/f71805f.c index 67b47de8263a..7f20edb0677c 100644 --- a/drivers/hwmon/f71805f.c +++ b/drivers/hwmon/f71805f.c @@ -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); diff --git a/drivers/hwmon/f71882fg.c b/drivers/hwmon/f71882fg.c index 4dec793fd07d..4673d403759a 100644 --- a/drivers/hwmon/f71882fg.c +++ b/drivers/hwmon/f71882fg.c @@ -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; |