- get rid of warning when linux/device.h doesnt exist - touch up the Makefile to let the ebuild handle the module details - fix support with io remap stuff in newer kernels - dont include headers that dont exist in 2.4.x kernels - use module_param() for 2.6.x and MODULE_PARM() for all others - dont declare all_devices as static since it is exported - dont include as the build system does it for us --- svgalib/kernel/svgalib_helper/Makefile +++ svgalib/kernel/svgalib_helper/Makefile @@ -25,7 +25,7 @@ endif -CLASS_SIMPLE := $(shell grep class_simple_create $(KDIR)/include/linux/device.h) +CLASS_SIMPLE := $(shell grep -s class_simple_create $(KDIR)/include/linux/device.h) ifneq ($(CLASS_SIMPLE),) CLASS_CFLAGS = -DCLASS_SIMPLE=1 --- svgalib/kernel/svgalib_helper/Makefile.alt +++ svgalib/kernel/svgalib_helper/Makefile.alt @@ -37,7 +37,7 @@ CFLAGS += -DSVGALIB_HELPER_MAJOR=$(SVGALIB_HELPER_MAJOR) ifeq (1,$(findstring 1,$(MODVER))) - CFLAGS += -DMODVERSIONS -include $(INCLUDEDIR)/linux/modversions.h + CFLAGS += -DMODVERSIONS -DCONFIG_MODVERSIONS=1 endif TARGET = svgalib_helper @@ -50,7 +50,8 @@ endif endif -all: .depend $(OBJS) +modules: $(OBJS) +all: .depend modules $(TARGET).o: $(SRC:.c=.o) $(LD) -r $^ -o $@ @@ -61,8 +62,8 @@ install: device modules_install modules_install: $(OBJS) - mkdir -p /lib/modules/$(VER)/kernel/misc - install -m 0644 -c $(OBJS) /lib/modules/$(VER)/kernel/misc + mkdir -p $(TOPDIR)/lib/modules/$(VER)/kernel/misc + install -m 0644 -c $(OBJS) $(TOPDIR)/lib/modules/$(VER)/kernel/misc device: rm -f /dev/svgalib_helper* /dev/svga_helper* /dev/svga /dev/svga? --- svgalib/kernel/svgalib_helper/kernel26compat.h +++ svgalib/kernel/svgalib_helper/kernel26compat.h @@ -10,7 +10,7 @@ # define PCI_GET_CLASS pci_find_class # define PCI_GET_DEVICE pci_find_device -# if defined (PG_chainlock) +# if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,3) # define my_io_remap_page_range(vma, start, ofs, len, prot) \ io_remap_page_range(vma,start,ofs,len,prot) # else @@ -70,6 +70,7 @@ /* These are also not present in 2.6 kernels ... */ #if (!defined _LINUX_DEVFS_FS_KERNEL_H) || (defined KERNEL_2_6) +#include static inline int devfs_register_chrdev (unsigned int major, const char *name, struct file_operations *fops) { @@ -77,7 +78,12 @@ } static inline int devfs_unregister_chrdev (unsigned int major,const char *name) { - return unregister_chrdev (major, name); +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) + return unregister_chrdev (major, name); +#else + unregister_chrdev (major, name); + return 0; +#endif } #endif @@ -167,3 +167,7 @@ #ifndef PCI_VENDOR_ID_RENDITION #define PCI_VENDOR_ID_RENDITION 0x1163 #endif + +#ifndef IRQF_SHARED +# define IRQF_SHARED SA_SHIRQ +#endif --- svgalib/kernel/svgalib_helper/main.c +++ svgalib/kernel/svgalib_helper/main.c @@ -1,5 +1,3 @@ -#include - #if defined (CONFIG_MODVERSIONS) && !defined (MODVERSIONS) # define MODVERSIONS #endif @@ -19,15 +19,22 @@ #include #include #include +#include +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18) #include +#endif #include +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0) #include +#endif #include #include #include #include +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0) #include +#endif #define __KERNEL_SYSCALLS__ #include @@ -55,7 +55,7 @@ #include "displaystart.h" int debug=0; -static int all_devices=0; +int all_devices=0; int num_devices=0; static char *sdev_id="svgalib_helper"; @@ -103,7 +103,11 @@ static volatile int vsync=0; static wait_queue_head_t vsync_wait; -static irqreturn_t vsync_interrupt(int irq, void *dev_id, struct pt_regs *regs) +static irqreturn_t vsync_interrupt(int irq, void *dev_id +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19) +, struct pt_regs *regs +#endif +) { struct sh_pci_device *dev = (struct sh_pci_device *)dev_id; @@ -360,7 +364,7 @@ vsync=1; i=0; while(irqs[i]!=-1) - request_irq(irqs[i++], vsync_interrupt, SA_SHIRQ, "svgalib_helper", sdev_id); + request_irq(irqs[i++], vsync_interrupt, IRQF_SHARED, "svgalib_helper", sdev_id); vga_enable_vsync((void *)sdev_id); wait_event_interruptible(vsync_wait, !vsync); i=0; @@ -448,7 +452,7 @@ int i=sh_pci_devs[minor]->dev->irq; sh_pci_devs[minor]->opencount++; if(sh_pci_devs[minor]->opencount==1 && i!=0 && i!=-1 && i!=255) - request_irq(i, vsync_interrupt, SA_SHIRQ, "svgalib_helper", sh_pci_devs[minor]); + request_irq(i, vsync_interrupt, IRQF_SHARED, "svgalib_helper", sh_pci_devs[minor]); } #ifndef KERNEL_2_6 @@ -770,10 +770,15 @@ } +#ifdef KERNEL_2_6 +module_param(debug, int, 0); +module_param(all_devices, int, 0); +#else MODULE_PARM(debug, "i"); -MODULE_PARM_DESC(debug, "Debug output level."); - MODULE_PARM(all_devices, "i"); +#endif + +MODULE_PARM_DESC(debug, "Debug output level."); MODULE_PARM_DESC(all_devices, "Give access to all PCI devices, regardless of class.");