Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 59388
b: refs/heads/master
c: 9c033e8
h: refs/heads/master
v: v3
  • Loading branch information
David Brownell authored and Greg Kroah-Hartman committed Jul 12, 2007
1 parent 324fd3d commit 4a46846
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 04d06ad0f1fdb499af84ae3d7969e2136a462f38
refs/heads/master: 9c033e810eef0aff6d4d3bf028aa1e583c074f93
11 changes: 6 additions & 5 deletions trunk/drivers/usb/host/ehci-mem.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand All @@ -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);
Expand All @@ -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);
}

/*-------------------------------------------------------------------------*/
Expand Down
9 changes: 8 additions & 1 deletion trunk/drivers/usb/host/ehci.h
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,14 @@ struct ehci_qh {
struct ehci_qh *reclaim; /* next to reclaim */

struct ehci_hcd *ehci;
struct kref kref;

/*
* Do NOT use atomic operations for QH refcounting. On some CPUs
* (PPC7448 for example), atomic operations cannot be performed on
* memory that is cache-inhibited (i.e. being used for DMA).
* Spinlocks are used to protect all QH fields.
*/
u32 refcount;
unsigned stamp;

u8 qh_state;
Expand Down

0 comments on commit 4a46846

Please sign in to comment.