forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-05-13 9d77db3c730780c8ef5ccd4b66403ff5675cfe4e
kernel/drivers/usb/host/u132-hcd.c
....@@ -71,7 +71,7 @@
7171 /* Some boards misreport power switching/overcurrent*/
7272 static bool distrust_firmware = true;
7373 module_param(distrust_firmware, bool, 0);
74
-MODULE_PARM_DESC(distrust_firmware, "true to distrust firmware power/overcurren"
74
+MODULE_PARM_DESC(distrust_firmware, "true to distrust firmware power/overcurrent"
7575 "t setup");
7676 static DECLARE_WAIT_QUEUE_HEAD(u132_hcd_wait);
7777 /*
....@@ -81,7 +81,6 @@
8181 static struct mutex u132_module_lock;
8282 static int u132_exiting;
8383 static int u132_instances;
84
-static struct list_head u132_static_list;
8584 /*
8685 * end of the global variables protected by u132_module_lock
8786 */
....@@ -177,7 +176,6 @@
177176 };
178177 struct u132 {
179178 struct kref kref;
180
- struct list_head u132_list;
181179 struct mutex sw_lock;
182180 struct mutex scheduler_lock;
183181 struct u132_platform_data *board;
....@@ -254,7 +252,6 @@
254252 struct usb_hcd *hcd = u132_to_hcd(u132);
255253 u132->going += 1;
256254 mutex_lock(&u132_module_lock);
257
- list_del_init(&u132->u132_list);
258255 u132_instances -= 1;
259256 mutex_unlock(&u132_module_lock);
260257 dev_warn(&u132->platform_dev->dev, "FREEING the hcd=%p and thus the u13"
....@@ -2477,7 +2474,8 @@
24772474 spin_unlock_irqrestore(&endp->queue_lock.slock,
24782475 irqs);
24792476 kfree(urbq);
2480
- } urb->error_count = 0;
2477
+ }
2478
+ urb->error_count = 0;
24812479 usb_hcd_giveback_urb(hcd, urb, status);
24822480 return 0;
24832481 } else if (list_empty(&endp->urb_more)) {
....@@ -2553,10 +2551,9 @@
25532551 dev_err(&u132->platform_dev->dev, "device is being removed\n");
25542552 return -ESHUTDOWN;
25552553 } else {
2556
- int frame = 0;
25572554 dev_err(&u132->platform_dev->dev, "TODO: u132_get_frame\n");
25582555 mdelay(100);
2559
- return frame;
2556
+ return 0;
25602557 }
25612558 }
25622559
....@@ -2982,7 +2979,8 @@
29822979 while (rings-- > 0) {
29832980 struct u132_ring *ring = &u132->ring[rings];
29842981 u132_ring_cancel_work(u132, ring);
2985
- } while (endps-- > 0) {
2982
+ }
2983
+ while (endps-- > 0) {
29862984 struct u132_endp *endp = u132->endp[endps];
29872985 if (endp)
29882986 u132_endp_cancel_work(u132, endp);
....@@ -3076,8 +3074,6 @@
30763074 retval = ftdi_read_pcimem(pdev, roothub.a, &rh_a);
30773075 if (retval)
30783076 return retval;
3079
- if (pdev->dev.dma_mask)
3080
- return -EINVAL;
30813077
30823078 hcd = usb_create_hcd(&u132_hc_driver, &pdev->dev, dev_name(&pdev->dev));
30833079 if (!hcd) {
....@@ -3090,7 +3086,6 @@
30903086 retval = 0;
30913087 hcd->rsrc_start = 0;
30923088 mutex_lock(&u132_module_lock);
3093
- list_add_tail(&u132->u132_list, &u132_static_list);
30943089 u132->sequence_num = ++u132_instances;
30953090 mutex_unlock(&u132_module_lock);
30963091 u132_u132_init_kref(u132);
....@@ -3193,7 +3188,6 @@
31933188 static int __init u132_hcd_init(void)
31943189 {
31953190 int retval;
3196
- INIT_LIST_HEAD(&u132_static_list);
31973191 u132_instances = 0;
31983192 u132_exiting = 0;
31993193 mutex_init(&u132_module_lock);
....@@ -3201,6 +3195,8 @@
32013195 return -ENODEV;
32023196 printk(KERN_INFO "driver %s\n", hcd_name);
32033197 workqueue = create_singlethread_workqueue("u132");
3198
+ if (!workqueue)
3199
+ return -ENOMEM;
32043200 retval = platform_driver_register(&u132_platform_driver);
32053201 if (retval)
32063202 destroy_workqueue(workqueue);
....@@ -3212,14 +3208,9 @@
32123208 module_init(u132_hcd_init);
32133209 static void __exit u132_hcd_exit(void)
32143210 {
3215
- struct u132 *u132;
3216
- struct u132 *temp;
32173211 mutex_lock(&u132_module_lock);
32183212 u132_exiting += 1;
32193213 mutex_unlock(&u132_module_lock);
3220
- list_for_each_entry_safe(u132, temp, &u132_static_list, u132_list) {
3221
- platform_device_unregister(u132->platform_dev);
3222
- }
32233214 platform_driver_unregister(&u132_platform_driver);
32243215 printk(KERN_INFO "u132-hcd driver deregistered\n");
32253216 wait_event(u132_hcd_wait, u132_instances == 0);