2008-10-30 01:39:11

by Kay Sievers

[permalink] [raw]
Subject: thinkpad_acpi: 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.

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()

CC: Henrique de Moraes Holschuh <[email protected]>
Acked-by: Greg Kroah-Hartman <[email protected]>
Signed-Off-By: Kay Sievers <[email protected]>
---


diff --git a/drivers/misc/thinkpad_acpi.c b/drivers/misc/thinkpad_acpi.c
index 4db1cf9..46a06e1 100644
--- a/drivers/misc/thinkpad_acpi.c
+++ b/drivers/misc/thinkpad_acpi.c
@@ -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);
}


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

On Thu, 30 Oct 2008, Kay Sievers wrote:
> From: Kay Sievers <[email protected]>
> Subject: thinkpad_acpi: struct device - replace bus_id with dev_name(), dev_set_name()
>
> CC: Henrique de Moraes Holschuh <[email protected]>
> Acked-by: Greg Kroah-Hartman <[email protected]>
> Signed-Off-By: Kay Sievers <[email protected]>

Acked-by: Henrique de Moraes Holschuh <[email protected]>

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?

--
"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

2008-11-03 15:14:37

by Kay Sievers

[permalink] [raw]
Subject: Re: thinkpad_acpi: struct device - replace bus_id with dev_name(), dev_set_name()

On Mon, Nov 3, 2008 at 15:54, Henrique de Moraes Holschuh
<[email protected]> wrote:
> On Thu, 30 Oct 2008, Kay Sievers wrote:
>> From: Kay Sievers <[email protected]>
>> Subject: thinkpad_acpi: struct device - replace bus_id with dev_name(), dev_set_name()
>>
>> CC: Henrique de Moraes Holschuh <[email protected]>
>> Acked-by: Greg Kroah-Hartman <[email protected]>
>> Signed-Off-By: Kay Sievers <[email protected]>
>
> Acked-by: Henrique de Moraes Holschuh <[email protected]>
>
> 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

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

On Mon, 03 Nov 2008, Kay Sievers wrote:
> On Mon, Nov 3, 2008 at 15:54, Henrique de Moraes Holschuh
> <[email protected]> wrote:
> > On Thu, 30 Oct 2008, Kay Sievers wrote:
> >> From: Kay Sievers <[email protected]>
> >> Subject: thinkpad_acpi: struct device - replace bus_id with dev_name(), dev_set_name()
> >>
> >> CC: Henrique de Moraes Holschuh <[email protected]>
> >> Acked-by: Greg Kroah-Hartman <[email protected]>
> >> Signed-Off-By: Kay Sievers <[email protected]>
> >
> > Acked-by: Henrique de Moraes Holschuh <[email protected]>
> >
> > 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.

--
"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