Commit 1a9271331ab663f3c7cda78d86b884f2ea86d4d7

Authored by Kay Sievers
Committed by Jesse Barnes
1 parent bfb0f330a6

PCI: struct device - replace bus_id with dev_name(), dev_set_name()

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>

Showing 6 changed files with 8 additions and 8 deletions Side-by-side Diff

arch/x86/kernel/pci-dma.c
... ... @@ -38,7 +38,7 @@
38 38 be probably a smaller DMA mask, but this is bug-to-bug compatible
39 39 to older i386. */
40 40 struct device x86_dma_fallback_dev = {
41   - .bus_id = "fallback device",
  41 + .init_name = "fallback device",
42 42 .coherent_dma_mask = DMA_32BIT_MASK,
43 43 .dma_mask = &x86_dma_fallback_dev.coherent_dma_mask,
44 44 };
drivers/pci/hotplug/acpiphp_ibm.c
... ... @@ -271,7 +271,7 @@
271 271 dbg("%s: generationg bus event\n", __func__);
272 272 acpi_bus_generate_proc_event(note->device, note->event, detail);
273 273 acpi_bus_generate_netlink_event(note->device->pnp.device_class,
274   - note->device->dev.bus_id,
  274 + dev_name(&note->device->dev),
275 275 note->event, detail);
276 276 } else
277 277 note->event = event;
... ... @@ -15,7 +15,7 @@
15 15  
16 16 dev_printk(KERN_ERR, &pdev->dev,
17 17 "Potentially misrouted IRQ (Bridge %s %04x:%04x)\n",
18   - parent->dev.bus_id, parent->vendor, parent->device);
  18 + dev_name(&parent->dev), parent->vendor, parent->device);
19 19 dev_printk(KERN_ERR, &pdev->dev, "%s\n", reason);
20 20 dev_printk(KERN_ERR, &pdev->dev, "Please report to linux-kernel@vger.kernel.org\n");
21 21 WARN_ON(1);
drivers/pci/pci-acpi.c
... ... @@ -375,7 +375,7 @@
375 375 * The string should be the same as root bridge's name
376 376 * Please look at 'pci_scan_bus_parented'
377 377 */
378   - num = sscanf(dev->bus_id, "pci%04x:%02x", &seg, &bus);
  378 + num = sscanf(dev_name(dev), "pci%04x:%02x", &seg, &bus);
379 379 if (num != 2)
380 380 return -ENODEV;
381 381 *handle = acpi_get_pci_rootbridge_handle(seg, bus);
drivers/pci/pcie/portdrv_core.c
... ... @@ -224,7 +224,7 @@
224 224 device->driver = NULL;
225 225 device->driver_data = NULL;
226 226 device->release = release_pcie_device; /* callback to free pcie dev */
227   - snprintf(device->bus_id, sizeof(device->bus_id), "%s:pcie%02x",
  227 + dev_set_name(device, "%s:pcie%02x",
228 228 pci_name(parent), get_descriptor_id(port_type, service_type));
229 229 device->parent = &parent->dev;
230 230 }
... ... @@ -412,7 +412,7 @@
412 412 * registered later in pci_bus_add_devices()
413 413 */
414 414 child->dev.class = &pcibus_class;
415   - sprintf(child->dev.bus_id, "%04x:%02x", pci_domain_nr(child), busnr);
  415 + dev_set_name(&child->dev, "%04x:%02x", pci_domain_nr(child), busnr);
416 416  
417 417 /*
418 418 * Set up the primary, secondary and subordinate
... ... @@ -1130,7 +1130,7 @@
1130 1130 memset(dev, 0, sizeof(*dev));
1131 1131 dev->parent = parent;
1132 1132 dev->release = pci_release_bus_bridge_dev;
1133   - sprintf(dev->bus_id, "pci%04x:%02x", pci_domain_nr(b), bus);
  1133 + dev_set_name(dev, "pci%04x:%02x", pci_domain_nr(b), bus);
1134 1134 error = device_register(dev);
1135 1135 if (error)
1136 1136 goto dev_reg_err;
... ... @@ -1141,7 +1141,7 @@
1141 1141  
1142 1142 b->dev.class = &pcibus_class;
1143 1143 b->dev.parent = b->bridge;
1144   - sprintf(b->dev.bus_id, "%04x:%02x", pci_domain_nr(b), bus);
  1144 + dev_set_name(&b->dev, "%04x:%02x", pci_domain_nr(b), bus);
1145 1145 error = device_register(&b->dev);
1146 1146 if (error)
1147 1147 goto class_dev_reg_err;