我正在为IRQ 8开发一个驱动程序,它对应于RTC时钟。我有以下问题。当我用请求IRQ请求IRQ时,会得到一个EBUSY错误。我认为首先使用free_irq(8,NULL)应该可以解决这个问题(至少它在内核版本2.6.24-23-generic上工作)。然而,当我使用它时,我会得到一个错误“试图释放已经释放的IRQ 8”。检查/proc/interrupts我看到了以下内容:8: 1 0 IO-APIC-edge rtc0
这是我在dmesg中得到的错误:
[14876.256173] ------------[ cut here ]------------
[14876.256182] WARNING: at kernel/irq/manage.c:1195 __free_irq+0x91/0x190()
[14876.256185] Hardware name: Aspire 7720
[14876.256187] Trying to free already-free IRQ 8
[14876.256189] Modules linked in: cmos_driver_alarm(O+) cmos_driver_ioctl(O) nls_cp437 vfat fat usb_storage uas listapci_driver(O) cmos_driver_read(O) aes_i586 cryptd aes_generic fuse mxl5005s zl10353 dvb_usb_ce6230 dvb_usb dvb_core arc4 joydev nouveau iwl3945 iwlegacy mac80211 ir_lirc_codec lirc_dev drm_kms_helper snd_hda_codec_realtek ir_mce_kbd_decoder ttm ir_sanyo_decoder firewire_ohci sdhci_pci sdhci cfg80211 drm ir_sony_decoder ir_jvc_decoder snd_hda_intel snd_hda_codec snd_pcm mmc_core tg3 intel_agp intel_gtt agpgart r852 sm_common nand nand_ecc ir_rc6_decoder iTCO_wdt firewire_core snd_page_alloc i2c_i801 r592 snd_hwdep serio_raw nand_ids ir_rc5_decoder libphy iTCO_vendor_support crc_itu_t i2c_core mtd memstick psmouse rc_rc6_mce ir_nec_decoder thermal battery pcspkr processor video button ac acer_wmi mxm_wmi evdev sparse_keymap rfkill ene_ir wmi rc_core vboxnetflt(O) vboxdrv(O) vhba(O) snd_seq snd_timer snd_seq_device snd soundcore ext4 crc16 jbd2 mbcache sr_mod cdrom sd_mod pata_acpi hid_logitech_dj usbhid hid ata_generic ata_piix libata scsi_mod uhci_hcd ehci_hcd usbcore usb_common [last unloaded: cmos_driver_alarm]
[14876.256283] Pid: 10363, comm: insmod Tainted: G W O 3.3.1-1-ARCH #1
[14876.256286] Call Trace:
[14876.256292] [<c01351f2>] warn_slowpath_common+0x72/0xa0
[14876.256296] [<c01a89e1>] ? __free_irq+0x91/0x190
[14876.256299] [<c01a89e1>] ? __free_irq+0x91/0x190
[14876.256303] [<c01352c3>] warn_slowpath_fmt+0x33/0x40
[14876.256306] [<c01a89e1>] __free_irq+0x91/0x190
[14876.256310] [<c01a8b23>] free_irq+0x43/0xa0
[14876.256314] [<f803501e>] init_driver+0x1e/0xc8 [cmos_driver_alarm]
[14876.256318] [<c0101124>] do_one_initcall+0x34/0x170
[14876.256325] [<f8035000>] ? 0xf8034fff
[14876.256330] [<c018f295>] sys_init_module+0x8c5/0x1a70
[14876.256342] [<c04ae85f>] sysenter_do_call+0x12/0x28
[14876.256345] ---[ end trace 81112f980bdc845e ]---
你知道我做错了什么吗?提前谢谢你
最佳答案
问题是你把NULL
作为参数传递给free_irq
。在允许您释放它之前,该函数会检查它是否与request_irq
匹配。
看看这个函数:
/* desc is obtained via irq_to_desc */
action_ptr = &desc->action;
for (;;) {
action = *action_ptr;
if (!action) {
WARN(1, "Trying to free already-free IRQ %d\n", irq);
raw_spin_unlock_irqrestore(&desc->lock, flags);
return NULL;
}
/* If dev_id doesn't match it just goes on. */
if (action->dev_id == dev_id)
break;
action_ptr = &action->next;
}
关于c - request_irq返回EBUSY并且free_irq说IRQ是免费的,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/10072864/