Skip to contentSkip to conversation

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

PATCH Superseded Neil Zhang 1 participant 2 messages Dec 11, 2013

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Neil Zhang

author
#0 lore raw

PATCH 1/1 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.

---
 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(-)
drivers/usb/phy/phy-ab8500-usb.c +0 -2
index 0874023..11ab2c4 100644
@@ -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);
 
drivers/usb/phy/phy-generic.c +0 -1
index aa6d37b..bb39498 100644
@@ -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);
drivers/usb/phy/phy-gpio-vbus-usb.c +0 -2
index 02799a5..69462e0 100644
@@ -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");
drivers/usb/phy/phy-mxs-usb.c +0 -2
index 545844b..9df81f0 100644
@@ -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);
drivers/usb/phy/phy.c +4 -0
index 1b74523..6689bd0 100644
@@ -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))))
Signature · 1 line
1.7.9.5
author
#1 lore raw
Quoted 101 lines

-----Original Message-----
From: Neil Zhang [mailto:[email protected]]
Sent: 2013年12月11日 14:18
To: [email protected]; [email protected]
Cc: [email protected]; [email protected]; 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.

---
 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(-)
drivers/usb/phy/phy-ab8500-usb.c +0 -2
index 0874023..11ab2c4 100644
@@ -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);
drivers/usb/phy/phy-generic.c index renamed from drivers/usb/phy/phy-generic.c +0 -0

aa6d37b..bb39498 100644

drivers/usb/phy/phy-generic.c +0 -1
@@ -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);

drivers/usb/phy/phy-gpio-vbus-usb.c +0 -2
index 02799a5..69462e0 100644
@@ -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

drivers/usb/phy/phy-mxs-usb.c +0 -2
@@ -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;
 
drivers/usb/phy/phy-mxs-usb.c +0 -0
 	platform_set_drvdata(pdev, mxs_phy);
drivers/usb/phy/phy.c index renamed from drivers/usb/phy/phy.c +0 -0

1b74523..6689bd0 100644

drivers/usb/phy/phy.c +2 -0
@@ -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)

drivers/usb/phy/phy.c +2 -1
 		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))))
--
Quoted 1 line

1.7.9.5

Please ignore this one and check patch v2.
Thanks.

Best Regards,
Neil Zhang �翳簕.n�+壏煯壄�+%娝�遍荻w�簕.n�+壏{炳G珴�妠ay�蕠跈�,jf"穐殢飦�戧鐉_璁(殠娸"濟�m���G珴�⒏?櫒璀�&x忈秈O曟瑉窔v豝�m��� �鹅�⒏?朓