* [KJ] [PATCH 5/21] polling loops: change exit condition to
@ 2005-12-04 0:15 Marcin Slusarz
2005-12-10 17:55 ` Alexey Dobriyan
0 siblings, 1 reply; 2+ messages in thread
From: Marcin Slusarz @ 2005-12-04 0:15 UTC (permalink / raw)
To: kernel-janitors
HARDWARE MONITORING
P: Jean Delvare
M: khali@linux-fr.org
Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com>
diff -upr -X linux-2.6.15-rc4/Documentation/dontdiff linux-2.6.15-rc4-orig/drivers/hwmon/hdaps.c linux-2.6.15-rc4/drivers/hwmon/hdaps.c
--- linux-2.6.15-rc4-orig/drivers/hwmon/hdaps.c 2005-12-03 15:22:32.000000000 +0100
+++ linux-2.6.15-rc4/drivers/hwmon/hdaps.c 2005-12-03 16:53:10.000000000 +0100
@@ -211,7 +211,8 @@ static int hdaps_read_pair(unsigned int
*/
static int hdaps_device_init(void)
{
- int total, ret = -ENXIO;
+ int ret = -ENXIO;
+ unsigned long end_time;
down(&hdaps_sem);
@@ -265,7 +266,8 @@ static int hdaps_device_init(void)
goto out;
/* we have done our dance, now let's wait for the applause */
- for (total = INIT_TIMEOUT_MSECS; total > 0; total -= INIT_WAIT_MSECS) {
+ end_time = jiffies + msecs_to_jiffies(INIT_TIMEOUT_MSECS);
+ while (time_before(jiffies, end_time)) {
int x, y;
/* a read of the device helps push it into action */
diff -upr -X linux-2.6.15-rc4/Documentation/dontdiff linux-2.6.15-rc4-orig/drivers/hwmon/w83l785ts.c linux-2.6.15-rc4/drivers/hwmon/w83l785ts.c
--- linux-2.6.15-rc4-orig/drivers/hwmon/w83l785ts.c 2005-12-03 15:22:32.000000000 +0100
+++ linux-2.6.15-rc4/drivers/hwmon/w83l785ts.c 2005-12-03 19:56:20.000000000 +0100
@@ -40,8 +40,7 @@
#include <linux/hwmon-sysfs.h>
#include <linux/err.h>
-/* How many retries on register read error */
-#define MAX_RETRIES 5
+#define MAX_TIMEOUT 15
/*
* Address to scan
@@ -273,12 +272,14 @@ static int w83l785ts_detach_client(struc
static u8 w83l785ts_read_value(struct i2c_client *client, u8 reg, u8 defval)
{
- int value, i;
+ int value, i = 1;
+ unsigned long end_time;
/* Frequent read errors have been reported on Asus boards, so we
* retry on read errors. If it still fails (unlikely), return the
* default value requested by the caller. */
- for (i = 1; i <= MAX_RETRIES; i++) {
+ end_time = jiffies + msecs_to_jiffies(MAX_TIMEOUT);
+ while (time_before_eq(jiffies, end_time)) {
value = i2c_smbus_read_byte_data(client, reg);
if (value >= 0) {
dev_dbg(&client->dev, "Read 0x%02x from register "
@@ -287,6 +288,7 @@ static u8 w83l785ts_read_value(struct i2
}
dev_dbg(&client->dev, "Read failed, will retry in %d.\n", i);
msleep(i);
+ ++i;
}
dev_err(&client->dev, "Couldn't read value from register 0x%02x. "
_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
https://lists.osdl.org/mailman/listinfo/kernel-janitors
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [KJ] [PATCH 5/21] polling loops: change exit condition to
2005-12-04 0:15 [KJ] [PATCH 5/21] polling loops: change exit condition to Marcin Slusarz
@ 2005-12-10 17:55 ` Alexey Dobriyan
0 siblings, 0 replies; 2+ messages in thread
From: Alexey Dobriyan @ 2005-12-10 17:55 UTC (permalink / raw)
To: kernel-janitors
[-- Attachment #1: Type: text/plain, Size: 911 bytes --]
On Sun, Dec 04, 2005 at 01:15:13AM +0100, Marcin Slusarz wrote:
> --- linux-2.6.15-rc4-orig/drivers/hwmon/w83l785ts.c
> +++ linux-2.6.15-rc4/drivers/hwmon/w83l785ts.c
> -/* How many retries on register read error */
> -#define MAX_RETRIES 5
> +#define MAX_TIMEOUT 15
This is used only once too.
> static u8 w83l785ts_read_value(struct i2c_client *client, u8 reg, u8 defval)
> {
> - int value, i;
> + int value, i = 1;
> + unsigned long end_time;
>
> /* Frequent read errors have been reported on Asus boards, so we
> * retry on read errors. If it still fails (unlikely), return the
> * default value requested by the caller. */
> - for (i = 1; i <= MAX_RETRIES; i++) {
> + end_time = jiffies + msecs_to_jiffies(MAX_TIMEOUT);
> + while (time_before_eq(jiffies, end_time)) {
> value = i2c_smbus_read_byte_data(client, reg);
> if (value >= 0) {
> dev_dbg(&client->dev, "Read 0x%02x from register "
[-- Attachment #2: Type: text/plain, Size: 168 bytes --]
_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
https://lists.osdl.org/mailman/listinfo/kernel-janitors
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2005-12-10 17:55 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-12-04 0:15 [KJ] [PATCH 5/21] polling loops: change exit condition to Marcin Slusarz
2005-12-10 17:55 ` Alexey Dobriyan
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.