projects
/
openwrt.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
[adm5120] fix usb mis-cleanup after r27162 (#9581)
[openwrt.git]
/
target
/
linux
/
adm5120
/
files
/
drivers
/
usb
/
host
/
adm5120-hcd.c
diff --git
a/target/linux/adm5120/files/drivers/usb/host/adm5120-hcd.c
b/target/linux/adm5120/files/drivers/usb/host/adm5120-hcd.c
index
2d2604a
..
0412546
100644
(file)
--- a/
target/linux/adm5120/files/drivers/usb/host/adm5120-hcd.c
+++ b/
target/linux/adm5120/files/drivers/usb/host/adm5120-hcd.c
@@
-1,7
+1,7
@@
/*
* ADM5120 HCD (Host Controller Driver) for USB
*
/*
* ADM5120 HCD (Host Controller Driver) for USB
*
- * Copyright (C) 2007
,2008 Gabor Juhos <juhosg at
openwrt.org>
+ * Copyright (C) 2007
-2008 Gabor Juhos <juhosg@
openwrt.org>
*
* This file was derived from: drivers/usb/host/ohci-hcd.c
* (C) Copyright 1999 Roman Weissgaerber <weissg@vienna.at>
*
* This file was derived from: drivers/usb/host/ohci-hcd.c
* (C) Copyright 1999 Roman Weissgaerber <weissg@vienna.at>
@@
-35,8
+35,9
@@
#include <linux/dma-mapping.h>
#include <linux/dmapool.h>
#include <linux/reboot.h>
#include <linux/dma-mapping.h>
#include <linux/dmapool.h>
#include <linux/reboot.h>
+#include <linux/debugfs.h>
+#include <linux/io.h>
-#include <asm/io.h>
#include <asm/irq.h>
#include <asm/system.h>
#include <asm/unaligned.h>
#include <asm/irq.h>
#include <asm/system.h>
#include <asm/unaligned.h>
@@
-45,8
+46,8
@@
#include "../core/hcd.h"
#include "../core/hub.h"
#include "../core/hcd.h"
#include "../core/hub.h"
-#define DRIVER_VERSION "0.
16.3
"
-#define DRIVER_AUTHOR "Gabor Juhos <juhosg
at
openwrt.org>"
+#define DRIVER_VERSION "0.
27.0
"
+#define DRIVER_AUTHOR "Gabor Juhos <juhosg
@
openwrt.org>"
#define DRIVER_DESC "ADMtek USB 1.1 Host Controller Driver"
/*-------------------------------------------------------------------------*/
#define DRIVER_DESC "ADMtek USB 1.1 Host Controller Driver"
/*-------------------------------------------------------------------------*/
@@
-57,12
+58,12
@@
#define OHCI_CONTROL_INIT OHCI_CTRL_CBSR
#define ADMHC_INTR_INIT \
#define OHCI_CONTROL_INIT OHCI_CTRL_CBSR
#define ADMHC_INTR_INIT \
- (
ADMHC_INTR_MIE | ADMHC_INTR_INSM | ADMHC_INTR_FATI \
- | ADMHC_INTR_RESI | ADMHC_INTR_TDC | ADMHC_INTR_BABI
)
+ (ADMHC_INTR_MIE | ADMHC_INTR_INSM | ADMHC_INTR_FATI \
+ | ADMHC_INTR_RESI | ADMHC_INTR_TDC | ADMHC_INTR_BABI)
/*-------------------------------------------------------------------------*/
/*-------------------------------------------------------------------------*/
-static const char hcd_name
[] = "admhc-hcd";
+static const char hcd_name[] = "admhc-hcd";
#define STATECHANGE_DELAY msecs_to_jiffies(300)
#define STATECHANGE_DELAY msecs_to_jiffies(300)
@@
-83,8
+84,8
@@
static void admhc_stop(struct usb_hcd *hcd);
/*
* queue up an urb for anything except the root hub
*/
/*
* queue up an urb for anything except the root hub
*/
-static int admhc_urb_enqueue(struct usb_hcd *hcd, struct u
sb_host_endpoint *ep
,
-
struct urb *urb,
gfp_t mem_flags)
+static int admhc_urb_enqueue(struct usb_hcd *hcd, struct u
rb *urb
,
+
gfp_t mem_flags)
{
struct admhcd *ahcd = hcd_to_admhcd(hcd);
struct ed *ed;
{
struct admhcd *ahcd = hcd_to_admhcd(hcd);
struct ed *ed;
@@
-96,12
+97,12
@@
static int admhc_urb_enqueue(struct usb_hcd *hcd, struct usb_host_endpoint *ep,
#ifdef ADMHC_VERBOSE_DEBUG
spin_lock_irqsave(&ahcd->lock, flags);
#ifdef ADMHC_VERBOSE_DEBUG
spin_lock_irqsave(&ahcd->lock, flags);
- urb_print(ahcd, urb, "ENQEUE", usb_pipein(pipe));
+ urb_print(ahcd, urb, "ENQEUE", usb_pipein(pipe)
, -EINPROGRESS
);
spin_unlock_irqrestore(&ahcd->lock, flags);
#endif
/* every endpoint has an ed, locate and maybe (re)initialize it */
spin_unlock_irqrestore(&ahcd->lock, flags);
#endif
/* every endpoint has an ed, locate and maybe (re)initialize it */
- ed = ed_get(ahcd, ep, urb->dev, pipe, urb->interval);
+ ed = ed_get(ahcd,
urb->
ep, urb->dev, pipe, urb->interval);
if (!ed)
return -ENOMEM;
if (!ed)
return -ENOMEM;
@@
-127,7
+128,7
@@
static int admhc_urb_enqueue(struct usb_hcd *hcd, struct usb_host_endpoint *ep,
else if ((urb->transfer_flags & URB_ZERO_PACKET) != 0
&& (urb->transfer_buffer_length
% usb_maxpacket(urb->dev, pipe,
else if ((urb->transfer_flags & URB_ZERO_PACKET) != 0
&& (urb->transfer_buffer_length
% usb_maxpacket(urb->dev, pipe,
- usb_pipeout
(pipe))) == 0)
+ usb_pipeout(pipe))) == 0)
td_cnt++;
break;
case PIPE_INTERRUPT:
td_cnt++;
break;
case PIPE_INTERRUPT:
@@
-161,22
+162,17
@@
static int admhc_urb_enqueue(struct usb_hcd *hcd, struct usb_host_endpoint *ep,
goto fail;
}
goto fail;
}
- /* in case of unlink-during-submit */
- spin_lock(&urb->lock);
- if (urb->status != -EINPROGRESS) {
- spin_unlock(&urb->lock);
- urb->hcpriv = urb_priv;
- finish_urb(ahcd, urb);
- ret = 0;
+ ret = usb_hcd_link_urb_to_ep(hcd, urb);
+ if (ret)
goto fail;
goto fail;
- }
/* schedule the ed if needed */
if (ed->state == ED_IDLE) {
ret = ed_schedule(ahcd, ed);
/* schedule the ed if needed */
if (ed->state == ED_IDLE) {
ret = ed_schedule(ahcd, ed);
- if (ret < 0)
- goto fail0;
-
+ if (ret < 0) {
+ usb_hcd_unlink_urb_from_ep(hcd, urb);
+ goto fail;
+ }
if (ed->type == PIPE_ISOCHRONOUS) {
u16 frame = admhc_frame_no(ahcd);
if (ed->type == PIPE_ISOCHRONOUS) {
u16 frame = admhc_frame_no(ahcd);
@@
-204,8
+200,6
@@
static int admhc_urb_enqueue(struct usb_hcd *hcd, struct usb_host_endpoint *ep,
admhc_dump_ed(ahcd, "admhc_urb_enqueue", urb_priv->ed, 1);
#endif
admhc_dump_ed(ahcd, "admhc_urb_enqueue", urb_priv->ed, 1);
#endif
-fail0:
- spin_unlock(&urb->lock);
fail:
if (ret)
urb_priv_free(ahcd, urb_priv);
fail:
if (ret)
urb_priv_free(ahcd, urb_priv);
@@
-215,23
+209,28
@@
fail:
}
/*
}
/*
- * decouple the URB from the HC queues (TDs, urb_priv);
it's
- *
already marked using urb->status.
reporting is always done
+ * decouple the URB from the HC queues (TDs, urb_priv);
+ * reporting is always done
* asynchronously, and we might be dealing with an urb that's
* partially transferred, or an ED with other urbs being unlinked.
*/
* asynchronously, and we might be dealing with an urb that's
* partially transferred, or an ED with other urbs being unlinked.
*/
-static int admhc_urb_dequeue(struct usb_hcd *hcd, struct urb *urb)
+static int admhc_urb_dequeue(struct usb_hcd *hcd, struct urb *urb,
+ int status)
{
struct admhcd *ahcd = hcd_to_admhcd(hcd);
unsigned long flags;
{
struct admhcd *ahcd = hcd_to_admhcd(hcd);
unsigned long flags;
+ int ret;
spin_lock_irqsave(&ahcd->lock, flags);
#ifdef ADMHC_VERBOSE_DEBUG
spin_lock_irqsave(&ahcd->lock, flags);
#ifdef ADMHC_VERBOSE_DEBUG
- urb_print(ahcd, urb, "DEQUEUE", 1);
+ urb_print(ahcd, urb, "DEQUEUE", 1
, status
);
#endif
#endif
-
- if (HC_IS_RUNNING(hcd->state)) {
+ ret = usb_hcd_check_unlink_urb(hcd, urb, status);
+ if (ret) {
+ /* Do nothing */
+ ;
+ } else if (HC_IS_RUNNING(hcd->state)) {
struct urb_priv *urb_priv;
/* Unless an IRQ completed the unlink while it was being
struct urb_priv *urb_priv;
/* Unless an IRQ completed the unlink while it was being
@@
-249,11
+248,11
@@
static int admhc_urb_dequeue(struct usb_hcd *hcd, struct urb *urb)
* any more ... just clean up every urb's memory.
*/
if (urb->hcpriv)
* any more ... just clean up every urb's memory.
*/
if (urb->hcpriv)
- finish_urb(ahcd, urb);
+ finish_urb(ahcd, urb
, status
);
}
spin_unlock_irqrestore(&ahcd->lock, flags);
}
spin_unlock_irqrestore(&ahcd->lock, flags);
- return
0
;
+ return
ret
;
}
/*-------------------------------------------------------------------------*/
}
/*-------------------------------------------------------------------------*/
@@
-303,8
+302,8
@@
sanitize:
goto rescan;
case ED_IDLE: /* fully unlinked */
if (list_empty(&ed->td_list)) {
goto rescan;
case ED_IDLE: /* fully unlinked */
if (list_empty(&ed->td_list)) {
- td_free
(ahcd, ed->dummy);
- ed_free
(ahcd, ed);
+ td_free(ahcd, ed->dummy);
+ ed_free(ahcd, ed);
break;
}
/* else FALL THROUGH */
break;
}
/* else FALL THROUGH */
@@
-341,7
+340,7
@@
static void admhc_usb_reset(struct admhcd *ahcd)
#else
/* FIXME */
ahcd->host_control = ADMHC_BUSS_RESET;
#else
/* FIXME */
ahcd->host_control = ADMHC_BUSS_RESET;
- admhc_writel(ahcd, ahcd->host_control
,
&ahcd->regs->host_control);
+ admhc_writel(ahcd, ahcd->host_control
,
&ahcd->regs->host_control);
#endif
}
#endif
}
@@
-643,7
+642,7
@@
static irqreturn_t admhc_irq(struct usb_hcd *hcd)
{
struct admhcd *ahcd = hcd_to_admhcd(hcd);
struct admhcd_regs __iomem *regs = ahcd->regs;
{
struct admhcd *ahcd = hcd_to_admhcd(hcd);
struct admhcd_regs __iomem *regs = ahcd->regs;
- u32 ints;
+ u32 ints;
ints = admhc_readl(ahcd, ®s->int_status);
if ((ints & ADMHC_INTR_INTA) == 0) {
ints = admhc_readl(ahcd, ®s->int_status);
if ((ints & ADMHC_INTR_INTA) == 0) {
@@
-779,7
+778,7
@@
static void admhc_stop(struct usb_hcd *hcd)
/*-------------------------------------------------------------------------*/
/*-------------------------------------------------------------------------*/
-#ifdef CONFIG_
MIPS_
ADM5120
+#ifdef CONFIG_ADM5120
#include "adm5120-drv.c"
#define PLATFORM_DRIVER usb_hcd_adm5120_driver
#endif
#include "adm5120-drv.c"
#define PLATFORM_DRIVER usb_hcd_adm5120_driver
#endif
@@
-799,7
+798,15
@@
static int __init admhc_hcd_mod_init(void)
pr_info("%s: " DRIVER_INFO "\n", hcd_name);
pr_info("%s: block sizes: ed %Zd td %Zd\n", hcd_name,
pr_info("%s: " DRIVER_INFO "\n", hcd_name);
pr_info("%s: block sizes: ed %Zd td %Zd\n", hcd_name,
- sizeof (struct ed), sizeof (struct td));
+ sizeof(struct ed), sizeof(struct td));
+
+#ifdef DEBUG
+ admhc_debug_root = debugfs_create_dir("admhc", NULL);
+ if (!admhc_debug_root) {
+ ret = -ENOENT;
+ goto error_debug;
+ }
+#endif
#ifdef PLATFORM_DRIVER
ret = platform_driver_register(&PLATFORM_DRIVER);
#ifdef PLATFORM_DRIVER
ret = platform_driver_register(&PLATFORM_DRIVER);
@@
-812,6
+819,12
@@
static int __init admhc_hcd_mod_init(void)
#ifdef PLATFORM_DRIVER
platform_driver_unregister(&PLATFORM_DRIVER);
error_platform:
#ifdef PLATFORM_DRIVER
platform_driver_unregister(&PLATFORM_DRIVER);
error_platform:
+#endif
+
+#ifdef DEBUG
+ debugfs_remove(admhc_debug_root);
+ admhc_debug_root = NULL;
+error_debug:
#endif
return ret;
}
#endif
return ret;
}
@@
-820,6
+833,9
@@
module_init(admhc_hcd_mod_init);
static void __exit admhc_hcd_mod_exit(void)
{
platform_driver_unregister(&PLATFORM_DRIVER);
static void __exit admhc_hcd_mod_exit(void)
{
platform_driver_unregister(&PLATFORM_DRIVER);
+#ifdef DEBUG
+ debugfs_remove(admhc_debug_root);
+#endif
}
module_exit(admhc_hcd_mod_exit);
}
module_exit(admhc_hcd_mod_exit);
This page took
0.031929 seconds
and
4
git commands to generate.