gpt4 book ai didi

c - request_irq 返回 EBUSY,free_irq 表示 IRQ 空闲

转载 作者:太空宇宙 更新时间:2023-11-04 03:02:15 25 4
gpt4 key购买 nike

我正在为 IRQ 号 8 开发一个驱动程序,它对应于 RTC 时钟。我有以下问题。当我用 request_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 匹配。

只看函数_free_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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com