2014-05-25 17:59:52

by Manuel Schölling

[permalink] [raw]
Subject: [PATCH] mwifiex: use time_after()

To be future-proof and for better readability the time comparisons are
modified to use time_after() instead of plain, error-prone math.

Signed-off-by: Manuel Schölling <[email protected]>
---
drivers/net/wireless/mwifiex/main.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/mwifiex/main.h b/drivers/net/wireless/mwifiex/main.h
index d53e1e8..3191066 100644
--- a/drivers/net/wireless/mwifiex/main.h
+++ b/drivers/net/wireless/mwifiex/main.h
@@ -1101,7 +1101,7 @@ mwifiex_11h_get_csa_closed_channel(struct mwifiex_private *priv)
return 0;

/* Clear csa channel, if DFS channel move time has passed */
- if (jiffies > priv->csa_expire_time) {
+ if (time_after(jiffies, priv->csa_expire_time)) {
priv->csa_chan = 0;
priv->csa_expire_time = 0;
}
--
1.7.10.4



2014-05-27 18:36:35

by Bing Zhao

[permalink] [raw]
Subject: RE: [PATCH] mwifiex: use time_after()

SGkgTWFudWVsLA0KDQpUaGFua3MgZm9yIHRoZSBwYXRjaC4NCg0KPiBUbyBiZSBmdXR1cmUtcHJv
b2YgYW5kIGZvciBiZXR0ZXIgcmVhZGFiaWxpdHkgdGhlIHRpbWUgY29tcGFyaXNvbnMgYXJlDQo+
IG1vZGlmaWVkIHRvIHVzZSB0aW1lX2FmdGVyKCkgaW5zdGVhZCBvZiBwbGFpbiwgZXJyb3ItcHJv
bmUgbWF0aC4NCj4gDQo+IFNpZ25lZC1vZmYtYnk6IE1hbnVlbCBTY2jDtmxsaW5nIDxtYW51ZWwu
c2Nob2VsbGluZ0BnbXguZGU+DQoNCkFja2VkLWJ5OiBCaW5nIFpoYW8gPGJ6aGFvQG1hcnZlbGwu
Y29tPg0KDQpSZWdhcmRzLA0KQmluZw0KDQo+IC0tLQ0KPiAgZHJpdmVycy9uZXQvd2lyZWxlc3Mv
bXdpZmlleC9tYWluLmggfCAgICAyICstDQo+ICAxIGZpbGUgY2hhbmdlZCwgMSB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