summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Wilcox <willy@debian.org>2003-06-26 03:27:43 -0700
committerGreg Kroah-Hartman <greg@kroah.com>2003-06-26 03:27:43 -0700
commita822b57bb40c2cf45b86c6d23fd2a1e7b527bcd6 (patch)
tree8c6da51344ce26cdde309e57d96bc7d4450d9140
parentf5f7e4d0cfa69ded0fdbe50435d0c972313cdca6 (diff)
[PATCH] PCI: create pci_name()
This patch introduces pci_name() and converts slot_name into a pointer to dev.bus_id.
-rw-r--r--drivers/pci/probe.c16
-rw-r--r--include/linux/pci.h10
2 files changed, 16 insertions, 10 deletions
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index c79e074800bf..0894f4aed331 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -109,7 +109,7 @@ static void pci_read_bases(struct pci_dev *dev, unsigned int howmany, int rom)
(((unsigned long) ~sz) << 32);
#else
if (l) {
- printk(KERN_ERR "PCI: Unable to handle 64-bit address for device %s\n", dev->slot_name);
+ printk(KERN_ERR "PCI: Unable to handle 64-bit address for device %s\n", pci_name(dev));
res->start = 0;
res->flags = 0;
continue;
@@ -304,7 +304,7 @@ int __devinit pci_scan_bridge(struct pci_bus *bus, struct pci_dev * dev, int max
pci_read_config_dword(dev, PCI_PRIMARY_BUS, &buses);
DBG("Scanning behind PCI bridge %s, config %06x, pass %d\n",
- dev->slot_name, buses & 0xffffff, pass);
+ pci_name(dev), buses & 0xffffff, pass);
if ((buses & 0xffff00) && !pcibios_assign_all_busses() && !is_cardbus) {
unsigned int cmax;
@@ -403,8 +403,9 @@ static int pci_setup_device(struct pci_dev * dev)
{
u32 class;
- sprintf(dev->slot_name, "%02x:%02x.%d", dev->bus->number,
- PCI_SLOT(dev->devfn), PCI_FUNC(dev->devfn));
+ dev->slot_name = dev->dev.bus_id;
+ sprintf(pci_name(dev), "%04x:%02x:%02x.%d", pci_domain_nr(dev->bus),
+ dev->bus->number, PCI_SLOT(dev->devfn), PCI_FUNC(dev->devfn));
sprintf(dev->dev.name, "PCI device %04x:%04x",
dev->vendor, dev->device);
@@ -452,12 +453,12 @@ static int pci_setup_device(struct pci_dev * dev)
default: /* unknown header */
printk(KERN_ERR "PCI: device %s has unknown header type %02x, ignoring.\n",
- dev->slot_name, dev->hdr_type);
+ pci_name(dev), dev->hdr_type);
return -1;
bad:
printk(KERN_ERR "PCI: %s: class %x doesn't match header type %02x. Ignoring class.\n",
- dev->slot_name, class, dev->hdr_type);
+ pci_name(dev), class, dev->hdr_type);
dev->class = PCI_CLASS_NOT_DEFINED;
}
@@ -531,9 +532,6 @@ pci_scan_device(struct pci_bus *bus, int devfn)
pci_name_device(dev);
- /* now put in global tree */
- sprintf(dev->dev.bus_id, "%04x:%s", pci_domain_nr(bus),
- dev->slot_name);
dev->dev.dma_mask = &dev->dma_mask;
return dev;
diff --git a/include/linux/pci.h b/include/linux/pci.h
index ff810c39e0bd..3ceb5d7da821 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -414,7 +414,7 @@ struct pci_dev {
struct resource dma_resource[DEVICE_COUNT_DMA];
struct resource irq_resource[DEVICE_COUNT_IRQ];
- char slot_name[8]; /* slot name */
+ char * slot_name; /* pointer to dev.bus_id */
/* These fields are used by common fixups */
unsigned int transparent:1; /* Transparent PCI bridge */
@@ -804,6 +804,14 @@ static inline void pci_set_drvdata (struct pci_dev *pdev, void *data)
dev_set_drvdata(&pdev->dev, data);
}
+/* If you want to know what to call your pci_dev, ask this function.
+ * Again, it's a wrapper around the generic device.
+ */
+static inline char *pci_name(struct pci_dev *pdev)
+{
+ return pdev->dev.bus_id;
+}
+
/*
* The world is not perfect and supplies us with broken PCI devices.
* For at least a part of these bugs we need a work-around, so both