Fix ups and Clean ups.
Modified: trunk/reactos/drivers/usb/cromwell/core/hcd-pci.c
Modified: trunk/reactos/drivers/usb/cromwell/core/hcd.h
Modified: trunk/reactos/drivers/usb/cromwell/core/usb.c
Modified: trunk/reactos/drivers/usb/cromwell/core/usbcore.c
Modified: trunk/reactos/drivers/usb/cromwell/host/ohci-hcd.c
Modified: trunk/reactos/drivers/usb/cromwell/linux/linux_wrapper.h
Modified: trunk/reactos/drivers/usb/cromwell/linux/pci_ids.h
Modified: trunk/reactos/drivers/usb/cromwell/sys/Makefile
Modified: trunk/reactos/drivers/usb/cromwell/sys/linuxwrapper.c
Modified: trunk/reactos/drivers/usb/cromwell/uhci/uhci-hcd.c

Modified: trunk/reactos/drivers/usb/cromwell/core/hcd-pci.c
--- trunk/reactos/drivers/usb/cromwell/core/hcd-pci.c	2005-05-21 08:44:40 UTC (rev 15449)
+++ trunk/reactos/drivers/usb/cromwell/core/hcd-pci.c	2005-05-21 11:29:53 UTC (rev 15450)
@@ -59,7 +59,8 @@
  *
  * Store this function in the HCD's struct pci_driver as probe().
  */
