Hi Olav,

I don't know if you've done any of this already, but I rather
mechanically created the two attached patches by blindly following the
patches made to the sl811h driver... Not really a recipe for success I
admit :-) Fortunately it does seem to work, after some tweaking. I'm not
sure I see a way of maintaining compatibility across the 2.6.10-11
boundary, it's fairly invasive.

There seem to be a few strange things about the sl811 driver that I
don't understand, and the changelog says compile tested only so I'll
bring them up here, and CC you David, since your name is in the
signed-off-by.

Since the sl811 and isp116x drivers are fairly similar in structure I
could supply a compile tested only patch that does similar fixes if you
would like.

First thing: where is ep->hep, the pointer from struct sl811h_ep to
struct usb_host_endpoint, initialised? I can see where hep->hcpriv is
set to ep to give the link the other way. I added the initialisation of
ep->hep at the same point as hep->hcpriv, I get segfaults otherwise.

I also couldn't find where urb->hcpriv was set to NULL when the urb was
finished -- not doing this causes usb_submit_urb() to return -EINVAL
next time the URB is submitted. I do it in finish_request() which seems
to match up with ohci-q doing it in finish_urb().

With these changes the isp116x driver seems to be working well on
2.6.11, although I've not really bashed it yet.

I've also attached a small cleanup patch, fixes a warning about unused
variable pipe, uses NULL in pointer context and only initialises
hcd->irq once. The patches apply in order
        2.6/usb-isp116x-hcd-host-endpoint.patch
        2.6/usb-isp116x-hcd-core-allocates-hcd-struct.patch
        2.6/usb-isp116x-hcd-cleanup.patch
they are against the released driver on the website, plus the
short_not_ok fix and the urb scheduling fix you posted here. I can
rework them against something else if you'd like.

Ian.

-- 
Ian Campbell, Senior Design Engineer
                                        Web: http://www.arcom.com
Arcom, Clifton Road,                    Direct: +44 (0)1223 403 465
Cambridge CB1 7EA, United Kingdom       Phone:  +44 (0)1223 411 200
%description
update isp116x-hcd with changes to usb core for 2.6.11
based on the changes to sl811-hcd
http://linux.bkbits.net:8080/linux-2.6/[EMAIL PROTECTED]|src/|src/drivers|src/drivers/usb|src/drivers/usb/host|related/drivers/usb/host/sl811-hcd.c
%patch
Index: 2.6/drivers/usb/host/isp116x-hcd.c
===================================================================
--- 2.6.orig/drivers/usb/host/isp116x-hcd.c	2005-03-04 13:25:40.319173017 +0000
+++ 2.6/drivers/usb/host/isp116x-hcd.c	2005-03-04 13:25:48.158033620 +0000
@@ -472,7 +472,7 @@
 	spin_unlock(&urb->lock);
 
 	spin_unlock(&isp116x->lock);
-	usb_hcd_giveback_urb(&isp116x->hcd, urb, regs);
+	usb_hcd_giveback_urb(isp116x_to_hcd(isp116x), urb, regs);
 	spin_lock(&isp116x->lock);
 
 	// take idle endpoints out of the schedule right away
@@ -497,7 +497,7 @@
 		isp116x->load[i] -= ep->load;
 	}
 	ep->branch = PERIODIC_SIZE;
-	hcd_to_bus(&isp116x->hcd)->bandwidth_allocated -= ep->load / ep->period;
+	isp116x_to_hcd(isp116x)->self.bandwidth_allocated -= ep->load / ep->period;
 
 	if (!--isp116x->periodic_count) {
 		isp116x->irqenb &= ~HCuPINT_SOF;
@@ -770,7 +770,7 @@
 
 	spin_lock_irqsave(&isp116x->lock, flags);
 
-	if (!HCD_IS_RUNNING(isp116x->hcd.state)) {
+	if (!HCD_IS_RUNNING(hcd->state)) {
 		retval = -ENODEV;
 		goto fail;
 	}
@@ -867,7 +867,7 @@
 			}
 			isp116x->load[i] += ep->load;
 		}
