lm_sensors2/kernel/chips w83792d.c

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

 



Hi Mark M. Hoffman

> > We use that huge 'do {...} while(0)' to substitute the "goto"
sentence,
> > because the "goto" sentence is NOT welcome in most cases, we want to
> > avoid
> > it. :-)
> 
> If that was your intention, I would prefer if you just used goto.
> To use 'do {...} while(0)' as a "stealth" goto is even worse.

Maybe you are right, I copied these codes from our Windows driver,
without
too much consideration about it. I don't resist "goto" in my 792 driver,
you
can see there are some "goto" sentences in some other places of the
driver.

You may help me change the "do...while(0)" into "goto" sentence if you
want,
since I do NOT have a lm_sensors CVS account, If I want to modify it, I
have to generate a patch and send it to MDS for his help.

After the modification, please just send me a notice so that I can
download
from CVS and test it immediately. Or you may send it to me first for my
test, then commit it into CVS after the test.

> > Although the idea of changing "while (0)" into "while (1)" is
feasible,
> > We can NOT do that, it's dangerous to use such endless loop. We have
> > tested
> > it, the "while (1)" leads to bad result, while "while (0)" works
well.
> 
> Well, the purpose of this part of the code was not immediately clear
> to me.  Now I've read it more closely.  It seems you are trying to
> settle on an appropriate fan divisor - one which is appropriate for
> the measured fan speed.  But... the loop obviously isn't a loop at
> all, so you're only incrementing or decrementing fan_div[nr] by 1.
> That means the user would have to read the fan multiple times before
> the fan_div arrives at a useful value.  Is that what you wanted?

Yes, you are right, that is what I want, users have to run "sensors"
for several times before they get an appropriate fan measured value.
In our 792 Windows version, there is a GUI which access the 792 chip
with an interval such as every 5 seconds. So after several seconds, it
will reach the appropriate fan measured value automatically.


> Also notice, the way it's written now... the value reported in
> results[0] (the limit) will be wrong if the fan_div is written
> back to the chip immediately after.

> I should have noticed in the first place... but actually it doesn't
> matter at all.  It will only really update the values once anyway
> because of the rate limiting.  As it's written now, you may just as
> well get rid of the second one altogether.  Do you see why?
> 
> At any rate, I think there are multiple problems here.  Could you
> please explain exactly what you are trying to do between these lines?
> Then maybe I can help you better.
> 
> > 1000 else if (operation == SENSORS_PROC_REAL_READ) {
> > ???
> > 1042 } else if (operation == SENSORS_PROC_REAL_WRITE) {

When I wrote these codes, I'm also afraid of leading to some problems,
But the test result on our two motherboards seems good, So I kept those
codes. I remember that I have ever sent a mail to lm_sensors group
for your suggestion about this function w83792d_fan(), but do NOT get
any response.:-(

If you can help me to modify these codes better, you may try to modify
it, and ask me to test. But please keep my purpose of modifying the
fan divisor and measured value automatically, because it the request of
our customers. :-)

Thanks
Best Regards
Chunhao
2005-3-29


===========================================================================================The privileged confidential information contained in this email is intended for use only by the addressees as indicated by the original author of this email. If you are not the addressee indicated in this email or are not responsible for delivery of the email to such person, please kindly reply the sender indicating accordingly and delete all copies of it from your computer and network server immediately. We thank you for your cooperation. It is advisable that any unauthorized use of confidential information of Winbond is strictly prohibited; and any information in this email that does not relate to the official business of Winbond shall be deemed as neither given nor endorsed by Winbond.===========================================================================================If your computer is unable to decode Chinese font, please ignore the following message. They essentially repea!
 t the  English statement above.???H???????t?????q?l???]???????K?????T, ?????v???o?H?H???w?????H?H???\????. ?????z???D?Q???w?????H?H???]???????]?b???g???v?????????U???????H??, ???z?i?????o?H?H?????Y?N?H???q?q???P???????A???????H????. ?????z???X?@, ?????????P??. ?S??????, ???????g???v?????????????q?l?????K???T???????O?Q?Y???T????. ?H???P?????q?l???~?L???????e,???o?????????q?l?????????N??.



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

  Powered by Linux