lkml.org 
[lkml]   [2014]   [Jun]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] ACPI/Battery: Retry to get Battery information if failed during probing
On Fri, 13 Jun 2014, Lan Tianyu wrote:

> How about this?
>
> - result = acpi_battery_update(battery, false);
> - if (result)
> +
> + /*
> + * Some machines'(E,G Lenovo Z480) ECs are not stable
> + * during boot up and this causes battery driver fails to be
> + * probed due to failure of getting battery information
> + * from EC sometimes. After several retries, the operation
> + * may work. So add retry code here and 20ms sleep between
> + * every retries.
> + */
> + while (acpi_battery_update(battery, false) && retry--)
> + msleep(20);
> + if (!retry) {
> + result = -ENODEV;
> goto fail;
> + }
> +

I think you want --retry and not retry--. Otherwise it's possible for the
final call to acpi_battery_update() to succeed and now it's returning
-ENODEV.


\
 
 \ /
  Last update: 2014-06-14 00:41    [W:0.456 / U:0.756 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site