1
0
mirror of git://projects.qi-hardware.com/openwrt-xburst.git synced 2024-11-16 19:45:00 +02:00
openwrt-xburst/package/system/ltq-vmmc/patches/000-portability.patch
blogic 4f2090ad48 [kernel] move lots of kernel related packages to the new system/ folder
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@33830 3c298f89-4303-0410-b956-a3cf2f4a3e73
2012-10-17 22:45:58 +00:00

288 lines
9.8 KiB
Diff

--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -228,7 +228,7 @@ drv_vmmc_CFLAGS += -fno-common
drv_vmmc_OBJS = "$(subst .c,.o, $(drv_vmmc_SOURCES) $(nodist_drv_vmmc_SOURCES))"
drv_vmmc.ko: $(drv_vmmc_SOURCES) $(EXTRA_DIST)
- @echo -e "Making Linux 2.6.x kernel object"
+ @echo "Making Linux 2.6.x kernel object"
@for f in $(drv_vmmc_SOURCES) $(nodist_drv_vmmc_SOURCES) ; do \
if test ! -e $(PWD)/$$f; then \
echo " LN $$f" ; \
@@ -236,10 +236,10 @@ drv_vmmc.ko: $(drv_vmmc_SOURCES) $(EXTRA
ln -s @abs_srcdir@/$$f $(PWD)/$$f; \
fi; \
done;
- @echo -e "# drv_vmmc: Generated to build Linux 2.6.x kernel object" > $(PWD)/Kbuild
- @echo -e "obj-m := $(subst .ko,.o,$@)" >> $(PWD)/Kbuild
- @echo -e "$(subst .ko,,$@)-y := $(drv_vmmc_OBJS)" >> $(PWD)/Kbuild
- @echo -e "EXTRA_CFLAGS := -DHAVE_CONFIG_H $(CFLAGS) $(drv_vmmc_CFLAGS) $(INCLUDES)" >> $(PWD)/Kbuild
+ @echo "# drv_vmmc: Generated to build Linux 2.6.x kernel object" > $(PWD)/Kbuild
+ @echo "obj-m := $(subst .ko,.o,$@)" >> $(PWD)/Kbuild
+ @echo "$(subst .ko,,$@)-y := $(drv_vmmc_OBJS)" >> $(PWD)/Kbuild
+ @echo "EXTRA_CFLAGS := -DHAVE_CONFIG_H $(CFLAGS) $(drv_vmmc_CFLAGS) $(INCLUDES)" >> $(PWD)/Kbuild
$(MAKE) ARCH=@KERNEL_ARCH@ -C @KERNEL_BUILD_PATH@ O=@KERNEL_BUILD_PATH@ M=$(PWD) modules
clean-generic:
--- a/src/drv_vmmc_linux.c
+++ b/src/drv_vmmc_linux.c
@@ -27,11 +27,18 @@
#include <linux/proc_fs.h>
#include <linux/wait.h>
#include <linux/vmalloc.h>
+#include <linux/sched.h>
#ifdef LINUX_2_6
#include <linux/version.h>
#ifndef UTS_RELEASE
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,33))
+#include <linux/autoconf.h>
#include <linux/utsrelease.h>
+#else
+#include <generated/autoconf.h>
+#include <generated/utsrelease.h>
+#endif
#endif /* UTC_RELEASE */
#undef CONFIG_DEVFS_FS
#endif /* LINUX_2_6 */
--- a/src/mps/drv_mps_vmmc_linux.c
+++ b/src/mps/drv_mps_vmmc_linux.c
@@ -19,11 +19,22 @@
#include "drv_config.h"
#include "drv_mps_version.h"
+#include <linux/version.h>
#ifdef CONFIG_DEBUG_MINI_BOOT
#define IKOS_MINI_BOOT
#endif /* */
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,33))
#include <linux/autoconf.h>
+#ifndef UTS_RELEASE
+#include <linux/utsrelease.h>
+#endif
+#else
+#include <generated/autoconf.h>
+#ifndef UTS_RELEASE
+#include <generated/utsrelease.h>
+#endif
+#endif
#include <linux/module.h>
#include <linux/init.h>
#include <linux/poll.h>
@@ -34,7 +45,13 @@
#include <linux/delay.h>
#include <linux/interrupt.h>
#ifdef LINUX_2_6
+#ifndef UTS_RELEASE
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 33)
#include <linux/utsrelease.h>
+#else
+#include <generated/utsrelease.h>
+#endif
+#endif /* UTC_RELEASE */
#else /* */
#include <linux/uts.h>
#include <linux/moduleparam.h>
@@ -94,8 +111,13 @@ IFX_int32_t ifx_mps_get_status_proc (IFX
#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);
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 37)
IFX_int32_t ifx_mps_ioctl (struct inode *inode, struct file *file_p,
IFX_uint32_t nCmd, IFX_ulong_t arg);
+#else
+long ifx_mps_ioctl (struct file *file_p,
+ IFX_uint32_t nCmd, IFX_ulong_t arg);
+#endif
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);
IFX_int32_t ifx_mps_register_data_callback (mps_devices type, IFX_uint32_t dir,
@@ -155,7 +177,11 @@ IFX_char_t voice_channel_int_name[NUM_VO
static struct file_operations ifx_mps_fops = {
owner:THIS_MODULE,
poll:ifx_mps_poll,
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 37)
ioctl:ifx_mps_ioctl,
+#else
+ unlocked_ioctl:ifx_mps_ioctl,
+#endif
open:ifx_mps_open,
release:ifx_mps_close
};
@@ -598,8 +624,13 @@ static IFX_uint32_t ifx_mps_poll (struct
* \return -ENOIOCTLCMD Invalid command
* \ingroup API
*/
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 37)
IFX_int32_t ifx_mps_ioctl (struct inode * inode, struct file * file_p,
IFX_uint32_t nCmd, IFX_ulong_t arg)
+#else
+long ifx_mps_ioctl (struct file *file_p,
+ IFX_uint32_t nCmd, IFX_ulong_t arg)
+#endif
{
IFX_int32_t retvalue = -EINVAL;
mps_message rw_struct;
@@ -613,17 +644,30 @@ IFX_int32_t ifx_mps_ioctl (struct inode
'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 LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 37)
if (((IFX_int32_t) inode >= 0) &&
((IFX_int32_t) inode < NUM_VOICE_CHANNEL + 1))
+#else
+ if (((IFX_int32_t) file_p >= 0) &&
+ ((IFX_int32_t) file_p < NUM_VOICE_CHANNEL + 1))
+#endif
{
from_kernel = 1;
/* Get corresponding mailbox device structure */
if ((pMBDev =
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 37)
ifx_mps_get_device ((mps_devices) ((IFX_int32_t) inode))) == 0)
+#else
+ ifx_mps_get_device ((mps_devices) ((IFX_int32_t) file_p))) == 0)
+#endif
{
return (-EINVAL);
}
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 37)
+#else
+ file_p = NULL;
+#endif
}
else
{
--- a/src/mps/drv_mps_vmmc_common.c
+++ b/src/mps/drv_mps_vmmc_common.c
@@ -21,7 +21,11 @@
#undef USE_PLAIN_VOICE_FIRMWARE
#undef PRINT_ON_ERR_INTERRUPT
#undef FAIL_ON_ERR_INTERRUPT
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,33))
#include <linux/autoconf.h>
+#else
+#include <generated/autoconf.h>
+#endif
#include <linux/interrupt.h>
#include <linux/delay.h>
@@ -92,7 +96,9 @@ extern IFX_uint32_t danube_get_cpu_ver (
extern mps_mbx_dev *ifx_mps_get_device (mps_devices type);
#ifdef LINUX_2_6
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,39))
extern IFX_void_t bsp_mask_and_ack_irq (IFX_uint32_t irq_nr);
+#endif
#else /* */
extern IFX_void_t mask_and_ack_danube_irq (IFX_uint32_t irq_nr);
--- a/src/mps/drv_mps_vmmc_danube.c
+++ b/src/mps/drv_mps_vmmc_danube.c
@@ -20,7 +20,11 @@
#ifdef SYSTEM_DANUBE /* defined in drv_mps_vmmc_config.h */
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,33))
#include <linux/autoconf.h>
+#else
+#include <generated/autoconf.h>
+#endif
/* lib_ifxos headers */
#include "ifx_types.h"
--- a/configure.in
+++ b/configure.in
@@ -112,7 +112,7 @@ dnl Set kernel build path
AC_ARG_ENABLE(kernelbuild,
AS_HELP_STRING(--enable-kernelbuild=x,Set the target kernel build path),
[
- if test -r $enableval/include/linux/autoconf.h; then
+ if test -e $enableval/include/linux/autoconf.h -o -e $enableval/include/generated/autoconf.h; then
AC_SUBST([KERNEL_BUILD_PATH],[$enableval])
else
AC_MSG_ERROR([The kernel build directory is not valid or not configured!])
--- a/src/drv_vmmc_bbd.c
+++ b/src/drv_vmmc_bbd.c
@@ -1072,7 +1072,11 @@ static IFX_int32_t vmmc_BBD_DownloadChCr
IFX_uint8_t padBytes = 0;
#endif
IFX_uint16_t cram_offset, cram_crc,
- pCmd [MAX_CMD_WORD] = {0};
+ pCmd [MAX_CMD_WORD]
+#if defined (__GNUC__) || defined (__GNUG__)
+ __attribute__ ((aligned(4)))
+#endif
+ = {0};
/* read offset */
cpb2w (&cram_offset, &bbd_cram->pData[0], sizeof (IFX_uint16_t));
--- a/src/drv_vmmc_init.c
+++ b/src/drv_vmmc_init.c
@@ -776,8 +776,13 @@ IFX_int32_t VMMC_TAPI_LL_FW_Start(IFX_TA
dwld.fwDwld.length = IoInit.pram_size;
/* download firmware */
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 37)
ret = ifx_mps_ioctl((IFX_void_t *) command, IFX_NULL, FIO_MPS_DOWNLOAD,
(IFX_uint32_t) &dwld.fwDwld);
+#else
+ ret = ifx_mps_ioctl((IFX_void_t *) command, FIO_MPS_DOWNLOAD,
+ (IFX_uint32_t) &dwld.fwDwld);
+#endif
}
if (VMMC_SUCCESS(ret))
--- a/src/drv_vmmc_ioctl.c
+++ b/src/drv_vmmc_ioctl.c
@@ -426,18 +426,31 @@ IFX_int32_t VMMC_Dev_Spec_Ioctl (IFX_TAP
/* MPS driver will do the USR2KERN so just pass on the pointer. */
dwnld_struct.data = (IFX_void_t *)IoInit.pPRAMfw;
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 37)
ret = ifx_mps_ioctl((IFX_void_t *)command, IFX_NULL,
FIO_MPS_DOWNLOAD, (IFX_uint32_t) &dwnld_struct);
+#else
+ ret = ifx_mps_ioctl((IFX_void_t *)command,
+ FIO_MPS_DOWNLOAD, (IFX_uint32_t) &dwnld_struct);
+#endif
break;
}
case FIO_DEV_RESET:
{
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 37)
ret = ifx_mps_ioctl((IFX_void_t *)command, IFX_NULL, FIO_MPS_RESET, 0);
+#else
+ ret = ifx_mps_ioctl((IFX_void_t *)command, FIO_MPS_RESET, 0);
+#endif
break;
}
case FIO_DEV_RESTART:
{
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 37)
ret = ifx_mps_ioctl((IFX_void_t *)command, IFX_NULL, FIO_MPS_RESTART, 0);
+#else
+ ret = ifx_mps_ioctl((IFX_void_t *)command, FIO_MPS_RESTART, 0);
+#endif
break;
}
case FIO_LASTERR:
--- a/src/mps/drv_mps_vmmc.h
+++ b/src/mps/drv_mps_vmmc.h
@@ -279,8 +279,13 @@ typedef struct
#include <linux/fs.h>
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);
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 37)
IFX_int32_t ifx_mps_ioctl (struct inode *inode, struct file *file_p,
IFX_uint32_t nCmd, unsigned long arg);
+#else
+long ifx_mps_ioctl (struct file *filp,
+ IFX_uint32_t nCmd, unsigned long arg);
+#endif
IFX_int32_t ifx_mps_register_data_callback (mps_devices type, IFX_uint32_t dir,
IFX_void_t (*callback) (mps_devices
type));