When building the Altera® example Linux Configuration via Protocol(CvP) driver the following error messages may occur:
altera_cvp.c: In function ‘altera_cvp_wait_for_bit’:
altera_cvp.c:243:3: error: ‘TASK_UNINTERRUPTIBLE’ undeclared (first use in this function)
altera_cvp.c:243:3: note: each undeclared identifier is reported only once for each function it appears in
altera_cvp.c:243:3: error: implicit declaration of function ‘schedule_timeout’ [-Werror=implicit-function-declaration]
altera_cvp.c: In function ‘altera_cvp_open’:
altera_cvp.c:318:11: error: dereferencing pointer to incomplete type
altera_cvp.c:318:23: error: ‘O_ACCMODE’ undeclared (first use in this function)
altera_cvp.c:318:37: error: ‘O_RDONLY’ undeclared (first use in this function)
altera_cvp.c: In function ‘altera_cvp_release’:
altera_cvp.c:337:11: error: dereferencing pointer to incomplete type
altera_cvp.c:337:23: error: ‘O_ACCMODE’ undeclared (first use in this function)
altera_cvp.c:337:37: error: ‘O_RDONLY’ undeclared (first use in this function)
altera_cvp.c: At top level:
altera_cvp.c:413:8: error: variable ‘altera_cvp_fops’ has initializer but incomplete type
altera_cvp.c:414:2: error: unknown field ‘owner’ specified in initializer
altera_cvp.c:414:2: warning: excess elements in struct initializer [enabled by default]
altera_cvp.c:414:2: warning: (near initialization for ‘altera_cvp_fops’) [enabled by default]
altera_cvp.c:415:2: error: unknown field ‘llseek’ specified in initializer
altera_cvp.c:415:13: error: ‘no_llseek’ undeclared here (not in a function)
altera_cvp.c:415:2: warning: excess elements in struct initializer [enabled by default]
altera_cvp.c:415:2: warning: (near initialization for ‘altera_cvp_fops’) [enabled by default]
altera_cvp.c:416:2: error: unknown field ‘read’ specified in initializer
altera_cvp.c:416:2: warning: excess elements in struct initializer [enabled by default]
altera_cvp.c:416:2: warning: (near initialization for ‘altera_cvp_fops’) [enabled by default]
altera_cvp.c:417:2: error: unknown field ‘write’ specified in initializer
altera_cvp.c:417:2: warning: excess elements in struct initializer [enabled by default]
altera_cvp.c:417:2: warning: (near initialization for ‘altera_cvp_fops’) [enabled by default]
altera_cvp.c:418:2: error: unknown field ‘open’ specified in initializer
altera_cvp.c:418:2: warning: excess elements in struct initializer [enabled by default]
altera_cvp.c:418:2: warning: (near initialization for ‘altera_cvp_fops’) [enabled by default]
altera_cvp.c:419:2: error: unknown field ‘release’ specified in initializer
altera_cvp.c:419:2: warning: excess elements in struct initializer [enabled by default]
altera_cvp.c:419:2: warning: (near initialization for ‘altera_cvp_fops’) [enabled by default]
altera_cvp.c: In function ‘altera_cvp_init’:
altera_cvp.c:482:2: error: implicit declaration of function ‘alloc_chrdev_region’ [-Werror=implicit-function-declaration]
altera_cvp.c:496:3: error: implicit declaration of function ‘unregister_chrdev_region’ [-Werror=implicit-function-declaration]
To work around this issue, ensure that the following three additional header files are included in the file altera_cvp.c contained within altera_cvp_1.0.tar.gz.gz:
#include <linux/fcntl.h> /*Helps fix O_ACCMODE*/
#include <linux/sched.h> /*Helps fix TASK_UNINTERRUPTIBLE */
#include <linux/fs.h> /*Helps fix the struct intializer */