Trying to free IRQ
Juan Antonio Medina Guerrero
juan-antonio.medina at anafocus.com
Fri Oct 17 19:15:20 EST 2008
Hello,
We are trying to implement an interrupt. The interrupt run ok but if we want
to unload and reload the module our system crashes:
Exit module output:
<3>Trying to free already-free IRQ 71
Init module output:
<3>IRQ handler type mismatch for IRQ 71
current handler: MYMODULE
This is part of the code:
Dts:
mydev at 8030 {
device_type = "mydev";
compatible = "mymodule";
reg = <8030 300>;
interrupts = <47 8>;
interrupt-parent = <700>;
};
Global variable:
unsigned int dev_id=MKDEV(MYDEV_MAJOR,0);
struct device_node* dev_node;
int irq_id;
Init_module:
// Find device node in device tree
dev_node = of_find_node_by_type(NULL, "mydev");
if (!dev_node)
{
printk(KERN_ALERT "\n\tERROR: No device found in device
tree\n");
goto init_find_node_error;
}
// Get and map irq number from device tree
irq_id = irq_of_parse_and_map(dev_node, 0);
if (irq_id == NO_IRQ)
{
printk(KERN_ALERT "\n\tERROR: irq_of_parse_and_map failed\n");
goto init_parse_map_irq_error;
}
// Request irq
if (request_irq(irq_id, interrupt_handler, 0, "MYMODULE", &dev_id))
{
printk (KERN_ALERT "\n\tERROR: request irq\n");
goto init_request_irq_error;
}
Exit_module:
free_irq(irq_id,NULL);
of_node_put(dev_node);
Could you please help us with this?
Regards,
Medina
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ozlabs.org/pipermail/linuxppc-embedded/attachments/20081017/9c088b41/attachment.htm>
More information about the Linuxppc-embedded
mailing list