All of lore.kernel.org
 help / color / mirror / Atom feed
* [lm-sensors] [PATCH v2 2/2] lm80.c: reinitialize client if data is
@ 2012-01-05 13:41 Frans Meulenbroeks
  2012-01-05 17:55 ` [lm-sensors] [PATCH v2 2/2] lm80.c: reinitialize client if data Guenter Roeck
  0 siblings, 1 reply; 2+ messages in thread
From: Frans Meulenbroeks @ 2012-01-05 13:41 UTC (permalink / raw)
  To: lm-sensors

if data->valid = 0 when asking for an update reinitialize
the client.
This is done for the case that the device got disconnected
as without reinitialisation it will not give any sensible
readings.

Signed-off-by: Frans Meulenbroeks <fransmeulenbroeks@gmail.com>
---

Tested with actual system and unplugging and replugging the device

 drivers/hwmon/lm80.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/drivers/hwmon/lm80.c b/drivers/hwmon/lm80.c
index 616f470..1d86912 100644
--- a/drivers/hwmon/lm80.c
+++ b/drivers/hwmon/lm80.c
@@ -583,6 +583,11 @@ static struct lm80_data *lm80_update_device(struct device *dev)
 
 	mutex_lock(&data->update_lock);
 
+    /* If the data is not valid it might be the device was temporarily
+       disconnected. In order to keep things running re-initialize the lm80 */
+	if (!data->valid)
+		lm80_init_client(client);
+
 	if (time_after(jiffies, data->last_updated + 2 * HZ) || !data->valid) {
 		dev_dbg(&client->dev, "Starting lm80 update\n");
 		for (i = 0; i <= 6; i++) {
-- 
1.7.0.4


_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-01-05 17:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-01-05 13:41 [lm-sensors] [PATCH v2 2/2] lm80.c: reinitialize client if data is Frans Meulenbroeks
2012-01-05 17:55 ` [lm-sensors] [PATCH v2 2/2] lm80.c: reinitialize client if data Guenter Roeck

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.