Skip to content

Commit 1e4c574

Browse files
AlanSterngregkh
authored andcommitted
USB: Remove remnants of Wireless USB and UWB
Wireless USB has long been defunct, and kernel support for it was removed in 2020 by commit caa6772 ("Staging: remove wusbcore and UWB from the kernel tree."). Nevertheless, some vestiges of the old implementation still clutter up the USB subsystem and one or two other places. Let's get rid of them once and for all. The only parts still left are the user-facing APIs in include/uapi/linux/usb/ch9.h. (There are also a couple of misleading instances, such as the Sierra Wireless USB modem, which is a USB modem made by Sierra Wireless.) Signed-off-by: Alan Stern <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 12e6ac6 commit 1e4c574

File tree

16 files changed

+62
-248
lines changed

16 files changed

+62
-248
lines changed

drivers/net/wireless/mediatek/mt76/usb.c

+1-2
Original file line numberDiff line numberDiff line change
@@ -286,8 +286,7 @@ static bool mt76u_check_sg(struct mt76_dev *dev)
286286
struct usb_device *udev = interface_to_usbdev(uintf);
287287

288288
return (!disable_usb_sg && udev->bus->sg_tablesize > 0 &&
289-
(udev->bus->no_sg_constraint ||
290-
udev->speed == USB_SPEED_WIRELESS));
289+
udev->bus->no_sg_constraint);
291290
}
292291

293292
static int

drivers/usb/core/config.c

-3
Original file line numberDiff line numberDiff line change
@@ -1051,9 +1051,6 @@ int usb_get_bos_descriptor(struct usb_device *dev)
10511051
}
10521052

