cpuinfo.c (670B)
1// SPDX-License-Identifier: GPL-2.0 2#include <linux/cpufreq.h> 3#include <linux/fs.h> 4#include <linux/init.h> 5#include <linux/proc_fs.h> 6#include <linux/seq_file.h> 7 8extern const struct seq_operations cpuinfo_op; 9 10static int cpuinfo_open(struct inode *inode, struct file *file) 11{ 12 return seq_open(file, &cpuinfo_op); 13} 14 15static const struct proc_ops cpuinfo_proc_ops = { 16 .proc_flags = PROC_ENTRY_PERMANENT, 17 .proc_open = cpuinfo_open, 18 .proc_read_iter = seq_read_iter, 19 .proc_lseek = seq_lseek, 20 .proc_release = seq_release, 21}; 22 23static int __init proc_cpuinfo_init(void) 24{ 25 proc_create("cpuinfo", 0, NULL, &cpuinfo_proc_ops); 26 return 0; 27} 28fs_initcall(proc_cpuinfo_init);