aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/renesas_usbhs
diff options
context:
space:
mode:
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>2011-10-31 03:48:22 -0400
committerFelipe Balbi <balbi@ti.com>2011-12-12 04:45:08 -0500
commitf352741d2704a480a927160be8c910570bf51238 (patch)
tree43ca57cd4d497e4e770ac674a1e6f656018a5668 /drivers/usb/renesas_usbhs
parentd399f90d192f4cbda2527d42d054d090e327a9a0 (diff)
usb: gadget: renesas_usbhs: cleanup usbhsh_endpoint_xxx()
this patch cleanup - make sure static function - remove unneeded label - useless local variable were removed Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers/usb/renesas_usbhs')
-rw-r--r--drivers/usb/renesas_usbhs/mod_host.c59
1 files changed, 28 insertions, 31 deletions
diff --git a/drivers/usb/renesas_usbhs/mod_host.c b/drivers/usb/renesas_usbhs/mod_host.c
index 1816a3e11b78..e09b64a92a4e 100644
--- a/drivers/usb/renesas_usbhs/mod_host.c
+++ b/drivers/usb/renesas_usbhs/mod_host.c
@@ -340,36 +340,26 @@ static void usbhsh_device_free(struct usbhsh_hpriv *hpriv,
340/* 340/*
341 * end-point control 341 * end-point control
342 */ 342 */
343struct usbhsh_ep *usbhsh_endpoint_alloc(struct usbhsh_hpriv *hpriv, 343static struct usbhsh_ep *usbhsh_endpoint_alloc(struct usbhsh_hpriv *hpriv,
344 struct usbhsh_device *udev, 344 struct usbhsh_device *udev,
345 struct usb_host_endpoint *ep, 345 struct usb_host_endpoint *ep,
346 int dir_in_req, 346 int dir_in_req,
347 gfp_t mem_flags) 347 gfp_t mem_flags)
348{ 348{
349 struct usbhs_priv *priv = usbhsh_hpriv_to_priv(hpriv); 349 struct usbhs_priv *priv = usbhsh_hpriv_to_priv(hpriv);
350 struct usb_hcd *hcd = usbhsh_hpriv_to_hcd(hpriv);
351 struct usbhsh_ep *uep; 350 struct usbhsh_ep *uep;
352 struct usbhsh_pipe_info *info; 351 struct usbhsh_pipe_info *info;
353 struct usbhs_pipe *pipe, *best_pipe; 352 struct usbhs_pipe *best_pipe = NULL;
354 struct device *dev = usbhsh_hcd_to_dev(hcd); 353 struct device *dev = usbhs_priv_to_dev(priv);
355 struct usb_endpoint_descriptor *desc = &ep->desc; 354 struct usb_endpoint_descriptor *desc = &ep->desc;
356 int type, i, dir_in;
357 unsigned int min_usr;
358 unsigned long flags; 355 unsigned long flags;
359 356
360 dir_in_req = !!dir_in_req;
361
362 uep = kzalloc(sizeof(struct usbhsh_ep), mem_flags); 357 uep = kzalloc(sizeof(struct usbhsh_ep), mem_flags);
363 if (!uep) { 358 if (!uep) {
364 dev_err(dev, "usbhsh_ep alloc fail\n"); 359 dev_err(dev, "usbhsh_ep alloc fail\n");
365 return NULL; 360 return NULL;
366 } 361 }
367 362
368 if (usb_endpoint_xfer_control(desc)) {
369 best_pipe = usbhsh_hpriv_to_dcp(hpriv);
370 goto usbhsh_endpoint_alloc_find_pipe;
371 }
372
373 /******************** spin lock ********************/ 363 /******************** spin lock ********************/
374 usbhs_lock(priv, flags); 364 usbhs_lock(priv, flags);
375 365
@@ -378,22 +368,29 @@ struct usbhsh_ep *usbhsh_endpoint_alloc(struct usbhsh_hpriv *hpriv,
378 * see 368 * see
379 * HARDWARE LIMITATION 369 * HARDWARE LIMITATION
380 */ 370 */
381 type = usb_endpoint_type(desc); 371 if (usb_endpoint_xfer_control(desc)) {
382 min_usr = ~0; 372 /* best pipe is DCP */
383 best_pipe = NULL; 373 best_pipe = usbhsh_hpriv_to_dcp(hpriv);
384 usbhs_for_each_pipe(pipe, priv, i) { 374 } else {
385 if (!usbhs_pipe_type_is(pipe, type)) 375 struct usbhs_pipe *pipe;
386 continue; 376 unsigned int min_usr = ~0;
387 377 int i, dir_in;
388 dir_in = !!usbhs_pipe_is_dir_in(pipe); 378
389 if (0 != (dir_in - dir_in_req)) 379 dir_in_req = !!dir_in_req;
390 continue; 380
391 381 usbhs_for_each_pipe(pipe, priv, i) {
392 info = usbhsh_pipe_info(pipe); 382 if (!usbhs_pipe_type_is(pipe, usb_endpoint_type(desc)))
393 383 continue;
394 if (min_usr > info->usr_cnt) { 384
395 min_usr = info->usr_cnt; 385 dir_in = !!usbhs_pipe_is_dir_in(pipe);
396 best_pipe = pipe; 386 if (0 != (dir_in - dir_in_req))
387 continue;
388
389 info = usbhsh_pipe_info(pipe);
390 if (min_usr > info->usr_cnt) {
391 min_usr = info->usr_cnt;
392 best_pipe = pipe;
393 }
397 } 394 }
398 } 395 }
399 396
@@ -415,7 +412,7 @@ struct usbhsh_ep *usbhsh_endpoint_alloc(struct usbhsh_hpriv *hpriv,
415 kfree(uep); 412 kfree(uep);
416 return NULL; 413 return NULL;
417 } 414 }
418usbhsh_endpoint_alloc_find_pipe: 415
419 /* 416 /*
420 * init uep 417 * init uep
421 */ 418 */
@@ -443,7 +440,7 @@ usbhsh_endpoint_alloc_find_pipe:
443 return uep; 440 return uep;
444} 441}
445 442
446void usbhsh_endpoint_free(struct usbhsh_hpriv *hpriv, 443static void usbhsh_endpoint_free(struct usbhsh_hpriv *hpriv,
447 struct usb_host_endpoint *ep) 444 struct usb_host_endpoint *ep)
448{ 445{
449 struct usbhs_priv *priv = usbhsh_hpriv_to_priv(hpriv); 446 struct usbhs_priv *priv = usbhsh_hpriv_to_priv(hpriv);