Re: [RFC] ACPI battery driver: odd usage of generic power supply class on battery removal

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

 



Alan Jenkins wrote:
> Hi,
>
> The ACPI battery driver does something strange with the generic power
> supply class, when the battery is removed from my laptop.  Instead of
> clearing the "present" attribute of the class device, it removes the
> entire class device.
>
> Can this be corrected, or is there a specific reason for it?
>
> Patch follows for illustration purposes.
>
> If this can be changed, I'd also try to cleanup
> acpi_battery_update().  I don't think it's right that
> CONFIG_ACPI_SYSFS_POWER affects the control flow.  When it's disabled,
> acpi_battery_present() is not tested before calling
> acpi_battery_get_state().  It might not cause any problems, but it is
> evil.
>

Ignore that patch, it won't work :-).  I have correct code prepared now
though.


    ACPI: battery: register power_supply subdevice only when battery is
present
   
    Make sure no power_supply object is present unless we actualy detect
    presence of battery. This fixes ghost batteries detected by HAL
   
    Signed-off-by: Andrey Borzenkov <arvidjaar@xxxxxxx>
    Signed-off-by: Alexey Starikovskiy <astarikovskiy@xxxxxxx>
    Signed-off-by: Len Brown <len.brown@xxxxxxxxx>


Ok, I found the original discussion
<http://lkml.indiana.edu/hypermail/linux/kernel/0710.3/2001.html>.  At
that point, the battery driver tried to change the set of properties
dynamically.  If the battery was not present, there was a bug that
caused the set of properties to be left empty.

But it doesn't do that right now.  When I tested my (corrected) patches,
the set of properties remained constant, "present" returned "0", and all
the other attributes returned -ENODEV.

So I think we can revisit this and fix it the right way this time :-). 
I just need to write the descriptions, then I'll submit the patches for
review.

Thanks
Alan
--
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