summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'media-libs/svgalib/files/svgalib-1.9.19-linux2.6.patch')
-rw-r--r--media-libs/svgalib/files/svgalib-1.9.19-linux2.6.patch189
1 files changed, 189 insertions, 0 deletions
diff --git a/media-libs/svgalib/files/svgalib-1.9.19-linux2.6.patch b/media-libs/svgalib/files/svgalib-1.9.19-linux2.6.patch
new file mode 100644
index 000000000000..9c1008616c14
--- /dev/null
+++ b/media-libs/svgalib/files/svgalib-1.9.19-linux2.6.patch
@@ -0,0 +1,189 @@
+diff -urpN svgalib-1.9.18/kernel/svgalib_helper/kernel26compat.h svgalib-1.9.18.new/kernel/svgalib_helper/kernel26compat.h
+--- svgalib-1.9.18/kernel/svgalib_helper/kernel26compat.h 2003-10-04 15:42:01.000000000 +0200
++++ svgalib-1.9.18.new/kernel/svgalib_helper/kernel26compat.h 2004-02-23 00:41:03.176196576 +0200
+@@ -52,6 +52,33 @@ static inline int devfs_unregister_chrde
+ }
+ #endif
+
++#if defined(KERNEL_2_6) && !defined(CONFIG_DEVFS_FS)
++# define SLH_SYSFS_REGISTER \
++ svgalib_helper_class = class_simple_create(THIS_MODULE, "svgalib_helper");
++
++# define SLH_SYSFS_ADD_CONTROL \
++ class_simple_device_add(svgalib_helper_class, \
++ MKDEV(SVGALIB_HELPER_MAJOR, 0), \
++ NULL, "svga");
++
++# define SLH_SYSFS_ADD_DEVICE(_name, _minor) \
++ class_simple_device_add(svgalib_helper_class, \
++ MKDEV(SVGALIB_HELPER_MAJOR, _minor), \
++ &sh_pci_devs[_minor]->dev->dev, _name);
++
++# define SLH_SYSFS_REMOVE_DEVICE(i) \
++ class_simple_device_remove(MKDEV(SVGALIB_HELPER_MAJOR, i));
++
++# define SLH_SYSFS_UNREGISTER \
++ class_simple_destroy(svgalib_helper_class);
++#else
++# define SLH_SYSFS_REGISTER
++# define SLH_SYSFS_ADD_CONTROL
++# define SLH_SYSFS_ADD_DEVICE(_name, _minor)
++# define SLH_SYSFS_REMOVE_DEVICE(i)
++# define SLH_SYSFS_UNREGISTER
++#endif
++
+ #if (defined MINOR)
+ # define my_minor(x) MINOR(x)
+ #else
+diff -urpN svgalib-1.9.18/kernel/svgalib_helper/main.c svgalib-1.9.18.new/kernel/svgalib_helper/main.c
+--- svgalib-1.9.18/kernel/svgalib_helper/main.c 2003-10-04 12:34:20.000000000 +0200
++++ svgalib-1.9.18.new/kernel/svgalib_helper/main.c 2004-02-23 00:42:25.490682872 +0200
+@@ -51,6 +51,10 @@ static int irqs[MAX_NR_DEVICES];
+ static devfs_handle_t devfs_handle;
+ #endif
+
++#if defined(KERNEL_2_6) && !defined(CONFIG_DEVFS_FS)
++struct class_simple *svgalib_helper_class;
++#endif
++
+ static int check_io_range(int port, int device) {
+ return 1;
+ }
+@@ -467,6 +471,7 @@ int init_module(void)
+ {
+ int result, i, j;
+ struct pci_dev *dev=NULL;
++ char name[255];
+ #ifdef CONFIG_DEVFS_FS
+ # ifndef KERNEL_2_6
+ devfs_handle_t slave_handle;
+@@ -513,9 +518,9 @@ int init_module(void)
+
+ printk(KERN_INFO "svgalib_helper: Initializing, version %s\n", versionstr);
+
+- result = devfs_register_chrdev(SVGALIB_HELPER_MAJOR, "svgalib_helper", &svgalib_helper_fops);
++ result = devfs_register_chrdev(SVGALIB_HELPER_MAJOR, "svgalib_helper", &svgalib_helper_fops);
+
+- if (result < 0) {
++ if (result < 0) {
+ printk(KERN_WARNING "svgalib_helper: can't get major %d\n",SVGALIB_HELPER_MAJOR);
+ return result;
+ }
+@@ -523,7 +528,7 @@ int init_module(void)
+ if((sh_pci_devs[0]=kmalloc(sizeof(struct sh_pci_device),GFP_KERNEL))==NULL) {
+ goto nomem_error;
+ }
+-
++
+ memset(sh_pci_devs[0],0,sizeof(struct sh_pci_device));
+ num_devices=1;
+ for(i=1;i<MAX_NR_DEVICES;i++) sh_pci_devs[i]=NULL;
+@@ -537,19 +542,22 @@ int init_module(void)
+ devfs_mk_symlink( NULL, "svga", 0, "svga_helper/0", &slave_handle, NULL );
+ devfs_auto_unregister( devfs_handle, slave_handle );
+ # else
+- devfs_mk_dir ("svga_helper");
+- for (i = 0; i < 8; i++) {
+- devfs_mk_cdev(MKDEV(SVGALIB_HELPER_MAJOR, i),
+- S_IFCHR | S_IRUGO | S_IRWXU, "svga_helper/%d", i);
+- }
+- devfs_mk_symlink("svga", "svga_helper/0");
++ devfs_mk_dir ("svga_helper");
++ for (i = 0; i < 8; i++) {
++ devfs_mk_cdev(MKDEV(SVGALIB_HELPER_MAJOR, i),
++ S_IFCHR | S_IRUGO | S_IRWXU, "svga_helper/%d", i);
++ }
++ devfs_mk_symlink("svga", "svga_helper/0");
+ # endif
+ #endif /* devfsd support */
+
++ SLH_SYSFS_REGISTER;
++ SLH_SYSFS_ADD_CONTROL;
++
+ if(pci_present()) {
+ while((dev= all_devices ?
+- pci_find_device(PCI_ANY_ID, PCI_ANY_ID, dev) :
+- pci_find_class(PCI_CLASS_DISPLAY_VGA<<8,dev)) &&
++ pci_find_device(PCI_ANY_ID, PCI_ANY_ID, dev) :
++ pci_find_class(PCI_CLASS_DISPLAY_VGA<<8,dev)) &&
+ (num_devices<=MAX_NR_DEVICES)) {
+ if((sh_pci_devs[num_devices]=kmalloc(sizeof(struct sh_pci_device),GFP_KERNEL))==NULL) {
+ goto nomem_error;
+@@ -581,6 +589,10 @@ int init_module(void)
+ sh_pci_devs[num_devices]->startad=-1;
+ #endif
+ sh_pci_devs[num_devices]->opencount=0;
++
++ sprintf(name, "svga%d", num_devices);
++ SLH_SYSFS_ADD_DEVICE(name, num_devices);
++
+ num_devices++;
+ }
+ }
+@@ -600,39 +612,51 @@ int init_module(void)
+ init_waitqueue_head(&vsync_wait);
+
+ #ifndef KERNEL_2_6
+- EXPORT_NO_SYMBOLS;
++ EXPORT_NO_SYMBOLS;
+ #endif
+-
++
+ return 0; /* succeed */
+
+ nomem_error:
+- for(i=0;i<MAX_NR_DEVICES;i++)
+- if(sh_pci_devs[i])kfree(sh_pci_devs[i]);
++ for(i=0;i<MAX_NR_DEVICES;i++) {
++ if(sh_pci_devs[i]) {
++ SLH_SYSFS_REMOVE_DEVICE(i);
++ kfree(sh_pci_devs[i]);
++ }
++ }
++
++ SLH_SYSFS_REMOVE_DEVICE(0);
++ SLH_SYSFS_UNREGISTER;
++
++ devfs_unregister_chrdev(SVGALIB_HELPER_MAJOR, "svgalib_helper");
+
+- devfs_unregister_chrdev(SVGALIB_HELPER_MAJOR, "svgalib_helper");
+-
+- return result;
++ return result;
+ }
+
+ void cleanup_module(void)
+ {
+ int i;
+- for(i=0;i<MAX_NR_DEVICES;i++)
++ for(i=0;i<MAX_NR_DEVICES;i++) {
+ if(sh_pci_devs[i]) {
++ SLH_SYSFS_REMOVE_DEVICE(i);
+ kfree(sh_pci_devs[i]);
+ }
++ }
++
++ SLH_SYSFS_REMOVE_DEVICE(0);
++ SLH_SYSFS_UNREGISTER;
+
+ #ifdef CONFIG_DEVFS_FS
+ # ifndef KERNEL_2_6
+- devfs_unregister(devfs_handle);
++ devfs_unregister(devfs_handle);
+ # else
+- for (i = 0; i < 8; i++)
+- devfs_remove("svga_helper/%d", i);
+- devfs_remove("svga_helper");
+- devfs_remove("svga");
+-# endif
++ for (i = 0; i < 8; i++)
++ devfs_remove("svga_helper/%d", i);
++ devfs_remove("svga_helper");
++ devfs_remove("svga");
++# endif
+ #endif
+-
++
+ devfs_unregister_chrdev(SVGALIB_HELPER_MAJOR, "svgalib_helper");
+
+ }