summaryrefslogtreecommitdiffstats
path: root/drivers/usb/serial
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-07-16 13:16:09 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-07-16 13:16:09 -0700
commitb903bd69e3fa156598def8d6433dfe5352af8da3 (patch)
treea13380f31bab62acfd667910656525c09511cb8a /drivers/usb/serial
parent84a1caf1453c3d44050bd22db958af4a7f99315c (diff)
parent1a49e2ac9651df7349867a5cf44e2c83de1046af (diff)
downloadlinux-stable-b903bd69e3fa156598def8d6433dfe5352af8da3.tar.gz
linux-stable-b903bd69e3fa156598def8d6433dfe5352af8da3.tar.bz2
linux-stable-b903bd69e3fa156598def8d6433dfe5352af8da3.zip
Merge 3.5-rc7 into usb-next
This resolves the merge issue with the drivers/usb/host/ehci-omap.c file. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/serial')
-rw-r--r--drivers/usb/serial/keyspan.c5
-rw-r--r--drivers/usb/serial/option.c88
-rw-r--r--drivers/usb/serial/quatech2.c4
3 files changed, 56 insertions, 41 deletions
diff --git a/drivers/usb/serial/keyspan.c b/drivers/usb/serial/keyspan.c
index a1b99243dac9..9a0ca8355905 100644
--- a/drivers/usb/serial/keyspan.c
+++ b/drivers/usb/serial/keyspan.c
@@ -1036,15 +1036,12 @@ static int keyspan_write_room(struct tty_struct *tty)
static int keyspan_open(struct tty_struct *tty, struct usb_serial_port *port)
{
struct keyspan_port_private *p_priv;
- struct keyspan_serial_private *s_priv;
- struct usb_serial *serial = port->serial;
const struct keyspan_device_details *d_details;
int i, err;
int baud_rate, device_port;
struct urb *urb;
unsigned int cflag = 0;
- s_priv = usb_get_serial_data(serial);
p_priv = usb_get_serial_port_data(port);
d_details = p_priv->device_details;
@@ -1130,10 +1127,8 @@ static void keyspan_close(struct usb_serial_port *port)
{
int i;
struct usb_serial *serial = port->serial;
- struct keyspan_serial_private *s_priv;
struct keyspan_port_private *p_priv;
- s_priv = usb_get_serial_data(serial);
p_priv = usb_get_serial_port_data(port);
p_priv->rts_state = 0;
diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
index 417ab1b0aa30..2b0c88da7828 100644
--- a/drivers/usb/serial/option.c
+++ b/drivers/usb/serial/option.c
@@ -1310,6 +1310,10 @@ static struct usb_serial_driver * const serial_drivers[] = {
static bool debug;
+struct option_private {
+ u8 bInterfaceNumber;
+};
+
module_usb_serial_driver(serial_drivers, option_ids);
static bool is_blacklisted(const u8 ifnum, enum option_blacklist_reason reason,
@@ -1340,51 +1344,78 @@ static int option_probe(struct usb_serial *serial,
const struct usb_device_id *id)
{
struct usb_wwan_intf_private *data;
-
- /* D-Link DWM 652 still exposes CD-Rom emulation interface in modem mode */
- if (serial->dev->descriptor.idVendor == DLINK_VENDOR_ID &&
- serial->dev->descriptor.idProduct == DLINK_PRODUCT_DWM_652 &&
- serial->interface->cur_altsetting->desc.bInterfaceClass == 0x8)
+ struct option_private *priv;
+ struct usb_interface_descriptor *iface_desc =
+ &serial->interface->cur_altsetting->desc;
+ struct usb_device_descriptor *dev_desc = &serial->dev->descriptor;
+
+ /*
+ * D-Link DWM 652 still exposes CD-Rom emulation interface in modem
+ * mode.
+ */
+ if (dev_desc->idVendor == DLINK_VENDOR_ID &&
+ dev_desc->idProduct == DLINK_PRODUCT_DWM_652 &&
+ iface_desc->bInterfaceClass == 0x08)
return -ENODEV;
/* Bandrich modem and AT command interface is 0xff */
- if ((serial->dev->descriptor.idVendor == BANDRICH_VENDOR_ID ||
- serial->dev->descriptor.idVendor == PIRELLI_VENDOR_ID) &&
- serial->interface->cur_altsetting->desc.bInterfaceClass != 0xff)
+ if ((dev_desc->idVendor == BANDRICH_VENDOR_ID ||
+ dev_desc->idVendor == PIRELLI_VENDOR_ID) &&
+ iface_desc->bInterfaceClass != 0xff)
return -ENODEV;
-
- /* Don't bind reserved interfaces (like network ones) which often have
+ /*
+ * Don't bind reserved interfaces (like network ones) which often have
* the same class/subclass/protocol as the serial interfaces. Look at
* the Windows driver .INF files for reserved interface numbers.
*/
if (is_blacklisted(
- serial->interface->cur_altsetting->desc.bInterfaceNumber,
+ iface_desc->bInterfaceNumber,
OPTION_BLACKLIST_RESERVED_IF,
(const struct option_blacklist_info *) id->driver_info))
return -ENODEV;
-
- /* Don't bind network interface on Samsung GT-B3730, it is handled by a separate module */
- if (serial->dev->descriptor.idVendor == SAMSUNG_VENDOR_ID &&
- serial->dev->descriptor.idProduct == SAMSUNG_PRODUCT_GT_B3730 &&
- serial->interface->cur_altsetting->desc.bInterfaceClass != USB_CLASS_CDC_DATA)
+ /*
+ * Don't bind network interface on Samsung GT-B3730, it is handled by
+ * a separate module.
+ */
+ if (dev_desc->idVendor == SAMSUNG_VENDOR_ID &&
+ dev_desc->idProduct == SAMSUNG_PRODUCT_GT_B3730 &&
+ iface_desc->bInterfaceClass != USB_CLASS_CDC_DATA)
return -ENODEV;
- data = serial->private = kzalloc(sizeof(struct usb_wwan_intf_private), GFP_KERNEL);
+ data = kzalloc(sizeof(struct usb_wwan_intf_private), GFP_KERNEL);
if (!data)
return -ENOMEM;
- data->send_setup = option_send_setup;
+
+ priv = kzalloc(sizeof(*priv), GFP_KERNEL);
+ if (!priv) {
+ kfree(data);
+ return -ENOMEM;
+ }
+
+ priv->bInterfaceNumber = iface_desc->bInterfaceNumber;
+ data->private = priv;
+
+ if (!is_blacklisted(iface_desc->bInterfaceNumber,
+ OPTION_BLACKLIST_SENDSETUP,
+ (struct option_blacklist_info *)id->driver_info)) {
+ data->send_setup = option_send_setup;
+ }
spin_lock_init(&data->susp_lock);
- data->private = (void *)id->driver_info;
+
+ usb_set_serial_data(serial, data);
+
return 0;
}
static void option_release(struct usb_serial *serial)
{
- struct usb_wwan_intf_private *priv = usb_get_serial_data(serial);
+ struct usb_wwan_intf_private *intfdata = usb_get_serial_data(serial);
+ struct option_private *priv = intfdata->private;
usb_wwan_release(serial);
kfree(priv);
+ kfree(intfdata);
}
static void option_instat_callback(struct urb *urb)
@@ -1451,18 +1482,11 @@ static void option_instat_callback(struct urb *urb)
static int option_send_setup(struct usb_serial_port *port)
{
struct usb_serial *serial = port->serial;
- struct usb_wwan_intf_private *intfdata =
- (struct usb_wwan_intf_private *) serial->private;
+ struct usb_wwan_intf_private *intfdata = usb_get_serial_data(serial);
+ struct option_private *priv = intfdata->private;
struct usb_wwan_port_private *portdata;
- int ifNum = serial->interface->cur_altsetting->desc.bInterfaceNumber;
int val = 0;
- if (is_blacklisted(ifNum, OPTION_BLACKLIST_SENDSETUP,
- (struct option_blacklist_info *) intfdata->private)) {
- dbg("No send_setup on blacklisted interface #%d\n", ifNum);
- return -EIO;
- }
-
portdata = usb_get_serial_port_data(port);
if (portdata->dtr_state)
@@ -1470,9 +1494,9 @@ static int option_send_setup(struct usb_serial_port *port)
if (portdata->rts_state)
val |= 0x02;
- return usb_control_msg(serial->dev,
- usb_rcvctrlpipe(serial->dev, 0),
- 0x22, 0x21, val, ifNum, NULL, 0, USB_CTRL_SET_TIMEOUT);
+ return usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev, 0),
+ 0x22, 0x21, val, priv->bInterfaceNumber, NULL,
+ 0, USB_CTRL_SET_TIMEOUT);
}
MODULE_AUTHOR(DRIVER_AUTHOR);
diff --git a/drivers/usb/serial/quatech2.c b/drivers/usb/serial/quatech2.c
index 8dd88ebe9863..151670b6b72a 100644
--- a/drivers/usb/serial/quatech2.c
+++ b/drivers/usb/serial/quatech2.c
@@ -345,7 +345,6 @@ static void qt2_set_termios(struct tty_struct *tty,
static int qt2_open(struct tty_struct *tty, struct usb_serial_port *port)
{
struct usb_serial *serial;
- struct qt2_serial_private *serial_priv;
struct qt2_port_private *port_priv;
u8 *data;
u16 device_port;
@@ -357,7 +356,6 @@ static int qt2_open(struct tty_struct *tty, struct usb_serial_port *port)
serial = port->serial;
port_priv = usb_get_serial_port_data(port);
- serial_priv = usb_get_serial_data(serial);
/* set the port to RS232 mode */
status = qt2_control_msg(serial->dev, QT2_GET_SET_QMCR,
@@ -417,13 +415,11 @@ static int qt2_open(struct tty_struct *tty, struct usb_serial_port *port)
static void qt2_close(struct usb_serial_port *port)
{
struct usb_serial *serial;
- struct qt2_serial_private *serial_priv;
struct qt2_port_private *port_priv;
unsigned long flags;
int i;
serial = port->serial;
- serial_priv = usb_get_serial_data(serial);
port_priv = usb_get_serial_port_data(port);
port_priv->is_open = false;