2014-09-27 19:10:51 +00:00
|
|
|
From f97cc1b1a4c868500cee6b016f54d78bdd3cdc26 Mon Sep 17 00:00:00 2001
|
2014-02-28 20:30:08 +00:00
|
|
|
From: popcornmix <popcornmix@gmail.com>
|
|
|
|
Date: Sat, 8 Sep 2012 15:17:53 +0100
|
2014-09-27 19:10:51 +00:00
|
|
|
Subject: [PATCH 030/196] Avoid dynamic memory allocation for channel lock in
|
2014-02-28 20:30:08 +00:00
|
|
|
USB driver. Thanks ddv2005.
|
|
|
|
|
|
|
|
---
|
|
|
|
drivers/usb/host/dwc_otg/dwc_otg_hcd.c | 6 +++---
|
|
|
|
drivers/usb/host/dwc_otg/dwc_otg_hcd.h | 2 +-
|
|
|
|
drivers/usb/host/dwc_otg/dwc_otg_hcd_ddma.c | 3 +--
|
|
|
|
drivers/usb/host/dwc_otg/dwc_otg_hcd_intr.c | 3 +--
|
|
|
|
4 files changed, 6 insertions(+), 8 deletions(-)
|
|
|
|
|
2014-09-27 19:10:51 +00:00
|
|
|
diff --git a/drivers/usb/host/dwc_otg/dwc_otg_hcd.c b/drivers/usb/host/dwc_otg/dwc_otg_hcd.c
|
|
|
|
index 20f989e..0ce7e46 100644
|
2014-02-28 20:30:08 +00:00
|
|
|
--- a/drivers/usb/host/dwc_otg/dwc_otg_hcd.c
|
|
|
|
+++ b/drivers/usb/host/dwc_otg/dwc_otg_hcd.c
|
2014-09-27 19:10:51 +00:00
|
|
|
@@ -822,6 +822,7 @@ static void dwc_otg_hcd_free(dwc_otg_hcd_t * dwc_otg_hcd)
|
2014-02-28 20:30:08 +00:00
|
|
|
} 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;
|
2014-09-27 19:10:51 +00:00
|
|
|
@@ -848,6 +849,7 @@ int dwc_otg_hcd_init(dwc_otg_hcd_t * hcd, dwc_otg_core_if_t * core_if)
|
2014-02-28 20:30:08 +00:00
|
|
|
dwc_hc_t *channel;
|
|
|
|
|
|
|
|
hcd->lock = DWC_SPINLOCK_ALLOC();
|
|
|
|
+ hcd->channel_lock = DWC_SPINLOCK_ALLOC();
|
|
|
|
DWC_DEBUGPL(DBG_HCDV, "init of HCD %p given core_if %p\n",
|
|
|
|
hcd, core_if);
|
|
|
|
if (!hcd->lock) {
|
2014-09-27 19:10:51 +00:00
|
|
|
@@ -1248,7 +1250,7 @@ dwc_otg_transaction_type_e dwc_otg_hcd_select_transactions(dwc_otg_hcd_t * hcd)
|
2014-02-28 20:30:08 +00:00
|
|
|
dwc_otg_qh_t *qh;
|
|
|
|
int num_channels;
|
|
|
|
dwc_irqflags_t flags;
|
|
|
|
- dwc_spinlock_t *channel_lock = DWC_SPINLOCK_ALLOC();
|
|
|
|
+ dwc_spinlock_t *channel_lock = hcd->channel_lock;
|
|
|
|
dwc_otg_transaction_type_e ret_val = DWC_OTG_TRANSACTION_NONE;
|
|
|
|
|
|
|
|
#ifdef DEBUG_SOF
|
2014-09-27 19:10:51 +00:00
|
|
|
@@ -1348,8 +1350,6 @@ dwc_otg_transaction_type_e dwc_otg_hcd_select_transactions(dwc_otg_hcd_t * hcd)
|
2014-02-28 20:30:08 +00:00
|
|
|
#ifdef DEBUG_HOST_CHANNELS
|
|
|
|
last_sel_trans_num_avail_hc_at_end = hcd->available_host_channels;
|
|
|
|
#endif /* DEBUG_HOST_CHANNELS */
|
|
|
|
-
|
|
|
|
- DWC_SPINLOCK_FREE(channel_lock);
|
|
|
|
return ret_val;
|
|
|
|
}
|
|
|
|
|
2014-09-27 19:10:51 +00:00
|
|
|
diff --git a/drivers/usb/host/dwc_otg/dwc_otg_hcd.h b/drivers/usb/host/dwc_otg/dwc_otg_hcd.h
|
|
|
|
index dd30f47..6d82127 100644
|
2014-02-28 20:30:08 +00:00
|
|
|
--- a/drivers/usb/host/dwc_otg/dwc_otg_hcd.h
|
|
|
|
+++ b/drivers/usb/host/dwc_otg/dwc_otg_hcd.h
|
|
|
|
@@ -548,7 +548,7 @@ struct dwc_otg_hcd {
|
|
|
|
|
|
|
|
/* */
|
|
|
|
dwc_spinlock_t *lock;
|
|
|
|
-
|
|
|
|
+ dwc_spinlock_t *channel_lock;
|
|
|
|
/**
|
|
|
|
* Private data that could be used by OS wrapper.
|
|
|
|
*/
|
2014-09-27 19:10:51 +00:00
|
|
|
diff --git a/drivers/usb/host/dwc_otg/dwc_otg_hcd_ddma.c b/drivers/usb/host/dwc_otg/dwc_otg_hcd_ddma.c
|
|
|
|
index d0d5fa1..a2ceb77 100644
|
2014-02-28 20:30:08 +00:00
|
|
|
--- a/drivers/usb/host/dwc_otg/dwc_otg_hcd_ddma.c
|
|
|
|
+++ b/drivers/usb/host/dwc_otg/dwc_otg_hcd_ddma.c
|
2014-09-27 19:10:51 +00:00
|
|
|
@@ -276,7 +276,7 @@ void dump_frame_list(dwc_otg_hcd_t * hcd)
|
2014-02-28 20:30:08 +00:00
|
|
|
static void release_channel_ddma(dwc_otg_hcd_t * hcd, dwc_otg_qh_t * qh)
|
|
|
|
{
|
|
|
|
dwc_irqflags_t flags;
|
|
|
|
- dwc_spinlock_t *channel_lock = DWC_SPINLOCK_ALLOC();
|
|
|
|
+ dwc_spinlock_t *channel_lock = hcd->channel_lock;
|
|
|
|
|
|
|
|
dwc_hc_t *hc = qh->channel;
|
|
|
|
if (dwc_qh_is_non_per(qh)) {
|
2014-09-27 19:10:51 +00:00
|
|
|
@@ -306,7 +306,6 @@ static void release_channel_ddma(dwc_otg_hcd_t * hcd, dwc_otg_qh_t * qh)
|
2014-02-28 20:30:08 +00:00
|
|
|
dwc_memset(qh->desc_list, 0x00,
|
|
|
|
sizeof(dwc_otg_host_dma_desc_t) * max_desc_num(qh));
|
|
|
|
}
|
|
|
|
- DWC_SPINLOCK_FREE(channel_lock);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-09-27 19:10:51 +00:00
|
|
|
diff --git a/drivers/usb/host/dwc_otg/dwc_otg_hcd_intr.c b/drivers/usb/host/dwc_otg/dwc_otg_hcd_intr.c
|
|
|
|
index f1658fa..21e8f09 100644
|
2014-02-28 20:30:08 +00:00
|
|
|
--- a/drivers/usb/host/dwc_otg/dwc_otg_hcd_intr.c
|
|
|
|
+++ b/drivers/usb/host/dwc_otg/dwc_otg_hcd_intr.c
|
2014-09-27 19:10:51 +00:00
|
|
|
@@ -922,7 +922,7 @@ static void release_channel(dwc_otg_hcd_t * hcd,
|
2014-02-28 20:30:08 +00:00
|
|
|
dwc_otg_transaction_type_e tr_type;
|
|
|
|
int free_qtd;
|
|
|
|
dwc_irqflags_t flags;
|
|
|
|
- dwc_spinlock_t *channel_lock = DWC_SPINLOCK_ALLOC();
|
|
|
|
+ dwc_spinlock_t *channel_lock = hcd->channel_lock;
|
|
|
|
|
|
|
|
DWC_DEBUGPL(DBG_HCDV, " %s: channel %d, halt_status %d, xfer_len %d\n",
|
|
|
|
__func__, hc->hc_num, halt_status, hc->xfer_len);
|
|
|
|
@@ -1009,7 +1009,6 @@ cleanup:
|
|
|
|
if (tr_type != DWC_OTG_TRANSACTION_NONE) {
|
|
|
|
dwc_otg_hcd_queue_transactions(hcd, tr_type);
|
|
|
|
}
|
|
|
|
- DWC_SPINLOCK_FREE(channel_lock);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-09-27 19:10:51 +00:00
|
|
|
--
|
|
|
|
1.9.1
|
|
|
|
|