Skip to content

Commit

Permalink
usb: phy: initialize the notifier when add a new phy
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Neil Zhang authored and Felipe Balbi committed Dec 12, 2013
1 parent 1b2e21b commit 31e3222
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 7 deletions.
2 changes: 0 additions & 2 deletions drivers/usb/phy/phy-ab8500-usb.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
1 change: 0 additions & 1 deletion drivers/usb/phy/phy-generic.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 0 additions & 2 deletions drivers/usb/phy/phy-gpio-vbus-usb.c
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
2 changes: 0 additions & 2 deletions drivers/usb/phy/phy-mxs-usb.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 4 additions & 0 deletions drivers/usb/phy/phy.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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))))
Expand Down

0 comments on commit 31e3222

Please sign in to comment.