updated on Mon Jan 23 12:00:23 UTC 2012
[aur-mirror.git] / svgalib / svgalib-1.9.25-linux2.6.patch
blob4f34b4c6678f7003b4ced7a8e5754c871fb6d530
1 - get rid of warning when linux/device.h doesnt exist
2 - touch up the Makefile to let the ebuild handle the module details
3 - fix support with io remap stuff in newer kernels
4 - dont include headers that dont exist in 2.4.x kernels
5 - use module_param() for 2.6.x and MODULE_PARM() for all others
6 - dont declare all_devices as static since it is exported
7 - dont include <linux/config.h> as the build system does it for us
8 - in lrmi, map old flag names to new names for versions >= 2.6.26
10 --- src/svgalib-1.9.25/kernel/svgalib_helper/Makefile
11 +++ src/svgalib-1.9.25/kernel/svgalib_helper/Makefile
12 @@ -25,7 +25,7 @@
13 endif
16 -CLASS_SIMPLE := $(shell grep class_simple_create $(KDIR)/include/linux/device.h)
17 +CLASS_SIMPLE := $(shell grep -s class_simple_create $(KDIR)/include/linux/device.h)
19 ifneq ($(CLASS_SIMPLE),)
20 CLASS_CFLAGS = -DCLASS_SIMPLE=1
21 --- src/svgalib-1.9.25/kernel/svgalib_helper/Makefile.alt
22 +++ src/svgalib-1.9.25/kernel/svgalib_helper/Makefile.alt
23 @@ -37,7 +37,7 @@
24 CFLAGS += -DSVGALIB_HELPER_MAJOR=$(SVGALIB_HELPER_MAJOR)
26 ifeq (1,$(findstring 1,$(MODVER)))
27 - CFLAGS += -DMODVERSIONS -include $(INCLUDEDIR)/linux/modversions.h
28 + CFLAGS += -DMODVERSIONS -DCONFIG_MODVERSIONS=1
29 endif
31 TARGET = svgalib_helper
32 @@ -50,7 +50,8 @@
33 endif
34 endif
36 -all: .depend $(OBJS)
37 +modules: $(OBJS)
38 +all: .depend modules
40 $(TARGET).o: $(SRC:.c=.o)
41 $(LD) -r $^ -o $@
42 @@ -61,8 +62,8 @@
43 install: device modules_install
45 modules_install: $(OBJS)
46 - mkdir -p /lib/modules/$(VER)/kernel/misc
47 - install -m 0644 -c $(OBJS) /lib/modules/$(VER)/kernel/misc
48 + mkdir -p $(TOPDIR)/lib/modules/$(VER)/kernel/misc
49 + install -m 0644 -c $(OBJS) $(TOPDIR)/lib/modules/$(VER)/kernel/misc
51 device:
52 rm -f /dev/svgalib_helper* /dev/svga_helper* /dev/svga /dev/svga?
53 --- src/svgalib-1.9.25/kernel/svgalib_helper/kernel26compat.h
54 +++ src/svgalib-1.9.25/kernel/svgalib_helper/kernel26compat.h
55 @@ -10,7 +10,7 @@
56 # define PCI_GET_CLASS pci_find_class
57 # define PCI_GET_DEVICE pci_find_device
59 -# if defined (PG_chainlock)
60 +# if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,3)
61 # define my_io_remap_page_range(vma, start, ofs, len, prot) \
62 io_remap_page_range(vma,start,ofs,len,prot)
63 # else
64 @@ -70,6 +70,7 @@
66 /* These are also not present in 2.6 kernels ... */
67 #if (!defined _LINUX_DEVFS_FS_KERNEL_H) || (defined KERNEL_2_6)
68 +#include <linux/fs.h>
69 static inline int devfs_register_chrdev (unsigned int major, const char *name,
70 struct file_operations *fops)
72 @@ -77,7 +78,12 @@
74 static inline int devfs_unregister_chrdev (unsigned int major,const char *name)
76 - return unregister_chrdev (major, name);
77 +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
78 + return unregister_chrdev (major, name);
79 +#else
80 + unregister_chrdev (major, name);
81 + return 0;
82 +#endif
84 #endif
86 @@ -99,7 +105,8 @@
87 class_device_create(svgalib_helper_class, \
88 MKDEV(SVGALIB_HELPER_MAJOR, _minor), \
89 &sh_pci_devs[_minor]->dev->dev, _name);
90 -#else /* 2.6.15 changed class_device_create */
91 +/* 2.6.15 changed class_device_create */
92 +#elif LINUX_VERSION_CODE < KERNEL_VERSION(2,6,26)
93 # define SLH_SYSFS_ADD_CONTROL \
94 class_device_create(svgalib_helper_class, NULL, \
95 MKDEV(SVGALIB_HELPER_MAJOR, 0), \
96 @@ -109,7 +116,30 @@
97 class_device_create(svgalib_helper_class, NULL, \
98 MKDEV(SVGALIB_HELPER_MAJOR, _minor), \
99 &sh_pci_devs[_minor]->dev->dev, _name);
100 -#endif /* 2.6.15 */
101 +/* 2.6.26 changed class_device_create to device_create */
102 +#elif LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27)
103 +# define SLH_SYSFS_ADD_CONTROL \
104 + device_create(svgalib_helper_class, NULL, \
105 + MKDEV(SVGALIB_HELPER_MAJOR, 0), \
106 + "svga");
108 +# define SLH_SYSFS_ADD_DEVICE(_name, _minor) \
109 + device_create(svgalib_helper_class, &sh_pci_devs[_minor]->dev->dev, \
110 + MKDEV(SVGALIB_HELPER_MAJOR, _minor), \
111 + _name);
112 +/* 2.6.27 changed device_create to device_create_drvdata */
113 +#else
114 +# define SLH_SYSFS_ADD_CONTROL \
115 + device_create_drvdata(svgalib_helper_class, NULL, \
116 + MKDEV(SVGALIB_HELPER_MAJOR, 0), \
117 + "%s%d", "svga", 0);
119 +# define SLH_SYSFS_ADD_DEVICE(_name, _minor) \
120 + device_create_drvdata(svgalib_helper_class, \
121 + &sh_pci_devs[_minor]->dev->dev, \
122 + MKDEV(SVGALIB_HELPER_MAJOR, _minor), \
123 + "%s%d", _name, _minor);
124 +#endif
126 # define SLH_SYSFS_REMOVE_DEVICE(i) \
127 class_destroy(svgalib_helper_class);
128 @@ -161,3 +191,7 @@
129 #ifndef PCI_VENDOR_ID_RENDITION
130 #define PCI_VENDOR_ID_RENDITION 0x1163
131 #endif
133 +#ifndef IRQF_SHARED
134 +# define IRQF_SHARED SA_SHIRQ
135 +#endif
136 --- src/svgalib-1.9.25/kernel/svgalib_helper/main.c
137 +++ src/svgalib-1.9.25/kernel/svgalib_helper/main.c
138 @@ -1,5 +1,3 @@
139 -#include <linux/config.h>
141 #if defined (CONFIG_MODVERSIONS) && !defined (MODVERSIONS)
142 # define MODVERSIONS
143 #endif
144 @@ -17,15 +15,22 @@
145 #include <linux/ioport.h>
146 #include <linux/interrupt.h>
147 #include <linux/pci.h>
148 +#include <linux/version.h>
149 +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18)
150 #include <linux/devfs_fs_kernel.h>
151 +#endif
152 #include <linux/mm.h>
153 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
154 #include <linux/thread_info.h>
155 +#endif
156 #include <linux/smp.h>
157 #include <linux/smp_lock.h>
159 #include <linux/sched.h>
160 #include <linux/wait.h>
161 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
162 #include <linux/syscalls.h>
163 +#endif
165 #define __KERNEL_SYSCALLS__
166 #include <linux/unistd.h>
167 @@ -50,7 +55,7 @@
168 #include "displaystart.h"
170 int debug=0;
171 -static int all_devices=0;
172 +int all_devices=0;
173 int num_devices=0;
175 static char *sdev_id="svgalib_helper";
176 @@ -98,7 +103,11 @@
177 static volatile int vsync=0;
178 static wait_queue_head_t vsync_wait;
180 -static irqreturn_t vsync_interrupt(int irq, void *dev_id, struct pt_regs *regs)
181 +static irqreturn_t vsync_interrupt(int irq, void *dev_id
182 +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
183 +, struct pt_regs *regs
184 +#endif
187 struct sh_pci_device *dev = (struct sh_pci_device *)dev_id;
189 @@ -355,7 +364,7 @@
190 vsync=1;
191 i=0;
192 while(irqs[i]!=-1)
193 - request_irq(irqs[i++], vsync_interrupt, SA_SHIRQ, "svgalib_helper", sdev_id);
194 + request_irq(irqs[i++], vsync_interrupt, IRQF_SHARED, "svgalib_helper", sdev_id);
195 vga_enable_vsync((void *)sdev_id);
196 wait_event_interruptible(vsync_wait, !vsync);
197 i=0;
198 @@ -443,7 +452,7 @@
199 int i=sh_pci_devs[minor]->dev->irq;
200 sh_pci_devs[minor]->opencount++;
201 if(sh_pci_devs[minor]->opencount==1 && i!=0 && i!=-1 && i!=255)
202 - request_irq(i, vsync_interrupt, SA_SHIRQ, "svgalib_helper", sh_pci_devs[minor]);
203 + request_irq(i, vsync_interrupt, IRQF_SHARED, "svgalib_helper", sh_pci_devs[minor]);
206 #ifndef KERNEL_2_6
207 @@ -763,10 +772,15 @@
211 +#ifdef KERNEL_2_6
212 +module_param(debug, int, 0);
213 +module_param(all_devices, int, 0);
214 +#else
215 MODULE_PARM(debug, "i");
216 -MODULE_PARM_DESC(debug, "Debug output level.");
218 MODULE_PARM(all_devices, "i");
219 +#endif
221 +MODULE_PARM_DESC(debug, "Debug output level.");
222 MODULE_PARM_DESC(all_devices, "Give access to all PCI devices, regardless of class.");
225 --- src/svgalib-1.9.25/src/lrmi.6.c
226 +++ src/svgalib-1.9.25/src/lrmi.6.c
227 @@ -169,6 +169,13 @@
231 +#ifndef TF_MASK
232 +#define TF_MASK X86_EFLAGS_TF
233 +#define IF_MASK X86_EFLAGS_IF
234 +#define IOPL_MASK X86_EFLAGS_IOPL
235 +#define VIF_MASK X86_EFLAGS_VIF
236 +#define VIP_MASK X86_EFLAGS_VIP
237 +#endif
239 #define DEFAULT_VM86_FLAGS (IF_MASK | IOPL_MASK)
240 #define DEFAULT_STACK_SIZE 0x1000
241 --- src/svgalib-1.9.25/src/lrmi.9.c
242 +++ src/svgalib-1.9.25/src/lrmi.9.c
243 @@ -206,6 +206,13 @@
246 #if defined(__linux__)
247 +#ifndef TF_MASK
248 +#define TF_MASK X86_EFLAGS_TF
249 +#define IF_MASK X86_EFLAGS_IF
250 +#define IOPL_MASK X86_EFLAGS_IOPL
251 +#define VIF_MASK X86_EFLAGS_VIF
252 +#define VIP_MASK X86_EFLAGS_VIP
253 +#endif
254 #define DEFAULT_VM86_FLAGS (IF_MASK | IOPL_MASK)
255 #elif defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__)
256 #define DEFAULT_VM86_FLAGS (PSL_I | PSL_IOPL)
257 --- src/svgalib-1.9.25/lrmi-0.6m/lrmi.c
258 +++ src/svgalib-1.9.25/lrmi-0.6m/lrmi.c
259 @@ -170,6 +170,14 @@
263 +#ifndef TF_MASK
264 +#define TF_MASK X86_EFLAGS_TF
265 +#define IF_MASK X86_EFLAGS_IF
266 +#define IOPL_MASK X86_EFLAGS_IOPL
267 +#define VIF_MASK X86_EFLAGS_VIF
268 +#define VIP_MASK X86_EFLAGS_VIP
269 +#endif
271 #define DEFAULT_VM86_FLAGS (IF_MASK | IOPL_MASK)
272 #define DEFAULT_STACK_SIZE 0x1000
273 #define RETURN_TO_32_INT 255
274 --- src/svgalib-1.9.25/lrmi-0.9/lrmi.c
275 +++ src/svgalib-1.9.25/lrmi-0.9/lrmi.c
276 @@ -203,6 +203,13 @@
279 #if defined(__linux__)
280 +#ifndef TF_MASK
281 +#define TF_MASK X86_EFLAGS_TF
282 +#define IF_MASK X86_EFLAGS_IF
283 +#define IOPL_MASK X86_EFLAGS_IOPL
284 +#define VIF_MASK X86_EFLAGS_VIF
285 +#define VIP_MASK X86_EFLAGS_VIP
286 +#endif
287 #define DEFAULT_VM86_FLAGS (IF_MASK | IOPL_MASK)
288 #elif defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__)
289 #define DEFAULT_VM86_FLAGS (PSL_I | PSL_IOPL)