mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] x86/microcode: Use DEVICE_ATTR_RO macro
@ 2023-01-18  2:35 Guangju Wang
  2023-01-18 11:38 ` [tip: x86/microcode] x86/microcode: Use the DEVICE_ATTR_RO() macro tip-bot2 for Guangju Wang[baidu]
  0 siblings, 1 reply; 2+ messages in thread
From: Guangju Wang @ 2023-01-18  2:35 UTC (permalink / raw)
  To: Borislav Petkov, Thomas Gleixner, Ingo Molnar, Dave Hansen; +Cc: X86 ML, LKML

From: "Guangju Wang[baidu]" <wgj900@163.com>

Use DEVICE_ATTR_RO() helper instead of plain DEVICE_ATTR(),
which makes the code a bit shorter and easier to read.

Signed-off-by: Guangju Wang[baidu] <wgj900@163.com>
---
 arch/x86/kernel/cpu/microcode/core.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/x86/kernel/cpu/microcode/core.c b/arch/x86/kernel/cpu/microcode/core.c
index 712aafff96e0..99abb318aa7f 100644
--- a/arch/x86/kernel/cpu/microcode/core.c
+++ b/arch/x86/kernel/cpu/microcode/core.c
@@ -507,7 +507,7 @@ static ssize_t version_show(struct device *dev,
 	return sprintf(buf, "0x%x\n", uci->cpu_sig.rev);
 }
 
-static ssize_t pf_show(struct device *dev,
+static ssize_t processor_flags_show(struct device *dev,
 			struct device_attribute *attr, char *buf)
 {
 	struct ucode_cpu_info *uci = ucode_cpu_info + dev->id;
@@ -515,8 +515,8 @@ static ssize_t pf_show(struct device *dev,
 	return sprintf(buf, "0x%x\n", uci->cpu_sig.pf);
 }
 
-static DEVICE_ATTR(version, 0444, version_show, NULL);
-static DEVICE_ATTR(processor_flags, 0444, pf_show, NULL);
+static DEVICE_ATTR_RO(version);
+static DEVICE_ATTR_RO(processor_flags);
 
 static struct attribute *mc_default_attrs[] = {
 	&dev_attr_version.attr,
-- 
2.25.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [tip: x86/microcode] x86/microcode: Use the DEVICE_ATTR_RO() macro
  2023-01-18  2:35 [PATCH] x86/microcode: Use DEVICE_ATTR_RO macro Guangju Wang
@ 2023-01-18 11:38 ` tip-bot2 for Guangju Wang[baidu]
  0 siblings, 0 replies; 2+ messages in thread
From: tip-bot2 for Guangju Wang[baidu] @ 2023-01-18 11:38 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: Guangju Wang[baidu], Ingo Molnar, Borislav Petkov (AMD),
	x86, linux-kernel

The following commit has been merged into the x86/microcode branch of tip:

Commit-ID:     59047d942bedc4ce88a2121a9f9e656b9532dd30
Gitweb:        https://git.kernel.org/tip/59047d942bedc4ce88a2121a9f9e656b9532dd30
Author:        Guangju Wang[baidu] <wgj900@163.com>
AuthorDate:    Wed, 18 Jan 2023 10:35:54 +08:00
Committer:     Ingo Molnar <mingo@kernel.org>
CommitterDate: Wed, 18 Jan 2023 12:02:20 +01:00

x86/microcode: Use the DEVICE_ATTR_RO() macro

Use DEVICE_ATTR_RO() helper instead of open-coded DEVICE_ATTR(),
which makes the code a bit shorter and easier to read.

No change in functionality.

Signed-off-by: Guangju Wang[baidu] <wgj900@163.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Acked-by: Borislav Petkov (AMD) <bp@alien8.de>
Link: https://lore.kernel.org/r/20230118023554.1898-1-wgj900@163.com
---
 arch/x86/kernel/cpu/microcode/core.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/x86/kernel/cpu/microcode/core.c b/arch/x86/kernel/cpu/microcode/core.c
index 712aaff..99abb31 100644
--- a/arch/x86/kernel/cpu/microcode/core.c
+++ b/arch/x86/kernel/cpu/microcode/core.c
@@ -507,7 +507,7 @@ static ssize_t version_show(struct device *dev,
 	return sprintf(buf, "0x%x\n", uci->cpu_sig.rev);
 }
 
-static ssize_t pf_show(struct device *dev,
+static ssize_t processor_flags_show(struct device *dev,
 			struct device_attribute *attr, char *buf)
 {
 	struct ucode_cpu_info *uci = ucode_cpu_info + dev->id;
@@ -515,8 +515,8 @@ static ssize_t pf_show(struct device *dev,
 	return sprintf(buf, "0x%x\n", uci->cpu_sig.pf);
 }
 
-static DEVICE_ATTR(version, 0444, version_show, NULL);
-static DEVICE_ATTR(processor_flags, 0444, pf_show, NULL);
+static DEVICE_ATTR_RO(version);
+static DEVICE_ATTR_RO(processor_flags);
 
 static struct attribute *mc_default_attrs[] = {
 	&dev_attr_version.attr,

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-01-18 12:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-18  2:35 [PATCH] x86/microcode: Use DEVICE_ATTR_RO macro Guangju Wang
2023-01-18 11:38 ` [tip: x86/microcode] x86/microcode: Use the DEVICE_ATTR_RO() macro tip-bot2 for Guangju Wang[baidu]

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®