summaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorAlexander Aring <alex.aring@gmail.com>2015-05-17 21:45:03 +0200
committerMarcel Holtmann <marcel@holtmann.org>2015-05-19 11:44:45 +0200
commitb82b99f16bc207291b14228441cfffbfd23d5f49 (patch)
tree826d990af67ad1b48977f97b9997342da3c48ea4 /drivers/net
parent3335d98c69b1b09b963d09c8475c40bd8988c994 (diff)
downloadop-kernel-dev-b82b99f16bc207291b14228441cfffbfd23d5f49.zip
op-kernel-dev-b82b99f16bc207291b14228441cfffbfd23d5f49.tar.gz
fakelb: declare fakelb list static
This patch moves the fakelb list of all registered phy's in a static declaration in the fakelb driver. Signed-off-by: Alexander Aring <alex.aring@gmail.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/ieee802154/fakelb.c32
1 files changed, 7 insertions, 25 deletions
diff --git a/drivers/net/ieee802154/fakelb.c b/drivers/net/ieee802154/fakelb.c
index 43370fb..c7e7d50 100644
--- a/drivers/net/ieee802154/fakelb.c
+++ b/drivers/net/ieee802154/fakelb.c
@@ -29,21 +29,17 @@
static int numlbs = 2;
static DEFINE_RWLOCK(fakelb_lock);
+static LIST_HEAD(fakelb_phys);
struct fakelb_phy {
struct ieee802154_hw *hw;
struct list_head list;
- struct fakelb_priv *fake;
spinlock_t lock;
bool working;
};
-struct fakelb_priv {
- struct list_head list;
-};
-
static int
fakelb_hw_ed(struct ieee802154_hw *hw, u8 *level)
{
@@ -82,7 +78,7 @@ fakelb_hw_xmit(struct ieee802154_hw *hw, struct sk_buff *skb)
struct fakelb_phy *phy;
read_lock_bh(&fakelb_lock);
- list_for_each_entry(phy, &current_phy->fake->list, list) {
+ list_for_each_entry(phy, &fakelb_phys, list) {
if (current_phy == phy)
continue;
@@ -132,7 +128,7 @@ static const struct ieee802154_ops fakelb_ops = {
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)
+static int fakelb_add_one(struct device *dev)
{
struct fakelb_phy *phy;
int err;
@@ -176,9 +172,6 @@ static int fakelb_add_one(struct device *dev, struct fakelb_priv *fake)
/* 950 MHz GFSK 802.15.4d-2009 */
hw->phy->supported.channels[6] |= 0x3ffc00;
- INIT_LIST_HEAD(&phy->list);
- phy->fake = fake;
-
spin_lock_init(&phy->lock);
hw->parent = dev;
@@ -188,7 +181,7 @@ static int fakelb_add_one(struct device *dev, struct fakelb_priv *fake)
goto err_reg;
write_lock_bh(&fakelb_lock);
- list_add_tail(&phy->list, &fake->list);
+ list_add_tail(&phy->list, &fakelb_phys);
write_unlock_bh(&fakelb_lock);
return 0;
@@ -210,41 +203,30 @@ static void fakelb_del(struct fakelb_phy *phy)
static int fakelb_probe(struct platform_device *pdev)
{
- struct fakelb_priv *priv;
struct fakelb_phy *phy, *tmp;
int err = -ENOMEM;
int i;
- priv = devm_kzalloc(&pdev->dev, sizeof(struct fakelb_priv),
- GFP_KERNEL);
- if (!priv)
- goto err_alloc;
-
- INIT_LIST_HEAD(&priv->list);
-
for (i = 0; i < numlbs; i++) {
- err = fakelb_add_one(&pdev->dev, priv);
+ err = fakelb_add_one(&pdev->dev);
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_safe(phy, tmp, &priv->list, list)
+ list_for_each_entry_safe(phy, tmp, &fakelb_phys, list)
fakelb_del(phy);
-err_alloc:
return err;
}
static int fakelb_remove(struct platform_device *pdev)
{
- struct fakelb_priv *priv = platform_get_drvdata(pdev);
struct fakelb_phy *phy, *temp;
- list_for_each_entry_safe(phy, temp, &priv->list, list)
+ list_for_each_entry_safe(phy, temp, &fakelb_phys, list)
fakelb_del(phy);
return 0;
OpenPOWER on IntegriCloud