Skip to contentSkip to conversation

Replace numeric parameter like 0444 with macro

PATCH NAK Baole Ni 1 participant 1 message Aug 2, 2016

Subsystems (2)
lore
Share & tools
lore

Baole Ni

author
#0 lore raw

PATCH 845/1285 Replace numeric parameter like 0444 with macro

I find that the developers often just specified the numeric value
when calling a macro which is defined with a parameter for access permission. As we know, these numeric value for access permission have had the corresponding macro, and that using macro can improve the robustness and readability of the code, thus, I suggest replacing the numeric parameter with the macro.

---
 drivers/platform/x86/asus-wmi.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/platform/x86/asus-wmi.c +5 -5
index a26dca3..cc2ed81 100644
@@ -1727,11 +1727,11 @@ static ssize_t show_sys_wmi(struct asus_wmi *asus, int devid, char *buf)
 		.store  = store_##_name,				\
 	}
 
-ASUS_WMI_CREATE_DEVICE_ATTR(touchpad, 0644, ASUS_WMI_DEVID_TOUCHPAD);
-ASUS_WMI_CREATE_DEVICE_ATTR(camera, 0644, ASUS_WMI_DEVID_CAMERA);
-ASUS_WMI_CREATE_DEVICE_ATTR(cardr, 0644, ASUS_WMI_DEVID_CARDREADER);
-ASUS_WMI_CREATE_DEVICE_ATTR(lid_resume, 0644, ASUS_WMI_DEVID_LID_RESUME);
-ASUS_WMI_CREATE_DEVICE_ATTR(als_enable, 0644, ASUS_WMI_DEVID_ALS_ENABLE);
+ASUS_WMI_CREATE_DEVICE_ATTR(touchpad, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH, ASUS_WMI_DEVID_TOUCHPAD);
+ASUS_WMI_CREATE_DEVICE_ATTR(camera, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH, ASUS_WMI_DEVID_CAMERA);
+ASUS_WMI_CREATE_DEVICE_ATTR(cardr, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH, ASUS_WMI_DEVID_CARDREADER);
+ASUS_WMI_CREATE_DEVICE_ATTR(lid_resume, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH, ASUS_WMI_DEVID_LID_RESUME);
+ASUS_WMI_CREATE_DEVICE_ATTR(als_enable, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH, ASUS_WMI_DEVID_ALS_ENABLE);
 
 static ssize_t store_cpufv(struct device *dev, struct device_attribute *attr,
 			   const char *buf, size_t count)
Signature · 1 line
2.9.2