mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-24 03:24:55 +08:00
f15412aa08
The Makefile/Kconfig currently controlling compilation of this code is: obj-$(CONFIG_DEBUG_FS) += $(debugfs-y) debugfs-y := asids-debugfs.o lib/Kconfig.debug:config DEBUG_FS lib/Kconfig.debug: bool "Debug Filesystem" ....meaning that it currently is not being built as a module by anyone. Lets remove the couple traces of modular code, so that when reading the driver there is no doubt it is builtin-only. Since module_init translates to device_initcall in the non-modular case, the init ordering remains unchanged with this commit. Cc: Yoshinori Sato <ysato@users.sourceforge.jp> Cc: Rich Felker <dalias@libc.org> Cc: linux-sh@vger.kernel.org Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com> Signed-off-by: Rich Felker <dalias@libc.org>
73 lines
1.8 KiB
C
73 lines
1.8 KiB
C
/*
|
|
* debugfs ops for process ASIDs
|
|
*
|
|
* Copyright (C) 2000, 2001 Paolo Alberelli
|
|
* Copyright (C) 2003 - 2008 Paul Mundt
|
|
* Copyright (C) 2003, 2004 Richard Curnow
|
|
*
|
|
* Provides a debugfs file that lists out the ASIDs currently associated
|
|
* with the processes.
|
|
*
|
|
* In the SH-5 case, if the DM.PC register is examined through the debug
|
|
* link, this shows ASID + PC. To make use of this, the PID->ASID
|
|
* relationship needs to be known. This is primarily for debugging.
|
|
*
|
|
* This file is subject to the terms and conditions of the GNU General Public
|
|
* License. See the file "COPYING" in the main directory of this archive
|
|
* for more details.
|
|
*/
|
|
#include <linux/init.h>
|
|
#include <linux/debugfs.h>
|
|
#include <linux/seq_file.h>
|
|
#include <linux/spinlock.h>
|
|
#include <asm/processor.h>
|
|
#include <asm/mmu_context.h>
|
|
|
|
static int asids_seq_show(struct seq_file *file, void *iter)
|
|
{
|
|
struct task_struct *p;
|
|
|
|
read_lock(&tasklist_lock);
|
|
|
|
for_each_process(p) {
|
|
int pid = p->pid;
|
|
|
|
if (unlikely(!pid))
|
|
continue;
|
|
|
|
if (p->mm)
|
|
seq_printf(file, "%5d : %04lx\n", pid,
|
|
cpu_asid(smp_processor_id(), p->mm));
|
|
}
|
|
|
|
read_unlock(&tasklist_lock);
|
|
|
|
return 0;
|
|
}
|
|
|
|
static int asids_debugfs_open(struct inode *inode, struct file *file)
|
|
{
|
|
return single_open(file, asids_seq_show, inode->i_private);
|
|
}
|
|
|
|
static const struct file_operations asids_debugfs_fops = {
|
|
.owner = THIS_MODULE,
|
|
.open = asids_debugfs_open,
|
|
.read = seq_read,
|
|
.llseek = seq_lseek,
|
|
.release = single_release,
|
|
};
|
|
|
|
static int __init asids_debugfs_init(void)
|
|
{
|
|
struct dentry *asids_dentry;
|
|
|
|
asids_dentry = debugfs_create_file("asids", S_IRUSR, arch_debugfs_dir,
|
|
NULL, &asids_debugfs_fops);
|
|
if (!asids_dentry)
|
|
return -ENOMEM;
|
|
|
|
return PTR_ERR_OR_ZERO(asids_dentry);
|
|
}
|
|
device_initcall(asids_debugfs_init);
|