staging: panel: Remove printk(KERN_DEBUG ...) located in the #if 0 block
[linux-2.6/btrfs-unstable.git] / net / mac802154 / mib.c
blobab59821ec7293b8c349ea5f5b1a626bef1448b44
1 /*
2 * Copyright 2007-2012 Siemens AG
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2
6 * as published by the Free Software Foundation.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License along
14 * with this program; if not, write to the Free Software Foundation, Inc.,
15 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17 * Written by:
18 * Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
19 * Sergey Lapin <slapin@ossfans.org>
20 * Maxim Gorbachyov <maxim.gorbachev@siemens.com>
21 * Alexander Smirnov <alex.bluesman.smirnov@gmail.com>
24 #include <linux/if_arp.h>
26 #include <net/mac802154.h>
27 #include <net/wpan-phy.h>
29 #include "mac802154.h"
31 struct hw_addr_filt_notify_work {
32 struct work_struct work;
33 struct net_device *dev;
34 unsigned long changed;
37 struct mac802154_priv *mac802154_slave_get_priv(struct net_device *dev)
39 struct mac802154_sub_if_data *priv = netdev_priv(dev);
41 BUG_ON(dev->type != ARPHRD_IEEE802154);
43 return priv->hw;
46 static void hw_addr_notify(struct work_struct *work)
48 struct hw_addr_filt_notify_work *nw = container_of(work,
49 struct hw_addr_filt_notify_work, work);
50 struct mac802154_priv *hw = mac802154_slave_get_priv(nw->dev);
51 int res;
53 res = hw->ops->set_hw_addr_filt(&hw->hw,
54 &hw->hw.hw_filt,
55 nw->changed);
56 if (res)
57 pr_debug("failed changed mask %lx\n", nw->changed);
59 kfree(nw);
61 return;
64 static void set_hw_addr_filt(struct net_device *dev, unsigned long changed)
66 struct mac802154_sub_if_data *priv = netdev_priv(dev);
67 struct hw_addr_filt_notify_work *work;
69 work = kzalloc(sizeof(*work), GFP_ATOMIC);
70 if (!work)
71 return;
73 INIT_WORK(&work->work, hw_addr_notify);
74 work->dev = dev;
75 work->changed = changed;
76 queue_work(priv->hw->dev_workqueue, &work->work);
78 return;
81 void mac802154_dev_set_ieee_addr(struct net_device *dev)
83 struct mac802154_sub_if_data *priv = netdev_priv(dev);
84 struct mac802154_priv *mac = priv->hw;
86 if (mac->ops->set_hw_addr_filt &&
87 memcmp(mac->hw.hw_filt.ieee_addr,
88 dev->dev_addr, IEEE802154_ADDR_LEN)) {
89 memcpy(mac->hw.hw_filt.ieee_addr,
90 dev->dev_addr, IEEE802154_ADDR_LEN);
91 set_hw_addr_filt(dev, IEEE802515_AFILT_IEEEADDR_CHANGED);