当前位置: 技术问答>linux和unix
request_irq和free_irq出错了,大家帮忙看看。
来源: 互联网 发布时间:2016-11-21
本文导语: 本帖最后由 HEHE8737 于 2010-12-02 11:45:54 编辑 static irqreturn_t adc_irq(int irq,void *dev_id) { if(!ev_adc) { adc_data=readl(adc_base+S3C2410_ADCDAT0)&0x3ff; ev_adc=1; wake_up_interruptible(&adc_waitq); } return IRQ_HANDLED; } static int a...
{
if(!ev_adc)
{
adc_data=readl(adc_base+S3C2410_ADCDAT0)&0x3ff;
ev_adc=1;
wake_up_interruptible(&adc_waitq);
}
return IRQ_HANDLED;
}
static int adc_open(struct inode *inode,struct file *filep)
{
int ret;
ret=request_irq(IRQ_ADC,adc_irq,IRQF_SHARED,DEVICE_NAME,1);
if(ret)
{
printk(KERN_ERR"IRQ %d erro %dn",IRQ_ADC,ret);
return -EINVAL;
}
return 0;
}
static ssize_t adc_read(struct file *filp,char *buffer,size_t count,loff_t *ppos)
{
if(down_trylock(&ADC_LOCK))
{
return -EBUSY;
}
if(!ev_adc)
{
if(filp->f_flags&O_NONBLOCK)
{
return -EAGAIN;
}
else
{
start_adc();
wait_event_interruptible(adc_waitq,ev_adc);
}
}
ev_adc=0;
copy_to_user(buffer,(char*)&adc_data,sizeof(adc_data));
up(&ADC_LOCK);
return sizeof(adc_data);
}
static void __exit adc_exit(void)
{
free_irq(IRQ_ADC,1);
iounmap(adc_base);
if(adc_clk)
{
clk_disable(adc_clk);
clk_put(adc_clk);
adc_clk=NULL;
}
misc_deregister(&adc_miscdev);
printk("2440ADC device Removed!n ");
}
打印的警告信息如下(驱动也打不开):
/home/xiong/drivers/adc-armfriendly/adcfriendly.c: In function `adc_open':
/home/xiong/drivers/adc-armfriendly/adcfriendly.c:41: warning: passing arg 5 of `request_irq' makes pointer from integer without a cast
/home/xiong/drivers/adc-armfriendly/adcfriendly.c: In function `adc_exit':
/home/xiong/drivers/adc-armfriendly/adcfriendly.c:142: warning: passing arg 2 of `free_irq' makes pointer from integer without a cast
/usr/src/linux-2.6.28.7/arch/arm/include/asm/uaccess.h: In function `adc_read':
/home/xiong/drivers/adc-armfriendly/adcfriendly.c:82: warning: ignoring return value of `copy_to_user', declared with attribute warn_unused_result
请问这是什么问题阿?我的内核是linux-2.6.28.7,主机是fedora13
|
void free_irq(unsigned int irq, void *dev_id) 这是2.6.28的函数原型,参数类型不对