--- ./drivers/usb-dist/host/uhci.c	Tue Apr 23 08:46:40 2002
+++ ./drivers/usb/host/uhci.c	Thu May  9 15:19:09 2002
@@ -121,7 +121,7 @@
 	unsigned long flags;
 
 	spin_lock_irqsave(&uhci->frame_list_lock, flags);
-	set_bit(TD_CTRL_IOC_BIT, &uhci->skel_term_td->status);
+	uhci->skel_term_td->status |= cpu_to_le32 (TD_CTRL_IOC);
 	spin_unlock_irqrestore(&uhci->frame_list_lock, flags);
 }
 
@@ -130,7 +130,7 @@
 	unsigned long flags;
 
 	spin_lock_irqsave(&uhci->frame_list_lock, flags);
-	clear_bit(TD_CTRL_IOC_BIT, &uhci->skel_term_td->status);
+	uhci->skel_term_td->status &= ~cpu_to_le32 (TD_CTRL_IOC);
 	spin_unlock_irqrestore(&uhci->frame_list_lock, flags);
 }
 
@@ -165,7 +165,8 @@
 	INIT_LIST_HEAD(&td->list);
 	INIT_LIST_HEAD(&td->fl_list);
 
-	usb_inc_dev_use(dev);
+	if (likely (dev != 0))
+		usb_inc_dev_use(dev);
 
 	return td;
 }
@@ -342,7 +343,8 @@
 	INIT_LIST_HEAD(&qh->list);
 	INIT_LIST_HEAD(&qh->remove_list);
 
-	usb_inc_dev_use(dev);
+	if (likely (dev != 0))
+		usb_inc_dev_use(dev);
 
 	return qh;
 }
@@ -475,9 +477,9 @@
 		tmp = tmp->next;
 
 		if (toggle)
-			set_bit(TD_TOKEN_TOGGLE, &td->info);
+			td->info |= cpu_to_le32 (1 << TD_TOKEN_TOGGLE);
 		else
-			clear_bit(TD_TOKEN_TOGGLE, &td->info);
+			td->info &= ~cpu_to_le32 (1 << TD_TOKEN_TOGGLE);
 
 		toggle ^= 1;
 	}
@@ -961,7 +963,7 @@
 			uhci_inc_fsbr(urb->dev->bus->hcpriv, urb);
 			urbp->fsbr_timeout = 0;
 			urbp->fsbrtime = jiffies;
-			clear_bit(TD_CTRL_IOC_BIT, &td->status);
+			td->status &= ~cpu_to_le32 (TD_CTRL_IOC);
 		}
 
 		status = uhci_status_bits(td->status);
@@ -1137,7 +1139,7 @@
 			uhci_inc_fsbr(urb->dev->bus->hcpriv, urb);
 			urbp->fsbr_timeout = 0;
 			urbp->fsbrtime = jiffies;
-			clear_bit(TD_CTRL_IOC_BIT, &td->status);
+			td->status &= ~cpu_to_le32 (TD_CTRL_IOC);
 		}
 
 		status = uhci_status_bits(td->status);
@@ -1852,7 +1854,7 @@
 		tmp = tmp->next;
 
 		if (td->status & TD_CTRL_ACTIVE) {
-			set_bit(TD_CTRL_IOC_BIT, &td->status);
+			td->status |= cpu_to_le32 (TD_CTRL_IOC);
 			break;
 		}
 	}
@@ -2834,7 +2836,7 @@
 		goto err_alloc_root_hub;
 	}
 
-	uhci->skeltd[0] = uhci_alloc_td(uhci, uhci->rh.dev);
+	uhci->skeltd[0] = uhci_alloc_td(uhci, 0);
 	if (!uhci->skeltd[0]) {
 		err("unable to allocate TD 0");
 		goto err_alloc_skeltd;
@@ -2847,7 +2849,7 @@
 	for (i = 1; i < 9; i++) {
 		struct uhci_td *td;
 
-		td = uhci->skeltd[i] = uhci_alloc_td(uhci, uhci->rh.dev);
+		td = uhci->skeltd[i] = uhci_alloc_td(uhci, 0);
 		if (!td) {
 			err("unable to allocate TD %d", i);
 			goto err_alloc_skeltd;
@@ -2857,14 +2859,14 @@
 		td->link = uhci->skeltd[i - 1]->dma_handle;
 	}
 
-	uhci->skel_term_td = uhci_alloc_td(uhci, uhci->rh.dev);
+	uhci->skel_term_td = uhci_alloc_td(uhci, 0);
 	if (!uhci->skel_term_td) {
 		err("unable to allocate skel TD term");
 		goto err_alloc_skeltd;
 	}
 
 	for (i = 0; i < UHCI_NUM_SKELQH; i++) {
-		uhci->skelqh[i] = uhci_alloc_qh(uhci, uhci->rh.dev);
+		uhci->skelqh[i] = uhci_alloc_qh(uhci, 0);
 		if (!uhci->skelqh[i]) {
 			err("unable to allocate QH %d", i);
 			goto err_alloc_skelqh;
