usb: phy: initialize the notifier when add a new phy
authorNeil Zhang <zhangwm@marvell.com>
Wed, 11 Dec 2013 06:45:14 +0000 (14:45 +0800)
committerFelipe Balbi <balbi@ti.com>
Thu, 12 Dec 2013 19:43:34 +0000 (13:43 -0600)
We need to initialize the notifer before use it.

So lets initialize it when add a new phy device to
reduce the code redundancy.

Signed-off-by: Neil Zhang <zhangwm@marvell.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
drivers/usb/phy/phy-ab8500-usb.c
drivers/usb/phy/phy-generic.c
drivers/usb/phy/phy-gpio-vbus-usb.c
drivers/usb/phy/phy-mxs-usb.c
drivers/usb/phy/phy.c

index 087402350b6d3f66b46212881c52d8fcd8b9f296..11ab2c45e46220ac98a9dc829fd88cecde51aa70 100644 (file)
@@ -1415,8 +1415,6 @@ static int ab8500_usb_probe(struct platform_device *pdev)
 
        platform_set_drvdata(pdev, ab);
 
-       ATOMIC_INIT_NOTIFIER_HEAD(&ab->phy.notifier);
-
        /* all: Disable phy when called from set_host and set_peripheral */
        INIT_WORK(&ab->phy_dis_work, ab8500_usb_phy_disable_work);
 
index fce3a9e9bb5d282ff6b1a64492ad6a55c90e654f..cd19bbc6e3cd80f7b68df8fa704e450636e7be55 100644 (file)
@@ -210,7 +210,6 @@ int usb_phy_gen_create_phy(struct device *dev, struct usb_phy_gen_xceiv *nop,
        nop->phy.otg->set_host          = nop_set_host;
        nop->phy.otg->set_peripheral    = nop_set_peripheral;
 
-       ATOMIC_INIT_NOTIFIER_HEAD(&nop->phy.notifier);
        return 0;
 }
 EXPORT_SYMBOL_GPL(usb_phy_gen_create_phy);
index 02799a5efcd448b8c38ee85de7cad8452ffbb617..69462e09d014e7dc15dd5f3f7ad20dd43a9f55bd 100644 (file)
@@ -314,8 +314,6 @@ static int gpio_vbus_probe(struct platform_device *pdev)
                goto err_irq;
        }
 
-       ATOMIC_INIT_NOTIFIER_HEAD(&gpio_vbus->phy.notifier);
-
        INIT_DELAYED_WORK(&gpio_vbus->work, gpio_vbus_work);
 
        gpio_vbus->vbus_draw = regulator_get(&pdev->dev, "vbus_draw");
index 797c45b9ddab1b82669d4480b9fd094ee2b568df..fa44c0f3e861c7c794394e4de3aa3e6e84c2f3f9 100644 (file)
@@ -167,8 +167,6 @@ static int mxs_phy_probe(struct platform_device *pdev)
        mxs_phy->phy.notify_disconnect  = mxs_phy_on_disconnect;
        mxs_phy->phy.type               = USB_PHY_TYPE_USB2;
 
-       ATOMIC_INIT_NOTIFIER_HEAD(&mxs_phy->phy.notifier);
-
        mxs_phy->clk = clk;
 
        platform_set_drvdata(pdev, &mxs_phy->phy);
index 1b74523e1fee5640bad21035b171ef9cf2c5289b..e6f61e4361df6bcd7f4f63b3124961c5b2be0bc0 100644 (file)
@@ -329,6 +329,8 @@ int usb_add_phy(struct usb_phy *x, enum usb_phy_type type)
                return -EINVAL;
        }
 
+       ATOMIC_INIT_NOTIFIER_HEAD(&x->notifier);
+
        spin_lock_irqsave(&phy_lock, flags);
 
        list_for_each_entry(phy, &phy_list, head) {
@@ -367,6 +369,8 @@ int usb_add_phy_dev(struct usb_phy *x)
                return -EINVAL;
        }
 
+       ATOMIC_INIT_NOTIFIER_HEAD(&x->notifier);
+
        spin_lock_irqsave(&phy_lock, flags);
        list_for_each_entry(phy_bind, &phy_bind_list, list)
                if (!(strcmp(phy_bind->phy_dev_name, dev_name(x->dev))))
This page took 0.029395 seconds and 5 git commands to generate.