驱动·错误

make -C /home/ysy/linux/IMX6ULL/linux/linux-imx-rel_imx_4.1.15_2.1.0_ga M=/home/ysy/linux/100ask/02_sr501_chrdev_probe_read_irq modules
make[1]: Entering directory '/home/ysy/linux/IMX6ULL/linux/linux-imx-rel_imx_4.1.15_2.1.0_ga'
  CC [M]  /home/ysy/linux/100ask/02_sr501_chrdev_probe_read_irq/sr501_drv.o
In file included from include/linux/mmzone.h:9:0,
                 from include/linux/gfp.h:5,
                 from include/linux/kmod.h:22,
                 from include/linux/module.h:13,
                 from /home/ysy/linux/100ask/02_sr501_chrdev_probe_read_irq/sr501_drv.c:1:
/home/ysy/linux/100ask/02_sr501_chrdev_probe_read_irq/sr501_drv.c: In function ‘sr501_drv_read’:
include/linux/wait.h:387:31: error: ‘TASK_INTERRUPTIBLE’ undeclared (first use in this function)
  ___wait_event(wq, condition, TASK_INTERRUPTIBLE, 0, 0,  \
                               ^
include/linux/wait.h:225:52: note: in definition of macro ‘___wait_event’
   long __int = prepare_to_wait_event(&wq, &__wait, state);\
                                                    ^
include/linux/wait.h:410:11: note: in expansion of macro ‘__wait_event_interruptible’
   __ret = __wait_event_interruptible(wq, condition); \
           ^
/home/ysy/linux/100ask/02_sr501_chrdev_probe_read_irq/sr501_drv.c:57:2: note: in expansion of macro ‘wait_event_interruptible’
  wait_event_interruptible(sr501_wq, sr501_data); 
  ^
include/linux/wait.h:387:31: note: each undeclared identifier is reported only once for each function it appears in
  ___wait_event(wq, condition, TASK_INTERRUPTIBLE, 0, 0,  \
                               ^
include/linux/wait.h:225:52: note: in definition of macro ‘___wait_event’
   long __int = prepare_to_wait_event(&wq, &__wait, state);\
                                                    ^
include/linux/wait.h:410:11: note: in expansion of macro ‘__wait_event_interruptible’
   __ret = __wait_event_interruptible(wq, condition); \
           ^
/home/ysy/linux/100ask/02_sr501_chrdev_probe_read_irq/sr501_drv.c:57:2: note: in expansion of macro ‘wait_event_interruptible’
  wait_event_interruptible(sr501_wq, sr501_data); 
  ^
include/linux/wait.h:198:43: error: ‘TASK_KILLABLE’ undeclared (first use in this function)
   state == TASK_INTERRUPTIBLE || state == TASK_KILLABLE) \
                                           ^
include/linux/wait.h:230:7: note: in expansion of macro ‘___wait_is_interruptible’
   if (___wait_is_interruptible(state) && __int) {  \
       ^
include/linux/wait.h:387:2: note: in expansion of macro ‘___wait_event’
  ___wait_event(wq, condition, TASK_INTERRUPTIBLE, 0, 0,  \
  ^
include/linux/wait.h:410:11: note: in expansion of macro ‘__wait_event_interruptible’
   __ret = __wait_event_interruptible(wq, condition); \
           ^
/home/ysy/linux/100ask/02_sr501_chrdev_probe_read_irq/sr501_drv.c:57:2: note: in expansion of macro ‘wait_event_interruptible’
  wait_event_interruptible(sr501_wq, sr501_data); 
  ^
/home/ysy/linux/100ask/02_sr501_chrdev_probe_read_irq/sr501_drv.c:57:2: error: implicit declaration of function ‘schedule’ [-Werror=implicit-function-declaration]
In file included from include/linux/mmzone.h:9:0,
                 from include/linux/gfp.h:5,
                 from include/linux/kmod.h:22,
                 from include/linux/module.h:13,
                 from /home/ysy/linux/100ask/02_sr501_chrdev_probe_read_irq/sr501_drv.c:1:
/home/ysy/linux/100ask/02_sr501_chrdev_probe_read_irq/sr501_drv.c: In function ‘sr501_isr’:
include/linux/wait.h:165:35: error: ‘TASK_NORMAL’ undeclared (first use in this function)
 #define wake_up(x)   __wake_up(x, TASK_NORMAL, 1, NULL)
                                   ^
/home/ysy/linux/100ask/02_sr501_chrdev_probe_read_irq/sr501_drv.c:96:2: note: in expansion of macro ‘wake_up’
  wake_up(&sr501_wq);
  ^
cc1: some warnings being treated as errors
scripts/Makefile.build:264: recipe for target '/home/ysy/linux/100ask/02_sr501_chrdev_probe_read_irq/sr501_drv.o' failed
make[2]: *** [/home/ysy/linux/100ask/02_sr501_chrdev_probe_read_irq/sr501_drv.o] Error 1
Makefile:1385: recipe for target '_module_/home/ysy/linux/100ask/02_sr501_chrdev_probe_read_irq' failed
make[1]: *** [_module_/home/ysy/linux/100ask/02_sr501_chrdev_probe_read_irq] Error 2
make[1]: Leaving directory '/home/ysy/linux/IMX6ULL/linux/linux-imx-rel_imx_4.1.15_2.1.0_ga'
Makefile:6: recipe for target 'kernel_modules' failed
make: *** [kernel_modules] Error 2

解决办法:错误定位行 wake_up_interruptible(&button_waitq); 原因缺少头文件 #include <linux/sched.h> 添加后即可通过编译 !

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值