[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <539A60FC.1050301@intel.com>
Date: Fri, 13 Jun 2014 10:25:00 +0800
From: Lan Tianyu <tianyu.lan@...el.com>
To: David Rientjes <rientjes@...gle.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 2014年06月13日 05:17, David Rientjes wrote:
> On Thu, 12 Jun 2014, Lan Tianyu wrote:
>
>> The retry time is set by randomly and not accurate because don't know
>> when EC will work normally. Set the retry time to 5 just in order to
>> make sure battery driver probing sucessfully every time,
>>
>
> Ok, I was hoping to avoid the excessive wait if it will never actually
> succeed
Ok. The battery driver has used async init and so this will not affect
the speed of boot up.
> but I assume there's some evidence that it can succeed after 40ms,
> 60ms, etc. Please consider the following instead:
>
> for (i = 0; i < 5; i++) {
> /* Comment on why we need a delay in between retries */
> if (i)
> msleep(20);
> result = acpi_battery_update(battery, false);
> if (!result)
> break;
> }
>
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;
+ }
+
--
Best regards
Tianyu Lan
--
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