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)
{
struct fakelb_phy *phy;
read_lock_bh(&fakelb_lock);
- list_for_each_entry(phy, ¤t_phy->fake->list, list) {
+ list_for_each_entry(phy, &fakelb_phys, list) {
if (current_phy == phy)
continue;
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;
/* 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;
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;
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;