summaryrefslogtreecommitdiff
path: root/drivers/usb/serial/option.c
diff options
context:
space:
mode:
authorDavid Ward <david.ward@ll.mit.edu>2015-09-16 19:27:56 +0300
committerJohan Hovold <johan@kernel.org>2015-10-09 13:42:40 +0300
commitbd8869e86b8a1e5e5b29fad766b2676bb74e5395 (patch)
treeddd652f408424bf441ef57ae8101055f11ca04bc /drivers/usb/serial/option.c
parent8d23766b34e206d5f9544d9d638e56d827abbcd4 (diff)
downloadlinux-bd8869e86b8a1e5e5b29fad766b2676bb74e5395.tar.xz
USB: option: revert introduction of struct option_private
This is a partial, context modified revert of commit e463c6dda8f5 ("USB: option: handle send_setup blacklisting at probe"), which introduced an unnecessary struct option_private for storing the interface number used in option_send_setup. Removing this struct will allow option_send_setup to be generalized for other drivers. Suggested-by: Bjørn Mork <bjorn@mork.no> Signed-off-by: David Ward <david.ward@ll.mit.edu> Signed-off-by: Johan Hovold <johan@kernel.org>
Diffstat (limited to 'drivers/usb/serial/option.c')
-rw-r--r--drivers/usb/serial/option.c21
1 files changed, 2 insertions, 19 deletions
diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
index 6956c4f62216..4d16c9744f54 100644
--- a/drivers/usb/serial/option.c
+++ b/drivers/usb/serial/option.c
@@ -1835,10 +1835,6 @@ static struct usb_serial_driver * const serial_drivers[] = {
&option_1port_device, NULL
};
-struct option_private {
- u8 bInterfaceNumber;
-};
-
module_usb_serial_driver(serial_drivers, option_ids);
static int option_probe(struct usb_serial *serial,
@@ -1882,26 +1878,16 @@ static int option_attach(struct usb_serial *serial)
struct usb_interface_descriptor *iface_desc;
const struct option_blacklist_info *blacklist;
struct usb_wwan_intf_private *data;
- struct option_private *priv;
data = kzalloc(sizeof(struct usb_wwan_intf_private), GFP_KERNEL);
if (!data)
return -ENOMEM;
- priv = kzalloc(sizeof(*priv), GFP_KERNEL);
- if (!priv) {
- kfree(data);
- return -ENOMEM;
- }
-
/* Retrieve blacklist info stored at probe. */
blacklist = usb_get_serial_data(serial);
iface_desc = &serial->interface->cur_altsetting->desc;
- priv->bInterfaceNumber = iface_desc->bInterfaceNumber;
- data->private = priv;
-
if (!blacklist || !test_bit(iface_desc->bInterfaceNumber,
&blacklist->sendsetup)) {
data->send_setup = option_send_setup;
@@ -1916,9 +1902,7 @@ static int option_attach(struct usb_serial *serial)
static void option_release(struct usb_serial *serial)
{
struct usb_wwan_intf_private *intfdata = usb_get_serial_data(serial);
- struct option_private *priv = intfdata->private;
- kfree(priv);
kfree(intfdata);
}
@@ -1985,9 +1969,8 @@ 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 = 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;
int res;
@@ -2003,7 +1986,7 @@ static int option_send_setup(struct usb_serial_port *port)
return res;
res = usb_control_msg(serial->dev, usb_sndctrlpipe(serial->dev, 0),
- 0x22, 0x21, val, priv->bInterfaceNumber, NULL,
+ 0x22, 0x21, val, ifNum, NULL,
0, USB_CTRL_SET_TIMEOUT);
usb_autopm_put_interface(serial->interface);