Skip to content

Commit abd2fdb

Browse files
IvDoornlinvjw
authored andcommitted
rt2x00: Fix RF offset
The word_base is in bytes instead of word index number, this means that when using it, it should be transformed into a word index first. Otherwise RF register reading will fail through debugfs since we would start reading 4 words starting with word 4 (which is the last valid word for RF). Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
1 parent 98c8a60 commit abd2fdb

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

‎drivers/net/wireless/rt2x00/rt2x00debug.c‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -435,11 +435,12 @@ static ssize_t rt2x00debug_read_##__name(struct file *file, \
435435
if (index >= debug->__name.word_count) \
436436
return -EINVAL; \
437437
\
438+
index += (debug->__name.word_base / \
439+
debug->__name.word_size); \
440+
\
438441
if (debug->__name.flags & RT2X00DEBUGFS_OFFSET) \
439442
index *= debug->__name.word_size; \
440443
\
441-
index += debug->__name.word_base; \
442-
\
443444
debug->__name.read(intf->rt2x00dev, index, &value); \
444445
\
445446
size = sprintf(line, __format, value); \
@@ -476,11 +477,12 @@ static ssize_t rt2x00debug_write_##__name(struct file *file, \
476477
size = strlen(line); \
477478
value = simple_strtoul(line, NULL, 0); \
478479
\
480+
index += (debug->__name.word_base / \
481+
debug->__name.word_size); \
482+
\
479483
if (debug->__name.flags & RT2X00DEBUGFS_OFFSET) \
480484
index *= debug->__name.word_size; \
481485
\
482-
index += debug->__name.word_base; \
483-
\
484486
debug->__name.write(intf->rt2x00dev, index, value); \
485487
\
486488
*offset += size; \

0 commit comments

Comments
 (0)