diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/isdn/gigaset/usb-gigaset.c | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/drivers/isdn/gigaset/usb-gigaset.c b/drivers/isdn/gigaset/usb-gigaset.c index d81c0e3f7702..7028911d91ed 100644 --- a/drivers/isdn/gigaset/usb-gigaset.c +++ b/drivers/isdn/gigaset/usb-gigaset.c | |||
@@ -109,6 +109,11 @@ static int gigaset_probe(struct usb_interface *interface, | |||
109 | const struct usb_device_id *id); | 109 | const struct usb_device_id *id); |
110 | static void gigaset_disconnect(struct usb_interface *interface); | 110 | static void gigaset_disconnect(struct usb_interface *interface); |
111 | 111 | ||
112 | /* functions called before/after suspend */ | ||
113 | static int gigaset_suspend(struct usb_interface *intf, pm_message_t message); | ||
114 | static int gigaset_resume(struct usb_interface *intf); | ||
115 | static int gigaset_pre_reset(struct usb_interface *intf); | ||
116 | |||
112 | static struct gigaset_driver *driver = NULL; | 117 | static struct gigaset_driver *driver = NULL; |
113 | static struct cardstate *cardstate = NULL; | 118 | static struct cardstate *cardstate = NULL; |
114 | 119 | ||
@@ -118,6 +123,11 @@ static struct usb_driver gigaset_usb_driver = { | |||
118 | .probe = gigaset_probe, | 123 | .probe = gigaset_probe, |
119 | .disconnect = gigaset_disconnect, | 124 | .disconnect = gigaset_disconnect, |
120 | .id_table = gigaset_table, | 125 | .id_table = gigaset_table, |
126 | .suspend = gigaset_suspend, | ||
127 | .resume = gigaset_resume, | ||
128 | .reset_resume = gigaset_resume, | ||
129 | .pre_reset = gigaset_pre_reset, | ||
130 | .post_reset = gigaset_resume, | ||
121 | }; | 131 | }; |
122 | 132 | ||
123 | struct usb_cardstate { | 133 | struct usb_cardstate { |
@@ -845,6 +855,52 @@ static void gigaset_disconnect(struct usb_interface *interface) | |||
845 | gigaset_unassign(cs); | 855 | gigaset_unassign(cs); |
846 | } | 856 | } |
847 | 857 | ||
858 | /* gigaset_suspend | ||
859 | * This function is called before the USB connection is suspended or reset. | ||
860 | */ | ||
861 | static int gigaset_suspend(struct usb_interface *intf, pm_message_t message) | ||
862 | { | ||
863 | struct cardstate *cs = usb_get_intfdata(intf); | ||
864 | |||
865 | /* stop activity */ | ||
866 | cs->connected = 0; /* prevent rescheduling */ | ||
867 | usb_kill_urb(cs->hw.usb->read_urb); | ||
868 | tasklet_kill(&cs->write_tasklet); | ||
869 | usb_kill_urb(cs->hw.usb->bulk_out_urb); | ||
870 | |||
871 | gig_dbg(DEBUG_SUSPEND, "suspend complete"); | ||
872 | return 0; | ||
873 | } | ||
874 | |||
875 | /* gigaset_resume | ||
876 | * This function is called after the USB connection has been resumed or reset. | ||
877 | */ | ||
878 | static int gigaset_resume(struct usb_interface *intf) | ||
879 | { | ||
880 | struct cardstate *cs = usb_get_intfdata(intf); | ||
881 | int rc; | ||
882 | |||
883 | /* resubmit interrupt URB */ | ||
884 | cs->connected = 1; | ||
885 | rc = usb_submit_urb(cs->hw.usb->read_urb, GFP_KERNEL); | ||
886 | if (rc) { | ||
887 | dev_err(cs->dev, "Could not submit read URB (error %d)\n", -rc); | ||
888 | return rc; | ||
889 | } | ||
890 | |||
891 | gig_dbg(DEBUG_SUSPEND, "resume complete"); | ||
892 | return 0; | ||
893 | } | ||
894 | |||
895 | /* gigaset_pre_reset | ||
896 | * This function is called before the USB connection is reset. | ||
897 | */ | ||
898 | static int gigaset_pre_reset(struct usb_interface *intf) | ||
899 | { | ||
900 | /* same as suspend */ | ||
901 | return gigaset_suspend(intf, PMSG_ON); | ||
902 | } | ||
903 | |||
848 | static const struct gigaset_ops ops = { | 904 | static const struct gigaset_ops ops = { |
849 | gigaset_write_cmd, | 905 | gigaset_write_cmd, |
850 | gigaset_write_room, | 906 | gigaset_write_room, |