Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 354967
b: refs/heads/master
c: 867ff98
h: refs/heads/master
i:
  354965: 672ed65
  354963: 066e9c0
  354959: a3ed94f
v: v3
  • Loading branch information
David Stevenson authored and Greg Kroah-Hartman committed Jan 16, 2013
1 parent ae603e5 commit 7ba0716
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 20 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: e5279ff6c9f5e950feac6e6f48621db912324c07
refs/heads/master: 867ff9880d5d71a38433c0471bc09bcc10851f36
25 changes: 6 additions & 19 deletions trunk/drivers/w1/slaves/w1_therm.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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)
Expand All @@ -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;
Expand Down Expand Up @@ -249,7 +236,7 @@ static ssize_t w1_therm_read(struct device *device,
}
}

if (!w1_therm_check_rom(rom))
if (verdict)
break;
}

Expand All @@ -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]);
Expand Down

0 comments on commit 7ba0716

Please sign in to comment.