ntb_hw_switchtec: Make partition index larger than 31 workable#67
ntb_hw_switchtec: Make partition index larger than 31 workable#67wesleywesley merged 1 commit intodevelfrom
Conversation
lsgunth
left a comment
There was a problem hiding this comment.
Mostly looks good, but you should be using __ffs64(), not __ffs(). The latter will still be 32bits on non-64bit platforms.
The title of the commit should reflect that it's fixing a bug. "Make something workable" is very awkward english.
"Fix bug with more than 32 partitions caused by integer ffs"
Or something like that.
|
@lsgunth I found the ffs/fls are defined on /include/asm-generic/bitops __ffs/__fls __ffs64 was defined on /include/linux/bitops.h One question: Regard, |
|
We can have a helper function like this to make input zero valid. And for the fls function, we can make another similar function fls_64() with u64 data as the input (refer to __ffs64() in the kernel). |
|
If you make helper functions such as those, it's going to be a pain to upstream as we'd really need to do it correctly and put them in the common code. Just use the ones that are available and their associated semantics. __ffs64() and fls64(). |
674d219 to
fab53ce
Compare
Switchtec could support as mush as 48 partitions, but ffs & fls are for 32 bit argument, in case of partition index larger than 31, the current code could not parse the peer partition index correctly. Change to the 64 bit version __ffs64 & fls64 accordingly to fix this bug. Signed-off-by: Wesley Sheng <wesley.sheng@microchip.com>
Switchtec could support as mush as 48 partitions, but ffs & fls are
for 32 bit argument, in case of partition index larger than 31, the
current code could not parse the peer partition index correctly.
Change to the 64 bit version __ffs & __fls accordlingly to fix this
bug.
Signed-off-by: Wesley Sheng wesley.sheng@microchip.com