Commit 04e850fe authored by Alexander Aring's avatar Alexander Aring Committed by Marcel Holtmann

mac802154: rename hw subif_data variable to local

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: default avatarAlexander Aring <alex.aring@gmail.com>
Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
parent 036562f9
......@@ -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;
......
......@@ -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 = {
......
......@@ -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 = {
......
......@@ -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 @@ int mac802154_slave_open(struct net_device *dev)
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);
}
......
......@@ -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);
}
}
......
......@@ -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);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment