Commit 73a324ba authored by James Simmons's avatar James Simmons

Cleanusp for the 3Dfx driver.

parent 06b34423
...@@ -79,10 +79,6 @@ ...@@ -79,10 +79,6 @@
#include <video/tdfx.h> #include <video/tdfx.h>
#include <video/fbcon.h> #include <video/fbcon.h>
#ifndef PCI_DEVICE_ID_3DFX_VOODOO5
#define PCI_DEVICE_ID_3DFX_VOODOO5 0x0009
#endif
#undef TDFXFB_DEBUG #undef TDFXFB_DEBUG
#ifdef TDFXFB_DEBUG #ifdef TDFXFB_DEBUG
#define DPRINTK(a,b...) printk(KERN_DEBUG "fb: %s: " a, __FUNCTION__ , ## b) #define DPRINTK(a,b...) printk(KERN_DEBUG "fb: %s: " a, __FUNCTION__ , ## b)
...@@ -995,7 +991,7 @@ static int __devinit tdfxfb_probe(struct pci_dev *pdev, ...@@ -995,7 +991,7 @@ static int __devinit tdfxfb_probe(struct pci_dev *pdev,
info = kmalloc(sizeof(struct fb_info) + sizeof(struct display) + info = kmalloc(sizeof(struct fb_info) + sizeof(struct display) +
sizeof(u32) * 16, GFP_KERNEL); sizeof(u32) * 16, GFP_KERNEL);
if (!info) return -ENXIO; if (!info) return -ENOMEM;
memset(info, 0, sizeof(info) + sizeof(struct display) + sizeof(u32) * 16); memset(info, 0, sizeof(info) + sizeof(struct display) + sizeof(u32) * 16);
...@@ -1016,25 +1012,25 @@ static int __devinit tdfxfb_probe(struct pci_dev *pdev, ...@@ -1016,25 +1012,25 @@ static int __devinit tdfxfb_probe(struct pci_dev *pdev,
} }
tdfx_fix.mmio_start = pci_resource_start(pdev, 0); tdfx_fix.mmio_start = pci_resource_start(pdev, 0);
tdfx_fix.mmio_len = 1 << 24; tdfx_fix.mmio_len = pci_resource_len(pdev, 0);
default_par.regbase_virt = ioremap_nocache(tdfx_fix.mmio_start, 1<<24); default_par.regbase_virt = ioremap_nocache(tdfx_fix.mmio_start, tdfx_fix.mmio_len);
if (!default_par.regbase_virt) { if (!default_par.regbase_virt) {
printk("fb: Can't remap %s register area.\n", tdfx_fix.id); printk("fb: Can't remap %s register area.\n", tdfx_fix.id);
return -ENXIO; goto out_err;
} }
if (!request_mem_region(pci_resource_start(pdev, 0), if (!request_mem_region(pci_resource_start(pdev, 0),
pci_resource_len(pdev, 0), "tdfx regbase")) { pci_resource_len(pdev, 0), "tdfx regbase")) {
printk(KERN_WARNING "tdfxfb: Can't reserve regbase\n"); printk(KERN_WARNING "tdfxfb: Can't reserve regbase\n");
iounmap(default_par.regbase_virt); goto out_err;
return -ENXIO;
} }
tdfx_fix.smem_start = pci_resource_start(pdev, 1); tdfx_fix.smem_start = pci_resource_start(pdev, 1);
if (!(tdfx_fix.smem_len = do_lfb_size(pdev->device))) { if (!(tdfx_fix.smem_len = do_lfb_size(pdev->device))) {
iounmap(default_par.regbase_virt);
printk("fb: Can't count %s memory.\n", tdfx_fix.id); printk("fb: Can't count %s memory.\n", tdfx_fix.id);
return -ENXIO; release_mem_region(pci_resource_start(pdev, 0),
pci_resource_len(pdev, 0));
goto out_err;
} }
if (!request_mem_region(pci_resource_start(pdev, 1), if (!request_mem_region(pci_resource_start(pdev, 1),
...@@ -1042,16 +1038,18 @@ static int __devinit tdfxfb_probe(struct pci_dev *pdev, ...@@ -1042,16 +1038,18 @@ static int __devinit tdfxfb_probe(struct pci_dev *pdev,
printk(KERN_WARNING "tdfxfb: Can't reserve smem\n"); printk(KERN_WARNING "tdfxfb: Can't reserve smem\n");
release_mem_region(pci_resource_start(pdev, 0), release_mem_region(pci_resource_start(pdev, 0),
pci_resource_len(pdev, 0)); pci_resource_len(pdev, 0));
iounmap(default_par.regbase_virt); goto out_err;
return -ENXIO;
} }
info->screen_base = ioremap_nocache(tdfx_fix.smem_start, info->screen_base = ioremap_nocache(tdfx_fix.smem_start,
tdfx_fix.smem_len); tdfx_fix.smem_len);
if (!info->screen_base) { if (!info->screen_base) {
printk("fb: Can't remap %s framebuffer.\n", tdfx_fix.id); printk("fb: Can't remap %s framebuffer.\n", tdfx_fix.id);
iounmap(default_par.regbase_virt); release_mem_region(pci_resource_start(pdev, 1),
return -ENXIO; pci_resource_len(pdev, 1));
release_mem_region(pci_resource_start(pdev, 0),
pci_resource_len(pdev, 0));
goto out_err;
} }
default_par.iobase = pci_resource_start(pdev, 2); default_par.iobase = pci_resource_start(pdev, 2);
...@@ -1063,9 +1061,7 @@ static int __devinit tdfxfb_probe(struct pci_dev *pdev, ...@@ -1063,9 +1061,7 @@ static int __devinit tdfxfb_probe(struct pci_dev *pdev,
pci_resource_len(pdev, 1)); pci_resource_len(pdev, 1));
release_mem_region(pci_resource_start(pdev, 0), release_mem_region(pci_resource_start(pdev, 0),
pci_resource_len(pdev, 0)); pci_resource_len(pdev, 0));
iounmap(default_par.regbase_virt); goto out_err;
iounmap(info->screen_base);
return -ENXIO;
} }
printk("fb: %s memory = %dK\n", tdfx_fix.id, tdfx_fix.smem_len >> 10); printk("fb: %s memory = %dK\n", tdfx_fix.id, tdfx_fix.smem_len >> 10);
...@@ -1104,13 +1100,24 @@ static int __devinit tdfxfb_probe(struct pci_dev *pdev, ...@@ -1104,13 +1100,24 @@ static int __devinit tdfxfb_probe(struct pci_dev *pdev,
if (register_framebuffer(info) < 0) { if (register_framebuffer(info) < 0) {
printk("tdfxfb: can't register framebuffer\n"); printk("tdfxfb: can't register framebuffer\n");
return -ENXIO; goto out_err;
} }
/* /*
* Our driver data * Our driver data
*/ */
pci_set_drvdata(pdev, info); pci_set_drvdata(pdev, info);
return 0; return 0;
out_err:
/*
* Cleanup after anything that was remapped/allocated.
*/
if (default_par.regbase_virt)
iounmap(default_par.regbase_virt);
if (info->screen_base)
iounmap(info->screen_base);
kfree(info);
return -ENXIO;
} }
/** /**
...@@ -1139,6 +1146,7 @@ static void __devexit tdfxfb_remove(struct pci_dev *pdev) ...@@ -1139,6 +1146,7 @@ static void __devexit tdfxfb_remove(struct pci_dev *pdev)
release_mem_region(pci_resource_start(pdev, 0), release_mem_region(pci_resource_start(pdev, 0),
pci_resource_len(pdev, 0)); pci_resource_len(pdev, 0));
pci_set_drvdata(pdev, NULL); pci_set_drvdata(pdev, NULL);
kfree(info);
} }
int __init tdfxfb_init(void) int __init tdfxfb_init(void)
......
...@@ -1258,6 +1258,7 @@ ...@@ -1258,6 +1258,7 @@
#define PCI_DEVICE_ID_3DFX_VOODOO2 0x0002 #define PCI_DEVICE_ID_3DFX_VOODOO2 0x0002
#define PCI_DEVICE_ID_3DFX_BANSHEE 0x0003 #define PCI_DEVICE_ID_3DFX_BANSHEE 0x0003
#define PCI_DEVICE_ID_3DFX_VOODOO3 0x0005 #define PCI_DEVICE_ID_3DFX_VOODOO3 0x0005
#define PCI_DEVICE_ID_3DFX_VOODOO5 0x0009
#define PCI_VENDOR_ID_SIGMADES 0x1236 #define PCI_VENDOR_ID_SIGMADES 0x1236
#define PCI_DEVICE_ID_SIGMADES_6425 0x6401 #define PCI_DEVICE_ID_SIGMADES_6425 0x6401
......
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