From: Javier Cardona Date: Sat, 31 Mar 2012 18:31:31 +0000 (-0700) Subject: mac80211: Allow tsf increments via debugfs X-Git-Tag: v3.5-rc1~109^2~410^2~154 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=9bdd3a6bf8513a0a9eda031d15b36e4677854243;p=platform%2Fkernel%2Flinux-stable.git mac80211: Allow tsf increments via debugfs Reading and writing back the tsf value via tsf is too slow if one wants to make small increments to this timer. With this change you can use the syntax "+=" or "-=" to add or substract a value from the tsf counter. Signed-off-by: Javier Cardona Signed-off-by: John W. Linville --- diff --git a/net/mac80211/debugfs_netdev.c b/net/mac80211/debugfs_netdev.c index 6ed0455..b0fc205 100644 --- a/net/mac80211/debugfs_netdev.c +++ b/net/mac80211/debugfs_netdev.c @@ -424,6 +424,7 @@ static ssize_t ieee80211_if_parse_tsf( struct ieee80211_local *local = sdata->local; unsigned long long tsf; int ret; + int tsf_is_delta = 0; if (strncmp(buf, "reset", 5) == 0) { if (local->ops->reset_tsf) { @@ -431,9 +432,20 @@ static ssize_t ieee80211_if_parse_tsf( wiphy_info(local->hw.wiphy, "debugfs reset TSF\n"); } } else { + if (buflen > 10 && buf[1] == '=') { + if (buf[0] == '+') + tsf_is_delta = 1; + else if (buf[0] == '-') + tsf_is_delta = -1; + else + return -EINVAL; + buf += 2; + } ret = kstrtoull(buf, 10, &tsf); if (ret < 0) return -EINVAL; + if (tsf_is_delta) + tsf = drv_get_tsf(local, sdata) + tsf_is_delta * tsf; if (local->ops->set_tsf) { drv_set_tsf(local, sdata, tsf); wiphy_info(local->hw.wiphy,