Re: [PATCH]suspend/resume support for option driver

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello, Oliver

Sorry for asking this question.

On Fri, 2009-01-23 at 12:02 +0100, Oliver Neukum wrote:
> This patch implements suspend and resume methods for the
> option driver. With my hardware I can even suspend the system
> and keep up a connection for a short time.
> 
> Signed-off-by: Oliver Neukum <oneukum@xxxxxxx>
> 
> 	Regards
> 		Oliver
> 
> ---
> 
> --- a/drivers/usb/serial/option.c
> +++ b/drivers/usb/serial/option.c
> @@ -62,6 +62,8 @@ static int  option_tiocmget(struct tty_struct *tty, struct file *file);
>  static int  option_tiocmset(struct tty_struct *tty, struct file *file,
>  				unsigned int set, unsigned int clear);
>  static int  option_send_setup(struct tty_struct *tty, struct usb_serial_port *port);
> +static int  option_suspend(struct usb_serial *serial, pm_message_t message);
> +static int  option_resume(struct usb_serial *serial);
>  
>  /* Vendor and product IDs */
>  #define OPTION_VENDOR_ID			0x0AF0
> @@ -487,6 +489,8 @@ static struct usb_driver option_driver = {
>  	.name       = "option",
>  	.probe      = usb_serial_probe,
>  	.disconnect = usb_serial_disconnect,
> +	.suspend    = usb_serial_suspend,
> +	.resume     = usb_serial_resume,
>  	.id_table   = option_ids,
>  	.no_dynamic_id = 	1,
>  };
> @@ -515,6 +519,8 @@ static struct usb_serial_driver option_1port_device = {
>  	.attach            = option_startup,
>  	.shutdown          = option_shutdown,
>  	.read_int_callback = option_instat_callback,
> +	.suspend           = option_suspend,
> +	.resume            = option_resume,
>  };
>  
>  static int debug;
> @@ -785,10 +791,10 @@ static void option_instat_callback(struct urb *urb)
>  				req_pkt->bRequestType, req_pkt->bRequest);
>  		}
>  	} else
> -		dbg("%s: error %d", __func__, status);
> +		err("%s: error %d", __func__, status);

Do your patch use err macros defined in usb.h ?
If yes, probably it's better to avoid using it, because this interface
may become deprecated. Anyway, Greg should know sitation better.
If no, sorry for bothering.

Hmmm, btw CodingStyle wants that you place bracers in else section too.
Like this: 

> -	} else
> +	} else {
> -		dbg("%s: error %d", __func__, status);
> +		err("%s: error %d", __func__, status);
> +	}


<snip>

-- 
Best regards, Klimov Alexey

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux