Skip to content

Commit 671d4ea

Browse files
committed
fixup! arch/arm64: Add Revision, Serial, Model to cpuinfo
1 parent d4908b8 commit 671d4ea

File tree

1 file changed

+22
-19
lines changed

1 file changed

+22
-19
lines changed

arch/arm64/kernel/cpuinfo.c

Lines changed: 22 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -219,10 +219,6 @@ static int c_show(struct seq_file *m, void *v)
219219
bool compat = personality(current->personality) == PER_LINUX32;
220220
struct cpuinfo_arm64 *cpuinfo = v;
221221
u32 midr = cpuinfo->reg_midr;
222-
struct device_node *np;
223-
const char *model;
224-
const char *serial;
225-
u32 revision;
226222

227223
/*
228224
* glibc reads /proc/cpuinfo to determine the number of
@@ -278,22 +274,29 @@ static int c_show(struct seq_file *m, void *v)
278274
seq_printf(m, "CPU part\t: 0x%03x\n", MIDR_PARTNUM(midr));
279275
seq_printf(m, "CPU revision\t: %d\n\n", MIDR_REVISION(midr));
280276

281-
np = of_find_node_by_path("/system");
282-
if (np) {
283-
if (!of_property_read_u32(np, "linux,revision", &revision))
284-
seq_printf(m, "Revision\t: %04x\n", revision);
285-
of_node_put(np);
286-
}
277+
if (cpumask_next(cpu, cpu_online_mask )>= nr_cpu_ids) {
278+
struct device_node *np;
279+
const char *model;
280+
const char *serial;
281+
u32 revision;
282+
283+
np = of_find_node_by_path("/system");
284+
if (np) {
285+
if (!of_property_read_u32(np, "linux,revision", &revision))
286+
seq_printf(m, "Revision\t: %04x\n", revision);
287+
of_node_put(np);
288+
}
287289

288-
np = of_find_node_by_path("/");
289-
if (np) {
290-
if (!of_property_read_string(np, "serial-number",
291-
&serial))
292-
seq_printf(m, "Serial\t\t: %s\n", serial);
293-
if (!of_property_read_string(np, "model",
294-
&model))
295-
seq_printf(m, "Model\t\t: %s\n", model);
296-
of_node_put(np);
290+
np = of_find_node_by_path("/");
291+
if (np) {
292+
if (!of_property_read_string(np, "serial-number",
293+
&serial))
294+
seq_printf(m, "Serial\t\t: %s\n", serial);
295+
if (!of_property_read_string(np, "model",
296+
&model))
297+
seq_printf(m, "Model\t\t: %s\n", model);
298+
of_node_put(np);
299+
}
297300
}
298301

299302
return 0;

0 commit comments

Comments
 (0)