Eliminiate fields in xgi_info that are duplicates of fields in pci_dev.
authorIan Romanick <idr@us.ibm.com>
Mon, 9 Jul 2007 23:43:48 +0000 (16:43 -0700)
committerIan Romanick <idr@us.ibm.com>
Mon, 9 Jul 2007 23:43:48 +0000 (16:43 -0700)
linux-core/xgi_drv.c
linux-core/xgi_drv.h
linux-core/xgi_misc.c

index 2f0218e..c4cc890 100644 (file)
@@ -233,10 +233,6 @@ int xgi_kern_probe(struct pci_dev *dev, const struct pci_device_id *id_table)
 
        info = &xgi_devices[xgi_num_devices];
        info->dev = dev;
-       info->vendor_id = dev->vendor;
-       info->device_id = dev->device;
-       info->bus = dev->bus->number;
-       info->slot = PCI_SLOT((dev)->devfn);
 
        xgi_lock_init(info);
 
@@ -294,14 +290,13 @@ int xgi_kern_probe(struct pci_dev *dev, const struct pci_device_id *id_table)
        info->fb.vbase = NULL;
        XGI_INFO("info->fb.vbase: 0x%p \n", info->fb.vbase);
 
-       info->irq = dev->irq;
 
        /* check common error condition */
-       if (info->irq == 0) {
+       if (info->dev->irq == 0) {
                XGI_ERROR("Can't find an IRQ for your XGI card!  \n");
                goto error_zero_dev;
        }
-       XGI_INFO("info->irq: %lx \n", info->irq);
+       XGI_INFO("info->irq: %lx \n", info->dev->irq);
 
        //xgi_enable_dvi_interrupt(info);
 
@@ -568,21 +563,21 @@ int xgi_kern_open(struct inode *inode, struct file *filp)
        if (!(info->flags & XGI_FLAG_OPEN)) {
                XGI_INFO("info->flags & XGI_FLAG_OPEN \n");
 
-               if (info->device_id == 0) {
+               if (info->dev->device == 0) {
                        XGI_INFO("open of nonexistent device %d\n", dev_num);
                        result = -ENXIO;
                        goto failed;
                }
 
                /* initialize struct irqaction */
-               status = request_irq(info->irq, xgi_kern_isr,
+               status = request_irq(info->dev->irq, xgi_kern_isr,
                                     SA_INTERRUPT | SA_SHIRQ, "xgi",
                                     (void *)info);
                if (status != 0) {
-                       if (info->irq && (status == -EBUSY)) {
+                       if (info->dev->irq && (status == -EBUSY)) {
                                XGI_ERROR
                                    ("Tried to get irq %d, but another driver",
-                                    (unsigned int)info->irq);
+                                    (unsigned int)info->dev->irq);
                                XGI_ERROR("has it and is not sharing it.\n");
                        }
                        XGI_ERROR("isr request failed 0x%x\n", status);
@@ -651,7 +646,7 @@ int xgi_kern_release(struct inode *inode, struct file *filp)
                 * Free the IRQ, which may block until all pending interrupt processing
                 * has completed.
                 */
-               free_irq(info->irq, (void *)info);
+               free_irq(info->dev->irq, (void *)info);
 
                xgi_cmdlist_cleanup(info);
 
@@ -1064,21 +1059,6 @@ static u8 xgi_find_pcie_capability(struct pci_dev *dev)
        return 0;
 }
 
-static struct pci_dev *xgi_get_pci_device(struct xgi_info * info)
-{
-       struct pci_dev *dev;
-
-       dev = XGI_PCI_GET_DEVICE(info->vendor_id, info->device_id, NULL);
-       while (dev) {
-               if (XGI_PCI_SLOT_NUMBER(dev) == info->slot
-                   && XGI_PCI_BUS_NUMBER(dev) == info->bus)
-                       return dev;
-               dev = XGI_PCI_GET_DEVICE(info->vendor_id, info->device_id, dev);
-       }
-
-       return NULL;
-}
-
 int xgi_kern_read_card_info(char *page, char **start, off_t off,
                            int count, int *eof, void *data)
 {
@@ -1089,7 +1069,7 @@ int xgi_kern_read_card_info(char *page, char **start, off_t off,
        struct xgi_info *info;
        info = (struct xgi_info *) data;
 
-       dev = xgi_get_pci_device(info);
+       dev = info->dev;
        if (!dev)
                return 0;
 
@@ -1162,13 +1142,10 @@ static void xgi_proc_create(void)
 
        xgi_max_devices = xgi_devices + XGI_MAX_DEVICES;
        for (info = xgi_devices; info < xgi_max_devices; info++) {
-               if (info->device_id == 0)
-                       break;
-
                /* world readable file */
                flags = S_IFREG | S_IRUGO;
 
-               dev = xgi_get_pci_device(info);
+               dev = info->dev;
                if (!dev)
                        break;
 
@@ -1314,19 +1291,19 @@ static void xgi_dev_init(struct xgi_info * info)
                for (dev = xgidev_list; dev->vendor; dev++) {
                        if ((dev->vendor == pdev->vendor)
                            && (dev->device == pdev->device)) {
+                               u8 rev_id;
+
                                XGI_INFO("dev->vendor = pdev->vendor= %x \n",
                                         dev->vendor);
                                XGI_INFO("dev->device = pdev->device= %x \n",
                                         dev->device);
 
-                               xgi_devices[found].device_id = pdev->device;
+                               xgi_devices[found].dev = pdev;
 
                                pci_read_config_byte(pdev, PCI_REVISION_ID,
-                                                    &xgi_devices[found].
-                                                    revision_id);
+                                                    rev_id);
 
-                               XGI_INFO("PCI_REVISION_ID= %x \n",
-                                        xgi_devices[found].revision_id);
+                               XGI_INFO("PCI_REVISION_ID= %x \n", rev_id);
 
                                pci_read_config_word(pdev, PCI_COMMAND,
                                                     &pci_cmd);
index 803ed9c..efbbd64 100644 (file)
@@ -105,11 +105,6 @@ struct xgi_info {
        struct pci_dev *dev;
        int flags;
        int device_number;
-       int bus;                /* PCI config info */
-       int slot;
-       int vendor_id;
-       U32 device_id;
-       u8 revision_id;
 
        /* physical characteristics */
        struct xgi_aperture mmio;
@@ -125,9 +120,8 @@ struct xgi_info {
        bool isLUTInLFB;
        unsigned int sdfbPageSize;
 
-       U32 pcie_config;
-       U32 pcie_status;
-       U32 irq;
+       u32 pcie_config;
+       u32 pcie_status;
 
        atomic_t use_count;
 
index 9c9fd38..d3385be 100644 (file)
 
 void xgi_get_device_info(struct xgi_info * info, struct xgi_chip_info * req)
 {
-       req->device_id = info->device_id;
+       req->device_id = info->dev->device;
        req->device_name[0] = 'x';
        req->device_name[1] = 'g';
        req->device_name[2] = '4';
        req->device_name[3] = '7';
-       req->vendor_id = info->vendor_id;
+       req->vendor_id = info->dev->vendor;
        req->curr_display_mode = 0;
        req->fb_size = info->fb.size;
        req->sarea_bus_addr = info->sarea_info.bus_addr;