* Re: [PATCH] resubmit w1_therm:Retries:remove old code add CRC
@ 2012-12-18 1:37 david
2012-12-24 18:47 ` Evgeniy Polyakov
0 siblings, 1 reply; 2+ messages in thread
From: david @ 2012-12-18 1:37 UTC (permalink / raw)
To: greg, zbr, linux-kernel
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>
diff --git a/drivers/w1/slaves/w1_therm.c b/drivers/w1/slaves/w1_therm.c
index 92d08e7..5ef583d 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
static int w1_strong_pullup = 1;
module_param_named(strong_pullup, w1_strong_pullup, int, 0);
-static u8 bad_roms[][9] = {
- {0xaa, 0x00, 0x4b, 0x46, 0xff, 0xff, 0x0c, 0x10, 0x87},
- {}
- };
static ssize_t w1_therm_read(struct device *device,
struct device_attribute *attr, char *buf);
@@ -168,16 +164,6 @@ static inline int w1_convert_temp(u8 rom[9], u8 fid)
return 0;
}
-static int w1_therm_check_rom(u8 rom[9])
-{
- int i;
-
- for (i=0; i<sizeof(bad_roms)/9; ++i)
- if (!memcmp(bad_roms[i], rom, 9))
- return 1;
-
- return 0;
-}
static ssize_t w1_therm_read(struct device *device,
struct device_attribute *attr, char *buf)
@@ -194,10 +180,11 @@ static ssize_t w1_therm_read(struct device *device,
memset(rom, 0, sizeof(rom));
- verdict = 0;
- crc = 0;
-
while (max_trying--) {
+
+ verdict = 0;
+ crc = 0;
+
if (!w1_reset_select_slave(sl)) {
int count = 0;
unsigned int tm = 750;
@@ -249,7 +236,7 @@ static ssize_t w1_therm_read(struct device *device,
}
}
- if (!w1_therm_check_rom(rom))
+ if (verdict)
break;
}
@@ -260,7 +247,7 @@ static ssize_t w1_therm_read(struct device *device,
if (verdict)
memcpy(sl->rom, rom, sizeof(sl->rom));
else
- dev_warn(device, "18S20 doesn't respond to CONVERT_TEMP.\n");
+ dev_warn(device, "Read failed CRC check\n");
for (i = 0; i < 9; ++i)
c -= snprintf(buf + PAGE_SIZE - c, c, "%02x ", sl->rom[i]);
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] resubmit w1_therm:Retries:remove old code add CRC
2012-12-18 1:37 [PATCH] resubmit w1_therm:Retries:remove old code add CRC david
@ 2012-12-24 18:47 ` Evgeniy Polyakov
0 siblings, 0 replies; 2+ messages in thread
From: Evgeniy Polyakov @ 2012-12-24 18:47 UTC (permalink / raw)
To: david; +Cc: greg, linux-kernel
Hi
Sorry for late reply - too much things to finish before the new year.
On Tue, Dec 18, 2012 at 01:37:56AM +0000, david (david@avoncliff.com) wrote:
> 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>
Greg, patch is ok, we discussed it in private with David
Please push it into your tree
Acked-by: Evgeniy Polyakov <zbr@ioremap.net>
--
Evgeniy Polyakov
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-12-24 18:47 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-12-18 1:37 [PATCH] resubmit w1_therm:Retries:remove old code add CRC david
2012-12-24 18:47 ` Evgeniy Polyakov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox