aboutsummaryrefslogtreecommitdiff
path: root/drivers/usb/host/ehci-mem.c
diff options
context:
space:
mode:
authorDavid Brownell <david-b@pacbell.net>2007-05-17 12:21:19 -0700
committerGreg Kroah-Hartman <gregkh@suse.de>2007-07-12 16:29:47 -0700
commit9c033e810eef0aff6d4d3bf028aa1e583c074f93 (patch)
treeb7dfa412f7882fa90fd6bb8c5e8cbc2185bd12cf /drivers/usb/host/ehci-mem.c
parent04d06ad0f1fdb499af84ae3d7969e2136a462f38 (diff)
USB: ehci refcounts work on ppc7448
Remove atomic operations on the reference counter for EHCI queue heads. On various platforms (including ppc7448), atomic operations are unusable with dma-coherent memory. Signed-off-by: Steven J. Hill <sjhill1@rockwellcollins.com> Signed-off-by: David Brownell <dbrownell@users.sourceforge.net> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/host/ehci-mem.c')
-rw-r--r--drivers/usb/host/ehci-mem.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/drivers/usb/host/ehci-mem.c b/drivers/usb/host/ehci-mem.c
index bdb29e61805..8816d09903d 100644
--- a/drivers/usb/host/ehci-mem.c
+++ b/drivers/usb/host/ehci-mem.c
@@ -64,9 +64,8 @@ static inline void ehci_qtd_free (struct ehci_hcd *ehci, struct ehci_qtd *qtd)
}
-static void qh_destroy (struct kref *kref)
+static void qh_destroy(struct ehci_qh *qh)
{
- struct ehci_qh *qh = container_of(kref, struct ehci_qh, kref);
struct ehci_hcd *ehci = qh->ehci;
/* clean qtds first, and know this is not linked */
@@ -90,7 +89,7 @@ static struct ehci_qh *ehci_qh_alloc (struct ehci_hcd *ehci, gfp_t flags)
return qh;
memset (qh, 0, sizeof *qh);
- kref_init(&qh->kref);
+ qh->refcount = 1;
qh->ehci = ehci;
qh->qh_dma = dma;
// INIT_LIST_HEAD (&qh->qh_list);
@@ -112,13 +111,15 @@ static struct ehci_qh *ehci_qh_alloc (struct ehci_hcd *ehci, gfp_t flags)
/* to share a qh (cpu threads, or hc) */
static inline struct ehci_qh *qh_get (struct ehci_qh *qh)
{
- kref_get(&qh->kref);
+ WARN_ON(!qh->refcount);
+ qh->refcount++;
return qh;
}
static inline void qh_put (struct ehci_qh *qh)
{
- kref_put(&qh->kref, qh_destroy);
+ if (!--qh->refcount)
+ qh_destroy(qh);
}
/*-------------------------------------------------------------------------*/