aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/usb
diff options
context:
space:
mode:
authorRobert Jarzmik <robert.jarzmik@free.fr>2009-01-25 02:54:31 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2009-03-24 19:20:26 -0400
commitc2344f13b59e007d782a3e591ebc551bc583a8b7 (patch)
tree17eda364b35d5c064c47e45b50487912844a0fa3 /include/linux/usb
parentdd44be6b17ac52238aa6c7f46b906d9fb76e7052 (diff)
USB: gpio_vbus: add delayed vbus_session calls
Call usb_gadget_vbus_connect() and ...disconnect() from a workqueue rather than from an irq handler, allowing msleep() calls in vbus_session. Update kerneldoc to match. [ dbrownell@users.sourceforge.net: more kerneldoc updates ] Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr> Signed-off-by: David Brownell <dbrownell@users.sourceforge.net> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'include/linux/usb')
-rw-r--r--include/linux/usb/gadget.h6
-rw-r--r--include/linux/usb/otg.h4
2 files changed, 8 insertions, 2 deletions
diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h
index 0460a746480c..bbf45d500b6d 100644
--- a/include/linux/usb/gadget.h
+++ b/include/linux/usb/gadget.h
@@ -598,6 +598,7 @@ static inline int usb_gadget_clear_selfpowered(struct usb_gadget *gadget)
598/** 598/**
599 * usb_gadget_vbus_connect - Notify controller that VBUS is powered 599 * usb_gadget_vbus_connect - Notify controller that VBUS is powered
600 * @gadget:The device which now has VBUS power. 600 * @gadget:The device which now has VBUS power.
601 * Context: can sleep
601 * 602 *
602 * This call is used by a driver for an external transceiver (or GPIO) 603 * This call is used by a driver for an external transceiver (or GPIO)
603 * that detects a VBUS power session starting. Common responses include 604 * that detects a VBUS power session starting. Common responses include
@@ -636,6 +637,7 @@ static inline int usb_gadget_vbus_draw(struct usb_gadget *gadget, unsigned mA)
636/** 637/**
637 * usb_gadget_vbus_disconnect - notify controller about VBUS session end 638 * usb_gadget_vbus_disconnect - notify controller about VBUS session end
638 * @gadget:the device whose VBUS supply is being described 639 * @gadget:the device whose VBUS supply is being described
640 * Context: can sleep
639 * 641 *
640 * This call is used by a driver for an external transceiver (or GPIO) 642 * This call is used by a driver for an external transceiver (or GPIO)
641 * that detects a VBUS power session ending. Common responses include 643 * that detects a VBUS power session ending. Common responses include
@@ -792,19 +794,20 @@ struct usb_gadget_driver {
792/** 794/**
793 * usb_gadget_register_driver - register a gadget driver 795 * usb_gadget_register_driver - register a gadget driver
794 * @driver:the driver being registered 796 * @driver:the driver being registered
797 * Context: can sleep
795 * 798 *
796 * Call this in your gadget driver's module initialization function, 799 * Call this in your gadget driver's module initialization function,
797 * to tell the underlying usb controller driver about your driver. 800 * to tell the underlying usb controller driver about your driver.
798 * The driver's bind() function will be called to bind it to a 801 * The driver's bind() function will be called to bind it to a
799 * gadget before this registration call returns. It's expected that 802 * gadget before this registration call returns. It's expected that
800 * the bind() functions will be in init sections. 803 * the bind() functions will be in init sections.
801 * This function must be called in a context that can sleep.
802 */ 804 */
803int usb_gadget_register_driver(struct usb_gadget_driver *driver); 805int usb_gadget_register_driver(struct usb_gadget_driver *driver);
804 806
805/** 807/**
806 * usb_gadget_unregister_driver - unregister a gadget driver 808 * usb_gadget_unregister_driver - unregister a gadget driver
807 * @driver:the driver being unregistered 809 * @driver:the driver being unregistered
810 * Context: can sleep
808 * 811 *
809 * Call this in your gadget driver's module cleanup function, 812 * Call this in your gadget driver's module cleanup function,
810 * to tell the underlying usb controller that your driver is 813 * to tell the underlying usb controller that your driver is
@@ -813,7 +816,6 @@ int usb_gadget_register_driver(struct usb_gadget_driver *driver);
813 * to unbind() and clean up any device state, before this procedure 816 * to unbind() and clean up any device state, before this procedure
814 * finally returns. It's expected that the unbind() functions 817 * finally returns. It's expected that the unbind() functions
815 * will in in exit sections, so may not be linked in some kernels. 818 * will in in exit sections, so may not be linked in some kernels.
816 * This function must be called in a context that can sleep.
817 */ 819 */
818int usb_gadget_unregister_driver(struct usb_gadget_driver *driver); 820int usb_gadget_unregister_driver(struct usb_gadget_driver *driver);
819 821
diff --git a/include/linux/usb/otg.h b/include/linux/usb/otg.h
index 94df4fe6c6c0..60a52576fd5c 100644
--- a/include/linux/usb/otg.h
+++ b/include/linux/usb/otg.h
@@ -86,6 +86,7 @@ extern int otg_set_transceiver(struct otg_transceiver *);
86extern struct otg_transceiver *otg_get_transceiver(void); 86extern struct otg_transceiver *otg_get_transceiver(void);
87extern void otg_put_transceiver(struct otg_transceiver *); 87extern void otg_put_transceiver(struct otg_transceiver *);
88 88
89/* Context: can sleep */
89static inline int 90static inline int
90otg_start_hnp(struct otg_transceiver *otg) 91otg_start_hnp(struct otg_transceiver *otg)
91{ 92{
@@ -102,6 +103,8 @@ otg_set_host(struct otg_transceiver *otg, struct usb_bus *host)
102 103
103 104
104/* for usb peripheral controller drivers */ 105/* for usb peripheral controller drivers */
106
107/* Context: can sleep */
105static inline int 108static inline int
106otg_set_peripheral(struct otg_transceiver *otg, struct usb_gadget *periph) 109otg_set_peripheral(struct otg_transceiver *otg, struct usb_gadget *periph)
107{ 110{
@@ -114,6 +117,7 @@ otg_set_power(struct otg_transceiver *otg, unsigned mA)
114 return otg->set_power(otg, mA); 117 return otg->set_power(otg, mA);
115} 118}
116 119
120/* Context: can sleep */
117static inline int 121static inline int
118otg_set_suspend(struct otg_transceiver *otg, int suspend) 122otg_set_suspend(struct otg_transceiver *otg, int suspend)
119{ 123{