dwc_otg: delete hcd->channel_lock
authorP33M <p33m@github.com>
Mon, 15 May 2017 13:27:48 +0000 (14:27 +0100)
committerRaspbian kernel package updater <root@raspbian.org>
Sun, 8 Oct 2017 01:08:05 +0000 (01:08 +0000)
The lock serves no purpose as it is only held while the HCD spinlock
is already being held.

drivers/usb/host/dwc_otg/dwc_otg_hcd.c
drivers/usb/host/dwc_otg/dwc_otg_hcd.h
drivers/usb/host/dwc_otg/dwc_otg_hcd_ddma.c
drivers/usb/host/dwc_otg/dwc_otg_hcd_intr.c

index 9a647b75027378e25eef00b5fc2a9166514b5c59..5ec991624c7865901b22ea01b9f2c58c8535ecfd 100644 (file)
@@ -938,7 +938,6 @@ static void dwc_otg_hcd_free(dwc_otg_hcd_t * dwc_otg_hcd)
        } else if (dwc_otg_hcd->status_buf != NULL) {
                DWC_FREE(dwc_otg_hcd->status_buf);
        }
-       DWC_SPINLOCK_FREE(dwc_otg_hcd->channel_lock);
        DWC_SPINLOCK_FREE(dwc_otg_hcd->lock);
        /* Set core_if's lock pointer to NULL */
        dwc_otg_hcd->core_if->lock = NULL;
@@ -969,10 +968,8 @@ int dwc_otg_hcd_init(dwc_otg_hcd_t * hcd, dwc_otg_core_if_t * core_if)
 
 #if (defined(DWC_LINUX) && defined(CONFIG_DEBUG_SPINLOCK))
        DWC_SPINLOCK_ALLOC_LINUX_DEBUG(hcd->lock);
-       DWC_SPINLOCK_ALLOC_LINUX_DEBUG(hcd->channel_lock);
 #else
        hcd->lock = DWC_SPINLOCK_ALLOC();
-       hcd->channel_lock = DWC_SPINLOCK_ALLOC();
 #endif
         DWC_DEBUGPL(DBG_HCDV, "init of HCD %p given core_if %p\n",
                     hcd, core_if);
@@ -1997,7 +1994,6 @@ dwc_otg_transaction_type_e dwc_otg_hcd_select_transactions(dwc_otg_hcd_t * hcd)
        dwc_otg_qh_t *qh;
        int num_channels;
        dwc_irqflags_t flags;
-       dwc_spinlock_t *channel_lock = hcd->channel_lock;
        dwc_otg_transaction_type_e ret_val = DWC_OTG_TRANSACTION_NONE;
 
 #ifdef DEBUG_HOST_CHANNELS
@@ -2016,13 +2012,10 @@ dwc_otg_transaction_type_e dwc_otg_hcd_select_transactions(dwc_otg_hcd_t * hcd)
 
                if (microframe_schedule) {
                        // Make sure we leave one channel for non periodic transactions.
-                       DWC_SPINLOCK_IRQSAVE(channel_lock, &flags);
                        if (hcd->available_host_channels <= 1) {
-                               DWC_SPINUNLOCK_IRQRESTORE(channel_lock, flags);
                                break;
                        }
                        hcd->available_host_channels--;
-                       DWC_SPINUNLOCK_IRQRESTORE(channel_lock, flags);
 #ifdef DEBUG_HOST_CHANNELS
                        last_sel_trans_num_per_scheduled++;
 #endif /* DEBUG_HOST_CHANNELS */
@@ -2035,10 +2028,8 @@ dwc_otg_transaction_type_e dwc_otg_hcd_select_transactions(dwc_otg_hcd_t * hcd)
                 * periodic assigned schedule.
                 */
                qh_ptr = DWC_LIST_NEXT(qh_ptr);
-               DWC_SPINLOCK_IRQSAVE(channel_lock, &flags);
                DWC_LIST_MOVE_HEAD(&hcd->periodic_sched_assigned,
                                   &qh->qh_list_entry);
-               DWC_SPINUNLOCK_IRQRESTORE(channel_lock, flags);
        }
 
        /*
@@ -2076,13 +2067,10 @@ dwc_otg_transaction_type_e dwc_otg_hcd_select_transactions(dwc_otg_hcd_t * hcd)
                }
 
                if (microframe_schedule) {
-                               DWC_SPINLOCK_IRQSAVE(channel_lock, &flags);
                                if (hcd->available_host_channels < 1) {
-                                       DWC_SPINUNLOCK_IRQRESTORE(channel_lock, flags);
                                        break;
                                }
                                hcd->available_host_channels--;
-                               DWC_SPINUNLOCK_IRQRESTORE(channel_lock, flags);
 #ifdef DEBUG_HOST_CHANNELS
                                last_sel_trans_num_nonper_scheduled++;
 #endif /* DEBUG_HOST_CHANNELS */
@@ -2095,11 +2083,8 @@ dwc_otg_transaction_type_e dwc_otg_hcd_select_transactions(dwc_otg_hcd_t * hcd)
                 * non-periodic active schedule.
                 */
                qh_ptr = DWC_LIST_NEXT(qh_ptr);
-               DWC_SPINLOCK_IRQSAVE(channel_lock, &flags);
                DWC_LIST_MOVE_HEAD(&hcd->non_periodic_sched_active,
                                   &qh->qh_list_entry);
-               DWC_SPINUNLOCK_IRQRESTORE(channel_lock, flags);
-
 
                if (!microframe_schedule)
                        hcd->non_periodic_channels++;
index 4539cd7b802d3e49ac9a6cb3f1d88b475a1ace16..7f7e9eaffd6a3c3d898855562fbec11289f77f53 100644 (file)
@@ -568,7 +568,6 @@ struct dwc_otg_hcd {
 
        /*  */
        dwc_spinlock_t *lock;
-       dwc_spinlock_t *channel_lock;
        /**
         * Private data that could be used by OS wrapper.
         */
index 126e99ab2fc43f11d89a08ff0476181ead84029f..bd8a20403713442f6748137d6b5de67e94c3893f 100644 (file)
@@ -279,17 +279,12 @@ void dump_frame_list(dwc_otg_hcd_t * hcd)
 
 static void release_channel_ddma(dwc_otg_hcd_t * hcd, dwc_otg_qh_t * qh)
 {
-       dwc_irqflags_t flags;
-       dwc_spinlock_t *channel_lock = hcd->channel_lock;
-
        dwc_hc_t *hc = qh->channel;
        if (dwc_qh_is_non_per(qh)) {
-               DWC_SPINLOCK_IRQSAVE(channel_lock, &flags);
                if (!microframe_schedule)
                        hcd->non_periodic_channels--;
                else
                        hcd->available_host_channels++;
-               DWC_SPINUNLOCK_IRQRESTORE(channel_lock, flags);
        } else
                update_frame_list(hcd, qh, 0);
 
index cf23baaa388562b5843be4cfa6c206cbdc4e780d..a4355afc77b68718fdaba6c5d4be257dadc75036 100644 (file)
@@ -945,7 +945,6 @@ static void release_channel(dwc_otg_hcd_t * hcd,
        dwc_otg_transaction_type_e tr_type;
        int free_qtd;
        dwc_irqflags_t flags;
-       dwc_spinlock_t *channel_lock = hcd->channel_lock;
 
        int hog_port = 0;
 
@@ -1034,11 +1033,8 @@ cleanup:
                        break;
                }
        } else {
-
-               DWC_SPINLOCK_IRQSAVE(channel_lock, &flags);
                hcd->available_host_channels++;
                fiq_print(FIQDBG_INT, hcd->fiq_state, "AHC = %d ", hcd->available_host_channels);
-               DWC_SPINUNLOCK_IRQRESTORE(channel_lock, flags);
        }
 
        /* Try to queue more transfers now that there's a free channel. */