* [PATCH] drivers/power/sbs-battery.c: don't trigger false supply_changed event
@ 2012-05-09 6:30 Nikolaus Voss
2012-05-09 14:51 ` Rhyland Klein
0 siblings, 1 reply; 3+ messages in thread
From: Nikolaus Voss @ 2012-05-09 6:30 UTC (permalink / raw)
To: linux-kernel; +Cc: cbouatmailru, rklein
power_supply_changed() events are triggerd based on the return value
of a get_property() call. However the property TECHNOLOGY is
hard-coded to LION in this driver, thus always succeeds.
So, with the battery removed, this triggers a false battery present
uevent. This uevent triggers a new query via power_supply_uevent()
which again starts to query all known properties and thus leads to
an infinite loop of battery present/not-present uevents.
This patch skips the battery presence detection for the hard-coded
property TECHNOLOGY.
Signed-off-by: Nikolaus Voss <n.voss@weinmann.de>
---
drivers/power/sbs-battery.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/power/sbs-battery.c b/drivers/power/sbs-battery.c
index 182d2ed..ef142f8 100644
--- a/drivers/power/sbs-battery.c
+++ b/drivers/power/sbs-battery.c
@@ -469,7 +469,7 @@ static int sbs_get_property(struct power_supply *psy,
case POWER_SUPPLY_PROP_TECHNOLOGY:
val->intval = POWER_SUPPLY_TECHNOLOGY_LION;
- break;
+ goto done; /* don't trigger power_supply_changed()! */
case POWER_SUPPLY_PROP_ENERGY_NOW:
case POWER_SUPPLY_PROP_ENERGY_FULL:
--
1.7.9.5
^ permalink raw reply related [flat|nested] 3+ messages in thread
* RE: [PATCH] drivers/power/sbs-battery.c: don't trigger false supply_changed event
2012-05-09 6:30 [PATCH] drivers/power/sbs-battery.c: don't trigger false supply_changed event Nikolaus Voss
@ 2012-05-09 14:51 ` Rhyland Klein
2012-06-20 3:31 ` Anton Vorontsov
0 siblings, 1 reply; 3+ messages in thread
From: Rhyland Klein @ 2012-05-09 14:51 UTC (permalink / raw)
To: 'Nikolaus Voss', 'linux-kernel@vger.kernel.org'
Cc: 'cbouatmailru@gmail.com'
On Wed, 2012-05-09 at 2:31, Nikolaus Voss wrote:
>power_supply_changed() events are triggerd based on the return value
>of a get_property() call. However the property TECHNOLOGY is
>hard-coded to LION in this driver, thus always succeeds.
>
>So, with the battery removed, this triggers a false battery present
>uevent. This uevent triggers a new query via power_supply_uevent()
>which again starts to query all known properties and thus leads to
>an infinite loop of battery present/not-present uevents.
>
>This patch skips the battery presence detection for the hard-coded
>property TECHNOLOGY.
>
>Signed-off-by: Nikolaus Voss <n.voss@weinmann.de>
Acked-by Rhyland Klein <rklein@nvidia.com>
--
nvpublic
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] drivers/power/sbs-battery.c: don't trigger false supply_changed event
2012-05-09 14:51 ` Rhyland Klein
@ 2012-06-20 3:31 ` Anton Vorontsov
0 siblings, 0 replies; 3+ messages in thread
From: Anton Vorontsov @ 2012-06-20 3:31 UTC (permalink / raw)
To: Rhyland Klein
Cc: 'Nikolaus Voss', 'linux-kernel@vger.kernel.org'
On Wed, May 09, 2012 at 07:51:05AM -0700, Rhyland Klein wrote:
> On Wed, 2012-05-09 at 2:31, Nikolaus Voss wrote:
> >power_supply_changed() events are triggerd based on the return value
> >of a get_property() call. However the property TECHNOLOGY is
> >hard-coded to LION in this driver, thus always succeeds.
> >
> >So, with the battery removed, this triggers a false battery present
> >uevent. This uevent triggers a new query via power_supply_uevent()
> >which again starts to query all known properties and thus leads to
> >an infinite loop of battery present/not-present uevents.
> >
> >This patch skips the battery presence detection for the hard-coded
> >property TECHNOLOGY.
> >
> >Signed-off-by: Nikolaus Voss <n.voss@weinmann.de>
>
> Acked-by Rhyland Klein <rklein@nvidia.com>
Applied, thanks!
--
Anton Vorontsov
Email: cbouatmailru@gmail.com
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-06-20 3:32 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-05-09 6:30 [PATCH] drivers/power/sbs-battery.c: don't trigger false supply_changed event Nikolaus Voss
2012-05-09 14:51 ` Rhyland Klein
2012-06-20 3:31 ` Anton Vorontsov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).