]> git.karo-electronics.de Git - linux-beck.git/commitdiff
mac802154: use driver-ops function wrappers
authorAlexander Aring <alex.aring@gmail.com>
Tue, 28 Oct 2014 17:21:21 +0000 (18:21 +0100)
committerMarcel Holtmann <marcel@holtmann.org>
Tue, 28 Oct 2014 22:19:07 +0000 (23:19 +0100)
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>
net/mac802154/iface.c
net/mac802154/main.c
net/mac802154/mib.c
net/mac802154/tx.c

index 0b21413081f1459a28b53e3ab8288cce49a60ae3..025cd5aba13fec6ffa6218e72c461f8a1f3ae267 100644 (file)
@@ -30,6 +30,7 @@
 #include <net/cfg802154.h>
 
 #include "ieee802154_i.h"
+#include "driver-ops.h"
 
 static int mac802154_wpan_update_llsec(struct net_device *dev)
 {
@@ -168,7 +169,7 @@ static int mac802154_slave_open(struct net_device *dev)
        mutex_unlock(&sdata->local->iflist_mtx);
 
        if (local->open_count++ == 0) {
-               res = local->ops->start(&local->hw);
+               res = drv_start(local);
                WARN_ON(res);
                if (res)
                        goto err;
@@ -186,6 +187,7 @@ static int mac802154_wpan_open(struct net_device *dev)
 {
        int rc;
        struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev);
+       struct ieee802154_local *local = sdata->local;
        struct wpan_phy *phy = sdata->local->phy;
 
        rc = mac802154_slave_open(dev);
@@ -195,40 +197,41 @@ static int mac802154_wpan_open(struct net_device *dev)
        mutex_lock(&phy->pib_lock);
 
        if (phy->set_txpower) {
-               rc = phy->set_txpower(phy, sdata->mac_params.transmit_power);
+               rc = drv_set_tx_power(local, sdata->mac_params.transmit_power);
                if (rc < 0)
                        goto out;
        }
 
        if (phy->set_lbt) {
-               rc = phy->set_lbt(phy, sdata->mac_params.lbt);
+               rc = drv_set_lbt_mode(local, sdata->mac_params.lbt);
                if (rc < 0)
                        goto out;
        }
 
        if (phy->set_cca_mode) {
-               rc = phy->set_cca_mode(phy, sdata->mac_params.cca_mode);
+               rc = drv_set_cca_mode(local, sdata->mac_params.cca_mode);
                if (rc < 0)
                        goto out;
        }
 
        if (phy->set_cca_ed_level) {
-               rc = phy->set_cca_ed_level(phy, sdata->mac_params.cca_ed_level);
+               rc = drv_set_cca_ed_level(local,
+                                         sdata->mac_params.cca_ed_level);
                if (rc < 0)
                        goto out;
        }
 
        if (phy->set_csma_params) {
-               rc = phy->set_csma_params(phy, sdata->mac_params.min_be,
-                                         sdata->mac_params.max_be,
-                                         sdata->mac_params.csma_retries);
+               rc = drv_set_csma_params(local, sdata->mac_params.min_be,
+                                        sdata->mac_params.max_be,
+                                        sdata->mac_params.csma_retries);
                if (rc < 0)
                        goto out;
        }
 
        if (phy->set_frame_retries) {
-               rc = phy->set_frame_retries(phy,
-                                           sdata->mac_params.frame_retries);
+               rc = drv_set_max_frame_retries(local,
+                                              sdata->mac_params.frame_retries);
                if (rc < 0)
                        goto out;
        }
@@ -255,7 +258,7 @@ static int mac802154_slave_close(struct net_device *dev)
        mutex_unlock(&sdata->local->iflist_mtx);
 
        if (!--local->open_count)
-               local->ops->stop(&local->hw);
+               drv_stop(local);
 
        return 0;
 }
index 632707bc47b9f2b10c1c0e2985715bdf2693bb49..24ecc09de2a4c6a12213f9d53410ba2ca5d990e4 100644 (file)
@@ -28,6 +28,7 @@
 #include <net/cfg802154.h>
 
 #include "ieee802154_i.h"
+#include "driver-ops.h"
 
 static int
 mac802154_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)
 {
        struct ieee802154_local *local = wpan_phy_priv(phy);
 
-       return local->ops->set_txpower(&local->hw, db);
+       return drv_set_tx_power(local, db);
 }
 
 static int mac802154_set_lbt(struct wpan_phy *phy, bool on)
 {
        struct ieee802154_local *local = wpan_phy_priv(phy);
 
-       return local->ops->set_lbt(&local->hw, on);
+       return drv_set_lbt_mode(local, on);
 }
 
 static int mac802154_set_cca_mode(struct wpan_phy *phy, u8 mode)
 {
        struct ieee802154_local *local = wpan_phy_priv(phy);
 
-       return local->ops->set_cca_mode(&local->hw, mode);
+       return drv_set_cca_mode(local, mode);
 }
 
 static int mac802154_set_cca_ed_level(struct wpan_phy *phy, s32 level)
 {
        struct ieee802154_local *local = wpan_phy_priv(phy);
 
-       return local->ops->set_cca_ed_level(&local->hw, level);
+       return drv_set_cca_ed_level(local, level);
 }
 
 static 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,
 {
        struct ieee802154_local *local = wpan_phy_priv(phy);
 
-       return local->ops->set_csma_params(&local->hw, min_be, max_be, retries);
+       return drv_set_csma_params(local, min_be, max_be, retries);
 }
 
 static int mac802154_set_frame_retries(struct wpan_phy *phy, s8 retries)
 {
        struct ieee802154_local *local = wpan_phy_priv(phy);
 
-       return local->ops->set_frame_retries(&local->hw, retries);
+       return drv_set_max_frame_retries(local, retries);
 }
 
 static void ieee802154_tasklet_handler(unsigned long data)
