Link: https://lore.kernel.org/r/20260217200002.683975158@linuxfoundation.org Tested-by: Florian Fainelli <florian.fainelli@broadcom.com> Tested-by: Takeshi Ogasawara <takeshi.ogasawara@futuring-girl.com> Tested-by: Peter Schneider <pschneider1968@googlemail.com> Tested-by: Jon Hunter <jonathanh@nvidia.com> Tested-by: Salvatore Bonaccorso <carnil@debian.org> Tested-by: Brett A C Sheffield <bacs@librecast.net> Tested-by: Mark Brown <broonie@kernel.org> Tested-by: Luna Jernberg <droidbittin@gmail.com> Tested-by: Ronald Warsow <rwarsow@gmx.de> Tested-by: Justin M. Forbes <jforbes@fedoraproject.org> Tested-by: Ron Economos <re@w6rz.net> Tested-by: Miguel Ojeda <ojeda@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
43 lines
859 B
C
43 lines
859 B
C
// SPDX-License-Identifier: GPL-2.0
|
|
#include <linux/fs.h>
|
|
#include <linux/init.h>
|
|
#include <linux/interrupt.h>
|
|
#include <linux/irqnr.h>
|
|
#include <linux/proc_fs.h>
|
|
#include <linux/seq_file.h>
|
|
|
|
/*
|
|
* /proc/interrupts
|
|
*/
|
|
static void *int_seq_start(struct seq_file *f, loff_t *pos)
|
|
{
|
|
return *pos <= irq_get_nr_irqs() ? pos : NULL;
|
|
}
|
|
|
|
static void *int_seq_next(struct seq_file *f, void *v, loff_t *pos)
|
|
{
|
|
(*pos)++;
|
|
if (*pos > irq_get_nr_irqs())
|
|
return NULL;
|
|
return pos;
|
|
}
|
|
|
|
static void int_seq_stop(struct seq_file *f, void *v)
|
|
{
|
|
/* Nothing to do */
|
|
}
|
|
|
|
static const struct seq_operations int_seq_ops = {
|
|
.start = int_seq_start,
|
|
.next = int_seq_next,
|
|
.stop = int_seq_stop,
|
|
.show = show_interrupts
|
|
};
|
|
|
|
static int __init proc_interrupts_init(void)
|
|
{
|
|
proc_create_seq("interrupts", 0, NULL, &int_seq_ops);
|
|
return 0;
|
|
}
|
|
fs_initcall(proc_interrupts_init);
|