-		hcd_to_bus(&isp116x->hcd)->bandwidth_allocated
+		hcd->self.bandwidth_allocated
 		    += ep->load / ep->period;
 
 		// switch over to SOFint
@@ -981,14 +981,14 @@
 {
 	struct isp116x *isp116x = hcd_to_isp116x(hcd);
 	int ports, i, changed = 0;
-	int can_suspend = isp116x->hcd.can_wakeup;
+	int can_suspend = hcd->can_wakeup;
 
 	VDBG("%s: enter\n", __func__);
 
 	ports = isp116x->rhdesca & RH_A_NDP;
 	BUG_ON(ports > 2);
 
-	if (!HCD_IS_RUNNING(isp116x->hcd.state))
+	if (!HCD_IS_RUNNING(hcd->state))
 		return -ESHUTDOWN;
 
 	/* init status */
@@ -1023,7 +1023,7 @@
 
 		if (!(status & RH_PS_CCS))
 			continue;
-		if ((status & RH_PS_PSS) && isp116x->hcd.remote_wakeup)
+		if ((status & RH_PS_PSS) && hcd->remote_wakeup)
 			continue;
 		can_suspend = 0;
 	}
@@ -1321,7 +1321,7 @@
 	unsigned i;
 
 	seq_printf(s, "%s\n%s version %s\n",
-		   isp116x->hcd.product_desc, hcd_name, DRIVER_VERSION);
+		   isp116x_to_hcd(isp116x)->product_desc, hcd_name, DRIVER_VERSION);
 
 	/* collect statistics to help estimate potential win for
 	 * DMA engines that care about alignment (PXA)
@@ -1472,11 +1472,11 @@
 
 	// Reset the chip
 	if (isp116x->board && isp116x->board->reset)
-		isp116x->board->reset(isp116x->hcd.self.controller, 0);
+		isp116x->board->reset(hcd->self.controller, 0);
 	else
 		isp116x_sw_reset(isp116x);
 	if (isp116x->board && isp116x->board->clock)
-		isp116x->board->clock(isp116x->hcd.self.controller, 0);
+		isp116x->board->clock(hcd->self.controller, 0);
 	spin_unlock_irqrestore(&isp116x->lock, flags);
 }
 
@@ -1534,7 +1534,7 @@
 	isp116x_write_reg32(isp116x, HCFMINTVL, 0x27782edf);
 	spin_unlock_irqrestore(&isp116x->lock, flags);
 
-	udev = usb_alloc_dev(NULL, &isp116x->hcd.self, 0);
+	udev = usb_alloc_dev(NULL, &hcd->self, 0);
 	if (!udev) {
 		isp116x_stop(hcd);
 		return -ENOMEM;
@@ -1548,7 +1548,7 @@
 	//    isp116x->hcd.can_wakeup = board->remote_wakeup_connected;
 	//            isp116x->hcd.can_wakeup = board->remote_wakeup_enable;
 
-	if (hcd_register_root(udev, &isp116x->hcd) != 0) {
+	if (hcd_register_root(udev, hcd) != 0) {
 		usb_put_dev(udev);
 		isp116x_stop(hcd);
 		return -ENODEV;
@@ -1578,6 +1578,7 @@
 
 static struct hc_driver isp116x_hc_driver = {
 	.description = hcd_name,
+	.hcd_priv_size = sizeof(struct isp116x),
 
 	/*
 	 * generic hardware linkage
@@ -1611,18 +1612,19 @@
 static int __init_or_module isp116x_remove(struct device *dev)
 {
 	struct isp116x *isp116x = dev_get_drvdata(dev);
+	struct usb_hcd *hcd = isp116x_to_hcd(isp116x);
 	struct platform_device *pdev;
 	struct resource *res;
 
 	pdev = container_of(dev, struct platform_device, dev);
 
-	if (HCD_IS_RUNNING(isp116x->hcd.state))
-		isp116x->hcd.state = USB_STATE_QUIESCING;
-	usb_disconnect(&isp116x->hcd.self.root_hub);
+	if (HCD_IS_RUNNING(hcd->state))
+		hcd->state = USB_STATE_QUIESCING;
+	usb_disconnect(&hcd->self.root_hub);
 	remove_debug_file(isp116x);
-	isp116x_stop(&isp116x->hcd);
-	usb_deregister_bus(&isp116x->hcd.self);
-	free_irq(isp116x->hcd.irq, isp116x);
+	isp116x_stop(hcd);
+	usb_deregister_bus(&hcd->self);
+	free_irq(hcd->irq, isp116x);
 
 	iounmap(isp116x->data_reg);
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
@@ -1639,6 +1641,7 @@
 
 static int __init isp116x_probe(struct device *dev)
 {
+	struct usb_hcd *hcd;
 	struct isp116x *isp116x;
 	struct platform_device *pdev;
 	struct resource *addr, *data;
@@ -1695,31 +1698,21 @@
 	}
 
 	/* allocate and initialize hcd */
