Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1a927133 authored by Kay Sievers's avatar Kay Sievers Committed by Jesse Barnes
Browse files

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: default avatarGreg Kroah-Hartman <gregkh@suse.de>
Signed-Off-By: default avatarKay Sievers <kay.sievers@vrfy.org>
Signed-off-by: default avatarJesse Barnes <jbarnes@virtuousgeek.org>
parent bfb0f330
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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,
};
+1 −1
Original line number Diff line number Diff line
@@ -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;
+1 −1
Original line number Diff line number Diff line
@@ -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);
+1 −1
Original line number Diff line number Diff line
@@ -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);
+1 −1
Original line number Diff line number Diff line
@@ -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;
}
Loading