Commit 31e322272d9d7da0724ae6e3180478575aa48909

Authored by Neil Zhang
Committed by Felipe Balbi
1 parent 1b2e21b082

usb: phy: initialize the notifier when add a new phy

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>

Showing 5 changed files with 4 additions and 7 deletions Side-by-side Diff

drivers/usb/phy/phy-ab8500-usb.c
... ... @@ -1415,8 +1415,6 @@
1415 1415  
1416 1416 platform_set_drvdata(pdev, ab);
1417 1417  
1418   - ATOMIC_INIT_NOTIFIER_HEAD(&ab->phy.notifier);
1419   -
1420 1418 /* all: Disable phy when called from set_host and set_peripheral */
1421 1419 INIT_WORK(&ab->phy_dis_work, ab8500_usb_phy_disable_work);
1422 1420  
drivers/usb/phy/phy-generic.c
... ... @@ -210,7 +210,6 @@
210 210 nop->phy.otg->set_host = nop_set_host;
211 211 nop->phy.otg->set_peripheral = nop_set_peripheral;
212 212  
213   - ATOMIC_INIT_NOTIFIER_HEAD(&nop->phy.notifier);
214 213 return 0;
215 214 }
216 215 EXPORT_SYMBOL_GPL(usb_phy_gen_create_phy);
drivers/usb/phy/phy-gpio-vbus-usb.c
... ... @@ -314,8 +314,6 @@
314 314 goto err_irq;
315 315 }
316 316  
317   - ATOMIC_INIT_NOTIFIER_HEAD(&gpio_vbus->phy.notifier);
318   -
319 317 INIT_DELAYED_WORK(&gpio_vbus->work, gpio_vbus_work);
320 318  
321 319 gpio_vbus->vbus_draw = regulator_get(&pdev->dev, "vbus_draw");
drivers/usb/phy/phy-mxs-usb.c
... ... @@ -167,8 +167,6 @@
167 167 mxs_phy->phy.notify_disconnect = mxs_phy_on_disconnect;
168 168 mxs_phy->phy.type = USB_PHY_TYPE_USB2;
169 169  
170   - ATOMIC_INIT_NOTIFIER_HEAD(&mxs_phy->phy.notifier);
171   -
172 170 mxs_phy->clk = clk;
173 171  
174 172 platform_set_drvdata(pdev, &mxs_phy->phy);
drivers/usb/phy/phy.c
... ... @@ -329,6 +329,8 @@
329 329 return -EINVAL;
330 330 }
331 331  
  332 + ATOMIC_INIT_NOTIFIER_HEAD(&x->notifier);
  333 +
332 334 spin_lock_irqsave(&phy_lock, flags);
333 335  
334 336 list_for_each_entry(phy, &phy_list, head) {
... ... @@ -366,6 +368,8 @@
366 368 dev_err(x->dev, "no device provided for PHY\n");
367 369 return -EINVAL;
368 370 }
  371 +
  372 + ATOMIC_INIT_NOTIFIER_HEAD(&x->notifier);
369 373  
370 374 spin_lock_irqsave(&phy_lock, flags);
371 375 list_for_each_entry(phy_bind, &phy_bind_list, list)