aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/serial/option.c
diff options
context:
space:
mode:
authorDavid Ward <david.ward@ll.mit.edu>2015-09-16 12:27:56 -0400
committerJohan Hovold <johan@kernel.org>2015-10-09 06:42:40 -0400
commitbd8869e86b8a1e5e5b29fad766b2676bb74e5395 (patch)
treeddd652f408424bf441ef57ae8101055f11ca04bc /drivers/usb/serial/option.c
parent8d23766b34e206d5f9544d9d638e56d827abbcd4 (diff)
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[] = {
1835 &option_1port_device, NULL 1835 &option_1port_device, NULL
1836}; 1836};
1837 1837
1838struct option_private {
1839 u8 bInterfaceNumber;
1840};
1841
1842module_usb_serial_driver(serial_drivers, option_ids); 1838module_usb_serial_driver(serial_drivers, option_ids);
1843 1839
1844static int option_probe(struct usb_serial *serial, 1840static int option_probe(struct usb_serial *serial,
@@ -1882,26 +1878,16 @@ static int option_attach(struct usb_serial *serial)
1882 struct usb_interface_descriptor *iface_desc; 1878 struct usb_interface_descriptor *iface_desc;
1883 const struct option_blacklist_info *blacklist; 1879 const struct option_blacklist_info *blacklist;
1884 struct usb_wwan_intf_private *data; 1880 struct usb_wwan_intf_private *data;
1885 struct option_private *priv;
1886 1881
1887 data = kzalloc(sizeof(struct usb_wwan_intf_private), GFP_KERNEL); 1882 data = kzalloc(sizeof(struct usb_wwan_intf_private), GFP_KERNEL);
1888 if (!data) 1883 if (!data)
1889 return -ENOMEM; 1884 return -ENOMEM;
1890 1885
1891 priv = kzalloc(sizeof(*priv), GFP_KERNEL);
1892 if (!priv) {
1893 kfree(data);
1894 return -ENOMEM;
1895 }
1896
1897 /* Retrieve blacklist info stored at probe. */ 1886 /* Retrieve blacklist info stored at probe. */
1898 blacklist = usb_get_serial_data(serial); 1887 blacklist = usb_get_serial_data(serial);
1899 1888
1900 iface_desc = &serial->interface->cur_altsetting->desc; 1889 iface_desc = &serial->interface->cur_altsetting->desc;
1901 1890
1902 priv->bInterfaceNumber = iface_desc->bInterfaceNumber;
1903 data->private = priv;
1904
1905 if (!blacklist || !test_bit(iface_desc->bInterfaceNumber, 1891 if (!blacklist || !test_bit(iface_desc->bInterfaceNumber,
1906 &blacklist->sendsetup)) { 1892 &blacklist->sendsetup)) {
1907 data->send_setup = option_send_setup; 1893 data->send_setup = option_send_setup;
@@ -1916,9 +1902,7 @@ static int option_attach(struct usb_serial *serial)
1916static void option_release(struct usb_serial *serial) 1902static void option_release(struct usb_serial *serial)
1917{ 1903{
1918 struct usb_wwan_intf_private *intfdata = usb_get_serial_data(serial); 1904 struct usb_wwan_intf_private *intfdata = usb_get_serial_data(serial);
1919 struct option_private *priv = intfdata->private;
1920 1905
1921 kfree(priv);
1922 kfree(intfdata); 1906 kfree(intfdata);
1923} 1907}
1924 1908
@@ -1985,9 +1969,8 @@ static void option_instat_callback(struct urb *urb)
1985static int option_send_setup(struct usb_serial_port *port) 1969static int option_send_setup(struct usb_serial_port *port)
1986{ 1970{
1987 struct usb_serial *serial = port->serial; 1971 struct usb_serial *serial = port->serial;
1988 struct usb_wwan_intf_private *intfdata = usb_get_serial_data(serial);
1989 struct option_private *priv = intfdata->private;
1990 struct usb_wwan_port_private *portdata; 1972 struct usb_wwan_port_private *portdata;
1973 int ifNum = serial->interface->cur_altsetting->desc.bInterfaceNumber;
1991 int val = 0; 1974 int val = 0;
1992 int res; 1975 int res;
1993 1976
@@ -2003,7 +1986,7 @@ static int option_send_setup(struct usb_serial_port *port)
2003 return res; 1986 return res;
2004 1987
2005 res = usb_control_msg(serial->dev, usb_sndctrlpipe(serial->dev, 0), 1988 res = usb_control_msg(serial->dev, usb_sndctrlpipe(serial->dev, 0),
2006 0x22, 0x21, val, priv->bInterfaceNumber, NULL, 1989 0x22, 0x21, val, ifNum, NULL,
2007 0, USB_CTRL_SET_TIMEOUT); 1990 0, USB_CTRL_SET_TIMEOUT);
2008 1991
2009 usb_autopm_put_interface(serial->interface); 1992 usb_autopm_put_interface(serial->interface);