| 
									
										
										
										
											2012-05-15 20:50:30 +00:00
										 |  |  | /*
 | 
					
						
							|  |  |  |  * Loopback IEEE 802.15.4 interface | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * Copyright 2007-2012 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. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * Written by: | 
					
						
							|  |  |  |  * Sergey Lapin <slapin@ossfans.org> | 
					
						
							|  |  |  |  * Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> | 
					
						
							|  |  |  |  * Alexander Smirnov <alex.bluesman.smirnov@gmail.com> | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include <linux/module.h>
 | 
					
						
							|  |  |  | #include <linux/timer.h>
 | 
					
						
							|  |  |  | #include <linux/platform_device.h>
 | 
					
						
							|  |  |  | #include <linux/netdevice.h>
 | 
					
						
							| 
									
										
										
											
												ieee802154: Introduce the use of the managed version of kzalloc
This patch moves data allocated using kzalloc to managed data allocated
using devm_kzalloc and cleans now unnecessary kfrees in probe and remove
functions. An explicit linux/device.h include is added to make sure
the devm_*() routine declarations are unambiguously available.
The following Coccinelle semantic patch was used for making the change:
@platform@
identifier p, probefn, removefn;
@@
struct platform_driver p = {
  .probe = probefn,
  .remove = removefn,
};
@prb@
identifier platform.probefn, pdev;
expression e, e1, e2;
@@
probefn(struct platform_device *pdev, ...) {
  <+...
- e = kzalloc(e1, e2)
+ e = devm_kzalloc(&pdev->dev, e1, e2)
  ...
?-kfree(e);
  ...+>
}
@rem depends on prb@
identifier platform.removefn;
expression e;
@@
removefn(...) {
  <...
- kfree(e);
  ...>
}
Signed-off-by: Himangi Saraogi <himangi774@gmail.com>
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: David S. Miller <davem@davemloft.net>
											
										 
											2014-05-19 22:25:11 +05:30
										 |  |  | #include <linux/device.h>
 | 
					
						
							| 
									
										
										
										
											2012-05-15 20:50:30 +00:00
										 |  |  | #include <linux/spinlock.h>
 | 
					
						
							|  |  |  | #include <net/mac802154.h>
 | 
					
						
							| 
									
										
										
										
											2014-10-25 09:41:02 +02:00
										 |  |  | #include <net/cfg802154.h>
 | 
					
						
							| 
									
										
										
										
											2012-05-15 20:50:30 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | static int numlbs = 1; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | struct fakelb_dev_priv { | 
					
						
							| 
									
										
										
										
											2014-10-25 17:16:34 +02:00
										 |  |  | 	struct ieee802154_hw *hw; | 
					
						
							| 
									
										
										
										
											2012-05-15 20:50:30 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	struct list_head list; | 
					
						
							|  |  |  | 	struct fakelb_priv *fake; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	spinlock_t lock; | 
					
						
							|  |  |  | 	bool working; | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | struct fakelb_priv { | 
					
						
							|  |  |  | 	struct list_head list; | 
					
						
							|  |  |  | 	rwlock_t lock; | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static int | 
					
						
							| 
									
										
										
										
											2014-10-25 17:16:34 +02:00
										 |  |  | fakelb_hw_ed(struct ieee802154_hw *hw, u8 *level) | 
					
						
							| 
									
										
										
										
											2012-05-15 20:50:30 +00:00
										 |  |  | { | 
					
						
							|  |  |  | 	BUG_ON(!level); | 
					
						
							|  |  |  | 	*level = 0xbe; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	return 0; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static int | 
					
						
							| 
									
										
										
										
											2014-10-28 18:21:19 +01:00
										 |  |  | fakelb_hw_channel(struct ieee802154_hw *hw, u8 page, u8 channel) | 
					
						
							| 
									
										
										
										
											2012-05-15 20:50:30 +00:00
										 |  |  | { | 
					
						
							|  |  |  | 	pr_debug("set channel to %d\n", channel); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	return 0; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static void | 
					
						
							|  |  |  | fakelb_hw_deliver(struct fakelb_dev_priv *priv, struct sk_buff *skb) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	struct sk_buff *newskb; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	spin_lock(&priv->lock); | 
					
						
							|  |  |  | 	if (priv->working) { | 
					
						
							|  |  |  | 		newskb = pskb_copy(skb, GFP_ATOMIC); | 
					
						
							| 
									
										
										
										
											2014-10-25 17:16:34 +02:00
										 |  |  | 		ieee802154_rx_irqsafe(priv->hw, newskb, 0xcc); | 
					
						
							| 
									
										
										
										
											2012-05-15 20:50:30 +00:00
										 |  |  | 	} | 
					
						
							|  |  |  | 	spin_unlock(&priv->lock); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static int | 
					
						
							| 
									
										
										
										
											2014-10-25 17:16:34 +02:00
										 |  |  | fakelb_hw_xmit(struct ieee802154_hw *hw, struct sk_buff *skb) | 
					
						
							| 
									
										
										
										
											2012-05-15 20:50:30 +00:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2014-10-25 17:16:34 +02:00
										 |  |  | 	struct fakelb_dev_priv *priv = hw->priv; | 
					
						
							| 
									
										
										
										
											2012-05-15 20:50:30 +00:00
										 |  |  | 	struct fakelb_priv *fake = priv->fake; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	read_lock_bh(&fake->lock); | 
					
						
							|  |  |  | 	if (priv->list.next == priv->list.prev) { | 
					
						
							|  |  |  | 		/* we are the only one device */ | 
					
						
							|  |  |  | 		fakelb_hw_deliver(priv, skb); | 
					
						
							|  |  |  | 	} else { | 
					
						
							|  |  |  | 		struct fakelb_dev_priv *dp; | 
					
						
							|  |  |  | 		list_for_each_entry(dp, &priv->fake->list, list) { | 
					
						
							|  |  |  | 			if (dp != priv && | 
					
						
							| 
									
										
										
										
											2014-10-25 17:16:34 +02:00
										 |  |  | 			    (dp->hw->phy->current_channel == | 
					
						
							|  |  |  | 			     priv->hw->phy->current_channel)) | 
					
						
							| 
									
										
										
										
											2012-05-15 20:50:30 +00:00
										 |  |  | 				fakelb_hw_deliver(dp, skb); | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 	read_unlock_bh(&fake->lock); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	return 0; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static int | 
					
						
							| 
									
										
										
										
											2014-10-25 17:16:34 +02:00
										 |  |  | fakelb_hw_start(struct ieee802154_hw *hw) { | 
					
						
							|  |  |  | 	struct fakelb_dev_priv *priv = hw->priv; | 
					
						
							| 
									
										
										
										
											2012-05-15 20:50:30 +00:00
										 |  |  | 	int ret = 0; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	spin_lock(&priv->lock); | 
					
						
							|  |  |  | 	if (priv->working) | 
					
						
							|  |  |  | 		ret = -EBUSY; | 
					
						
							|  |  |  | 	else | 
					
						
							|  |  |  | 		priv->working = 1; | 
					
						
							|  |  |  | 	spin_unlock(&priv->lock); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	return ret; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static void | 
					
						
							| 
									
										
										
										
											2014-10-25 17:16:34 +02:00
										 |  |  | fakelb_hw_stop(struct ieee802154_hw *hw) { | 
					
						
							|  |  |  | 	struct fakelb_dev_priv *priv = hw->priv; | 
					
						
							| 
									
										
										
										
											2012-05-15 20:50:30 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	spin_lock(&priv->lock); | 
					
						
							|  |  |  | 	priv->working = 0; | 
					
						
							|  |  |  | 	spin_unlock(&priv->lock); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-10-28 18:21:18 +01:00
										 |  |  | static const struct ieee802154_ops fakelb_ops = { | 
					
						
							| 
									
										
										
										
											2012-05-15 20:50:30 +00:00
										 |  |  | 	.owner = THIS_MODULE, | 
					
						
							| 
									
										
										
										
											2014-10-26 09:37:08 +01:00
										 |  |  | 	.xmit_sync = fakelb_hw_xmit, | 
					
						
							| 
									
										
										
										
											2012-05-15 20:50:30 +00:00
										 |  |  | 	.ed = fakelb_hw_ed, | 
					
						
							|  |  |  | 	.set_channel = fakelb_hw_channel, | 
					
						
							|  |  |  | 	.start = fakelb_hw_start, | 
					
						
							|  |  |  | 	.stop = fakelb_hw_stop, | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /* Number of dummy devices to be set up by this module. */ | 
					
						
							|  |  |  | module_param(numlbs, int, 0); | 
					
						
							|  |  |  | MODULE_PARM_DESC(numlbs, " number of pseudo devices"); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static int fakelb_add_one(struct device *dev, struct fakelb_priv *fake) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	struct fakelb_dev_priv *priv; | 
					
						
							|  |  |  | 	int err; | 
					
						
							| 
									
										
										
										
											2014-10-25 17:16:34 +02:00
										 |  |  | 	struct ieee802154_hw *hw; | 
					
						
							| 
									
										
										
										
											2012-05-15 20:50:30 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-10-25 17:16:34 +02:00
										 |  |  | 	hw = ieee802154_alloc_hw(sizeof(*priv), &fakelb_ops); | 
					
						
							|  |  |  | 	if (!hw) | 
					
						
							| 
									
										
										
										
											2012-05-15 20:50:30 +00:00
										 |  |  | 		return -ENOMEM; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-10-25 17:16:34 +02:00
										 |  |  | 	priv = hw->priv; | 
					
						
							|  |  |  | 	priv->hw = hw; | 
					
						
							| 
									
										
										
										
											2012-05-15 20:50:30 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	/* 868 MHz BPSK	802.15.4-2003 */ | 
					
						
							| 
									
										
										
										
											2014-10-25 17:16:34 +02:00
										 |  |  | 	hw->phy->channels_supported[0] |= 1; | 
					
						
							| 
									
										
										
										
											2012-05-15 20:50:30 +00:00
										 |  |  | 	/* 915 MHz BPSK	802.15.4-2003 */ | 
					
						
							| 
									
										
										
										
											2014-10-25 17:16:34 +02:00
										 |  |  | 	hw->phy->channels_supported[0] |= 0x7fe; | 
					
						
							| 
									
										
										
										
											2012-05-15 20:50:30 +00:00
										 |  |  | 	/* 2.4 GHz O-QPSK 802.15.4-2003 */ | 
					
						
							| 
									
										
										
										
											2014-10-25 17:16:34 +02:00
										 |  |  | 	hw->phy->channels_supported[0] |= 0x7FFF800; | 
					
						
							| 
									
										
										
										
											2012-05-15 20:50:30 +00:00
										 |  |  | 	/* 868 MHz ASK 802.15.4-2006 */ | 
					
						
							| 
									
										
										
										
											2014-10-25 17:16:34 +02:00
										 |  |  | 	hw->phy->channels_supported[1] |= 1; | 
					
						
							| 
									
										
										
										
											2012-05-15 20:50:30 +00:00
										 |  |  | 	/* 915 MHz ASK 802.15.4-2006 */ | 
					
						
							| 
									
										
										
										
											2014-10-25 17:16:34 +02:00
										 |  |  | 	hw->phy->channels_supported[1] |= 0x7fe; | 
					
						
							| 
									
										
										
										
											2012-05-15 20:50:30 +00:00
										 |  |  | 	/* 868 MHz O-QPSK 802.15.4-2006 */ | 
					
						
							| 
									
										
										
										
											2014-10-25 17:16:34 +02:00
										 |  |  | 	hw->phy->channels_supported[2] |= 1; | 
					
						
							| 
									
										
										
										
											2012-05-15 20:50:30 +00:00
										 |  |  | 	/* 915 MHz O-QPSK 802.15.4-2006 */ | 
					
						
							| 
									
										
										
										
											2014-10-25 17:16:34 +02:00
										 |  |  | 	hw->phy->channels_supported[2] |= 0x7fe; | 
					
						
							| 
									
										
										
										
											2012-05-15 20:50:30 +00:00
										 |  |  | 	/* 2.4 GHz CSS 802.15.4a-2007 */ | 
					
						
							| 
									
										
										
										
											2014-10-25 17:16:34 +02:00
										 |  |  | 	hw->phy->channels_supported[3] |= 0x3fff; | 
					
						
							| 
									
										
										
										
											2012-05-15 20:50:30 +00:00
										 |  |  | 	/* UWB Sub-gigahertz 802.15.4a-2007 */ | 
					
						
							| 
									
										
										
										
											2014-10-25 17:16:34 +02:00
										 |  |  | 	hw->phy->channels_supported[4] |= 1; | 
					
						
							| 
									
										
										
										
											2012-05-15 20:50:30 +00:00
										 |  |  | 	/* UWB Low band 802.15.4a-2007 */ | 
					
						
							| 
									
										
										
										
											2014-10-25 17:16:34 +02:00
										 |  |  | 	hw->phy->channels_supported[4] |= 0x1e; | 
					
						
							| 
									
										
										
										
											2012-05-15 20:50:30 +00:00
										 |  |  | 	/* UWB High band 802.15.4a-2007 */ | 
					
						
							| 
									
										
										
										
											2014-10-25 17:16:34 +02:00
										 |  |  | 	hw->phy->channels_supported[4] |= 0xffe0; | 
					
						
							| 
									
										
										
										
											2012-05-15 20:50:30 +00:00
										 |  |  | 	/* 750 MHz O-QPSK 802.15.4c-2009 */ | 
					
						
							| 
									
										
										
										
											2014-10-25 17:16:34 +02:00
										 |  |  | 	hw->phy->channels_supported[5] |= 0xf; | 
					
						
							| 
									
										
										
										
											2012-05-15 20:50:30 +00:00
										 |  |  | 	/* 750 MHz MPSK 802.15.4c-2009 */ | 
					
						
							| 
									
										
										
										
											2014-10-25 17:16:34 +02:00
										 |  |  | 	hw->phy->channels_supported[5] |= 0xf0; | 
					
						
							| 
									
										
										
										
											2012-05-15 20:50:30 +00:00
										 |  |  | 	/* 950 MHz BPSK 802.15.4d-2009 */ | 
					
						
							| 
									
										
										
										
											2014-10-25 17:16:34 +02:00
										 |  |  | 	hw->phy->channels_supported[6] |= 0x3ff; | 
					
						
							| 
									
										
										
										
											2012-05-15 20:50:30 +00:00
										 |  |  | 	/* 950 MHz GFSK 802.15.4d-2009 */ | 
					
						
							| 
									
										
										
										
											2014-10-25 17:16:34 +02:00
										 |  |  | 	hw->phy->channels_supported[6] |= 0x3ffc00; | 
					
						
							| 
									
										
										
										
											2012-05-15 20:50:30 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	INIT_LIST_HEAD(&priv->list); | 
					
						
							|  |  |  | 	priv->fake = fake; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	spin_lock_init(&priv->lock); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-10-25 17:16:34 +02:00
										 |  |  | 	hw->parent = dev; | 
					
						
							| 
									
										
										
										
											2012-05-15 20:50:30 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-10-25 17:16:34 +02:00
										 |  |  | 	err = ieee802154_register_hw(hw); | 
					
						
							| 
									
										
										
										
											2012-05-15 20:50:30 +00:00
										 |  |  | 	if (err) | 
					
						
							|  |  |  | 		goto err_reg; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	write_lock_bh(&fake->lock); | 
					
						
							|  |  |  | 	list_add_tail(&priv->list, &fake->list); | 
					
						
							|  |  |  | 	write_unlock_bh(&fake->lock); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	return 0; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | err_reg: | 
					
						
							| 
									
										
										
										
											2014-10-25 17:16:34 +02:00
										 |  |  | 	ieee802154_free_hw(priv->hw); | 
					
						
							| 
									
										
										
										
											2012-05-15 20:50:30 +00:00
										 |  |  | 	return err; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static void fakelb_del(struct fakelb_dev_priv *priv) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	write_lock_bh(&priv->fake->lock); | 
					
						
							|  |  |  | 	list_del(&priv->list); | 
					
						
							|  |  |  | 	write_unlock_bh(&priv->fake->lock); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-10-25 17:16:34 +02:00
										 |  |  | 	ieee802154_unregister_hw(priv->hw); | 
					
						
							|  |  |  | 	ieee802154_free_hw(priv->hw); | 
					
						
							| 
									
										
										
										
											2012-05-15 20:50:30 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-12-03 09:24:12 -05:00
										 |  |  | static int fakelb_probe(struct platform_device *pdev) | 
					
						
							| 
									
										
										
										
											2012-05-15 20:50:30 +00:00
										 |  |  | { | 
					
						
							|  |  |  | 	struct fakelb_priv *priv; | 
					
						
							|  |  |  | 	struct fakelb_dev_priv *dp; | 
					
						
							|  |  |  | 	int err = -ENOMEM; | 
					
						
							|  |  |  | 	int i; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
											
												ieee802154: Introduce the use of the managed version of kzalloc
This patch moves data allocated using kzalloc to managed data allocated
using devm_kzalloc and cleans now unnecessary kfrees in probe and remove
functions. An explicit linux/device.h include is added to make sure
the devm_*() routine declarations are unambiguously available.
The following Coccinelle semantic patch was used for making the change:
@platform@
identifier p, probefn, removefn;
@@
struct platform_driver p = {
  .probe = probefn,
  .remove = removefn,
};
@prb@
identifier platform.probefn, pdev;
expression e, e1, e2;
@@
probefn(struct platform_device *pdev, ...) {
  <+...
- e = kzalloc(e1, e2)
+ e = devm_kzalloc(&pdev->dev, e1, e2)
  ...
?-kfree(e);
  ...+>
}
@rem depends on prb@
identifier platform.removefn;
expression e;
@@
removefn(...) {
  <...
- kfree(e);
  ...>
}
Signed-off-by: Himangi Saraogi <himangi774@gmail.com>
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: David S. Miller <davem@davemloft.net>
											
										 
											2014-05-19 22:25:11 +05:30
										 |  |  | 	priv = devm_kzalloc(&pdev->dev, sizeof(struct fakelb_priv), | 
					
						
							|  |  |  | 			    GFP_KERNEL); | 
					
						
							| 
									
										
										
										
											2012-05-15 20:50:30 +00:00
										 |  |  | 	if (!priv) | 
					
						
							|  |  |  | 		goto err_alloc; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	INIT_LIST_HEAD(&priv->list); | 
					
						
							|  |  |  | 	rwlock_init(&priv->lock); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	for (i = 0; i < numlbs; i++) { | 
					
						
							|  |  |  | 		err = fakelb_add_one(&pdev->dev, priv); | 
					
						
							|  |  |  | 		if (err < 0) | 
					
						
							|  |  |  | 			goto err_slave; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	platform_set_drvdata(pdev, priv); | 
					
						
							|  |  |  | 	dev_info(&pdev->dev, "added ieee802154 hardware\n"); | 
					
						
							|  |  |  | 	return 0; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | err_slave: | 
					
						
							|  |  |  | 	list_for_each_entry(dp, &priv->list, list) | 
					
						
							|  |  |  | 		fakelb_del(dp); | 
					
						
							|  |  |  | err_alloc: | 
					
						
							|  |  |  | 	return err; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-12-03 09:24:12 -05:00
										 |  |  | static int fakelb_remove(struct platform_device *pdev) | 
					
						
							| 
									
										
										
										
											2012-05-15 20:50:30 +00:00
										 |  |  | { | 
					
						
							|  |  |  | 	struct fakelb_priv *priv = platform_get_drvdata(pdev); | 
					
						
							|  |  |  | 	struct fakelb_dev_priv *dp, *temp; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	list_for_each_entry_safe(dp, temp, &priv->list, list) | 
					
						
							|  |  |  | 		fakelb_del(dp); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	return 0; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static struct platform_device *ieee802154fake_dev; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static struct platform_driver ieee802154fake_driver = { | 
					
						
							|  |  |  | 	.probe = fakelb_probe, | 
					
						
							| 
									
										
										
										
											2012-12-03 09:24:12 -05:00
										 |  |  | 	.remove = fakelb_remove, | 
					
						
							| 
									
										
										
										
											2012-05-15 20:50:30 +00:00
										 |  |  | 	.driver = { | 
					
						
							|  |  |  | 			.name = "ieee802154fakelb", | 
					
						
							|  |  |  | 	}, | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static __init int fakelb_init_module(void) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	ieee802154fake_dev = platform_device_register_simple( | 
					
						
							|  |  |  | 			     "ieee802154fakelb", -1, NULL, 0); | 
					
						
							|  |  |  | 	return platform_driver_register(&ieee802154fake_driver); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static __exit void fake_remove_module(void) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	platform_driver_unregister(&ieee802154fake_driver); | 
					
						
							|  |  |  | 	platform_device_unregister(ieee802154fake_dev); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | module_init(fakelb_init_module); | 
					
						
							|  |  |  | module_exit(fake_remove_module); | 
					
						
							|  |  |  | MODULE_LICENSE("GPL"); |