[PATCH] misc: ad525x_dpot: fix macro parentheses and permissions

Haoyu Lu posted 1 patch 1 week ago
drivers/misc/ad525x_dpot.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
[PATCH] misc: ad525x_dpot: fix macro parentheses and permissions
Posted by Haoyu Lu 1 week ago
From: "haoyu.lu" <hechushiguitu666@gmail.com>

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

Signed-off-by: haoyu.lu <hechushiguitu666@gmail.com>
---
 drivers/misc/ad525x_dpot.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/misc/ad525x_dpot.c b/drivers/misc/ad525x_dpot.c
index 57bead9fba1b..ee258cd325f6 100644
--- a/drivers/misc/ad525x_dpot.c
+++ b/drivers/misc/ad525x_dpot.c
@@ -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
Re: [PATCH] misc: ad525x_dpot: fix macro parentheses and permissions
Posted by Greg Kroah-Hartman 1 week ago
On Thu, Mar 26, 2026 at 04:55:10PM +0800, Haoyu Lu wrote:
> From: "haoyu.lu" <hechushiguitu666@gmail.com>
> 
> Fix checkpatch.pl warnings:
> - Macros with complex values should be enclosed in parentheses
> - Symbolic permissions 'S_IWUSR | S_IRUGO' are not preferred
> 
> Signed-off-by: haoyu.lu <hechushiguitu666@gmail.com>

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