]> git.hungrycats.org Git - linux/commitdiff
[video planb] don't hardware pci command/cacheline/latency values,
authorJeff Garzik <jgarzik@redhat.com>
Mon, 1 Sep 2003 07:41:34 +0000 (03:41 -0400)
committerJeff Garzik <jgarzik@redhat.com>
Mon, 1 Sep 2003 07:41:34 +0000 (03:41 -0400)
use the PCI layer instead to provide those for us.

drivers/media/video/planb.c

index cb1dfcc416270c051f7be1815e613fc8e4f4a97d..b4f2cb5e738be77c33e00cdba091e7a02af1e533 100644 (file)
@@ -2158,6 +2158,7 @@ static int find_planb(void)
        unsigned int            old_base, new_base;
        unsigned int            irq;
        struct pci_dev          *pdev;
+       int rc;
 
        if (_machine != _MACH_Pmac)
                return 0;
@@ -2211,18 +2212,25 @@ static int find_planb(void)
 
        pdev = pci_find_slot (bus, dev_fn);
        if (!pdev) {
-               printk(KERN_ERR "cannot find slot\n");
-               /* XXX handle error */
+               printk(KERN_ERR "planb: cannot find slot\n");
+               goto err_out;
        }
 
        /* Enable response in memory space, bus mastering,
           use memory write and invalidate */
-       pci_write_config_word (pdev, PCI_COMMAND,
-               PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER |
-               PCI_COMMAND_INVALIDATE);
-       /* Set PCI Cache line size & latency timer */
-       pci_write_config_byte (pdev, PCI_CACHE_LINE_SIZE, 0x8);
-       pci_write_config_byte (pdev, PCI_LATENCY_TIMER, 0x40);
+       rc = pci_enable_device(pdev);
+       if (rc) {
+               printk(KERN_ERR "planb: cannot enable PCI device %s\n",
+                      pci_name(pdev));
+               goto err_out;
+       }
+       rc = pci_set_mwi(pdev);
+       if (rc) {
+               printk(KERN_ERR "planb: cannot enable MWI on PCI device %s\n",
+                      pci_name(pdev));
+               goto err_out_disable;
+       }
+       pci_set_master(pdev);
 
        /* Set the new base address */
        pci_write_config_dword (pdev, confreg, new_base);
@@ -2234,6 +2242,12 @@ static int find_planb(void)
        pb->irq = irq;
        
        return planb_num;
+
+err_out_disable:
+       pci_disable_device(pdev);
+err_out:
+       /* FIXME handle error */   /* comment moved from pci_find_slot, above */
+       return 0;
 }
 
 static void release_planb(void)