Re: [PATCH 2.6] I2C: New chip driver: sis5595

From: Jean Delvare
Date: Tue Feb 01 2005 - 09:52:18 EST



Quoting myself:

> To me, the only acceptable simplification is
> the initialization of "last_updated" to something which ensures that
> the first update attempt will succeed - providing we actually can do
> that.

On second thought, we obviously cannot, because jiffies wrap, so there is
no single initial value of "last_updated", either relative or
absolute, which can ensure this condition to be true. I think we are
stuck we this "valid" flag, or at least with the concept thereof.
Possibly we can use "last_updated" itself as a flag if we absolutely
want to get rid of "valid". "last_updated == 0" would mean the same
as "valid == 0" did. The probability of "last_updated" to become 0
again after init time is obviously thin, and it wouldn't really hurt if
it did (it would simply allow an extra update to happen). That said,
this makes the code somewhat trickier.

What could (and should) be done anyway is to use time_after() or
something equivalent for the jiffies checks, instead of direct
coparison, in all hardware monitoring drivers.

Thanks,
--
Jean Delvare
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/