index 16baff1ea3139d6a5bc89d9bdca50975e9770c6d..3fbc217dbdccbf9c6f83a34440a7ff6f0dcb335a 100644 (file)
@@ -24,6 +24,7 @@
 #include <net/cfg802154.h>
 
 #include "ieee802154_i.h"
+#include "driver-ops.h"
 
 struct phy_chan_notify_work {
        struct work_struct work;
@@ -170,7 +171,7 @@ static void phy_chan_notify(struct work_struct *work)
        int res;
 
        mutex_lock(&sdata->local->phy->pib_lock);
-       res = local->ops->set_channel(&local->hw, sdata->page, sdata->chan);
+       res = drv_set_channel(local, sdata->page, sdata->chan);
        if (res) {
                pr_debug("set_channel failed\n");
        } else {
index e85767355c482fe2128ad48568af4040c693f2bd..77973a84e9a2246e45b301eedcdd3226d4873643 100644 (file)
@@ -28,6 +28,7 @@
 #include <net/cfg802154.h>
 
 #include "ieee802154_i.h"
+#include "driver-ops.h"
 
 /* IEEE 802.15.4 transceivers can sleep during the xmit session, so process
  * packets through the workqueue.
@@ -55,7 +56,7 @@ static void ieee802154_xmit_worker(struct work_struct *work)
        if (!netif_running(dev))
                goto err_tx;
 
-       res = local->ops->xmit_sync(&local->hw, skb);
+       res = drv_xmit_sync(local, skb);
        if (res)
                goto err_tx;
 
@@ -96,7 +97,7 @@ ieee802154_tx(struct ieee802154_local *local, struct sk_buff *skb)
 
        /* async is priority, otherwise sync is fallback */
        if (local->ops->xmit_async) {
-               ret = local->ops->xmit_async(&local->hw, skb);
+               ret = drv_xmit_async(local, skb);
                if (ret) {
                        ieee802154_wake_queue(&local->hw);
                        goto err_tx;