package/base-files-network: use new service wrappers
[openwrt.git] / package / ltq-vmmc / patches / 000-portability.patch
1 --- a/src/Makefile.am
2 +++ b/src/Makefile.am
3 @@ -228,7 +228,7 @@ drv_vmmc_CFLAGS += -fno-common
4 drv_vmmc_OBJS = "$(subst .c,.o, $(drv_vmmc_SOURCES) $(nodist_drv_vmmc_SOURCES))"
5
6 drv_vmmc.ko: $(drv_vmmc_SOURCES) $(EXTRA_DIST)
7 - @echo -e "Making Linux 2.6.x kernel object"
8 + @echo "Making Linux 2.6.x kernel object"
9 @for f in $(drv_vmmc_SOURCES) $(nodist_drv_vmmc_SOURCES) ; do \
10 if test ! -e $(PWD)/$$f; then \
11 echo " LN $$f" ; \
12 @@ -236,10 +236,10 @@ drv_vmmc.ko: $(drv_vmmc_SOURCES) $(EXTRA
13 ln -s @abs_srcdir@/$$f $(PWD)/$$f; \
14 fi; \
15 done;
16 - @echo -e "# drv_vmmc: Generated to build Linux 2.6.x kernel object" > $(PWD)/Kbuild
17 - @echo -e "obj-m := $(subst .ko,.o,$@)" >> $(PWD)/Kbuild
18 - @echo -e "$(subst .ko,,$@)-y := $(drv_vmmc_OBJS)" >> $(PWD)/Kbuild
19 - @echo -e "EXTRA_CFLAGS := -DHAVE_CONFIG_H $(CFLAGS) $(drv_vmmc_CFLAGS) $(INCLUDES)" >> $(PWD)/Kbuild
20 + @echo "# drv_vmmc: Generated to build Linux 2.6.x kernel object" > $(PWD)/Kbuild
21 + @echo "obj-m := $(subst .ko,.o,$@)" >> $(PWD)/Kbuild
22 + @echo "$(subst .ko,,$@)-y := $(drv_vmmc_OBJS)" >> $(PWD)/Kbuild
23 + @echo "EXTRA_CFLAGS := -DHAVE_CONFIG_H $(CFLAGS) $(drv_vmmc_CFLAGS) $(INCLUDES)" >> $(PWD)/Kbuild
24 $(MAKE) ARCH=@KERNEL_ARCH@ -C @KERNEL_BUILD_PATH@ O=@KERNEL_BUILD_PATH@ M=$(PWD) modules
25
26 clean-generic:
27 --- a/src/drv_vmmc_linux.c
28 +++ b/src/drv_vmmc_linux.c
29 @@ -27,11 +27,18 @@
30 #include <linux/proc_fs.h>
31 #include <linux/wait.h>
32 #include <linux/vmalloc.h>
33 +#include <linux/sched.h>
34
35 #ifdef LINUX_2_6
36 #include <linux/version.h>
37 #ifndef UTS_RELEASE
38 +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,33))
39 +#include <linux/autoconf.h>
40 #include <linux/utsrelease.h>
41 +#else
42 +#include <generated/autoconf.h>
43 +#include <generated/utsrelease.h>
44 +#endif
45 #endif /* UTC_RELEASE */
46 #undef CONFIG_DEVFS_FS
47 #endif /* LINUX_2_6 */
48 --- a/src/mps/drv_mps_vmmc_linux.c
49 +++ b/src/mps/drv_mps_vmmc_linux.c
50 @@ -19,11 +19,22 @@
51 #include "drv_config.h"
52
53 #include "drv_mps_version.h"
54 +#include <linux/version.h>
55
56 #ifdef CONFIG_DEBUG_MINI_BOOT
57 #define IKOS_MINI_BOOT
58 #endif /* */
59 +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,33))
60 #include <linux/autoconf.h>
61 +#ifndef UTS_RELEASE
62 +#include <linux/utsrelease.h>
63 +#endif
64 +#else
65 +#include <generated/autoconf.h>
66 +#ifndef UTS_RELEASE
67 +#include <generated/utsrelease.h>
68 +#endif
69 +#endif
70 #include <linux/module.h>
71 #include <linux/init.h>
72 #include <linux/poll.h>
73 @@ -34,7 +45,13 @@
74 #include <linux/delay.h>
75 #include <linux/interrupt.h>
76 #ifdef LINUX_2_6
77 +#ifndef UTS_RELEASE
78 +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 33)
79 #include <linux/utsrelease.h>
80 +#else
81 +#include <generated/utsrelease.h>
82 +#endif
83 +#endif /* UTC_RELEASE */
84 #else /* */
85 #include <linux/uts.h>
86 #include <linux/moduleparam.h>
87 @@ -94,8 +111,13 @@ IFX_int32_t ifx_mps_get_status_proc (IFX
88 #ifndef __KERNEL__
89 IFX_int32_t ifx_mps_open (struct inode *inode, struct file *file_p);
90 IFX_int32_t ifx_mps_close (struct inode *inode, struct file *file_p);
91 +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 37)
92 IFX_int32_t ifx_mps_ioctl (struct inode *inode, struct file *file_p,
93 IFX_uint32_t nCmd, IFX_ulong_t arg);
94 +#else
95 +long ifx_mps_ioctl (struct file *file_p,
96 + IFX_uint32_t nCmd, IFX_ulong_t arg);
97 +#endif
98 IFX_int32_t ifx_mps_read_mailbox (mps_devices type, mps_message * rw);
99 IFX_int32_t ifx_mps_write_mailbox (mps_devices type, mps_message * rw);
100 IFX_int32_t ifx_mps_register_data_callback (mps_devices type, IFX_uint32_t dir,
101 @@ -155,7 +177,11 @@ IFX_char_t voice_channel_int_name[NUM_VO
102 static struct file_operations ifx_mps_fops = {
103 owner:THIS_MODULE,
104 poll:ifx_mps_poll,
105 +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 37)
106 ioctl:ifx_mps_ioctl,
107 +#else
108 + unlocked_ioctl:ifx_mps_ioctl,
109 +#endif
110 open:ifx_mps_open,
111 release:ifx_mps_close
112 };
113 @@ -598,8 +624,13 @@ static IFX_uint32_t ifx_mps_poll (struct
114 * \return -ENOIOCTLCMD Invalid command
115 * \ingroup API
116 */
117 +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 37)
118 IFX_int32_t ifx_mps_ioctl (struct inode * inode, struct file * file_p,
119 IFX_uint32_t nCmd, IFX_ulong_t arg)
120 +#else
121 +long ifx_mps_ioctl (struct file *file_p,
122 + IFX_uint32_t nCmd, IFX_ulong_t arg)
123 +#endif
124 {
125 IFX_int32_t retvalue = -EINVAL;
126 mps_message rw_struct;
127 @@ -613,17 +644,30 @@ IFX_int32_t ifx_mps_ioctl (struct inode
128 'mps_devices' enum type, which in fact is [0..8]; So, if inode value is
129 [0..NUM_VOICE_CHANNEL+1], then we make sure that we are calling from
130 kernel space. */
131 +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 37)
132 if (((IFX_int32_t) inode >= 0) &&
133 ((IFX_int32_t) inode < NUM_VOICE_CHANNEL + 1))
134 +#else
135 + if (((IFX_int32_t) file_p >= 0) &&
136 + ((IFX_int32_t) file_p < NUM_VOICE_CHANNEL + 1))
137 +#endif
138 {
139 from_kernel = 1;
140
141 /* Get corresponding mailbox device structure */
142 if ((pMBDev =
143 +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 37)
144 ifx_mps_get_device ((mps_devices) ((IFX_int32_t) inode))) == 0)
145 +#else
146 + ifx_mps_get_device ((mps_devices) ((IFX_int32_t) file_p))) == 0)
147 +#endif
148 {
149 return (-EINVAL);
150 }
151 +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 37)
152 +#else
153 + file_p = NULL;
154 +#endif
155 }
156 else
157 {
158 --- a/src/mps/drv_mps_vmmc_common.c
159 +++ b/src/mps/drv_mps_vmmc_common.c
160 @@ -21,7 +21,11 @@
161 #undef USE_PLAIN_VOICE_FIRMWARE
162 #undef PRINT_ON_ERR_INTERRUPT
163 #undef FAIL_ON_ERR_INTERRUPT
164 +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,33))
165 #include <linux/autoconf.h>
166 +#else
167 +#include <generated/autoconf.h>
168 +#endif
169 #include <linux/interrupt.h>
170 #include <linux/delay.h>
171
172 @@ -92,7 +96,9 @@ extern IFX_uint32_t danube_get_cpu_ver (
173 extern mps_mbx_dev *ifx_mps_get_device (mps_devices type);
174
175 #ifdef LINUX_2_6
176 +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,39))
177 extern IFX_void_t bsp_mask_and_ack_irq (IFX_uint32_t irq_nr);
178 +#endif
179
180 #else /* */
181 extern IFX_void_t mask_and_ack_danube_irq (IFX_uint32_t irq_nr);
182 --- a/src/mps/drv_mps_vmmc_danube.c
183 +++ b/src/mps/drv_mps_vmmc_danube.c
184 @@ -20,7 +20,11 @@
185
186 #ifdef SYSTEM_DANUBE /* defined in drv_mps_vmmc_config.h */
187
188 +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,33))
189 #include <linux/autoconf.h>
190 +#else
191 +#include <generated/autoconf.h>
192 +#endif
193
194 /* lib_ifxos headers */
195 #include "ifx_types.h"
196 --- a/configure.in
197 +++ b/configure.in
198 @@ -112,7 +112,7 @@ dnl Set kernel build path
199 AC_ARG_ENABLE(kernelbuild,
200 AS_HELP_STRING(--enable-kernelbuild=x,Set the target kernel build path),
201 [
202 - if test -r $enableval/include/linux/autoconf.h; then
203 + if test -e $enableval/include/linux/autoconf.h -o -e $enableval/include/generated/autoconf.h; then
204 AC_SUBST([KERNEL_BUILD_PATH],[$enableval])
205 else
206 AC_MSG_ERROR([The kernel build directory is not valid or not configured!])
207 --- a/src/drv_vmmc_bbd.c
208 +++ b/src/drv_vmmc_bbd.c
209 @@ -1072,7 +1072,11 @@ static IFX_int32_t vmmc_BBD_DownloadChCr
210 IFX_uint8_t padBytes = 0;
211 #endif
212 IFX_uint16_t cram_offset, cram_crc,
213 - pCmd [MAX_CMD_WORD] = {0};
214 + pCmd [MAX_CMD_WORD]
215 +#if defined (__GNUC__) || defined (__GNUG__)
216 + __attribute__ ((aligned(4)))
217 +#endif
218 + = {0};
219
220 /* read offset */
221 cpb2w (&cram_offset, &bbd_cram->pData[0], sizeof (IFX_uint16_t));
222 --- a/src/drv_vmmc_init.c
223 +++ b/src/drv_vmmc_init.c
224 @@ -776,8 +776,13 @@ IFX_int32_t VMMC_TAPI_LL_FW_Start(IFX_TA
225 dwld.fwDwld.length = IoInit.pram_size;
226
227 /* download firmware */
228 +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 37)
229 ret = ifx_mps_ioctl((IFX_void_t *) command, IFX_NULL, FIO_MPS_DOWNLOAD,
230 (IFX_uint32_t) &dwld.fwDwld);
231 +#else
232 + ret = ifx_mps_ioctl((IFX_void_t *) command, FIO_MPS_DOWNLOAD,
233 + (IFX_uint32_t) &dwld.fwDwld);
234 +#endif
235 }
236
237 if (VMMC_SUCCESS(ret))
238 --- a/src/drv_vmmc_ioctl.c
239 +++ b/src/drv_vmmc_ioctl.c
240 @@ -426,18 +426,31 @@ IFX_int32_t VMMC_Dev_Spec_Ioctl (IFX_TAP
241 /* MPS driver will do the USR2KERN so just pass on the pointer. */
242 dwnld_struct.data = (IFX_void_t *)IoInit.pPRAMfw;
243
244 +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 37)
245 ret = ifx_mps_ioctl((IFX_void_t *)command, IFX_NULL,
246 FIO_MPS_DOWNLOAD, (IFX_uint32_t) &dwnld_struct);
247 +#else
248 + ret = ifx_mps_ioctl((IFX_void_t *)command,
249 + FIO_MPS_DOWNLOAD, (IFX_uint32_t) &dwnld_struct);
250 +#endif
251 break;
252 }
253 case FIO_DEV_RESET:
254 {
255 +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 37)
256 ret = ifx_mps_ioctl((IFX_void_t *)command, IFX_NULL, FIO_MPS_RESET, 0);
257 +#else
258 + ret = ifx_mps_ioctl((IFX_void_t *)command, FIO_MPS_RESET, 0);
259 +#endif
260 break;
261 }
262 case FIO_DEV_RESTART:
263 {
264 +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 37)
265 ret = ifx_mps_ioctl((IFX_void_t *)command, IFX_NULL, FIO_MPS_RESTART, 0);
266 +#else
267 + ret = ifx_mps_ioctl((IFX_void_t *)command, FIO_MPS_RESTART, 0);
268 +#endif
269 break;
270 }
271 case FIO_LASTERR:
272 --- a/src/mps/drv_mps_vmmc.h
273 +++ b/src/mps/drv_mps_vmmc.h
274 @@ -279,8 +279,13 @@ typedef struct
275 #include <linux/fs.h>
276 IFX_int32_t ifx_mps_open (struct inode *inode, struct file *file_p);
277 IFX_int32_t ifx_mps_close (struct inode *inode, struct file *filp);
278 +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 37)
279 IFX_int32_t ifx_mps_ioctl (struct inode *inode, struct file *file_p,
280 IFX_uint32_t nCmd, unsigned long arg);
281 +#else
282 +long ifx_mps_ioctl (struct file *filp,
283 + IFX_uint32_t nCmd, unsigned long arg);
284 +#endif
285 IFX_int32_t ifx_mps_register_data_callback (mps_devices type, IFX_uint32_t dir,
286 IFX_void_t (*callback) (mps_devices
287 type));
This page took 0.054571 seconds and 5 git commands to generate.