-int STDCALL usb_hcd_pci_probe (struct pci_dev *dev, const struct pci_device_id *id)
+int STDCALL
+usb_hcd_pci_probe (struct pci_dev *dev, const struct pci_device_id *id)
 {
 	struct hc_driver	*driver;
 	PHYSICAL_ADDRESS	resource;

Modified: trunk/reactos/drivers/usb/cromwell/core/hcd.h
--- trunk/reactos/drivers/usb/cromwell/core/hcd.h	2005-05-21 08:44:40 UTC (rev 15449)
+++ trunk/reactos/drivers/usb/cromwell/core/hcd.h	2005-05-21 11:29:53 UTC (rev 15450)
@@ -215,7 +215,7 @@
 	const char	*description;	/* "ehci-hcd" etc */
 
 	/* irq handler */
-	void	(*irq) (struct usb_hcd *hcd, struct pt_regs *regs);
+	int	(*irq) (struct usb_hcd *hcd, struct pt_regs *regs);
 
 	int	flags;
 #define	HCD_MEMORY	0x0001		/* HC regs use memory (else I/O) */

Modified: trunk/reactos/drivers/usb/cromwell/core/usb.c
--- trunk/reactos/drivers/usb/cromwell/core/usb.c	2005-05-21 08:44:40 UTC (rev 15449)
+++ trunk/reactos/drivers/usb/cromwell/core/usb.c	2005-05-21 11:29:53 UTC (rev 15450)
@@ -869,12 +869,14 @@
 	might_sleep ();
 
 	if (!dev) {
-		pr_debug ("%s nodev\n", __FUNCTION__);
+//		pr_debug ("%s nodev\n", __FUNCTION__);
+		DPRINT ("%s nodev\n", __FUNCTION__);
 		return;
 	}
 	bus = dev->bus;
 	if (!bus) {
-		pr_debug ("%s nobus\n", __FUNCTION__);
+//		pr_debug ("%s nobus\n", __FUNCTION__);
+		DPRINT ("%s nobus\n", __FUNCTION__);
 		return;
 	}
 	ops = bus->op;

Modified: trunk/reactos/drivers/usb/cromwell/core/usbcore.c
--- trunk/reactos/drivers/usb/cromwell/core/usbcore.c	2005-05-21 08:44:40 UTC (rev 15449)
+++ trunk/reactos/drivers/usb/cromwell/core/usbcore.c	2005-05-21 11:29:53 UTC (rev 15450)
@@ -6,7 +6,8 @@
 #include <ddk/ntddk.h>
 #include <debug.h>
 
-NTSTATUS AddDevice(PDRIVER_OBJECT DriverObject, PDEVICE_OBJECT pdo)
+NTSTATUS STDCALL
+AddDevice(PDRIVER_OBJECT DriverObject, PDEVICE_OBJECT pdo)
 {
 	DbgPrint("usbcore: AddDevice called\n");
 	
@@ -19,13 +20,15 @@
 	return STATUS_SUCCESS;
 }
 
-VOID DriverUnload(PDRIVER_OBJECT DriverObject)
+VOID STDCALL
+DriverUnload(PDRIVER_OBJECT DriverObject)
 {
 	// nothing to do here yet
 }
 
 // Dispatch PNP
-NTSTATUS DispatchPnp(PDEVICE_OBJECT fdo, PIRP Irp)
+NTSTATUS STDCALL
+DispatchPnp(PDEVICE_OBJECT fdo, PIRP Irp)
 {
 	ULONG fcn;
 	PIO_STACK_LOCATION stack;
@@ -42,7 +45,8 @@
 	return STATUS_SUCCESS;
 }
 
-NTSTATUS DispatchPower(PDEVICE_OBJECT fido, PIRP Irp)
+NTSTATUS STDCALL
+DispatchPower(PDEVICE_OBJECT fido, PIRP Irp)
 {
 	DbgPrint("IRP_MJ_POWER dispatch\n");
 	return STATUS_SUCCESS;

Modified: trunk/reactos/drivers/usb/cromwell/host/ohci-hcd.c
--- trunk/reactos/drivers/usb/cromwell/host/ohci-hcd.c	2005-05-21 08:44:40 UTC (rev 15449)
+++ trunk/reactos/drivers/usb/cromwell/host/ohci-hcd.c	2005-05-21 11:29:53 UTC (rev 15450)
@@ -520,7 +520,7 @@
 	(void) readl (&ohci->regs->control);
 
 	// POTPGT delay is bits 24-31, in 2 ms units.
-	mdelay ((roothub_a (ohci) >> 23) & 0x1fe);
+	mdelay (((int)(roothub_a (ohci) >> 23) & 0x1fe));
  
 	/* connect the virtual root hub */
 	bus = hcd_to_bus (&ohci->hcd);
@@ -552,7 +552,8 @@
 
 /* an interrupt happens */
 
-static void ohci_irq (struct usb_hcd *hcd, struct pt_regs *ptregs)
+static
+int ohci_irq (struct usb_hcd *hcd, struct pt_regs *ptregs)
 {
 	struct ohci_hcd		*ohci = hcd_to_ohci (hcd);
 	struct ohci_regs	*regs = ohci->regs;
@@ -567,11 +568,11 @@
 	} else if ((ints = readl (&regs->intrstatus)) == ~(u32)0) {
 		disable (ohci);
 		ohci_dbg (ohci, "device removed!\n");
-		return;
+		return 0;
 
 	/* interrupt for some other device? */
 	} else if ((ints &= readl (&regs->intrenable)) == 0) {
-		return;
+		return 0;
 	} 
 
 	if (ints & OHCI_INTR_UE) {
@@ -606,6 +607,7 @@
 	writel (OHCI_INTR_MIE, &regs->intrenable);	
 	// flush those pci writes
 	(void) readl (&ohci->regs->control);
+	return 0;
 }
 
 /*-------------------------------------------------------------------------*/

Modified: trunk/reactos/drivers/usb/cromwell/linux/linux_wrapper.h
--- trunk/reactos/drivers/usb/cromwell/linux/linux_wrapper.h	2005-05-21 08:44:40 UTC (rev 15449)
+++ trunk/reactos/drivers/usb/cromwell/linux/linux_wrapper.h	2005-05-21 11:29:53 UTC (rev 15450)
@@ -234,8 +234,8 @@
         struct list_head node;
         char *name;
         const struct pci_device_id *id_table;   /* must be non-NULL for probe to be called */
-        int  (*probe)  (struct pci_dev *dev, const struct pci_device_id *id);   /* New device inserted */
-        void (*remove) (struct pci_dev *dev);   /* Device removed (NULL if not a hot-plug capable driver) */
+        int STDCALL (*probe)  (struct pci_dev *dev, const struct pci_device_id *id);   /* New device inserted */
+        void STDCALL (*remove) (struct pci_dev *dev);   /* Device removed (NULL if not a hot-plug capable driver) */
         int  (*save_state) (struct pci_dev *dev, u32 state);    /* Save Device Context */
         int  (*suspend) (struct pci_dev *dev, u32 state);       /* Device suspended */
         int  (*resume) (struct pci_dev *dev);                   /* Device woken up */
@@ -328,7 +328,7 @@
 
 #define inw(x) READ_PORT_USHORT((PUSHORT)(x))
 #define outw(x,p) WRITE_PORT_USHORT((PUSHORT)(p),(x))
-#define outl(x,p) WRITE_PORT_ULONG((PUSHORT)(p),(x))
+#define outl(x,p) WRITE_PORT_ULONG((PULONG)(p),(x))
 
 /* The kernel macro for list_for_each_entry makes nonsense (have no clue
  * why, this is just the same definition...) */
@@ -799,4 +799,5 @@
 
 #define __KERNEL_DS   0x18
 
+int my_pci_write_config_word(struct pci_dev *, int, u16);
 

Modified: trunk/reactos/drivers/usb/cromwell/linux/pci_ids.h
--- trunk/reactos/drivers/usb/cromwell/linux/pci_ids.h	2005-05-21 08:44:40 UTC (rev 15449)
+++ trunk/reactos/drivers/usb/cromwell/linux/pci_ids.h	2005-05-21 11:29:53 UTC (rev 15450)
@@ -10,7 +10,7 @@
 #define PCI_DEVICE_ID_NS_87560_LIO	0x000e
 #define PCI_DEVICE_ID_INTEL_82371AB_2	0x7112
 
-#define PCI_CLASS_SERIAL_USB (PCI_CLASS_SERIAL_BUS_CTLR << 8 + PCI_SUBCLASS_SB_USB)
+#define PCI_CLASS_SERIAL_USB ((PCI_CLASS_SERIAL_BUS_CTLR << 8) + PCI_SUBCLASS_SB_USB)
 
 #endif
 

Modified: trunk/reactos/drivers/usb/cromwell/sys/Makefile
--- trunk/reactos/drivers/usb/cromwell/sys/Makefile	2005-05-21 08:44:40 UTC (rev 15449)
+++ trunk/reactos/drivers/usb/cromwell/sys/Makefile	2005-05-21 11:29:53 UTC (rev 15450)
@@ -2,3 +2,4 @@
 O_TARGET :=  usbwrapper.o BootUSB.o linuxwrapper.o xpad.o xremote.o usbkey.o risefall.o
 
 include $(TOPDIR)/Rules.make
+

Modified: trunk/reactos/drivers/usb/cromwell/sys/linuxwrapper.c
--- trunk/reactos/drivers/usb/cromwell/sys/linuxwrapper.c	2005-05-21 08:44:40 UTC (rev 15449)
+++ trunk/reactos/drivers/usb/cromwell/sys/linuxwrapper.c	2005-05-21 11:29:53 UTC (rev 15450)
@@ -75,6 +75,7 @@
 {
 	int n;
 //	printk("handle irqs\n");
+	DPRINT1("Handle Irqs\n");
 	for(n=0;n<MAX_IRQS;n++)
 	{
 		if (reg_irqs[n].handler && (irq==reg_irqs[n].irq || irq==-1))
@@ -101,6 +102,7 @@
 
 			main_timer_list[n]=NULL; // remove timer
 //			printk("do timer %i fn %p\n",n,function);
+			DPRINT1("do timer %i fn %p\n",n,function);
 
 			function(data);
 		}
@@ -155,6 +157,8 @@
 {
 	int n,found=0;
 //	printk("drv_num %i %p %p\n",drvs_num,m_drivers[0]->probe,m_drivers[1]->probe);
+	DPRINT1("drv_num %i %p %p\n",drvs_num,m_drivers[0]->probe,m_drivers[1]->probe);
+
 	if (dev->driver)
 	{
 		if (dev->driver->probe)
@@ -168,6 +172,8 @@
 			{
 				dev->driver=m_drivers[n];
 //				printk("probe%i %p ",n,m_drivers[n]->probe);
+				DPRINT1("probe%i %p ",n,m_drivers[n]->probe);
+
 				if (m_drivers[n]->probe(dev) == 0)
 				{
 //					return 0;
@@ -187,6 +193,8 @@
 	if (drvs_num<MAX_DRVS)
 	{
 //		printk("driver_register %i: %p %p",drvs_num,driver,driver->probe);
+		DPRINT1("driver_register %i: %p %p",drvs_num,driver,driver->probe);
+
 		m_drivers[drvs_num++]=driver;
 		return 0;
 	}
@@ -229,6 +237,8 @@
 	int wait=1;
 	x+=10; // safety
 //	printk("schedule_timeout %i\n",x);
+	DPRINT1("schedule_timeout %i\n",x);
+
 	while(x>0)
 	{
 		do_all_timers();
@@ -244,6 +254,8 @@
 	}
 	need_wakeup=0;
 //	printk("schedule DONE!!!!!!\n");
+	DPRINT1("schedule DONE!!!!!!\n");
+
 	return x;
 }
 /*------------------------------------------------------------------------*/ 
@@ -251,6 +263,8 @@
 {
 	int n=100;
 //	printk("wait for completion\n");
+	DPRINT1("wait for completion\n");
+
 	while(!x->done && (n>0))
 	{
 		do_all_timers();	
@@ -262,6 +276,8 @@
 		n--;
 	}
 //	printk("wait for completion done %i\n",x->done);
+	DPRINT1("wait for completion done %i\n",x->done);
+
 }
 /*------------------------------------------------------------------------*/ 
 void my_interruptible_sleep_on(PKEVENT evnt)
@@ -278,7 +294,7 @@
 	const struct pci_device_id *id=NULL;
 	if (!pci_probe_dev)
 	{
-		printk(KERN_ERR "PCI device not set!\n");
+		DPRINT1("PCI device not set!\n");
 		return 0;
 	}
 	x->probe(dev, id);

Modified: trunk/reactos/drivers/usb/cromwell/uhci/uhci-hcd.c
--- trunk/reactos/drivers/usb/cromwell/uhci/uhci-hcd.c	2005-05-21 08:44:40 UTC (rev 15449)
+++ trunk/reactos/drivers/usb/cromwell/uhci/uhci-hcd.c	2005-05-21 11:29:53 UTC (rev 15450)
@@ -1877,7 +1877,7 @@
 	spin_unlock_irqrestore(&uhci->urb_remove_list_lock, flags);
 }
 
-static void uhci_irq(struct usb_hcd *hcd, struct pt_regs *regs)
+static int uhci_irq(struct usb_hcd *hcd, struct pt_regs *regs)
 {
 	struct uhci_hcd *uhci = hcd_to_uhci(hcd);
 	unsigned int io_addr = uhci->io_addr;
@@ -1890,7 +1890,7 @@
 	 */
 	status = inw(io_addr + USBSTS);
 	if (!status)	/* shared interrupt, not mine */
-		return;
+		return 0;
 	outw(status, io_addr + USBSTS);		/* Clear it */
 
 	if (status & ~(USBSTS_USBINT | USBSTS_ERROR | USBSTS_RD)) {
@@ -1929,6 +1929,8 @@
 	spin_unlock(&uhci->urb_list_lock);
 
 	uhci_finish_completion(hcd, regs);
+	
+	return 0;
 }
 
 static void reset_hc(struct uhci_hcd *uhci)
@@ -2275,7 +2277,7 @@
 		err("unable to allocate root hub");
 		goto err_alloc_root_hub;
 	}
-	hcd->pdev->bus = udev; /* Fix bus pointer for initial device */
+	hcd->pdev->bus = (struct pci_bus  *)udev; /* Fix bus pointer for initial device */
 
 	uhci->term_td = uhci_alloc_td(uhci, udev);
 	if (!uhci->term_td) {