Commit 6ac15fda4e2b9ad45b7769037964110f7f597b5c

Authored by Stephen Warren
Committed by Marek Vasut
1 parent 7e54188775

usb: ci_udc: remove controller.items array

There's no need to store an array of QTD pointers in the controller.
Since the calculation is so simple, just have ci_get_qtd() perform it
at run-time, rather than pre-calculating everything.

Signed-off-by: Stephen Warren <swarren@nvidia.com>

Showing 2 changed files with 3 additions and 6 deletions Side-by-side Diff

drivers/usb/gadget/ci_udc.c
... ... @@ -146,7 +146,9 @@
146 146 */
147 147 static struct ept_queue_item *ci_get_qtd(int ep_num, int dir_in)
148 148 {
149   - return controller.items[(ep_num * 2) + dir_in];
  149 + int index = (ep_num * 2) + dir_in;
  150 + uint8_t *imem = controller.items_mem + (index * ILIST_ENT_SZ);
  151 + return (struct ept_queue_item *)imem;
150 152 }
151 153  
152 154 /**
... ... @@ -790,7 +792,6 @@
790 792 static int ci_udc_probe(void)
791 793 {
792 794 struct ept_queue_head *head;
793   - uint8_t *imem;
794 795 int i;
795 796  
796 797 const int num = 2 * NUM_ENDPOINTS;
... ... @@ -830,9 +831,6 @@
830 831 | CONFIG_ZLT;
831 832 head->next = TERMINATE;
832 833 head->info = 0;
833   -
834   - imem = controller.items_mem + (i * ILIST_ENT_SZ);
835   - controller.items[i] = (struct ept_queue_item *)imem;
836 834  
837 835 if (i & 1) {
838 836 ci_flush_qh(i / 2);
drivers/usb/gadget/ci_udc.h
... ... @@ -102,7 +102,6 @@
102 102 struct usb_gadget_driver *driver;
103 103 struct ehci_ctrl *ctrl;
104 104 struct ept_queue_head *epts;
105   - struct ept_queue_item *items[2 * NUM_ENDPOINTS];
106 105 uint8_t *items_mem;
107 106 struct ci_ep ep[NUM_ENDPOINTS];
108 107 };