forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-05-13 9d77db3c730780c8ef5ccd4b66403ff5675cfe4e
kernel/drivers/net/wireless/intersil/orinoco/orinoco_usb.c
....@@ -73,10 +73,6 @@
7373 #define URB_ASYNC_UNLINK 0
7474 #endif
7575
76
-/* 802.2 LLC/SNAP header used for Ethernet encapsulation over 802.11 */
77
-static const u8 encaps_hdr[] = {0xaa, 0xaa, 0x03, 0x00, 0x00, 0x00};
78
-#define ENCAPS_OVERHEAD (sizeof(encaps_hdr) + 2)
79
-
8076 struct header_struct {
8177 /* 802.3 */
8278 u8 dest[ETH_ALEN];
....@@ -162,7 +158,7 @@
162158
163159
164160 #define EZUSB_REQUEST_FW_TRANS 0xA0
165
-#define EZUSB_REQUEST_TRIGER 0xAA
161
+#define EZUSB_REQUEST_TRIGGER 0xAA
166162 #define EZUSB_REQUEST_TRIG_AC 0xAC
167163 #define EZUSB_CPUCS_REG 0x7F92
168164
....@@ -206,7 +202,7 @@
206202 __le16 crc; /* CRC up to here */
207203 __le16 hermes_len;
208204 __le16 hermes_rid;
209
- u8 data[0];
205
+ u8 data[];
210206 } __packed;
211207
212208 /* Table of devices that work or may work with this driver */
....@@ -369,17 +365,6 @@
369365 return ctx;
370366 }
371367
372
-
373
-/* Hopefully the real complete_all will soon be exported, in the mean
374
- * while this should work. */
375
-static inline void ezusb_complete_all(struct completion *comp)
376
-{
377
- complete(comp);
378
- complete(comp);
379
- complete(comp);
380
- complete(comp);
381
-}
382
-
383368 static void ezusb_ctx_complete(struct request_context *ctx)
384369 {
385370 struct ezusb_priv *upriv = ctx->upriv;
....@@ -413,7 +398,7 @@
413398
414399 netif_wake_queue(dev);
415400 }
416
- ezusb_complete_all(&ctx->done);
401
+ complete_all(&ctx->done);
417402 ezusb_request_context_put(ctx);
418403 break;
419404
....@@ -423,7 +408,7 @@
423408 /* This is normal, as all request contexts get flushed
424409 * when the device is disconnected */
425410 err("Called, CTX not terminating, but device gone");
426
- ezusb_complete_all(&ctx->done);
411
+ complete_all(&ctx->done);
427412 ezusb_request_context_put(ctx);
428413 break;
429414 }
....@@ -438,13 +423,13 @@
438423 }
439424 }
440425
441
-/**
426
+/*
442427 * ezusb_req_queue_run:
443428 * Description:
444429 * Note: Only one active CTX at any one time, because there's no
445430 * other (reliable) way to match the response URB to the correct
446431 * CTX.
447
- **/
432
+ */
448433 static void ezusb_req_queue_run(struct ezusb_priv *upriv)
449434 {
450435 unsigned long flags;
....@@ -550,7 +535,7 @@
550535 flags);
551536 break;
552537 }
553
- /* fall through */
538
+ fallthrough;
554539 case EZUSB_CTX_RESP_RECEIVED:
555540 /* IN already received before this OUT-ACK */
556541 ctx->state = EZUSB_CTX_COMPLETE;
....@@ -572,7 +557,7 @@
572557 case EZUSB_CTX_REQ_SUBMITTED:
573558 case EZUSB_CTX_RESP_RECEIVED:
574559 ctx->state = EZUSB_CTX_REQ_FAILED;
575
- /* fall through */
560
+ fallthrough;
576561
577562 case EZUSB_CTX_REQ_FAILED:
578563 case EZUSB_CTX_REQ_TIMEOUT:
....@@ -694,11 +679,11 @@
694679 * get the chance to run themselves. So we make sure
695680 * that we don't sleep for ever */
696681 int msecs = DEF_TIMEOUT * (1000 / HZ);
697
- while (!ctx->done.done && msecs--)
682
+
683
+ while (!try_wait_for_completion(&ctx->done) && msecs--)
698684 udelay(1000);
699685 } else {
700
- swait_event_interruptible_exclusive(ctx->done.wait,
701
- ctx->done.done);
686
+ wait_for_completion(&ctx->done);
702687 }
703688 break;
704689 default:
....@@ -719,7 +704,7 @@
719704 return crc;
720705 }
721706
722
-/**
707
+/*
723708 * ezusb_fill_req:
724709 *
725710 * if data == NULL and length > 0 the data is assumed to be already in
....@@ -912,10 +897,11 @@
912897 case EZUSB_CTX_REQ_SUBMITTED:
913898 if (!ctx->in_rid)
914899 break;
900
+ fallthrough;
915901 default:
916902 err("%s: Unexpected context state %d", __func__,
917903 state);
918
- /* fall though */
904
+ fallthrough;
919905 case EZUSB_CTX_REQ_TIMEOUT:
920906 case EZUSB_CTX_REQ_FAILED:
921907 case EZUSB_CTX_RESP_TIMEOUT:
....@@ -1332,12 +1318,12 @@
13321318 netdev_dbg(upriv->dev, "sending control message\n");
13331319 retval = usb_control_msg(upriv->udev,
13341320 usb_sndctrlpipe(upriv->udev, 0),
1335
- EZUSB_REQUEST_TRIGER,
1321
+ EZUSB_REQUEST_TRIGGER,
13361322 USB_TYPE_VENDOR | USB_RECIP_DEVICE |
13371323 USB_DIR_OUT, 0x0, 0x0, NULL, 0,
13381324 DEF_TIMEOUT);
13391325 if (retval < 0) {
1340
- err("EZUSB_REQUEST_TRIGER failed retval %d", retval);
1326
+ err("EZUSB_REQUEST_TRIGGER failed retval %d", retval);
13411327 return retval;
13421328 }
13431329 #if 0