• Jean Delvare's avatar
    [PATCH] I2C: Cleanup fan_div in w83781d · c188b751
    Jean Delvare authored
    Here is a proposed patch that cleanups the fan_div code from w83781d.
    The original code was obviously taken from the 2.4 driver, but the way
    things were done in 2.4 do not make any sense anymore (because we now
    have a single value per interface file).
    
    Since fan divisor bits are spread over three different regs with various
    bitmask manipulations, I don't think it makes much sense to have a
    single function as we do in most other cases. Having three different
    functions makes more sense, although they are of course similar. The
    size increment is only 581 bytes, I don't think its a problem since it
    also makes the code much more efficient and readable too IMHO.
    
    I agree that the original code was working - it was simply doing far too
    much work each time one would want to change a fan divisor.
    
    Originally, I took a look at the code because I wanted to fix the fact
    that changing fan divisors breaks fan mins. But it looked like a good
    cleanup before doing that was required. Once this patch will have been
    accepted, I'll work on the other one.
    
    I've tested my patch successfully on a W83781D and an AS99127F rev.1.
    Note that this means that one part of the code wasn't tested, because
    these are the two chips of the family that do not support divisors
    greater than 8. If anyone can test it, please do.
    c188b751
w83781d.c 52.1 KB