Skip to contentSkip to conversation

hwmon: Fix 'Macros with complex values' checkpatch errors

PATCH In review Guenter Roeck 2 participants 3 messages Mar 14, 2013

Subsystems (3)
lore
Share & tools
lore

Guenter Roeck

author maintainer
#0 lore raw

PATCH 2/9 hwmon: Fix 'Macros with complex values' checkpatch errors

Fix:

ERROR: Macros with complex values should be enclosed in parenthesis

when it is seen due to complex code and not due to multi-line variable declarations.

Cc Hans de Goede <[email protected]>
Cc Alistair John Strachan <[email protected]>
---
 drivers/hwmon/abituguru.c  |   11 +++++++----
 drivers/hwmon/abituguru3.c |   10 ++++++----
 drivers/hwmon/gpio-fan.c   |    2 +-
 drivers/hwmon/s3c-hwmon.c  |   19 ++++++++-----------
 4 files changed, 22 insertions(+), 20 deletions(-)
drivers/hwmon/abituguru.c +7 -4
index b84f180..df0b699 100644
@@ -96,9 +96,12 @@
 #define ABIT_UGURU_MAX_TIMEOUTS			2
 /* utility macros */
 #define ABIT_UGURU_NAME				"abituguru"
-#define ABIT_UGURU_DEBUG(level, format, arg...)				\
-	if (level <= verbose)						\
-		pr_debug(format , ## arg)
+#define ABIT_UGURU_DEBUG(level, format, arg...)		\
+	do {						\
+		if (level <= verbose)			\
+			pr_debug(format , ## arg);	\
+	} while (0)
+
 /* Macros to help calculate the sysfs_names array length */
 /*
  * sum of strlen of: in??_input\0, in??_{min,max}\0, in??_{min,max}_alarm\0,
@@ -1533,7 +1536,7 @@ static int abituguru_resume(struct device *dev)
 }
 
 static SIMPLE_DEV_PM_OPS(abituguru_pm, abituguru_suspend, abituguru_resume);
-#define ABIT_UGURU_PM	&abituguru_pm
+#define ABIT_UGURU_PM	(&abituguru_pm)
 #else
 #define ABIT_UGURU_PM	NULL
 #endif /* CONFIG_PM */
drivers/hwmon/abituguru3.c +6 -4
index dcce352..1d2da31 100644
@@ -76,9 +76,11 @@
 #define ABIT_UGURU3_SYNCHRONIZE_TIMEOUT		5
 /* utility macros */
 #define ABIT_UGURU3_NAME			"abituguru3"
-#define ABIT_UGURU3_DEBUG(format, arg...)	\
-	if (verbose)				\
-		pr_debug(format , ## arg)
+#define ABIT_UGURU3_DEBUG(format, arg...)		\
+	do {						\
+		if (verbose)				\
+			pr_debug(format , ## arg);	\
+	} while (0)
 
 /* Macros to help calculate the sysfs_names array length */
 #define ABIT_UGURU3_MAX_NO_SENSORS 26
@@ -1159,7 +1161,7 @@ static int abituguru3_resume(struct device *dev)
 }
 
 static SIMPLE_DEV_PM_OPS(abituguru3_pm, abituguru3_suspend, abituguru3_resume);
-#define ABIT_UGURU3_PM	&abituguru3_pm
+#define ABIT_UGURU3_PM	(&abituguru3_pm)
 #else
 #define ABIT_UGURU3_PM	NULL
 #endif /* CONFIG_PM */
drivers/hwmon/gpio-fan.c +1 -1
index 3978194..4e02480 100644
@@ -619,7 +619,7 @@ static int gpio_fan_resume(struct device *dev)
 }
 
 static SIMPLE_DEV_PM_OPS(gpio_fan_pm, gpio_fan_suspend, gpio_fan_resume);
-#define GPIO_FAN_PM	&gpio_fan_pm
+#define GPIO_FAN_PM	(&gpio_fan_pm)
 #else
 #define GPIO_FAN_PM	NULL
 #endif
drivers/hwmon/s3c-hwmon.c +8 -11
index ff2ae02..a9f7e80 100644
@@ -107,17 +107,14 @@ static ssize_t s3c_hwmon_show_raw(struct device *dev,
 	return  (ret < 0) ? ret : snprintf(buf, PAGE_SIZE, "%d\n", ret);
 }
 
-#define DEF_ADC_ATTR(x)	\
-	static SENSOR_DEVICE_ATTR(adc##x##_raw, S_IRUGO, s3c_hwmon_show_raw, NULL, x)
-
-DEF_ADC_ATTR(0);
-DEF_ADC_ATTR(1);
-DEF_ADC_ATTR(2);
-DEF_ADC_ATTR(3);
-DEF_ADC_ATTR(4);
-DEF_ADC_ATTR(5);
-DEF_ADC_ATTR(6);
-DEF_ADC_ATTR(7);
+static SENSOR_DEVICE_ATTR(adc0_raw, S_IRUGO, s3c_hwmon_show_raw, NULL, 0);
+static SENSOR_DEVICE_ATTR(adc1_raw, S_IRUGO, s3c_hwmon_show_raw, NULL, 1);
+static SENSOR_DEVICE_ATTR(adc2_raw, S_IRUGO, s3c_hwmon_show_raw, NULL, 2);
+static SENSOR_DEVICE_ATTR(adc3_raw, S_IRUGO, s3c_hwmon_show_raw, NULL, 3);
+static SENSOR_DEVICE_ATTR(adc4_raw, S_IRUGO, s3c_hwmon_show_raw, NULL, 4);
+static SENSOR_DEVICE_ATTR(adc5_raw, S_IRUGO, s3c_hwmon_show_raw, NULL, 5);
+static SENSOR_DEVICE_ATTR(adc6_raw, S_IRUGO, s3c_hwmon_show_raw, NULL, 6);
+static SENSOR_DEVICE_ATTR(adc7_raw, S_IRUGO, s3c_hwmon_show_raw, NULL, 7);
 
 static struct attribute *s3c_hwmon_attrs[9] = {
 	&sensor_dev_attr_adc0_raw.dev_attr.attr,
Signature · 7 lines
1.7.9.7


_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
maintainer Acked-by on v1 2/9
#1 lore raw
Quoted 11 lines · Guenter Roeck

Fix:

ERROR: Macros with complex values should be enclosed in parenthesis

when it is seen due to complex code and not due to multi-line variable declarations.

Cc Hans de Goede <[email protected]>
Cc Alistair John Strachan <[email protected]>

LGTM.

Signature · 2 lines
Cheers,
Alistair.

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

author maintainer
#2 lore raw
In reply to Guenter Roeck
Quoted 9 lines · Alistair Strachan
Quoted 7 lines · Guenter Roeck

Fix:

ERROR: Macros with complex values should be enclosed in parenthesis

when it is seen due to complex code and not due to multi-line variable declarations.

Quoted 9 lines
Quoted 4 lines
Cc Hans de Goede <[email protected]>
Cc Alistair John Strachan <[email protected]>

LGTM.

Thanks!

Guenter

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors