summaryrefslogtreecommitdiffstats
path: root/net/mac802154
diff options
context:
space:
mode:
authorAlexander Aring <alex.aring@gmail.com>2014-10-28 13:21:21 -0400
committerMarcel Holtmann <marcel@holtmann.org>2014-10-28 18:19:07 -0400
commit59cb300f2b2ce1fc46696deb9a7bd066cd53a65a (patch)
treec5bb25ddba1f8b419f3dab5b17bc43d051980f5b /net/mac802154
parentb6eea9ca354aeb80d358ff52d046bb8a26bd2b17 (diff)
mac802154: use driver-ops function wrappers
This patch replaces all directly called driver ops by previous introduced driver-ops function wrappers. Signed-off-by: Alexander Aring <alex.aring@gmail.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'net/mac802154')
-rw-r--r--net/mac802154/iface.c25
-rw-r--r--net/mac802154/main.c13
-rw-r--r--net/mac802154/mib.c3
-rw-r--r--net/mac802154/tx.c5
4 files changed, 26 insertions, 20 deletions
diff --git a/net/mac802154/iface.c b/net/mac802154/iface.c
index 0b21413081f1..025cd5aba13f 100644
--- a/net/mac802154/iface.c
+++ b/net/mac802154/iface.c
@@ -30,6 +30,7 @@
30#include <net/cfg802154.h> 30#include <net/cfg802154.h>
31 31
32#include "ieee802154_i.h" 32#include "ieee802154_i.h"
33#include "driver-ops.h"
33 34
34static int mac802154_wpan_update_llsec(struct net_device *dev) 35static int mac802154_wpan_update_llsec(struct net_device *dev)
35{ 36{
@@ -168,7 +169,7 @@ static int mac802154_slave_open(struct net_device *dev)
168 mutex_unlock(&sdata->local->iflist_mtx); 169 mutex_unlock(&sdata->local->iflist_mtx);
169 170
170 if (local->open_count++ == 0) { 171 if (local->open_count++ == 0) {
171 res = local->ops->start(&local->hw); 172 res = drv_start(local);
172 WARN_ON(res); 173 WARN_ON(res);
173 if (res) 174 if (res)
174 goto err; 175 goto err;
@@ -186,6 +187,7 @@ static int mac802154_wpan_open(struct net_device *dev)
186{ 187{
187 int rc; 188 int rc;
188 struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev); 189 struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev);
190 struct ieee802154_local *local = sdata->local;
189 struct wpan_phy *phy = sdata->local->phy; 191 struct wpan_phy *phy = sdata->local->phy;
190 192
191 rc = mac802154_slave_open(dev); 193 rc = mac802154_slave_open(dev);
@@ -195,40 +197,41 @@ static int mac802154_wpan_open(struct net_device *dev)
195 mutex_lock(&phy->pib_lock); 197 mutex_lock(&phy->pib_lock);
196 198
197 if (phy->set_txpower) { 199 if (phy->set_txpower) {
198 rc = phy->set_txpower(phy, sdata->mac_params.transmit_power); 200 rc = drv_set_tx_power(local, sdata->mac_params.transmit_power);
199 if (rc < 0) 201 if (rc < 0)
200 goto out; 202 goto out;
201 } 203 }
202 204
203 if (phy->set_lbt) { 205 if (phy->set_lbt) {
204 rc = phy->set_lbt(phy, sdata->mac_params.lbt); 206 rc = drv_set_lbt_mode(local, sdata->mac_params.lbt);
205 if (rc < 0) 207 if (rc < 0)
206 goto out; 208 goto out;
207 } 209 }
208 210
209 if (phy->set_cca_mode) { 211 if (phy->set_cca_mode) {
210 rc = phy->set_cca_mode(phy, sdata->mac_params.cca_mode); 212 rc = drv_set_cca_mode(local, sdata->mac_params.cca_mode);
211 if (rc < 0) 213 if (rc < 0)
212 goto out; 214 goto out;
213 } 215 }
214 216
215 if (phy->set_cca_ed_level) { 217 if (phy->set_cca_ed_level) {
216 rc = phy->set_cca_ed_level(phy, sdata->mac_params.cca_ed_level); 218 rc = drv_set_cca_ed_level(local,
219 sdata->mac_params.cca_ed_level);
217 if (rc < 0) 220 if (rc < 0)
218 goto out; 221 goto out;
219 } 222 }
220 223
221 if (phy->set_csma_params) { 224 if (phy->set_csma_params) {
222 rc = phy->set_csma_params(phy, sdata->mac_params.min_be, 225 rc = drv_set_csma_params(local, sdata->mac_params.min_be,
223 sdata->mac_params.max_be, 226 sdata->mac_params.max_be,
224 sdata->mac_params.csma_retries); 227 sdata->mac_params.csma_retries);
225 if (rc < 0) 228 if (rc < 0)
226 goto out; 229 goto out;
227 } 230 }
228 231
229 if (phy->set_frame_retries) { 232 if (phy->set_frame_retries) {
230 rc = phy->set_frame_retries(phy, 233 rc = drv_set_max_frame_retries(local,
231 sdata->mac_params.frame_retries); 234 sdata->mac_params.frame_retries);
232 if (rc < 0) 235 if (rc < 0)
233 goto out; 236 goto out;
234 } 237 }
@@ -255,7 +258,7 @@ static int mac802154_slave_close(struct net_device *dev)
255 mutex_unlock(&sdata->local->iflist_mtx); 258 mutex_unlock(&sdata->local->iflist_mtx);
256 259
257 if (!--local->open_count) 260 if (!--local->open_count)
258 local->ops->stop(&local->hw); 261 drv_stop(local);
259 262
260 return 0; 263 return 0;
261} 264}
diff --git a/net/mac802154/main.c b/net/mac802154/main.c
index 632707bc47b9..24ecc09de2a4 100644
--- a/net/mac802154/main.c
+++ b/net/mac802154/main.c
@@ -28,6 +28,7 @@
28#include <net/cfg802154.h> 28#include <net/cfg802154.h>
29 29
30#include "ieee802154_i.h" 30#include "ieee802154_i.h"
31#include "driver-ops.h"
31 32
32static int 33static int
33mac802154_netdev_register(struct wpan_phy *phy, struct net_device *dev) 34mac802154_netdev_register(struct wpan_phy *phy, struct net_device *dev)
@@ -124,28 +125,28 @@ static int mac802154_set_txpower(struct wpan_phy *phy, int db)
124{ 125{
125 struct ieee802154_local *local = wpan_phy_priv(phy); 126 struct ieee802154_local *local = wpan_phy_priv(phy);
126 127
127 return local->ops->set_txpower(&local->hw, db); 128 return drv_set_tx_power(local, db);
128} 129}
129 130
130static int mac802154_set_lbt(struct wpan_phy *phy, bool on) 131static int mac802154_set_lbt(struct wpan_phy *phy, bool on)
131{ 132{
132 struct ieee802154_local *local = wpan_phy_priv(phy); 133 struct ieee802154_local *local = wpan_phy_priv(phy);
133 134
134 return local->ops->set_lbt(&local->hw, on); 135 return drv_set_lbt_mode(local, on);
135} 136}
136 137
137static int mac802154_set_cca_mode(struct wpan_phy *phy, u8 mode) 138static int mac802154_set_cca_mode(struct wpan_phy *phy, u8 mode)
138{ 139{
139 struct ieee802154_local *local = wpan_phy_priv(phy); 140 struct ieee802154_local *local = wpan_phy_priv(phy);
140 141
141 return local->ops->set_cca_mode(&local->hw, mode); 142 return drv_set_cca_mode(local, mode);
142} 143}
143 144
144static int mac802154_set_cca_ed_level(struct wpan_phy *phy, s32 level) 145static int mac802154_set_cca_ed_level(struct wpan_phy *phy, s32 level)
145{ 146{
146 struct ieee802154_local *local = wpan_phy_priv(phy); 147 struct ieee802154_local *local = wpan_phy_priv(phy);
147 148
148 return local->ops->set_cca_ed_level(&local->hw, level); 149 return drv_set_cca_ed_level(local, level);
149} 150}
150 151
151static int mac802154_set_csma_params(struct wpan_phy *phy, u8 min_be, 152static int mac802154_set_csma_params(struct wpan_phy *phy, u8 min_be,
@@ -153,14 +154,14 @@ static int mac802154_set_csma_params(struct wpan_phy *phy, u8 min_be,
153{ 154{
154 struct ieee802154_local *local = wpan_phy_priv(phy); 155 struct ieee802154_local *local = wpan_phy_priv(phy);
155 156
156 return local->ops->set_csma_params(&local->hw, min_be, max_be, retries); 157 return drv_set_csma_params(local, min_be, max_be, retries);
157} 158}
158 159
159static int mac802154_set_frame_retries(struct wpan_phy *phy, s8 retries) 160static int mac802154_set_frame_retries(struct wpan_phy *phy, s8 retries)
160{ 161{
161 struct ieee802154_local *local = wpan_phy_priv(phy); 162 struct ieee802154_local *local = wpan_phy_priv(phy);
162 163
163 return local->ops->set_frame_retries(&local->hw, retries); 164 return drv_set_max_frame_retries(local, retries);
164} 165}
165 166
166static void ieee802154_tasklet_handler(unsigned long data) 167static void ieee802154_tasklet_handler(unsigned long data)
diff --git a/net/mac802154/mib.c b/net/mac802154/mib.c
index 16baff1ea313..3fbc217dbdcc 100644
--- a/net/mac802154/mib.c
+++ b/net/mac802154/mib.c
@@ -24,6 +24,7 @@
24#include <net/cfg802154.h> 24#include <net/cfg802154.h>
25 25
26#include "ieee802154_i.h" 26#include "ieee802154_i.h"
27#include "driver-ops.h"
27 28
28struct phy_chan_notify_work { 29struct phy_chan_notify_work {
29 struct work_struct work; 30 struct work_struct work;
@@ -170,7 +171,7 @@ static void phy_chan_notify(struct work_struct *work)
170 int res; 171 int res;
171 172
172 mutex_lock(&sdata->local->phy->pib_lock); 173 mutex_lock(&sdata->local->phy->pib_lock);
173 res = local->ops->set_channel(&local->hw, sdata->page, sdata->chan); 174 res = drv_set_channel(local, sdata->page, sdata->chan);
174 if (res) { 175 if (res) {
175 pr_debug("set_channel failed\n"); 176 pr_debug("set_channel failed\n");
176 } else { 177 } else {
diff --git a/net/mac802154/tx.c b/net/mac802154/tx.c
index e85767355c48..77973a84e9a2 100644
--- a/net/mac802154/tx.c
+++ b/net/mac802154/tx.c
@@ -28,6 +28,7 @@
28#include <net/cfg802154.h> 28#include <net/cfg802154.h>
29 29
30#include "ieee802154_i.h" 30#include "ieee802154_i.h"
31#include "driver-ops.h"
31 32
32/* IEEE 802.15.4 transceivers can sleep during the xmit session, so process 33/* IEEE 802.15.4 transceivers can sleep during the xmit session, so process
33 * packets through the workqueue. 34 * packets through the workqueue.
@@ -55,7 +56,7 @@ static void ieee802154_xmit_worker(struct work_struct *work)
55 if (!netif_running(dev)) 56 if (!netif_running(dev))
56 goto err_tx; 57 goto err_tx;
57 58
58 res = local->ops->xmit_sync(&local->hw, skb); 59 res = drv_xmit_sync(local, skb);
59 if (res) 60 if (res)
60 goto err_tx; 61 goto err_tx;
61 62
@@ -96,7 +97,7 @@ ieee802154_tx(struct ieee802154_local *local, struct sk_buff *skb)
96 97
97 /* async is priority, otherwise sync is fallback */ 98 /* async is priority, otherwise sync is fallback */
98 if (local->ops->xmit_async) { 99 if (local->ops->xmit_async) {
99 ret = local->ops->xmit_async(&local->hw, skb); 100 ret = drv_xmit_async(local, skb);
100 if (ret) { 101 if (ret) {
101 ieee802154_wake_queue(&local->hw); 102 ieee802154_wake_queue(&local->hw);
102 goto err_tx; 103 goto err_tx;