-	isp116x = kcalloc(1, sizeof *isp116x, GFP_KERNEL);
-	if (!isp116x) {
-		retval = -ENOMEM;
+	hcd = usb_create_hcd(&isp116x_hc_driver);
+	if (!hcd) {
+		retval = 0;
 		goto err5;
 	}
+	isp116x = hcd_to_isp116x(hcd);
 	dev_set_drvdata(dev, isp116x);
 	isp116x->data_reg = data_reg;
 	isp116x->addr_reg = addr_reg;
 
-	usb_bus_init(&isp116x->hcd.self);
-	isp116x->hcd.self.controller = dev;
-	isp116x->hcd.self.bus_name = dev->bus_id;
-	isp116x->hcd.self.op = &usb_hcd_operations;
-	isp116x->hcd.self.hcpriv = isp116x;
-
-#if KERNEL_VERSION(2,6,10) <= LINUX_VERSION_CODE
-	isp116x->hcd.self.release = &usb_hcd_release;
-#endif
-
-	isp116x->hcd.description = isp116x_hc_driver.description;
-	init_timer(&isp116x->hcd.rh_timer);
-	isp116x->hcd.driver = &isp116x_hc_driver;
-	isp116x->hcd.irq = -1;
-	isp116x->hcd.state = USB_STATE_HALT;
-
+	hcd->self.controller = dev;
+	hcd->self.bus_name = dev->bus_id;
+	hcd->irq = irq;
+	hcd->regs = addr_reg;
+ 
 	spin_lock_init(&isp116x->lock);
 	INIT_LIST_HEAD(&isp116x->async);
 	isp116x->board = dev->platform_data;
@@ -1727,11 +1720,11 @@
 	if (isp116x->board)
 		isp116x->board->reset = NULL;
 	if (isp116x->board && isp116x->board->reset) {
-		isp116x->board->reset(isp116x->hcd.self.controller, 1);
+		isp116x->board->reset(hcd->self.controller, 1);
 		msleep(20);
 		if (isp116x->board->clock)
-			isp116x->board->clock(isp116x->hcd.self.controller, 1);
-		isp116x->board->reset(isp116x->hcd.self.controller, 0);
+			isp116x->board->clock(hcd->self.controller, 1);
+		isp116x->board->reset(hcd->self.controller, 0);
 	} else {
 		isp116x_sw_reset(isp116x);
 	}
@@ -1762,21 +1755,21 @@
 		retval = -ENODEV;
 		goto err6;
 	} else {
-		isp116x->hcd.product_desc = "ISP116x Host Controller";
-		INFO("Found %s\n", isp116x->hcd.product_desc);
+		hcd->product_desc = "ISP116x Host Controller";
+		INFO("Found %s\n", hcd->product_desc);
 	}
 
