* [PATCH] usb: phy: initilize the notifier when add a new phy
@ 2013-12-11 6:18 Neil Zhang
2013-12-11 6:46 ` Neil Zhang
0 siblings, 1 reply; 2+ messages in thread
From: Neil Zhang @ 2013-12-11 6:18 UTC (permalink / raw)
To: balbi, gregkh; +Cc: linux-usb, linux-kernel, Neil Zhang
We need to initilize the notifer before use it.
So lets initilize it when add a new phy device to reduce the code
redundance.
Signed-off-by: Neil Zhang <zhangwm@marvell.com>
---
drivers/usb/phy/phy-ab8500-usb.c | 2 --
drivers/usb/phy/phy-generic.c | 1 -
drivers/usb/phy/phy-gpio-vbus-usb.c | 2 --
drivers/usb/phy/phy-mxs-usb.c | 2 --
drivers/usb/phy/phy.c | 4 ++++
5 files changed, 4 insertions(+), 7 deletions(-)
diff --git a/drivers/usb/phy/phy-ab8500-usb.c b/drivers/usb/phy/phy-ab8500-usb.c
index 0874023..11ab2c4 100644
--- a/drivers/usb/phy/phy-ab8500-usb.c
+++ b/drivers/usb/phy/phy-ab8500-usb.c
@@ -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);
diff --git a/drivers/usb/phy/phy-generic.c b/drivers/usb/phy/phy-generic.c
index aa6d37b..bb39498 100644
--- a/drivers/usb/phy/phy-generic.c
+++ b/drivers/usb/phy/phy-generic.c
@@ -241,7 +241,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);
diff --git a/drivers/usb/phy/phy-gpio-vbus-usb.c b/drivers/usb/phy/phy-gpio-vbus-usb.c
index 02799a5..69462e0 100644
--- a/drivers/usb/phy/phy-gpio-vbus-usb.c
+++ b/drivers/usb/phy/phy-gpio-vbus-usb.c
@@ -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");
diff --git a/drivers/usb/phy/phy-mxs-usb.c b/drivers/usb/phy/phy-mxs-usb.c
index 545844b..9df81f0 100644
--- a/drivers/usb/phy/phy-mxs-usb.c
+++ b/drivers/usb/phy/phy-mxs-usb.c
@@ -160,8 +160,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);
diff --git a/drivers/usb/phy/phy.c b/drivers/usb/phy/phy.c
index 1b74523..6689bd0 100644
--- a/drivers/usb/phy/phy.c
+++ b/drivers/usb/phy/phy.c
@@ -329,6 +329,8 @@ int usb_add_phy(struct usb_phy *x, enum usb_phy_type type)
return -EINVAL;
}
+ ATOMIC_INIT_NOTIFIER_HEAD(&ab->phy.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(&ab->phy.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))))
--
1.7.9.5
^ permalink raw reply [flat|nested] 2+ messages in thread
* RE: [PATCH] usb: phy: initilize the notifier when add a new phy
2013-12-11 6:18 [PATCH] usb: phy: initilize the notifier when add a new phy Neil Zhang
@ 2013-12-11 6:46 ` Neil Zhang
0 siblings, 0 replies; 2+ messages in thread
From: Neil Zhang @ 2013-12-11 6:46 UTC (permalink / raw)
To: Neil Zhang, balbi, gregkh; +Cc: linux-usb, linux-kernel
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="gb2312", Size: 3789 bytes --]
> -----Original Message-----
> From: Neil Zhang [mailto:zhangwm@marvell.com]
> Sent: 2013Äê12ÔÂ11ÈÕ 14:18
> To: balbi@ti.com; gregkh@linuxfoundation.org
> Cc: linux-usb@vger.kernel.org; linux-kernel@vger.kernel.org; Neil Zhang
> Subject: [PATCH] usb: phy: initilize the notifier when add a new phy
>
> We need to initilize the notifer before use it.
> So lets initilize it when add a new phy device to reduce the code redundance.
>
> Signed-off-by: Neil Zhang <zhangwm@marvell.com>
> ---
> drivers/usb/phy/phy-ab8500-usb.c | 2 --
> drivers/usb/phy/phy-generic.c | 1 -
> drivers/usb/phy/phy-gpio-vbus-usb.c | 2 --
> drivers/usb/phy/phy-mxs-usb.c | 2 --
> drivers/usb/phy/phy.c | 4 ++++
> 5 files changed, 4 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/usb/phy/phy-ab8500-usb.c
> b/drivers/usb/phy/phy-ab8500-usb.c
> index 0874023..11ab2c4 100644
> --- a/drivers/usb/phy/phy-ab8500-usb.c
> +++ b/drivers/usb/phy/phy-ab8500-usb.c
> @@ -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);
>
> diff --git a/drivers/usb/phy/phy-generic.c b/drivers/usb/phy/phy-generic.c index
> aa6d37b..bb39498 100644
> --- a/drivers/usb/phy/phy-generic.c
> +++ b/drivers/usb/phy/phy-generic.c
> @@ -241,7 +241,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);
> diff --git a/drivers/usb/phy/phy-gpio-vbus-usb.c
> b/drivers/usb/phy/phy-gpio-vbus-usb.c
> index 02799a5..69462e0 100644
> --- a/drivers/usb/phy/phy-gpio-vbus-usb.c
> +++ b/drivers/usb/phy/phy-gpio-vbus-usb.c
> @@ -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"); diff
> --git a/drivers/usb/phy/phy-mxs-usb.c b/drivers/usb/phy/phy-mxs-usb.c index
> 545844b..9df81f0 100644
> --- a/drivers/usb/phy/phy-mxs-usb.c
> +++ b/drivers/usb/phy/phy-mxs-usb.c
> @@ -160,8 +160,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);
> diff --git a/drivers/usb/phy/phy.c b/drivers/usb/phy/phy.c index
> 1b74523..6689bd0 100644
> --- a/drivers/usb/phy/phy.c
> +++ b/drivers/usb/phy/phy.c
> @@ -329,6 +329,8 @@ int usb_add_phy(struct usb_phy *x, enum
> usb_phy_type type)
> return -EINVAL;
> }
>
> + ATOMIC_INIT_NOTIFIER_HEAD(&ab->phy.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(&ab->phy.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))))
> --
> 1.7.9.5
Please ignore this one and check patch v2.
Thanks.
Best Regards,
Neil Zhang
ÿôèº{.nÇ+·®+%Ëÿ±éݶ\x17¥wÿº{.nÇ+·¥{±þG«éÿ{ayº\x1dÊÚë,j\a¢f£¢·hïêÿêçz_è®\x03(éÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?¨èÚ&£ø§~á¶iOæ¬z·vØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?I¥
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-12-11 6:47 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-12-11 6:18 [PATCH] usb: phy: initilize the notifier when add a new phy Neil Zhang
2013-12-11 6:46 ` Neil Zhang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®