diff options
Diffstat (limited to 'firmware/hotswap.c')
-rw-r--r-- | firmware/hotswap.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/firmware/hotswap.c b/firmware/hotswap.c index 97c162ce39..ec298f7243 100644 --- a/firmware/hotswap.c +++ b/firmware/hotswap.c | |||
@@ -33,9 +33,14 @@ unsigned long card_extract_bits( | |||
33 | unsigned int start, /* bit no. to start reading */ | 33 | unsigned int start, /* bit no. to start reading */ |
34 | unsigned int size) /* how many bits to read */ | 34 | unsigned int size) /* how many bits to read */ |
35 | { | 35 | { |
36 | unsigned int long_index = start / 32; | 36 | unsigned int long_index, bit_index; |
37 | unsigned int bit_index = start % 32; | ||
38 | unsigned long result; | 37 | unsigned long result; |
38 | |||
39 | /* we assume words of CSD/CID are stored least significant word first */ | ||
40 | start = 127 - start; | ||
41 | |||
42 | long_index = start / 32; | ||
43 | bit_index = start % 32; | ||
39 | 44 | ||
40 | result = p[long_index] << bit_index; | 45 | result = p[long_index] << bit_index; |
41 | 46 | ||