-	retval = request_irq(irq, usb_hcd_irq, SA_INTERRUPT, hcd_name, &isp116x->hcd);
+	retval = request_irq(irq, usb_hcd_irq, SA_INTERRUPT, hcd_name, hcd);
 	if (retval < 0)
 		goto err6;
-	isp116x->hcd.irq = irq;
+	hcd->irq = irq;
 
-	INFO("%s, irq %d\n", isp116x->hcd.product_desc, irq);
+	INFO("%s, irq %d\n", hcd->product_desc, irq);
 
-	retval = usb_register_bus(&isp116x->hcd.self);
+	retval = usb_register_bus(&hcd->self);
 	if (retval < 0)
 		goto err7;
-	retval = isp116x_start(&isp116x->hcd);
+	retval = isp116x_start(hcd);
 	if (retval < 0)
 		goto err8;
 
@@ -1784,9 +1777,9 @@
 	return 0;
 
       err8:
-	usb_deregister_bus(&isp116x->hcd.self);
+	usb_deregister_bus(&hcd->self);
       err7:
-	free_irq(isp116x->hcd.irq, isp116x);
+	free_irq(hcd->irq, isp116x);
       err6:
 	kfree(isp116x);
       err5:
@@ -1815,7 +1808,7 @@
 
 	if (phase != SUSPEND_POWER_DOWN)
 		return 0;
-	return isp116x_hub_suspend(&isp116x->hcd);
+	return isp116x_hub_suspend(isp116x_to_hcd(isp116x));
 }
 
 static int isp116x_resume(struct device *dev, u32 phase)
@@ -1824,7 +1817,7 @@
 
 	if (phase != RESUME_POWER_ON)
 		return 0;
-	return isp116x_hub_resume(&isp116x->hcd);
+	return isp116x_hub_resume(isp116x_to_hcd(isp116x));
 }
 
 #else
