Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

David Ward and committed by
Johan Hovold
bd8869e8 8d23766b

+2 -19
+2 -19
drivers/usb/serial/option.c
··· 1835 1835 &option_1port_device, NULL 1836 1836 }; 1837 1837 1838 - struct option_private { 1839 - u8 bInterfaceNumber; 1840 - }; 1841 - 1842 1838 module_usb_serial_driver(serial_drivers, option_ids); 1843 1839 1844 1840 static int option_probe(struct usb_serial *serial, ··· 1878 1882 struct usb_interface_descriptor *iface_desc; 1879 1883 const struct option_blacklist_info *blacklist; 1880 1884 struct usb_wwan_intf_private *data; 1881 - struct option_private *priv; 1882 1885 1883 1886 data = kzalloc(sizeof(struct usb_wwan_intf_private), GFP_KERNEL); 1884 1887 if (!data) 1885 1888 return -ENOMEM; 1886 1889 1887 - priv = kzalloc(sizeof(*priv), GFP_KERNEL); 1888 - if (!priv) { 1889 - kfree(data); 1890 - return -ENOMEM; 1891 - } 1892 - 1893 1890 /* Retrieve blacklist info stored at probe. */ 1894 1891 blacklist = usb_get_serial_data(serial); 1895 1892 1896 1893 iface_desc = &serial->interface->cur_altsetting->desc; 1897 - 1898 - priv->bInterfaceNumber = iface_desc->bInterfaceNumber; 1899 - data->private = priv; 1900 1894 1901 1895 if (!blacklist || !test_bit(iface_desc->bInterfaceNumber, 1902 1896 &blacklist->sendsetup)) { ··· 1902 1916 static void option_release(struct usb_serial *serial) 1903 1917 { 1904 1918 struct usb_wwan_intf_private *intfdata = usb_get_serial_data(serial); 1905 - struct option_private *priv = intfdata->private; 1906 1919 1907 - kfree(priv); 1908 1920 kfree(intfdata); 1909 1921 } 1910 1922 ··· 1969 1985 static int option_send_setup(struct usb_serial_port *port) 1970 1986 { 1971 1987 struct usb_serial *serial = port->serial; 1972 - struct usb_wwan_intf_private *intfdata = usb_get_serial_data(serial); 1973 - struct option_private *priv = intfdata->private; 1974 1988 struct usb_wwan_port_private *portdata; 1989 + int ifNum = serial->interface->cur_altsetting->desc.bInterfaceNumber; 1975 1990 int val = 0; 1976 1991 int res; 1977 1992 ··· 1986 2003 return res; 1987 2004 1988 2005 res = usb_control_msg(serial->dev, usb_sndctrlpipe(serial->dev, 0), 1989 - 0x22, 0x21, val, priv->bInterfaceNumber, NULL, 2006 + 0x22, 0x21, val, ifNum, NULL, 1990 2007 0, USB_CTRL_SET_TIMEOUT); 1991 2008 1992 2009 usb_autopm_put_interface(serial->interface);