[PATCH 1/2 RESEND 3] hwmon: new vt1211 driver

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Juerg,

> > > +             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.

Sorry, I don't follow you here. Do you have a concrete example please?

At any rate, this is only an optimization. If you don't feel
comfortable with it, you can go on with your method which will still
work.

Thanks,
-- 
Jean Delvare




[Index of Archives]     [Linux Kernel]     [Linux Hardware Monitoring]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux