Re: [patch 0/2] acpi: driverregistration again can report ENODEV

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Friday 20 October 2006 03:59, Thomas Renninger wrote:
> On Fri, 2006-10-20 at 11:25 +0200, fseidel@xxxxxxx wrote:
> > Currently acpi_bus_register_driver only reports an error
> > (-ENODEV) if acpi_disabled is true,
> > but many acpi drivers also depend on a negative error
> > value if no driver could be attached to a device
> > (as e.g. driver/acpi/asus_acpi.c).
> > This patch adds this again (without changing return type
> > of acpi_driver_attach for this).

I object to this.

> acpi_bus_register_driver must return -ENODEV when no device with
> matching HID was found. E.g. battery also should currently get always
> loaded even a system never has one.

If the driver wants to unload if it doesn't find any devices,
it can easily do so by counting calls to its add() method, as
asus_acpi.c currently does.  I don't think that's a good long-
term solution, though.  I think it would be better to have a
hotplug scheme that loads the driver when the hardware is
found, like we do for PCI.

> driver_attach returned the amount of found devices in past, this was
> changed recently (can't find the patch/mail) right now. This change
> broke things and should get corrected by these patches.

Here's my patch that results in the current behavior:
  http://kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=9d9f749b316ac21cb59ad3e595cbce469b409e1a

What did it break?  I haven't seen any reports of problems.

I think it's a mistake to have acpi_bus_register_driver() return
any indication of how many devices were claimed.  If the driver
needs to know how many devices it claimed, it can easily count
them in its add() method.  Returning the count from register_driver()
is racey if devices can be hot-plugged.

Bjorn
-
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux IBM ACPI]     [Linux Power Management]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux