Merge tag 'ntb-5.11' of git://github.com/jonmason/ntb
[linux/fpc-iii.git] / tools / lib / api / cpu.c
blob4af6d4b7aa07516e25c4a49048563c8faa2716e1
1 // SPDX-License-Identifier: GPL-2.0
2 #include <stdio.h>
4 #include "cpu.h"
5 #include "fs/fs.h"
7 int cpu__get_max_freq(unsigned long long *freq)
9 char entry[PATH_MAX];
10 int cpu;
12 if (sysfs__read_int("devices/system/cpu/online", &cpu) < 0)
13 return -1;
15 snprintf(entry, sizeof(entry),
16 "devices/system/cpu/cpu%d/cpufreq/cpuinfo_max_freq", cpu);
18 return sysfs__read_ull(entry, freq);