Skip to content

Commit

Permalink
mac802154: rename hw subif_data variable to local
Browse files Browse the repository at this point in the history
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>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
  • Loading branch information
Alexander Aring authored and Marcel Holtmann committed Oct 25, 2014
1 parent 036562f commit 04e850f
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 47 deletions.
2 changes: 1 addition & 1 deletion net/mac802154/ieee802154_i.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
12 changes: 6 additions & 6 deletions net/mac802154/iface.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -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)
Expand Down Expand Up @@ -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 = {
Expand Down
2 changes: 1 addition & 1 deletion net/mac802154/mac_cmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down
34 changes: 17 additions & 17 deletions net/mac802154/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -74,23 +74,23 @@ 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;
}

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);
Expand All @@ -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;

Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
}
Expand Down
38 changes: 19 additions & 19 deletions net/mac802154/mib.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand All @@ -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);
}
}
Expand All @@ -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);

Expand Down Expand Up @@ -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);
}
}
Expand All @@ -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);
}
Expand All @@ -193,20 +193,20 @@ 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)
return;

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);
}
}

Expand Down
6 changes: 3 additions & 3 deletions net/mac802154/monitor.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
}


Expand Down

0 comments on commit 04e850f

Please sign in to comment.