aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFelipe Balbi <balbi@ti.com>2010-09-29 03:55:49 -0400
committerFelipe Balbi <balbi@ti.com>2011-02-18 07:05:54 -0500
commitcccad6d4b103e53fb3d1fc1467f654ecb572d047 (patch)
tree83403c73c85247aeffa82ceaea6d9a5ec726235d
parent002eda1348788f623dc42231dcda5f591d753124 (diff)
usb: otg: notifier: switch to atomic notifier
most of our notifications, will be called from IRQ context, so an atomic notifier suits the job better. Signed-off-by: Felipe Balbi <balbi@ti.com>
-rw-r--r--drivers/usb/otg/ab8500-usb.c6
-rw-r--r--drivers/usb/otg/nop-usb-xceiv.c2
-rw-r--r--drivers/usb/otg/twl4030-usb.c6
-rw-r--r--drivers/usb/otg/twl6030-usb.c8
-rw-r--r--include/linux/usb/otg.h6
5 files changed, 14 insertions, 14 deletions
diff --git a/drivers/usb/otg/ab8500-usb.c b/drivers/usb/otg/ab8500-usb.c
index d14736b3107b..07ccea9ada40 100644
--- a/drivers/usb/otg/ab8500-usb.c
+++ b/drivers/usb/otg/ab8500-usb.c
@@ -212,7 +212,7 @@ static int ab8500_usb_link_status_update(struct ab8500_usb *ab)
212 break; 212 break;
213 } 213 }
214 214
215 blocking_notifier_call_chain(&ab->otg.notifier, event, v); 215 atomic_notifier_call_chain(&ab->otg.notifier, event, v);
216 216
217 return 0; 217 return 0;
218} 218}
@@ -281,7 +281,7 @@ static int ab8500_usb_set_power(struct otg_transceiver *otg, unsigned mA)
281 ab->vbus_draw = mA; 281 ab->vbus_draw = mA;
282 282
283 if (mA) 283 if (mA)
284 blocking_notifier_call_chain(&ab->otg.notifier, 284 atomic_notifier_call_chain(&ab->otg.notifier,
285 USB_EVENT_ENUMERATED, ab->otg.gadget); 285 USB_EVENT_ENUMERATED, ab->otg.gadget);
286 return 0; 286 return 0;
287} 287}
@@ -500,7 +500,7 @@ static int __devinit ab8500_usb_probe(struct platform_device *pdev)
500 500
501 platform_set_drvdata(pdev, ab); 501 platform_set_drvdata(pdev, ab);
502 502
503 BLOCKING_INIT_NOTIFIER_HEAD(&ab->otg.notifier); 503 ATOMIC_INIT_NOTIFIER_HEAD(&ab->otg.notifier);
504 504
505 /* v1: Wait for link status to become stable. 505 /* v1: Wait for link status to become stable.
506 * all: Updates form set_host and set_peripheral as they are atomic. 506 * all: Updates form set_host and set_peripheral as they are atomic.
diff --git a/drivers/usb/otg/nop-usb-xceiv.c b/drivers/usb/otg/nop-usb-xceiv.c
index 8acf165fe13b..c1e360046435 100644
--- a/drivers/usb/otg/nop-usb-xceiv.c
+++ b/drivers/usb/otg/nop-usb-xceiv.c
@@ -132,7 +132,7 @@ static int __devinit nop_usb_xceiv_probe(struct platform_device *pdev)
132 132
133 platform_set_drvdata(pdev, nop); 133 platform_set_drvdata(pdev, nop);
134 134
135 BLOCKING_INIT_NOTIFIER_HEAD(&nop->otg.notifier); 135 ATOMIC_INIT_NOTIFIER_HEAD(&nop->otg.notifier);
136 136
137 return 0; 137 return 0;
138exit: 138exit:
diff --git a/drivers/usb/otg/twl4030-usb.c b/drivers/usb/otg/twl4030-usb.c
index 6ca505f333e4..2362d8352bc8 100644
--- a/drivers/usb/otg/twl4030-usb.c
+++ b/drivers/usb/otg/twl4030-usb.c
@@ -512,7 +512,7 @@ static irqreturn_t twl4030_usb_irq(int irq, void *_twl)
512 else 512 else
513 twl4030_phy_resume(twl); 513 twl4030_phy_resume(twl);
514 514
515 blocking_notifier_call_chain(&twl->otg.notifier, status, 515 atomic_notifier_call_chain(&twl->otg.notifier, status,
516 twl->otg.gadget); 516 twl->otg.gadget);
517 } 517 }
518 sysfs_notify(&twl->dev->kobj, NULL, "vbus"); 518 sysfs_notify(&twl->dev->kobj, NULL, "vbus");
@@ -534,7 +534,7 @@ static void twl4030_usb_phy_init(struct twl4030_usb *twl)
534 twl->asleep = 0; 534 twl->asleep = 0;
535 } 535 }
536 536
537 blocking_notifier_call_chain(&twl->otg.notifier, status, 537 atomic_notifier_call_chain(&twl->otg.notifier, status,
538 twl->otg.gadget); 538 twl->otg.gadget);
539 } 539 }
540 sysfs_notify(&twl->dev->kobj, NULL, "vbus"); 540 sysfs_notify(&twl->dev->kobj, NULL, "vbus");
@@ -623,7 +623,7 @@ static int __devinit twl4030_usb_probe(struct platform_device *pdev)
623 if (device_create_file(&pdev->dev, &dev_attr_vbus)) 623 if (device_create_file(&pdev->dev, &dev_attr_vbus))
624 dev_warn(&pdev->dev, "could not create sysfs file\n"); 624 dev_warn(&pdev->dev, "could not create sysfs file\n");
625 625
626 BLOCKING_INIT_NOTIFIER_HEAD(&twl->otg.notifier); 626 ATOMIC_INIT_NOTIFIER_HEAD(&twl->otg.notifier);
627 627
628 /* Our job is to use irqs and status from the power module 628 /* Our job is to use irqs and status from the power module
629 * to keep the transceiver disabled when nothing's connected. 629 * to keep the transceiver disabled when nothing's connected.
diff --git a/drivers/usb/otg/twl6030-usb.c b/drivers/usb/otg/twl6030-usb.c
index 05f17b77d54c..8a91b4b832a1 100644
--- a/drivers/usb/otg/twl6030-usb.c
+++ b/drivers/usb/otg/twl6030-usb.c
@@ -263,13 +263,13 @@ static irqreturn_t twl6030_usb_irq(int irq, void *_twl)
263 twl->otg.state = OTG_STATE_B_IDLE; 263 twl->otg.state = OTG_STATE_B_IDLE;
264 twl->linkstat = status; 264 twl->linkstat = status;
265 twl->otg.last_event = status; 265 twl->otg.last_event = status;
266 blocking_notifier_call_chain(&twl->otg.notifier, 266 atomic_notifier_call_chain(&twl->otg.notifier,
267 status, twl->otg.gadget); 267 status, twl->otg.gadget);
268 } else { 268 } else {
269 status = USB_EVENT_NONE; 269 status = USB_EVENT_NONE;
270 twl->linkstat = status; 270 twl->linkstat = status;
271 twl->otg.last_event = status; 271 twl->otg.last_event = status;
272 blocking_notifier_call_chain(&twl->otg.notifier, 272 atomic_notifier_call_chain(&twl->otg.notifier,
273 status, twl->otg.gadget); 273 status, twl->otg.gadget);
274 if (twl->asleep) { 274 if (twl->asleep) {
275 regulator_disable(twl->usb3v3); 275 regulator_disable(twl->usb3v3);
@@ -302,7 +302,7 @@ static irqreturn_t twl6030_usbotg_irq(int irq, void *_twl)
302 twl->otg.state = OTG_STATE_A_IDLE; 302 twl->otg.state = OTG_STATE_A_IDLE;
303 twl->linkstat = status; 303 twl->linkstat = status;
304 twl->otg.last_event = status; 304 twl->otg.last_event = status;
305 blocking_notifier_call_chain(&twl->otg.notifier, status, 305 atomic_notifier_call_chain(&twl->otg.notifier, status,
306 twl->otg.gadget); 306 twl->otg.gadget);
307 } else { 307 } else {
308 twl6030_writeb(twl, TWL_MODULE_USB, USB_ID_INT_EN_HI_CLR, 308 twl6030_writeb(twl, TWL_MODULE_USB, USB_ID_INT_EN_HI_CLR,
@@ -419,7 +419,7 @@ static int __devinit twl6030_usb_probe(struct platform_device *pdev)
419 if (device_create_file(&pdev->dev, &dev_attr_vbus)) 419 if (device_create_file(&pdev->dev, &dev_attr_vbus))
420 dev_warn(&pdev->dev, "could not create sysfs file\n"); 420 dev_warn(&pdev->dev, "could not create sysfs file\n");
421 421
422 BLOCKING_INIT_NOTIFIER_HEAD(&twl->otg.notifier); 422 ATOMIC_INIT_NOTIFIER_HEAD(&twl->otg.notifier);
423 423
424 twl->irq_enabled = true; 424 twl->irq_enabled = true;
425 status = request_threaded_irq(twl->irq1, NULL, twl6030_usbotg_irq, 425 status = request_threaded_irq(twl->irq1, NULL, twl6030_usbotg_irq,
diff --git a/include/linux/usb/otg.h b/include/linux/usb/otg.h
index da511eec3cb8..6e40718f5abe 100644
--- a/include/linux/usb/otg.h
+++ b/include/linux/usb/otg.h
@@ -75,7 +75,7 @@ struct otg_transceiver {
75 void __iomem *io_priv; 75 void __iomem *io_priv;
76 76
77 /* for notification of usb_xceiv_events */ 77 /* for notification of usb_xceiv_events */
78 struct blocking_notifier_head notifier; 78 struct atomic_notifier_head notifier;
79 79
80 /* to pass extra port status to the root hub */ 80 /* to pass extra port status to the root hub */
81 u16 port_status; 81 u16 port_status;
@@ -235,13 +235,13 @@ otg_start_srp(struct otg_transceiver *otg)
235static inline int 235static inline int
236otg_register_notifier(struct otg_transceiver *otg, struct notifier_block *nb) 236otg_register_notifier(struct otg_transceiver *otg, struct notifier_block *nb)
237{ 237{
238 return blocking_notifier_chain_register(&otg->notifier, nb); 238 return atomic_notifier_chain_register(&otg->notifier, nb);
239} 239}
240 240
241static inline void 241static inline void
242otg_unregister_notifier(struct otg_transceiver *otg, struct notifier_block *nb) 242otg_unregister_notifier(struct otg_transceiver *otg, struct notifier_block *nb)
243{ 243{
244 blocking_notifier_chain_unregister(&otg->notifier, nb); 244 atomic_notifier_chain_unregister(&otg->notifier, nb);
245} 245}
246 246
247/* for OTG controller drivers (and maybe other stuff) */ 247/* for OTG controller drivers (and maybe other stuff) */