b.liu | e958203 | 2025-04-17 19:18:16 +0800 | [diff] [blame^] | 1 | --- a/src/drv_tapi_linux.c |
| 2 | +++ b/src/drv_tapi_linux.c |
| 3 | @@ -47,7 +47,9 @@ |
| 4 | #include <linux/errno.h> |
| 5 | #include <asm/uaccess.h> /* copy_from_user(), ... */ |
| 6 | #include <asm/byteorder.h> |
| 7 | +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,33)) |
| 8 | #include <linux/smp_lock.h> /* lock_kernel() */ |
| 9 | +#endif |
| 10 | #include <asm/io.h> |
| 11 | |
| 12 | #ifdef LINUX_2_6 |
| 13 | @@ -69,7 +71,9 @@ |
| 14 | #else |
| 15 | #include <linux/tqueue.h> |
| 16 | #include <linux/sched.h> |
| 17 | +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,33)) |
| 18 | #include <linux/smp_lock.h> /* lock_kernel() */ |
| 19 | +#endif |
| 20 | #endif /* LINUX_2_6 */ |
| 21 | |
| 22 | #include "drv_tapi.h" |
| 23 | @@ -137,8 +141,13 @@ static ssize_t ifx_tapi_write(struct fil |
| 24 | size_t count, loff_t * ppos); |
| 25 | static ssize_t ifx_tapi_read(struct file * filp, char *buf, |
| 26 | size_t length, loff_t * ppos); |
| 27 | +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,36)) |
| 28 | static int ifx_tapi_ioctl(struct inode *inode, struct file *filp, |
| 29 | unsigned int nCmd, unsigned long nArgument); |
| 30 | +#else |
| 31 | +static long ifx_tapi_ioctl(struct file *filp, |
| 32 | + unsigned int nCmd, unsigned long nArgument); |
| 33 | +#endif |
| 34 | static unsigned int ifx_tapi_poll (struct file *filp, poll_table *table); |
| 35 | |
| 36 | #ifdef CONFIG_PROC_FS |
| 37 | @@ -222,7 +231,11 @@ IFX_return_t TAPI_OS_RegisterLLDrv (IFX_ |
| 38 | IFX_char_t *pRegDrvName = IFX_NULL; |
| 39 | IFX_int32_t ret = 0; |
| 40 | |
| 41 | +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,36)) |
| 42 | if (tapi_fops.ioctl == IFX_NULL) |
| 43 | +#else |
| 44 | + if (tapi_fops.unlocked_ioctl == IFX_NULL) |
| 45 | +#endif |
| 46 | { |
| 47 | #ifdef MODULE |
| 48 | tapi_fops.owner = THIS_MODULE; |
| 49 | @@ -230,7 +243,11 @@ IFX_return_t TAPI_OS_RegisterLLDrv (IFX_ |
| 50 | tapi_fops.read = ifx_tapi_read; |
| 51 | tapi_fops.write = ifx_tapi_write; |
| 52 | tapi_fops.poll = ifx_tapi_poll; |
| 53 | +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,36)) |
| 54 | tapi_fops.ioctl = ifx_tapi_ioctl; |
| 55 | +#else |
| 56 | + tapi_fops.unlocked_ioctl = ifx_tapi_ioctl; |
| 57 | +#endif |
| 58 | tapi_fops.open = ifx_tapi_open; |
| 59 | tapi_fops.release = ifx_tapi_release; |
| 60 | } |
| 61 | @@ -885,8 +902,13 @@ static IFX_uint32_t ifx_tapi_poll (struc |
| 62 | - 0 and positive values - success |
| 63 | - negative value - ioctl failed |
| 64 | */ |
| 65 | +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,36)) |
| 66 | static int ifx_tapi_ioctl(struct inode *inode, struct file *filp, |
| 67 | unsigned int nCmd, unsigned long nArg) |
| 68 | +#else |
| 69 | +static long ifx_tapi_ioctl(struct file *filp, |
| 70 | + unsigned int nCmd, unsigned long nArg) |
| 71 | +#endif |
| 72 | { |
| 73 | TAPI_FD_PRIV_DATA_t *pTapiPriv; |
| 74 | IFX_TAPI_ioctlCtx_t ctx; |
| 75 | @@ -3725,7 +3747,9 @@ IFX_void_t TAPI_OS_ThreadKill(IFXOS_Thre |
| 76 | kernel lock (lock_kernel()). The lock must be |
| 77 | grabbed before changing the terminate |
| 78 | flag and released after the down() call. */ |
| 79 | - lock_kernel(); |
| 80 | +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,33) |
| 81 | + lock_kernel(); |
| 82 | +#endif |
| 83 | mb(); |
| 84 | #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,28) |
| 85 | kill_proc(pThrCntrl->tid, SIGKILL, 1); |
| 86 | @@ -3733,8 +3757,10 @@ IFX_void_t TAPI_OS_ThreadKill(IFXOS_Thre |
| 87 | kill_pid(find_vpid(pThrCntrl->tid), SIGKILL, 1); |
| 88 | #endif |
| 89 | /* release the big kernel lock */ |
| 90 | +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,33) |
| 91 | unlock_kernel(); |
| 92 | - wait_for_completion (&pThrCntrl->thrCompletion); |
| 93 | +#endif |
| 94 | + wait_for_completion (&pThrCntrl->thrCompletion); |
| 95 | |
| 96 | #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,23) |
| 97 | /* Now we are sure the thread is in zombie state. |
| 98 | --- a/src/lib/lib_fifo/lib_fifo.c |
| 99 | +++ b/src/lib/lib_fifo/lib_fifo.c |
| 100 | @@ -41,7 +41,7 @@ |
| 101 | #ifdef LINUX |
| 102 | /* if linux/slab.h is not available, use the precessor linux/malloc.h */ |
| 103 | #include <linux/slab.h> |
| 104 | -#elif VXWORKS |
| 105 | +#elif defined(VXWORKS) |
| 106 | #include <sys_drv_debug.h> |
| 107 | #endif /* LINUX */ |
| 108 | |