diff options
author | Kaiwan N Billimoria <kaiwan@designergraphix.com> | 2009-01-07 10:37:34 -0500 |
---|---|---|
committer | Jean Delvare <khali@linux-fr.org> | 2009-01-07 10:37:34 -0500 |
commit | 2b7300513b98e05058a803de3beb8a1c0a0c61d9 (patch) | |
tree | 279b61da3b204e44bc52ad62a4836e28ffce1bde /drivers/hwmon | |
parent | 0589c2de643ef71a684ba6d219532f9e2a3e554b (diff) |
hwmon: (lm70) Code streamlining and cleanup
This fixes a byteswap bug in the LM70 temperature sensor driver,
which was previously covered up by a converse bug in the driver
for the LM70EVAL-LLP board (which is also fixed).
Other fixes: doc updates, remove an annoying msleep(), and improve
three-wire protocol handling.
Signed-off-by: Kaiwan N Billimoria <kaiwan@designergraphix.com>
[ dbrownell@users.sourceforge.net: doc and whitespace tweaks ]
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Diffstat (limited to 'drivers/hwmon')
-rw-r--r-- | drivers/hwmon/lm70.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/hwmon/lm70.c b/drivers/hwmon/lm70.c index d435f003292d..9f9741b1d2b5 100644 --- a/drivers/hwmon/lm70.c +++ b/drivers/hwmon/lm70.c | |||
@@ -65,10 +65,9 @@ static ssize_t lm70_sense_temp(struct device *dev, | |||
65 | "spi_write_then_read failed with status %d\n", status); | 65 | "spi_write_then_read failed with status %d\n", status); |
66 | goto out; | 66 | goto out; |
67 | } | 67 | } |
68 | dev_dbg(dev, "rxbuf[1] : 0x%x rxbuf[0] : 0x%x\n", rxbuf[1], rxbuf[0]); | 68 | raw = (rxbuf[0] << 8) + rxbuf[1]; |
69 | 69 | dev_dbg(dev, "rxbuf[0] : 0x%02x rxbuf[1] : 0x%02x raw=0x%04x\n", | |
70 | raw = (rxbuf[1] << 8) + rxbuf[0]; | 70 | rxbuf[0], rxbuf[1], raw); |
71 | dev_dbg(dev, "raw=0x%x\n", raw); | ||
72 | 71 | ||
73 | /* | 72 | /* |
74 | * The "raw" temperature read into rxbuf[] is a 16-bit signed 2's | 73 | * The "raw" temperature read into rxbuf[] is a 16-bit signed 2's |
@@ -109,6 +108,8 @@ static int __devinit lm70_probe(struct spi_device *spi) | |||
109 | if ((spi->mode & (SPI_CPOL|SPI_CPHA)) || !(spi->mode & SPI_3WIRE)) | 108 | if ((spi->mode & (SPI_CPOL|SPI_CPHA)) || !(spi->mode & SPI_3WIRE)) |
110 | return -EINVAL; | 109 | return -EINVAL; |
111 | 110 | ||
111 | /* NOTE: we assume 8-bit words, and convert to 16 bits manually */ | ||
112 | |||
112 | p_lm70 = kzalloc(sizeof *p_lm70, GFP_KERNEL); | 113 | p_lm70 = kzalloc(sizeof *p_lm70, GFP_KERNEL); |
113 | if (!p_lm70) | 114 | if (!p_lm70) |
114 | return -ENOMEM; | 115 | return -ENOMEM; |