aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/wusbcore/devconnect.c27
-rw-r--r--drivers/usb/wusbcore/mmc.c14
2 files changed, 8 insertions, 33 deletions
diff --git a/drivers/usb/wusbcore/devconnect.c b/drivers/usb/wusbcore/devconnect.c
index 30d7020e1c50..f45d777bef34 100644
--- a/drivers/usb/wusbcore/devconnect.c
+++ b/drivers/usb/wusbcore/devconnect.c
@@ -200,7 +200,6 @@ static struct wusb_dev *wusbhc_cack_add(struct wusbhc *wusbhc,
200 u8 dev_addr; 200 u8 dev_addr;
201 int result; 201 int result;
202 202
203 d_fnstart(3, dev, "(wusbhc %p port_idx %d)\n", wusbhc, port_idx);
204 /* Is it registered already? */ 203 /* Is it registered already? */
205 list_for_each_entry(wusb_dev, &wusbhc->cack_list, cack_node) 204 list_for_each_entry(wusb_dev, &wusbhc->cack_list, cack_node)
206 if (!memcmp(&wusb_dev->cdid, &dnc->CDID, 205 if (!memcmp(&wusb_dev->cdid, &dnc->CDID,
@@ -208,13 +207,8 @@ static struct wusb_dev *wusbhc_cack_add(struct wusbhc *wusbhc,
208 return wusb_dev; 207 return wusb_dev;
209 /* We don't have it, create an entry, register it */ 208 /* We don't have it, create an entry, register it */
210 wusb_dev = wusb_dev_alloc(wusbhc); 209 wusb_dev = wusb_dev_alloc(wusbhc);
211 if (wusb_dev == NULL) { 210 if (wusb_dev == NULL)
212 if (printk_ratelimit())
213 dev_err(dev, "DN CONNECT: no memory to process %s's %s "
214 "request\n", pr_cdid,
215 new_connection ? "connect" : "reconnect");
216 return NULL; 211 return NULL;
217 }
218 wusb_dev_init(wusb_dev); 212 wusb_dev_init(wusb_dev);
219 wusb_dev->cdid = dnc->CDID; 213 wusb_dev->cdid = dnc->CDID;
220 wusb_dev->port_idx = port_idx; 214 wusb_dev->port_idx = port_idx;
@@ -246,7 +240,6 @@ static struct wusb_dev *wusbhc_cack_add(struct wusbhc *wusbhc,
246 list_add_tail(&wusb_dev->cack_node, &wusbhc->cack_list); 240 list_add_tail(&wusb_dev->cack_node, &wusbhc->cack_list);
247 wusbhc->cack_count++; 241 wusbhc->cack_count++;
248 wusbhc_fill_cack_ie(wusbhc); 242 wusbhc_fill_cack_ie(wusbhc);
249 d_fnend(3, dev, "(wusbhc %p port_idx %d)\n", wusbhc, port_idx);
250 return wusb_dev; 243 return wusb_dev;
251} 244}
252 245
@@ -334,13 +327,8 @@ void wusbhc_devconnect_ack(struct wusbhc *wusbhc, struct wusb_dn_connect *dnc,
334 for (idx = 0; idx < wusbhc->ports_max; idx++) { 327 for (idx = 0; idx < wusbhc->ports_max; idx++) {
335 port = wusb_port_by_idx(wusbhc, idx); 328 port = wusb_port_by_idx(wusbhc, idx);
336 if (port->wusb_dev 329 if (port->wusb_dev
337 && !memcmp(&dnc->CDID, &port->wusb_dev->cdid, 330 && memcmp(&dnc->CDID, &port->wusb_dev->cdid, sizeof(dnc->CDID)) == 0)
338 sizeof(dnc->CDID))) {
339 if (printk_ratelimit())
340 dev_err(dev, "Already handling dev %s "
341 " (it might be slow)\n", pr_cdid);
342 goto error_unlock; 331 goto error_unlock;
343 }
344 } 332 }
345 /* Look up those fake ports we have for a free one */ 333 /* Look up those fake ports we have for a free one */
346 for (idx = 0; idx < wusbhc->ports_max; idx++) { 334 for (idx = 0; idx < wusbhc->ports_max; idx++) {
@@ -494,7 +482,6 @@ int wusbhc_devconnect_auth(struct wusbhc *wusbhc, u8 port_idx)
494 */ 482 */
495static void __wusbhc_keep_alive(struct wusbhc *wusbhc) 483static void __wusbhc_keep_alive(struct wusbhc *wusbhc)
496{ 484{
497 int result;
498 struct device *dev = wusbhc->dev; 485 struct device *dev = wusbhc->dev;
499 unsigned cnt; 486 unsigned cnt;
500 struct wusb_dev *wusb_dev; 487 struct wusb_dev *wusb_dev;
@@ -502,7 +489,6 @@ static void __wusbhc_keep_alive(struct wusbhc *wusbhc)
502 struct wuie_keep_alive *ie = &wusbhc->keep_alive_ie; 489 struct wuie_keep_alive *ie = &wusbhc->keep_alive_ie;
503 unsigned keep_alives, old_keep_alives; 490 unsigned keep_alives, old_keep_alives;
504 491
505 d_fnstart(5, dev, "(wusbhc %p)\n", wusbhc);
506 old_keep_alives = ie->hdr.bLength - sizeof(ie->hdr); 492 old_keep_alives = ie->hdr.bLength - sizeof(ie->hdr);
507 keep_alives = 0; 493 keep_alives = 0;
508 for (cnt = 0; 494 for (cnt = 0;
@@ -531,13 +517,10 @@ static void __wusbhc_keep_alive(struct wusbhc *wusbhc)
531 ie->bDeviceAddress[keep_alives++] = 0x7f; 517 ie->bDeviceAddress[keep_alives++] = 0x7f;
532 ie->hdr.bLength = sizeof(ie->hdr) + 518 ie->hdr.bLength = sizeof(ie->hdr) +
533 keep_alives*sizeof(ie->bDeviceAddress[0]); 519 keep_alives*sizeof(ie->bDeviceAddress[0]);
534 if (keep_alives > 0) { 520 if (keep_alives > 0)
535 result = wusbhc_mmcie_set(wusbhc, 10, 5, &ie->hdr); 521 wusbhc_mmcie_set(wusbhc, 10, 5, &ie->hdr);
536 if (result < 0 && printk_ratelimit()) 522 else if (old_keep_alives != 0)
537 dev_err(dev, "KEEPALIVE: can't set MMC: %d\n", result);
538 } else if (old_keep_alives != 0)
539 wusbhc_mmcie_rm(wusbhc, &ie->hdr); 523 wusbhc_mmcie_rm(wusbhc, &ie->hdr);
540 d_fnend(5, dev, "(wusbhc %p) = void\n", wusbhc);
541} 524}
542 525
543/* 526/*
diff --git a/drivers/usb/wusbcore/mmc.c b/drivers/usb/wusbcore/mmc.c
index 76907286f156..cfa77a01cebd 100644
--- a/drivers/usb/wusbcore/mmc.c
+++ b/drivers/usb/wusbcore/mmc.c
@@ -93,7 +93,6 @@ int wusbhc_mmcie_set(struct wusbhc *wusbhc, u8 interval, u8 repeat_cnt,
93 struct wuie_hdr *wuie) 93 struct wuie_hdr *wuie)
94{ 94{
95 int result = -ENOBUFS; 95 int result = -ENOBUFS;
96 struct device *dev = wusbhc->dev;
97 unsigned handle, itr; 96 unsigned handle, itr;
98 97
99 /* Search a handle, taking into account the ordering */ 98 /* Search a handle, taking into account the ordering */
@@ -119,11 +118,8 @@ int wusbhc_mmcie_set(struct wusbhc *wusbhc, u8 interval, u8 repeat_cnt,
119 if (wusbhc->mmcie[itr] == NULL) 118 if (wusbhc->mmcie[itr] == NULL)
120 handle = itr; 119 handle = itr;
121 } 120 }
122 if (handle == ~0) { 121 if (handle == ~0)
123 if (printk_ratelimit())
124 dev_err(dev, "MMC handle space exhausted\n");
125 goto error_unlock; 122 goto error_unlock;
126 }
127 } 123 }
128 result = (wusbhc->mmcie_add)(wusbhc, interval, repeat_cnt, handle, 124 result = (wusbhc->mmcie_add)(wusbhc, interval, repeat_cnt, handle,
129 wuie); 125 wuie);
@@ -143,15 +139,15 @@ EXPORT_SYMBOL_GPL(wusbhc_mmcie_set);
143void wusbhc_mmcie_rm(struct wusbhc *wusbhc, struct wuie_hdr *wuie) 139void wusbhc_mmcie_rm(struct wusbhc *wusbhc, struct wuie_hdr *wuie)
144{ 140{
145 int result; 141 int result;
146 struct device *dev = wusbhc->dev;
147 unsigned handle, itr; 142 unsigned handle, itr;
148 143
149 mutex_lock(&wusbhc->mmcie_mutex); 144 mutex_lock(&wusbhc->mmcie_mutex);
150 for (itr = 0; itr < wusbhc->mmcies_max; itr++) 145 for (itr = 0; itr < wusbhc->mmcies_max; itr++) {
151 if (wusbhc->mmcie[itr] == wuie) { 146 if (wusbhc->mmcie[itr] == wuie) {
152 handle = itr; 147 handle = itr;
153 goto found; 148 goto found;
154 } 149 }
150 }
155 mutex_unlock(&wusbhc->mmcie_mutex); 151 mutex_unlock(&wusbhc->mmcie_mutex);
156 return; 152 return;
157 153
@@ -159,11 +155,7 @@ found:
159 result = (wusbhc->mmcie_rm)(wusbhc, handle); 155 result = (wusbhc->mmcie_rm)(wusbhc, handle);
160 if (result == 0) 156 if (result == 0)
161 wusbhc->mmcie[itr] = NULL; 157 wusbhc->mmcie[itr] = NULL;
162 else if (printk_ratelimit())
163 dev_err(dev, "MMC: Failed to remove IE %p (0x%02x)\n",
164 wuie, wuie->bIEIdentifier);
165 mutex_unlock(&wusbhc->mmcie_mutex); 158 mutex_unlock(&wusbhc->mmcie_mutex);
166 return;
167} 159}
168EXPORT_SYMBOL_GPL(wusbhc_mmcie_rm); 160EXPORT_SYMBOL_GPL(wusbhc_mmcie_rm);
169 161