Re: Ticket #2382

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

 



On Wed, Nov 20, 2013 at 07:25:09PM +0100, Jean Delvare wrote:
> On Wed, 20 Nov 2013 10:15:29 -0800, Guenter Roeck wrote:
> > On Wed, Nov 20, 2013 at 07:06:41PM +0100, Jean Delvare wrote:
> > > Personally I'd just do the minimum to avoid returning an error. In
> > > other words I'd be fine returning values down to 6 degrees (for the
> > > Atom D510 at least). We know the value is wrong but it can be corrected
> > > in user-space, while if we clamp higher, it can no longer be corrected.
> > 
> > Seems to me it would be much simpler to just return 0 if the valid bit is 0,
> > and not bother returning -EAGAIN in that case. After all, that is what
> > it boils down to, isn't it ?
> 
> In the specific case of these Atom chips, sort of, yes (although I'd
> return maybe 5000 for continuity with the last known good value, but
> that's not so important in the end, plus there's no guarantee that the
> limit is the same for other Atom CPU models / samples.)
> 
> However we can't really do that in general, as again there is no Intel
> documentation saying that valid == 0 can only mean "temperature too
> low". There may be other causes.
> 
> Now I really can't remember if we ever had reports of -EAGAIN being
> returned transiently. If the error is always permanent then I'd agree
> that returning 0 (or any other arbitrarily low value) is no worse than
> returning -EAGAIN.
> 
> Alternatively, as long as we have no clean way to return "lower than X
> but I don't know the exact value" to user-space, it might be more
> simple to just ignore the valid bit and always return the value. In
> ticket #2382 I found that values 1°C and 4°C would be returned instead
> of the error in that case, it's no worse than returning 0°C or an
> arbitrary 5°C, and it would come for absolutely no extra code.
> 
Both are ok with me. Either case it would be a one-line change.

-       return tdata->valid ? sprintf(buf, "%d\n", tdata->temp) : -EAGAIN;
+       return sprintf(buf, "%d\n", tdata->valid ? tdata->temp : 0);

or

-       return tdata->valid ? sprintf(buf, "%d\n", tdata->temp) : -EAGAIN;
+       return sprintf(buf, "%d\n", tdata->temp);

Let me know which one you prefer and I'll submit a patch.

Thanks,
Guenter

_______________________________________________
lm-sensors mailing list
lm-sensors@xxxxxxxxxxxxxx
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors





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

  Powered by Linux