lm_sensors2/kernel/chips w83792d.c

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

 



Hi Mark M. Hoffman

Thank you for your suggestion, please refer to my answer below.

> Why is there a huge 'do {...} while(0)' loop in w83792d_fan()?  I
guess
> it's some kind of fan divisor auto-configuration.  If that's the case,
> shouldn't it be 'do {...} while(1)'?

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. :-)

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.


> Also, why not move the w83792d_update_client() call to the bottom of
the loop?

Which case do you mean ? Case 1 or Case 2?
Original:
		/* adjust Fan Divisor, then change RPM */
		do {
			w83792d_update_client(client);
			if ((data->fan[nr]>0x50) &&
(data->fan[nr]<0xff)) {
				......
			} else {
				......
			}
		} while (0);

After modification, Case 1:
		/* adjust Fan Divisor, then change RPM */
		do {
			if ((data->fan[nr]>0x50) &&
(data->fan[nr]<0xff)) {
				......
			} else {
				......
			}
			w83792d_update_client(client);
		} while (0);


After modification, Case 2:
		/* adjust Fan Divisor, then change RPM */
		do {
			if ((data->fan[nr]>0x50) &&
(data->fan[nr]<0xff)) {
				......
			} else {
				......
			}
		} while (0);
		w83792d_update_client(client);

It seems the "Case 1" is NOT good, because the "
w83792d_update_client()"
will NOT be executed when some "break" appears.

To tell the truth, I did not consider such problem before,
Would you please give me the sufficient reason of the modification?

Thanks
Best Regards
Chunhao


===========================================================================================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&nbsp; 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