Commit 952a11ca authored by Paul Fertser's avatar Paul Fertser Committed by Guenter Roeck
Browse files

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: default avatarPaul 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: default avatarGuenter Roeck <linux@roeck-us.net>
parent b87783e8
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -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);
+2 −2
Original line number Diff line number Diff line
@@ -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);
+3 −3
Original line number Diff line number Diff line
@@ -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;
}
+2 −2
Original line number Diff line number Diff line
@@ -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);
+2 −2
Original line number Diff line number Diff line
@@ -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);
Loading