]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/usb/host/ehci-mem.c
Merge branch 'x86-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git...
[linux-2.6-omap-h63xx.git] / drivers / usb / host / ehci-mem.c
index bdb29e61805870173d164eee9ba128fa9125ae2c..0431397836f65e859f1a2b1829f418fa3697f65d 100644 (file)
@@ -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,14 +89,11 @@ 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);
        INIT_LIST_HEAD (&qh->qtd_list);
-#ifdef CONFIG_CPU_FREQ
-       INIT_LIST_HEAD (&qh->split_intr_qhs);
-#endif
 
        /* dummy td enables safe urb queuing */
        qh->dummy = ehci_qtd_alloc (ehci, flags);
@@ -112,13 +108,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);
 }
 
 /*-------------------------------------------------------------------------*/