Hi Jean, > > + vt1211_write8(data, VT1211_REG_PWM_CTL, > > + ((data->pwm_ctl[1] << 4) | > > + data->pwm_ctl[0])); > > + vt1211_write8(data, VT1211_REG_FAN_DIV, > > + ((data->fan_div[1] << 6) | > > + (data->fan_div[0] << 4) | > > + data->fan_ctl)); > > BTW, here you don't actually care about the values of fan_div, all you > need is to make sure you don't overwrite them in the register. In that > case it isn't very efficient to decode them and store them in the > cache, then shift and merge them again to recreate the register value. > Instead you could store the upper nibble of the register value in a > temporary variable, it'd be more efficient, and IMHO clearer. But if I don't update the cache I could end up with stale data on a following read. If there is a back-to-back read-write-read sequence, the 2nd read could return the cached value from the 1st read rather then the updated value from the write. ...juerg