From: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
To: Alexey Starikovskiy <astarikovskiy@suse.de>
Cc: linux acpi <linux-acpi@vger.kernel.org>,
Maxim Levitsky <maximlevitsky@gmail.com>
Subject: Re: [RFC] ACPI battery driver: odd usage of generic power supply class on battery removal
Date: Mon, 11 May 2009 16:44:49 +0100 [thread overview]
Message-ID: <4A0847F1.4060205@tuffmail.co.uk> (raw)
In-Reply-To: <4A07159A.9010006@tuffmail.co.uk>
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@mail.ru>
Signed-off-by: Alexey Starikovskiy <astarikovskiy@suse.de>
Signed-off-by: Len Brown <len.brown@intel.com>
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
prev parent reply other threads:[~2009-05-11 15:44 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-05-10 17:57 [RFC] ACPI battery driver: odd usage of generic power supply class on battery removal Alan Jenkins
2009-05-11 0:31 ` Maxim Levitsky
2009-05-11 15:44 ` Alan Jenkins [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4A0847F1.4060205@tuffmail.co.uk \
--to=alan-jenkins@tuffmail.co.uk \
--cc=astarikovskiy@suse.de \
--cc=linux-acpi@vger.kernel.org \
--cc=maximlevitsky@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox