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>
This commit is contained in:
Alexander Aring 2014-10-28 18:21:21 +01:00 committed by Marcel Holtmann
parent b6eea9ca35
commit 59cb300f2b
4 changed files with 26 additions and 20 deletions

View 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,31 +197,32 @@ 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,
rc = drv_set_csma_params(local, sdata->mac_params.min_be,
sdata->mac_params.max_be,
sdata->mac_params.csma_retries);
if (rc < 0)
@ -227,7 +230,7 @@ static int mac802154_wpan_open(struct net_device *dev)
}
if (phy->set_frame_retries) {
rc = phy->set_frame_retries(phy,
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;
}

View 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)

View 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 {

View 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;