Hello,
I have an UL with one interrupt. When I try to request the interrupt, it fails. Here is the code of my driver:static int __init mod_init(void)
{
u8 errorcode;
printk("DSP: Driver loaded\n");
if( register_chrdev(240, "DSPDriver", &fops) == 0) {
printk("DSP: registering device\n");
if( request_irq(IRQ_NR, driver_isr, SA_INTERRUPT|SA_SHIRQ, "dsp", &fops))
{
printk("DSP: Got IRQ %i\n", IRQ_NR);
return 0;
}
else
{
printk("DSP: ERROR IRQ request failed!\n");
unregister_chrdev(240, "DSPDriver");
return -EBUSY;
}
}
printk("DSP: registering device FAILED\n");
return -EIO;
}
static void __exit mod_exit(void)
{
printk("cleanup_module called\n");
free_irq( IRQ_NR, &fops );
unregister_chrdev(240, "DSPDriver");
}
module_init( mod_init );
module_exit( mod_exit );
I don't know why. My driver should be the only one requesting this IRQ. It doesn't matter if I request it shared or exclusively. /proc/interrupts looks like this: # cat /proc/interrupts
1: 519 jtag_uart
3: 90384 L timer
6: 270 eth0
8: 0 dsp
: 0 spurious
1: 519 jtag_uart
3: 90386 L timer
6: 270 eth0
8: 0 dsp
: 0 spurious
1: 519 jtag_uart
3: 90394 L timer
6: 274 eth0
8: 0 dsp
: 0 spurious
1: 519 jtag_uart
3: 90407 L timer
6: 298 eth0
8: 0 dsp
: 0 spurious
1: 519 jtag_uart
3: 90420 L timer
6: 330 eth0
8: 0 dsp
: 0 spurious
1: 519 jtag_uart
3: 90432 L timer
6: 330 eth0
8: 0 dsp
: 0 spurious
1: 519 jtag_uart
3: 90446 L timer
6: 377 eth0
8: 0 dsp
: 0 spurious
1: 519 jtag_uart
3: 90458 L timer
6: 383 eth0
8: 0 dsp
: 0 spurious
1: 519 jtag_uart
3: 90471 L timer
6: 403 eth0
8: 0 dsp
: 0 spurious
1: 519 jtag_uart
3: 90484 L timer
6: 421 eth0
8: 0 dsp
: 0 spurious
1: 519 jtag_uart
3: 90497 L timer
6: 455 eth0
8: 0 dsp
: 0 spurious
1: 519 jtag_uart
3: 90511 L timer
6: 527 eth0
8: 0 dsp
: 0 spurious
1: 519 jtag_uart
3: 90516 L timer
6: 527 eth0
8: 0 dsp
: 0 spurious
1: 519 jtag_uart
3: 90527 L timer
6: 535 eth0
8: 0 dsp
: 0 spurious
1: 519 jtag_uart
3: 90531 L timer
6: 535 eth0
8: 0 dsp
: 0 spurious
1: 519 jtag_uart
3: 90533 L timer
6: 535 eth0
8: 0 dsp
: 0 spurious
1: 519 jtag_uart
3: 90534 L timer
6: 538 eth0
8: 0 dsp
: 0 spurious
1: 519 jtag_uart
3: 90535 L timer
6: 538 eth0
8: 0 dsp
: 0 spurious
1: 519 jtag_uart
3: 90536 L timer
6: 538 eth0
8: 0 dsp
: 0 spurious
1: 519 jtag_uart
3: 90550 L timer
6: 571 eth0
8: 0 dsp
: 0 spurious
1: 519 jtag_uart
3: 90553 L timer
6: 571 eth0
8: 0 dsp
: 0 spurious
1: 519 jtag_uart
3: 90554 L timer
6: 571 eth0
8: 0 dsp
: 0 spurious
1: 519 jtag_uart
3: 90555 L timer
6: 571 eth0
8: 0 dsp
: 0 spurious
1: 519 jtag_uart
3: 90556 L timer
6: 571 eth0
8: 0 dsp
: 0 spurious
1: 519 jtag_uart
3: 90567 L timer
6: 579 eth0
8: 0 dsp
: 0 spurious
1: 519 jtag_uart
3: 90570 L timer
6: 579 eth0
8: 0 dsp
: 0 spurious
1: 519 jtag_uart
3: 90571 L timer
6: 580 eth0
8: 0 dsp
: 0 spurious
1: 519 jtag_uart
3: 90572 L timer
6: 580 eth0
8: 0 dsp
: 0 spurious
1: 519 jtag_uart
3: 90573 L timer
6: 580 eth0
8: 0 dsp
: 0 spurious
1: 519 jtag_uart
3: 90575 L timer
6: 580 eth0
8: 0 dsp
: 0 spurious
1: 519 jtag_uart
3: 90576 L timer
6: 580 eth0
8: 0 dsp
: 0 spurious
1: 519 jtag_uart
3: 90583 L timer
6: 609 eth0
8: 0 dsp
: 0 spurious
1: 519 jtag_uart
3: 90589 L timer
6: 625 eth0
8: 0 dsp
: 0 spurious
链接已复制
4 回复数
Hi MRKs,
The value returned from request_irq() is either 0 to indicate success or a negative error code ... just test for zero & you should be fine: if( request_irq(IRQ_NR, driver_isr, SA_INTERRUPT|SA_SHIRQ, "dsp", &fops) == 0) or test for zero Regards, --Scott