Linux IEEE 802.15.4 and 6LoWPAN development
 help / color / mirror / Atom feed
From: Alexander Aring <alex.aring@gmail.com>
To: linux-wpan@vger.kernel.org
Cc: kernel@pengutronix.de, Alexander Aring <alex.aring@gmail.com>
Subject: [PATCH bluetooth-next 06/17] mac802154: use driver-ops function wrappers
Date: Tue, 28 Oct 2014 18:21:21 +0100	[thread overview]
Message-ID: <1414516892-4107-7-git-send-email-alex.aring@gmail.com> (raw)
In-Reply-To: <1414516892-4107-1-git-send-email-alex.aring@gmail.com>

This patch replaces all directly called driver ops by previous
introduced driver-ops function wrappers.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
---
 net/mac802154/iface.c | 25 ++++++++++++++-----------
 net/mac802154/main.c  | 13 +++++++------
 net/mac802154/mib.c   |  3 ++-
 net/mac802154/tx.c    |  5 +++--
 4 files changed, 26 insertions(+), 20 deletions(-)

diff --git a/net/mac802154/iface.c b/net/mac802154/iface.c
index 0b21413..025cd5a 100644
--- a/net/mac802154/iface.c
+++ b/net/mac802154/iface.c
@@ -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;
 }
diff --git a/net/mac802154/main.c b/net/mac802154/main.c
index 632707b..24ecc09 100644
--- a/net/mac802154/main.c
+++ b/net/mac802154/main.c
@@ -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)
diff --git a/net/mac802154/mib.c b/net/mac802154/mib.c
index 16baff1..3fbc217 100644
--- a/net/mac802154/mib.c
+++ b/net/mac802154/mib.c
@@ -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 {
diff --git a/net/mac802154/tx.c b/net/mac802154/tx.c
index e857673..77973a8 100644
--- a/net/mac802154/tx.c
+++ b/net/mac802154/tx.c
@@ -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;
-- 
2.1.2


  parent reply	other threads:[~2014-10-28 17:22 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-28 17:21 [PATCH bluetooth-next 00/17] mac802154: iface and driver-ops cleanup Alexander Aring
2014-10-28 17:21 ` [PATCH bluetooth-next 01/17] mac802154: monitor: merge into iface implementation Alexander Aring
2014-10-29  3:39   ` Varka Bhadram
2014-10-29  3:49     ` Varka Bhadram
2014-10-29  5:39       ` Alexander Aring
2014-10-28 17:21 ` [PATCH bluetooth-next 02/17] mac802154: main: move open and close into iface Alexander Aring
2014-10-28 17:21 ` [PATCH bluetooth-next 03/17] mac802154: declare struct ieee802154_ops as const Alexander Aring
2014-10-29  3:31   ` Varka Bhadram
2014-10-28 17:21 ` [PATCH bluetooth-next 04/17] mac802154: ops: declare channel and page as u8 Alexander Aring
2014-10-29  3:32   ` Varka Bhadram
2014-10-28 17:21 ` [PATCH bluetooth-next 05/17] mac802154: introduce driver-ops header Alexander Aring
2014-10-28 17:21 ` Alexander Aring [this message]
2014-10-28 17:21 ` [PATCH bluetooth-next 07/17] mac802154: remove might_sleep from driver layer Alexander Aring
2014-10-29  3:33   ` Varka Bhadram
2014-10-29  5:53     ` Alexander Aring
2014-10-29  5:57       ` Varka Bhadram
2014-10-29  6:13         ` Alexander Aring
2014-10-29  7:23           ` Alexander Aring
2014-10-29  8:10           ` Varka Bhadram
2014-10-29  8:12             ` Varka Bhadram
2014-10-28 17:21 ` [PATCH bluetooth-next 08/17] mac802154: remove driver ops in wpan-phy Alexander Aring
2014-10-28 17:21 ` [PATCH bluetooth-next 09/17] mac802154: rework sdata state change to running Alexander Aring
2014-10-28 17:21 ` [PATCH bluetooth-next 10/17] mac802154: rename running to started Alexander Aring
2014-10-28 17:21 ` [PATCH bluetooth-next 11/17] mac802154: move local started handling Alexander Aring
2014-10-28 17:21 ` [PATCH bluetooth-next 12/17] mac802154: add synchronization handling Alexander Aring
2014-10-28 17:21 ` [PATCH bluetooth-next 13/17] mac802154: iface: remove assign to zero Alexander Aring
2014-10-28 17:21 ` [PATCH bluetooth-next 14/17] mac802154: remove channel attributes from sdata Alexander Aring
2014-10-29  3:52   ` Varka Bhadram
2014-10-29  5:22     ` Alexander Aring
2014-10-29  5:35       ` Varka Bhadram
2014-10-29  6:07         ` Alexander Aring
2014-10-28 17:21 ` [PATCH bluetooth-next 15/17] mac802154: move mac_params functions into mac_cmd Alexander Aring
2014-10-28 17:21 ` [PATCH bluetooth-next 16/17] mac802154: cleanup open count handling Alexander Aring
2014-10-28 17:21 ` [PATCH bluetooth-next 17/17] ieee802154: introduce sysfs file Alexander Aring
2014-10-28 22:24 ` [PATCH bluetooth-next 00/17] mac802154: iface and driver-ops cleanup Marcel Holtmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1414516892-4107-7-git-send-email-alex.aring@gmail.com \
    --to=alex.aring@gmail.com \
    --cc=kernel@pengutronix.de \
    --cc=linux-wpan@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox