Thread (9 messages) 9 messages, 6 authors, 2017-12-21

Re: [-next PATCH 4/4] treewide: Use DEVICE_ATTR_WO

flat view

From: Joe Perches <joe@perches.com>
Date: 2017-12-19 18:51:26
Also in: linux-input, linux-pm, linux-scsi, lkml, netdev

On Tue, 2017-12-19 at 19:44 +0100, Borislav Petkov wrote:
On Tue, Dec 19, 2017 at 10:15:09AM -0800, Joe Perches wrote:
quoted
Convert DEVICE_ATTR uses to DEVICE_ATTR_WO where possible.

Done with perl script:

$ git grep -w --name-only DEVICE_ATTR | \
  xargs perl -i -e 'local $/; while (<>) { s/\bDEVICE_ATTR\s*\(\s*(\w+)\s*,\s*\(?(?:\s*S_IWUSR\s*|\s*0200\s*)\)?\s*,\s*NULL\s*,\s*\s_store\s*\)/DEVICE_ATTR_WO(\1)/g; print;}'
[]
quoted
diff --git a/arch/x86/kernel/cpu/microcode/core.c b/arch/x86/kernel/cpu/microcode/core.c
[]
quoted
@@ -560,7 +560,7 @@ static ssize_t pf_show(struct device *dev,
 	return sprintf(buf, "0x%x\n", uci->cpu_sig.pf);
 }
 
-static DEVICE_ATTR(reload, 0200, NULL, reload_store);
+static DEVICE_ATTR_WO(reload);
 static DEVICE_ATTR(version, 0400, version_show, NULL);
 static DEVICE_ATTR(processor_flags, 0400, pf_show, NULL);
 
# cat /sys/devices/system/cpu/microcode/reload
cat: /sys/devices/system/cpu/microcode/reload: Permission denied
Not different behavior.  It was and remains write only.
The reason for the code churn being?
Consistency for easier grep by use-type.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help