10531053
switch (cap_type) {
1054-
case USB_CAP_TYPE_WIRELESS_USB:
1055-
/* Wireless USB cap descriptor is handled by wusb */
1056-
break;
10571054
case USB_CAP_TYPE_EXT:
10581055
dev->bos->ext_cap =
10591056
(struct usb_ext_cap_descriptor *)buffer;

drivers/usb/core/devices.c

-1
Original file line numberDiff line numberDiff line change
@@ -424,7 +424,6 @@ static ssize_t usb_device_dump(char __user **buffer, size_t *nbytes,
424424
case USB_SPEED_UNKNOWN: /* usb 1.1 root hub code */
425425
case USB_SPEED_FULL:
426426
speed = "12"; break;
427-
case USB_SPEED_WIRELESS: /* Wireless has no real fixed speed */
428427
case USB_SPEED_HIGH:
429428
speed = "480"; break;
430429
case USB_SPEED_SUPER:

drivers/usb/core/hcd.c

+4-36
Original file line numberDiff line numberDiff line change
@@ -156,27 +156,6 @@ static const u8 usb3_rh_dev_descriptor[18] = {
156156
0x01 /* __u8 bNumConfigurations; */
157157
};
158158

159-
/* usb 2.5 (wireless USB 1.0) root hub device descriptor */
160-
static const u8 usb25_rh_dev_descriptor[18] = {
161-
0x12, /* __u8 bLength; */
162-
USB_DT_DEVICE, /* __u8 bDescriptorType; Device */
163-
0x50, 0x02, /* __le16 bcdUSB; v2.5 */
164-
165-
0x09, /* __u8 bDeviceClass; HUB_CLASSCODE */
166-
0x00, /* __u8 bDeviceSubClass; */
167-
0x00, /* __u8 bDeviceProtocol; [ usb 2.0 no TT ] */
168-
0xFF, /* __u8 bMaxPacketSize0; always 0xFF (WUSB Spec 7.4.1). */
169-
170-
0x6b, 0x1d, /* __le16 idVendor; Linux Foundation 0x1d6b */
171-
0x02, 0x00, /* __le16 idProduct; device 0x0002 */
172-
KERNEL_VER, KERNEL_REL, /* __le16 bcdDevice */
173-
174-
0x03, /* __u8 iManufacturer; */
175-
0x02, /* __u8 iProduct; */
176-
0x01, /* __u8 iSerialNumber; */
177-
0x01 /* __u8 bNumConfigurations; */
178-
};
179-
180159
/* usb 2.0 root hub device descriptor */
181160
static const u8 usb2_rh_dev_descriptor[18] = {
182161
0x12, /* __u8 bLength; */
@@ -368,7 +347,7 @@ static const u8 ss_rh_config_descriptor[] = {
368347
};
369348

370349
/* authorized_default behaviour:
371-
* -1 is authorized for all devices except wireless (old behaviour)
350+
* -1 is authorized for all devices (leftover from wireless USB)
372351
* 0 is unauthorized for all devices
373352
* 1 is authorized for all devices
374353
* 2 is authorized for internal devices
@@ -383,7 +362,7 @@ module_param(authorized_default, int, S_IRUGO|S_IWUSR);
383362
MODULE_PARM_DESC(authorized_default,
384363
"Default USB device authorization: 0 is not authorized, 1 is "
385364
"authorized, 2 is authorized for internal devices, -1 is "
386-
"authorized except for wireless USB (default, old behaviour)");
365+
"authorized (default, same as 1)");
387366
/*-------------------------------------------------------------------------*/
388367

389368
/**
@@ -578,9 +557,6 @@ static int rh_call_control (struct usb_hcd *hcd, struct urb *urb)
578557
case HCD_USB3:
579558
bufp = usb3_rh_dev_descriptor;
580559
break;
581-
case HCD_USB25:
582-
bufp = usb25_rh_dev_descriptor;
583-
break;
584560
case HCD_USB2:
585561
bufp = usb2_rh_dev_descriptor;
586562
break;
@@ -602,7 +578,6 @@ static int rh_call_control (struct usb_hcd *hcd, struct urb *urb)
602578
bufp = ss_rh_config_descriptor;
603579
len = sizeof ss_rh_config_descriptor;
604580
break;
605-
case HCD_USB25:
606581
case HCD_USB2:
607582
bufp = hs_rh_config_descriptor;
608583
len = sizeof hs_rh_config_descriptor;
@@ -2848,18 +2823,14 @@ int usb_add_hcd(struct usb_hcd *hcd,
28482823
hcd->dev_policy = USB_DEVICE_AUTHORIZE_NONE;
28492824
break;
28502825

2851-
case USB_AUTHORIZE_ALL:
2852-
hcd->dev_policy = USB_DEVICE_AUTHORIZE_ALL;
2853-
break;
2854-
28552826
case USB_AUTHORIZE_INTERNAL:
28562827
hcd->dev_policy = USB_DEVICE_AUTHORIZE_INTERNAL;
28572828
break;
28582829

2830+
case USB_AUTHORIZE_ALL:
28592831
case USB_AUTHORIZE_WIRED:
28602832
default:
2861-
hcd->dev_policy = hcd->wireless ?
2862-
USB_DEVICE_AUTHORIZE_NONE : USB_DEVICE_AUTHORIZE_ALL;
2833+
hcd->dev_policy = USB_DEVICE_AUTHORIZE_ALL;
28632834
break;
28642835
}
28652836

@@ -2903,9 +2874,6 @@ int usb_add_hcd(struct usb_hcd *hcd,
29032874
case HCD_USB2:
29042875
rhdev->speed = USB_SPEED_HIGH;
29052876
break;
2906-
case HCD_USB25:
2907-
rhdev->speed = USB_SPEED_WIRELESS;
2908-
break;
29092877
case HCD_USB3:
29102878
rhdev->speed = USB_SPEED_SUPER;
29112879
break;

drivers/usb/core/hub.c

+45-110
Original file line numberDiff line numberDiff line change
@@ -2140,22 +2140,6 @@ EXPORT_SYMBOL_GPL(usb_set_device_state);
21402140
* USB-3.0 buses the address is assigned by the controller hardware
21412141
* and it usually is not the same as the device number.
21422142
*
2143-
* WUSB devices are simple: they have no hubs behind, so the mapping
2144-
* device <-> virtual port number becomes 1:1. Why? to simplify the
2145-
* life of the device connection logic in
2146-
* drivers/usb/wusbcore/devconnect.c. When we do the initial secret
2147-
* handshake we need to assign a temporary address in the unauthorized
2148-
* space. For simplicity we use the first virtual port number found to
2149-
* be free [drivers/usb/wusbcore/devconnect.c:wusbhc_devconnect_ack()]
2150-
* and that becomes it's address [X < 128] or its unauthorized address
2151-
* [X | 0x80].
2152-
*
2153-
* We add 1 as an offset to the one-based USB-stack port number
2154-
* (zero-based wusb virtual port index) for two reasons: (a) dev addr
2155-
* 0 is reserved by USB for default address; (b) Linux's USB stack
2156-
* uses always #1 for the root hub of the controller. So USB stack's
2157-
* port #1, which is wusb virtual-port #0 has address #2.
2158-
*
21592143
* Devices connected under xHCI are not as simple. The host controller
21602144
* supports virtualization, so the hardware assigns device addresses and
21612145
* the HCD must setup data structures before issuing a set address
@@ -2168,19 +2152,13 @@ static void choose_devnum(struct usb_device *udev)
21682152

21692153
/* be safe when more hub events are proceed in parallel */
21702154
mutex_lock(&bus->devnum_next_mutex);
2171-
if (udev->wusb) {
2172-
devnum = udev->portnum + 1;
2173-
BUG_ON(test_bit(devnum, bus->devmap.devicemap));
2174-
} else {
2175-
/* Try to allocate the next devnum beginning at
2176-
* bus->devnum_next. */
2177-
devnum = find_next_zero_bit(bus->devmap.devicemap, 128,
2178-
bus->devnum_next);
2179-
if (devnum >= 128)
2180-
devnum = find_next_zero_bit(bus->devmap.devicemap,
2181-
128, 1);
2182-
bus->devnum_next = (devnum >= 127 ? 1 : devnum + 1);
2183-
}
2155+
2156+
/* Try to allocate the next devnum beginning at bus->devnum_next. */
2157+
devnum = find_next_zero_bit(bus->devmap.devicemap, 128,
2158+
bus->devnum_next);
2159+
if (devnum >= 128)
2160+
devnum = find_next_zero_bit(bus->devmap.devicemap, 128, 1);
2161+
bus->devnum_next = (devnum >= 127 ? 1 : devnum + 1);
21842162
if (devnum < 128) {
21852163
set_bit(devnum, bus->devmap.devicemap);
21862164
udev->devnum = devnum;
@@ -2198,9 +2176,7 @@ static void release_devnum(struct usb_device *udev)
21982176

21992177
static void update_devnum(struct usb_device *udev, int devnum)
22002178
{
2201-
/* The address for a WUSB device is managed by wusbcore. */
2202-
if (!udev->wusb)
2203-
udev->devnum = devnum;
2179+
udev->devnum = devnum;
22042180
if (!udev->devaddr)
22052181
udev->devaddr = (u8)devnum;
22062182
}
@@ -2693,20 +2669,6 @@ int usb_authorize_device(struct usb_device *usb_dev)
26932669
goto error_autoresume;
26942670
}
26952671

2696-
if (usb_dev->wusb) {
2697-
struct usb_device_descriptor *descr;
2698-
2699-
descr = usb_get_device_descriptor(usb_dev);
2700-
if (IS_ERR(descr)) {
2701-
result = PTR_ERR(descr);
2702-
dev_err(&usb_dev->dev, "can't re-read device descriptor for "
2703-
"authorization: %d\n", result);
2704-
goto error_device_descriptor;
2705-
}
2706-
usb_dev->descriptor = *descr;
2707-
kfree(descr);
2708-
}
2709-
27102672
usb_dev->authorized = 1;
27112673
/* Choose and set the configuration. This registers the interfaces
27122674
* with the driver core and lets interface drivers bind to them.
@@ -2723,7 +2685,6 @@ int usb_authorize_device(struct usb_device *usb_dev)
27232685
}
27242686
dev_info(&usb_dev->dev, "authorized to connect\n");
27252687

2726-
error_device_descriptor:
27272688
usb_autosuspend_device(usb_dev);
27282689
error_autoresume:
27292690
out_authorized:
@@ -2806,17 +2767,6 @@ static enum usb_ssp_rate get_port_ssp_rate(struct usb_device *hdev,
28062767
return USB_SSP_GEN_UNKNOWN;
28072768
}
28082769

2809-
/* Returns 1 if @hub is a WUSB root hub, 0 otherwise */
2810-
static unsigned hub_is_wusb(struct usb_hub *hub)
2811-
{
2812-
struct usb_hcd *hcd;
2813-
if (hub->hdev->parent != NULL) /* not a root hub? */
2814-
return 0;
2815-
hcd = bus_to_hcd(hub->hdev->bus);
2816-
return hcd->wireless;
2817-
}
2818-
2819-
28202770
#ifdef CONFIG_USB_FEW_INIT_RETRIES
28212771
#define PORT_RESET_TRIES 2
28222772
#define SET_ADDRESS_TRIES 1
@@ -2969,9 +2919,7 @@ static int hub_port_wait_reset(struct usb_hub *hub, int port1,
29692919
udev->tx_lanes = 1;
29702920
udev->ssp_rate = USB_SSP_GEN_UNKNOWN;
29712921
}
2972-
if (hub_is_wusb(hub))
2973-
udev->speed = USB_SPEED_WIRELESS;
2974-
else if (udev->ssp_rate != USB_SSP_GEN_UNKNOWN)
2922+
if (udev->ssp_rate != USB_SSP_GEN_UNKNOWN)
29752923
udev->speed = USB_SPEED_SUPER_PLUS;
29762924
else if (hub_is_superspeed(hub->hdev))
29772925
udev->speed = USB_SPEED_SUPER;
@@ -4880,13 +4828,10 @@ hub_port_init(struct usb_hub *hub, struct usb_device *udev, int port1,
48804828
if (initial) {
48814829
/* USB 2.0 section 5.5.3 talks about ep0 maxpacket ...
48824830
* it's fixed size except for full speed devices.
4883-
* For Wireless USB devices, ep0 max packet is always 512 (tho
4884-
* reported as 0xff in the device descriptor). WUSB1.0[4.8.1].
48854831
*/
48864832
switch (udev->speed) {
48874833
case USB_SPEED_SUPER_PLUS:
48884834
case USB_SPEED_SUPER:
4889-
case USB_SPEED_WIRELESS: /* fixed at 512 */
48904835
udev->ep0.desc.wMaxPacketSize = cpu_to_le16(512);
48914836
break;
48924837
case USB_SPEED_HIGH: /* fixed at 64 */
@@ -4907,10 +4852,7 @@ hub_port_init(struct usb_hub *hub, struct usb_device *udev, int port1,
49074852
}
49084853
}
49094854

4910-
if (udev->speed == USB_SPEED_WIRELESS)
4911-
speed = "variable speed Wireless";
4912-
else
4913-
speed = usb_speed_string(udev->speed);
4855+
speed = usb_speed_string(udev->speed);
49144856

49154857
/*
49164858
* The controller driver may be NULL if the controller device
@@ -5003,50 +4945,44 @@ hub_port_init(struct usb_hub *hub, struct usb_device *udev, int port1,
50034945
}
50044946
}
50054947

4948+
for (operations = 0; operations < SET_ADDRESS_TRIES; ++operations) {
4949+
retval = hub_set_address(udev, devnum);
4950+
if (retval >= 0)
4951+
break;
4952+
msleep(200);
4953+
}
4954+
if (retval < 0) {
4955+
if (retval != -ENODEV)
4956+
dev_err(&udev->dev, "device not accepting address %d, error %d\n",
4957+
devnum, retval);
4958+
goto fail;
4959+
}
4960+
if (udev->speed >= USB_SPEED_SUPER) {
4961+
devnum = udev->devnum;
4962+
dev_info(&udev->dev,
4963+
"%s SuperSpeed%s%s USB device number %d using %s\n",
4964+
(udev->config) ? "reset" : "new",
4965+
(udev->speed == USB_SPEED_SUPER_PLUS) ?
4966+
" Plus" : "",
4967+
(udev->ssp_rate == USB_SSP_GEN_2x2) ?
4968+
" Gen 2x2" :
4969+
(udev->ssp_rate == USB_SSP_GEN_2x1) ?
4970+
" Gen 2x1" :
4971+
(udev->ssp_rate == USB_SSP_GEN_1x2) ?
4972+
" Gen 1x2" : "",
4973+
devnum, driver_name);
4974+
}
4975+
50064976
/*
5007-
* If device is WUSB, we already assigned an
5008-
* unauthorized address in the Connect Ack sequence;
5009-
* authorization will assign the final address.
4977+
* cope with hardware quirkiness:
4978+
* - let SET_ADDRESS settle, some device hardware wants it
4979+
* - read ep0 maxpacket even for high and low speed,
50104980
*/
5011-
if (udev->wusb == 0) {
5012-
for (operations = 0; operations < SET_ADDRESS_TRIES; ++operations) {
5013-
retval = hub_set_address(udev, devnum);
5014-
if (retval >= 0)
5015-
break;
5016-
msleep(200);
5017-
}
5018-
if (retval < 0) {
5019-
if (retval != -ENODEV)
5020-
dev_err(&udev->dev, "device not accepting address %d, error %d\n",
5021-
devnum, retval);
5022-
goto fail;
5023-
}
5024-
if (udev->speed >= USB_SPEED_SUPER) {
5025-
devnum = udev->devnum;
5026-
dev_info(&udev->dev,
5027-
"%s SuperSpeed%s%s USB device number %d using %s\n",
5028-
(udev->config) ? "reset" : "new",
5029-
(udev->speed == USB_SPEED_SUPER_PLUS) ?
5030-
" Plus" : "",
5031-
(udev->ssp_rate == USB_SSP_GEN_2x2) ?
5032-
" Gen 2x2" :
5033-
(udev->ssp_rate == USB_SSP_GEN_2x1) ?
5034-
" Gen 2x1" :
5035-
(udev->ssp_rate == USB_SSP_GEN_1x2) ?
5036-
" Gen 1x2" : "",
5037-
devnum, driver_name);
5038-
}
4981+
msleep(10);
50394982

5040-
/* cope with hardware quirkiness:
5041-
* - let SET_ADDRESS settle, some device hardware wants it
5042-
* - read ep0 maxpacket even for high and low speed,
5043-
*/
5044-
msleep(10);
5045-
if (do_new_scheme)
5046-
break;
5047-
}
4983+
if (do_new_scheme)
4984+
break;
50484985

5049-
/* !do_new_scheme || wusb */
50504986
maxp0 = get_bMaxPacketSize0(udev, buf, 8, retries == 0);
50514987
if (maxp0 < 0) {
50524988
retval = maxp0;
@@ -5128,7 +5064,7 @@ hub_port_init(struct usb_hub *hub, struct usb_device *udev, int port1,
51285064

51295065
usb_detect_quirks(udev);
51305066

5131-
if (udev->wusb == 0 && le16_to_cpu(udev->descriptor.bcdUSB) >= 0x0201) {
5067+
if (le16_to_cpu(udev->descriptor.bcdUSB) >= 0x0201) {
51325068
retval = usb_get_bos_descriptor(udev);
51335069
if (!retval) {
51345070
udev->lpm_capable = usb_device_supports_lpm(udev);
@@ -5404,7 +5340,6 @@ static void hub_port_connect(struct usb_hub *hub, int port1, u16 portstatus,
54045340
usb_set_device_state(udev, USB_STATE_POWERED);
54055341
udev->bus_mA = hub->mA_per_port;
54065342
udev->level = hdev->level + 1;
5407-
udev->wusb = hub_is_wusb(hub);
54085343

54095344
/* Devices connected to SuperSpeed hubs are USB 3.0 or later */
54105345
if (hub_is_superspeed(hub->hdev))

drivers/usb/core/sysfs.c

-3
Original file line numberDiff line numberDiff line change
@@ -161,9 +161,6 @@ static ssize_t speed_show(struct device *dev, struct device_attribute *attr,
161161
case USB_SPEED_HIGH:
162162
speed = "480";
163163
break;
164-
case USB_SPEED_WIRELESS:
165-
speed = "480";
166-
break;
167164
case USB_SPEED_SUPER:
168165
speed = "5000";
169166
break;

0 commit comments

Comments
 (0)