Re: [PATCH 1/2] usb_gigaset: suspend support

Oliver Neukum <[email protected]>
Newsgroups gmane.linux.usb.devel,gmane.linux.kernel,gmane.linux.isdn.i4l.devel
Message-ID <[email protected]>
Am Montag 29 Oktober 2007 schrieb Tilman Schmidt:
> From: Tilman Schmidt <[email protected]>
> 
> Add basic suspend/resume support to the usb_gigaset driver.
> 
> Signed-off-by: Tilman Schmidt <[email protected]>
> ---
> 
>  drivers/isdn/gigaset/usb-gigaset.c |   69 ++++++++++++++++++++++++++++++++++++-
>  1 file changed, 68 insertions(+), 1 deletion(-)
> 
> --- a/drivers/isdn/gigaset/usb-gigaset.c	2007-10-23 01:48:12.000000000 +0200
> +++ b/drivers/isdn/gigaset/usb-gigaset.c	2007-10-24 00:47:32.000000000 +0200
> @@ -104,10 +104,15 @@ MODULE_DEVICE_TABLE(usb, gigaset_table);
>   * flags per packet.
>   */
>  
> +/* functions called if a device of this driver is connected/disconnected */
>  static int gigaset_probe(struct usb_interface *interface,
>  			 const struct usb_device_id *id);
>  static void gigaset_disconnect(struct usb_interface *interface);
>  
> +/* functions called before/after suspend */
> +static int gigaset_suspend(struct usb_interface *intf, pm_message_t message);
> +static int gigaset_resume(struct usb_interface *intf);
> +
>  static struct gigaset_driver *driver = NULL;
>  static struct cardstate *cardstate = NULL;
>  
> @@ -117,6 +122,11 @@ static struct usb_driver gigaset_usb_dri
>  	.probe =	gigaset_probe,
>  	.disconnect =	gigaset_disconnect,
>  	.id_table =	gigaset_table,
> +	.suspend =	gigaset_suspend,
> +	.resume =	gigaset_resume,
> +	.reset_resume =	gigaset_resume,
> +	.pre_reset =	gigaset_suspend,
> +	.post_reset =	gigaset_resume,
>  };
>  
>  struct usb_cardstate {
> @@ -831,7 +843,7 @@ static void gigaset_disconnect(struct us
>  	usb_set_intfdata(interface, NULL);
>  	tasklet_kill(&cs->write_tasklet);
>  
> -	usb_kill_urb(ucs->bulk_out_urb);	/* FIXME: only if active? */
> +	usb_kill_urb(ucs->bulk_out_urb);
>  
>  	kfree(ucs->bulk_out_buffer);
>  	usb_free_urb(ucs->bulk_out_urb);
> @@ -847,6 +859,63 @@ static void gigaset_disconnect(struct us
>  	gigaset_unassign(cs);
>  }
>  
> +/* gigaset_suspend
> + * This function is called before the USB connection is suspended or reset.
> + */
> +static int gigaset_suspend(struct usb_interface *intf, pm_message_t message)
> +{
> +	struct cardstate *cs;
> +	struct usb_cardstate *ucs;
> +	int rc;
> +
> +	if ((cs = usb_get_intfdata(intf)) == NULL ||
> +	    (ucs = cs->hw.usb) == NULL) {
> +		err("%s: no cardstate", __func__);
> +		return -EFAULT;
> +	}
> +
> +	//FIXME stop common module activities? ISDN_STAT_STOP? block open()?
> +
> +	/* stop submitting bulk URBs */
> +	tasklet_disable(&cs->write_tasklet);
> +
> +	/* kill pending read URB */
> +	usb_kill_urb(ucs->read_urb);

no pending write URB?

	Regards
		Oliver

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
[email protected]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.