wpan-phy: follow usual patter of devices registration
authorDmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Mon, 28 Sep 2009 15:01:20 +0000 (19:01 +0400)
committerDmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Fri, 6 Nov 2009 11:29:50 +0000 (14:29 +0300)
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>
drivers/ieee802154/fakehard.c
include/net/wpan-phy.h
net/ieee802154/wpan-class.c

index f6f2afefaa177e306ed20f747693d3985ecfa5e9..4ea93cc7afcc733a52b5eab34fec182f93075848 100644 (file)
@@ -372,11 +372,12 @@ static int __devinit ieee802154fake_probe(struct platform_device *pdev)
                        goto out;
        }
 
+       wpan_phy_set_dev(phy, &pdev->dev);
        SET_NETDEV_DEV(dev, &phy->dev);
 
        platform_set_drvdata(pdev, dev);
 
-       err = wpan_phy_register(&pdev->dev, phy);
+       err = wpan_phy_register(phy);
        if (err)
                goto out;
 
index 7b7fc581e673219ed7d850164ca49cec8b3a2f39..f63537c17363df5cd07ece7bc3b46a1dc9f1a799 100644 (file)
@@ -45,7 +45,11 @@ struct wpan_phy {
 };
 
 struct wpan_phy *wpan_phy_alloc(size_t priv_size);
-int wpan_phy_register(struct device *parent, struct wpan_phy *phy);
+static inline void wpan_phy_set_dev(struct wpan_phy *phy, struct device *dev)
+{
+       phy->dev.parent = dev;
+}
+int wpan_phy_register(struct wpan_phy *phy);
 void wpan_phy_unregister(struct wpan_phy *phy);
 void wpan_phy_free(struct wpan_phy *phy);
 /* Same semantics as for class_for_each_device */
index 0c51f85aa59132dbd52244689703bd956bb720e8..cd42e88b839744c3b0b8166657f7c4443ce7e0b3 100644 (file)
@@ -168,10 +168,8 @@ struct wpan_phy *wpan_phy_alloc(size_t priv_size)
 }
 EXPORT_SYMBOL(wpan_phy_alloc);
 
-int wpan_phy_register(struct device *parent, struct wpan_phy *phy)
+int wpan_phy_register(struct wpan_phy *phy)
 {
-       phy->dev.parent = parent;
-
        return device_add(&phy->dev);
 }
 EXPORT_SYMBOL(wpan_phy_register);