powerpc pmu: Don't use garbage battery info.
If pmu_query_battery fails, don't notify a change in battery status. Reviewed by: jhibbits Differential Revision: https://reviews.freebsd.org/D34889
This commit is contained in:
parent
2ad93a4f6b
commit
5f2995aa95
@ -964,7 +964,7 @@ pmu_battery_notify(struct pmu_battstate *batt, struct pmu_battstate *old)
|
||||
}
|
||||
|
||||
static void
|
||||
pmu_battquery_proc()
|
||||
pmu_battquery_proc(void)
|
||||
{
|
||||
struct pmu_softc *sc;
|
||||
struct pmu_battstate batt;
|
||||
@ -977,8 +977,10 @@ pmu_battquery_proc()
|
||||
while (1) {
|
||||
kproc_suspend_check(curproc);
|
||||
error = pmu_query_battery(sc, 0, &batt);
|
||||
pmu_battery_notify(&batt, &cur_batt);
|
||||
cur_batt = batt;
|
||||
if (error == 0) {
|
||||
pmu_battery_notify(&batt, &cur_batt);
|
||||
cur_batt = batt;
|
||||
}
|
||||
pause("pmu_batt", hz);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user