PCI: struct device - replace bus_id with dev_name(), dev_set_name()
authorKay Sievers <kay.sievers@vrfy.org>
Thu, 30 Oct 2008 01:17:49 +0000 (02:17 +0100)
committerJesse Barnes <jbarnes@virtuousgeek.org>
Wed, 7 Jan 2009 19:12:23 +0000 (11:12 -0800)
This patch is part of a larger patch series which will remove
the "char bus_id[20]" name string from struct device. The device
name is managed in the kobject anyway, and without any size
limitation, and just needlessly copied into "struct device".

To set and read the device name dev_name(dev) and dev_set_name(dev)
must be used. If your code uses static kobjects, which it shouldn't
do, "const char *init_name" can be used to statically provide the
name the registered device should have. At registration time, the
init_name field is cleared, to enforce the use of dev_name(dev) to
access the device name at a later time.

We need to get rid of all occurrences of bus_id in the entire tree
to be able to enable the new interface. Please apply this patch,
and possibly convert any remaining remaining occurrences of bus_id.

Acked-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-Off-By: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
arch/x86/kernel/pci-dma.c
drivers/pci/hotplug/acpiphp_ibm.c
drivers/pci/irq.c
drivers/pci/pci-acpi.c
drivers/pci/pcie/portdrv_core.c
drivers/pci/probe.c

index 19a1044a0cd94fbdc64b6ffd1e3df8ecde4530c9..b25428533141a5a73fb8787268864b774c5e9752 100644 (file)
@@ -38,7 +38,7 @@ EXPORT_SYMBOL(bad_dma_address);
    be probably a smaller DMA mask, but this is bug-to-bug compatible
    to older i386. */
 struct device x86_dma_fallback_dev = {
-       .bus_id = "fallback device",
+       .init_name = "fallback device",
        .coherent_dma_mask = DMA_32BIT_MASK,
        .dma_mask = &x86_dma_fallback_dev.coherent_dma_mask,
 };
index 881fdd2b7313d61afbf3d3299d166370d2152c75..5befa7e379b73ffd43f242f4095c25265e8cad00 100644 (file)
@@ -271,7 +271,7 @@ static void ibm_handle_events(acpi_handle handle, u32 event, void *context)
                dbg("%s: generationg bus event\n", __func__);
                acpi_bus_generate_proc_event(note->device, note->event, detail);
                acpi_bus_generate_netlink_event(note->device->pnp.device_class,
-                                                 note->device->dev.bus_id,
+                                                 dev_name(&note->device->dev),
                                                  note->event, detail);
        } else
                note->event = event;
index 6441dfa969a38abcaf74d99c0499b0ab6058fce6..de01174aff067a2868817b5d64deea03cd040d55 100644 (file)
@@ -15,7 +15,7 @@ static void pci_note_irq_problem(struct pci_dev *pdev, const char *reason)
 
        dev_printk(KERN_ERR, &pdev->dev,
                   "Potentially misrouted IRQ (Bridge %s %04x:%04x)\n",
-                  parent->dev.bus_id, parent->vendor, parent->device);
+                  dev_name(&parent->dev), parent->vendor, parent->device);
        dev_printk(KERN_ERR, &pdev->dev, "%s\n", reason);
        dev_printk(KERN_ERR, &pdev->dev, "Please report to linux-kernel@vger.kernel.org\n");
        WARN_ON(1);
index ae5ec76dca77a636bf5b1f1a6cf4c52b03b8d9c8..2ed3f10d0860550fbe9d77da134efcf41d5909d8 100644 (file)
@@ -375,7 +375,7 @@ static int acpi_pci_find_root_bridge(struct device *dev, acpi_handle *handle)
         * The string should be the same as root bridge's name
         * Please look at 'pci_scan_bus_parented'
         */
-       num = sscanf(dev->bus_id, "pci%04x:%02x", &seg, &bus);
+       num = sscanf(dev_name(dev), "pci%04x:%02x", &seg, &bus);
        if (num != 2)
                return -ENODEV;
        *handle = acpi_get_pci_rootbridge_handle(seg, bus);
index 2e091e014829e61366ec69b1267d8d9f05e58111..75f501ab646853743ad99a1197ba12c64b67ab30 100644 (file)
@@ -224,7 +224,7 @@ static void pcie_device_init(struct pci_dev *parent, struct pcie_device *dev,
        device->driver = NULL;
        device->driver_data = NULL;
        device->release = release_pcie_device;  /* callback to free pcie dev */
-       snprintf(device->bus_id, sizeof(device->bus_id), "%s:pcie%02x",
+       dev_set_name(device, "%s:pcie%02x",
                 pci_name(parent), get_descriptor_id(port_type, service_type));
        device->parent = &parent->dev;
 }
index 5b3f5937ecf556429217afa10d58b0053f273269..eb2b985beb48af52775b002503337f45ca4f7231 100644 (file)
@@ -412,7 +412,7 @@ static struct pci_bus *pci_alloc_child_bus(struct pci_bus *parent,
         * registered later in pci_bus_add_devices()
         */
        child->dev.class = &pcibus_class;
-       sprintf(child->dev.bus_id, "%04x:%02x", pci_domain_nr(child), busnr);
+       dev_set_name(&child->dev, "%04x:%02x", pci_domain_nr(child), busnr);
 
        /*
         * Set up the primary, secondary and subordinate
@@ -1130,7 +1130,7 @@ struct pci_bus * pci_create_bus(struct device *parent,
        memset(dev, 0, sizeof(*dev));
        dev->parent = parent;
        dev->release = pci_release_bus_bridge_dev;
-       sprintf(dev->bus_id, "pci%04x:%02x", pci_domain_nr(b), bus);
+       dev_set_name(dev, "pci%04x:%02x", pci_domain_nr(b), bus);
        error = device_register(dev);
        if (error)
                goto dev_reg_err;
@@ -1141,7 +1141,7 @@ struct pci_bus * pci_create_bus(struct device *parent,
 
        b->dev.class = &pcibus_class;
        b->dev.parent = b->bridge;
-       sprintf(b->dev.bus_id, "%04x:%02x", pci_domain_nr(b), bus);
+       dev_set_name(&b->dev, "%04x:%02x", pci_domain_nr(b), bus);
        error = device_register(&b->dev);
        if (error)
                goto class_dev_reg_err;