* [PATCH bluetooth-next 00/10] ieee802154: removals and renames
@ 2014-10-25 15:16 Alexander Aring
2014-10-25 15:16 ` [PATCH bluetooth-next 01/10] ieee802154: remove fakehard driver Alexander Aring
` (10 more replies)
0 siblings, 11 replies; 12+ messages in thread
From: Alexander Aring @ 2014-10-25 15:16 UTC (permalink / raw)
To: linux-wpan; +Cc: kernel, Alexander Aring
This patch series removes the not working/not finished hardMAC virtual driver
"fakehard". Additional we remove the not used ieee802154_addr driver callback ops.
The other patches are rename patches for avoiding mainly the "priv variable naming
hell" inside the 802.15.4 subsystem. This series introduce 802.11 naming style for
used structs and variable naming.
This serie based on "[PATCHv2 bluetooth-next 0/7] ieee802154: file movements" patch
serie.
Alexander Aring (10):
ieee802154: remove fakehard driver
ieee802154: rename ieee802154_dev to ieee802154_hw
mac802154: rename mac802154_priv to ieee802154_local
mac802154: rename mac802154_sub_if_data
mac802154: rename hw subif_data variable to local
mac802154: rename sdata slaves and slaves_mtx
mac802154: introduce hw_to_local function
mac802154: introduce IEEE802154_DEV_TO_SUB_IF
mac802154: rename dev_workqueue to workqueue
mac802154: remove ieee802154_addr from driver_ops
drivers/net/ieee802154/Kconfig | 10 -
drivers/net/ieee802154/Makefile | 1 -
drivers/net/ieee802154/at86rf230.c | 90 ++++----
drivers/net/ieee802154/cc2520.c | 50 ++---
drivers/net/ieee802154/fakehard.c | 427 -------------------------------------
drivers/net/ieee802154/fakelb.c | 78 +++----
drivers/net/ieee802154/mrf24j40.c | 48 ++---
include/net/mac802154.h | 43 ++--
net/mac802154/ieee802154_i.h | 34 +--
net/mac802154/iface.c | 141 ++++++------
net/mac802154/mac_cmd.c | 4 +-
net/mac802154/main.c | 265 +++++++++++------------
net/mac802154/mib.c | 206 +++++++++---------
net/mac802154/monitor.c | 26 +--
net/mac802154/rx.c | 22 +-
net/mac802154/tx.c | 40 ++--
16 files changed, 522 insertions(+), 963 deletions(-)
delete mode 100644 drivers/net/ieee802154/fakehard.c
--
2.1.2
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH bluetooth-next 01/10] ieee802154: remove fakehard driver
2014-10-25 15:16 [PATCH bluetooth-next 00/10] ieee802154: removals and renames Alexander Aring
@ 2014-10-25 15:16 ` Alexander Aring
2014-10-25 15:16 ` [PATCH bluetooth-next 02/10] ieee802154: rename ieee802154_dev to ieee802154_hw Alexander Aring
` (9 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: Alexander Aring @ 2014-10-25 15:16 UTC (permalink / raw)
To: linux-wpan; +Cc: kernel, Alexander Aring
This patch removes the not functional fakehard driver. We don't support
HardMAC 802.15.4 drivers right now.
Signed-off-by: Alexander Aring <alex.aring@gmail.com>
---
drivers/net/ieee802154/Kconfig | 10 -
drivers/net/ieee802154/Makefile | 1 -
drivers/net/ieee802154/fakehard.c | 427 --------------------------------------
3 files changed, 438 deletions(-)
delete mode 100644 drivers/net/ieee802154/fakehard.c
diff --git a/drivers/net/ieee802154/Kconfig b/drivers/net/ieee802154/Kconfig
index 391a916..1a3c3e5 100644
--- a/drivers/net/ieee802154/Kconfig
+++ b/drivers/net/ieee802154/Kconfig
@@ -10,16 +10,6 @@ menuconfig IEEE802154_DRIVERS
If you say N, all options in this submenu will be skipped and
disabled.
-config IEEE802154_FAKEHARD
- tristate "Fake LR-WPAN driver with several interconnected devices"
- depends on IEEE802154_DRIVERS
- ---help---
- Say Y here to enable the fake driver that serves as an example
- of HardMAC device driver.
-
- This driver can also be built as a module. To do so say M here.
- The module will be called 'fakehard'.
-
config IEEE802154_FAKELB
depends on IEEE802154_DRIVERS && MAC802154
tristate "IEEE 802.15.4 loopback driver"
diff --git a/drivers/net/ieee802154/Makefile b/drivers/net/ieee802154/Makefile
index 655cb95..d77fa4d 100644
--- a/drivers/net/ieee802154/Makefile
+++ b/drivers/net/ieee802154/Makefile
@@ -1,4 +1,3 @@
-obj-$(CONFIG_IEEE802154_FAKEHARD) += fakehard.o
obj-$(CONFIG_IEEE802154_FAKELB) += fakelb.o
obj-$(CONFIG_IEEE802154_AT86RF230) += at86rf230.o
obj-$(CONFIG_IEEE802154_MRF24J40) += mrf24j40.o
diff --git a/drivers/net/ieee802154/fakehard.c b/drivers/net/ieee802154/fakehard.c
deleted file mode 100644
index 8be05ad..0000000
--- a/drivers/net/ieee802154/fakehard.c
+++ /dev/null
@@ -1,427 +0,0 @@
-/*
- * Sample driver for HardMAC IEEE 802.15.4 devices
- *
- * Copyright (C) 2009 Siemens AG
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2
- * as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Written by:
- * Dmitry Eremin-Solenikov <dmitry.baryshkov@siemens.com>
- */
-#include <linux/kernel.h>
-#include <linux/module.h>
-#include <linux/platform_device.h>
-#include <linux/netdevice.h>
-#include <linux/skbuff.h>
-#include <linux/if_arp.h>
-#include <linux/ieee802154.h>
-
-#include <net/af_ieee802154.h>
-#include <net/ieee802154_netdev.h>
-#include <net/nl802154.h>
-#include <net/cfg802154.h>
-
-struct fakehard_priv {
- struct wpan_phy *phy;
-};
-
-static struct wpan_phy *fake_to_phy(const struct net_device *dev)
-{
- struct fakehard_priv *priv = netdev_priv(dev);
- return priv->phy;
-}
-
-/**
- * fake_get_phy - Return a phy corresponding to this device.
- * @dev: The network device for which to return the wan-phy object
- *
- * This function returns a wpan-phy object corresponding to the passed
- * network device. Reference counter for wpan-phy object is incremented,
- * so when the wpan-phy isn't necessary, you should drop the reference
- * via @wpan_phy_put() call.
- */
-static struct wpan_phy *fake_get_phy(const struct net_device *dev)
-{
- struct wpan_phy *phy = fake_to_phy(dev);
- return to_phy(get_device(&phy->dev));
-}
-
-/**
- * fake_get_pan_id - Retrieve the PAN ID of the device.
- * @dev: The network device to retrieve the PAN of.
- *
- * Return the ID of the PAN from the PIB.
- */
-static __le16 fake_get_pan_id(const struct net_device *dev)
-{
- BUG_ON(dev->type != ARPHRD_IEEE802154);
-
- return cpu_to_le16(0xeba1);
-}
-
-/**
- * fake_get_short_addr - Retrieve the short address of the device.
- * @dev: The network device to retrieve the short address of.
- *
- * Returns the IEEE 802.15.4 short-form address cached for this
- * device. If the device has not yet had a short address assigned
- * then this should return 0xFFFF to indicate a lack of association.
- */
-static __le16 fake_get_short_addr(const struct net_device *dev)
-{
- BUG_ON(dev->type != ARPHRD_IEEE802154);
-
- return cpu_to_le16(0x1);
-}
-
-/**
- * fake_get_dsn - Retrieve the DSN of the device.
- * @dev: The network device to retrieve the DSN for.
- *
- * Returns the IEEE 802.15.4 DSN for the network device.
- * The DSN is the sequence number which will be added to each
- * packet or MAC command frame by the MAC during transmission.
- *
- * DSN means 'Data Sequence Number'.
- *
- * Note: This is in section 7.2.1.2 of the IEEE 802.15.4-2006
- * document.
- */
-static u8 fake_get_dsn(const struct net_device *dev)
-{
- BUG_ON(dev->type != ARPHRD_IEEE802154);
-
- return 0x00; /* DSN are implemented in HW, so return just 0 */
-}
-
-/**
- * fake_assoc_req - Make an association request to the HW.
- * @dev: The network device which we are associating to a network.
- * @addr: The coordinator with which we wish to associate.
- * @channel: The channel on which to associate.
- * @cap: The capability information field to use in the association.
- *
- * Start an association with a coordinator. The coordinator's address
- * and PAN ID can be found in @addr.
- *
- * Note: This is in section 7.3.1 and 7.5.3.1 of the IEEE
- * 802.15.4-2006 document.
- */
-static int fake_assoc_req(struct net_device *dev,
- struct ieee802154_addr *addr, u8 channel, u8 page, u8 cap)
-{
- struct wpan_phy *phy = fake_to_phy(dev);
-
- mutex_lock(&phy->pib_lock);
- phy->current_channel = channel;
- phy->current_page = page;
- mutex_unlock(&phy->pib_lock);
-
- /* We simply emulate it here */
- return ieee802154_nl_assoc_confirm(dev, fake_get_short_addr(dev),
- IEEE802154_SUCCESS);
-}
-
-/**
- * fake_assoc_resp - Send an association response to a device.
- * @dev: The network device on which to send the response.
- * @addr: The address of the device to respond to.
- * @short_addr: The assigned short address for the device (if any).
- * @status: The result of the association request.
- *
- * Queue the association response of the coordinator to another
- * device's attempt to associate with the network which we
- * coordinate. This is then added to the indirect-send queue to be
- * transmitted to the end device when it polls for data.
- *
- * Note: This is in section 7.3.2 and 7.5.3.1 of the IEEE
- * 802.15.4-2006 document.
- */
-static int fake_assoc_resp(struct net_device *dev,
- struct ieee802154_addr *addr, __le16 short_addr, u8 status)
-{
- return 0;
-}
-
-/**
- * fake_disassoc_req - Disassociate a device from a network.
- * @dev: The network device on which we're disassociating a device.
- * @addr: The device to disassociate from the network.
- * @reason: The reason to give to the device for being disassociated.
- *
- * This sends a disassociation notification to the device being
- * disassociated from the network.
- *
- * Note: This is in section 7.5.3.2 of the IEEE 802.15.4-2006
- * document, with the reason described in 7.3.3.2.
- */
-static int fake_disassoc_req(struct net_device *dev,
- struct ieee802154_addr *addr, u8 reason)
-{
- return ieee802154_nl_disassoc_confirm(dev, IEEE802154_SUCCESS);
-}
-
-/**
- * fake_start_req - Start an IEEE 802.15.4 PAN.
- * @dev: The network device on which to start the PAN.
- * @addr: The coordinator address to use when starting the PAN.
- * @channel: The channel on which to start the PAN.
- * @bcn_ord: Beacon order.
- * @sf_ord: Superframe order.
- * @pan_coord: Whether or not we are the PAN coordinator or just
- * requesting a realignment perhaps?
- * @blx: Battery Life Extension feature bitfield.
- * @coord_realign: Something to realign something else.
- *
- * If pan_coord is non-zero then this starts a network with the
- * provided parameters, otherwise it attempts a coordinator
- * realignment of the stated network instead.
- *
- * Note: This is in section 7.5.2.3 of the IEEE 802.15.4-2006
- * document, with 7.3.8 describing coordinator realignment.
- */
-static int fake_start_req(struct net_device *dev,
- struct ieee802154_addr *addr, u8 channel, u8 page,
- u8 bcn_ord, u8 sf_ord, u8 pan_coord, u8 blx,
- u8 coord_realign)
-{
- struct wpan_phy *phy = fake_to_phy(dev);
-
- mutex_lock(&phy->pib_lock);
- phy->current_channel = channel;
- phy->current_page = page;
- mutex_unlock(&phy->pib_lock);
-
- /* We don't emulate beacons here at all, so START should fail */
- ieee802154_nl_start_confirm(dev, IEEE802154_INVALID_PARAMETER);
- return 0;
-}
-
-/**
- * fake_scan_req - Start a channel scan.
- * @dev: The network device on which to perform a channel scan.
- * @type: The type of scan to perform.
- * @channels: The channel bitmask to scan.
- * @duration: How long to spend on each channel.
- *
- * This starts either a passive (energy) scan or an active (PAN) scan
- * on the channels indicated in the @channels bitmask. The duration of
- * the scan is measured in terms of superframe duration. Specifically,
- * the scan will spend aBaseSuperFrameDuration * ((2^n) + 1) on each
- * channel.
- *
- * Note: This is in section 7.5.2.1 of the IEEE 802.15.4-2006 document.
- */
-static int fake_scan_req(struct net_device *dev, u8 type, u32 channels,
- u8 page, u8 duration)
-{
- u8 edl[27] = {};
- return ieee802154_nl_scan_confirm(dev, IEEE802154_SUCCESS, type,
- channels, page,
- type == IEEE802154_MAC_SCAN_ED ? edl : NULL);
-}
-
-static struct ieee802154_mlme_ops fake_mlme = {
- .assoc_req = fake_assoc_req,
- .assoc_resp = fake_assoc_resp,
- .disassoc_req = fake_disassoc_req,
- .start_req = fake_start_req,
- .scan_req = fake_scan_req,
-
- .get_phy = fake_get_phy,
-
- .get_pan_id = fake_get_pan_id,
- .get_short_addr = fake_get_short_addr,
- .get_dsn = fake_get_dsn,
-};
-
-static int ieee802154_fake_open(struct net_device *dev)
-{
- netif_start_queue(dev);
- return 0;
-}
-
-static int ieee802154_fake_close(struct net_device *dev)
-{
- netif_stop_queue(dev);
- return 0;
-}
-
-static netdev_tx_t ieee802154_fake_xmit(struct sk_buff *skb,
- struct net_device *dev)
-{
- dev->stats.tx_packets++;
- dev->stats.tx_bytes += skb->len;
-
- /* FIXME: do hardware work here ... */
-
- dev_kfree_skb(skb);
- return NETDEV_TX_OK;
-}
-
-
-static int ieee802154_fake_ioctl(struct net_device *dev, struct ifreq *ifr,
- int cmd)
-{
- struct sockaddr_ieee802154 *sa =
- (struct sockaddr_ieee802154 *)&ifr->ifr_addr;
- u16 pan_id, short_addr;
-
- switch (cmd) {
- case SIOCGIFADDR:
- /* FIXME: fixed here, get from device IRL */
- pan_id = le16_to_cpu(fake_get_pan_id(dev));
- short_addr = le16_to_cpu(fake_get_short_addr(dev));
- if (pan_id == IEEE802154_PANID_BROADCAST ||
- short_addr == IEEE802154_ADDR_BROADCAST)
- return -EADDRNOTAVAIL;
-
- sa->family = AF_IEEE802154;
- sa->addr.addr_type = IEEE802154_ADDR_SHORT;
- sa->addr.pan_id = pan_id;
- sa->addr.short_addr = short_addr;
- return 0;
- }
- return -ENOIOCTLCMD;
-}
-
-static int ieee802154_fake_mac_addr(struct net_device *dev, void *p)
-{
- return -EBUSY; /* HW address is built into the device */
-}
-
-static const struct net_device_ops fake_ops = {
- .ndo_open = ieee802154_fake_open,
- .ndo_stop = ieee802154_fake_close,
- .ndo_start_xmit = ieee802154_fake_xmit,
- .ndo_do_ioctl = ieee802154_fake_ioctl,
- .ndo_set_mac_address = ieee802154_fake_mac_addr,
-};
-
-static void ieee802154_fake_destruct(struct net_device *dev)
-{
- struct wpan_phy *phy = fake_to_phy(dev);
-
- wpan_phy_unregister(phy);
- free_netdev(dev);
- wpan_phy_free(phy);
-}
-
-static void ieee802154_fake_setup(struct net_device *dev)
-{
- dev->addr_len = IEEE802154_ADDR_LEN;
- memset(dev->broadcast, 0xff, IEEE802154_ADDR_LEN);
- dev->features = NETIF_F_HW_CSUM;
- dev->needed_tailroom = 2; /* FCS */
- dev->mtu = 127;
- dev->tx_queue_len = 10;
- dev->type = ARPHRD_IEEE802154;
- dev->flags = IFF_NOARP | IFF_BROADCAST;
- dev->watchdog_timeo = 0;
- dev->destructor = ieee802154_fake_destruct;
-}
-
-
-static int ieee802154fake_probe(struct platform_device *pdev)
-{
- struct net_device *dev;
- struct fakehard_priv *priv;
- struct wpan_phy *phy = wpan_phy_alloc(0);
- int err;
-
- if (!phy)
- return -ENOMEM;
-
- dev = alloc_netdev(sizeof(struct fakehard_priv), "hardwpan%d",
- NET_NAME_UNKNOWN, ieee802154_fake_setup);
- if (!dev) {
- wpan_phy_free(phy);
- return -ENOMEM;
- }
-
- memcpy(dev->dev_addr, "\xba\xbe\xca\xfe\xde\xad\xbe\xef",
- dev->addr_len);
-
- /*
- * For now we'd like to emulate 2.4 GHz-only device,
- * both O-QPSK and CSS
- */
- /* 2.4 GHz O-QPSK 802.15.4-2003 */
- phy->channels_supported[0] |= 0x7FFF800;
- /* 2.4 GHz CSS 802.15.4a-2007 */
- phy->channels_supported[3] |= 0x3fff;
-
- phy->transmit_power = 0xbf;
-
- dev->netdev_ops = &fake_ops;
- dev->ml_priv = &fake_mlme;
-
- priv = netdev_priv(dev);
- priv->phy = phy;
-
- wpan_phy_set_dev(phy, &pdev->dev);
- SET_NETDEV_DEV(dev, &phy->dev);
-
- platform_set_drvdata(pdev, dev);
-
- err = wpan_phy_register(phy);
- if (err)
- goto out;
-
- err = register_netdev(dev);
- if (err < 0)
- goto out;
-
- dev_info(&pdev->dev, "Added ieee802154 HardMAC hardware\n");
- return 0;
-
-out:
- unregister_netdev(dev);
- return err;
-}
-
-static int ieee802154fake_remove(struct platform_device *pdev)
-{
- struct net_device *dev = platform_get_drvdata(pdev);
- unregister_netdev(dev);
- return 0;
-}
-
-static struct platform_device *ieee802154fake_dev;
-
-static struct platform_driver ieee802154fake_driver = {
- .probe = ieee802154fake_probe,
- .remove = ieee802154fake_remove,
- .driver = {
- .name = "ieee802154hardmac",
- .owner = THIS_MODULE,
- },
-};
-
-static __init int fake_init(void)
-{
- ieee802154fake_dev = platform_device_register_simple(
- "ieee802154hardmac", -1, NULL, 0);
- return platform_driver_register(&ieee802154fake_driver);
-}
-
-static __exit void fake_exit(void)
-{
- platform_driver_unregister(&ieee802154fake_driver);
- platform_device_unregister(ieee802154fake_dev);
-}
-
-module_init(fake_init);
-module_exit(fake_exit);
-MODULE_LICENSE("GPL");
--
2.1.2
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH bluetooth-next 02/10] ieee802154: rename ieee802154_dev to ieee802154_hw
2014-10-25 15:16 [PATCH bluetooth-next 00/10] ieee802154: removals and renames Alexander Aring
2014-10-25 15:16 ` [PATCH bluetooth-next 01/10] ieee802154: remove fakehard driver Alexander Aring
@ 2014-10-25 15:16 ` Alexander Aring
2014-10-25 15:16 ` [PATCH bluetooth-next 03/10] mac802154: rename mac802154_priv to ieee802154_local Alexander Aring
` (8 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: Alexander Aring @ 2014-10-25 15:16 UTC (permalink / raw)
To: linux-wpan; +Cc: kernel, Alexander Aring, Alan Ott
The identical struct of the wireless stack implementation is named
ieee80211_hw. This is useful to name the variable hw instead of get
confusing with netdev dev variable.
Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Cc: Alan Ott <alan@signal11.us>
---
drivers/net/ieee802154/at86rf230.c | 90 +++++++++++++++++++-------------------
drivers/net/ieee802154/cc2520.c | 50 ++++++++++-----------
drivers/net/ieee802154/fakelb.c | 78 ++++++++++++++++-----------------
drivers/net/ieee802154/mrf24j40.c | 48 ++++++++++----------
include/net/mac802154.h | 44 +++++++++----------
net/mac802154/ieee802154_i.h | 2 +-
net/mac802154/main.c | 34 +++++++-------
net/mac802154/rx.c | 12 ++---
8 files changed, 179 insertions(+), 179 deletions(-)
diff --git a/drivers/net/ieee802154/at86rf230.c b/drivers/net/ieee802154/at86rf230.c
index a433d20..b0d68d7 100644
--- a/drivers/net/ieee802154/at86rf230.c
+++ b/drivers/net/ieee802154/at86rf230.c
@@ -77,7 +77,7 @@ struct at86rf230_state_change {
struct at86rf230_local {
struct spi_device *spi;
- struct ieee802154_dev *dev;
+ struct ieee802154_hw *hw;
struct at86rf2xx_chip_data *data;
struct regmap *regmap;
@@ -808,7 +808,7 @@ at86rf230_rx(struct at86rf230_local *lp,
/* We do not put CRC into the frame */
skb_trim(skb, len - 2);
- ieee802154_rx_irqsafe(lp->dev, skb, lqi);
+ ieee802154_rx_irqsafe(lp->hw, skb, lqi);
}
static void
@@ -969,9 +969,9 @@ at86rf230_xmit_tx_on(void *context)
}
static int
-at86rf230_xmit(struct ieee802154_dev *dev, struct sk_buff *skb)
+at86rf230_xmit(struct ieee802154_hw *hw, struct sk_buff *skb)
{
- struct at86rf230_local *lp = dev->priv;
+ struct at86rf230_local *lp = hw->priv;
struct at86rf230_state_change *ctx = &lp->tx;
void (*tx_complete)(void *context) = at86rf230_write_frame;
@@ -1012,7 +1012,7 @@ at86rf230_xmit(struct ieee802154_dev *dev, struct sk_buff *skb)
}
static int
-at86rf230_ed(struct ieee802154_dev *dev, u8 *level)
+at86rf230_ed(struct ieee802154_hw *hw, u8 *level)
{
might_sleep();
BUG_ON(!level);
@@ -1021,15 +1021,15 @@ at86rf230_ed(struct ieee802154_dev *dev, u8 *level)
}
static int
-at86rf230_start(struct ieee802154_dev *dev)
+at86rf230_start(struct ieee802154_hw *hw)
{
- return at86rf230_sync_state_change(dev->priv, STATE_RX_AACK_ON);
+ return at86rf230_sync_state_change(hw->priv, STATE_RX_AACK_ON);
}
static void
-at86rf230_stop(struct ieee802154_dev *dev)
+at86rf230_stop(struct ieee802154_hw *hw)
{
- at86rf230_sync_state_change(dev->priv, STATE_FORCE_TRX_OFF);
+ at86rf230_sync_state_change(hw->priv, STATE_FORCE_TRX_OFF);
}
static int
@@ -1064,15 +1064,15 @@ at86rf212_set_channel(struct at86rf230_local *lp, int page, int channel)
}
static int
-at86rf230_channel(struct ieee802154_dev *dev, int page, int channel)
+at86rf230_channel(struct ieee802154_hw *hw, int page, int channel)
{
- struct at86rf230_local *lp = dev->priv;
+ struct at86rf230_local *lp = hw->priv;
int rc;
might_sleep();
if (page < 0 || page > 31 ||
- !(lp->dev->phy->channels_supported[page] & BIT(channel))) {
+ !(lp->hw->phy->channels_supported[page] & BIT(channel))) {
WARN_ON(1);
return -EINVAL;
}
@@ -1084,18 +1084,18 @@ at86rf230_channel(struct ieee802154_dev *dev, int page, int channel)
/* Wait for PLL */
usleep_range(lp->data->t_channel_switch,
lp->data->t_channel_switch + 10);
- dev->phy->current_channel = channel;
- dev->phy->current_page = page;
+ hw->phy->current_channel = channel;
+ hw->phy->current_page = page;
return 0;
}
static int
-at86rf230_set_hw_addr_filt(struct ieee802154_dev *dev,
+at86rf230_set_hw_addr_filt(struct ieee802154_hw *hw,
struct ieee802154_hw_addr_filt *filt,
unsigned long changed)
{
- struct at86rf230_local *lp = dev->priv;
+ struct at86rf230_local *lp = hw->priv;
if (changed & IEEE802154_AFILT_SADDR_CHANGED) {
u16 addr = le16_to_cpu(filt->short_addr);
@@ -1138,9 +1138,9 @@ at86rf230_set_hw_addr_filt(struct ieee802154_dev *dev,
}
static int
-at86rf230_set_txpower(struct ieee802154_dev *dev, int db)
+at86rf230_set_txpower(struct ieee802154_hw *hw, int db)
{
- struct at86rf230_local *lp = dev->priv;
+ struct at86rf230_local *lp = hw->priv;
/* typical maximum output is 5dBm with RG_PHY_TX_PWR 0x60, lower five
* bits decrease power in 1dB steps. 0x60 represents extra PA gain of
@@ -1157,17 +1157,17 @@ at86rf230_set_txpower(struct ieee802154_dev *dev, int db)
}
static int
-at86rf230_set_lbt(struct ieee802154_dev *dev, bool on)
+at86rf230_set_lbt(struct ieee802154_hw *hw, bool on)
{
- struct at86rf230_local *lp = dev->priv;
+ struct at86rf230_local *lp = hw->priv;
return at86rf230_write_subreg(lp, SR_CSMA_LBT_MODE, on);
}
static int
-at86rf230_set_cca_mode(struct ieee802154_dev *dev, u8 mode)
+at86rf230_set_cca_mode(struct ieee802154_hw *hw, u8 mode)
{
- struct at86rf230_local *lp = dev->priv;
+ struct at86rf230_local *lp = hw->priv;
return at86rf230_write_subreg(lp, SR_CCA_MODE, mode);
}
@@ -1185,9 +1185,9 @@ at86rf23x_get_desens_steps(struct at86rf230_local *lp, s32 level)
}
static int
-at86rf230_set_cca_ed_level(struct ieee802154_dev *dev, s32 level)
+at86rf230_set_cca_ed_level(struct ieee802154_hw *hw, s32 level)
{
- struct at86rf230_local *lp = dev->priv;
+ struct at86rf230_local *lp = hw->priv;
if (level < lp->data->rssi_base_val || level > 30)
return -EINVAL;
@@ -1197,10 +1197,10 @@ at86rf230_set_cca_ed_level(struct ieee802154_dev *dev, s32 level)
}
static int
-at86rf230_set_csma_params(struct ieee802154_dev *dev, u8 min_be, u8 max_be,
+at86rf230_set_csma_params(struct ieee802154_hw *hw, u8 min_be, u8 max_be,
u8 retries)
{
- struct at86rf230_local *lp = dev->priv;
+ struct at86rf230_local *lp = hw->priv;
int rc;
if (min_be > max_be || max_be > 8 || retries > 5)
@@ -1218,9 +1218,9 @@ at86rf230_set_csma_params(struct ieee802154_dev *dev, u8 min_be, u8 max_be,
}
static int
-at86rf230_set_frame_retries(struct ieee802154_dev *dev, s8 retries)
+at86rf230_set_frame_retries(struct ieee802154_hw *hw, s8 retries)
{
- struct at86rf230_local *lp = dev->priv;
+ struct at86rf230_local *lp = hw->priv;
int rc = 0;
if (retries < -1 || retries > 15)
@@ -1409,8 +1409,8 @@ at86rf230_detect_device(struct at86rf230_local *lp)
return -EINVAL;
}
- lp->dev->extra_tx_headroom = 0;
- lp->dev->flags = IEEE802154_HW_OMIT_CKSUM | IEEE802154_HW_AACK |
+ lp->hw->extra_tx_headroom = 0;
+ lp->hw->flags = IEEE802154_HW_OMIT_CKSUM | IEEE802154_HW_AACK |
IEEE802154_HW_TXPOWER | IEEE802154_HW_CSMA;
switch (part) {
@@ -1421,15 +1421,15 @@ at86rf230_detect_device(struct at86rf230_local *lp)
case 3:
chip = "at86rf231";
lp->data = &at86rf231_data;
- lp->dev->phy->channels_supported[0] = 0x7FFF800;
+ lp->hw->phy->channels_supported[0] = 0x7FFF800;
break;
case 7:
chip = "at86rf212";
if (version == 1) {
lp->data = &at86rf212_data;
- lp->dev->flags |= IEEE802154_HW_LBT;
- lp->dev->phy->channels_supported[0] = 0x00007FF;
- lp->dev->phy->channels_supported[2] = 0x00007FF;
+ lp->hw->flags |= IEEE802154_HW_LBT;
+ lp->hw->phy->channels_supported[0] = 0x00007FF;
+ lp->hw->phy->channels_supported[2] = 0x00007FF;
} else {
rc = -ENOTSUPP;
}
@@ -1437,7 +1437,7 @@ at86rf230_detect_device(struct at86rf230_local *lp)
case 11:
chip = "at86rf233";
lp->data = &at86rf233_data;
- lp->dev->phy->channels_supported[0] = 0x7FFF800;
+ lp->hw->phy->channels_supported[0] = 0x7FFF800;
break;
default:
chip = "unkown";
@@ -1478,7 +1478,7 @@ at86rf230_setup_spi_messages(struct at86rf230_local *lp)
static int at86rf230_probe(struct spi_device *spi)
{
struct at86rf230_platform_data *pdata;
- struct ieee802154_dev *dev;
+ struct ieee802154_hw *hw;
struct at86rf230_local *lp;
unsigned int status;
int rc, irq_type;
@@ -1517,14 +1517,14 @@ static int at86rf230_probe(struct spi_device *spi)
usleep_range(120, 240);
}
- dev = ieee802154_alloc_device(sizeof(*lp), &at86rf230_ops);
- if (!dev)
+ hw = ieee802154_alloc_hw(sizeof(*lp), &at86rf230_ops);
+ if (!hw)
return -ENOMEM;
- lp = dev->priv;
- lp->dev = dev;
+ lp = hw->priv;
+ lp->hw = hw;
lp->spi = spi;
- dev->parent = &spi->dev;
+ hw->parent = &spi->dev;
lp->regmap = devm_regmap_init_spi(spi, &at86rf230_regmap_spi_config);
if (IS_ERR(lp->regmap)) {
@@ -1564,14 +1564,14 @@ static int at86rf230_probe(struct spi_device *spi)
if (rc)
goto free_dev;
- rc = ieee802154_register_device(lp->dev);
+ rc = ieee802154_register_hw(lp->hw);
if (rc)
goto free_dev;
return rc;
free_dev:
- ieee802154_free_device(lp->dev);
+ ieee802154_free_hw(lp->hw);
return rc;
}
@@ -1582,8 +1582,8 @@ static int at86rf230_remove(struct spi_device *spi)
/* mask all at86rf230 irq's */
at86rf230_write_subreg(lp, SR_IRQ_MASK, 0);
- ieee802154_unregister_device(lp->dev);
- ieee802154_free_device(lp->dev);
+ ieee802154_unregister_hw(lp->hw);
+ ieee802154_free_hw(lp->hw);
dev_dbg(&spi->dev, "unregistered at86rf230\n");
return 0;
diff --git a/drivers/net/ieee802154/cc2520.c b/drivers/net/ieee802154/cc2520.c
index 32b3c88..b827e04 100644
--- a/drivers/net/ieee802154/cc2520.c
+++ b/drivers/net/ieee802154/cc2520.c
@@ -193,7 +193,7 @@
/* Driver private information */
struct cc2520_private {
struct spi_device *spi; /* SPI device structure */
- struct ieee802154_dev *dev; /* IEEE-802.15.4 device */
+ struct ieee802154_hw *hw; /* IEEE-802.15.4 device */
u8 *buf; /* SPI TX/Rx data buffer */
struct mutex buffer_mutex; /* SPI buffer mutex */
bool is_tx; /* Flag for sync b/w Tx and Rx */
@@ -453,20 +453,20 @@ cc2520_read_rxfifo(struct cc2520_private *priv, u8 *data, u8 len, u8 *lqi)
return status;
}
-static int cc2520_start(struct ieee802154_dev *dev)
+static int cc2520_start(struct ieee802154_hw *hw)
{
- return cc2520_cmd_strobe(dev->priv, CC2520_CMD_SRXON);
+ return cc2520_cmd_strobe(hw->priv, CC2520_CMD_SRXON);
}
-static void cc2520_stop(struct ieee802154_dev *dev)
+static void cc2520_stop(struct ieee802154_hw *hw)
{
- cc2520_cmd_strobe(dev->priv, CC2520_CMD_SRFOFF);
+ cc2520_cmd_strobe(hw->priv, CC2520_CMD_SRFOFF);
}
static int
-cc2520_tx(struct ieee802154_dev *dev, struct sk_buff *skb)
+cc2520_tx(struct ieee802154_hw *hw, struct sk_buff *skb)
{
- struct cc2520_private *priv = dev->priv;
+ struct cc2520_private *priv = hw->priv;
unsigned long flags;
int rc;
u8 status = 0;
@@ -536,7 +536,7 @@ static int cc2520_rx(struct cc2520_private *priv)
skb_trim(skb, skb->len - 2);
- ieee802154_rx_irqsafe(priv->dev, skb, lqi);
+ ieee802154_rx_irqsafe(priv->hw, skb, lqi);
dev_vdbg(&priv->spi->dev, "RXFIFO: %x %x\n", len, lqi);
@@ -544,9 +544,9 @@ static int cc2520_rx(struct cc2520_private *priv)
}
static int
-cc2520_ed(struct ieee802154_dev *dev, u8 *level)
+cc2520_ed(struct ieee802154_hw *hw, u8 *level)
{
- struct cc2520_private *priv = dev->priv;
+ struct cc2520_private *priv = hw->priv;
u8 status = 0xff;
u8 rssi;
int ret;
@@ -569,9 +569,9 @@ cc2520_ed(struct ieee802154_dev *dev, u8 *level)
}
static int
-cc2520_set_channel(struct ieee802154_dev *dev, int page, int channel)
+cc2520_set_channel(struct ieee802154_hw *hw, int page, int channel)
{
- struct cc2520_private *priv = dev->priv;
+ struct cc2520_private *priv = hw->priv;
int ret;
might_sleep();
@@ -588,10 +588,10 @@ cc2520_set_channel(struct ieee802154_dev *dev, int page, int channel)
}
static int
-cc2520_filter(struct ieee802154_dev *dev,
+cc2520_filter(struct ieee802154_hw *hw,
struct ieee802154_hw_addr_filt *filt, unsigned long changed)
{
- struct cc2520_private *priv = dev->priv;
+ struct cc2520_private *priv = hw->priv;
if (changed & IEEE802154_AFILT_PANID_CHANGED) {
u16 panid = le16_to_cpu(filt->pan_id);
@@ -645,27 +645,27 @@ static int cc2520_register(struct cc2520_private *priv)
{
int ret = -ENOMEM;
- priv->dev = ieee802154_alloc_device(sizeof(*priv), &cc2520_ops);
- if (!priv->dev)
+ priv->hw = ieee802154_alloc_hw(sizeof(*priv), &cc2520_ops);
+ if (!priv->hw)
goto err_ret;
- priv->dev->priv = priv;
- priv->dev->parent = &priv->spi->dev;
- priv->dev->extra_tx_headroom = 0;
+ priv->hw->priv = priv;
+ priv->hw->parent = &priv->spi->dev;
+ priv->hw->extra_tx_headroom = 0;
/* We do support only 2.4 Ghz */
- priv->dev->phy->channels_supported[0] = 0x7FFF800;
- priv->dev->flags = IEEE802154_HW_OMIT_CKSUM | IEEE802154_HW_AACK;
+ priv->hw->phy->channels_supported[0] = 0x7FFF800;
+ priv->hw->flags = IEEE802154_HW_OMIT_CKSUM | IEEE802154_HW_AACK;
dev_vdbg(&priv->spi->dev, "registered cc2520\n");
- ret = ieee802154_register_device(priv->dev);
+ ret = ieee802154_register_hw(priv->hw);
if (ret)
goto err_free_device;
return 0;
err_free_device:
- ieee802154_free_device(priv->dev);
+ ieee802154_free_hw(priv->hw);
err_ret:
return ret;
}
@@ -1002,8 +1002,8 @@ static int cc2520_remove(struct spi_device *spi)
mutex_destroy(&priv->buffer_mutex);
flush_work(&priv->fifop_irqwork);
- ieee802154_unregister_device(priv->dev);
- ieee802154_free_device(priv->dev);
+ ieee802154_unregister_hw(priv->hw);
+ ieee802154_free_hw(priv->hw);
return 0;
}
diff --git a/drivers/net/ieee802154/fakelb.c b/drivers/net/ieee802154/fakelb.c
index e6e2993..51e3c58 100644
--- a/drivers/net/ieee802154/fakelb.c
+++ b/drivers/net/ieee802154/fakelb.c
@@ -30,7 +30,7 @@
static int numlbs = 1;
struct fakelb_dev_priv {
- struct ieee802154_dev *dev;
+ struct ieee802154_hw *hw;
struct list_head list;
struct fakelb_priv *fake;
@@ -45,7 +45,7 @@ struct fakelb_priv {
};
static int
-fakelb_hw_ed(struct ieee802154_dev *dev, u8 *level)
+fakelb_hw_ed(struct ieee802154_hw *hw, u8 *level)
{
might_sleep();
BUG_ON(!level);
@@ -55,13 +55,13 @@ fakelb_hw_ed(struct ieee802154_dev *dev, u8 *level)
}
static int
-fakelb_hw_channel(struct ieee802154_dev *dev, int page, int channel)
+fakelb_hw_channel(struct ieee802154_hw *hw, int page, int channel)
{
pr_debug("set channel to %d\n", channel);
might_sleep();
- dev->phy->current_page = page;
- dev->phy->current_channel = channel;
+ hw->phy->current_page = page;
+ hw->phy->current_channel = channel;
return 0;
}
@@ -74,15 +74,15 @@ fakelb_hw_deliver(struct fakelb_dev_priv *priv, struct sk_buff *skb)
spin_lock(&priv->lock);
if (priv->working) {
newskb = pskb_copy(skb, GFP_ATOMIC);
- ieee802154_rx_irqsafe(priv->dev, newskb, 0xcc);
+ ieee802154_rx_irqsafe(priv->hw, newskb, 0xcc);
}
spin_unlock(&priv->lock);
}
static int
-fakelb_hw_xmit(struct ieee802154_dev *dev, struct sk_buff *skb)
+fakelb_hw_xmit(struct ieee802154_hw *hw, struct sk_buff *skb)
{
- struct fakelb_dev_priv *priv = dev->priv;
+ struct fakelb_dev_priv *priv = hw->priv;
struct fakelb_priv *fake = priv->fake;
might_sleep();
@@ -95,8 +95,8 @@ fakelb_hw_xmit(struct ieee802154_dev *dev, struct sk_buff *skb)
struct fakelb_dev_priv *dp;
list_for_each_entry(dp, &priv->fake->list, list) {
if (dp != priv &&
- (dp->dev->phy->current_channel ==
- priv->dev->phy->current_channel))
+ (dp->hw->phy->current_channel ==
+ priv->hw->phy->current_channel))
fakelb_hw_deliver(dp, skb);
}
}
@@ -106,8 +106,8 @@ fakelb_hw_xmit(struct ieee802154_dev *dev, struct sk_buff *skb)
}
static int
-fakelb_hw_start(struct ieee802154_dev *dev) {
- struct fakelb_dev_priv *priv = dev->priv;
+fakelb_hw_start(struct ieee802154_hw *hw) {
+ struct fakelb_dev_priv *priv = hw->priv;
int ret = 0;
spin_lock(&priv->lock);
@@ -121,8 +121,8 @@ fakelb_hw_start(struct ieee802154_dev *dev) {
}
static void
-fakelb_hw_stop(struct ieee802154_dev *dev) {
- struct fakelb_dev_priv *priv = dev->priv;
+fakelb_hw_stop(struct ieee802154_hw *hw) {
+ struct fakelb_dev_priv *priv = hw->priv;
spin_lock(&priv->lock);
priv->working = 0;
@@ -146,54 +146,54 @@ static int fakelb_add_one(struct device *dev, struct fakelb_priv *fake)
{
struct fakelb_dev_priv *priv;
int err;
- struct ieee802154_dev *ieee;
+ struct ieee802154_hw *hw;
- ieee = ieee802154_alloc_device(sizeof(*priv), &fakelb_ops);
- if (!ieee)
+ hw = ieee802154_alloc_hw(sizeof(*priv), &fakelb_ops);
+ if (!hw)
return -ENOMEM;
- priv = ieee->priv;
- priv->dev = ieee;
+ priv = hw->priv;
+ priv->hw = hw;
/* 868 MHz BPSK 802.15.4-2003 */
- ieee->phy->channels_supported[0] |= 1;
+ hw->phy->channels_supported[0] |= 1;
/* 915 MHz BPSK 802.15.4-2003 */
- ieee->phy->channels_supported[0] |= 0x7fe;
+ hw->phy->channels_supported[0] |= 0x7fe;
/* 2.4 GHz O-QPSK 802.15.4-2003 */
- ieee->phy->channels_supported[0] |= 0x7FFF800;
+ hw->phy->channels_supported[0] |= 0x7FFF800;
/* 868 MHz ASK 802.15.4-2006 */
- ieee->phy->channels_supported[1] |= 1;
+ hw->phy->channels_supported[1] |= 1;
/* 915 MHz ASK 802.15.4-2006 */
- ieee->phy->channels_supported[1] |= 0x7fe;
+ hw->phy->channels_supported[1] |= 0x7fe;
/* 868 MHz O-QPSK 802.15.4-2006 */
- ieee->phy->channels_supported[2] |= 1;
+ hw->phy->channels_supported[2] |= 1;
/* 915 MHz O-QPSK 802.15.4-2006 */
- ieee->phy->channels_supported[2] |= 0x7fe;
+ hw->phy->channels_supported[2] |= 0x7fe;
/* 2.4 GHz CSS 802.15.4a-2007 */
- ieee->phy->channels_supported[3] |= 0x3fff;
+ hw->phy->channels_supported[3] |= 0x3fff;
/* UWB Sub-gigahertz 802.15.4a-2007 */
- ieee->phy->channels_supported[4] |= 1;
+ hw->phy->channels_supported[4] |= 1;
/* UWB Low band 802.15.4a-2007 */
- ieee->phy->channels_supported[4] |= 0x1e;
+ hw->phy->channels_supported[4] |= 0x1e;
/* UWB High band 802.15.4a-2007 */
- ieee->phy->channels_supported[4] |= 0xffe0;
+ hw->phy->channels_supported[4] |= 0xffe0;
/* 750 MHz O-QPSK 802.15.4c-2009 */
- ieee->phy->channels_supported[5] |= 0xf;
+ hw->phy->channels_supported[5] |= 0xf;
/* 750 MHz MPSK 802.15.4c-2009 */
- ieee->phy->channels_supported[5] |= 0xf0;
+ hw->phy->channels_supported[5] |= 0xf0;
/* 950 MHz BPSK 802.15.4d-2009 */
- ieee->phy->channels_supported[6] |= 0x3ff;
+ hw->phy->channels_supported[6] |= 0x3ff;
/* 950 MHz GFSK 802.15.4d-2009 */
- ieee->phy->channels_supported[6] |= 0x3ffc00;
+ hw->phy->channels_supported[6] |= 0x3ffc00;
INIT_LIST_HEAD(&priv->list);
priv->fake = fake;
spin_lock_init(&priv->lock);
- ieee->parent = dev;
+ hw->parent = dev;
- err = ieee802154_register_device(ieee);
+ err = ieee802154_register_hw(hw);
if (err)
goto err_reg;
@@ -204,7 +204,7 @@ static int fakelb_add_one(struct device *dev, struct fakelb_priv *fake)
return 0;
err_reg:
- ieee802154_free_device(priv->dev);
+ ieee802154_free_hw(priv->hw);
return err;
}
@@ -214,8 +214,8 @@ static void fakelb_del(struct fakelb_dev_priv *priv)
list_del(&priv->list);
write_unlock_bh(&priv->fake->lock);
- ieee802154_unregister_device(priv->dev);
- ieee802154_free_device(priv->dev);
+ ieee802154_unregister_hw(priv->hw);
+ ieee802154_free_hw(priv->hw);
}
static int fakelb_probe(struct platform_device *pdev)
diff --git a/drivers/net/ieee802154/mrf24j40.c b/drivers/net/ieee802154/mrf24j40.c
index 56a6959..2e267c5 100644
--- a/drivers/net/ieee802154/mrf24j40.c
+++ b/drivers/net/ieee802154/mrf24j40.c
@@ -79,7 +79,7 @@ enum mrf24j40_modules { MRF24J40, MRF24J40MA, MRF24J40MC };
/* Device Private Data */
struct mrf24j40 {
struct spi_device *spi;
- struct ieee802154_dev *dev;
+ struct ieee802154_hw *hw;
struct mutex buffer_mutex; /* only used to protect buf */
struct completion tx_complete;
@@ -332,9 +332,9 @@ out:
return ret;
}
-static int mrf24j40_tx(struct ieee802154_dev *dev, struct sk_buff *skb)
+static int mrf24j40_tx(struct ieee802154_hw *hw, struct sk_buff *skb)
{
- struct mrf24j40 *devrec = dev->priv;
+ struct mrf24j40 *devrec = hw->priv;
u8 val;
int ret = 0;
@@ -383,7 +383,7 @@ err:
return ret;
}
-static int mrf24j40_ed(struct ieee802154_dev *dev, u8 *level)
+static int mrf24j40_ed(struct ieee802154_hw *hw, u8 *level)
{
/* TODO: */
pr_warn("mrf24j40: ed not implemented\n");
@@ -391,9 +391,9 @@ static int mrf24j40_ed(struct ieee802154_dev *dev, u8 *level)
return 0;
}
-static int mrf24j40_start(struct ieee802154_dev *dev)
+static int mrf24j40_start(struct ieee802154_hw *hw)
{
- struct mrf24j40 *devrec = dev->priv;
+ struct mrf24j40 *devrec = hw->priv;
u8 val;
int ret;
@@ -408,9 +408,9 @@ static int mrf24j40_start(struct ieee802154_dev *dev)
return 0;
}
-static void mrf24j40_stop(struct ieee802154_dev *dev)
+static void mrf24j40_stop(struct ieee802154_hw *hw)
{
- struct mrf24j40 *devrec = dev->priv;
+ struct mrf24j40 *devrec = hw->priv;
u8 val;
int ret;
@@ -423,10 +423,10 @@ static void mrf24j40_stop(struct ieee802154_dev *dev)
write_short_reg(devrec, REG_INTCON, val);
}
-static int mrf24j40_set_channel(struct ieee802154_dev *dev,
+static int mrf24j40_set_channel(struct ieee802154_hw *hw,
int page, int channel)
{
- struct mrf24j40 *devrec = dev->priv;
+ struct mrf24j40 *devrec = hw->priv;
u8 val;
int ret;
@@ -454,11 +454,11 @@ static int mrf24j40_set_channel(struct ieee802154_dev *dev,
return 0;
}
-static int mrf24j40_filter(struct ieee802154_dev *dev,
+static int mrf24j40_filter(struct ieee802154_hw *hw,
struct ieee802154_hw_addr_filt *filt,
unsigned long changed)
{
- struct mrf24j40 *devrec = dev->priv;
+ struct mrf24j40 *devrec = hw->priv;
dev_dbg(printdev(devrec), "filter\n");
@@ -564,7 +564,7 @@ static int mrf24j40_handle_rx(struct mrf24j40 *devrec)
/* TODO: Other drivers call ieee20154_rx_irqsafe() here (eg: cc2040,
* also from a workqueue). I think irqsafe is not necessary here.
* Can someone confirm? */
- ieee802154_rx_irqsafe(devrec->dev, skb, lqi);
+ ieee802154_rx_irqsafe(devrec->hw, skb, lqi);
dev_dbg(printdev(devrec), "RX Handled\n");
@@ -745,17 +745,17 @@ static int mrf24j40_probe(struct spi_device *spi)
/* Register with the 802154 subsystem */
- devrec->dev = ieee802154_alloc_device(0, &mrf24j40_ops);
- if (!devrec->dev)
+ devrec->hw = ieee802154_alloc_hw(0, &mrf24j40_ops);
+ if (!devrec->hw)
goto err_ret;
- devrec->dev->priv = devrec;
- devrec->dev->parent = &devrec->spi->dev;
- devrec->dev->phy->channels_supported[0] = CHANNEL_MASK;
- devrec->dev->flags = IEEE802154_HW_OMIT_CKSUM|IEEE802154_HW_AACK;
+ devrec->hw->priv = devrec;
+ devrec->hw->parent = &devrec->spi->dev;
+ devrec->hw->phy->channels_supported[0] = CHANNEL_MASK;
+ devrec->hw->flags = IEEE802154_HW_OMIT_CKSUM|IEEE802154_HW_AACK;
dev_dbg(printdev(devrec), "registered mrf24j40\n");
- ret = ieee802154_register_device(devrec->dev);
+ ret = ieee802154_register_hw(devrec->hw);
if (ret)
goto err_register_device;
@@ -780,9 +780,9 @@ static int mrf24j40_probe(struct spi_device *spi)
err_irq:
err_hw_init:
- ieee802154_unregister_device(devrec->dev);
+ ieee802154_unregister_hw(devrec->hw);
err_register_device:
- ieee802154_free_device(devrec->dev);
+ ieee802154_free_hw(devrec->hw);
err_ret:
return ret;
}
@@ -793,8 +793,8 @@ static int mrf24j40_remove(struct spi_device *spi)
dev_dbg(printdev(devrec), "remove\n");
- ieee802154_unregister_device(devrec->dev);
- ieee802154_free_device(devrec->dev);
+ ieee802154_unregister_hw(devrec->hw);
+ ieee802154_free_hw(devrec->hw);
/* TODO: Will ieee802154_free_device() wait until ->xmit() is
* complete? */
diff --git a/include/net/mac802154.h b/include/net/mac802154.h
index 70351de..eb0e1cb 100644
--- a/include/net/mac802154.h
+++ b/include/net/mac802154.h
@@ -52,7 +52,7 @@ struct ieee802154_hw_addr_filt {
u8 pan_coord;
};
-struct ieee802154_dev {
+struct ieee802154_hw {
/* filled by the driver */
int extra_tx_headroom;
u32 flags;
@@ -159,37 +159,37 @@ struct ieee802154_dev {
*/
struct ieee802154_ops {
struct module *owner;
- int (*start)(struct ieee802154_dev *dev);
- void (*stop)(struct ieee802154_dev *dev);
- int (*xmit)(struct ieee802154_dev *dev,
+ int (*start)(struct ieee802154_hw *hw);
+ void (*stop)(struct ieee802154_hw *hw);
+ int (*xmit)(struct ieee802154_hw *hw,
struct sk_buff *skb);
- int (*ed)(struct ieee802154_dev *dev, u8 *level);
- int (*set_channel)(struct ieee802154_dev *dev,
+ int (*ed)(struct ieee802154_hw *hw, u8 *level);
+ int (*set_channel)(struct ieee802154_hw *hw,
int page,
int channel);
- int (*set_hw_addr_filt)(struct ieee802154_dev *dev,
- struct ieee802154_hw_addr_filt *filt,
+ int (*set_hw_addr_filt)(struct ieee802154_hw *hw,
+ struct ieee802154_hw_addr_filt *filt,
unsigned long changed);
- int (*ieee_addr)(struct ieee802154_dev *dev, __le64 addr);
- int (*set_txpower)(struct ieee802154_dev *dev, int db);
- int (*set_lbt)(struct ieee802154_dev *dev, bool on);
- int (*set_cca_mode)(struct ieee802154_dev *dev, u8 mode);
- int (*set_cca_ed_level)(struct ieee802154_dev *dev,
+ int (*ieee_addr)(struct ieee802154_hw *hw, __le64 addr);
+ int (*set_txpower)(struct ieee802154_hw *hw, int db);
+ int (*set_lbt)(struct ieee802154_hw *hw, bool on);
+ int (*set_cca_mode)(struct ieee802154_hw *hw, u8 mode);
+ int (*set_cca_ed_level)(struct ieee802154_hw *hw,
s32 level);
- int (*set_csma_params)(struct ieee802154_dev *dev,
+ int (*set_csma_params)(struct ieee802154_hw *hw,
u8 min_be, u8 max_be, u8 retries);
- int (*set_frame_retries)(struct ieee802154_dev *dev,
+ int (*set_frame_retries)(struct ieee802154_hw *hw,
s8 retries);
};
-/* Basic interface to register ieee802154 device */
-struct ieee802154_dev *
-ieee802154_alloc_device(size_t priv_data_len, struct ieee802154_ops *ops);
-void ieee802154_free_device(struct ieee802154_dev *dev);
-int ieee802154_register_device(struct ieee802154_dev *dev);
-void ieee802154_unregister_device(struct ieee802154_dev *dev);
+/* Basic interface to register ieee802154 hwice */
+struct ieee802154_hw *
+ieee802154_alloc_hw(size_t priv_data_len, struct ieee802154_ops *ops);
+void ieee802154_free_hw(struct ieee802154_hw *hw);
+int ieee802154_register_hw(struct ieee802154_hw *hw);
+void ieee802154_unregister_hw(struct ieee802154_hw *hw);
-void ieee802154_rx_irqsafe(struct ieee802154_dev *dev, struct sk_buff *skb,
+void ieee802154_rx_irqsafe(struct ieee802154_hw *hw, struct sk_buff *skb,
u8 lqi);
#endif /* NET_MAC802154_H */
diff --git a/net/mac802154/ieee802154_i.h b/net/mac802154/ieee802154_i.h
index 970b621..0cb98e8 100644
--- a/net/mac802154/ieee802154_i.h
+++ b/net/mac802154/ieee802154_i.h
@@ -27,7 +27,7 @@
/* mac802154 device private data */
struct mac802154_priv {
- struct ieee802154_dev hw;
+ struct ieee802154_hw hw;
struct ieee802154_ops *ops;
/* ieee802154 phy */
diff --git a/net/mac802154/main.c b/net/mac802154/main.c
index 9798c74..b0bcc06 100644
--- a/net/mac802154/main.c
+++ b/net/mac802154/main.c
@@ -235,8 +235,8 @@ static int mac802154_set_frame_retries(struct wpan_phy *phy, s8 retries)
return priv->ops->set_frame_retries(&priv->hw, retries);
}
-struct ieee802154_dev *
-ieee802154_alloc_device(size_t priv_data_len, struct ieee802154_ops *ops)
+struct ieee802154_hw *
+ieee802154_alloc_hw(size_t priv_data_len, struct ieee802154_ops *ops)
{
struct wpan_phy *phy;
struct mac802154_priv *priv;
@@ -285,9 +285,9 @@ ieee802154_alloc_device(size_t priv_data_len, struct ieee802154_ops *ops)
return &priv->hw;
}
-EXPORT_SYMBOL(ieee802154_alloc_device);
+EXPORT_SYMBOL(ieee802154_alloc_hw);
-void ieee802154_free_device(struct ieee802154_dev *hw)
+void ieee802154_free_hw(struct ieee802154_hw *hw)
{
struct mac802154_priv *priv = mac802154_to_priv(hw);
@@ -297,49 +297,49 @@ void ieee802154_free_device(struct ieee802154_dev *hw)
wpan_phy_free(priv->phy);
}
-EXPORT_SYMBOL(ieee802154_free_device);
+EXPORT_SYMBOL(ieee802154_free_hw);
-int ieee802154_register_device(struct ieee802154_dev *dev)
+int ieee802154_register_hw(struct ieee802154_hw *hw)
{
- struct mac802154_priv *priv = mac802154_to_priv(dev);
+ struct mac802154_priv *priv = mac802154_to_priv(hw);
int rc = -ENOSYS;
- if (dev->flags & IEEE802154_HW_TXPOWER) {
+ if (hw->flags & IEEE802154_HW_TXPOWER) {
if (!priv->ops->set_txpower)
goto out;
priv->phy->set_txpower = mac802154_set_txpower;
}
- if (dev->flags & IEEE802154_HW_LBT) {
+ if (hw->flags & IEEE802154_HW_LBT) {
if (!priv->ops->set_lbt)
goto out;
priv->phy->set_lbt = mac802154_set_lbt;
}
- if (dev->flags & IEEE802154_HW_CCA_MODE) {
+ if (hw->flags & IEEE802154_HW_CCA_MODE) {
if (!priv->ops->set_cca_mode)
goto out;
priv->phy->set_cca_mode = mac802154_set_cca_mode;
}
- if (dev->flags & IEEE802154_HW_CCA_ED_LEVEL) {
+ if (hw->flags & IEEE802154_HW_CCA_ED_LEVEL) {
if (!priv->ops->set_cca_ed_level)
goto out;
priv->phy->set_cca_ed_level = mac802154_set_cca_ed_level;
}
- if (dev->flags & IEEE802154_HW_CSMA_PARAMS) {
+ if (hw->flags & IEEE802154_HW_CSMA_PARAMS) {
if (!priv->ops->set_csma_params)
goto out;
priv->phy->set_csma_params = mac802154_set_csma_params;
}
- if (dev->flags & IEEE802154_HW_FRAME_RETRIES) {
+ if (hw->flags & IEEE802154_HW_FRAME_RETRIES) {
if (!priv->ops->set_frame_retries)
goto out;
@@ -377,11 +377,11 @@ out_wq:
out:
return rc;
}
-EXPORT_SYMBOL(ieee802154_register_device);
+EXPORT_SYMBOL(ieee802154_register_hw);
-void ieee802154_unregister_device(struct ieee802154_dev *dev)
+void ieee802154_unregister_hw(struct ieee802154_hw *hw)
{
- struct mac802154_priv *priv = mac802154_to_priv(dev);
+ struct mac802154_priv *priv = mac802154_to_priv(hw);
struct mac802154_sub_if_data *sdata, *next;
flush_workqueue(priv->dev_workqueue);
@@ -405,7 +405,7 @@ void ieee802154_unregister_device(struct ieee802154_dev *dev)
wpan_phy_unregister(priv->phy);
}
-EXPORT_SYMBOL(ieee802154_unregister_device);
+EXPORT_SYMBOL(ieee802154_unregister_hw);
MODULE_DESCRIPTION("IEEE 802.15.4 implementation");
MODULE_LICENSE("GPL v2");
diff --git a/net/mac802154/rx.c b/net/mac802154/rx.c
index bc6cffd5..62b5c7d 100644
--- a/net/mac802154/rx.c
+++ b/net/mac802154/rx.c
@@ -42,12 +42,12 @@
struct rx_work {
struct sk_buff *skb;
struct work_struct work;
- struct ieee802154_dev *dev;
+ struct ieee802154_hw *hw;
u8 lqi;
};
static void
-mac802154_subif_rx(struct ieee802154_dev *hw, struct sk_buff *skb, u8 lqi)
+mac802154_subif_rx(struct ieee802154_hw *hw, struct sk_buff *skb, u8 lqi)
{
struct mac802154_priv *priv = mac802154_to_priv(hw);
@@ -83,14 +83,14 @@ static void mac802154_rx_worker(struct work_struct *work)
{
struct rx_work *rw = container_of(work, struct rx_work, work);
- mac802154_subif_rx(rw->dev, rw->skb, rw->lqi);
+ mac802154_subif_rx(rw->hw, rw->skb, rw->lqi);
kfree(rw);
}
void
-ieee802154_rx_irqsafe(struct ieee802154_dev *dev, struct sk_buff *skb, u8 lqi)
+ieee802154_rx_irqsafe(struct ieee802154_hw *hw, struct sk_buff *skb, u8 lqi)
{
- struct mac802154_priv *priv = mac802154_to_priv(dev);
+ struct mac802154_priv *priv = mac802154_to_priv(hw);
struct rx_work *work;
if (!skb)
@@ -102,7 +102,7 @@ ieee802154_rx_irqsafe(struct ieee802154_dev *dev, struct sk_buff *skb, u8 lqi)
INIT_WORK(&work->work, mac802154_rx_worker);
work->skb = skb;
- work->dev = dev;
+ work->hw = hw;
work->lqi = lqi;
queue_work(priv->dev_workqueue, &work->work);
--
2.1.2
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH bluetooth-next 03/10] mac802154: rename mac802154_priv to ieee802154_local
2014-10-25 15:16 [PATCH bluetooth-next 00/10] ieee802154: removals and renames Alexander Aring
2014-10-25 15:16 ` [PATCH bluetooth-next 01/10] ieee802154: remove fakehard driver Alexander Aring
2014-10-25 15:16 ` [PATCH bluetooth-next 02/10] ieee802154: rename ieee802154_dev to ieee802154_hw Alexander Aring
@ 2014-10-25 15:16 ` Alexander Aring
2014-10-25 15:16 ` [PATCH bluetooth-next 04/10] mac802154: rename mac802154_sub_if_data Alexander Aring
` (7 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: Alexander Aring @ 2014-10-25 15:16 UTC (permalink / raw)
To: linux-wpan; +Cc: kernel, Alexander Aring
This patch rename the mac802154_priv to ieee802154_local. The
mac802154_priv structure is like ieee80211_local and so we name it
ieee802154_local.
Signed-off-by: Alexander Aring <alex.aring@gmail.com>
---
net/mac802154/ieee802154_i.h | 12 +--
net/mac802154/iface.c | 4 +-
net/mac802154/main.c | 172 +++++++++++++++++++++----------------------
net/mac802154/mib.c | 21 +++---
net/mac802154/monitor.c | 4 +-
net/mac802154/rx.c | 12 +--
net/mac802154/tx.c | 36 ++++-----
7 files changed, 130 insertions(+), 131 deletions(-)
diff --git a/net/mac802154/ieee802154_i.h b/net/mac802154/ieee802154_i.h
index 0cb98e8..eb55cd2 100644
--- a/net/mac802154/ieee802154_i.h
+++ b/net/mac802154/ieee802154_i.h
@@ -26,7 +26,7 @@
#include "llsec.h"
/* mac802154 device private data */
-struct mac802154_priv {
+struct ieee802154_local {
struct ieee802154_hw hw;
struct ieee802154_ops *ops;
@@ -69,7 +69,7 @@ struct mac802154_priv {
struct mac802154_sub_if_data {
struct list_head list; /* the ieee802154_priv->slaves list */
- struct mac802154_priv *hw;
+ struct ieee802154_local *hw;
struct net_device *dev;
int type;
@@ -99,7 +99,7 @@ struct mac802154_sub_if_data {
struct mac802154_llsec sec;
};
-#define mac802154_to_priv(_hw) container_of(_hw, struct mac802154_priv, hw)
+#define mac802154_to_priv(_hw) container_of(_hw, struct ieee802154_local, hw)
#define MAC802154_CHAN_NONE 0xff /* No channel is assigned */
@@ -109,13 +109,13 @@ extern struct ieee802154_mlme_ops mac802154_mlme_wpan;
int mac802154_slave_open(struct net_device *dev);
int mac802154_slave_close(struct net_device *dev);
-void mac802154_monitors_rx(struct mac802154_priv *priv, struct sk_buff *skb);
+void mac802154_monitors_rx(struct ieee802154_local *local, struct sk_buff *skb);
void mac802154_monitor_setup(struct net_device *dev);
-void mac802154_wpans_rx(struct mac802154_priv *priv, struct sk_buff *skb);
+void mac802154_wpans_rx(struct ieee802154_local *local, struct sk_buff *skb);
void mac802154_wpan_setup(struct net_device *dev);
-netdev_tx_t mac802154_tx(struct mac802154_priv *priv, struct sk_buff *skb,
+netdev_tx_t mac802154_tx(struct ieee802154_local *local, struct sk_buff *skb,
u8 page, u8 chan);
/* MIB callbacks */
diff --git a/net/mac802154/iface.c b/net/mac802154/iface.c
index 03eedc3..10f1ee2 100644
--- a/net/mac802154/iface.c
+++ b/net/mac802154/iface.c
@@ -565,7 +565,7 @@ static int mac802154_parse_frame_start(struct sk_buff *skb,
return 0;
}
-void mac802154_wpans_rx(struct mac802154_priv *priv, struct sk_buff *skb)
+void mac802154_wpans_rx(struct ieee802154_local *local, struct sk_buff *skb)
{
int ret;
struct mac802154_sub_if_data *sdata;
@@ -579,7 +579,7 @@ void mac802154_wpans_rx(struct mac802154_priv *priv, struct sk_buff *skb)
}
rcu_read_lock();
- list_for_each_entry_rcu(sdata, &priv->slaves, list) {
+ list_for_each_entry_rcu(sdata, &local->slaves, list) {
if (sdata->type != IEEE802154_DEV_WPAN ||
!netif_running(sdata->dev))
continue;
diff --git a/net/mac802154/main.c b/net/mac802154/main.c
index b0bcc06..387d4cf 100644
--- a/net/mac802154/main.c
+++ b/net/mac802154/main.c
@@ -33,7 +33,7 @@ int mac802154_slave_open(struct net_device *dev)
{
struct mac802154_sub_if_data *priv = netdev_priv(dev);
struct mac802154_sub_if_data *subif;
- struct mac802154_priv *ipriv = priv->hw;
+ struct ieee802154_local *local = priv->hw;
int res = 0;
ASSERT_RTNL();
@@ -54,17 +54,17 @@ int mac802154_slave_open(struct net_device *dev)
priv->running = true;
mutex_unlock(&priv->hw->slaves_mtx);
- if (ipriv->open_count++ == 0) {
- res = ipriv->ops->start(&ipriv->hw);
+ if (local->open_count++ == 0) {
+ res = local->ops->start(&local->hw);
WARN_ON(res);
if (res)
goto err;
}
- if (ipriv->ops->ieee_addr) {
+ if (local->ops->ieee_addr) {
__le64 addr = ieee802154_devaddr_from_raw(dev->dev_addr);
- res = ipriv->ops->ieee_addr(&ipriv->hw, addr);
+ res = local->ops->ieee_addr(&local->hw, addr);
WARN_ON(res);
if (res)
goto err;
@@ -82,7 +82,7 @@ err:
int mac802154_slave_close(struct net_device *dev)
{
struct mac802154_sub_if_data *priv = netdev_priv(dev);
- struct mac802154_priv *ipriv = priv->hw;
+ struct ieee802154_local *local = priv->hw;
ASSERT_RTNL();
@@ -92,8 +92,8 @@ int mac802154_slave_close(struct net_device *dev)
priv->running = false;
mutex_unlock(&priv->hw->slaves_mtx);
- if (!--ipriv->open_count)
- ipriv->ops->stop(&ipriv->hw);
+ if (!--local->open_count)
+ local->ops->stop(&local->hw);
return 0;
}
@@ -102,34 +102,34 @@ static int
mac802154_netdev_register(struct wpan_phy *phy, struct net_device *dev)
{
struct mac802154_sub_if_data *priv;
- struct mac802154_priv *ipriv;
+ struct ieee802154_local *local;
int err;
- ipriv = wpan_phy_priv(phy);
+ local = wpan_phy_priv(phy);
priv = netdev_priv(dev);
priv->dev = dev;
- priv->hw = ipriv;
+ priv->hw = local;
- dev->needed_headroom = ipriv->hw.extra_tx_headroom;
+ dev->needed_headroom = local->hw.extra_tx_headroom;
- SET_NETDEV_DEV(dev, &ipriv->phy->dev);
+ SET_NETDEV_DEV(dev, &local->phy->dev);
- mutex_lock(&ipriv->slaves_mtx);
- if (!ipriv->running) {
- mutex_unlock(&ipriv->slaves_mtx);
+ mutex_lock(&local->slaves_mtx);
+ if (!local->running) {
+ mutex_unlock(&local->slaves_mtx);
return -ENODEV;
}
- mutex_unlock(&ipriv->slaves_mtx);
+ mutex_unlock(&local->slaves_mtx);
err = register_netdev(dev);
if (err < 0)
return err;
rtnl_lock();
- mutex_lock(&ipriv->slaves_mtx);
- list_add_tail_rcu(&priv->list, &ipriv->slaves);
- mutex_unlock(&ipriv->slaves_mtx);
+ mutex_lock(&local->slaves_mtx);
+ list_add_tail_rcu(&priv->list, &local->slaves);
+ mutex_unlock(&local->slaves_mtx);
rtnl_unlock();
return 0;
@@ -194,52 +194,52 @@ err:
static int mac802154_set_txpower(struct wpan_phy *phy, int db)
{
- struct mac802154_priv *priv = wpan_phy_priv(phy);
+ struct ieee802154_local *local = wpan_phy_priv(phy);
- return priv->ops->set_txpower(&priv->hw, db);
+ return local->ops->set_txpower(&local->hw, db);
}
static int mac802154_set_lbt(struct wpan_phy *phy, bool on)
{
- struct mac802154_priv *priv = wpan_phy_priv(phy);
+ struct ieee802154_local *local = wpan_phy_priv(phy);
- return priv->ops->set_lbt(&priv->hw, on);
+ return local->ops->set_lbt(&local->hw, on);
}
static int mac802154_set_cca_mode(struct wpan_phy *phy, u8 mode)
{
- struct mac802154_priv *priv = wpan_phy_priv(phy);
+ struct ieee802154_local *local = wpan_phy_priv(phy);
- return priv->ops->set_cca_mode(&priv->hw, mode);
+ return local->ops->set_cca_mode(&local->hw, mode);
}
static int mac802154_set_cca_ed_level(struct wpan_phy *phy, s32 level)
{
- struct mac802154_priv *priv = wpan_phy_priv(phy);
+ struct ieee802154_local *local = wpan_phy_priv(phy);
- return priv->ops->set_cca_ed_level(&priv->hw, level);
+ return local->ops->set_cca_ed_level(&local->hw, level);
}
static int mac802154_set_csma_params(struct wpan_phy *phy, u8 min_be,
u8 max_be, u8 retries)
{
- struct mac802154_priv *priv = wpan_phy_priv(phy);
+ struct ieee802154_local *local = wpan_phy_priv(phy);
- return priv->ops->set_csma_params(&priv->hw, min_be, max_be, retries);
+ return local->ops->set_csma_params(&local->hw, min_be, max_be, retries);
}
static int mac802154_set_frame_retries(struct wpan_phy *phy, s8 retries)
{
- struct mac802154_priv *priv = wpan_phy_priv(phy);
+ struct ieee802154_local *local = wpan_phy_priv(phy);
- return priv->ops->set_frame_retries(&priv->hw, retries);
+ return local->ops->set_frame_retries(&local->hw, retries);
}
struct ieee802154_hw *
ieee802154_alloc_hw(size_t priv_data_len, struct ieee802154_ops *ops)
{
struct wpan_phy *phy;
- struct mac802154_priv *priv;
+ struct ieee802154_local *local;
size_t priv_size;
if (!ops || !ops->xmit || !ops->ed || !ops->start ||
@@ -249,24 +249,24 @@ ieee802154_alloc_hw(size_t priv_data_len, struct ieee802154_ops *ops)
}
/* Ensure 32-byte alignment of our private data and hw private data.
- * We use the wpan_phy priv data for both our mac802154_priv and for
+ * We use the wpan_phy priv data for both our ieee802154_local and for
* the driver's private data
*
* in memory it'll be like this:
*
- * +-----------------------+
- * | struct wpan_phy |
- * +-----------------------+
- * | struct mac802154_priv |
- * +-----------------------+
- * | driver's private data |
- * +-----------------------+
+ * +-------------------------+
+ * | struct wpan_phy |
+ * +-------------------------+
+ * | struct ieee802154_local |
+ * +-------------------------+
+ * | driver's private data |
+ * +-------------------------+
*
* Due to ieee802154 layer isn't aware of driver and MAC structures,
* so lets align them here.
*/
- priv_size = ALIGN(sizeof(*priv), NETDEV_ALIGN) + priv_data_len;
+ priv_size = ALIGN(sizeof(*local), NETDEV_ALIGN) + priv_data_len;
phy = wpan_phy_alloc(priv_size);
if (!phy) {
@@ -274,106 +274,106 @@ ieee802154_alloc_hw(size_t priv_data_len, struct ieee802154_ops *ops)
return NULL;
}
- priv = wpan_phy_priv(phy);
- priv->phy = phy;
- priv->hw.phy = priv->phy;
- priv->hw.priv = (char *)priv + ALIGN(sizeof(*priv), NETDEV_ALIGN);
- priv->ops = ops;
+ local = wpan_phy_priv(phy);
+ local->phy = phy;
+ local->hw.phy = local->phy;
+ local->hw.priv = (char *)local + ALIGN(sizeof(*local), NETDEV_ALIGN);
+ local->ops = ops;
- INIT_LIST_HEAD(&priv->slaves);
- mutex_init(&priv->slaves_mtx);
+ INIT_LIST_HEAD(&local->slaves);
+ mutex_init(&local->slaves_mtx);
- return &priv->hw;
+ return &local->hw;
}
EXPORT_SYMBOL(ieee802154_alloc_hw);
void ieee802154_free_hw(struct ieee802154_hw *hw)
{
- struct mac802154_priv *priv = mac802154_to_priv(hw);
+ struct ieee802154_local *local = mac802154_to_priv(hw);
- BUG_ON(!list_empty(&priv->slaves));
+ BUG_ON(!list_empty(&local->slaves));
- mutex_destroy(&priv->slaves_mtx);
+ mutex_destroy(&local->slaves_mtx);
- wpan_phy_free(priv->phy);
+ wpan_phy_free(local->phy);
}
EXPORT_SYMBOL(ieee802154_free_hw);
int ieee802154_register_hw(struct ieee802154_hw *hw)
{
- struct mac802154_priv *priv = mac802154_to_priv(hw);
+ struct ieee802154_local *local = mac802154_to_priv(hw);
int rc = -ENOSYS;
if (hw->flags & IEEE802154_HW_TXPOWER) {
- if (!priv->ops->set_txpower)
+ if (!local->ops->set_txpower)
goto out;
- priv->phy->set_txpower = mac802154_set_txpower;
+ local->phy->set_txpower = mac802154_set_txpower;
}
if (hw->flags & IEEE802154_HW_LBT) {
- if (!priv->ops->set_lbt)
+ if (!local->ops->set_lbt)
goto out;
- priv->phy->set_lbt = mac802154_set_lbt;
+ local->phy->set_lbt = mac802154_set_lbt;
}
if (hw->flags & IEEE802154_HW_CCA_MODE) {
- if (!priv->ops->set_cca_mode)
+ if (!local->ops->set_cca_mode)
goto out;
- priv->phy->set_cca_mode = mac802154_set_cca_mode;
+ local->phy->set_cca_mode = mac802154_set_cca_mode;
}
if (hw->flags & IEEE802154_HW_CCA_ED_LEVEL) {
- if (!priv->ops->set_cca_ed_level)
+ if (!local->ops->set_cca_ed_level)
goto out;
- priv->phy->set_cca_ed_level = mac802154_set_cca_ed_level;
+ local->phy->set_cca_ed_level = mac802154_set_cca_ed_level;
}
if (hw->flags & IEEE802154_HW_CSMA_PARAMS) {
- if (!priv->ops->set_csma_params)
+ if (!local->ops->set_csma_params)
goto out;
- priv->phy->set_csma_params = mac802154_set_csma_params;
+ local->phy->set_csma_params = mac802154_set_csma_params;
}
if (hw->flags & IEEE802154_HW_FRAME_RETRIES) {
- if (!priv->ops->set_frame_retries)
+ if (!local->ops->set_frame_retries)
goto out;
- priv->phy->set_frame_retries = mac802154_set_frame_retries;
+ local->phy->set_frame_retries = mac802154_set_frame_retries;
}
- priv->dev_workqueue =
- create_singlethread_workqueue(wpan_phy_name(priv->phy));
- if (!priv->dev_workqueue) {
+ local->dev_workqueue =
+ create_singlethread_workqueue(wpan_phy_name(local->phy));
+ if (!local->dev_workqueue) {
rc = -ENOMEM;
goto out;
}
- wpan_phy_set_dev(priv->phy, priv->hw.parent);
+ wpan_phy_set_dev(local->phy, local->hw.parent);
- priv->phy->add_iface = mac802154_add_iface;
- priv->phy->del_iface = mac802154_del_iface;
+ local->phy->add_iface = mac802154_add_iface;
+ local->phy->del_iface = mac802154_del_iface;
- rc = wpan_phy_register(priv->phy);
+ rc = wpan_phy_register(local->phy);
if (rc < 0)
goto out_wq;
rtnl_lock();
- mutex_lock(&priv->slaves_mtx);
- priv->running = MAC802154_DEVICE_RUN;
- mutex_unlock(&priv->slaves_mtx);
+ mutex_lock(&local->slaves_mtx);
+ local->running = MAC802154_DEVICE_RUN;
+ mutex_unlock(&local->slaves_mtx);
rtnl_unlock();
return 0;
out_wq:
- destroy_workqueue(priv->dev_workqueue);
+ destroy_workqueue(local->dev_workqueue);
out:
return rc;
}
@@ -381,19 +381,19 @@ EXPORT_SYMBOL(ieee802154_register_hw);
void ieee802154_unregister_hw(struct ieee802154_hw *hw)
{
- struct mac802154_priv *priv = mac802154_to_priv(hw);
+ struct ieee802154_local *local = mac802154_to_priv(hw);
struct mac802154_sub_if_data *sdata, *next;
- flush_workqueue(priv->dev_workqueue);
- destroy_workqueue(priv->dev_workqueue);
+ flush_workqueue(local->dev_workqueue);
+ destroy_workqueue(local->dev_workqueue);
rtnl_lock();
- mutex_lock(&priv->slaves_mtx);
- priv->running = MAC802154_DEVICE_STOPPED;
- mutex_unlock(&priv->slaves_mtx);
+ mutex_lock(&local->slaves_mtx);
+ local->running = MAC802154_DEVICE_STOPPED;
+ mutex_unlock(&local->slaves_mtx);
- list_for_each_entry_safe(sdata, next, &priv->slaves, list) {
+ list_for_each_entry_safe(sdata, next, &local->slaves, list) {
mutex_lock(&sdata->hw->slaves_mtx);
list_del(&sdata->list);
mutex_unlock(&sdata->hw->slaves_mtx);
@@ -403,7 +403,7 @@ void ieee802154_unregister_hw(struct ieee802154_hw *hw)
rtnl_unlock();
- wpan_phy_unregister(priv->phy);
+ wpan_phy_unregister(local->phy);
}
EXPORT_SYMBOL(ieee802154_unregister_hw);
diff --git a/net/mac802154/mib.c b/net/mac802154/mib.c
index 7c94672..5d9592a 100644
--- a/net/mac802154/mib.c
+++ b/net/mac802154/mib.c
@@ -36,7 +36,7 @@ struct hw_addr_filt_notify_work {
unsigned long changed;
};
-static struct mac802154_priv *mac802154_slave_get_priv(struct net_device *dev)
+static struct ieee802154_local *mac802154_slave_get_priv(struct net_device *dev)
{
struct mac802154_sub_if_data *priv = netdev_priv(dev);
@@ -49,12 +49,11 @@ static void hw_addr_notify(struct work_struct *work)
{
struct hw_addr_filt_notify_work *nw = container_of(work,
struct hw_addr_filt_notify_work, work);
- struct mac802154_priv *hw = mac802154_slave_get_priv(nw->dev);
+ struct ieee802154_local *local = mac802154_slave_get_priv(nw->dev);
int res;
- res = hw->ops->set_hw_addr_filt(&hw->hw,
- &hw->hw.hw_filt,
- nw->changed);
+ res = local->ops->set_hw_addr_filt(&local->hw, &local->hw.hw_filt,
+ nw->changed);
if (res)
pr_debug("failed changed mask %lx\n", nw->changed);
@@ -110,13 +109,13 @@ __le16 mac802154_dev_get_short_addr(const struct net_device *dev)
void mac802154_dev_set_ieee_addr(struct net_device *dev)
{
struct mac802154_sub_if_data *priv = netdev_priv(dev);
- struct mac802154_priv *mac = priv->hw;
+ struct ieee802154_local *local = priv->hw;
priv->extended_addr = ieee802154_devaddr_from_raw(dev->dev_addr);
- if (mac->ops->set_hw_addr_filt &&
- mac->hw.hw_filt.ieee_addr != priv->extended_addr) {
- mac->hw.hw_filt.ieee_addr = priv->extended_addr;
+ if (local->ops->set_hw_addr_filt &&
+ local->hw.hw_filt.ieee_addr != priv->extended_addr) {
+ local->hw.hw_filt.ieee_addr = priv->extended_addr;
set_hw_addr_filt(dev, IEEE802154_AFILT_IEEEADDR_CHANGED);
}
}
@@ -165,12 +164,12 @@ static void phy_chan_notify(struct work_struct *work)
{
struct phy_chan_notify_work *nw = container_of(work,
struct phy_chan_notify_work, work);
- struct mac802154_priv *hw = mac802154_slave_get_priv(nw->dev);
+ struct ieee802154_local *local = mac802154_slave_get_priv(nw->dev);
struct mac802154_sub_if_data *priv = netdev_priv(nw->dev);
int res;
mutex_lock(&priv->hw->phy->pib_lock);
- res = hw->ops->set_channel(&hw->hw, priv->page, priv->chan);
+ res = local->ops->set_channel(&local->hw, priv->page, priv->chan);
if (res) {
pr_debug("set_channel failed\n");
} else {
diff --git a/net/mac802154/monitor.c b/net/mac802154/monitor.c
index ca82c72..a107fd2 100644
--- a/net/mac802154/monitor.c
+++ b/net/mac802154/monitor.c
@@ -57,7 +57,7 @@ static netdev_tx_t mac802154_monitor_xmit(struct sk_buff *skb,
}
-void mac802154_monitors_rx(struct mac802154_priv *priv, struct sk_buff *skb)
+void mac802154_monitors_rx(struct ieee802154_local *local, struct sk_buff *skb)
{
struct sk_buff *skb2;
struct mac802154_sub_if_data *sdata;
@@ -65,7 +65,7 @@ void mac802154_monitors_rx(struct mac802154_priv *priv, struct sk_buff *skb)
u8 *data;
rcu_read_lock();
- list_for_each_entry_rcu(sdata, &priv->slaves, list) {
+ list_for_each_entry_rcu(sdata, &local->slaves, list) {
if (sdata->type != IEEE802154_DEV_MONITOR ||
!netif_running(sdata->dev))
continue;
diff --git a/net/mac802154/rx.c b/net/mac802154/rx.c
index 62b5c7d..dc01817 100644
--- a/net/mac802154/rx.c
+++ b/net/mac802154/rx.c
@@ -49,13 +49,13 @@ struct rx_work {
static void
mac802154_subif_rx(struct ieee802154_hw *hw, struct sk_buff *skb, u8 lqi)
{
- struct mac802154_priv *priv = mac802154_to_priv(hw);
+ struct ieee802154_local *local = mac802154_to_priv(hw);
mac_cb(skb)->lqi = lqi;
skb->protocol = htons(ETH_P_IEEE802154);
skb_reset_mac_header(skb);
- if (!(priv->hw.flags & IEEE802154_HW_OMIT_CKSUM)) {
+ if (!(local->hw.flags & IEEE802154_HW_OMIT_CKSUM)) {
u16 crc;
if (skb->len < 2) {
@@ -70,8 +70,8 @@ mac802154_subif_rx(struct ieee802154_hw *hw, struct sk_buff *skb, u8 lqi)
skb_trim(skb, skb->len - 2); /* CRC */
}
- mac802154_monitors_rx(priv, skb);
- mac802154_wpans_rx(priv, skb);
+ mac802154_monitors_rx(local, skb);
+ mac802154_wpans_rx(local, skb);
return;
@@ -90,7 +90,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 mac802154_priv *priv = mac802154_to_priv(hw);
+ struct ieee802154_local *local = mac802154_to_priv(hw);
struct rx_work *work;
if (!skb)
@@ -105,6 +105,6 @@ ieee802154_rx_irqsafe(struct ieee802154_hw *hw, struct sk_buff *skb, u8 lqi)
work->hw = hw;
work->lqi = lqi;
- queue_work(priv->dev_workqueue, &work->work);
+ queue_work(local->dev_workqueue, &work->work);
}
EXPORT_SYMBOL(ieee802154_rx_irqsafe);
diff --git a/net/mac802154/tx.c b/net/mac802154/tx.c
index 8f537bf..d4c92bd 100644
--- a/net/mac802154/tx.c
+++ b/net/mac802154/tx.c
@@ -33,7 +33,7 @@
struct xmit_work {
struct sk_buff *skb;
struct work_struct work;
- struct mac802154_priv *priv;
+ struct ieee802154_local *local;
u8 chan;
u8 page;
};
@@ -44,10 +44,10 @@ static void mac802154_xmit_worker(struct work_struct *work)
struct mac802154_sub_if_data *sdata;
int res;
- mutex_lock(&xw->priv->phy->pib_lock);
- if (xw->priv->phy->current_channel != xw->chan ||
- xw->priv->phy->current_page != xw->page) {
- res = xw->priv->ops->set_channel(&xw->priv->hw,
+ mutex_lock(&xw->local->phy->pib_lock);
+ if (xw->local->phy->current_channel != xw->chan ||
+ xw->local->phy->current_page != xw->page) {
+ res = xw->local->ops->set_channel(&xw->local->hw,
xw->page,
xw->chan);
if (res) {
@@ -55,20 +55,20 @@ static void mac802154_xmit_worker(struct work_struct *work)
goto out;
}
- xw->priv->phy->current_channel = xw->chan;
- xw->priv->phy->current_page = xw->page;
+ xw->local->phy->current_channel = xw->chan;
+ xw->local->phy->current_page = xw->page;
}
- res = xw->priv->ops->xmit(&xw->priv->hw, xw->skb);
+ res = xw->local->ops->xmit(&xw->local->hw, xw->skb);
if (res)
pr_debug("transmission failed\n");
out:
- mutex_unlock(&xw->priv->phy->pib_lock);
+ mutex_unlock(&xw->local->phy->pib_lock);
/* Restart the netif queue on each sub_if_data object. */
rcu_read_lock();
- list_for_each_entry_rcu(sdata, &xw->priv->slaves, list)
+ list_for_each_entry_rcu(sdata, &xw->local->slaves, list)
netif_wake_queue(sdata->dev);
rcu_read_unlock();
@@ -77,20 +77,20 @@ out:
kfree(xw);
}
-netdev_tx_t mac802154_tx(struct mac802154_priv *priv, struct sk_buff *skb,
+netdev_tx_t mac802154_tx(struct ieee802154_local *local, struct sk_buff *skb,
u8 page, u8 chan)
{
struct xmit_work *work;
struct mac802154_sub_if_data *sdata;
- if (!(priv->phy->channels_supported[page] & (1 << chan))) {
+ if (!(local->phy->channels_supported[page] & (1 << chan))) {
WARN_ON(1);
goto err_tx;
}
- mac802154_monitors_rx(mac802154_to_priv(&priv->hw), skb);
+ mac802154_monitors_rx(mac802154_to_priv(&local->hw), skb);
- if (!(priv->hw.flags & IEEE802154_HW_OMIT_CKSUM)) {
+ if (!(local->hw.flags & IEEE802154_HW_OMIT_CKSUM)) {
u16 crc = crc_ccitt(0, skb->data, skb->len);
u8 *data = skb_put(skb, 2);
@@ -98,7 +98,7 @@ netdev_tx_t mac802154_tx(struct mac802154_priv *priv, struct sk_buff *skb,
data[1] = crc >> 8;
}
- if (skb_cow_head(skb, priv->hw.extra_tx_headroom))
+ if (skb_cow_head(skb, local->hw.extra_tx_headroom))
goto err_tx;
work = kzalloc(sizeof(*work), GFP_ATOMIC);
@@ -109,17 +109,17 @@ netdev_tx_t mac802154_tx(struct mac802154_priv *priv, struct sk_buff *skb,
/* Stop the netif queue on each sub_if_data object. */
rcu_read_lock();
- list_for_each_entry_rcu(sdata, &priv->slaves, list)
+ list_for_each_entry_rcu(sdata, &local->slaves, list)
netif_stop_queue(sdata->dev);
rcu_read_unlock();
INIT_WORK(&work->work, mac802154_xmit_worker);
work->skb = skb;
- work->priv = priv;
+ work->local = local;
work->page = page;
work->chan = chan;
- queue_work(priv->dev_workqueue, &work->work);
+ queue_work(local->dev_workqueue, &work->work);
return NETDEV_TX_OK;
--
2.1.2
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH bluetooth-next 04/10] mac802154: rename mac802154_sub_if_data
2014-10-25 15:16 [PATCH bluetooth-next 00/10] ieee802154: removals and renames Alexander Aring
` (2 preceding siblings ...)
2014-10-25 15:16 ` [PATCH bluetooth-next 03/10] mac802154: rename mac802154_priv to ieee802154_local Alexander Aring
@ 2014-10-25 15:16 ` Alexander Aring
2014-10-25 15:16 ` [PATCH bluetooth-next 05/10] mac802154: rename hw subif_data variable to local Alexander Aring
` (6 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: Alexander Aring @ 2014-10-25 15:16 UTC (permalink / raw)
To: linux-wpan; +Cc: kernel, Alexander Aring
Like wireless this structure should named ieee802154_sub_if_data and not
mac802154_sub_if_data. This patch renames the struct and variables to
sdata instead priv sometimes.
Signed-off-by: Alexander Aring <alex.aring@gmail.com>
---
net/mac802154/ieee802154_i.h | 2 +-
net/mac802154/iface.c | 137 +++++++++++++++---------------
net/mac802154/mac_cmd.c | 4 +-
net/mac802154/main.c | 54 ++++++------
net/mac802154/mib.c | 192 +++++++++++++++++++++----------------------
net/mac802154/monitor.c | 22 ++---
net/mac802154/tx.c | 4 +-
7 files changed, 208 insertions(+), 207 deletions(-)
diff --git a/net/mac802154/ieee802154_i.h b/net/mac802154/ieee802154_i.h
index eb55cd2..daaca37 100644
--- a/net/mac802154/ieee802154_i.h
+++ b/net/mac802154/ieee802154_i.h
@@ -66,7 +66,7 @@ struct ieee802154_local {
* Each ieee802154 device/transceiver may have several slaves and able
* to be associated with several networks at the same time.
*/
-struct mac802154_sub_if_data {
+struct ieee802154_sub_if_data {
struct list_head list; /* the ieee802154_priv->slaves list */
struct ieee802154_local *hw;
diff --git a/net/mac802154/iface.c b/net/mac802154/iface.c
index 10f1ee2..d3eb8a4 100644
--- a/net/mac802154/iface.c
+++ b/net/mac802154/iface.c
@@ -33,7 +33,7 @@
static int mac802154_wpan_update_llsec(struct net_device *dev)
{
- struct mac802154_sub_if_data *priv = netdev_priv(dev);
+ struct ieee802154_sub_if_data *sdata = netdev_priv(dev);
struct ieee802154_mlme_ops *ops = ieee802154_mlme_ops(dev);
int rc = 0;
@@ -41,10 +41,10 @@ static int mac802154_wpan_update_llsec(struct net_device *dev)
struct ieee802154_llsec_params params;
int changed = 0;
- params.pan_id = priv->pan_id;
+ params.pan_id = sdata->pan_id;
changed |= IEEE802154_LLSEC_PARAM_PAN_ID;
- params.hwaddr = priv->extended_addr;
+ params.hwaddr = sdata->extended_addr;
changed |= IEEE802154_LLSEC_PARAM_HWADDR;
rc = ops->llsec->set_params(dev, ¶ms, changed);
@@ -56,20 +56,20 @@ static int mac802154_wpan_update_llsec(struct net_device *dev)
static int
mac802154_wpan_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
{
- struct mac802154_sub_if_data *priv = netdev_priv(dev);
+ struct ieee802154_sub_if_data *sdata = netdev_priv(dev);
struct sockaddr_ieee802154 *sa =
(struct sockaddr_ieee802154 *)&ifr->ifr_addr;
int err = -ENOIOCTLCMD;
- spin_lock_bh(&priv->mib_lock);
+ spin_lock_bh(&sdata->mib_lock);
switch (cmd) {
case SIOCGIFADDR:
{
u16 pan_id, short_addr;
- pan_id = le16_to_cpu(priv->pan_id);
- short_addr = le16_to_cpu(priv->short_addr);
+ pan_id = le16_to_cpu(sdata->pan_id);
+ short_addr = le16_to_cpu(sdata->short_addr);
if (pan_id == IEEE802154_PANID_BROADCAST ||
short_addr == IEEE802154_ADDR_BROADCAST) {
err = -EADDRNOTAVAIL;
@@ -96,14 +96,14 @@ mac802154_wpan_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
break;
}
- priv->pan_id = cpu_to_le16(sa->addr.pan_id);
- priv->short_addr = cpu_to_le16(sa->addr.short_addr);
+ sdata->pan_id = cpu_to_le16(sa->addr.pan_id);
+ sdata->short_addr = cpu_to_le16(sa->addr.short_addr);
err = mac802154_wpan_update_llsec(dev);
break;
}
- spin_unlock_bh(&priv->mib_lock);
+ spin_unlock_bh(&sdata->mib_lock);
return err;
}
@@ -123,11 +123,11 @@ static int mac802154_wpan_mac_addr(struct net_device *dev, void *p)
int mac802154_set_mac_params(struct net_device *dev,
const struct ieee802154_mac_params *params)
{
- struct mac802154_sub_if_data *priv = netdev_priv(dev);
+ struct ieee802154_sub_if_data *sdata = netdev_priv(dev);
- mutex_lock(&priv->hw->slaves_mtx);
- priv->mac_params = *params;
- mutex_unlock(&priv->hw->slaves_mtx);
+ mutex_lock(&sdata->hw->slaves_mtx);
+ sdata->mac_params = *params;
+ mutex_unlock(&sdata->hw->slaves_mtx);
return 0;
}
@@ -135,18 +135,18 @@ int mac802154_set_mac_params(struct net_device *dev,
void mac802154_get_mac_params(struct net_device *dev,
struct ieee802154_mac_params *params)
{
- struct mac802154_sub_if_data *priv = netdev_priv(dev);
+ struct ieee802154_sub_if_data *sdata = netdev_priv(dev);
- mutex_lock(&priv->hw->slaves_mtx);
- *params = priv->mac_params;
- mutex_unlock(&priv->hw->slaves_mtx);
+ mutex_lock(&sdata->hw->slaves_mtx);
+ *params = sdata->mac_params;
+ mutex_unlock(&sdata->hw->slaves_mtx);
}
static int mac802154_wpan_open(struct net_device *dev)
{
int rc;
- struct mac802154_sub_if_data *priv = netdev_priv(dev);
- struct wpan_phy *phy = priv->hw->phy;
+ struct ieee802154_sub_if_data *sdata = netdev_priv(dev);
+ struct wpan_phy *phy = sdata->hw->phy;
rc = mac802154_slave_open(dev);
if (rc < 0)
@@ -155,40 +155,40 @@ static int mac802154_wpan_open(struct net_device *dev)
mutex_lock(&phy->pib_lock);
if (phy->set_txpower) {
- rc = phy->set_txpower(phy, priv->mac_params.transmit_power);
+ rc = phy->set_txpower(phy, sdata->mac_params.transmit_power);
if (rc < 0)
goto out;
}
if (phy->set_lbt) {
- rc = phy->set_lbt(phy, priv->mac_params.lbt);
+ rc = phy->set_lbt(phy, sdata->mac_params.lbt);
if (rc < 0)
goto out;
}
if (phy->set_cca_mode) {
- rc = phy->set_cca_mode(phy, priv->mac_params.cca_mode);
+ rc = phy->set_cca_mode(phy, sdata->mac_params.cca_mode);
if (rc < 0)
goto out;
}
if (phy->set_cca_ed_level) {
- rc = phy->set_cca_ed_level(phy, priv->mac_params.cca_ed_level);
+ rc = phy->set_cca_ed_level(phy, sdata->mac_params.cca_ed_level);
if (rc < 0)
goto out;
}
if (phy->set_csma_params) {
- rc = phy->set_csma_params(phy, priv->mac_params.min_be,
- priv->mac_params.max_be,
- priv->mac_params.csma_retries);
+ rc = phy->set_csma_params(phy, 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,
- priv->mac_params.frame_retries);
+ sdata->mac_params.frame_retries);
if (rc < 0)
goto out;
}
@@ -201,14 +201,14 @@ out:
return rc;
}
-static int mac802154_set_header_security(struct mac802154_sub_if_data *priv,
+static int mac802154_set_header_security(struct ieee802154_sub_if_data *sdata,
struct ieee802154_hdr *hdr,
const struct ieee802154_mac_cb *cb)
{
struct ieee802154_llsec_params params;
u8 level;
- mac802154_llsec_get_params(&priv->sec, ¶ms);
+ mac802154_llsec_get_params(&sdata->sec, ¶ms);
if (!params.enabled && cb->secen_override && cb->secen)
return -EINVAL;
@@ -241,7 +241,7 @@ static int mac802154_header_create(struct sk_buff *skb,
unsigned len)
{
struct ieee802154_hdr hdr;
- struct mac802154_sub_if_data *priv = netdev_priv(dev);
+ struct ieee802154_sub_if_data *sdata = netdev_priv(dev);
struct ieee802154_mac_cb *cb = mac_cb(skb);
int hlen;
@@ -254,25 +254,25 @@ static int mac802154_header_create(struct sk_buff *skb,
hdr.fc.ack_request = cb->ackreq;
hdr.seq = ieee802154_mlme_ops(dev)->get_dsn(dev);
- if (mac802154_set_header_security(priv, &hdr, cb) < 0)
+ if (mac802154_set_header_security(sdata, &hdr, cb) < 0)
return -EINVAL;
if (!saddr) {
- spin_lock_bh(&priv->mib_lock);
+ spin_lock_bh(&sdata->mib_lock);
- if (priv->short_addr == cpu_to_le16(IEEE802154_ADDR_BROADCAST) ||
- priv->short_addr == cpu_to_le16(IEEE802154_ADDR_UNDEF) ||
- priv->pan_id == cpu_to_le16(IEEE802154_PANID_BROADCAST)) {
+ if (sdata->short_addr == cpu_to_le16(IEEE802154_ADDR_BROADCAST) ||
+ sdata->short_addr == cpu_to_le16(IEEE802154_ADDR_UNDEF) ||
+ sdata->pan_id == cpu_to_le16(IEEE802154_PANID_BROADCAST)) {
hdr.source.mode = IEEE802154_ADDR_LONG;
- hdr.source.extended_addr = priv->extended_addr;
+ hdr.source.extended_addr = sdata->extended_addr;
} else {
hdr.source.mode = IEEE802154_ADDR_SHORT;
- hdr.source.short_addr = priv->short_addr;
+ hdr.source.short_addr = sdata->short_addr;
}
- hdr.source.pan_id = priv->pan_id;
+ hdr.source.pan_id = sdata->pan_id;
- spin_unlock_bh(&priv->mib_lock);
+ spin_unlock_bh(&sdata->mib_lock);
} else {
hdr.source = *(const struct ieee802154_addr *)saddr;
}
@@ -310,16 +310,16 @@ mac802154_header_parse(const struct sk_buff *skb, unsigned char *haddr)
static netdev_tx_t
mac802154_wpan_xmit(struct sk_buff *skb, struct net_device *dev)
{
- struct mac802154_sub_if_data *priv;
+ struct ieee802154_sub_if_data *sdata;
u8 chan, page;
int rc;
- priv = netdev_priv(dev);
+ sdata = netdev_priv(dev);
- spin_lock_bh(&priv->mib_lock);
- chan = priv->chan;
- page = priv->page;
- spin_unlock_bh(&priv->mib_lock);
+ spin_lock_bh(&sdata->mib_lock);
+ chan = sdata->chan;
+ page = sdata->page;
+ spin_unlock_bh(&sdata->mib_lock);
if (chan == MAC802154_CHAN_NONE ||
page >= WPAN_NUM_PAGES ||
@@ -328,7 +328,7 @@ mac802154_wpan_xmit(struct sk_buff *skb, struct net_device *dev)
return NETDEV_TX_OK;
}
- rc = mac802154_llsec_encrypt(&priv->sec, skb);
+ rc = mac802154_llsec_encrypt(&sdata->sec, skb);
if (rc) {
pr_warn("encryption failed: %i\n", rc);
kfree_skb(skb);
@@ -339,7 +339,7 @@ mac802154_wpan_xmit(struct sk_buff *skb, struct net_device *dev)
dev->stats.tx_packets++;
dev->stats.tx_bytes += skb->len;
- return mac802154_tx(priv->hw, skb, page, chan);
+ return mac802154_tx(sdata->hw, skb, page, chan);
}
static struct header_ops mac802154_header_ops = {
@@ -357,16 +357,16 @@ static const struct net_device_ops mac802154_wpan_ops = {
static void mac802154_wpan_free(struct net_device *dev)
{
- struct mac802154_sub_if_data *priv = netdev_priv(dev);
+ struct ieee802154_sub_if_data *sdata = netdev_priv(dev);
- mac802154_llsec_destroy(&priv->sec);
+ mac802154_llsec_destroy(&sdata->sec);
free_netdev(dev);
}
void mac802154_wpan_setup(struct net_device *dev)
{
- struct mac802154_sub_if_data *priv;
+ struct ieee802154_sub_if_data *sdata;
dev->addr_len = IEEE802154_ADDR_LEN;
memset(dev->broadcast, 0xff, IEEE802154_ADDR_LEN);
@@ -384,28 +384,29 @@ void mac802154_wpan_setup(struct net_device *dev)
dev->netdev_ops = &mac802154_wpan_ops;
dev->ml_priv = &mac802154_mlme_wpan;
- priv = netdev_priv(dev);
- priv->type = IEEE802154_DEV_WPAN;
+ sdata = netdev_priv(dev);
+ sdata->type = IEEE802154_DEV_WPAN;
- priv->chan = MAC802154_CHAN_NONE;
- priv->page = 0;
+ sdata->chan = MAC802154_CHAN_NONE;
+ sdata->page = 0;
- spin_lock_init(&priv->mib_lock);
- mutex_init(&priv->sec_mtx);
+ spin_lock_init(&sdata->mib_lock);
+ mutex_init(&sdata->sec_mtx);
- get_random_bytes(&priv->bsn, 1);
- get_random_bytes(&priv->dsn, 1);
+ get_random_bytes(&sdata->bsn, 1);
+ get_random_bytes(&sdata->dsn, 1);
/* defaults per 802.15.4-2011 */
- priv->mac_params.min_be = 3;
- priv->mac_params.max_be = 5;
- priv->mac_params.csma_retries = 4;
- priv->mac_params.frame_retries = -1; /* for compatibility, actual default is 3 */
+ sdata->mac_params.min_be = 3;
+ sdata->mac_params.max_be = 5;
+ sdata->mac_params.csma_retries = 4;
+ /* for compatibility, actual default is 3 */
+ sdata->mac_params.frame_retries = -1;
- priv->pan_id = cpu_to_le16(IEEE802154_PANID_BROADCAST);
- priv->short_addr = cpu_to_le16(IEEE802154_ADDR_BROADCAST);
+ sdata->pan_id = cpu_to_le16(IEEE802154_PANID_BROADCAST);
+ sdata->short_addr = cpu_to_le16(IEEE802154_ADDR_BROADCAST);
- mac802154_llsec_init(&priv->sec);
+ mac802154_llsec_init(&sdata->sec);
}
static int mac802154_process_data(struct net_device *dev, struct sk_buff *skb)
@@ -414,7 +415,7 @@ static int mac802154_process_data(struct net_device *dev, struct sk_buff *skb)
}
static int
-mac802154_subif_frame(struct mac802154_sub_if_data *sdata, struct sk_buff *skb,
+mac802154_subif_frame(struct ieee802154_sub_if_data *sdata, struct sk_buff *skb,
const struct ieee802154_hdr *hdr)
{
__le16 span, sshort;
@@ -568,7 +569,7 @@ static int mac802154_parse_frame_start(struct sk_buff *skb,
void mac802154_wpans_rx(struct ieee802154_local *local, struct sk_buff *skb)
{
int ret;
- struct mac802154_sub_if_data *sdata;
+ struct ieee802154_sub_if_data *sdata;
struct ieee802154_hdr hdr;
ret = mac802154_parse_frame_start(skb, &hdr);
diff --git a/net/mac802154/mac_cmd.c b/net/mac802154/mac_cmd.c
index ad09d54..bccaefb 100644
--- a/net/mac802154/mac_cmd.c
+++ b/net/mac802154/mac_cmd.c
@@ -75,11 +75,11 @@ static int mac802154_mlme_start_req(struct net_device *dev,
static struct wpan_phy *mac802154_get_phy(const struct net_device *dev)
{
- struct mac802154_sub_if_data *priv = netdev_priv(dev);
+ struct ieee802154_sub_if_data *sdata = netdev_priv(dev);
BUG_ON(dev->type != ARPHRD_IEEE802154);
- return to_phy(get_device(&priv->hw->phy->dev));
+ return to_phy(get_device(&sdata->hw->phy->dev));
}
static struct ieee802154_llsec_ops mac802154_llsec_ops = {
diff --git a/net/mac802154/main.c b/net/mac802154/main.c
index 387d4cf..6f630d4 100644
--- a/net/mac802154/main.c
+++ b/net/mac802154/main.c
@@ -31,28 +31,28 @@
int mac802154_slave_open(struct net_device *dev)
{
- struct mac802154_sub_if_data *priv = netdev_priv(dev);
- struct mac802154_sub_if_data *subif;
- struct ieee802154_local *local = priv->hw;
+ struct ieee802154_sub_if_data *sdata = netdev_priv(dev);
+ struct ieee802154_sub_if_data *subif;
+ struct ieee802154_local *local = sdata->hw;
int res = 0;
ASSERT_RTNL();
- if (priv->type == IEEE802154_DEV_WPAN) {
- mutex_lock(&priv->hw->slaves_mtx);
- list_for_each_entry(subif, &priv->hw->slaves, list) {
- if (subif != priv && subif->type == priv->type &&
+ if (sdata->type == IEEE802154_DEV_WPAN) {
+ mutex_lock(&sdata->hw->slaves_mtx);
+ list_for_each_entry(subif, &sdata->hw->slaves, list) {
+ if (subif != sdata && subif->type == sdata->type &&
subif->running) {
- mutex_unlock(&priv->hw->slaves_mtx);
+ mutex_unlock(&sdata->hw->slaves_mtx);
return -EBUSY;
}
}
- mutex_unlock(&priv->hw->slaves_mtx);
+ mutex_unlock(&sdata->hw->slaves_mtx);
}
- mutex_lock(&priv->hw->slaves_mtx);
- priv->running = true;
- mutex_unlock(&priv->hw->slaves_mtx);
+ mutex_lock(&sdata->hw->slaves_mtx);
+ sdata->running = true;
+ mutex_unlock(&sdata->hw->slaves_mtx);
if (local->open_count++ == 0) {
res = local->ops->start(&local->hw);
@@ -74,23 +74,23 @@ int mac802154_slave_open(struct net_device *dev)
netif_start_queue(dev);
return 0;
err:
- priv->hw->open_count--;
+ sdata->hw->open_count--;
return res;
}
int mac802154_slave_close(struct net_device *dev)
{
- struct mac802154_sub_if_data *priv = netdev_priv(dev);
- struct ieee802154_local *local = priv->hw;
+ struct ieee802154_sub_if_data *sdata = netdev_priv(dev);
+ struct ieee802154_local *local = sdata->hw;
ASSERT_RTNL();
netif_stop_queue(dev);
- mutex_lock(&priv->hw->slaves_mtx);
- priv->running = false;
- mutex_unlock(&priv->hw->slaves_mtx);
+ mutex_lock(&sdata->hw->slaves_mtx);
+ sdata->running = false;
+ mutex_unlock(&sdata->hw->slaves_mtx);
if (!--local->open_count)
local->ops->stop(&local->hw);
@@ -101,15 +101,15 @@ int mac802154_slave_close(struct net_device *dev)
static int
mac802154_netdev_register(struct wpan_phy *phy, struct net_device *dev)
{
- struct mac802154_sub_if_data *priv;
+ struct ieee802154_sub_if_data *sdata;
struct ieee802154_local *local;
int err;
local = wpan_phy_priv(phy);
- priv = netdev_priv(dev);
- priv->dev = dev;
- priv->hw = local;
+ sdata = netdev_priv(dev);
+ sdata->dev = dev;
+ sdata->hw = local;
dev->needed_headroom = local->hw.extra_tx_headroom;
@@ -128,7 +128,7 @@ mac802154_netdev_register(struct wpan_phy *phy, struct net_device *dev)
rtnl_lock();
mutex_lock(&local->slaves_mtx);
- list_add_tail_rcu(&priv->list, &local->slaves);
+ list_add_tail_rcu(&sdata->list, &local->slaves);
mutex_unlock(&local->slaves_mtx);
rtnl_unlock();
@@ -138,7 +138,7 @@ mac802154_netdev_register(struct wpan_phy *phy, struct net_device *dev)
static void
mac802154_del_iface(struct wpan_phy *phy, struct net_device *dev)
{
- struct mac802154_sub_if_data *sdata;
+ struct ieee802154_sub_if_data *sdata;
ASSERT_RTNL();
@@ -162,12 +162,12 @@ mac802154_add_iface(struct wpan_phy *phy, const char *name, int type)
switch (type) {
case IEEE802154_DEV_MONITOR:
- dev = alloc_netdev(sizeof(struct mac802154_sub_if_data),
+ dev = alloc_netdev(sizeof(struct ieee802154_sub_if_data),
name, NET_NAME_UNKNOWN,
mac802154_monitor_setup);
break;
case IEEE802154_DEV_WPAN:
- dev = alloc_netdev(sizeof(struct mac802154_sub_if_data),
+ dev = alloc_netdev(sizeof(struct ieee802154_sub_if_data),
name, NET_NAME_UNKNOWN,
mac802154_wpan_setup);
break;
@@ -382,7 +382,7 @@ EXPORT_SYMBOL(ieee802154_register_hw);
void ieee802154_unregister_hw(struct ieee802154_hw *hw)
{
struct ieee802154_local *local = mac802154_to_priv(hw);
- struct mac802154_sub_if_data *sdata, *next;
+ struct ieee802154_sub_if_data *sdata, *next;
flush_workqueue(local->dev_workqueue);
destroy_workqueue(local->dev_workqueue);
diff --git a/net/mac802154/mib.c b/net/mac802154/mib.c
index 5d9592a..ef05b3b 100644
--- a/net/mac802154/mib.c
+++ b/net/mac802154/mib.c
@@ -38,11 +38,11 @@ struct hw_addr_filt_notify_work {
static struct ieee802154_local *mac802154_slave_get_priv(struct net_device *dev)
{
- struct mac802154_sub_if_data *priv = netdev_priv(dev);
+ struct ieee802154_sub_if_data *sdata = netdev_priv(dev);
BUG_ON(dev->type != ARPHRD_IEEE802154);
- return priv->hw;
+ return sdata->hw;
}
static void hw_addr_notify(struct work_struct *work)
@@ -62,7 +62,7 @@ static void hw_addr_notify(struct work_struct *work)
static void set_hw_addr_filt(struct net_device *dev, unsigned long changed)
{
- struct mac802154_sub_if_data *priv = netdev_priv(dev);
+ struct ieee802154_sub_if_data *sdata = netdev_priv(dev);
struct hw_addr_filt_notify_work *work;
work = kzalloc(sizeof(*work), GFP_ATOMIC);
@@ -72,92 +72,92 @@ static void set_hw_addr_filt(struct net_device *dev, unsigned long changed)
INIT_WORK(&work->work, hw_addr_notify);
work->dev = dev;
work->changed = changed;
- queue_work(priv->hw->dev_workqueue, &work->work);
+ queue_work(sdata->hw->dev_workqueue, &work->work);
}
void mac802154_dev_set_short_addr(struct net_device *dev, __le16 val)
{
- struct mac802154_sub_if_data *priv = netdev_priv(dev);
+ struct ieee802154_sub_if_data *sdata = netdev_priv(dev);
BUG_ON(dev->type != ARPHRD_IEEE802154);
- spin_lock_bh(&priv->mib_lock);
- priv->short_addr = val;
- spin_unlock_bh(&priv->mib_lock);
+ spin_lock_bh(&sdata->mib_lock);
+ sdata->short_addr = val;
+ spin_unlock_bh(&sdata->mib_lock);
- if ((priv->hw->ops->set_hw_addr_filt) &&
- (priv->hw->hw.hw_filt.short_addr != priv->short_addr)) {
- priv->hw->hw.hw_filt.short_addr = priv->short_addr;
+ if ((sdata->hw->ops->set_hw_addr_filt) &&
+ (sdata->hw->hw.hw_filt.short_addr != sdata->short_addr)) {
+ sdata->hw->hw.hw_filt.short_addr = sdata->short_addr;
set_hw_addr_filt(dev, IEEE802154_AFILT_SADDR_CHANGED);
}
}
__le16 mac802154_dev_get_short_addr(const struct net_device *dev)
{
- struct mac802154_sub_if_data *priv = netdev_priv(dev);
+ struct ieee802154_sub_if_data *sdata = netdev_priv(dev);
__le16 ret;
BUG_ON(dev->type != ARPHRD_IEEE802154);
- spin_lock_bh(&priv->mib_lock);
- ret = priv->short_addr;
- spin_unlock_bh(&priv->mib_lock);
+ spin_lock_bh(&sdata->mib_lock);
+ ret = sdata->short_addr;
+ spin_unlock_bh(&sdata->mib_lock);
return ret;
}
void mac802154_dev_set_ieee_addr(struct net_device *dev)
{
- struct mac802154_sub_if_data *priv = netdev_priv(dev);
- struct ieee802154_local *local = priv->hw;
+ struct ieee802154_sub_if_data *sdata = netdev_priv(dev);
+ struct ieee802154_local *local = sdata->hw;
- priv->extended_addr = ieee802154_devaddr_from_raw(dev->dev_addr);
+ sdata->extended_addr = ieee802154_devaddr_from_raw(dev->dev_addr);
if (local->ops->set_hw_addr_filt &&
- local->hw.hw_filt.ieee_addr != priv->extended_addr) {
- local->hw.hw_filt.ieee_addr = priv->extended_addr;
+ local->hw.hw_filt.ieee_addr != sdata->extended_addr) {
+ local->hw.hw_filt.ieee_addr = sdata->extended_addr;
set_hw_addr_filt(dev, IEEE802154_AFILT_IEEEADDR_CHANGED);
}
}
__le16 mac802154_dev_get_pan_id(const struct net_device *dev)
{
- struct mac802154_sub_if_data *priv = netdev_priv(dev);
+ struct ieee802154_sub_if_data *sdata = netdev_priv(dev);
__le16 ret;
BUG_ON(dev->type != ARPHRD_IEEE802154);
- spin_lock_bh(&priv->mib_lock);
- ret = priv->pan_id;
- spin_unlock_bh(&priv->mib_lock);
+ spin_lock_bh(&sdata->mib_lock);
+ ret = sdata->pan_id;
+ spin_unlock_bh(&sdata->mib_lock);
return ret;
}
void mac802154_dev_set_pan_id(struct net_device *dev, __le16 val)
{
- struct mac802154_sub_if_data *priv = netdev_priv(dev);
+ struct ieee802154_sub_if_data *sdata = netdev_priv(dev);
BUG_ON(dev->type != ARPHRD_IEEE802154);
- spin_lock_bh(&priv->mib_lock);
- priv->pan_id = val;
- spin_unlock_bh(&priv->mib_lock);
+ spin_lock_bh(&sdata->mib_lock);
+ sdata->pan_id = val;
+ spin_unlock_bh(&sdata->mib_lock);
- if ((priv->hw->ops->set_hw_addr_filt) &&
- (priv->hw->hw.hw_filt.pan_id != priv->pan_id)) {
- priv->hw->hw.hw_filt.pan_id = priv->pan_id;
+ if ((sdata->hw->ops->set_hw_addr_filt) &&
+ (sdata->hw->hw.hw_filt.pan_id != sdata->pan_id)) {
+ sdata->hw->hw.hw_filt.pan_id = sdata->pan_id;
set_hw_addr_filt(dev, IEEE802154_AFILT_PANID_CHANGED);
}
}
u8 mac802154_dev_get_dsn(const struct net_device *dev)
{
- struct mac802154_sub_if_data *priv = netdev_priv(dev);
+ struct ieee802154_sub_if_data *sdata = netdev_priv(dev);
BUG_ON(dev->type != ARPHRD_IEEE802154);
- return priv->dsn++;
+ return sdata->dsn++;
}
static void phy_chan_notify(struct work_struct *work)
@@ -165,38 +165,38 @@ static void phy_chan_notify(struct work_struct *work)
struct phy_chan_notify_work *nw = container_of(work,
struct phy_chan_notify_work, work);
struct ieee802154_local *local = mac802154_slave_get_priv(nw->dev);
- struct mac802154_sub_if_data *priv = netdev_priv(nw->dev);
+ struct ieee802154_sub_if_data *sdata = netdev_priv(nw->dev);
int res;
- mutex_lock(&priv->hw->phy->pib_lock);
- res = local->ops->set_channel(&local->hw, priv->page, priv->chan);
+ mutex_lock(&sdata->hw->phy->pib_lock);
+ res = local->ops->set_channel(&local->hw, sdata->page, sdata->chan);
if (res) {
pr_debug("set_channel failed\n");
} else {
- priv->hw->phy->current_channel = priv->chan;
- priv->hw->phy->current_page = priv->page;
+ sdata->hw->phy->current_channel = sdata->chan;
+ sdata->hw->phy->current_page = sdata->page;
}
- mutex_unlock(&priv->hw->phy->pib_lock);
+ mutex_unlock(&sdata->hw->phy->pib_lock);
kfree(nw);
}
void mac802154_dev_set_page_channel(struct net_device *dev, u8 page, u8 chan)
{
- struct mac802154_sub_if_data *priv = netdev_priv(dev);
+ struct ieee802154_sub_if_data *sdata = netdev_priv(dev);
struct phy_chan_notify_work *work;
BUG_ON(dev->type != ARPHRD_IEEE802154);
- spin_lock_bh(&priv->mib_lock);
- priv->page = page;
- priv->chan = chan;
- spin_unlock_bh(&priv->mib_lock);
+ spin_lock_bh(&sdata->mib_lock);
+ sdata->page = page;
+ sdata->chan = chan;
+ spin_unlock_bh(&sdata->mib_lock);
- mutex_lock(&priv->hw->phy->pib_lock);
- if (priv->hw->phy->current_channel != priv->chan ||
- priv->hw->phy->current_page != priv->page) {
- mutex_unlock(&priv->hw->phy->pib_lock);
+ mutex_lock(&sdata->hw->phy->pib_lock);
+ if (sdata->hw->phy->current_channel != sdata->chan ||
+ sdata->hw->phy->current_page != sdata->page) {
+ mutex_unlock(&sdata->hw->phy->pib_lock);
work = kzalloc(sizeof(*work), GFP_ATOMIC);
if (!work)
@@ -204,9 +204,9 @@ void mac802154_dev_set_page_channel(struct net_device *dev, u8 page, u8 chan)
INIT_WORK(&work->work, phy_chan_notify);
work->dev = dev;
- queue_work(priv->hw->dev_workqueue, &work->work);
+ queue_work(sdata->hw->dev_workqueue, &work->work);
} else {
- mutex_unlock(&priv->hw->phy->pib_lock);
+ mutex_unlock(&sdata->hw->phy->pib_lock);
}
}
@@ -214,14 +214,14 @@ void mac802154_dev_set_page_channel(struct net_device *dev, u8 page, u8 chan)
int mac802154_get_params(struct net_device *dev,
struct ieee802154_llsec_params *params)
{
- struct mac802154_sub_if_data *priv = netdev_priv(dev);
+ struct ieee802154_sub_if_data *sdata = netdev_priv(dev);
int res;
BUG_ON(dev->type != ARPHRD_IEEE802154);
- mutex_lock(&priv->sec_mtx);
- res = mac802154_llsec_get_params(&priv->sec, params);
- mutex_unlock(&priv->sec_mtx);
+ mutex_lock(&sdata->sec_mtx);
+ res = mac802154_llsec_get_params(&sdata->sec, params);
+ mutex_unlock(&sdata->sec_mtx);
return res;
}
@@ -230,14 +230,14 @@ int mac802154_set_params(struct net_device *dev,
const struct ieee802154_llsec_params *params,
int changed)
{
- struct mac802154_sub_if_data *priv = netdev_priv(dev);
+ struct ieee802154_sub_if_data *sdata = netdev_priv(dev);
int res;
BUG_ON(dev->type != ARPHRD_IEEE802154);
- mutex_lock(&priv->sec_mtx);
- res = mac802154_llsec_set_params(&priv->sec, params, changed);
- mutex_unlock(&priv->sec_mtx);
+ mutex_lock(&sdata->sec_mtx);
+ res = mac802154_llsec_set_params(&sdata->sec, params, changed);
+ mutex_unlock(&sdata->sec_mtx);
return res;
}
@@ -247,14 +247,14 @@ int mac802154_add_key(struct net_device *dev,
const struct ieee802154_llsec_key_id *id,
const struct ieee802154_llsec_key *key)
{
- struct mac802154_sub_if_data *priv = netdev_priv(dev);
+ struct ieee802154_sub_if_data *sdata = netdev_priv(dev);
int res;
BUG_ON(dev->type != ARPHRD_IEEE802154);
- mutex_lock(&priv->sec_mtx);
- res = mac802154_llsec_key_add(&priv->sec, id, key);
- mutex_unlock(&priv->sec_mtx);
+ mutex_lock(&sdata->sec_mtx);
+ res = mac802154_llsec_key_add(&sdata->sec, id, key);
+ mutex_unlock(&sdata->sec_mtx);
return res;
}
@@ -262,14 +262,14 @@ int mac802154_add_key(struct net_device *dev,
int mac802154_del_key(struct net_device *dev,
const struct ieee802154_llsec_key_id *id)
{
- struct mac802154_sub_if_data *priv = netdev_priv(dev);
+ struct ieee802154_sub_if_data *sdata = netdev_priv(dev);
int res;
BUG_ON(dev->type != ARPHRD_IEEE802154);
- mutex_lock(&priv->sec_mtx);
- res = mac802154_llsec_key_del(&priv->sec, id);
- mutex_unlock(&priv->sec_mtx);
+ mutex_lock(&sdata->sec_mtx);
+ res = mac802154_llsec_key_del(&sdata->sec, id);
+ mutex_unlock(&sdata->sec_mtx);
return res;
}
@@ -278,28 +278,28 @@ int mac802154_del_key(struct net_device *dev,
int mac802154_add_dev(struct net_device *dev,
const struct ieee802154_llsec_device *llsec_dev)
{
- struct mac802154_sub_if_data *priv = netdev_priv(dev);
+ struct ieee802154_sub_if_data *sdata = netdev_priv(dev);
int res;
BUG_ON(dev->type != ARPHRD_IEEE802154);
- mutex_lock(&priv->sec_mtx);
- res = mac802154_llsec_dev_add(&priv->sec, llsec_dev);
- mutex_unlock(&priv->sec_mtx);
+ mutex_lock(&sdata->sec_mtx);
+ res = mac802154_llsec_dev_add(&sdata->sec, llsec_dev);
+ mutex_unlock(&sdata->sec_mtx);
return res;
}
int mac802154_del_dev(struct net_device *dev, __le64 dev_addr)
{
- struct mac802154_sub_if_data *priv = netdev_priv(dev);
+ struct ieee802154_sub_if_data *sdata = netdev_priv(dev);
int res;
BUG_ON(dev->type != ARPHRD_IEEE802154);
- mutex_lock(&priv->sec_mtx);
- res = mac802154_llsec_dev_del(&priv->sec, dev_addr);
- mutex_unlock(&priv->sec_mtx);
+ mutex_lock(&sdata->sec_mtx);
+ res = mac802154_llsec_dev_del(&sdata->sec, dev_addr);
+ mutex_unlock(&sdata->sec_mtx);
return res;
}
@@ -309,14 +309,14 @@ int mac802154_add_devkey(struct net_device *dev,
__le64 device_addr,
const struct ieee802154_llsec_device_key *key)
{
- struct mac802154_sub_if_data *priv = netdev_priv(dev);
+ struct ieee802154_sub_if_data *sdata = netdev_priv(dev);
int res;
BUG_ON(dev->type != ARPHRD_IEEE802154);
- mutex_lock(&priv->sec_mtx);
- res = mac802154_llsec_devkey_add(&priv->sec, device_addr, key);
- mutex_unlock(&priv->sec_mtx);
+ mutex_lock(&sdata->sec_mtx);
+ res = mac802154_llsec_devkey_add(&sdata->sec, device_addr, key);
+ mutex_unlock(&sdata->sec_mtx);
return res;
}
@@ -325,14 +325,14 @@ int mac802154_del_devkey(struct net_device *dev,
__le64 device_addr,
const struct ieee802154_llsec_device_key *key)
{
- struct mac802154_sub_if_data *priv = netdev_priv(dev);
+ struct ieee802154_sub_if_data *sdata = netdev_priv(dev);
int res;
BUG_ON(dev->type != ARPHRD_IEEE802154);
- mutex_lock(&priv->sec_mtx);
- res = mac802154_llsec_devkey_del(&priv->sec, device_addr, key);
- mutex_unlock(&priv->sec_mtx);
+ mutex_lock(&sdata->sec_mtx);
+ res = mac802154_llsec_devkey_del(&sdata->sec, device_addr, key);
+ mutex_unlock(&sdata->sec_mtx);
return res;
}
@@ -341,14 +341,14 @@ int mac802154_del_devkey(struct net_device *dev,
int mac802154_add_seclevel(struct net_device *dev,
const struct ieee802154_llsec_seclevel *sl)
{
- struct mac802154_sub_if_data *priv = netdev_priv(dev);
+ struct ieee802154_sub_if_data *sdata = netdev_priv(dev);
int res;
BUG_ON(dev->type != ARPHRD_IEEE802154);
- mutex_lock(&priv->sec_mtx);
- res = mac802154_llsec_seclevel_add(&priv->sec, sl);
- mutex_unlock(&priv->sec_mtx);
+ mutex_lock(&sdata->sec_mtx);
+ res = mac802154_llsec_seclevel_add(&sdata->sec, sl);
+ mutex_unlock(&sdata->sec_mtx);
return res;
}
@@ -356,14 +356,14 @@ int mac802154_add_seclevel(struct net_device *dev,
int mac802154_del_seclevel(struct net_device *dev,
const struct ieee802154_llsec_seclevel *sl)
{
- struct mac802154_sub_if_data *priv = netdev_priv(dev);
+ struct ieee802154_sub_if_data *sdata = netdev_priv(dev);
int res;
BUG_ON(dev->type != ARPHRD_IEEE802154);
- mutex_lock(&priv->sec_mtx);
- res = mac802154_llsec_seclevel_del(&priv->sec, sl);
- mutex_unlock(&priv->sec_mtx);
+ mutex_lock(&sdata->sec_mtx);
+ res = mac802154_llsec_seclevel_del(&sdata->sec, sl);
+ mutex_unlock(&sdata->sec_mtx);
return res;
}
@@ -371,28 +371,28 @@ int mac802154_del_seclevel(struct net_device *dev,
void mac802154_lock_table(struct net_device *dev)
{
- struct mac802154_sub_if_data *priv = netdev_priv(dev);
+ struct ieee802154_sub_if_data *sdata = netdev_priv(dev);
BUG_ON(dev->type != ARPHRD_IEEE802154);
- mutex_lock(&priv->sec_mtx);
+ mutex_lock(&sdata->sec_mtx);
}
void mac802154_get_table(struct net_device *dev,
struct ieee802154_llsec_table **t)
{
- struct mac802154_sub_if_data *priv = netdev_priv(dev);
+ struct ieee802154_sub_if_data *sdata = netdev_priv(dev);
BUG_ON(dev->type != ARPHRD_IEEE802154);
- *t = &priv->sec.table;
+ *t = &sdata->sec.table;
}
void mac802154_unlock_table(struct net_device *dev)
{
- struct mac802154_sub_if_data *priv = netdev_priv(dev);
+ struct ieee802154_sub_if_data *sdata = netdev_priv(dev);
BUG_ON(dev->type != ARPHRD_IEEE802154);
- mutex_unlock(&priv->sec_mtx);
+ mutex_unlock(&sdata->sec_mtx);
}
diff --git a/net/mac802154/monitor.c b/net/mac802154/monitor.c
index a107fd2..bd63e12 100644
--- a/net/mac802154/monitor.c
+++ b/net/mac802154/monitor.c
@@ -33,14 +33,14 @@
static netdev_tx_t mac802154_monitor_xmit(struct sk_buff *skb,
struct net_device *dev)
{
- struct mac802154_sub_if_data *priv;
+ struct ieee802154_sub_if_data *sdata;
u8 chan, page;
- priv = netdev_priv(dev);
+ sdata = netdev_priv(dev);
/* FIXME: locking */
- chan = priv->hw->phy->current_channel;
- page = priv->hw->phy->current_page;
+ chan = sdata->hw->phy->current_channel;
+ page = sdata->hw->phy->current_page;
if (chan == MAC802154_CHAN_NONE) /* not initialized */
return NETDEV_TX_OK;
@@ -53,14 +53,14 @@ static netdev_tx_t mac802154_monitor_xmit(struct sk_buff *skb,
dev->stats.tx_packets++;
dev->stats.tx_bytes += skb->len;
- return mac802154_tx(priv->hw, skb, page, chan);
+ return mac802154_tx(sdata->hw, skb, page, chan);
}
void mac802154_monitors_rx(struct ieee802154_local *local, struct sk_buff *skb)
{
struct sk_buff *skb2;
- struct mac802154_sub_if_data *sdata;
+ struct ieee802154_sub_if_data *sdata;
u16 crc = crc_ccitt(0, skb->data, skb->len);
u8 *data;
@@ -90,7 +90,7 @@ static const struct net_device_ops mac802154_monitor_ops = {
void mac802154_monitor_setup(struct net_device *dev)
{
- struct mac802154_sub_if_data *priv;
+ struct ieee802154_sub_if_data *sdata;
dev->addr_len = 0;
dev->hard_header_len = 0;
@@ -105,9 +105,9 @@ void mac802154_monitor_setup(struct net_device *dev)
dev->netdev_ops = &mac802154_monitor_ops;
dev->ml_priv = &mac802154_mlme_reduced;
- priv = netdev_priv(dev);
- priv->type = IEEE802154_DEV_MONITOR;
+ sdata = netdev_priv(dev);
+ sdata->type = IEEE802154_DEV_MONITOR;
- priv->chan = MAC802154_CHAN_NONE; /* not initialized */
- priv->page = 0;
+ sdata->chan = MAC802154_CHAN_NONE; /* not initialized */
+ sdata->page = 0;
}
diff --git a/net/mac802154/tx.c b/net/mac802154/tx.c
index d4c92bd..d20dadd 100644
--- a/net/mac802154/tx.c
+++ b/net/mac802154/tx.c
@@ -41,7 +41,7 @@ struct xmit_work {
static void mac802154_xmit_worker(struct work_struct *work)
{
struct xmit_work *xw = container_of(work, struct xmit_work, work);
- struct mac802154_sub_if_data *sdata;
+ struct ieee802154_sub_if_data *sdata;
int res;
mutex_lock(&xw->local->phy->pib_lock);
@@ -81,7 +81,7 @@ netdev_tx_t mac802154_tx(struct ieee802154_local *local, struct sk_buff *skb,
u8 page, u8 chan)
{
struct xmit_work *work;
- struct mac802154_sub_if_data *sdata;
+ struct ieee802154_sub_if_data *sdata;
if (!(local->phy->channels_supported[page] & (1 << chan))) {
WARN_ON(1);
--
2.1.2
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH bluetooth-next 05/10] mac802154: rename hw subif_data variable to local
2014-10-25 15:16 [PATCH bluetooth-next 00/10] ieee802154: removals and renames Alexander Aring
` (3 preceding siblings ...)
2014-10-25 15:16 ` [PATCH bluetooth-next 04/10] mac802154: rename mac802154_sub_if_data Alexander Aring
@ 2014-10-25 15:16 ` Alexander Aring
2014-10-25 15:16 ` [PATCH bluetooth-next 06/10] mac802154: rename sdata slaves and slaves_mtx Alexander Aring
` (5 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: Alexander Aring @ 2014-10-25 15:16 UTC (permalink / raw)
To: linux-wpan; +Cc: kernel, Alexander Aring
This patch renames the hw attribute in struct ieee802154_sub_if_data to
local. This avoid confusing with the struct ieee802154_hw hw; inside of
local struct.
Signed-off-by: Alexander Aring <alex.aring@gmail.com>
---
net/mac802154/ieee802154_i.h | 2 +-
net/mac802154/iface.c | 12 ++++++------
net/mac802154/mac_cmd.c | 2 +-
net/mac802154/main.c | 34 +++++++++++++++++-----------------
net/mac802154/mib.c | 38 +++++++++++++++++++-------------------
net/mac802154/monitor.c | 6 +++---
6 files changed, 47 insertions(+), 47 deletions(-)
diff --git a/net/mac802154/ieee802154_i.h b/net/mac802154/ieee802154_i.h
index daaca37..c5b1ab7 100644
--- a/net/mac802154/ieee802154_i.h
+++ b/net/mac802154/ieee802154_i.h
@@ -69,7 +69,7 @@ struct ieee802154_local {
struct ieee802154_sub_if_data {
struct list_head list; /* the ieee802154_priv->slaves list */
- struct ieee802154_local *hw;
+ struct ieee802154_local *local;
struct net_device *dev;
int type;
diff --git a/net/mac802154/iface.c b/net/mac802154/iface.c
index d3eb8a4..6eace90 100644
--- a/net/mac802154/iface.c
+++ b/net/mac802154/iface.c
@@ -125,9 +125,9 @@ int mac802154_set_mac_params(struct net_device *dev,
{
struct ieee802154_sub_if_data *sdata = netdev_priv(dev);
- mutex_lock(&sdata->hw->slaves_mtx);
+ mutex_lock(&sdata->local->slaves_mtx);
sdata->mac_params = *params;
- mutex_unlock(&sdata->hw->slaves_mtx);
+ mutex_unlock(&sdata->local->slaves_mtx);
return 0;
}
@@ -137,16 +137,16 @@ void mac802154_get_mac_params(struct net_device *dev,
{
struct ieee802154_sub_if_data *sdata = netdev_priv(dev);
- mutex_lock(&sdata->hw->slaves_mtx);
+ mutex_lock(&sdata->local->slaves_mtx);
*params = sdata->mac_params;
- mutex_unlock(&sdata->hw->slaves_mtx);
+ mutex_unlock(&sdata->local->slaves_mtx);
}
static int mac802154_wpan_open(struct net_device *dev)
{
int rc;
struct ieee802154_sub_if_data *sdata = netdev_priv(dev);
- struct wpan_phy *phy = sdata->hw->phy;
+ struct wpan_phy *phy = sdata->local->phy;
rc = mac802154_slave_open(dev);
if (rc < 0)
@@ -339,7 +339,7 @@ mac802154_wpan_xmit(struct sk_buff *skb, struct net_device *dev)
dev->stats.tx_packets++;
dev->stats.tx_bytes += skb->len;
- return mac802154_tx(sdata->hw, skb, page, chan);
+ return mac802154_tx(sdata->local, skb, page, chan);
}
static struct header_ops mac802154_header_ops = {
diff --git a/net/mac802154/mac_cmd.c b/net/mac802154/mac_cmd.c
index bccaefb..5ee1088 100644
--- a/net/mac802154/mac_cmd.c
+++ b/net/mac802154/mac_cmd.c
@@ -79,7 +79,7 @@ static struct wpan_phy *mac802154_get_phy(const struct net_device *dev)
BUG_ON(dev->type != ARPHRD_IEEE802154);
- return to_phy(get_device(&sdata->hw->phy->dev));
+ return to_phy(get_device(&sdata->local->phy->dev));
}
static struct ieee802154_llsec_ops mac802154_llsec_ops = {
diff --git a/net/mac802154/main.c b/net/mac802154/main.c
index 6f630d4..9b2644f 100644
--- a/net/mac802154/main.c
+++ b/net/mac802154/main.c
@@ -33,26 +33,26 @@ int mac802154_slave_open(struct net_device *dev)
{
struct ieee802154_sub_if_data *sdata = netdev_priv(dev);
struct ieee802154_sub_if_data *subif;
- struct ieee802154_local *local = sdata->hw;
+ struct ieee802154_local *local = sdata->local;
int res = 0;
ASSERT_RTNL();
if (sdata->type == IEEE802154_DEV_WPAN) {
- mutex_lock(&sdata->hw->slaves_mtx);
- list_for_each_entry(subif, &sdata->hw->slaves, list) {
+ mutex_lock(&sdata->local->slaves_mtx);
+ list_for_each_entry(subif, &sdata->local->slaves, list) {
if (subif != sdata && subif->type == sdata->type &&
subif->running) {
- mutex_unlock(&sdata->hw->slaves_mtx);
+ mutex_unlock(&sdata->local->slaves_mtx);
return -EBUSY;
}
}
- mutex_unlock(&sdata->hw->slaves_mtx);
+ mutex_unlock(&sdata->local->slaves_mtx);
}
- mutex_lock(&sdata->hw->slaves_mtx);
+ mutex_lock(&sdata->local->slaves_mtx);
sdata->running = true;
- mutex_unlock(&sdata->hw->slaves_mtx);
+ mutex_unlock(&sdata->local->slaves_mtx);
if (local->open_count++ == 0) {
res = local->ops->start(&local->hw);
@@ -74,7 +74,7 @@ int mac802154_slave_open(struct net_device *dev)
netif_start_queue(dev);
return 0;
err:
- sdata->hw->open_count--;
+ sdata->local->open_count--;
return res;
}
@@ -82,15 +82,15 @@ err:
int mac802154_slave_close(struct net_device *dev)
{
struct ieee802154_sub_if_data *sdata = netdev_priv(dev);
- struct ieee802154_local *local = sdata->hw;
+ struct ieee802154_local *local = sdata->local;
ASSERT_RTNL();
netif_stop_queue(dev);
- mutex_lock(&sdata->hw->slaves_mtx);
+ mutex_lock(&sdata->local->slaves_mtx);
sdata->running = false;
- mutex_unlock(&sdata->hw->slaves_mtx);
+ mutex_unlock(&sdata->local->slaves_mtx);
if (!--local->open_count)
local->ops->stop(&local->hw);
@@ -109,7 +109,7 @@ mac802154_netdev_register(struct wpan_phy *phy, struct net_device *dev)
sdata = netdev_priv(dev);
sdata->dev = dev;
- sdata->hw = local;
+ sdata->local = local;
dev->needed_headroom = local->hw.extra_tx_headroom;
@@ -144,11 +144,11 @@ mac802154_del_iface(struct wpan_phy *phy, struct net_device *dev)
sdata = netdev_priv(dev);
- BUG_ON(sdata->hw->phy != phy);
+ BUG_ON(sdata->local->phy != phy);
- mutex_lock(&sdata->hw->slaves_mtx);
+ mutex_lock(&sdata->local->slaves_mtx);
list_del_rcu(&sdata->list);
- mutex_unlock(&sdata->hw->slaves_mtx);
+ mutex_unlock(&sdata->local->slaves_mtx);
synchronize_rcu();
unregister_netdevice(sdata->dev);
@@ -394,9 +394,9 @@ void ieee802154_unregister_hw(struct ieee802154_hw *hw)
mutex_unlock(&local->slaves_mtx);
list_for_each_entry_safe(sdata, next, &local->slaves, list) {
- mutex_lock(&sdata->hw->slaves_mtx);
+ mutex_lock(&sdata->local->slaves_mtx);
list_del(&sdata->list);
- mutex_unlock(&sdata->hw->slaves_mtx);
+ mutex_unlock(&sdata->local->slaves_mtx);
unregister_netdevice(sdata->dev);
}
diff --git a/net/mac802154/mib.c b/net/mac802154/mib.c
index ef05b3b..1ffca5c 100644
--- a/net/mac802154/mib.c
+++ b/net/mac802154/mib.c
@@ -42,7 +42,7 @@ static struct ieee802154_local *mac802154_slave_get_priv(struct net_device *dev)
BUG_ON(dev->type != ARPHRD_IEEE802154);
- return sdata->hw;
+ return sdata->local;
}
static void hw_addr_notify(struct work_struct *work)
@@ -72,7 +72,7 @@ static void set_hw_addr_filt(struct net_device *dev, unsigned long changed)
INIT_WORK(&work->work, hw_addr_notify);
work->dev = dev;
work->changed = changed;
- queue_work(sdata->hw->dev_workqueue, &work->work);
+ queue_work(sdata->local->dev_workqueue, &work->work);
}
void mac802154_dev_set_short_addr(struct net_device *dev, __le16 val)
@@ -85,9 +85,9 @@ void mac802154_dev_set_short_addr(struct net_device *dev, __le16 val)
sdata->short_addr = val;
spin_unlock_bh(&sdata->mib_lock);
- if ((sdata->hw->ops->set_hw_addr_filt) &&
- (sdata->hw->hw.hw_filt.short_addr != sdata->short_addr)) {
- sdata->hw->hw.hw_filt.short_addr = sdata->short_addr;
+ if ((sdata->local->ops->set_hw_addr_filt) &&
+ (sdata->local->hw.hw_filt.short_addr != sdata->short_addr)) {
+ sdata->local->hw.hw_filt.short_addr = sdata->short_addr;
set_hw_addr_filt(dev, IEEE802154_AFILT_SADDR_CHANGED);
}
}
@@ -109,7 +109,7 @@ __le16 mac802154_dev_get_short_addr(const struct net_device *dev)
void mac802154_dev_set_ieee_addr(struct net_device *dev)
{
struct ieee802154_sub_if_data *sdata = netdev_priv(dev);
- struct ieee802154_local *local = sdata->hw;
+ struct ieee802154_local *local = sdata->local;
sdata->extended_addr = ieee802154_devaddr_from_raw(dev->dev_addr);
@@ -144,9 +144,9 @@ void mac802154_dev_set_pan_id(struct net_device *dev, __le16 val)
sdata->pan_id = val;
spin_unlock_bh(&sdata->mib_lock);
- if ((sdata->hw->ops->set_hw_addr_filt) &&
- (sdata->hw->hw.hw_filt.pan_id != sdata->pan_id)) {
- sdata->hw->hw.hw_filt.pan_id = sdata->pan_id;
+ if ((sdata->local->ops->set_hw_addr_filt) &&
+ (sdata->local->hw.hw_filt.pan_id != sdata->pan_id)) {
+ sdata->local->hw.hw_filt.pan_id = sdata->pan_id;
set_hw_addr_filt(dev, IEEE802154_AFILT_PANID_CHANGED);
}
}
@@ -168,15 +168,15 @@ static void phy_chan_notify(struct work_struct *work)
struct ieee802154_sub_if_data *sdata = netdev_priv(nw->dev);
int res;
- mutex_lock(&sdata->hw->phy->pib_lock);
+ mutex_lock(&sdata->local->phy->pib_lock);
res = local->ops->set_channel(&local->hw, sdata->page, sdata->chan);
if (res) {
pr_debug("set_channel failed\n");
} else {
- sdata->hw->phy->current_channel = sdata->chan;
- sdata->hw->phy->current_page = sdata->page;
+ sdata->local->phy->current_channel = sdata->chan;
+ sdata->local->phy->current_page = sdata->page;
}
- mutex_unlock(&sdata->hw->phy->pib_lock);
+ mutex_unlock(&sdata->local->phy->pib_lock);
kfree(nw);
}
@@ -193,10 +193,10 @@ void mac802154_dev_set_page_channel(struct net_device *dev, u8 page, u8 chan)
sdata->chan = chan;
spin_unlock_bh(&sdata->mib_lock);
- mutex_lock(&sdata->hw->phy->pib_lock);
- if (sdata->hw->phy->current_channel != sdata->chan ||
- sdata->hw->phy->current_page != sdata->page) {
- mutex_unlock(&sdata->hw->phy->pib_lock);
+ mutex_lock(&sdata->local->phy->pib_lock);
+ if (sdata->local->phy->current_channel != sdata->chan ||
+ sdata->local->phy->current_page != sdata->page) {
+ mutex_unlock(&sdata->local->phy->pib_lock);
work = kzalloc(sizeof(*work), GFP_ATOMIC);
if (!work)
@@ -204,9 +204,9 @@ void mac802154_dev_set_page_channel(struct net_device *dev, u8 page, u8 chan)
INIT_WORK(&work->work, phy_chan_notify);
work->dev = dev;
- queue_work(sdata->hw->dev_workqueue, &work->work);
+ queue_work(sdata->local->dev_workqueue, &work->work);
} else {
- mutex_unlock(&sdata->hw->phy->pib_lock);
+ mutex_unlock(&sdata->local->phy->pib_lock);
}
}
diff --git a/net/mac802154/monitor.c b/net/mac802154/monitor.c
index bd63e12..79bce52 100644
--- a/net/mac802154/monitor.c
+++ b/net/mac802154/monitor.c
@@ -39,8 +39,8 @@ static netdev_tx_t mac802154_monitor_xmit(struct sk_buff *skb,
sdata = netdev_priv(dev);
/* FIXME: locking */
- chan = sdata->hw->phy->current_channel;
- page = sdata->hw->phy->current_page;
+ chan = sdata->local->phy->current_channel;
+ page = sdata->local->phy->current_page;
if (chan == MAC802154_CHAN_NONE) /* not initialized */
return NETDEV_TX_OK;
@@ -53,7 +53,7 @@ static netdev_tx_t mac802154_monitor_xmit(struct sk_buff *skb,
dev->stats.tx_packets++;
dev->stats.tx_bytes += skb->len;
- return mac802154_tx(sdata->hw, skb, page, chan);
+ return mac802154_tx(sdata->local, skb, page, chan);
}
--
2.1.2
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH bluetooth-next 06/10] mac802154: rename sdata slaves and slaves_mtx
2014-10-25 15:16 [PATCH bluetooth-next 00/10] ieee802154: removals and renames Alexander Aring
` (4 preceding siblings ...)
2014-10-25 15:16 ` [PATCH bluetooth-next 05/10] mac802154: rename hw subif_data variable to local Alexander Aring
@ 2014-10-25 15:16 ` Alexander Aring
2014-10-25 15:16 ` [PATCH bluetooth-next 07/10] mac802154: introduce hw_to_local function Alexander Aring
` (4 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: Alexander Aring @ 2014-10-25 15:16 UTC (permalink / raw)
To: linux-wpan; +Cc: kernel, Alexander Aring
This patch renamens the slaves attribute in sdata to interfaces and
slaves_mtx to iflist_mtx. This is similar like the mac80211 stack naming
convention.
Signed-off-by: Alexander Aring <alex.aring@gmail.com>
---
net/mac802154/ieee802154_i.h | 4 ++--
net/mac802154/iface.c | 10 ++++----
net/mac802154/main.c | 54 ++++++++++++++++++++++----------------------
net/mac802154/monitor.c | 2 +-
net/mac802154/tx.c | 4 ++--
5 files changed, 37 insertions(+), 37 deletions(-)
diff --git a/net/mac802154/ieee802154_i.h b/net/mac802154/ieee802154_i.h
index c5b1ab7..b7cf41c 100644
--- a/net/mac802154/ieee802154_i.h
+++ b/net/mac802154/ieee802154_i.h
@@ -42,8 +42,8 @@ struct ieee802154_local {
*
* So atomic readers can use any of this protection methods.
*/
- struct list_head slaves;
- struct mutex slaves_mtx;
+ struct list_head interfaces;
+ struct mutex iflist_mtx;
/* This one is used for scanning and other jobs not to be interfered
* with serial driver.
diff --git a/net/mac802154/iface.c b/net/mac802154/iface.c
index 6eace90..c0dbb40 100644
--- a/net/mac802154/iface.c
+++ b/net/mac802154/iface.c
@@ -125,9 +125,9 @@ int mac802154_set_mac_params(struct net_device *dev,
{
struct ieee802154_sub_if_data *sdata = netdev_priv(dev);
- mutex_lock(&sdata->local->slaves_mtx);
+ mutex_lock(&sdata->local->iflist_mtx);
sdata->mac_params = *params;
- mutex_unlock(&sdata->local->slaves_mtx);
+ mutex_unlock(&sdata->local->iflist_mtx);
return 0;
}
@@ -137,9 +137,9 @@ void mac802154_get_mac_params(struct net_device *dev,
{
struct ieee802154_sub_if_data *sdata = netdev_priv(dev);
- mutex_lock(&sdata->local->slaves_mtx);
+ mutex_lock(&sdata->local->iflist_mtx);
*params = sdata->mac_params;
- mutex_unlock(&sdata->local->slaves_mtx);
+ mutex_unlock(&sdata->local->iflist_mtx);
}
static int mac802154_wpan_open(struct net_device *dev)
@@ -580,7 +580,7 @@ void mac802154_wpans_rx(struct ieee802154_local *local, struct sk_buff *skb)
}
rcu_read_lock();
- list_for_each_entry_rcu(sdata, &local->slaves, list) {
+ list_for_each_entry_rcu(sdata, &local->interfaces, list) {
if (sdata->type != IEEE802154_DEV_WPAN ||
!netif_running(sdata->dev))
continue;
diff --git a/net/mac802154/main.c b/net/mac802154/main.c
index 9b2644f..34e7e61 100644
--- a/net/mac802154/main.c
+++ b/net/mac802154/main.c
@@ -39,20 +39,20 @@ int mac802154_slave_open(struct net_device *dev)
ASSERT_RTNL();
if (sdata->type == IEEE802154_DEV_WPAN) {
- mutex_lock(&sdata->local->slaves_mtx);
- list_for_each_entry(subif, &sdata->local->slaves, list) {
+ mutex_lock(&sdata->local->iflist_mtx);
+ list_for_each_entry(subif, &sdata->local->interfaces, list) {
if (subif != sdata && subif->type == sdata->type &&
subif->running) {
- mutex_unlock(&sdata->local->slaves_mtx);
+ mutex_unlock(&sdata->local->iflist_mtx);
return -EBUSY;
}
}
- mutex_unlock(&sdata->local->slaves_mtx);
+ mutex_unlock(&sdata->local->iflist_mtx);
}
- mutex_lock(&sdata->local->slaves_mtx);
+ mutex_lock(&sdata->local->iflist_mtx);
sdata->running = true;
- mutex_unlock(&sdata->local->slaves_mtx);
+ mutex_unlock(&sdata->local->iflist_mtx);
if (local->open_count++ == 0) {
res = local->ops->start(&local->hw);
@@ -88,9 +88,9 @@ int mac802154_slave_close(struct net_device *dev)
netif_stop_queue(dev);
- mutex_lock(&sdata->local->slaves_mtx);
+ mutex_lock(&sdata->local->iflist_mtx);
sdata->running = false;
- mutex_unlock(&sdata->local->slaves_mtx);
+ mutex_unlock(&sdata->local->iflist_mtx);
if (!--local->open_count)
local->ops->stop(&local->hw);
@@ -115,21 +115,21 @@ mac802154_netdev_register(struct wpan_phy *phy, struct net_device *dev)
SET_NETDEV_DEV(dev, &local->phy->dev);
- mutex_lock(&local->slaves_mtx);
+ mutex_lock(&local->iflist_mtx);
if (!local->running) {
- mutex_unlock(&local->slaves_mtx);
+ mutex_unlock(&local->iflist_mtx);
return -ENODEV;
}
- mutex_unlock(&local->slaves_mtx);
+ mutex_unlock(&local->iflist_mtx);
err = register_netdev(dev);
if (err < 0)
return err;
rtnl_lock();
- mutex_lock(&local->slaves_mtx);
- list_add_tail_rcu(&sdata->list, &local->slaves);
- mutex_unlock(&local->slaves_mtx);
+ mutex_lock(&local->iflist_mtx);
+ list_add_tail_rcu(&sdata->list, &local->interfaces);
+ mutex_unlock(&local->iflist_mtx);
rtnl_unlock();
return 0;
@@ -146,9 +146,9 @@ mac802154_del_iface(struct wpan_phy *phy, struct net_device *dev)
BUG_ON(sdata->local->phy != phy);
- mutex_lock(&sdata->local->slaves_mtx);
+ mutex_lock(&sdata->local->iflist_mtx);
list_del_rcu(&sdata->list);
- mutex_unlock(&sdata->local->slaves_mtx);
+ mutex_unlock(&sdata->local->iflist_mtx);
synchronize_rcu();
unregister_netdevice(sdata->dev);
@@ -280,8 +280,8 @@ ieee802154_alloc_hw(size_t priv_data_len, struct ieee802154_ops *ops)
local->hw.priv = (char *)local + ALIGN(sizeof(*local), NETDEV_ALIGN);
local->ops = ops;
- INIT_LIST_HEAD(&local->slaves);
- mutex_init(&local->slaves_mtx);
+ INIT_LIST_HEAD(&local->interfaces);
+ mutex_init(&local->iflist_mtx);
return &local->hw;
}
@@ -291,9 +291,9 @@ void ieee802154_free_hw(struct ieee802154_hw *hw)
{
struct ieee802154_local *local = mac802154_to_priv(hw);
- BUG_ON(!list_empty(&local->slaves));
+ BUG_ON(!list_empty(&local->interfaces));
- mutex_destroy(&local->slaves_mtx);
+ mutex_destroy(&local->iflist_mtx);
wpan_phy_free(local->phy);
}
@@ -364,9 +364,9 @@ int ieee802154_register_hw(struct ieee802154_hw *hw)
rtnl_lock();
- mutex_lock(&local->slaves_mtx);
+ mutex_lock(&local->iflist_mtx);
local->running = MAC802154_DEVICE_RUN;
- mutex_unlock(&local->slaves_mtx);
+ mutex_unlock(&local->iflist_mtx);
rtnl_unlock();
@@ -389,14 +389,14 @@ void ieee802154_unregister_hw(struct ieee802154_hw *hw)
rtnl_lock();
- mutex_lock(&local->slaves_mtx);
+ mutex_lock(&local->iflist_mtx);
local->running = MAC802154_DEVICE_STOPPED;
- mutex_unlock(&local->slaves_mtx);
+ mutex_unlock(&local->iflist_mtx);
- list_for_each_entry_safe(sdata, next, &local->slaves, list) {
- mutex_lock(&sdata->local->slaves_mtx);
+ list_for_each_entry_safe(sdata, next, &local->interfaces, list) {
+ mutex_lock(&sdata->local->iflist_mtx);
list_del(&sdata->list);
- mutex_unlock(&sdata->local->slaves_mtx);
+ mutex_unlock(&sdata->local->iflist_mtx);
unregister_netdevice(sdata->dev);
}
diff --git a/net/mac802154/monitor.c b/net/mac802154/monitor.c
index 79bce52..9d2ac5e 100644
--- a/net/mac802154/monitor.c
+++ b/net/mac802154/monitor.c
@@ -65,7 +65,7 @@ void mac802154_monitors_rx(struct ieee802154_local *local, struct sk_buff *skb)
u8 *data;
rcu_read_lock();
- list_for_each_entry_rcu(sdata, &local->slaves, list) {
+ list_for_each_entry_rcu(sdata, &local->interfaces, list) {
if (sdata->type != IEEE802154_DEV_MONITOR ||
!netif_running(sdata->dev))
continue;
diff --git a/net/mac802154/tx.c b/net/mac802154/tx.c
index d20dadd..b6039c7 100644
--- a/net/mac802154/tx.c
+++ b/net/mac802154/tx.c
@@ -68,7 +68,7 @@ out:
/* Restart the netif queue on each sub_if_data object. */
rcu_read_lock();
- list_for_each_entry_rcu(sdata, &xw->local->slaves, list)
+ list_for_each_entry_rcu(sdata, &xw->local->interfaces, list)
netif_wake_queue(sdata->dev);
rcu_read_unlock();
@@ -109,7 +109,7 @@ netdev_tx_t mac802154_tx(struct ieee802154_local *local, struct sk_buff *skb,
/* Stop the netif queue on each sub_if_data object. */
rcu_read_lock();
- list_for_each_entry_rcu(sdata, &local->slaves, list)
+ list_for_each_entry_rcu(sdata, &local->interfaces, list)
netif_stop_queue(sdata->dev);
rcu_read_unlock();
--
2.1.2
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH bluetooth-next 07/10] mac802154: introduce hw_to_local function
2014-10-25 15:16 [PATCH bluetooth-next 00/10] ieee802154: removals and renames Alexander Aring
` (5 preceding siblings ...)
2014-10-25 15:16 ` [PATCH bluetooth-next 06/10] mac802154: rename sdata slaves and slaves_mtx Alexander Aring
@ 2014-10-25 15:16 ` Alexander Aring
2014-10-25 15:16 ` [PATCH bluetooth-next 08/10] mac802154: introduce IEEE802154_DEV_TO_SUB_IF Alexander Aring
` (3 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: Alexander Aring @ 2014-10-25 15:16 UTC (permalink / raw)
To: linux-wpan; +Cc: kernel, Alexander Aring
This patch replace the mac802154_to_priv macro with a static inline
function named hw_to_local. This brings a similar naming convention like
mac80211 stack.
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 ++--
net/mac802154/tx.c | 2 +-
4 files changed, 12 insertions(+), 8 deletions(-)
diff --git a/net/mac802154/ieee802154_i.h b/net/mac802154/ieee802154_i.h
index b7cf41c..41e29b0 100644
--- a/net/mac802154/ieee802154_i.h
+++ b/net/mac802154/ieee802154_i.h
@@ -99,10 +99,14 @@ struct ieee802154_sub_if_data {
struct mac802154_llsec sec;
};
-#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 34e7e61..c7799fa 100644
--- a/net/mac802154/main.c
+++ b/net/mac802154/main.c
@@ -289,7 +289,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->interfaces));
@@ -301,7 +301,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) {
@@ -381,7 +381,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 dc01817..1b5e8e3 100644
--- a/net/mac802154/rx.c
+++ b/net/mac802154/rx.c
@@ -49,7 +49,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);
@@ -90,7 +90,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)
diff --git a/net/mac802154/tx.c b/net/mac802154/tx.c
index b6039c7..3684426 100644
--- a/net/mac802154/tx.c
+++ b/net/mac802154/tx.c
@@ -88,7 +88,7 @@ netdev_tx_t mac802154_tx(struct ieee802154_local *local, struct sk_buff *skb,
goto err_tx;
}
- mac802154_monitors_rx(mac802154_to_priv(&local->hw), skb);
+ mac802154_monitors_rx(local, skb);
if (!(local->hw.flags & IEEE802154_HW_OMIT_CKSUM)) {
u16 crc = crc_ccitt(0, skb->data, skb->len);
--
2.1.2
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH bluetooth-next 08/10] mac802154: introduce IEEE802154_DEV_TO_SUB_IF
2014-10-25 15:16 [PATCH bluetooth-next 00/10] ieee802154: removals and renames Alexander Aring
` (6 preceding siblings ...)
2014-10-25 15:16 ` [PATCH bluetooth-next 07/10] mac802154: introduce hw_to_local function Alexander Aring
@ 2014-10-25 15:16 ` Alexander Aring
2014-10-25 15:16 ` [PATCH bluetooth-next 09/10] mac802154: rename dev_workqueue to workqueue Alexander Aring
` (2 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: Alexander Aring @ 2014-10-25 15:16 UTC (permalink / raw)
To: linux-wpan; +Cc: kernel, Alexander Aring
This function adds a wrapper to call netdev_priv to getting the sdata
attribute. This is similar like the IEEE80211_DEV_TO_SUB_IF function
inside wireless stack implementation.
Signed-off-by: Alexander Aring <alex.aring@gmail.com>
---
net/mac802154/ieee802154_i.h | 6 ++++++
net/mac802154/iface.c | 18 ++++++++--------
net/mac802154/mac_cmd.c | 2 +-
net/mac802154/main.c | 11 ++++------
net/mac802154/mib.c | 49 ++++++++++++++++++++++----------------------
net/mac802154/monitor.c | 4 ++--
6 files changed, 47 insertions(+), 43 deletions(-)
diff --git a/net/mac802154/ieee802154_i.h b/net/mac802154/ieee802154_i.h
index 41e29b0..61885aa 100644
--- a/net/mac802154/ieee802154_i.h
+++ b/net/mac802154/ieee802154_i.h
@@ -107,6 +107,12 @@ hw_to_local(struct ieee802154_hw *hw)
return container_of(hw, struct ieee802154_local, hw);
}
+static inline struct ieee802154_sub_if_data *
+IEEE802154_DEV_TO_SUB_IF(const struct net_device *dev)
+{
+ return netdev_priv(dev);
+}
+
extern struct ieee802154_reduced_mlme_ops mac802154_mlme_reduced;
extern struct ieee802154_mlme_ops mac802154_mlme_wpan;
diff --git a/net/mac802154/iface.c b/net/mac802154/iface.c
index c0dbb40..cdd661f 100644
--- a/net/mac802154/iface.c
+++ b/net/mac802154/iface.c
@@ -33,7 +33,7 @@
static int mac802154_wpan_update_llsec(struct net_device *dev)
{
- struct ieee802154_sub_if_data *sdata = netdev_priv(dev);
+ struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev);
struct ieee802154_mlme_ops *ops = ieee802154_mlme_ops(dev);
int rc = 0;
@@ -56,7 +56,7 @@ static int mac802154_wpan_update_llsec(struct net_device *dev)
static int
mac802154_wpan_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
{
- struct ieee802154_sub_if_data *sdata = netdev_priv(dev);
+ struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev);
struct sockaddr_ieee802154 *sa =
(struct sockaddr_ieee802154 *)&ifr->ifr_addr;
int err = -ENOIOCTLCMD;
@@ -123,7 +123,7 @@ static int mac802154_wpan_mac_addr(struct net_device *dev, void *p)
int mac802154_set_mac_params(struct net_device *dev,
const struct ieee802154_mac_params *params)
{
- struct ieee802154_sub_if_data *sdata = netdev_priv(dev);
+ struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev);
mutex_lock(&sdata->local->iflist_mtx);
sdata->mac_params = *params;
@@ -135,7 +135,7 @@ int mac802154_set_mac_params(struct net_device *dev,
void mac802154_get_mac_params(struct net_device *dev,
struct ieee802154_mac_params *params)
{
- struct ieee802154_sub_if_data *sdata = netdev_priv(dev);
+ struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev);
mutex_lock(&sdata->local->iflist_mtx);
*params = sdata->mac_params;
@@ -145,7 +145,7 @@ void mac802154_get_mac_params(struct net_device *dev,
static int mac802154_wpan_open(struct net_device *dev)
{
int rc;
- struct ieee802154_sub_if_data *sdata = netdev_priv(dev);
+ struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev);
struct wpan_phy *phy = sdata->local->phy;
rc = mac802154_slave_open(dev);
@@ -241,7 +241,7 @@ static int mac802154_header_create(struct sk_buff *skb,
unsigned len)
{
struct ieee802154_hdr hdr;
- struct ieee802154_sub_if_data *sdata = netdev_priv(dev);
+ struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev);
struct ieee802154_mac_cb *cb = mac_cb(skb);
int hlen;
@@ -314,7 +314,7 @@ mac802154_wpan_xmit(struct sk_buff *skb, struct net_device *dev)
u8 chan, page;
int rc;
- sdata = netdev_priv(dev);
+ sdata = IEEE802154_DEV_TO_SUB_IF(dev);
spin_lock_bh(&sdata->mib_lock);
chan = sdata->chan;
@@ -357,7 +357,7 @@ static const struct net_device_ops mac802154_wpan_ops = {
static void mac802154_wpan_free(struct net_device *dev)
{
- struct ieee802154_sub_if_data *sdata = netdev_priv(dev);
+ struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev);
mac802154_llsec_destroy(&sdata->sec);
@@ -384,7 +384,7 @@ void mac802154_wpan_setup(struct net_device *dev)
dev->netdev_ops = &mac802154_wpan_ops;
dev->ml_priv = &mac802154_mlme_wpan;
- sdata = netdev_priv(dev);
+ sdata = IEEE802154_DEV_TO_SUB_IF(dev);
sdata->type = IEEE802154_DEV_WPAN;
sdata->chan = MAC802154_CHAN_NONE;
diff --git a/net/mac802154/mac_cmd.c b/net/mac802154/mac_cmd.c
index 5ee1088..ed767f5 100644
--- a/net/mac802154/mac_cmd.c
+++ b/net/mac802154/mac_cmd.c
@@ -75,7 +75,7 @@ static int mac802154_mlme_start_req(struct net_device *dev,
static struct wpan_phy *mac802154_get_phy(const struct net_device *dev)
{
- struct ieee802154_sub_if_data *sdata = netdev_priv(dev);
+ struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev);
BUG_ON(dev->type != ARPHRD_IEEE802154);
diff --git a/net/mac802154/main.c b/net/mac802154/main.c
index c7799fa..a34006e 100644
--- a/net/mac802154/main.c
+++ b/net/mac802154/main.c
@@ -31,7 +31,7 @@
int mac802154_slave_open(struct net_device *dev)
{
- struct ieee802154_sub_if_data *sdata = netdev_priv(dev);
+ struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev);
struct ieee802154_sub_if_data *subif;
struct ieee802154_local *local = sdata->local;
int res = 0;
@@ -81,7 +81,7 @@ err:
int mac802154_slave_close(struct net_device *dev)
{
- struct ieee802154_sub_if_data *sdata = netdev_priv(dev);
+ struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev);
struct ieee802154_local *local = sdata->local;
ASSERT_RTNL();
@@ -101,13 +101,12 @@ int mac802154_slave_close(struct net_device *dev)
static int
mac802154_netdev_register(struct wpan_phy *phy, struct net_device *dev)
{
- struct ieee802154_sub_if_data *sdata;
+ struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev);
struct ieee802154_local *local;
int err;
local = wpan_phy_priv(phy);
- sdata = netdev_priv(dev);
sdata->dev = dev;
sdata->local = local;
@@ -138,12 +137,10 @@ mac802154_netdev_register(struct wpan_phy *phy, struct net_device *dev)
static void
mac802154_del_iface(struct wpan_phy *phy, struct net_device *dev)
{
- struct ieee802154_sub_if_data *sdata;
+ struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev);
ASSERT_RTNL();
- sdata = netdev_priv(dev);
-
BUG_ON(sdata->local->phy != phy);
mutex_lock(&sdata->local->iflist_mtx);
diff --git a/net/mac802154/mib.c b/net/mac802154/mib.c
index 1ffca5c..d7a2504 100644
--- a/net/mac802154/mib.c
+++ b/net/mac802154/mib.c
@@ -38,7 +38,7 @@ struct hw_addr_filt_notify_work {
static struct ieee802154_local *mac802154_slave_get_priv(struct net_device *dev)
{
- struct ieee802154_sub_if_data *sdata = netdev_priv(dev);
+ struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev);
BUG_ON(dev->type != ARPHRD_IEEE802154);
@@ -62,7 +62,7 @@ static void hw_addr_notify(struct work_struct *work)
static void set_hw_addr_filt(struct net_device *dev, unsigned long changed)
{
- struct ieee802154_sub_if_data *sdata = netdev_priv(dev);
+ struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev);
struct hw_addr_filt_notify_work *work;
work = kzalloc(sizeof(*work), GFP_ATOMIC);
@@ -77,7 +77,7 @@ static void set_hw_addr_filt(struct net_device *dev, unsigned long changed)
void mac802154_dev_set_short_addr(struct net_device *dev, __le16 val)
{
- struct ieee802154_sub_if_data *sdata = netdev_priv(dev);
+ struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev);
BUG_ON(dev->type != ARPHRD_IEEE802154);
@@ -94,7 +94,7 @@ void mac802154_dev_set_short_addr(struct net_device *dev, __le16 val)
__le16 mac802154_dev_get_short_addr(const struct net_device *dev)
{
- struct ieee802154_sub_if_data *sdata = netdev_priv(dev);
+ struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev);
__le16 ret;
BUG_ON(dev->type != ARPHRD_IEEE802154);
@@ -108,7 +108,7 @@ __le16 mac802154_dev_get_short_addr(const struct net_device *dev)
void mac802154_dev_set_ieee_addr(struct net_device *dev)
{
- struct ieee802154_sub_if_data *sdata = netdev_priv(dev);
+ struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev);
struct ieee802154_local *local = sdata->local;
sdata->extended_addr = ieee802154_devaddr_from_raw(dev->dev_addr);
@@ -122,7 +122,7 @@ void mac802154_dev_set_ieee_addr(struct net_device *dev)
__le16 mac802154_dev_get_pan_id(const struct net_device *dev)
{
- struct ieee802154_sub_if_data *sdata = netdev_priv(dev);
+ struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev);
__le16 ret;
BUG_ON(dev->type != ARPHRD_IEEE802154);
@@ -136,7 +136,7 @@ __le16 mac802154_dev_get_pan_id(const struct net_device *dev)
void mac802154_dev_set_pan_id(struct net_device *dev, __le16 val)
{
- struct ieee802154_sub_if_data *sdata = netdev_priv(dev);
+ struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev);
BUG_ON(dev->type != ARPHRD_IEEE802154);
@@ -153,7 +153,7 @@ void mac802154_dev_set_pan_id(struct net_device *dev, __le16 val)
u8 mac802154_dev_get_dsn(const struct net_device *dev)
{
- struct ieee802154_sub_if_data *sdata = netdev_priv(dev);
+ struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev);
BUG_ON(dev->type != ARPHRD_IEEE802154);
@@ -164,8 +164,9 @@ static void phy_chan_notify(struct work_struct *work)
{
struct phy_chan_notify_work *nw = container_of(work,
struct phy_chan_notify_work, work);
- struct ieee802154_local *local = mac802154_slave_get_priv(nw->dev);
- struct ieee802154_sub_if_data *sdata = netdev_priv(nw->dev);
+ struct net_device *dev = nw->dev;
+ struct ieee802154_local *local = mac802154_slave_get_priv(dev);
+ struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev);
int res;
mutex_lock(&sdata->local->phy->pib_lock);
@@ -183,7 +184,7 @@ static void phy_chan_notify(struct work_struct *work)
void mac802154_dev_set_page_channel(struct net_device *dev, u8 page, u8 chan)
{
- struct ieee802154_sub_if_data *sdata = netdev_priv(dev);
+ struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev);
struct phy_chan_notify_work *work;
BUG_ON(dev->type != ARPHRD_IEEE802154);
@@ -214,7 +215,7 @@ void mac802154_dev_set_page_channel(struct net_device *dev, u8 page, u8 chan)
int mac802154_get_params(struct net_device *dev,
struct ieee802154_llsec_params *params)
{
- struct ieee802154_sub_if_data *sdata = netdev_priv(dev);
+ struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev);
int res;
BUG_ON(dev->type != ARPHRD_IEEE802154);
@@ -230,7 +231,7 @@ int mac802154_set_params(struct net_device *dev,
const struct ieee802154_llsec_params *params,
int changed)
{
- struct ieee802154_sub_if_data *sdata = netdev_priv(dev);
+ struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev);
int res;
BUG_ON(dev->type != ARPHRD_IEEE802154);
@@ -247,7 +248,7 @@ int mac802154_add_key(struct net_device *dev,
const struct ieee802154_llsec_key_id *id,
const struct ieee802154_llsec_key *key)
{
- struct ieee802154_sub_if_data *sdata = netdev_priv(dev);
+ struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev);
int res;
BUG_ON(dev->type != ARPHRD_IEEE802154);
@@ -262,7 +263,7 @@ int mac802154_add_key(struct net_device *dev,
int mac802154_del_key(struct net_device *dev,
const struct ieee802154_llsec_key_id *id)
{
- struct ieee802154_sub_if_data *sdata = netdev_priv(dev);
+ struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev);
int res;
BUG_ON(dev->type != ARPHRD_IEEE802154);
@@ -278,7 +279,7 @@ int mac802154_del_key(struct net_device *dev,
int mac802154_add_dev(struct net_device *dev,
const struct ieee802154_llsec_device *llsec_dev)
{
- struct ieee802154_sub_if_data *sdata = netdev_priv(dev);
+ struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev);
int res;
BUG_ON(dev->type != ARPHRD_IEEE802154);
@@ -292,7 +293,7 @@ int mac802154_add_dev(struct net_device *dev,
int mac802154_del_dev(struct net_device *dev, __le64 dev_addr)
{
- struct ieee802154_sub_if_data *sdata = netdev_priv(dev);
+ struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev);
int res;
BUG_ON(dev->type != ARPHRD_IEEE802154);
@@ -309,7 +310,7 @@ int mac802154_add_devkey(struct net_device *dev,
__le64 device_addr,
const struct ieee802154_llsec_device_key *key)
{
- struct ieee802154_sub_if_data *sdata = netdev_priv(dev);
+ struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev);
int res;
BUG_ON(dev->type != ARPHRD_IEEE802154);
@@ -325,7 +326,7 @@ int mac802154_del_devkey(struct net_device *dev,
__le64 device_addr,
const struct ieee802154_llsec_device_key *key)
{
- struct ieee802154_sub_if_data *sdata = netdev_priv(dev);
+ struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev);
int res;
BUG_ON(dev->type != ARPHRD_IEEE802154);
@@ -341,7 +342,7 @@ int mac802154_del_devkey(struct net_device *dev,
int mac802154_add_seclevel(struct net_device *dev,
const struct ieee802154_llsec_seclevel *sl)
{
- struct ieee802154_sub_if_data *sdata = netdev_priv(dev);
+ struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev);
int res;
BUG_ON(dev->type != ARPHRD_IEEE802154);
@@ -356,7 +357,7 @@ int mac802154_add_seclevel(struct net_device *dev,
int mac802154_del_seclevel(struct net_device *dev,
const struct ieee802154_llsec_seclevel *sl)
{
- struct ieee802154_sub_if_data *sdata = netdev_priv(dev);
+ struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev);
int res;
BUG_ON(dev->type != ARPHRD_IEEE802154);
@@ -371,7 +372,7 @@ int mac802154_del_seclevel(struct net_device *dev,
void mac802154_lock_table(struct net_device *dev)
{
- struct ieee802154_sub_if_data *sdata = netdev_priv(dev);
+ struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev);
BUG_ON(dev->type != ARPHRD_IEEE802154);
@@ -381,7 +382,7 @@ void mac802154_lock_table(struct net_device *dev)
void mac802154_get_table(struct net_device *dev,
struct ieee802154_llsec_table **t)
{
- struct ieee802154_sub_if_data *sdata = netdev_priv(dev);
+ struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev);
BUG_ON(dev->type != ARPHRD_IEEE802154);
@@ -390,7 +391,7 @@ void mac802154_get_table(struct net_device *dev,
void mac802154_unlock_table(struct net_device *dev)
{
- struct ieee802154_sub_if_data *sdata = netdev_priv(dev);
+ struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev);
BUG_ON(dev->type != ARPHRD_IEEE802154);
diff --git a/net/mac802154/monitor.c b/net/mac802154/monitor.c
index 9d2ac5e..f8ea6dc 100644
--- a/net/mac802154/monitor.c
+++ b/net/mac802154/monitor.c
@@ -36,7 +36,7 @@ static netdev_tx_t mac802154_monitor_xmit(struct sk_buff *skb,
struct ieee802154_sub_if_data *sdata;
u8 chan, page;
- sdata = netdev_priv(dev);
+ sdata = IEEE802154_DEV_TO_SUB_IF(dev);
/* FIXME: locking */
chan = sdata->local->phy->current_channel;
@@ -105,7 +105,7 @@ void mac802154_monitor_setup(struct net_device *dev)
dev->netdev_ops = &mac802154_monitor_ops;
dev->ml_priv = &mac802154_mlme_reduced;
- sdata = netdev_priv(dev);
+ sdata = IEEE802154_DEV_TO_SUB_IF(dev);
sdata->type = IEEE802154_DEV_MONITOR;
sdata->chan = MAC802154_CHAN_NONE; /* not initialized */
--
2.1.2
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH bluetooth-next 09/10] mac802154: rename dev_workqueue to workqueue
2014-10-25 15:16 [PATCH bluetooth-next 00/10] ieee802154: removals and renames Alexander Aring
` (7 preceding siblings ...)
2014-10-25 15:16 ` [PATCH bluetooth-next 08/10] mac802154: introduce IEEE802154_DEV_TO_SUB_IF Alexander Aring
@ 2014-10-25 15:16 ` Alexander Aring
2014-10-25 15:16 ` [PATCH bluetooth-next 10/10] mac802154: remove ieee802154_addr from driver_ops Alexander Aring
2014-10-25 20:02 ` [PATCH bluetooth-next 00/10] ieee802154: removals and renames Marcel Holtmann
10 siblings, 0 replies; 12+ messages in thread
From: Alexander Aring @ 2014-10-25 15:16 UTC (permalink / raw)
To: linux-wpan; +Cc: kernel, Alexander Aring
Small rename to use the name workqueue than dev_workqueue. To bring the
same naming convention like wireless into 802.15.4.
Signed-off-by: Alexander Aring <alex.aring@gmail.com>
---
net/mac802154/ieee802154_i.h | 2 +-
net/mac802154/main.c | 10 +++++-----
net/mac802154/mib.c | 4 ++--
net/mac802154/rx.c | 2 +-
net/mac802154/tx.c | 2 +-
5 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/net/mac802154/ieee802154_i.h b/net/mac802154/ieee802154_i.h
index 61885aa..7aae692 100644
--- a/net/mac802154/ieee802154_i.h
+++ b/net/mac802154/ieee802154_i.h
@@ -48,7 +48,7 @@ struct ieee802154_local {
/* This one is used for scanning and other jobs not to be interfered
* with serial driver.
*/
- struct workqueue_struct *dev_workqueue;
+ struct workqueue_struct *workqueue;
/* SoftMAC device is registered and running. One can add subinterfaces.
* This flag should be modified under slaves_mtx and RTNL, so you can
diff --git a/net/mac802154/main.c b/net/mac802154/main.c
index a34006e..5ce3184 100644
--- a/net/mac802154/main.c
+++ b/net/mac802154/main.c
@@ -343,9 +343,9 @@ int ieee802154_register_hw(struct ieee802154_hw *hw)
local->phy->set_frame_retries = mac802154_set_frame_retries;
}
- local->dev_workqueue =
+ local->workqueue =
create_singlethread_workqueue(wpan_phy_name(local->phy));
- if (!local->dev_workqueue) {
+ if (!local->workqueue) {
rc = -ENOMEM;
goto out;
}
@@ -370,7 +370,7 @@ int ieee802154_register_hw(struct ieee802154_hw *hw)
return 0;
out_wq:
- destroy_workqueue(local->dev_workqueue);
+ destroy_workqueue(local->workqueue);
out:
return rc;
}
@@ -381,8 +381,8 @@ void ieee802154_unregister_hw(struct ieee802154_hw *hw)
struct ieee802154_local *local = hw_to_local(hw);
struct ieee802154_sub_if_data *sdata, *next;
- flush_workqueue(local->dev_workqueue);
- destroy_workqueue(local->dev_workqueue);
+ flush_workqueue(local->workqueue);
+ destroy_workqueue(local->workqueue);
rtnl_lock();
diff --git a/net/mac802154/mib.c b/net/mac802154/mib.c
index d7a2504..16baff1 100644
--- a/net/mac802154/mib.c
+++ b/net/mac802154/mib.c
@@ -72,7 +72,7 @@ static void set_hw_addr_filt(struct net_device *dev, unsigned long changed)
INIT_WORK(&work->work, hw_addr_notify);
work->dev = dev;
work->changed = changed;
- queue_work(sdata->local->dev_workqueue, &work->work);
+ queue_work(sdata->local->workqueue, &work->work);
}
void mac802154_dev_set_short_addr(struct net_device *dev, __le16 val)
@@ -205,7 +205,7 @@ void mac802154_dev_set_page_channel(struct net_device *dev, u8 page, u8 chan)
INIT_WORK(&work->work, phy_chan_notify);
work->dev = dev;
- queue_work(sdata->local->dev_workqueue, &work->work);
+ queue_work(sdata->local->workqueue, &work->work);
} else {
mutex_unlock(&sdata->local->phy->pib_lock);
}
diff --git a/net/mac802154/rx.c b/net/mac802154/rx.c
index 1b5e8e3..53c9e0c 100644
--- a/net/mac802154/rx.c
+++ b/net/mac802154/rx.c
@@ -105,6 +105,6 @@ ieee802154_rx_irqsafe(struct ieee802154_hw *hw, struct sk_buff *skb, u8 lqi)
work->hw = hw;
work->lqi = lqi;
- queue_work(local->dev_workqueue, &work->work);
+ queue_work(local->workqueue, &work->work);
}
EXPORT_SYMBOL(ieee802154_rx_irqsafe);
diff --git a/net/mac802154/tx.c b/net/mac802154/tx.c
index 3684426..2c40d9b 100644
--- a/net/mac802154/tx.c
+++ b/net/mac802154/tx.c
@@ -119,7 +119,7 @@ netdev_tx_t mac802154_tx(struct ieee802154_local *local, struct sk_buff *skb,
work->page = page;
work->chan = chan;
- queue_work(local->dev_workqueue, &work->work);
+ queue_work(local->workqueue, &work->work);
return NETDEV_TX_OK;
--
2.1.2
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH bluetooth-next 10/10] mac802154: remove ieee802154_addr from driver_ops
2014-10-25 15:16 [PATCH bluetooth-next 00/10] ieee802154: removals and renames Alexander Aring
` (8 preceding siblings ...)
2014-10-25 15:16 ` [PATCH bluetooth-next 09/10] mac802154: rename dev_workqueue to workqueue Alexander Aring
@ 2014-10-25 15:16 ` Alexander Aring
2014-10-25 20:02 ` [PATCH bluetooth-next 00/10] ieee802154: removals and renames Marcel Holtmann
10 siblings, 0 replies; 12+ messages in thread
From: Alexander Aring @ 2014-10-25 15:16 UTC (permalink / raw)
To: linux-wpan; +Cc: kernel, Alexander Aring
This driver_ops callback function is never used by any driver.
Signed-off-by: Alexander Aring <alex.aring@gmail.com>
---
include/net/mac802154.h | 1 -
net/mac802154/main.c | 10 ----------
2 files changed, 11 deletions(-)
diff --git a/include/net/mac802154.h b/include/net/mac802154.h
index eb0e1cb..b07d431 100644
--- a/include/net/mac802154.h
+++ b/include/net/mac802154.h
@@ -170,7 +170,6 @@ struct ieee802154_ops {
int (*set_hw_addr_filt)(struct ieee802154_hw *hw,
struct ieee802154_hw_addr_filt *filt,
unsigned long changed);
- int (*ieee_addr)(struct ieee802154_hw *hw, __le64 addr);
int (*set_txpower)(struct ieee802154_hw *hw, int db);
int (*set_lbt)(struct ieee802154_hw *hw, bool on);
int (*set_cca_mode)(struct ieee802154_hw *hw, u8 mode);
diff --git a/net/mac802154/main.c b/net/mac802154/main.c
index 5ce3184..0e9a6a2 100644
--- a/net/mac802154/main.c
+++ b/net/mac802154/main.c
@@ -61,16 +61,6 @@ int mac802154_slave_open(struct net_device *dev)
goto err;
}
- if (local->ops->ieee_addr) {
- __le64 addr = ieee802154_devaddr_from_raw(dev->dev_addr);
-
- res = local->ops->ieee_addr(&local->hw, addr);
- WARN_ON(res);
- if (res)
- goto err;
- mac802154_dev_set_ieee_addr(dev);
- }
-
netif_start_queue(dev);
return 0;
err:
--
2.1.2
^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH bluetooth-next 00/10] ieee802154: removals and renames
2014-10-25 15:16 [PATCH bluetooth-next 00/10] ieee802154: removals and renames Alexander Aring
` (9 preceding siblings ...)
2014-10-25 15:16 ` [PATCH bluetooth-next 10/10] mac802154: remove ieee802154_addr from driver_ops Alexander Aring
@ 2014-10-25 20:02 ` Marcel Holtmann
10 siblings, 0 replies; 12+ messages in thread
From: Marcel Holtmann @ 2014-10-25 20:02 UTC (permalink / raw)
To: Alexander Aring; +Cc: linux-wpan, kernel
Hi Alex,
> This patch series removes the not working/not finished hardMAC virtual driver
> "fakehard". Additional we remove the not used ieee802154_addr driver callback ops.
> The other patches are rename patches for avoiding mainly the "priv variable naming
> hell" inside the 802.15.4 subsystem. This series introduce 802.11 naming style for
> used structs and variable naming.
>
> This serie based on "[PATCHv2 bluetooth-next 0/7] ieee802154: file movements" patch
> serie.
>
> Alexander Aring (10):
> ieee802154: remove fakehard driver
> ieee802154: rename ieee802154_dev to ieee802154_hw
> mac802154: rename mac802154_priv to ieee802154_local
> mac802154: rename mac802154_sub_if_data
> mac802154: rename hw subif_data variable to local
> mac802154: rename sdata slaves and slaves_mtx
> mac802154: introduce hw_to_local function
> mac802154: introduce IEEE802154_DEV_TO_SUB_IF
> mac802154: rename dev_workqueue to workqueue
> mac802154: remove ieee802154_addr from driver_ops
>
> drivers/net/ieee802154/Kconfig | 10 -
> drivers/net/ieee802154/Makefile | 1 -
> drivers/net/ieee802154/at86rf230.c | 90 ++++----
> drivers/net/ieee802154/cc2520.c | 50 ++---
> drivers/net/ieee802154/fakehard.c | 427 -------------------------------------
> drivers/net/ieee802154/fakelb.c | 78 +++----
> drivers/net/ieee802154/mrf24j40.c | 48 ++---
> include/net/mac802154.h | 43 ++--
> net/mac802154/ieee802154_i.h | 34 +--
> net/mac802154/iface.c | 141 ++++++------
> net/mac802154/mac_cmd.c | 4 +-
> net/mac802154/main.c | 265 +++++++++++------------
> net/mac802154/mib.c | 206 +++++++++---------
> net/mac802154/monitor.c | 26 +--
> net/mac802154/rx.c | 22 +-
> net/mac802154/tx.c | 40 ++--
> 16 files changed, 522 insertions(+), 963 deletions(-)
> delete mode 100644 drivers/net/ieee802154/fakehard.c
all 10 patches have been applied to bluetooth-next tree.
Regards
Marcel
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2014-10-25 20:02 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-25 15:16 [PATCH bluetooth-next 00/10] ieee802154: removals and renames Alexander Aring
2014-10-25 15:16 ` [PATCH bluetooth-next 01/10] ieee802154: remove fakehard driver Alexander Aring
2014-10-25 15:16 ` [PATCH bluetooth-next 02/10] ieee802154: rename ieee802154_dev to ieee802154_hw Alexander Aring
2014-10-25 15:16 ` [PATCH bluetooth-next 03/10] mac802154: rename mac802154_priv to ieee802154_local Alexander Aring
2014-10-25 15:16 ` [PATCH bluetooth-next 04/10] mac802154: rename mac802154_sub_if_data Alexander Aring
2014-10-25 15:16 ` [PATCH bluetooth-next 05/10] mac802154: rename hw subif_data variable to local Alexander Aring
2014-10-25 15:16 ` [PATCH bluetooth-next 06/10] mac802154: rename sdata slaves and slaves_mtx Alexander Aring
2014-10-25 15:16 ` [PATCH bluetooth-next 07/10] mac802154: introduce hw_to_local function Alexander Aring
2014-10-25 15:16 ` [PATCH bluetooth-next 08/10] mac802154: introduce IEEE802154_DEV_TO_SUB_IF Alexander Aring
2014-10-25 15:16 ` [PATCH bluetooth-next 09/10] mac802154: rename dev_workqueue to workqueue Alexander Aring
2014-10-25 15:16 ` [PATCH bluetooth-next 10/10] mac802154: remove ieee802154_addr from driver_ops Alexander Aring
2014-10-25 20:02 ` [PATCH bluetooth-next 00/10] ieee802154: removals and renames Marcel Holtmann
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).