diff options
| author | David Stevenson <david@avoncliff.com> | 2012-12-17 20:37:56 -0500 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-01-16 02:43:05 -0500 |
| commit | 867ff9880d5d71a38433c0471bc09bcc10851f36 (patch) | |
| tree | bc723c92a38a39d5bdb27584ebdb069d297322f3 | |
| parent | e5279ff6c9f5e950feac6e6f48621db912324c07 (diff) | |
w1_therm: Retries: remove old code add CRC
w1_therm includes some obsolete code to detect bad_roms, this is no
longer relevant.
The retry code is only used for this bad_rom test, however there is a
CRC check that detects a bad read, but does not trigger a retry. This
patch removes all the bad_rom code and uses the CRC check to trigger
retries.
Signed-off-by: David Stevenson <david@avoncliff.com>
Acked-by: Evgeniy Polyakov <zbr@ioremap.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| -rw-r--r-- | drivers/w1/slaves/w1_therm.c | 25 |
1 files changed, 6 insertions, 19 deletions
diff --git a/drivers/w1/slaves/w1_therm.c b/drivers/w1/slaves/w1_therm.c index 92d08e7fcba2..5ef583d520fa 100644 --- a/drivers/w1/slaves/w1_therm.c +++ b/drivers/w1/slaves/w1_therm.c | |||
| @@ -45,10 +45,6 @@ MODULE_DESCRIPTION("Driver for 1-wire Dallas network protocol, temperature famil | |||
| 45 | static int w1_strong_pullup = 1; | 45 | static int w1_strong_pullup = 1; |
| 46 | module_param_named(strong_pullup, w1_strong_pullup, int, 0); | 46 | module_param_named(strong_pullup, w1_strong_pullup, int, 0); |
| 47 | 47 | ||
| 48 | static u8 bad_roms[][9] = { | ||
| 49 | {0xaa, 0x00, 0x4b, 0x46, 0xff, 0xff, 0x0c, 0x10, 0x87}, | ||
| 50 | {} | ||
| 51 | }; | ||
| 52 | 48 | ||
| 53 | static ssize_t w1_therm_read(struct device *device, | 49 | static ssize_t w1_therm_read(struct device *device, |
| 54 | struct device_attribute *attr, char *buf); | 50 | struct device_attribute *attr, char *buf); |
| @@ -168,16 +164,6 @@ static inline int w1_convert_temp(u8 rom[9], u8 fid) | |||
| 168 | return 0; | 164 | return 0; |
| 169 | } | 165 | } |
| 170 | 166 | ||
| 171 | static int w1_therm_check_rom(u8 rom[9]) | ||
| 172 | { | ||
| 173 | int i; | ||
| 174 | |||
| 175 | for (i=0; i<sizeof(bad_roms)/9; ++i) | ||
| 176 | if (!memcmp(bad_roms[i], rom, 9)) | ||
| 177 | return 1; | ||
| 178 | |||
| 179 | return 0; | ||
| 180 | } | ||
| 181 | 167 | ||
| 182 | static ssize_t w1_therm_read(struct device *device, | 168 | static ssize_t w1_therm_read(struct device *device, |
| 183 | struct device_attribute *attr, char *buf) | 169 | struct device_attribute *attr, char *buf) |
| @@ -194,10 +180,11 @@ static ssize_t w1_therm_read(struct device *device, | |||
| 194 | 180 | ||
| 195 | memset(rom, 0, sizeof(rom)); | 181 | memset(rom, 0, sizeof(rom)); |
| 196 | 182 | ||
| 197 | verdict = 0; | ||
| 198 | crc = 0; | ||
| 199 | |||
| 200 | while (max_trying--) { | 183 | while (max_trying--) { |
| 184 | |||
| 185 | verdict = 0; | ||
| 186 | crc = 0; | ||
| 187 | |||
| 201 | if (!w1_reset_select_slave(sl)) { | 188 | if (!w1_reset_select_slave(sl)) { |
| 202 | int count = 0; | 189 | int count = 0; |
| 203 | unsigned int tm = 750; | 190 | unsigned int tm = 750; |
| @@ -249,7 +236,7 @@ static ssize_t w1_therm_read(struct device *device, | |||
| 249 | } | 236 | } |
| 250 | } | 237 | } |
| 251 | 238 | ||
| 252 | if (!w1_therm_check_rom(rom)) | 239 | if (verdict) |
| 253 | break; | 240 | break; |
| 254 | } | 241 | } |
| 255 | 242 | ||
| @@ -260,7 +247,7 @@ static ssize_t w1_therm_read(struct device *device, | |||
| 260 | if (verdict) | 247 | if (verdict) |
| 261 | memcpy(sl->rom, rom, sizeof(sl->rom)); | 248 | memcpy(sl->rom, rom, sizeof(sl->rom)); |
| 262 | else | 249 | else |
| 263 | dev_warn(device, "18S20 doesn't respond to CONVERT_TEMP.\n"); | 250 | dev_warn(device, "Read failed CRC check\n"); |
| 264 | 251 | ||
| 265 | for (i = 0; i < 9; ++i) | 252 | for (i = 0; i < 9; ++i) |
| 266 | c -= snprintf(buf + PAGE_SIZE - c, c, "%02x ", sl->rom[i]); | 253 | c -= snprintf(buf + PAGE_SIZE - c, c, "%02x ", sl->rom[i]); |
