mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 10:04:49 +00:00
Fix ups and Clean ups.
svn path=/trunk/; revision=15450
This commit is contained in:
parent
a8779d96c8
commit
f10f1f0548
10 changed files with 49 additions and 20 deletions
|
@ -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;
|
||||
|
|
|
@ -215,7 +215,7 @@ struct hc_driver {
|
|||
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) */
|
||||
|
|
|
@ -869,12 +869,14 @@ void usb_disconnect(struct usb_device **pdev)
|
|||
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;
|
||||
|
|
|
@ -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 @@ NTSTATUS AddDevice(PDRIVER_OBJECT DriverObject, PDEVICE_OBJECT pdo)
|
|||
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 @@ NTSTATUS DispatchPnp(PDEVICE_OBJECT fdo, PIRP Irp)
|
|||
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;
|
||||
|
|
|
@ -520,7 +520,7 @@ static int hc_start (struct ohci_hcd *ohci)
|
|||
(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 @@ static int hc_start (struct ohci_hcd *ohci)
|
|||
|
||||
/* 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 @@ static void ohci_irq (struct usb_hcd *hcd, struct pt_regs *ptregs)
|
|||
} else if ((ints = readl (®s->intrstatus)) == ~(u32)0) {
|
||||
disable (ohci);
|
||||
ohci_dbg (ohci, "device removed!\n");
|
||||
return;
|
||||
return 0;
|
||||
|
||||
/* interrupt for some other device? */
|
||||
} else if ((ints &= readl (®s->intrenable)) == 0) {
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (ints & OHCI_INTR_UE) {
|
||||
|
@ -606,6 +607,7 @@ static void ohci_irq (struct usb_hcd *hcd, struct pt_regs *ptregs)
|
|||
writel (OHCI_INTR_MIE, ®s->intrenable);
|
||||
// flush those pci writes
|
||||
(void) readl (&ohci->regs->control);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
|
|
|
@ -234,8 +234,8 @@ struct pci_driver {
|
|||
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 @@ struct usbdevfs_hub_portinfo
|
|||
|
||||
#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 @@ void do_all_timers(void);
|
|||
|
||||
#define __KERNEL_DS 0x18
|
||||
|
||||
int my_pci_write_config_word(struct pci_dev *, int, u16);
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -2,3 +2,4 @@
|
|||
O_TARGET := usbwrapper.o BootUSB.o linuxwrapper.o xpad.o xremote.o usbkey.o risefall.o
|
||||
|
||||
include $(TOPDIR)/Rules.make
|
||||
|
||||
|
|
|
@ -75,6 +75,7 @@ void handle_irqs(int irq)
|
|||
{
|
||||
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 @@ void do_all_timers(void)
|
|||
|
||||
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 my_device_add(struct device *dev)
|
|||
{
|
||||
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 @@ int my_device_add(struct device *dev)
|
|||
{
|
||||
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 @@ int my_driver_register(struct device_driver *driver)
|
|||
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 my_schedule_timeout(int x)
|
|||
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 @@ int my_schedule_timeout(int x)
|
|||
}
|
||||
need_wakeup=0;
|
||||
// printk("schedule DONE!!!!!!\n");
|
||||
DPRINT1("schedule DONE!!!!!!\n");
|
||||
|
||||
return x;
|
||||
}
|
||||
/*------------------------------------------------------------------------*/
|
||||
|
@ -251,6 +263,8 @@ void my_wait_for_completion(struct completion *x)
|
|||
{
|
||||
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 @@ void my_wait_for_completion(struct completion *x)
|
|||
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 @@ int my_pci_module_init(struct pci_driver *x)
|
|||
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);
|
||||
|
|
|
@ -1877,7 +1877,7 @@ static void uhci_remove_pending_qhs(struct uhci_hcd *uhci)
|
|||
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 @@ static void uhci_irq(struct usb_hcd *hcd, struct pt_regs *regs)
|
|||
*/
|
||||
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 @@ static void uhci_irq(struct usb_hcd *hcd, struct pt_regs *regs)
|
|||
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 @@ static int __devinit uhci_start(struct usb_hcd *hcd)
|
|||
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) {
|
||||
|
|
Loading…
Reference in a new issue