Skip to content

Commit e9cf356

Browse files
committed
wpan-phy: follow usual patter of devices registration
Follow the usual pattern of devices registration by adding new function (wpan_phy_set_dev) that sets child->parent relationship and removing parent argument from wpan_phy_register call. Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
1 parent a0b4a73 commit e9cf356

3 files changed

Lines changed: 8 additions & 5 deletions

File tree

‎drivers/ieee802154/fakehard.c‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -372,11 +372,12 @@ static int __devinit ieee802154fake_probe(struct platform_device *pdev)
372372
goto out;
373373
}
374374

375+
wpan_phy_set_dev(phy, &pdev->dev);
375376
SET_NETDEV_DEV(dev, &phy->dev);
376377

377378
platform_set_drvdata(pdev, dev);
378379

379-
err = wpan_phy_register(&pdev->dev, phy);
380+
err = wpan_phy_register(phy);
380381
if (err)
381382
goto out;
382383

‎include/net/wpan-phy.h‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,11 @@ struct wpan_phy {
4545
};
4646

4747
struct wpan_phy *wpan_phy_alloc(size_t priv_size);
48-
int wpan_phy_register(struct device *parent, struct wpan_phy *phy);
48+
static inline void wpan_phy_set_dev(struct wpan_phy *phy, struct device *dev)
49+
{
50+
phy->dev.parent = dev;
51+
}
52+
int wpan_phy_register(struct wpan_phy *phy);
4953
void wpan_phy_unregister(struct wpan_phy *phy);
5054
void wpan_phy_free(struct wpan_phy *phy);
5155
/* Same semantics as for class_for_each_device */

‎net/ieee802154/wpan-class.c‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -168,10 +168,8 @@ struct wpan_phy *wpan_phy_alloc(size_t priv_size)
168168
}
169169
EXPORT_SYMBOL(wpan_phy_alloc);
170170

171-
int wpan_phy_register(struct device *parent, struct wpan_phy *phy)
171+
int wpan_phy_register(struct wpan_phy *phy)
172172
{
173-
phy->dev.parent = parent;
174-
175173
return device_add(&phy->dev);
176174
}
177175
EXPORT_SYMBOL(wpan_phy_register);

0 commit comments

Comments
 (0)