Commit abd34d8d authored by Bjørn Mork's avatar Bjørn Mork Committed by Mauro Carvalho Chehab

[media] use pci_dev->revision

pci_setup_device() has saved the PCI revision in the pci_dev
struct since Linux 2.6.23.  Use it.

Cc: Auke Kok <auke-jan.h.kok@intel.com>
Signed-off-by: default avatarBjørn Mork <bjorn@mork.no>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent ec0c8d55
...@@ -378,12 +378,7 @@ static int saa7146_init_one(struct pci_dev *pci, const struct pci_device_id *ent ...@@ -378,12 +378,7 @@ static int saa7146_init_one(struct pci_dev *pci, const struct pci_device_id *ent
dev->pci = pci; dev->pci = pci;
/* get chip-revision; this is needed to enable bug-fixes */ /* get chip-revision; this is needed to enable bug-fixes */
err = pci_read_config_dword(pci, PCI_CLASS_REVISION, &dev->revision); dev->revision = pci->revision;
if (err < 0) {
ERR(("pci_read_config_dword() failed.\n"));
goto err_disable;
}
dev->revision &= 0xf;
/* remap the memory from virtual to physical address */ /* remap the memory from virtual to physical address */
......
...@@ -290,10 +290,8 @@ static void flexcop_pci_dma_exit(struct flexcop_pci *fc_pci) ...@@ -290,10 +290,8 @@ static void flexcop_pci_dma_exit(struct flexcop_pci *fc_pci)
static int flexcop_pci_init(struct flexcop_pci *fc_pci) static int flexcop_pci_init(struct flexcop_pci *fc_pci)
{ {
int ret; int ret;
u8 card_rev;
pci_read_config_byte(fc_pci->pdev, PCI_CLASS_REVISION, &card_rev); info("card revision %x", fc_pci->pdev->revision);
info("card revision %x", card_rev);
if ((ret = pci_enable_device(fc_pci->pdev)) != 0) if ((ret = pci_enable_device(fc_pci->pdev)) != 0)
return ret; return ret;
......
...@@ -460,7 +460,7 @@ static int __devinit bt878_probe(struct pci_dev *dev, ...@@ -460,7 +460,7 @@ static int __devinit bt878_probe(struct pci_dev *dev,
goto fail0; goto fail0;
} }
pci_read_config_byte(dev, PCI_CLASS_REVISION, &bt->revision); bt->revision = dev->revision;
pci_read_config_byte(dev, PCI_LATENCY_TIMER, &lat); pci_read_config_byte(dev, PCI_LATENCY_TIMER, &lat);
......
...@@ -48,7 +48,7 @@ ...@@ -48,7 +48,7 @@
int __devinit mantis_pci_init(struct mantis_pci *mantis) int __devinit mantis_pci_init(struct mantis_pci *mantis)
{ {
u8 revision, latency; u8 latency;
struct mantis_hwconfig *config = mantis->hwconfig; struct mantis_hwconfig *config = mantis->hwconfig;
struct pci_dev *pdev = mantis->pdev; struct pci_dev *pdev = mantis->pdev;
int err, ret = 0; int err, ret = 0;
...@@ -95,9 +95,8 @@ int __devinit mantis_pci_init(struct mantis_pci *mantis) ...@@ -95,9 +95,8 @@ int __devinit mantis_pci_init(struct mantis_pci *mantis)
} }
pci_read_config_byte(pdev, PCI_LATENCY_TIMER, &latency); pci_read_config_byte(pdev, PCI_LATENCY_TIMER, &latency);
pci_read_config_byte(pdev, PCI_CLASS_REVISION, &revision);
mantis->latency = latency; mantis->latency = latency;
mantis->revision = revision; mantis->revision = pdev->revision;
dprintk(MANTIS_ERROR, 0, " Mantis Rev %d [%04x:%04x], ", dprintk(MANTIS_ERROR, 0, " Mantis Rev %d [%04x:%04x], ",
mantis->revision, mantis->revision,
......
...@@ -4303,7 +4303,7 @@ static int __devinit bttv_probe(struct pci_dev *dev, ...@@ -4303,7 +4303,7 @@ static int __devinit bttv_probe(struct pci_dev *dev,
goto fail0; goto fail0;
} }
pci_read_config_byte(dev, PCI_CLASS_REVISION, &btv->revision); btv->revision = dev->revision;
pci_read_config_byte(dev, PCI_LATENCY_TIMER, &lat); pci_read_config_byte(dev, PCI_LATENCY_TIMER, &lat);
printk(KERN_INFO "bttv%d: Bt%d (rev %d) at %s, ", printk(KERN_INFO "bttv%d: Bt%d (rev %d) at %s, ",
bttv_num,btv->id, btv->revision, pci_name(dev)); bttv_num,btv->id, btv->revision, pci_name(dev));
......
...@@ -818,7 +818,7 @@ static int cx18_setup_pci(struct cx18 *cx, struct pci_dev *pci_dev, ...@@ -818,7 +818,7 @@ static int cx18_setup_pci(struct cx18 *cx, struct pci_dev *pci_dev,
cmd |= PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER; cmd |= PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER;
pci_write_config_word(pci_dev, PCI_COMMAND, cmd); pci_write_config_word(pci_dev, PCI_COMMAND, cmd);
pci_read_config_byte(pci_dev, PCI_CLASS_REVISION, &cx->card_rev); cx->card_rev = pci_dev->revision;
pci_read_config_byte(pci_dev, PCI_LATENCY_TIMER, &pci_latency); pci_read_config_byte(pci_dev, PCI_LATENCY_TIMER, &pci_latency);
if (pci_latency < 64 && cx18_pci_latency) { if (pci_latency < 64 && cx18_pci_latency) {
......
...@@ -2045,7 +2045,7 @@ static int __devinit cx23885_initdev(struct pci_dev *pci_dev, ...@@ -2045,7 +2045,7 @@ static int __devinit cx23885_initdev(struct pci_dev *pci_dev,
} }
/* print pci info */ /* print pci info */
pci_read_config_byte(pci_dev, PCI_CLASS_REVISION, &dev->pci_rev); dev->pci_rev = pci_dev->revision;
pci_read_config_byte(pci_dev, PCI_LATENCY_TIMER, &dev->pci_lat); pci_read_config_byte(pci_dev, PCI_LATENCY_TIMER, &dev->pci_lat);
printk(KERN_INFO "%s/0: found at %s, rev: %d, irq: %d, " printk(KERN_INFO "%s/0: found at %s, rev: %d, irq: %d, "
"latency: %d, mmio: 0x%llx\n", dev->name, "latency: %d, mmio: 0x%llx\n", dev->name,
......
...@@ -474,7 +474,7 @@ static int cx8802_init_common(struct cx8802_dev *dev) ...@@ -474,7 +474,7 @@ static int cx8802_init_common(struct cx8802_dev *dev)
return -EIO; return -EIO;
} }
pci_read_config_byte(dev->pci, PCI_CLASS_REVISION, &dev->pci_rev); dev->pci_rev = dev->pci->revision;
pci_read_config_byte(dev->pci, PCI_LATENCY_TIMER, &dev->pci_lat); pci_read_config_byte(dev->pci, PCI_LATENCY_TIMER, &dev->pci_lat);
printk(KERN_INFO "%s/2: found at %s, rev: %d, irq: %d, " printk(KERN_INFO "%s/2: found at %s, rev: %d, irq: %d, "
"latency: %d, mmio: 0x%llx\n", dev->core->name, "latency: %d, mmio: 0x%llx\n", dev->core->name,
......
...@@ -1832,7 +1832,7 @@ static int __devinit cx8800_initdev(struct pci_dev *pci_dev, ...@@ -1832,7 +1832,7 @@ static int __devinit cx8800_initdev(struct pci_dev *pci_dev,
dev->core = core; dev->core = core;
/* print pci info */ /* print pci info */
pci_read_config_byte(pci_dev, PCI_CLASS_REVISION, &dev->pci_rev); dev->pci_rev = pci_dev->revision;
pci_read_config_byte(pci_dev, PCI_LATENCY_TIMER, &dev->pci_lat); pci_read_config_byte(pci_dev, PCI_LATENCY_TIMER, &dev->pci_lat);
printk(KERN_INFO "%s/0: found at %s, rev: %d, irq: %d, " printk(KERN_INFO "%s/0: found at %s, rev: %d, irq: %d, "
"latency: %d, mmio: 0x%llx\n", core->name, "latency: %d, mmio: 0x%llx\n", core->name,
......
...@@ -810,7 +810,6 @@ static int ivtv_setup_pci(struct ivtv *itv, struct pci_dev *pdev, ...@@ -810,7 +810,6 @@ static int ivtv_setup_pci(struct ivtv *itv, struct pci_dev *pdev,
const struct pci_device_id *pci_id) const struct pci_device_id *pci_id)
{ {
u16 cmd; u16 cmd;
u8 card_rev;
unsigned char pci_latency; unsigned char pci_latency;
IVTV_DEBUG_INFO("Enabling pci device\n"); IVTV_DEBUG_INFO("Enabling pci device\n");
...@@ -857,7 +856,6 @@ static int ivtv_setup_pci(struct ivtv *itv, struct pci_dev *pdev, ...@@ -857,7 +856,6 @@ static int ivtv_setup_pci(struct ivtv *itv, struct pci_dev *pdev,
} }
IVTV_DEBUG_INFO("Bus Mastering Enabled.\n"); IVTV_DEBUG_INFO("Bus Mastering Enabled.\n");
pci_read_config_byte(pdev, PCI_CLASS_REVISION, &card_rev);
pci_read_config_byte(pdev, PCI_LATENCY_TIMER, &pci_latency); pci_read_config_byte(pdev, PCI_LATENCY_TIMER, &pci_latency);
if (pci_latency < 64 && ivtv_pci_latency) { if (pci_latency < 64 && ivtv_pci_latency) {
...@@ -874,7 +872,7 @@ static int ivtv_setup_pci(struct ivtv *itv, struct pci_dev *pdev, ...@@ -874,7 +872,7 @@ static int ivtv_setup_pci(struct ivtv *itv, struct pci_dev *pdev,
IVTV_DEBUG_INFO("%d (rev %d) at %02x:%02x.%x, " IVTV_DEBUG_INFO("%d (rev %d) at %02x:%02x.%x, "
"irq: %d, latency: %d, memory: 0x%lx\n", "irq: %d, latency: %d, memory: 0x%lx\n",
pdev->device, card_rev, pdev->bus->number, pdev->device, pdev->revision, pdev->bus->number,
PCI_SLOT(pdev->devfn), PCI_FUNC(pdev->devfn), PCI_SLOT(pdev->devfn), PCI_FUNC(pdev->devfn),
pdev->irq, pci_latency, (unsigned long)itv->base_addr); pdev->irq, pci_latency, (unsigned long)itv->base_addr);
......
...@@ -927,7 +927,7 @@ static int __devinit saa7134_initdev(struct pci_dev *pci_dev, ...@@ -927,7 +927,7 @@ static int __devinit saa7134_initdev(struct pci_dev *pci_dev,
} }
/* print pci info */ /* print pci info */
pci_read_config_byte(pci_dev, PCI_CLASS_REVISION, &dev->pci_rev); dev->pci_rev = pci_dev->revision;
pci_read_config_byte(pci_dev, PCI_LATENCY_TIMER, &dev->pci_lat); pci_read_config_byte(pci_dev, PCI_LATENCY_TIMER, &dev->pci_lat);
printk(KERN_INFO "%s: found at %s, rev: %d, irq: %d, " printk(KERN_INFO "%s: found at %s, rev: %d, irq: %d, "
"latency: %d, mmio: 0x%llx\n", dev->name, "latency: %d, mmio: 0x%llx\n", dev->name,
......
...@@ -1247,7 +1247,7 @@ static int __devinit saa7164_initdev(struct pci_dev *pci_dev, ...@@ -1247,7 +1247,7 @@ static int __devinit saa7164_initdev(struct pci_dev *pci_dev,
} }
/* print pci info */ /* print pci info */
pci_read_config_byte(pci_dev, PCI_CLASS_REVISION, &dev->pci_rev); dev->pci_rev = pci_dev->revision;
pci_read_config_byte(pci_dev, PCI_LATENCY_TIMER, &dev->pci_lat); pci_read_config_byte(pci_dev, PCI_LATENCY_TIMER, &dev->pci_lat);
printk(KERN_INFO "%s/0: found at %s, rev: %d, irq: %d, " printk(KERN_INFO "%s/0: found at %s, rev: %d, irq: %d, "
"latency: %d, mmio: 0x%llx\n", dev->name, "latency: %d, mmio: 0x%llx\n", dev->name,
......
...@@ -1230,7 +1230,7 @@ static int __devinit zoran_probe(struct pci_dev *pdev, ...@@ -1230,7 +1230,7 @@ static int __devinit zoran_probe(struct pci_dev *pdev,
mutex_init(&zr->other_lock); mutex_init(&zr->other_lock);
if (pci_enable_device(pdev)) if (pci_enable_device(pdev))
goto zr_unreg; goto zr_unreg;
pci_read_config_byte(zr->pci_dev, PCI_CLASS_REVISION, &zr->revision); zr->revision = zr->pci_dev->revision;
dprintk(1, dprintk(1,
KERN_INFO KERN_INFO
......
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