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> 添加后即可通过编译 !