mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-23 01:10:04 +00:00
[PATCH] USB: option card driver coding style tweaks
Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
parent
b9db07fba7
commit
7bb75aeeee
1 changed files with 89 additions and 106 deletions
|
@ -45,29 +45,29 @@
|
||||||
#include "usb-serial.h"
|
#include "usb-serial.h"
|
||||||
|
|
||||||
/* Function prototypes */
|
/* Function prototypes */
|
||||||
static int option_open (struct usb_serial_port *port, struct file *filp);
|
static int option_open(struct usb_serial_port *port, struct file *filp);
|
||||||
static void option_close (struct usb_serial_port *port, struct file *filp);
|
static void option_close(struct usb_serial_port *port, struct file *filp);
|
||||||
static int option_startup (struct usb_serial *serial);
|
static int option_startup(struct usb_serial *serial);
|
||||||
static void option_shutdown (struct usb_serial *serial);
|
static void option_shutdown(struct usb_serial *serial);
|
||||||
static void option_rx_throttle (struct usb_serial_port *port);
|
static void option_rx_throttle(struct usb_serial_port *port);
|
||||||
static void option_rx_unthrottle (struct usb_serial_port *port);
|
static void option_rx_unthrottle(struct usb_serial_port *port);
|
||||||
static int option_write_room (struct usb_serial_port *port);
|
static int option_write_room(struct usb_serial_port *port);
|
||||||
|
|
||||||
static void option_instat_callback(struct urb *urb, struct pt_regs *regs);
|
static void option_instat_callback(struct urb *urb, struct pt_regs *regs);
|
||||||
|
|
||||||
static int option_write (struct usb_serial_port *port,
|
static int option_write(struct usb_serial_port *port,
|
||||||
const unsigned char *buf, int count);
|
const unsigned char *buf, int count);
|
||||||
|
|
||||||
static int option_chars_in_buffer (struct usb_serial_port *port);
|
static int option_chars_in_buffer(struct usb_serial_port *port);
|
||||||
static int option_ioctl (struct usb_serial_port *port, struct file *file,
|
static int option_ioctl(struct usb_serial_port *port, struct file *file,
|
||||||
unsigned int cmd, unsigned long arg);
|
unsigned int cmd, unsigned long arg);
|
||||||
static void option_set_termios (struct usb_serial_port *port,
|
static void option_set_termios(struct usb_serial_port *port,
|
||||||
struct termios *old);
|
struct termios *old);
|
||||||
static void option_break_ctl (struct usb_serial_port *port, int break_state);
|
static void option_break_ctl(struct usb_serial_port *port, int break_state);
|
||||||
static int option_tiocmget (struct usb_serial_port *port, struct file *file);
|
static int option_tiocmget(struct usb_serial_port *port, struct file *file);
|
||||||
static int option_tiocmset (struct usb_serial_port *port, struct file *file,
|
static int option_tiocmset(struct usb_serial_port *port, struct file *file,
|
||||||
unsigned int set, unsigned int clear);
|
unsigned int set, unsigned int clear);
|
||||||
static int option_send_setup (struct usb_serial_port *port);
|
static int option_send_setup(struct usb_serial_port *port);
|
||||||
|
|
||||||
/* Vendor and product IDs */
|
/* Vendor and product IDs */
|
||||||
#define OPTION_VENDOR_ID 0x0AF0
|
#define OPTION_VENDOR_ID 0x0AF0
|
||||||
|
@ -76,7 +76,6 @@ static int option_send_setup (struct usb_serial_port *port);
|
||||||
#define OPTION_PRODUCT_FUSION 0x6000
|
#define OPTION_PRODUCT_FUSION 0x6000
|
||||||
#define OPTION_PRODUCT_FUSION2 0x6300
|
#define OPTION_PRODUCT_FUSION2 0x6300
|
||||||
|
|
||||||
|
|
||||||
static struct usb_device_id option_ids[] = {
|
static struct usb_device_id option_ids[] = {
|
||||||
{ USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_OLD) },
|
{ USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_OLD) },
|
||||||
{ USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_FUSION) },
|
{ USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_FUSION) },
|
||||||
|
@ -129,7 +128,6 @@ static int debug;
|
||||||
#define debug 0
|
#define debug 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* per port private data */
|
/* per port private data */
|
||||||
|
|
||||||
#define N_IN_URB 4
|
#define N_IN_URB 4
|
||||||
|
@ -156,10 +154,8 @@ struct option_port_private {
|
||||||
unsigned long tx_start_time[N_OUT_URB];
|
unsigned long tx_start_time[N_OUT_URB];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/* Functions used by new usb-serial code. */
|
/* Functions used by new usb-serial code. */
|
||||||
static int __init
|
static int __init option_init(void)
|
||||||
option_init (void)
|
|
||||||
{
|
{
|
||||||
int retval;
|
int retval;
|
||||||
retval = usb_serial_register(&option_3port_device);
|
retval = usb_serial_register(&option_3port_device);
|
||||||
|
@ -179,8 +175,7 @@ option_init (void)
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void __exit
|
static void __exit option_exit(void)
|
||||||
option_exit (void)
|
|
||||||
{
|
{
|
||||||
usb_deregister (&option_driver);
|
usb_deregister (&option_driver);
|
||||||
usb_serial_deregister (&option_3port_device);
|
usb_serial_deregister (&option_3port_device);
|
||||||
|
@ -189,39 +184,31 @@ option_exit (void)
|
||||||
module_init(option_init);
|
module_init(option_init);
|
||||||
module_exit(option_exit);
|
module_exit(option_exit);
|
||||||
|
|
||||||
static void
|
static void option_rx_throttle(struct usb_serial_port *port)
|
||||||
option_rx_throttle (struct usb_serial_port *port)
|
|
||||||
{
|
{
|
||||||
dbg("%s", __FUNCTION__);
|
dbg("%s", __FUNCTION__);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void option_rx_unthrottle(struct usb_serial_port *port)
|
||||||
static void
|
|
||||||
option_rx_unthrottle (struct usb_serial_port *port)
|
|
||||||
{
|
{
|
||||||
dbg("%s", __FUNCTION__);
|
dbg("%s", __FUNCTION__);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void option_break_ctl(struct usb_serial_port *port, int break_state)
|
||||||
static void
|
|
||||||
option_break_ctl (struct usb_serial_port *port, int break_state)
|
|
||||||
{
|
{
|
||||||
/* Unfortunately, I don't know how to send a break */
|
/* Unfortunately, I don't know how to send a break */
|
||||||
dbg("%s", __FUNCTION__);
|
dbg("%s", __FUNCTION__);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void option_set_termios(struct usb_serial_port *port,
|
||||||
static void
|
struct termios *old_termios)
|
||||||
option_set_termios (struct usb_serial_port *port,
|
|
||||||
struct termios *old_termios)
|
|
||||||
{
|
{
|
||||||
dbg("%s", __FUNCTION__);
|
dbg("%s", __FUNCTION__);
|
||||||
|
|
||||||
option_send_setup(port);
|
option_send_setup(port);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int option_tiocmget(struct usb_serial_port *port, struct file *file)
|
||||||
option_tiocmget (struct usb_serial_port *port, struct file *file)
|
|
||||||
{
|
{
|
||||||
unsigned int value;
|
unsigned int value;
|
||||||
struct option_port_private *portdata;
|
struct option_port_private *portdata;
|
||||||
|
@ -238,9 +225,8 @@ option_tiocmget (struct usb_serial_port *port, struct file *file)
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int option_tiocmset(struct usb_serial_port *port, struct file *file,
|
||||||
option_tiocmset (struct usb_serial_port *port, struct file *file,
|
unsigned int set, unsigned int clear)
|
||||||
unsigned int set, unsigned int clear)
|
|
||||||
{
|
{
|
||||||
struct option_port_private *portdata;
|
struct option_port_private *portdata;
|
||||||
|
|
||||||
|
@ -258,17 +244,15 @@ option_tiocmset (struct usb_serial_port *port, struct file *file,
|
||||||
return option_send_setup(port);
|
return option_send_setup(port);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int option_ioctl(struct usb_serial_port *port, struct file *file,
|
||||||
option_ioctl (struct usb_serial_port *port, struct file *file,
|
unsigned int cmd, unsigned long arg)
|
||||||
unsigned int cmd, unsigned long arg)
|
|
||||||
{
|
{
|
||||||
return -ENOIOCTLCMD;
|
return -ENOIOCTLCMD;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Write */
|
/* Write */
|
||||||
static int
|
static int option_write(struct usb_serial_port *port,
|
||||||
option_write (struct usb_serial_port *port,
|
const unsigned char *buf, int count)
|
||||||
const unsigned char *buf, int count)
|
|
||||||
{
|
{
|
||||||
struct option_port_private *portdata;
|
struct option_port_private *portdata;
|
||||||
int i;
|
int i;
|
||||||
|
@ -291,16 +275,19 @@ option_write (struct usb_serial_port *port,
|
||||||
if (this_urb->status == -EINPROGRESS) {
|
if (this_urb->status == -EINPROGRESS) {
|
||||||
if (this_urb->transfer_flags & URB_ASYNC_UNLINK)
|
if (this_urb->transfer_flags & URB_ASYNC_UNLINK)
|
||||||
continue;
|
continue;
|
||||||
if (time_before(jiffies, portdata->tx_start_time[i] + 10 * HZ))
|
if (time_before(jiffies,
|
||||||
|
portdata->tx_start_time[i] + 10 * HZ))
|
||||||
continue;
|
continue;
|
||||||
this_urb->transfer_flags |= URB_ASYNC_UNLINK;
|
this_urb->transfer_flags |= URB_ASYNC_UNLINK;
|
||||||
usb_unlink_urb(this_urb);
|
usb_unlink_urb(this_urb);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (this_urb->status != 0)
|
if (this_urb->status != 0)
|
||||||
dbg("usb_write %p failed (err=%d)", this_urb, this_urb->status);
|
dbg("usb_write %p failed (err=%d)",
|
||||||
|
this_urb, this_urb->status);
|
||||||
|
|
||||||
dbg("%s: endpoint %d buf %d", __FUNCTION__, usb_pipeendpoint(this_urb->pipe), i);
|
dbg("%s: endpoint %d buf %d", __FUNCTION__,
|
||||||
|
usb_pipeendpoint(this_urb->pipe), i);
|
||||||
|
|
||||||
/* send the data */
|
/* send the data */
|
||||||
memcpy (this_urb->transfer_buffer, buf, todo);
|
memcpy (this_urb->transfer_buffer, buf, todo);
|
||||||
|
@ -310,7 +297,9 @@ option_write (struct usb_serial_port *port,
|
||||||
this_urb->dev = port->serial->dev;
|
this_urb->dev = port->serial->dev;
|
||||||
err = usb_submit_urb(this_urb, GFP_ATOMIC);
|
err = usb_submit_urb(this_urb, GFP_ATOMIC);
|
||||||
if (err) {
|
if (err) {
|
||||||
dbg("usb_submit_urb %p (write bulk) failed (%d, has %d)", this_urb, err, this_urb->status);
|
dbg("usb_submit_urb %p (write bulk) failed "
|
||||||
|
"(%d, has %d)", this_urb,
|
||||||
|
err, this_urb->status);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
portdata->tx_start_time[i] = jiffies;
|
portdata->tx_start_time[i] = jiffies;
|
||||||
|
@ -323,8 +312,7 @@ option_write (struct usb_serial_port *port,
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void option_indat_callback(struct urb *urb, struct pt_regs *regs)
|
||||||
option_indat_callback (struct urb *urb, struct pt_regs *regs)
|
|
||||||
{
|
{
|
||||||
int i, err;
|
int i, err;
|
||||||
int endpoint;
|
int endpoint;
|
||||||
|
@ -357,14 +345,14 @@ option_indat_callback (struct urb *urb, struct pt_regs *regs)
|
||||||
if (port->open_count && urb->status != -ESHUTDOWN) {
|
if (port->open_count && urb->status != -ESHUTDOWN) {
|
||||||
err = usb_submit_urb(urb, GFP_ATOMIC);
|
err = usb_submit_urb(urb, GFP_ATOMIC);
|
||||||
if (err)
|
if (err)
|
||||||
printk(KERN_ERR "%s: resubmit read urb failed. (%d)", __FUNCTION__, err);
|
printk(KERN_ERR "%s: resubmit read urb failed. "
|
||||||
|
"(%d)", __FUNCTION__, err);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void option_outdat_callback(struct urb *urb, struct pt_regs *regs)
|
||||||
option_outdat_callback (struct urb *urb, struct pt_regs *regs)
|
|
||||||
{
|
{
|
||||||
struct usb_serial_port *port;
|
struct usb_serial_port *port;
|
||||||
|
|
||||||
|
@ -376,8 +364,7 @@ option_outdat_callback (struct urb *urb, struct pt_regs *regs)
|
||||||
schedule_work(&port->work);
|
schedule_work(&port->work);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void option_instat_callback(struct urb *urb, struct pt_regs *regs)
|
||||||
option_instat_callback (struct urb *urb, struct pt_regs *regs)
|
|
||||||
{
|
{
|
||||||
int err;
|
int err;
|
||||||
struct usb_serial_port *port = (struct usb_serial_port *) urb->context;
|
struct usb_serial_port *port = (struct usb_serial_port *) urb->context;
|
||||||
|
@ -395,10 +382,12 @@ option_instat_callback (struct urb *urb, struct pt_regs *regs)
|
||||||
dbg("%s: NULL req_pkt\n", __FUNCTION__);
|
dbg("%s: NULL req_pkt\n", __FUNCTION__);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if ((req_pkt->bRequestType == 0xA1) && (req_pkt->bRequest == 0x20)) {
|
if ((req_pkt->bRequestType == 0xA1) &&
|
||||||
|
(req_pkt->bRequest == 0x20)) {
|
||||||
int old_dcd_state;
|
int old_dcd_state;
|
||||||
unsigned char signals = *((unsigned char *)
|
unsigned char signals = *((unsigned char *)
|
||||||
urb->transfer_buffer + sizeof(struct usb_ctrlrequest));
|
urb->transfer_buffer +
|
||||||
|
sizeof(struct usb_ctrlrequest));
|
||||||
|
|
||||||
dbg("%s: signal x%x", __FUNCTION__, signals);
|
dbg("%s: signal x%x", __FUNCTION__, signals);
|
||||||
|
|
||||||
|
@ -408,12 +397,13 @@ option_instat_callback (struct urb *urb, struct pt_regs *regs)
|
||||||
portdata->dsr_state = ((signals & 0x02) ? 1 : 0);
|
portdata->dsr_state = ((signals & 0x02) ? 1 : 0);
|
||||||
portdata->ri_state = ((signals & 0x08) ? 1 : 0);
|
portdata->ri_state = ((signals & 0x08) ? 1 : 0);
|
||||||
|
|
||||||
if (port->tty && !C_CLOCAL(port->tty)
|
if (port->tty && !C_CLOCAL(port->tty) &&
|
||||||
&& old_dcd_state && !portdata->dcd_state) {
|
old_dcd_state && !portdata->dcd_state)
|
||||||
tty_hangup(port->tty);
|
tty_hangup(port->tty);
|
||||||
}
|
} else {
|
||||||
} else
|
dbg("%s: type %x req %x", __FUNCTION__,
|
||||||
dbg("%s: type %x req %x", __FUNCTION__, req_pkt->bRequestType,req_pkt->bRequest);
|
req_pkt->bRequestType,req_pkt->bRequest);
|
||||||
|
}
|
||||||
} else
|
} else
|
||||||
dbg("%s: error %d", __FUNCTION__, urb->status);
|
dbg("%s: error %d", __FUNCTION__, urb->status);
|
||||||
|
|
||||||
|
@ -422,13 +412,12 @@ option_instat_callback (struct urb *urb, struct pt_regs *regs)
|
||||||
urb->dev = serial->dev;
|
urb->dev = serial->dev;
|
||||||
err = usb_submit_urb(urb, GFP_ATOMIC);
|
err = usb_submit_urb(urb, GFP_ATOMIC);
|
||||||
if (err)
|
if (err)
|
||||||
dbg("%s: resubmit intr urb failed. (%d)", __FUNCTION__, err);
|
dbg("%s: resubmit intr urb failed. (%d)",
|
||||||
|
__FUNCTION__, err);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int option_write_room(struct usb_serial_port *port)
|
||||||
static int
|
|
||||||
option_write_room (struct usb_serial_port *port)
|
|
||||||
{
|
{
|
||||||
struct option_port_private *portdata;
|
struct option_port_private *portdata;
|
||||||
int i;
|
int i;
|
||||||
|
@ -447,9 +436,7 @@ option_write_room (struct usb_serial_port *port)
|
||||||
return data_len;
|
return data_len;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int option_chars_in_buffer(struct usb_serial_port *port)
|
||||||
static int
|
|
||||||
option_chars_in_buffer (struct usb_serial_port *port)
|
|
||||||
{
|
{
|
||||||
struct option_port_private *portdata;
|
struct option_port_private *portdata;
|
||||||
int i;
|
int i;
|
||||||
|
@ -467,9 +454,7 @@ option_chars_in_buffer (struct usb_serial_port *port)
|
||||||
return data_len;
|
return data_len;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int option_open(struct usb_serial_port *port, struct file *filp)
|
||||||
static int
|
|
||||||
option_open (struct usb_serial_port *port, struct file *filp)
|
|
||||||
{
|
{
|
||||||
struct option_port_private *portdata;
|
struct option_port_private *portdata;
|
||||||
struct usb_serial *serial = port->serial;
|
struct usb_serial *serial = port->serial;
|
||||||
|
@ -490,17 +475,21 @@ option_open (struct usb_serial_port *port, struct file *filp)
|
||||||
if (! urb)
|
if (! urb)
|
||||||
continue;
|
continue;
|
||||||
if (urb->dev != serial->dev) {
|
if (urb->dev != serial->dev) {
|
||||||
dbg("%s: dev %p != %p", __FUNCTION__, urb->dev, serial->dev);
|
dbg("%s: dev %p != %p", __FUNCTION__,
|
||||||
|
urb->dev, serial->dev);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* make sure endpoint data toggle is synchronized with the device */
|
/*
|
||||||
|
* make sure endpoint data toggle is synchronized with the
|
||||||
|
* device
|
||||||
|
*/
|
||||||
usb_clear_halt(urb->dev, urb->pipe);
|
usb_clear_halt(urb->dev, urb->pipe);
|
||||||
|
|
||||||
err = usb_submit_urb(urb, GFP_KERNEL);
|
err = usb_submit_urb(urb, GFP_KERNEL);
|
||||||
if (err) {
|
if (err) {
|
||||||
dbg("%s: submit urb %d failed (%d) %d", __FUNCTION__, i, err,
|
dbg("%s: submit urb %d failed (%d) %d",
|
||||||
|
__FUNCTION__, i, err,
|
||||||
urb->transfer_buffer_length);
|
urb->transfer_buffer_length);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -511,7 +500,8 @@ option_open (struct usb_serial_port *port, struct file *filp)
|
||||||
if (! urb)
|
if (! urb)
|
||||||
continue;
|
continue;
|
||||||
urb->dev = serial->dev;
|
urb->dev = serial->dev;
|
||||||
/* usb_settoggle(urb->dev, usb_pipeendpoint(urb->pipe), usb_pipeout(urb->pipe), 0); */
|
/* usb_settoggle(urb->dev, usb_pipeendpoint(urb->pipe),
|
||||||
|
usb_pipeout(urb->pipe), 0); */
|
||||||
}
|
}
|
||||||
|
|
||||||
port->tty->low_latency = 1;
|
port->tty->low_latency = 1;
|
||||||
|
@ -521,8 +511,7 @@ option_open (struct usb_serial_port *port, struct file *filp)
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void
|
static inline void stop_urb(struct urb *urb)
|
||||||
stop_urb (struct urb *urb)
|
|
||||||
{
|
{
|
||||||
if (urb && urb->status == -EINPROGRESS) {
|
if (urb && urb->status == -EINPROGRESS) {
|
||||||
urb->transfer_flags &= ~URB_ASYNC_UNLINK;
|
urb->transfer_flags &= ~URB_ASYNC_UNLINK;
|
||||||
|
@ -530,8 +519,7 @@ stop_urb (struct urb *urb)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void option_close(struct usb_serial_port *port, struct file *filp)
|
||||||
option_close (struct usb_serial_port *port, struct file *filp)
|
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
struct usb_serial *serial = port->serial;
|
struct usb_serial *serial = port->serial;
|
||||||
|
@ -555,12 +543,10 @@ option_close (struct usb_serial_port *port, struct file *filp)
|
||||||
port->tty = NULL;
|
port->tty = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Helper functions used by option_setup_urbs */
|
/* Helper functions used by option_setup_urbs */
|
||||||
static struct urb *
|
static struct urb *option_setup_urb(struct usb_serial *serial, int endpoint,
|
||||||
option_setup_urb (struct usb_serial *serial, int endpoint,
|
int dir, void *ctx, char *buf, int len,
|
||||||
int dir, void *ctx, char *buf, int len,
|
void (*callback)(struct urb *, struct pt_regs *regs))
|
||||||
void (*callback)(struct urb *, struct pt_regs *regs))
|
|
||||||
{
|
{
|
||||||
struct urb *urb;
|
struct urb *urb;
|
||||||
|
|
||||||
|
@ -582,8 +568,7 @@ option_setup_urb (struct usb_serial *serial, int endpoint,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Setup urbs */
|
/* Setup urbs */
|
||||||
static void
|
static void option_setup_urbs(struct usb_serial *serial)
|
||||||
option_setup_urbs (struct usb_serial *serial)
|
|
||||||
{
|
{
|
||||||
int j;
|
int j;
|
||||||
struct usb_serial_port *port;
|
struct usb_serial_port *port;
|
||||||
|
@ -609,9 +594,7 @@ option_setup_urbs (struct usb_serial *serial)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int option_send_setup(struct usb_serial_port *port)
|
||||||
static int
|
|
||||||
option_send_setup (struct usb_serial_port *port)
|
|
||||||
{
|
{
|
||||||
struct usb_serial *serial = port->serial;
|
struct usb_serial *serial = port->serial;
|
||||||
struct option_port_private *portdata;
|
struct option_port_private *portdata;
|
||||||
|
@ -627,16 +610,15 @@ option_send_setup (struct usb_serial_port *port)
|
||||||
if (portdata->rts_state)
|
if (portdata->rts_state)
|
||||||
val |= 0x02;
|
val |= 0x02;
|
||||||
|
|
||||||
return usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev, 0),
|
return usb_control_msg(serial->dev,
|
||||||
0x22,0x21,val,0,NULL,0,USB_CTRL_SET_TIMEOUT);
|
usb_rcvctrlpipe(serial->dev, 0),
|
||||||
|
0x22,0x21,val,0,NULL,0,USB_CTRL_SET_TIMEOUT);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int option_startup(struct usb_serial *serial)
|
||||||
static int
|
|
||||||
option_startup (struct usb_serial *serial)
|
|
||||||
{
|
{
|
||||||
int i, err;
|
int i, err;
|
||||||
struct usb_serial_port *port;
|
struct usb_serial_port *port;
|
||||||
|
@ -647,9 +629,10 @@ option_startup (struct usb_serial *serial)
|
||||||
/* Now setup per port private data */
|
/* Now setup per port private data */
|
||||||
for (i = 0; i < serial->num_ports; i++) {
|
for (i = 0; i < serial->num_ports; i++) {
|
||||||
port = serial->port[i];
|
port = serial->port[i];
|
||||||
portdata = kmalloc(sizeof(struct option_port_private), GFP_KERNEL);
|
portdata = kmalloc(sizeof(*portdata), GFP_KERNEL);
|
||||||
if (!portdata) {
|
if (!portdata) {
|
||||||
dbg("%s: kmalloc for option_port_private (%d) failed!.", __FUNCTION__, i);
|
dbg("%s: kmalloc for option_port_private (%d) failed!.",
|
||||||
|
__FUNCTION__, i);
|
||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
memset(portdata, 0, sizeof(struct option_port_private));
|
memset(portdata, 0, sizeof(struct option_port_private));
|
||||||
|
@ -660,7 +643,8 @@ option_startup (struct usb_serial *serial)
|
||||||
continue;
|
continue;
|
||||||
err = usb_submit_urb(port->interrupt_in_urb, GFP_KERNEL);
|
err = usb_submit_urb(port->interrupt_in_urb, GFP_KERNEL);
|
||||||
if (err)
|
if (err)
|
||||||
dbg("%s: submit irq_in urb failed %d", __FUNCTION__, err);
|
dbg("%s: submit irq_in urb failed %d",
|
||||||
|
__FUNCTION__, err);
|
||||||
}
|
}
|
||||||
|
|
||||||
option_setup_urbs(serial);
|
option_setup_urbs(serial);
|
||||||
|
@ -668,8 +652,7 @@ option_startup (struct usb_serial *serial)
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void option_shutdown(struct usb_serial *serial)
|
||||||
option_shutdown (struct usb_serial *serial)
|
|
||||||
{
|
{
|
||||||
int i, j;
|
int i, j;
|
||||||
struct usb_serial_port *port;
|
struct usb_serial_port *port;
|
||||||
|
|
Loading…
Reference in a new issue