On Friday 03 March 2006 00:21, Jaya Kumar wrote:
> On 2/22/06, Bjorn Helgaas <[EMAIL PROTECTED]> wrote:
> > But the loop body in acpi_driver_attach() is only executed once
> > per device (not once per device ID), so acpi_bus_driver_init() is
> > called at most once per device. And acpi_bus_driver_init() calls
> > the .add() method only once.
> >
> The scenario I was asking about is different. I'm asking whether it's
> possible that a system has multiple ACPI devices that each have at
> least one HID that maps to a single driver add(). Here's a scenario I
> was thinking about, let's say the BIOS states that I have an ACPI
> device that handle miscellaneous control buttons:
> Device (FOO1)
> {
> Name (_HID, "PNP0C0D")
>
> and on the same system, the BIOS states that I have another ACPI
> device that handles the power button:
> Device (FOO2)
> {
> Name (_HID, "ACPI_FPB")
>
> then this scenario would result in button.c's add() getting called twice.
> Right?
Yes. But you have two devices, and acpi_button_add() will get called
once for each of them, which is exactly what we want. Your original
question was about this line in acpi_button_add():
311 button = kmalloc(sizeof(struct acpi_button), GFP_KERNEL);
This kmalloc will happen for every button device, but the pointer is
attached to the acpi_device:
acpi_driver_data(device) = button;
and the corresponding kfree is in acpi_button_remove().
If you still think there is a problem, maybe it will be clear to me
if you post the patch to fix it.
Bjorn
-
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at http://vger.kernel.org/majordomo-info.html