• Jean Delvare's avatar
    [PATCH] I2C: speed up eeprom driver by a factor of 4 · 10ffbb04
    Jean Delvare authored
    Basically, I divide the eeprom in 8 32-byte slices. Each of it has a
    "valid" boolean (combined together into a bitfield) and a jiffies
    counter. Eeprom_update_client() is added a new parameter to specify
    which slice to update. Code updated accordingly. Finally, the read
    function updates only slices that need to be. The code is heavily
    inspired from what was done in the CVS driver, of course.
    
    Three additional notes:
    
    1* This fixes a bug in eeprom_update_client()'s refresh condition. We
    used to check jiffies before valid, although jiffies are not defined if
    valid isn't true. That was already fixed in our CVS driver but for some
    reason the fix did not go into 2.6 yet.
    
    2* This also skips the update if the read if out of bounds. I think this
    is the thing to do.
    
    3* It can be discussed wether eeprom_update_client() should take two
    slice parameters instead of one (start slice, end slice). This would
    make things slightly faster when consecutive slices are requested. Maybe
    the code would even be clearer. It wasn't done so far because the CVS
    driver wouldn't benefit from it (because the EEPROM's contents are split
    over several "output" files in that version of the driver) but I'll
    probably give it a try in 2.6.
    10ffbb04
eeprom.c 8.01 KB