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

From: Haoyu Lu

Date: Thu Mar 26 2026 - 05:15:24 EST


From: "haoyu.lu" <hechushiguitu666@xxxxxxxxx>

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@xxxxxxxxx>
---
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