Skip to contentSkip to conversation

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

PATCH Kay Sievers 2 participants 4 messages Oct 30, 2008 – Nov 3, 2008 Char and misc drivers

lore
Share & tools
lore
#0 lore raw

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.

We want to submit a patch to -next, which will remove bus_id from "struct device", to find the remaining pieces to convert, and finally switch over to the new api, which will remove the 20 bytes array and does no longer have a size limitation.

Thanks,
Kay

From: Kay Sievers <[email protected]>
Subject: thinkpad_acpi: struct device - replace bus_id with dev_name(), dev_set_name()

---

drivers/misc/thinkpad_acpi.c +4 -4
index 4db1cf9..46a06e1 100644
@@ -2376,7 +2376,7 @@ static void hotkey_notify(struct ibm_struct *ibm, u32 event)
 		/* forward it to userspace, maybe it knows how to handle it */
 		acpi_bus_generate_netlink_event(
 					ibm->acpi->device->pnp.device_class,
-					ibm->acpi->device->dev.bus_id,
+					dev_name(&ibm->acpi->device->dev),
 					event, 0);
 		return;
 	}
@@ -2506,7 +2506,7 @@ static void hotkey_notify(struct ibm_struct *ibm, u32 event)
 		if (!ignore_acpi_ev && send_acpi_ev) {
 			acpi_bus_generate_netlink_event(
 					ibm->acpi->device->pnp.device_class,
-					ibm->acpi->device->dev.bus_id,
+					dev_name(&ibm->acpi->device->dev),
 					event, hkey);
 		}
 	}
@@ -3725,7 +3725,7 @@ static void dock_notify(struct ibm_struct *ibm, u32 event)
 	}
 	acpi_bus_generate_proc_event(ibm->acpi->device, event, data);
 	acpi_bus_generate_netlink_event(ibm->acpi->device->pnp.device_class,
-					  ibm->acpi->device->dev.bus_id,
+					  dev_name(&ibm->acpi->device->dev),
 					  event, data);
 }
 
@@ -3827,7 +3827,7 @@ static void bay_notify(struct ibm_struct *ibm, u32 event)
 {
 	acpi_bus_generate_proc_event(ibm->acpi->device, event, 0);
 	acpi_bus_generate_netlink_event(ibm->acpi->device->pnp.device_class,
-					  ibm->acpi->device->dev.bus_id,
+					  dev_name(&ibm->acpi->device->dev),
 					  event, 0);
 }
 
#1 lore raw
Quoted 6 lines · Kay Sievers

From: Kay Sievers <[email protected]>
Subject: thinkpad_acpi: struct device - replace bus_id with dev_name(), dev_set_name()

Do you want me to push it to Len for merge through the acpi tree, or are you guys going to be handle it through another tree?

Signature · 4 lines
  "One disk to rule them all, One disk to find them. One disk to bring
  them all and in the darkness grind them. In the Land of Redmond
  where the shadows lie." -- The Silicon Valley Tarot
  Henrique Holschuh
#2 lore raw
Quoted 4 lines · Henrique de Moraes Holschuh
Quoted 3 lines · Kay Sievers

From: Kay Sievers <[email protected]>
Subject: thinkpad_acpi: struct device - replace bus_id with dev_name(), dev_set_name()

Quoted 8 lines
Quoted 3 lines

Do you want me to push it to Len for merge through the acpi tree, or are you guys going to be handle it through another tree?

Would be nice if you can push it and it will show up in -next soon, so we can check there what's still missing.

Thanks,
Kay

#3 lore raw
Quoted 10 lines · Kay Sievers
Quoted 8 lines · Henrique de Moraes Holschuh
Quoted 6 lines · Kay Sievers

From: Kay Sievers <[email protected]>
Subject: thinkpad_acpi: struct device - replace bus_id with dev_name(), dev_set_name()

Quoted 7 lines
Quoted 4 lines

Do you want me to push it to Len for merge through the acpi tree, or are you guys going to be handle it through another tree?

Would be nice if you can push it and it will show up in -next soon, so we can check there what's still missing.

I will push it to Len, but it depends on him when it will hit -next.

Signature · 4 lines
  "One disk to rule them all, One disk to find them. One disk to bring
  them all and in the darkness grind them. In the Land of Redmond
  where the shadows lie." -- The Silicon Valley Tarot
  Henrique Holschuh