hc
2024-10-22 8ac6c7a54ed1b98d142dce24b11c6de6a1e239a5
kernel/drivers/usb/core/devices.c
....@@ -39,7 +39,6 @@
3939 #include <linux/fs.h>
4040 #include <linux/mm.h>
4141 #include <linux/gfp.h>
42
-#include <linux/poll.h>
4342 #include <linux/usb.h>
4443 #include <linux/usbdevice_fs.h>
4544 #include <linux/usb/hcd.h>
....@@ -97,22 +96,6 @@
9796 /* E: Ad=xx(s) Atr=xx(ssss) MxPS=dddd Ivl=D?s */
9897 "E: Ad=%02x(%c) Atr=%02x(%-4s) MxPS=%4d Ivl=%d%cs\n";
9998
100
-/*
101
- * Wait for an connect/disconnect event to happen. We initialize
102
- * the event counter with an odd number, and each event will increment
103
- * the event counter by two, so it will always _stay_ odd. That means
104
- * that it will never be zero, so "event 0" will never match a current
105
- * event, and thus 'poll' will always trigger as readable for the first
106
- * time it gets called.
107
- */
108
-static struct device_connect_event {
109
- atomic_t count;
110
- wait_queue_head_t wait;
111
-} device_event = {
112
- .count = ATOMIC_INIT(1),
113
- .wait = __WAIT_QUEUE_HEAD_INITIALIZER(device_event.wait)
114
-};
115
-
11699 struct class_info {
117100 int class;
118101 char *class_name;
....@@ -133,6 +116,10 @@
133116 {USB_CLASS_CSCID, "scard"},
134117 {USB_CLASS_CONTENT_SEC, "c-sec"},
135118 {USB_CLASS_VIDEO, "video"},
119
+ {USB_CLASS_PERSONAL_HEALTHCARE, "perhc"},
120
+ {USB_CLASS_AUDIO_VIDEO, "av"},
121
+ {USB_CLASS_BILLBOARD, "blbrd"},
122
+ {USB_CLASS_USB_TYPE_C_BRIDGE, "bridg"},
136123 {USB_CLASS_WIRELESS_CONTROLLER, "wlcon"},
137124 {USB_CLASS_MISC, "misc"},
138125 {USB_CLASS_APP_SPEC, "app."},
....@@ -141,12 +128,6 @@
141128 };
142129
143130 /*****************************************************************/
144
-
145
-void usbfs_conn_disc_event(void)
146
-{
147
- atomic_add(2, &device_event.count);
148
- wake_up(&device_event.wait);
149
-}
150131
151132 static const char *class_decode(const int class)
152133 {
....@@ -176,38 +157,25 @@
176157 switch (usb_endpoint_type(desc)) {
177158 case USB_ENDPOINT_XFER_CONTROL:
178159 type = "Ctrl";
179
- if (speed == USB_SPEED_HIGH) /* uframes per NAK */
180
- interval = desc->bInterval;
181
- else
182
- interval = 0;
183160 dir = 'B'; /* ctrl is bidirectional */
184161 break;
185162 case USB_ENDPOINT_XFER_ISOC:
186163 type = "Isoc";
187
- interval = 1 << (desc->bInterval - 1);
188164 break;
189165 case USB_ENDPOINT_XFER_BULK:
190166 type = "Bulk";
191
- if (speed == USB_SPEED_HIGH && dir == 'O') /* uframes per NAK */
192
- interval = desc->bInterval;
193
- else
194
- interval = 0;
195167 break;
196168 case USB_ENDPOINT_XFER_INT:
197169 type = "Int.";
198
- if (speed == USB_SPEED_HIGH || speed >= USB_SPEED_SUPER)
199
- interval = 1 << (desc->bInterval - 1);
200
- else
201
- interval = desc->bInterval;
202170 break;
203171 default: /* "can't happen" */
204172 return start;
205173 }
206
- interval *= (speed == USB_SPEED_HIGH ||
207
- speed >= USB_SPEED_SUPER) ? 125 : 1000;
208
- if (interval % 1000)
174
+
175
+ interval = usb_decode_interval(desc, speed);
176
+ if (interval % 1000) {
209177 unit = 'u';
210
- else {
178
+ } else {
211179 unit = 'm';
212180 interval /= 1000;
213181 }
....@@ -598,8 +566,6 @@
598566 return -EINVAL;
599567 if (nbytes <= 0)
600568 return 0;
601
- if (!access_ok(VERIFY_WRITE, buf, nbytes))
602
- return -EFAULT;
603569
604570 mutex_lock(&usb_bus_idr_lock);
605571 /* print devices for all busses */
....@@ -621,25 +587,7 @@
621587 return total_written;
622588 }
623589
624
-/* Kernel lock for "lastev" protection */
625
-static __poll_t usb_device_poll(struct file *file,
626
- struct poll_table_struct *wait)
627
-{
628
- unsigned int event_count;
629
-
630
- poll_wait(file, &device_event.wait, wait);
631
-
632
- event_count = atomic_read(&device_event.count);
633
- if (file->f_version != event_count) {
634
- file->f_version = event_count;
635
- return EPOLLIN | EPOLLRDNORM;
636
- }
637
-
638
- return 0;
639
-}
640
-
641590 const struct file_operations usbfs_devices_fops = {
642591 .llseek = no_seek_end_llseek,
643592 .read = usb_device_read,
644
- .poll = usb_device_poll,
645593 };