Skip to contentSkip to conversation

misc: ad525x_dpot: fix macro parentheses and permissions

PATCH In review Haoyu Lu 2 participants 2 messages Mar 26

Subsystems (2)
lore
Share & tools
lore

Haoyu Lu

author
#0 lore raw

PATCH 1/1 misc: ad525x_dpot: fix macro parentheses and permissions

From: "haoyu.lu" <[email protected]>

Fix checkpatch.pl warnings:
- Macros with complex values should be enclosed in parentheses
- Symbolic permissions 'S_IWUSR | S_IRUGO' are not preferred

---
 drivers/misc/ad525x_dpot.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/misc/ad525x_dpot.c +7 -5
index 57bead9fba1b..ee258cd325f6 100644
@@ -511,14 +511,16 @@ set_##_name(struct device *dev, \
 	return sysfs_set_reg(dev, attr, buf, count, _reg); \
 }
 
-#define DPOT_DEVICE_SHOW_SET(name, reg) \
+#define DPOT_DEVICE_SHOW_SET(name, reg) ( \
 DPOT_DEVICE_SHOW(name, reg) \
 DPOT_DEVICE_SET(name, reg) \
-static DEVICE_ATTR(name, S_IWUSR | S_IRUGO, show_##name, set_##name)
+static DEVICE_ATTR(name, 0644, show_##name, set_##name) \
+)
 
-#define DPOT_DEVICE_SHOW_ONLY(name, reg) \
+#define DPOT_DEVICE_SHOW_ONLY(name, reg) ( \
 DPOT_DEVICE_SHOW(name, reg) \
-static DEVICE_ATTR(name, S_IWUSR | S_IRUGO, show_##name, NULL)
+static DEVICE_ATTR(name, 0644, show_##name, NULL) \
+)
 
 DPOT_DEVICE_SHOW_SET(rdac0, DPOT_ADDR_RDAC | DPOT_RDAC0);
 DPOT_DEVICE_SHOW_SET(eeprom0, DPOT_ADDR_EEPROM | DPOT_RDAC0);
@@ -615,7 +617,7 @@ set_##_name(struct device *dev, \
 { \
 	return sysfs_do_cmd(dev, attr, buf, count, _cmd); \
 } \
-static DEVICE_ATTR(_name, S_IWUSR | S_IRUGO, NULL, set_##_name)
+static DEVICE_ATTR(_name, 0644, NULL, set_##_name)
 
 DPOT_DEVICE_DO_CMD(inc_all, DPOT_INC_ALL);
 DPOT_DEVICE_DO_CMD(dec_all, DPOT_DEC_ALL);

--
2.53.0.windows.1

#1 lore raw
Quoted 7 lines · Haoyu Lu

From: "haoyu.lu" <[email protected]>

Fix checkpatch.pl warnings:
- Macros with complex values should be enclosed in parentheses
- Symbolic permissions 'S_IWUSR | S_IRUGO' are not preferred

Please do not do checkpatch cleanups in other areas of the kernel when you do not have the experience of doing them first in drivers/staging/ as due to a number of problems in this patch, it obviously can not be applied :(

thanks,

greg k-h