Index: 2.6/drivers/usb/host/isp116x.h
===================================================================
--- 2.6.orig/drivers/usb/host/isp116x.h	2005-03-04 13:25:40.320172744 +0000
+++ 2.6/drivers/usb/host/isp116x.h	2005-03-04 13:25:48.160033074 +0000
@@ -244,7 +244,6 @@
 #define	PERIODIC_SIZE		(1 << LOG2_PERIODIC_SIZE)
 
 struct isp116x {
-	struct usb_hcd hcd;
 	spinlock_t lock;
 	atomic_t atl_finishing;
 
@@ -324,7 +323,12 @@
 
 static inline struct isp116x *hcd_to_isp116x(struct usb_hcd *hcd)
 {
-	return container_of(hcd, struct isp116x, hcd);
+	return (struct isp116x *) (hcd->hcd_priv);
+}
+
+static inline struct usb_hcd *isp116x_to_hcd(struct isp116x *isp116x)
+{
+	return container_of((void *) isp116x, struct usb_hcd, hcd_priv);
 }
 
 /*-------------------------------------------------------------------------*/
@@ -364,7 +368,7 @@
 #error USE_PLATFORM_DELAY and USE_NDELAY simultaneously defined.
 #endif
 // 24 instructions per 32-bit write
-#define	isp116x_delay(h,d)	(h)->board->delay((h)->hcd.self.controller,d)
+#define	isp116x_delay(h,d)	(h)->board->delay(isp116x_to_hcd(h)->self.controller,d)
 #elif defined(USE_NDELAY)
 // 15 instructions per 32-bit write
 #define	isp116x_delay(h,d)	ndelay(d)
%description
update isp116x-hcd with changes to usb core for 2.6.11
based on the changes to sl811-hcd
http://linux.bkbits.net:8080/linux-2.6/[EMAIL PROTECTED]|src/|src/drivers|src/drivers/usb|src/drivers/usb/host|related/drivers/usb/host/sl811-hcd.c
%patch
Index: 2.6/drivers/usb/host/isp116x-hcd.c
===================================================================
--- 2.6.orig/drivers/usb/host/isp116x-hcd.c	2005-03-04 13:25:37.148038501 +0000
+++ 2.6/drivers/usb/host/isp116x-hcd.c	2005-03-04 13:25:40.319173017 +0000
@@ -244,16 +244,14 @@
 static void preproc_atl_queue(struct isp116x *isp116x)
 {
 	struct isp116x_ep *ep;
-	struct isp116x_req *req;
 	struct urb *urb;
 	struct ptd *ptd;
 	u16 toggle, dir, len;
 
 	for (ep = isp116x->atl_active; ep; ep = ep->active) {
-		BUG_ON(list_empty(&ep->queue));
+		BUG_ON(list_empty(&ep->hep->urb_list));
 
-		req = container_of(ep->queue.next, struct isp116x_req, queue);
-		urb = req->urb;
+		urb = container_of(ep->hep->urb_list.next, struct urb, urb_list);
 		ptd = &ep->ptd;
 		len = ep->length;
 		spin_lock(&urb->lock);
@@ -311,7 +309,6 @@
 static void postproc_atl_queue(struct isp116x *isp116x)
 {
 	struct isp116x_ep *ep;
-	struct isp116x_req *req;
 	struct urb *urb;
 	struct usb_device *udev;
 	struct ptd *ptd;
@@ -319,9 +316,8 @@
 	u8 cc;
 
 	for (ep = isp116x->atl_active; ep; ep = ep->active) {
-		BUG_ON(list_empty(&ep->queue));
-		req = container_of(ep->queue.next, struct isp116x_req, queue);
-		urb = req->urb;
+		BUG_ON(list_empty(&ep->hep->urb_list));
+		urb = container_of(ep->hep->urb_list.next, struct urb, urb_list);
 		udev = urb->dev;
 		ptd = &ep->ptd;
 		cc = PTD_GET_CC(ptd);
@@ -452,16 +448,13 @@
   processed urbs.
 */
 static void finish_request(struct isp116x *isp116x, struct isp116x_ep *ep,
-			   struct isp116x_req *req, struct pt_regs *regs)
+			   struct urb *urb, struct pt_regs *regs)
 {
 	unsigned i;
-	struct urb *urb = req->urb;
 	unsigned int pipe = urb->pipe;
 
-	list_del(&req->queue);
-	kfree(req);
-	urb->hcpriv = NULL;
 	ep->error_count = 0;
+	urb->hcpriv = 0;
 
 	if (usb_pipecontrol(urb->pipe))
 		ep->nextpid = USB_PID_SETUP;
@@ -483,7 +476,7 @@
 	spin_lock(&isp116x->lock);
 
 	// take idle endpoints out of the schedule right away
-	if (!list_empty(&ep->queue))
+	if (!list_empty(&ep->hep->urb_list))
 		return;
 
 	// async deschedule
@@ -525,7 +518,6 @@
 {
 	struct isp116x_ep *last_ep = NULL;
 	struct isp116x_ep *ep;
-	struct isp116x_req *req;
 	struct urb *urb;
 	u16 load = 0;
 	int len, index, speed, byte_time;
@@ -558,8 +550,7 @@
 	}
 	// Schedule control/bulk transfers
 	list_for_each_entry(ep, &isp116x->async, schedule) {
-		req = container_of(ep->queue.next, struct isp116x_req, queue);
-		urb = req->urb;
+		urb = container_of(ep->hep->urb_list.next, struct urb, urb_list);
 		speed = urb->dev->speed;
 		byte_time =
 		    speed ==
@@ -626,7 +617,7 @@
 static void finish_atl_transfers(struct isp116x *isp116x, struct pt_regs *regs)
 {
 	struct isp116x_ep *ep;
-	struct isp116x_req *req;
+	struct urb *urb;
 
 	if (!isp116x->atl_active)
 		return;
@@ -639,13 +630,13 @@
 	unpack_fifo(isp116x);
 	postproc_atl_queue(isp116x);
 	for (ep = isp116x->atl_active; ep; ep = ep->active) {
-		req = container_of(ep->queue.next, struct isp116x_req, queue);
+		urb = container_of(ep->hep->urb_list.next, struct urb, urb_list);
 		// USB_PID_ACK check here avoids finishing of
 		// control transfers, for which TD_DATAUNDERRUN
 		// occured, while URB_SHORT_NOT_OK was set
-		if (req->urb->status != -EINPROGRESS
+		if (urb && urb->status != -EINPROGRESS
 		    && ep->nextpid != USB_PID_ACK)
-			finish_request(isp116x, ep, req, regs);
+			finish_request(isp116x, ep, urb, regs);
 	}
 	atomic_dec(&isp116x->atl_finishing);
 }
@@ -749,18 +740,16 @@
 
 /*-------------------------------------------------------------------------*/
 
-static int isp116x_urb_enqueue(struct usb_hcd *hcd, struct urb *urb,
-			       int mem_flags)
+static int isp116x_urb_enqueue(struct usb_hcd *hcd, struct usb_host_endpoint *hep,
+			       struct urb *urb, int mem_flags)
 {
 	struct isp116x *isp116x = hcd_to_isp116x(hcd);
 	struct usb_device *udev = urb->dev;
-	struct hcd_dev *hdev = (struct hcd_dev *)udev->hcpriv;
 	unsigned int pipe = urb->pipe;
 	int is_out = !usb_pipein(pipe);
 	int type = usb_pipetype(pipe);
 	int epnum = usb_pipeendpoint(pipe);
 	struct isp116x_ep *ep = NULL;
-	struct isp116x_req *req;
 	unsigned long flags;
 	int i;
 	int retval = 0;
@@ -775,16 +764,8 @@
 		ERR("Isochronous transfers not supported\n");
 		return -EINVAL;
 	}
-	// avoid all allocations within spinlocks: request or endpoint
-	urb->hcpriv = req = kmalloc(sizeof *req, mem_flags);
-	if (!req)
-		return -ENOMEM;
-	req->urb = urb;
-
-	i = epnum << 1;
-	if (i && is_out)
-		i |= 1;
-	if (!hdev->ep[i])
+	/* avoid all allocations within spinlocks */
+	if (!hep->hcpriv)
 		ep = kcalloc(1, sizeof *ep, mem_flags);
 
 	spin_lock_irqsave(&isp116x->lock, flags);
@@ -794,13 +775,13 @@
 		goto fail;
 	}
 
-	if (hdev->ep[i]) {
-		ep = hdev->ep[i];
+	if (hep->hcpriv) {
+		kfree(ep);
+		ep = hep->hcpriv;
 	} else if (!ep) {
 		retval = -ENOMEM;
 		goto fail;
 	} else {
-		INIT_LIST_HEAD(&ep->queue);
 		INIT_LIST_HEAD(&ep->schedule);
 		ep->udev = usb_get_dev(udev);
 		ep->epnum = epnum;
@@ -837,7 +818,8 @@
 								   is_out))
 			    / 1000;
 		}
-		hdev->ep[i] = ep;
+		hep->hcpriv = ep;
+		ep->hep = hep;
 	}
 
 	/* maybe put endpoint into schedule */
@@ -901,20 +883,17 @@
 	spin_lock(&urb->lock);
 	if (urb->status != -EINPROGRESS) {
 		spin_unlock(&urb->lock);
-		finish_request(isp116x, ep, req, NULL);
-		req = NULL;
+		finish_request(isp116x, ep, urb, NULL);
 		retval = 0;
 		goto fail;
 	}
-	list_add_tail(&req->queue, &ep->queue);
+	urb->hcpriv = hep;
 	ALIGNSTAT(isp116x, urb->transfer_buffer);
 	spin_unlock(&urb->lock);
 
 	start_atl_transfers(isp116x);
       fail:
 	spin_unlock_irqrestore(&isp116x->lock, flags);
-	if (retval)
-		kfree(req);
 	VDBG("%s: exit\n", __func__);
 	return retval;
 }
@@ -922,36 +901,31 @@
 static int isp116x_urb_dequeue(struct usb_hcd *hcd, struct urb *urb)
 {
 	struct isp116x *isp116x = hcd_to_isp116x(hcd);
-	struct usb_device *udev = urb->dev;
-	struct hcd_dev *hdev = (struct hcd_dev *)udev->hcpriv;
-	unsigned int pipe = urb->pipe;
-	int is_out = !usb_pipein(pipe);
+	struct usb_host_endpoint *hep = urb->hcpriv;
 	unsigned long flags;
-	unsigned i;
 	struct isp116x_ep *ep, *ep_act;
-	struct isp116x_req *req = urb->hcpriv;
 	int retval = 0;
 
 	VDBG("%s: enter\n", __func__);
-	i = usb_pipeendpoint(pipe) << 1;
-	if (i && is_out)
-		i |= 1;
+
+	if (!hep)
+		return -EINVAL;
 
 	spin_lock_irqsave(&isp116x->lock, flags);
-	ep = hdev->ep[i];
+	ep = hep->hcpriv;
 	if (ep) {
 		// In front of queue?
-		if (ep->queue.next == &req->queue)
+		if (ep->hep->urb_list.next == &urb->urb_list)
 			// active?
 			for (ep_act = isp116x->atl_active; ep_act;
 			     ep_act = ep_act->active)
 				if (ep_act == ep) {
-					req = 0;
+					urb = 0;
 					break;
 				}
 
-		if (req) {
-			finish_request(isp116x, ep, req, NULL);
+		if (urb) {
+			finish_request(isp116x, ep, urb, NULL);
 		} else
 			VDBG("dequeue, urb %p active; wait4irq\n", urb);
 	} else
@@ -963,34 +937,25 @@
 
 /// ???? This function is visited all the time. Isn't
 /// something wrong here if plug/unplug causes hang
-static void isp116x_endpoint_disable(struct usb_hcd *hcd, struct hcd_dev *hdev,
-				     int epnum)
+static void isp116x_endpoint_disable(struct usb_hcd *hcd, struct usb_host_endpoint *hep)
 {
-	struct isp116x *isp116x = hcd_to_isp116x(hcd);
-	struct isp116x_ep *ep;
-	unsigned long flags;
+	struct isp116x_ep *ep = hep->hcpriv;
 	int i;
 
 	VDBG("%s: enter\n", __func__);
-	i = (epnum & 0xf) << 1;
-	if (epnum && !(epnum & USB_DIR_IN))
-		i |= 1;
-
-	spin_lock_irqsave(&isp116x->lock, flags);
-	ep = hdev->ep[i];
-	hdev->ep[i] = NULL;
-	spin_unlock_irqrestore(&isp116x->lock, flags);
 
-	if (ep) {
-		/* assume we'd just wait for the irq */
-		for (i = 0; i < 100 && !list_empty(&ep->queue); i++)
-			msleep(10);
-		if (!list_empty(&ep->queue))
-			WARN("ep %p not empty?\n", ep);
+	if (!ep)
+		return;
 
-		usb_put_dev(ep->udev);
-		kfree(ep);
-	}
+	/* assume we'd just wait for the irq */
+	for (i = 0; i < 100 && !list_empty(&hep->urb_list); i++)
+		msleep(10);
+	if (!list_empty(&hep->urb_list))
+		WARN("ep %p not empty?\n", ep);
+	
+	usb_put_dev(ep->udev);
+	kfree(ep);
+	hep->hcpriv = 0;
 	VDBG("%s: exit\n", __func__);
 	return;
 }
@@ -1375,7 +1340,7 @@
 	dump_int(s, "hc_int_status", isp116x_read_reg32(isp116x, HCINTSTAT));
 
 	list_for_each_entry(ep, &isp116x->async, schedule) {
-		struct isp116x_req *req;
+		struct urb *urb;
 
 		seq_printf(s, "%p, ep%d%s, maxpacket %d:\n", ep, ep->epnum, ( {
 									     char
@@ -1394,10 +1359,10 @@
 									     break;};
 									     s;}
 			   ), ep->maxpacket) ;
-		list_for_each_entry(req, &ep->queue, queue) {
-			seq_printf(s, "  urb%p, %d/%d\n", req->urb,
-				   req->urb->actual_length,
-				   req->urb->transfer_buffer_length);
+		list_for_each_entry(urb, &ep->hep->urb_list, urb_list) {
+			seq_printf(s, "  urb%p, %d/%d\n", urb,
+				   urb->actual_length,
+				   urb->transfer_buffer_length);
 		}
 	}
 	if (!list_empty(&isp116x->async))
@@ -1745,12 +1710,6 @@
 	isp116x->hcd.self.op = &usb_hcd_operations;
 	isp116x->hcd.self.hcpriv = isp116x;
 
-	// NOTE: 2.6.11 starts to change the hcd glue layer some more,
-	// eventually letting us eliminate struct isp116xh_req and a
-	// lot of the boilerplate int code here 
-
-	INIT_LIST_HEAD(&isp116x->hcd.dev_list);
-
 #if KERNEL_VERSION(2,6,10) <= LINUX_VERSION_CODE
 	isp116x->hcd.self.release = &usb_hcd_release;
 #endif
Index: 2.6/drivers/usb/host/isp116x.h
===================================================================
--- 2.6.orig/drivers/usb/host/isp116x.h	2005-03-04 13:25:37.149038229 +0000
+++ 2.6/drivers/usb/host/isp116x.h	2005-03-04 13:25:40.320172744 +0000
@@ -282,8 +282,7 @@
 };
 
 struct isp116x_ep {
-	// urb queue (struct isp116x_req)
-	struct list_head queue;
+	struct usb_host_endpoint *hep;
 	struct usb_device *udev;
 	// philips transfer descriptor
 	struct ptd ptd;
@@ -308,12 +307,6 @@
 	struct list_head schedule;
 };
 
-// FIXME: get rid of this struct in post-2.6.10 versions
-struct isp116x_req {
-	struct urb *urb;
-	struct list_head queue;
-};
-
 static void ALIGNSTAT(struct isp116x *isp116x, void *ptr)
 {
 	unsigned p = (unsigned)ptr;
Index: 2.6/drivers/usb/host/isp116x-hcd.c
===================================================================
--- 2.6.orig/drivers/usb/host/isp116x-hcd.c	2005-03-04 13:25:48.158033620 +0000
+++ 2.6/drivers/usb/host/isp116x-hcd.c	2005-03-04 13:25:50.462404714 +0000
@@ -456,7 +456,7 @@
 	ep->error_count = 0;
 	urb->hcpriv = 0;
 
-	if (usb_pipecontrol(urb->pipe))
+	if (usb_pipecontrol(pipe))
 		ep->nextpid = USB_PID_SETUP;
 
 	// FIXME: Haven't seen this warning; remove this portion of code 
@@ -955,9 +955,8 @@
 	
 	usb_put_dev(ep->udev);
 	kfree(ep);
-	hep->hcpriv = 0;
+	hep->hcpriv = NULL;
 	VDBG("%s: exit\n", __func__);
-	return;
 }
 
 static int isp116x_get_frame(struct usb_hcd *hcd)
@@ -1762,7 +1761,6 @@
 	retval = request_irq(irq, usb_hcd_irq, SA_INTERRUPT, hcd_name, hcd);
 	if (retval < 0)
 		goto err6;
-	hcd->irq = irq;
 
 	INFO("%s, irq %d\n", hcd->product_desc, irq);
 

Reply via email to