I am programming a kernel module in C which is struggling to access IRQ description array elements and to display all action names of these elements.
At the beginning, I thought that this irq_desc array is sonething like a macro but after compiling i understood it is not. Then I used for_each_irq_desc(irq, desc) function. but this time it returned a warning:
WARNING: "irq_to_desc" [/home/samet/Masaüstü/Assignment3/Ass-1.ko] undefined!
and after this warning, i tried to insmod the module into kernel this time an error message popped:
insmod: error inserting './Ass-1.ko': -1 Unknown symbol in module
after this i included all header files that i think relevant to this process, but nothing changed.
since it is very short i am attaching the code:
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/sched.h>
#include <linux/irq.h>
#include <linux/irqdesc.h>
#include <linux/irqnr.h>
struct task_struct* p;
struct irq_desc* irqElement;
int irq, desc;
static int __init ass_1_init(void)
{
printk(KERN_INFO "Ass-1 module is starting...\n");
for_each_process(p){printk("%d\t%s\n", p->pid, p->comm);}
for_each_irq_desc(irq, irqElement){printk("%p\n", irqElement);}
return 0;
}
static void __exit ass_1_exit(void)
{
printk(KERN_INFO "Ass-1 module is finishing...\n");
}
module_init(ass_1_init);
module_exit(ass_1_exit);