blob: 96f1087e372c19332d0acc23fb588a06cf10efe8 [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001// SPDX-License-Identifier: GPL-2.0
Rafael J. Wysocki7d5905d2017-11-15 02:13:40 +01002#include <linux/cpufreq.h>
Alexey Dobriyan8591cf42008-10-04 23:40:23 +04003#include <linux/fs.h>
4#include <linux/init.h>
5#include <linux/proc_fs.h>
6#include <linux/seq_file.h>
7
Rafael J. Wysocki7d5905d2017-11-15 02:13:40 +01008__weak void arch_freq_prepare_all(void)
9{
10}
11
Alexey Dobriyan8591cf42008-10-04 23:40:23 +040012extern const struct seq_operations cpuinfo_op;
13static int cpuinfo_open(struct inode *inode, struct file *file)
14{
Rafael J. Wysocki7d5905d2017-11-15 02:13:40 +010015 arch_freq_prepare_all();
Alexey Dobriyan8591cf42008-10-04 23:40:23 +040016 return seq_open(file, &cpuinfo_op);
17}
18
19static const struct file_operations proc_cpuinfo_operations = {
20 .open = cpuinfo_open,
21 .read = seq_read,
22 .llseek = seq_lseek,
23 .release = seq_release,
24};
25
26static int __init proc_cpuinfo_init(void)
27{
28 proc_create("cpuinfo", 0, NULL, &proc_cpuinfo_operations);
29 return 0;
30}
Paul Gortmakerabaf3782014-01-23 15:55:45 -080031fs_initcall(proc_cpuinfo_init);