All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alexander Aring <alex.aring@gmail.com>
To: linux-wpan@vger.kernel.org
Cc: Alexander Aring <alex.aring@gmail.com>
Subject: [PATCH wpan-next 10/11] mac802154: use hw_to_local
Date: Tue, 12 Aug 2014 15:14:14 +0200	[thread overview]
Message-ID: <1407849255-11500-11-git-send-email-alex.aring@gmail.com> (raw)
In-Reply-To: <1407849255-11500-1-git-send-email-alex.aring@gmail.com>

This patch replace the mac802154_to_priv macro with a static inline
function named hw_to_local.

This patch is part of getting wireless feeling into the ieee802154
implementation.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
---
 net/mac802154/ieee802154_i.h | 8 ++++++--
 net/mac802154/main.c         | 6 +++---
 net/mac802154/rx.c           | 4 ++--
 3 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/net/mac802154/ieee802154_i.h b/net/mac802154/ieee802154_i.h
index 2f0d995..1a344ab 100644
--- a/net/mac802154/ieee802154_i.h
+++ b/net/mac802154/ieee802154_i.h
@@ -101,10 +101,14 @@ struct ieee802154_local {
 #define	MAC802154_DEVICE_STOPPED	0x00
 #define MAC802154_DEVICE_RUN		0x01
 
-#define mac802154_to_priv(_hw)	container_of(_hw, struct ieee802154_local, hw)
-
 #define MAC802154_CHAN_NONE		0xff /* No channel is assigned */
 
+static inline struct ieee802154_local *
+hw_to_local(struct ieee802154_hw *hw)
+{
+	return container_of(hw, struct ieee802154_local, hw);
+}
+
 extern struct ieee802154_reduced_mlme_ops mac802154_mlme_reduced;
 extern struct ieee802154_mlme_ops mac802154_mlme_wpan;
 
diff --git a/net/mac802154/main.c b/net/mac802154/main.c
index 6641707..685d5bd 100644
--- a/net/mac802154/main.c
+++ b/net/mac802154/main.c
@@ -284,7 +284,7 @@ EXPORT_SYMBOL(ieee802154_alloc_hw);
 
 void ieee802154_free_hw(struct ieee802154_hw *hw)
 {
-	struct ieee802154_local *local = mac802154_to_priv(hw);
+	struct ieee802154_local *local = hw_to_local(hw);
 
 	BUG_ON(!list_empty(&local->slaves));
 
@@ -296,7 +296,7 @@ EXPORT_SYMBOL(ieee802154_free_hw);
 
 int ieee802154_register_hw(struct ieee802154_hw *hw)
 {
-	struct ieee802154_local *local = mac802154_to_priv(hw);
+	struct ieee802154_local *local = hw_to_local(hw);
 	int rc = -ENOSYS;
 
 	if (hw->flags & IEEE802154_HW_TXPOWER) {
@@ -376,7 +376,7 @@ EXPORT_SYMBOL(ieee802154_register_hw);
 
 void ieee802154_unregister_hw(struct ieee802154_hw *hw)
 {
-	struct ieee802154_local *local = mac802154_to_priv(hw);
+	struct ieee802154_local *local = hw_to_local(hw);
 	struct ieee802154_sub_if_data *sdata, *next;
 
 	flush_workqueue(local->dev_workqueue);
diff --git a/net/mac802154/rx.c b/net/mac802154/rx.c
index 730e56d..7bd3c85 100644
--- a/net/mac802154/rx.c
+++ b/net/mac802154/rx.c
@@ -53,7 +53,7 @@ struct rx_work {
 static void
 mac802154_subif_rx(struct ieee802154_hw *hw, struct sk_buff *skb, u8 lqi)
 {
-	struct ieee802154_local *local = mac802154_to_priv(hw);
+	struct ieee802154_local *local = hw_to_local(hw);
 
 	mac_cb(skb)->lqi = lqi;
 	skb->protocol = htons(ETH_P_IEEE802154);
@@ -93,7 +93,7 @@ static void mac802154_rx_worker(struct work_struct *work)
 void
 ieee802154_rx_irqsafe(struct ieee802154_hw *hw, struct sk_buff *skb, u8 lqi)
 {
-	struct ieee802154_local *local = mac802154_to_priv(hw);
+	struct ieee802154_local *local = hw_to_local(hw);
 	struct rx_work *work;
 
 	if (!skb)
-- 
2.0.3


  parent reply	other threads:[~2014-08-12 13:14 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-12 13:14 [PATCH wpan-next 00/11] ieee802154: mac802154: wireless transformation Alexander Aring
2014-08-12 13:14 ` [PATCH wpan-next 01/11] ieee802154: rename ieee802154_dev to ieee802154_hw Alexander Aring
2014-08-12 13:14 ` [PATCH wpan-next 02/11] mac802154: rename ieee802154_dev.c to main.c Alexander Aring
2014-08-12 13:14 ` [PATCH wpan-next 03/11] mac802154: remove not functional monitor device Alexander Aring
2014-08-12 13:14 ` [PATCH wpan-next 04/11] ieee802154: add new interface types Alexander Aring
2014-08-12 13:14 ` [PATCH wpan-next 05/11] nl802154: add missing endif comment Alexander Aring
2014-08-12 13:14 ` [PATCH wpan-next 06/11] mac802154: rename mac802154_priv to ieee802154_local Alexander Aring
2014-08-12 13:14 ` [PATCH wpan-next 07/11] mac802154: rename mac802154_sub_if_data to ieee802154_sub_if_data Alexander Aring
2014-08-12 13:14 ` [PATCH wpan-next 08/11] mac802154: rename mac802154.h to ieee802154_i.h Alexander Aring
2014-08-12 13:14 ` [PATCH wpan-next 09/11] mac802154: rename hw subif_data variable to local Alexander Aring
2014-08-12 13:14 ` Alexander Aring [this message]
2014-08-12 13:14 ` [PATCH wpan-next 11/11] mac802154: rx: use tasklet instead workqueue Alexander Aring
2014-08-14  7:37 ` [PATCH wpan-next 00/11] ieee802154: mac802154: wireless transformation Martin Townsend
2014-08-14  7:59   ` Alexander Aring
2014-08-14  8:09     ` Martin Townsend
2014-08-14  8:24       ` Alexander Aring
2014-08-14  8:13     ` Alexander Aring

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=1407849255-11500-11-git-send-email-alex.aring@gmail.com \
    --to=alex.aring@gmail.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.