From: John Crispin Date: Mon, 14 Mar 2011 07:34:08 +0000 (+0000) Subject: * fixes .unlocked_ioctl functions X-Git-Tag: reboot~17233 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=cd3ff0e45c7b7786926b1e20c953551238e9d3b7;p=oweals%2Fopenwrt.git * fixes .unlocked_ioctl functions SVN-Revision: 26158 --- diff --git a/package/ltq-dsl/patches/100-dsl_compat.patch b/package/ltq-dsl/patches/100-dsl_compat.patch index 4897b33140..f892351a65 100644 --- a/package/ltq-dsl/patches/100-dsl_compat.patch +++ b/package/ltq-dsl/patches/100-dsl_compat.patch @@ -19,16 +19,70 @@ #include "drv_dsl_cpe_api.h" #include "drv_dsl_cpe_api_ioctl.h" -@@ -72,7 +73,7 @@ +@@ -34,9 +35,13 @@ + static DSL_ssize_t DSL_DRV_Write(DSL_DRV_file_t *pFile, const DSL_char_t * pBuf, + DSL_DRV_size_t nSize, DSL_DRV_offset_t * pLoff); + ++#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,36)) + static DSL_int_t DSL_DRV_Ioctls(DSL_DRV_inode_t * pINode, DSL_DRV_file_t * pFile, + DSL_uint_t nCommand, unsigned long nArg); +- ++#else ++static DSL_int_t DSL_DRV_Ioctls(DSL_DRV_file_t * pFile, ++ DSL_uint_t nCommand, unsigned long nArg); ++#endif + static int DSL_DRV_Open(DSL_DRV_inode_t * ino, DSL_DRV_file_t * fil); + + static int DSL_DRV_Release(DSL_DRV_inode_t * ino, DSL_DRV_file_t * fil); +@@ -72,7 +77,11 @@ open: DSL_DRV_Open, release: DSL_DRV_Release, write: DSL_DRV_Write, -- ioctl: DSL_DRV_Ioctls, ++#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,36)) + ioctl: DSL_DRV_Ioctls, ++#else + unlocked_ioctl: DSL_DRV_Ioctls, ++#endif poll: DSL_DRV_Poll }; #else -@@ -1058,6 +1059,7 @@ +@@ -168,10 +177,17 @@ + \return Success or failure. + \ingroup Internal + */ ++#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,36)) + static DSL_int_t DSL_DRV_Ioctls(DSL_DRV_inode_t * pINode, + DSL_DRV_file_t * pFile, + DSL_uint_t nCommand, + unsigned long nArg) ++#else ++static DSL_int_t DSL_DRV_Ioctls( ++ DSL_DRV_file_t * pFile, ++ DSL_uint_t nCommand, ++ unsigned long nArg) ++#endif + { + DSL_int_t nErr=0; + DSL_boolean_t bIsInKernel; +@@ -216,16 +232,7 @@ + } + } + } +- +- if (pINode == DSL_NULL) +- { +- bIsInKernel = DSL_TRUE; +- } +- else +- { +- bIsInKernel = DSL_FALSE; +- } +- ++ bIsInKernel = DSL_FALSE; + if ( (_IOC_TYPE(nCommand) == DSL_IOC_MAGIC_CPE_API) || + (_IOC_TYPE(nCommand) == DSL_IOC_MAGIC_CPE_API_G997) || + (_IOC_TYPE(nCommand) == DSL_IOC_MAGIC_CPE_API_PM) || +@@ -1058,6 +1065,7 @@ /* Entry point of driver */ int __init DSL_ModuleInit(void) { @@ -36,7 +90,7 @@ DSL_int_t i; printk(DSL_DRV_CRLF DSL_DRV_CRLF "Infineon CPE API Driver version: %s" DSL_DRV_CRLF, -@@ -1104,7 +1106,8 @@ +@@ -1104,7 +1112,8 @@ } DSL_DRV_DevNodeInit(); diff --git a/package/ltq-dsl/src/lantiq_mei.c b/package/ltq-dsl/src/lantiq_mei.c index 062b0286f9..c236fa9dda 100644 --- a/package/ltq-dsl/src/lantiq_mei.c +++ b/package/ltq-dsl/src/lantiq_mei.c @@ -149,7 +149,11 @@ static int IFX_MEI_GetPage (DSL_DEV_Device_t *, u32, u32, u32, u32 *, u32 *); static int IFX_MEI_BarUpdate (DSL_DEV_Device_t *, int); static ssize_t IFX_MEI_Write (DSL_DRV_file_t *, const char *, size_t, loff_t *); +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,36)) static int IFX_MEI_UserIoctls (DSL_DRV_inode_t *, DSL_DRV_file_t *, unsigned int, unsigned long); +#else +static int IFX_MEI_UserIoctls (DSL_DRV_file_t *, unsigned int, unsigned long); +#endif static int IFX_MEI_Open (DSL_DRV_inode_t *, DSL_DRV_file_t *); static int IFX_MEI_Release (DSL_DRV_inode_t *, DSL_DRV_file_t *); @@ -200,7 +204,11 @@ static struct file_operations bsp_mei_operations = { open:IFX_MEI_Open, release:IFX_MEI_Release, write:IFX_MEI_Write, +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,36)) + ioctl:IFX_MEI_UserIoctls, +#else unlocked_ioctl:IFX_MEI_UserIoctls, +#endif }; static DSL_DEV_Device_t dsl_devices[BSP_MAX_DEVICES]; @@ -2662,16 +2670,28 @@ DSL_BSP_KernelIoctls (DSL_DEV_Device_t * pDev, unsigned int command, return error; } +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,36)) static int IFX_MEI_UserIoctls (DSL_DRV_inode_t * ino, DSL_DRV_file_t * fil, unsigned int command, unsigned long lon) +#else +static int +IFX_MEI_UserIoctls (DSL_DRV_file_t * fil, + unsigned int command, unsigned long lon) +#endif { int error = 0; +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,36)) int maj = MAJOR (ino->i_rdev); int num = MINOR (ino->i_rdev); +#endif DSL_DEV_Device_t *pDev; +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,36)) pDev = IFX_BSP_HandleGet (maj, num); +#else + pDev = IFX_BSP_HandleGet (0, 0); +#endif if (pDev == NULL) return -EIO; diff --git a/package/ltq-tapi/patches/linux-37.patch b/package/ltq-tapi/patches/linux-37.patch index 6266ca14a8..5d5ff7ed3e 100644 --- a/package/ltq-tapi/patches/linux-37.patch +++ b/package/ltq-tapi/patches/linux-37.patch @@ -1,23 +1,57 @@ --- a/src/drv_tapi_linux.c +++ b/src/drv_tapi_linux.c -@@ -213,7 +213,7 @@ +@@ -128,8 +128,13 @@ + size_t count, loff_t * ppos); + static ssize_t ifx_tapi_read(struct file * filp, char *buf, + size_t length, loff_t * ppos); ++#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,36)) + static int ifx_tapi_ioctl(struct inode *inode, struct file *filp, + unsigned int nCmd, unsigned long nArgument); ++#else ++static int ifx_tapi_ioctl(struct file *filp, ++ unsigned int nCmd, unsigned long nArgument); ++#endif + static unsigned int ifx_tapi_poll (struct file *filp, poll_table *table); + + #ifdef CONFIG_PROC_FS +@@ -213,7 +218,11 @@ IFX_char_t *pRegDrvName = IFX_NULL; IFX_int32_t ret = 0; -- if (tapi_fops.ioctl == IFX_NULL) ++#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,36)) + if (tapi_fops.ioctl == IFX_NULL) ++#else + if (tapi_fops.unlocked_ioctl == IFX_NULL) ++#endif { #ifdef MODULE tapi_fops.owner = THIS_MODULE; -@@ -221,7 +221,7 @@ +@@ -221,7 +230,11 @@ tapi_fops.read = ifx_tapi_read; tapi_fops.write = ifx_tapi_write; tapi_fops.poll = ifx_tapi_poll; -- tapi_fops.ioctl = ifx_tapi_ioctl; ++#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,36)) + tapi_fops.ioctl = ifx_tapi_ioctl; ++#else + tapi_fops.unlocked_ioctl = ifx_tapi_ioctl; ++#endif tapi_fops.open = ifx_tapi_open; tapi_fops.release = ifx_tapi_release; } +@@ -876,8 +889,13 @@ + - 0 and positive values - success + - negative value - ioctl failed + */ ++#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,36)) + static int ifx_tapi_ioctl(struct inode *inode, struct file *filp, + unsigned int nCmd, unsigned long nArg) ++#else ++static int ifx_tapi_ioctl(struct file *filp, ++ unsigned int nCmd, unsigned long nArg) ++#endif + { + TAPI_FD_PRIV_DATA_t *pTapiPriv; + IFX_TAPI_ioctlCtx_t ctx; --- a/src/lib/lib_fifo/lib_fifo.c +++ b/src/lib/lib_fifo/lib_fifo.c @@ -41,7 +41,7 @@ diff --git a/package/ltq-vmmc/patches/200-kernel-37.patch b/package/ltq-vmmc/patches/200-kernel-37.patch index b89da4691a..e4878f66cc 100644 --- a/package/ltq-vmmc/patches/200-kernel-37.patch +++ b/package/ltq-vmmc/patches/200-kernel-37.patch @@ -1,5 +1,14 @@ --- a/src/drv_vmmc_init.c +++ b/src/drv_vmmc_init.c +@@ -784,7 +784,7 @@ + dwld.fwDwld.length = IoInit.pram_size; + + /* download firmware */ +- ret = ifx_mps_ioctl((IFX_void_t *) command, IFX_NULL, FIO_MPS_DOWNLOAD, ++ ret = ifx_mps_ioctl((IFX_void_t *) command, FIO_MPS_DOWNLOAD, + (IFX_uint32_t) &dwld.fwDwld); + } + @@ -1594,7 +1594,7 @@ #ifdef VMMC_DRIVER_UNLOAD_HOOK if (VDevices[0].nDevState & DS_GPIO_RESERVED) @@ -11,6 +20,15 @@ { --- a/src/mps/drv_mps_vmmc_linux.c +++ b/src/mps/drv_mps_vmmc_linux.c +@@ -112,7 +112,7 @@ + #ifndef __KERNEL__ + IFX_int32_t ifx_mps_open (struct inode *inode, struct file *file_p); + IFX_int32_t ifx_mps_close (struct inode *inode, struct file *file_p); +-IFX_int32_t ifx_mps_ioctl (struct inode *inode, struct file *file_p, ++long ifx_mps_ioctl (struct file *file_p, + IFX_uint32_t nCmd, IFX_ulong_t arg); + IFX_int32_t ifx_mps_read_mailbox (mps_devices type, mps_message * rw); + IFX_int32_t ifx_mps_write_mailbox (mps_devices type, mps_message * rw); @@ -173,7 +173,7 @@ static struct file_operations ifx_mps_fops = { owner:THIS_MODULE, @@ -20,3 +38,69 @@ open:ifx_mps_open, release:ifx_mps_close }; +@@ -616,7 +616,7 @@ + * \return -ENOIOCTLCMD Invalid command + * \ingroup API + */ +-IFX_int32_t ifx_mps_ioctl (struct inode * inode, struct file * file_p, ++long ifx_mps_ioctl (struct file *file_p, + IFX_uint32_t nCmd, IFX_ulong_t arg) + { + IFX_int32_t retvalue = -EINVAL; +@@ -631,17 +631,18 @@ + 'mps_devices' enum type, which in fact is [0..8]; So, if inode value is + [0..NUM_VOICE_CHANNEL+1], then we make sure that we are calling from + kernel space. */ +- if (((IFX_int32_t) inode >= 0) && +- ((IFX_int32_t) inode < NUM_VOICE_CHANNEL + 1)) ++ if (((IFX_int32_t) file_p >= 0) && ++ ((IFX_int32_t) file_p < NUM_VOICE_CHANNEL + 1)) + { + from_kernel = 1; + + /* Get corresponding mailbox device structure */ + if ((pMBDev = +- ifx_mps_get_device ((mps_devices) ((IFX_int32_t) inode))) == 0) ++ ifx_mps_get_device ((mps_devices) ((IFX_int32_t) file_p))) == 0) + { + return (-EINVAL); + } ++ file_p = NULL; + } + else + { +--- a/src/drv_vmmc_ioctl.c ++++ b/src/drv_vmmc_ioctl.c +@@ -427,18 +427,18 @@ + /* MPS driver will do the USR2KERN so just pass on the pointer. */ + dwnld_struct.data = (IFX_void_t *)IoInit.pPRAMfw; + +- ret = ifx_mps_ioctl((IFX_void_t *)command, IFX_NULL, ++ ret = ifx_mps_ioctl((IFX_void_t *)command, + FIO_MPS_DOWNLOAD, (IFX_uint32_t) &dwnld_struct); + break; + } + case FIO_DEV_RESET: + { +- ret = ifx_mps_ioctl((IFX_void_t *)command, IFX_NULL, FIO_MPS_RESET, 0); ++ ret = ifx_mps_ioctl((IFX_void_t *)command, FIO_MPS_RESET, 0); + break; + } + case FIO_DEV_RESTART: + { +- ret = ifx_mps_ioctl((IFX_void_t *)command, IFX_NULL, FIO_MPS_RESTART, 0); ++ ret = ifx_mps_ioctl((IFX_void_t *)command, FIO_MPS_RESTART, 0); + break; + } + case FIO_LASTERR: +--- a/src/mps/drv_mps_vmmc.h ++++ b/src/mps/drv_mps_vmmc.h +@@ -279,7 +279,7 @@ + #include + IFX_int32_t ifx_mps_open (struct inode *inode, struct file *file_p); + IFX_int32_t ifx_mps_close (struct inode *inode, struct file *filp); +-IFX_int32_t ifx_mps_ioctl (struct inode *inode, struct file *file_p, ++long ifx_mps_ioctl (struct file *filp, + IFX_uint32_t nCmd, unsigned long arg); + IFX_int32_t ifx_mps_register_data_callback (mps_devices type, IFX_uint32_t dir, + IFX_void_t (*callback) (mps_devices