Fixes for compilation against recent kernels; disable helper module, change configuration file loading...

This commit is contained in:
Ryan McGrath 2011-02-24 00:31:25 -08:00
parent 00bae13bba
commit ed9bb8f71a
15 changed files with 206 additions and 73 deletions

View file

@ -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 @@ typedef void* devfs_handle_t;
/* These are also not present in 2.6 kernels ... */
#if (!defined _LINUX_DEVFS_FS_KERNEL_H) || (defined KERNEL_2_6)
#include <linux/fs.h>
static inline int devfs_register_chrdev (unsigned int major, const char *name,
struct file_operations *fops)
{
@ -77,7 +78,12 @@ static inline int devfs_register_chrdev (unsigned int major, const char *name,
}
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
@ -99,7 +105,8 @@ static inline int devfs_unregister_chrdev (unsigned int major,const char *name)
class_device_create(svgalib_helper_class, \
MKDEV(SVGALIB_HELPER_MAJOR, _minor), \
&sh_pci_devs[_minor]->dev->dev, _name);
#else /* 2.6.15 changed class_device_create */
/* 2.6.15 changed class_device_create */
#elif LINUX_VERSION_CODE < KERNEL_VERSION(2,6,26)
# define SLH_SYSFS_ADD_CONTROL \
class_device_create(svgalib_helper_class, NULL, \
MKDEV(SVGALIB_HELPER_MAJOR, 0), \
@ -109,7 +116,42 @@ static inline int devfs_unregister_chrdev (unsigned int major,const char *name)
class_device_create(svgalib_helper_class, NULL, \
MKDEV(SVGALIB_HELPER_MAJOR, _minor), \
&sh_pci_devs[_minor]->dev->dev, _name);
#endif /* 2.6.15 */
/* 2.6.26 changed class_device_create to device_create */
#elif LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27)
# define SLH_SYSFS_ADD_CONTROL \
device_create(svgalib_helper_class, NULL, \
MKDEV(SVGALIB_HELPER_MAJOR, 0), \
"svga");
# define SLH_SYSFS_ADD_DEVICE(_name, _minor) \
device_create(svgalib_helper_class, &sh_pci_devs[_minor]->dev->dev, \
MKDEV(SVGALIB_HELPER_MAJOR, _minor), \
_name);
/* 2.6.27 changed device_create to device_create_drvdata */
#elif LINUX_VERSION_CODE < KERNEL_VERSION(2,6,28)
# define SLH_SYSFS_ADD_CONTROL \
device_create_drvdata(svgalib_helper_class, NULL, \
MKDEV(SVGALIB_HELPER_MAJOR, 0), \
"%s%d", "svga", 0);
# define SLH_SYSFS_ADD_DEVICE(_name, _minor) \
device_create_drvdata(svgalib_helper_class, \
&sh_pci_devs[_minor]->dev->dev, \
MKDEV(SVGALIB_HELPER_MAJOR, _minor), \
"%s%d", _name, _minor);
/* 2.6.28 changed device_create_drvdata back to device_create */
#else
# define SLH_SYSFS_ADD_CONTROL \
device_create(svgalib_helper_class, NULL, \
MKDEV(SVGALIB_HELPER_MAJOR, 0), NULL, \
"%s%d", "svga", 0);
# define SLH_SYSFS_ADD_DEVICE(_name, _minor) \
device_create(svgalib_helper_class, \
&sh_pci_devs[_minor]->dev->dev, \
MKDEV(SVGALIB_HELPER_MAJOR, _minor), NULL, \
"%s%d", _name, _minor);
#endif
# define SLH_SYSFS_REMOVE_DEVICE(i) \
class_destroy(svgalib_helper_class);
@ -161,3 +203,7 @@ static inline int devfs_unregister_chrdev (unsigned int major,const char *name)
#ifndef PCI_VENDOR_ID_RENDITION
#define PCI_VENDOR_ID_RENDITION 0x1163
#endif
#ifndef IRQF_SHARED
# define IRQF_SHARED SA_SHIRQ
#endif