2010-03-18 22:44:41 passing argument 2 of ‘request_irq’ from incompatible pointer type
zhang zhihua (CHINA)
Message: 87433
我想申请一个中断处理函数,使用下面的函数:
static irqreturn_t irq_task1(int irq,void *dev_id,struct pt_regs *regs)
{
printk("This is the irq_task!\n");
/**********************************************/
//调用处理函数
/**********************************************/
return IRQ_HANDLED;
}
{
int ret;
ret = request_irq (UART1_IRQNO,irq_task1,IRQF_SHARED,TEST_DEVICE_NAME,NULL);
}
但是编译却出现如下告警:warning:passing argument 2 of ‘request_irq’ from incompatible pointer type
什么地方有问题呢?
而且将驱动添加到内核之后编写了一个最简单的test程序调用open函数,出现如下:
root:~> ./test
Welcome to the driver open function!
Welcome to the driver ioctl function!
Trying to free already-free IRQ 107
Hardware Trace:
0 Target : <0x00004bac> { _dump_stack + 0x0 }
Source : <0x0002b85e> { _free_irq + 0x106 } CALL pcrel
1 Target : <0x0002b85e> { _free_irq + 0x106 }
Source : <0x000101da> { _printk + 0x66 } RTS
2 Target : <0x000101d0> { _printk + 0x5c }
Source : <0x00010c00> { _vprintk + 0x14c } RTS
3 Target : <0x00010bf4> { _vprintk + 0x140 }
Source : <0x0002e1fc> { ___ipipe_restore_root + 0x28 } RTS
4 Target : <0x0002e1d4> { ___ipipe_restore_root + 0x0 }
Source : <0x00010bf0> { _vprintk + 0x13c } CALL pcrel
5 Target : <0x00010be8> { _vprintk + 0x134 }
Source : <0x00010d32> { _vprintk + 0x27e } JUMP.S
6 Target : <0x00010d32> { _vprintk + 0x27e }
Source : <0x0000fc86> { _wake_up_klogd + 0x1a } RTS
7 Target : <0x0000fc6c> { _wake_up_klogd + 0x0 }
Source : <0x000105d4> { _release_console_sem + 0x1e0 } JUMP.L
8 Target : <0x000105cc> { _release_console_sem + 0x1d8 }
Source : <0x000105c0> { _release_console_sem + 0x1cc } IF !CC JUMP
9 Target : <0x000105be> { _release_console_sem + 0x1ca }
Source : <0x0002e1fc> { ___ipipe_restore_root + 0x28 } RTS
10 Target : <0x0002e1d4> { ___ipipe_restore_root + 0x0 }
Source : <0x000105ba> { _release_console_sem + 0x1c6 } CALL pcrel
11 Target : <0x000105b2> { _release_console_sem + 0x1be }
Source : <0x0002e1fc> { ___ipipe_restore_root + 0x28 } RTS
12 Target : <0x0002e1d4> { ___ipipe_restore_root + 0x0 }
Source : <0x00023134> { _up + 0x50 } JUMP.L
13 Target : <0x000230e4> { _up + 0x0 }
Source : <0x000105ae> { _release_console_sem + 0x1ba } CALL pcrel
14 Target : <0x0001059a> { _release_console_sem + 0x1a6 }
Source : <0x00010464> { _release_console_sem + 0x70 } IF !CC JUMP
15 Target : <0x00010424> { _release_console_sem + 0x30 }
Source : <0x0001057c> { _release_console_sem + 0x188 } JUMP.S
Stack info:
SP: [0x01905e60] <0x01905e60> /* kernel dynamic memory */
FP: (0x01905e78)
Memory from 0x01905e60 to 01906000
01905e60:[00217d74]<0002b862> 00000000 0000006b 01905e9c 0000006b (00000000)<000e7ede>
01905e80: 007c4970 0059cd20 007c4970 00000008 0041d668 0192f004 <000655c0> 007c4970
01905ea0: 0059cd20 <000655e4> 01905ec4 <0000b03e><0000a5c2> 00000000 00000000 01938ee0
01905ec0:<000630ca> 0059cd20 00000006 01938f78 00000000 005b6160 00000000 00000003
01905ee0: 01904000 <00063152> 005b6160 0059cd20 ffffe000 01938efc ffa0085a 01904000
01905f00: ffa00816 000630f0 00000000 01931258 01904000 ffffe000 00000001 00000001
01905f20: 0192f004 01925252 00008000 00000000 00000000 01906000 01925252 01925252
01905f40:<019206fc> ffa00e0c 02003025 01928785 01926969 0192873e 01926966 00000008
01905f60: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
01905f80: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
01905fa0: 0000000c 00000000 67452301 003dcf74 00000000 01938ed4 01938ee0 0192f060
01905fc0: 01931258 01938f78 01930ae0 01938ef8 00000006 00000003 0193360c 0192f004
01905fe0: 00000001 00000001 00000000 01938edb 00000003 00000003 00000006 00000006
Return addresses in stack:
address : <0x0002b862> { _free_irq + 0x10a }
frame 1 : <0x000e7ede> { _uart_release + 0xe }
address : <0x000655c0> { ___fput + 0x6c }
address : <0x000655e4> { ___fput + 0x90 }
address : <0x0000b03e> { _pick_next_task_fair + 0x46 }
address : <0x0000a5c2> { _finish_task_switch + 0x1a }
address : <0x000630ca> { _filp_close + 0x36 }
address : <0x00063152> { _sys_close + 0x62 }
address : <0x019206fc> [ test + 0x6bc ]
Welcome to the driver release function!
TranslateQuoteReplyEditDelete
2010-03-18 23:36:12 Re: passing argument 2 of ‘request_irq’ from incompatible pointer type
Mike Frysinger (UNITED STATES)
Message: 87436
please review a basic C book. the warning is telling you the problem -- fix your irq handler's prototype. i dont know where you got that example because it isnt from our documentation:
docs.blackfin.uclinux.org/doku.php?id=linux-kernel:interrupts
as for the error, dont call free_irq() on already freed irqs -- like it told you.