[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.DEB.2.02.1406131445130.31981@chino.kir.corp.google.com>
Date: Fri, 13 Jun 2014 14:46:11 -0700 (PDT)
From: David Rientjes <rientjes@...gle.com>
To: Lan Tianyu <tianyu.lan@...el.com>
cc: rjw@...ysocki.net, lenb@...nel.org, naszar@...ru,
linux-acpi@...r.kernel.org, linux-kernel@...r.kernel.org,
stable@...r.kernel.org
Subject: Re: [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.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists