This is more to point out the bug in w1_slave_read_id, the next patch
rewrites the routine.
w1.c 1.15
Reading at an offset other than zero, ie reading less than 8 bytes at
a time would result in reading the first bytes over and over until 8
bytes were returned. Added the offset to the buffer.
Signed-off-by: David Fries <[email protected]>
---
drivers/w1/w1.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/w1/w1.c b/drivers/w1/w1.c
index b18eedb..dbd9930 100644
--- a/drivers/w1/w1.c
+++ b/drivers/w1/w1.c
@@ -110,13 +110,13 @@ static ssize_t w1_slave_read_id(struct kobject *kobj,
{
struct w1_slave *sl = kobj_to_w1_slave(kobj);
- if (off > 8) {
+ if (off >= 8) {
count = 0;
} else {
if (off + count > 8)
count = 8 - off;
- memcpy(buf, (u8 *)&sl->reg_num, count);
+ memcpy(buf, (u8 *)&sl->reg_num+off, count);
}
return count;
--
1.4.4.4