Commit 0959f0ca authored by Adrian Bunk's avatar Adrian Bunk Committed by Linus Torvalds

drivers/video/sis/: remove more kernel 2.4 code

Signed-off-by: default avatarAdrian Bunk <bunk@stusta.de>
Cc: Thomas Winischhofer <thomas@winischhofer.net>
Cc: "Antonino A. Daplas" <adaplas@pol.net>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent c831c338
...@@ -58,9 +58,6 @@ ...@@ -58,9 +58,6 @@
#define SIS_LINUX_KERNEL /* Linux kernel framebuffer */ #define SIS_LINUX_KERNEL /* Linux kernel framebuffer */
#undef SIS_XORG_XF86 /* XFree86/X.org */ #undef SIS_XORG_XF86 /* XFree86/X.org */
#undef SIS_LINUX_KERNEL_24
#undef SIS_LINUX_KERNEL_26
#ifdef OutPortByte #ifdef OutPortByte
#undef OutPortByte #undef OutPortByte
#endif #endif
...@@ -100,8 +97,6 @@ ...@@ -100,8 +97,6 @@
#define SIS315H #define SIS315H
#endif #endif
#define SIS_LINUX_KERNEL_26
#if !defined(SIS300) && !defined(SIS315H) #if !defined(SIS300) && !defined(SIS315H)
#warning Neither CONFIG_FB_SIS_300 nor CONFIG_FB_SIS_315 is set #warning Neither CONFIG_FB_SIS_300 nor CONFIG_FB_SIS_315 is set
#warning sisfb will not work! #warning sisfb will not work!
......
...@@ -27,11 +27,7 @@ ...@@ -27,11 +27,7 @@
#include <linux/version.h> #include <linux/version.h>
#include "osdef.h" #include "osdef.h"
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
#include <video/sisfb.h> #include <video/sisfb.h>
#else
#include <linux/sisfb.h>
#endif
#include "vgatypes.h" #include "vgatypes.h"
#include "vstruct.h" #include "vstruct.h"
...@@ -40,12 +36,8 @@ ...@@ -40,12 +36,8 @@
#define VER_MINOR 8 #define VER_MINOR 8
#define VER_LEVEL 9 #define VER_LEVEL 9
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
#include <linux/spinlock.h> #include <linux/spinlock.h>
#define SIS_PCI_GET_CLASS(a, b) pci_get_class(a, b)
#define SIS_PCI_GET_DEVICE(a,b,c) pci_get_device(a,b,c)
#define SIS_PCI_GET_SLOT(a,b) pci_get_slot(a,b)
#define SIS_PCI_PUT_DEVICE(a) pci_dev_put(a)
#ifdef CONFIG_COMPAT #ifdef CONFIG_COMPAT
#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,10) #if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,10)
#include <linux/ioctl32.h> #include <linux/ioctl32.h>
...@@ -54,18 +46,7 @@ ...@@ -54,18 +46,7 @@
#define SIS_NEW_CONFIG_COMPAT #define SIS_NEW_CONFIG_COMPAT
#endif #endif
#endif /* CONFIG_COMPAT */ #endif /* CONFIG_COMPAT */
#else /* 2.4 */
#define SIS_PCI_GET_CLASS(a, b) pci_find_class(a, b)
#define SIS_PCI_GET_DEVICE(a,b,c) pci_find_device(a,b,c)
#define SIS_PCI_GET_SLOT(a,b) pci_find_slot(a,b)
#define SIS_PCI_PUT_DEVICE(a)
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,19)
#ifdef __x86_64__ /* Shouldn't we check for CONFIG_IA32_EMULATION here? */
#include <asm/ioctl32.h>
#define SIS_OLD_CONFIG_COMPAT
#endif
#endif
#endif /* 2.4 */
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,8) #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,8)
#define SIS_IOTYPE1 void __iomem #define SIS_IOTYPE1 void __iomem
#define SIS_IOTYPE2 __iomem #define SIS_IOTYPE2 __iomem
...@@ -497,26 +478,8 @@ struct sis_video_info { ...@@ -497,26 +478,8 @@ struct sis_video_info {
struct fb_var_screeninfo default_var; struct fb_var_screeninfo default_var;
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
struct fb_fix_screeninfo sisfb_fix; struct fb_fix_screeninfo sisfb_fix;
u32 pseudo_palette[17]; u32 pseudo_palette[17];
#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
struct display sis_disp;
struct display_switch sisfb_sw;
struct {
u16 red, green, blue, pad;
} sis_palette[256];
union {
#ifdef FBCON_HAS_CFB16
u16 cfb16[16];
#endif
#ifdef FBCON_HAS_CFB32
u32 cfb32[16];
#endif
} sis_fbcon_cmap;
#endif
struct sisfb_monitor { struct sisfb_monitor {
u16 hmin; u16 hmin;
...@@ -537,10 +500,6 @@ struct sis_video_info { ...@@ -537,10 +500,6 @@ struct sis_video_info {
int mni; /* Mode number index */ int mni; /* Mode number index */
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
int currcon;
#endif
unsigned long video_size; unsigned long video_size;
unsigned long video_base; unsigned long video_base;
unsigned long mmio_size; unsigned long mmio_size;
...@@ -577,9 +536,6 @@ struct sis_video_info { ...@@ -577,9 +536,6 @@ struct sis_video_info {
int sisfb_tvplug; int sisfb_tvplug;
int sisfb_tvstd; int sisfb_tvstd;
int sisfb_nocrt2rate; int sisfb_nocrt2rate;
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
int sisfb_inverse;
#endif
u32 heapstart; /* offset */ u32 heapstart; /* offset */
SIS_IOTYPE1 *sisfb_heap_start; /* address */ SIS_IOTYPE1 *sisfb_heap_start; /* address */
...@@ -645,9 +601,7 @@ struct sis_video_info { ...@@ -645,9 +601,7 @@ struct sis_video_info {
int modechanged; int modechanged;
unsigned char modeprechange; unsigned char modeprechange;
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
u8 sisfb_lastrates[128]; u8 sisfb_lastrates[128];
#endif
int newrom; int newrom;
int haveXGIROM; int haveXGIROM;
......
...@@ -1947,7 +1947,7 @@ sisfb_get_northbridge(int basechipid) ...@@ -1947,7 +1947,7 @@ sisfb_get_northbridge(int basechipid)
default: return NULL; default: return NULL;
} }
for(i = 0; i < nbridgenum; i++) { for(i = 0; i < nbridgenum; i++) {
if((pdev = SIS_PCI_GET_DEVICE(PCI_VENDOR_ID_SI, if((pdev = pci_get_device(PCI_VENDOR_ID_SI,
nbridgeids[nbridgeidx+i], NULL))) nbridgeids[nbridgeidx+i], NULL)))
break; break;
} }
...@@ -4612,9 +4612,9 @@ sisfb_find_host_bridge(struct sis_video_info *ivideo, struct pci_dev *mypdev, ...@@ -4612,9 +4612,9 @@ sisfb_find_host_bridge(struct sis_video_info *ivideo, struct pci_dev *mypdev,
unsigned short temp; unsigned short temp;
int ret = 0; int ret = 0;
while((pdev = SIS_PCI_GET_CLASS(PCI_CLASS_BRIDGE_HOST, pdev))) { while((pdev = pci_get_class(PCI_CLASS_BRIDGE_HOST, pdev))) {
temp = pdev->vendor; temp = pdev->vendor;
SIS_PCI_PUT_DEVICE(pdev); pci_dev_put(pdev);
if(temp == pcivendor) { if(temp == pcivendor) {
ret = 1; ret = 1;
break; break;
...@@ -5153,24 +5153,24 @@ sisfb_post_xgi(struct pci_dev *pdev) ...@@ -5153,24 +5153,24 @@ sisfb_post_xgi(struct pci_dev *pdev)
if(reg & 0x80) v2 |= 0x80; if(reg & 0x80) v2 |= 0x80;
v2 |= 0x01; v2 |= 0x01;
if((mypdev = SIS_PCI_GET_DEVICE(PCI_VENDOR_ID_SI, 0x0730, NULL))) { if((mypdev = pci_get_device(PCI_VENDOR_ID_SI, 0x0730, NULL))) {
SIS_PCI_PUT_DEVICE(mypdev); pci_dev_put(mypdev);
if(((v2 & 0x06) == 2) || ((v2 & 0x06) == 4)) if(((v2 & 0x06) == 2) || ((v2 & 0x06) == 4))
v2 &= 0xf9; v2 &= 0xf9;
v2 |= 0x08; v2 |= 0x08;
v1 &= 0xfe; v1 &= 0xfe;
} else { } else {
mypdev = SIS_PCI_GET_DEVICE(PCI_VENDOR_ID_SI, 0x0735, NULL); mypdev = pci_get_device(PCI_VENDOR_ID_SI, 0x0735, NULL);
if(!mypdev) if(!mypdev)
mypdev = SIS_PCI_GET_DEVICE(PCI_VENDOR_ID_SI, 0x0645, NULL); mypdev = pci_get_device(PCI_VENDOR_ID_SI, 0x0645, NULL);
if(!mypdev) if(!mypdev)
mypdev = SIS_PCI_GET_DEVICE(PCI_VENDOR_ID_SI, 0x0650, NULL); mypdev = pci_get_device(PCI_VENDOR_ID_SI, 0x0650, NULL);
if(mypdev) { if(mypdev) {
pci_read_config_dword(mypdev, 0x94, &regd); pci_read_config_dword(mypdev, 0x94, &regd);
regd &= 0xfffffeff; regd &= 0xfffffeff;
pci_write_config_dword(mypdev, 0x94, regd); pci_write_config_dword(mypdev, 0x94, regd);
v1 &= 0xfe; v1 &= 0xfe;
SIS_PCI_PUT_DEVICE(mypdev); pci_dev_put(mypdev);
} else if(sisfb_find_host_bridge(ivideo, pdev, PCI_VENDOR_ID_SI)) { } else if(sisfb_find_host_bridge(ivideo, pdev, PCI_VENDOR_ID_SI)) {
v1 &= 0xfe; v1 &= 0xfe;
} else if(sisfb_find_host_bridge(ivideo, pdev, 0x1106) || } else if(sisfb_find_host_bridge(ivideo, pdev, 0x1106) ||
...@@ -5193,13 +5193,13 @@ sisfb_post_xgi(struct pci_dev *pdev) ...@@ -5193,13 +5193,13 @@ sisfb_post_xgi(struct pci_dev *pdev)
if( (!(v1 & 0x02)) && (v2 & 0x30) && (regd < 0xcf) ) if( (!(v1 & 0x02)) && (v2 & 0x30) && (regd < 0xcf) )
setSISIDXREG(SISCR, 0x5f, 0xf1, 0x01); setSISIDXREG(SISCR, 0x5f, 0xf1, 0x01);
if((mypdev = SIS_PCI_GET_DEVICE(0x10de, 0x01e0, NULL))) { if((mypdev = pci_get_device(0x10de, 0x01e0, NULL))) {
/* TODO: set CR5f &0xf1 | 0x01 for version 6570 /* TODO: set CR5f &0xf1 | 0x01 for version 6570
* of nforce 2 ROM * of nforce 2 ROM
*/ */
if(0) if(0)
setSISIDXREG(SISCR, 0x5f, 0xf1, 0x01); setSISIDXREG(SISCR, 0x5f, 0xf1, 0x01);
SIS_PCI_PUT_DEVICE(mypdev); pci_dev_put(mypdev);
} }
} }
...@@ -5235,9 +5235,9 @@ sisfb_post_xgi(struct pci_dev *pdev) ...@@ -5235,9 +5235,9 @@ sisfb_post_xgi(struct pci_dev *pdev)
setSISIDXREG(SISCR, 0x75, 0xe0, bios[0x4ff] & 0x1f); setSISIDXREG(SISCR, 0x75, 0xe0, bios[0x4ff] & 0x1f);
setSISIDXREG(SISCR, 0x76, 0xe0, bios[0x500] & 0x1f); setSISIDXREG(SISCR, 0x76, 0xe0, bios[0x500] & 0x1f);
v1 = bios[0x501]; v1 = bios[0x501];
if((mypdev = SIS_PCI_GET_DEVICE(0x8086, 0x2530, NULL))) { if((mypdev = pci_get_device(0x8086, 0x2530, NULL))) {
v1 = 0xf0; v1 = 0xf0;
SIS_PCI_PUT_DEVICE(mypdev); pci_dev_put(mypdev);
} }
outSISIDXREG(SISCR, 0x77, v1); outSISIDXREG(SISCR, 0x77, v1);
} }
...@@ -5946,7 +5946,7 @@ sisfb_probe(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -5946,7 +5946,7 @@ sisfb_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
if(!ivideo->sisvga_enabled) { if(!ivideo->sisvga_enabled) {
if(pci_enable_device(pdev)) { if(pci_enable_device(pdev)) {
if(ivideo->nbridge) SIS_PCI_PUT_DEVICE(ivideo->nbridge); if(ivideo->nbridge) pci_dev_put(ivideo->nbridge);
pci_set_drvdata(pdev, NULL); pci_set_drvdata(pdev, NULL);
kfree(sis_fb_info); kfree(sis_fb_info);
return -EIO; return -EIO;
...@@ -5973,7 +5973,7 @@ sisfb_probe(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -5973,7 +5973,7 @@ sisfb_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
"requiring Chrontel/GPIO setup\n", "requiring Chrontel/GPIO setup\n",
mychswtable[i].vendorName, mychswtable[i].vendorName,
mychswtable[i].cardName); mychswtable[i].cardName);
ivideo->lpcdev = SIS_PCI_GET_DEVICE(PCI_VENDOR_ID_SI, 0x0008, NULL); ivideo->lpcdev = pci_get_device(PCI_VENDOR_ID_SI, 0x0008, NULL);
break; break;
} }
i++; i++;
...@@ -5983,7 +5983,7 @@ sisfb_probe(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -5983,7 +5983,7 @@ sisfb_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
#ifdef CONFIG_FB_SIS_315 #ifdef CONFIG_FB_SIS_315
if((ivideo->chip == SIS_760) && (ivideo->nbridge)) { if((ivideo->chip == SIS_760) && (ivideo->nbridge)) {
ivideo->lpcdev = SIS_PCI_GET_SLOT(ivideo->nbridge->bus, (2 << 3)); ivideo->lpcdev = pci_get_slot(ivideo->nbridge->bus, (2 << 3));
} }
#endif #endif
...@@ -6148,9 +6148,9 @@ error_1: release_mem_region(ivideo->video_base, ivideo->video_size); ...@@ -6148,9 +6148,9 @@ error_1: release_mem_region(ivideo->video_base, ivideo->video_size);
error_2: release_mem_region(ivideo->mmio_base, ivideo->mmio_size); error_2: release_mem_region(ivideo->mmio_base, ivideo->mmio_size);
error_3: vfree(ivideo->bios_abase); error_3: vfree(ivideo->bios_abase);
if(ivideo->lpcdev) if(ivideo->lpcdev)
SIS_PCI_PUT_DEVICE(ivideo->lpcdev); pci_dev_put(ivideo->lpcdev);
if(ivideo->nbridge) if(ivideo->nbridge)
SIS_PCI_PUT_DEVICE(ivideo->nbridge); pci_dev_put(ivideo->nbridge);
pci_set_drvdata(pdev, NULL); pci_set_drvdata(pdev, NULL);
if(!ivideo->sisvga_enabled) if(!ivideo->sisvga_enabled)
pci_disable_device(pdev); pci_disable_device(pdev);
...@@ -6330,70 +6330,6 @@ error_3: vfree(ivideo->bios_abase); ...@@ -6330,70 +6330,6 @@ error_3: vfree(ivideo->bios_abase);
sisfb_set_vparms(ivideo); sisfb_set_vparms(ivideo);
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
/* ---------------- For 2.4: Now switch the mode ------------------ */
printk(KERN_INFO "sisfb: Setting mode %dx%dx%d (%dHz)\n",
ivideo->video_width, ivideo->video_height, ivideo->video_bpp,
ivideo->refresh_rate);
/* Determine whether or not acceleration is to be
* used. Need to know before pre/post_set_mode()
*/
ivideo->accel = 0;
ivideo->default_var.accel_flags &= ~FB_ACCELF_TEXT;
if(ivideo->sisfb_accel) {
ivideo->accel = -1;
ivideo->default_var.accel_flags |= FB_ACCELF_TEXT;
}
/* Now switch the mode */
sisfb_pre_setmode(ivideo);
if(SiSSetMode(&ivideo->SiS_Pr, ivideo->mode_no) == 0) {
printk(KERN_ERR "sisfb: Fatal error: Setting mode[0x%x] failed\n",
ivideo->mode_no);
ret = -EINVAL;
iounmap(ivideo->mmio_vbase);
goto error_0;
}
outSISIDXREG(SISSR, IND_SIS_PASSWORD, SIS_PASSWORD);
sisfb_post_setmode(ivideo);
/* Maximize regardless of sisfb_max at startup */
ivideo->default_var.yres_virtual = 32767;
/* Force reset of x virtual in crtc_to_var */
ivideo->default_var.xres_virtual = 0;
/* Copy mode timing to var */
sisfb_crtc_to_var(ivideo, &ivideo->default_var);
/* Find out about screen pitch */
sisfb_calc_pitch(ivideo, &ivideo->default_var);
sisfb_set_pitch(ivideo);
/* Init the accelerator (does nothing currently) */
sisfb_initaccel(ivideo);
/* Init some fbinfo entries */
sis_fb_info->node = -1;
sis_fb_info->flags = FBINFO_FLAG_DEFAULT;
sis_fb_info->fbops = &sisfb_ops;
sis_fb_info->disp = &ivideo->sis_disp;
sis_fb_info->blank = &sisfb_blank;
sis_fb_info->switch_con = &sisfb_switch;
sis_fb_info->updatevar = &sisfb_update_var;
sis_fb_info->changevar = NULL;
strcpy(sis_fb_info->fontname, sisfb_fontname);
sisfb_set_disp(-1, &ivideo->default_var, sis_fb_info);
#else /* --------- For 2.6: Setup a somewhat sane default var ------------ */
printk(KERN_INFO "sisfb: Default mode is %dx%dx%d (%dHz)\n", printk(KERN_INFO "sisfb: Default mode is %dx%dx%d (%dHz)\n",
ivideo->video_width, ivideo->video_height, ivideo->video_bpp, ivideo->video_width, ivideo->video_height, ivideo->video_bpp,
ivideo->refresh_rate); ivideo->refresh_rate);
...@@ -6453,7 +6389,6 @@ error_3: vfree(ivideo->bios_abase); ...@@ -6453,7 +6389,6 @@ error_3: vfree(ivideo->bios_abase);
sis_fb_info->pseudo_palette = ivideo->pseudo_palette; sis_fb_info->pseudo_palette = ivideo->pseudo_palette;
fb_alloc_cmap(&sis_fb_info->cmap, 256 , 0); fb_alloc_cmap(&sis_fb_info->cmap, 256 , 0);
#endif /* 2.6 */
printk(KERN_DEBUG "sisfb: Initial vbflags 0x%x\n", (int)ivideo->vbflags); printk(KERN_DEBUG "sisfb: Initial vbflags 0x%x\n", (int)ivideo->vbflags);
...@@ -6563,10 +6498,10 @@ static void __devexit sisfb_remove(struct pci_dev *pdev) ...@@ -6563,10 +6498,10 @@ static void __devexit sisfb_remove(struct pci_dev *pdev)
vfree(ivideo->bios_abase); vfree(ivideo->bios_abase);
if(ivideo->lpcdev) if(ivideo->lpcdev)
SIS_PCI_PUT_DEVICE(ivideo->lpcdev); pci_dev_put(ivideo->lpcdev);
if(ivideo->nbridge) if(ivideo->nbridge)
SIS_PCI_PUT_DEVICE(ivideo->nbridge); pci_dev_put(ivideo->nbridge);
#ifdef CONFIG_MTRR #ifdef CONFIG_MTRR
/* Release MTRR region */ /* Release MTRR region */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment