diff options
author | Alan Cox <alan@lxorguk.ukuu.org.uk> | 2006-03-24 03:18:28 -0800 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-03-24 07:33:29 -0800 |
commit | 00d83a54aa824b11ebc8c66c4a879cfeb5029a22 (patch) | |
tree | c4d13bb89b7ee082439ae75a5c1ee2d9da52c3c4 /drivers/char/rio/rio_linux.c | |
parent | e2b3afd676ad3e15ca2efca3b3605c7d817ec6e3 (diff) | |
download | linux-00d83a54aa824b11ebc8c66c4a879cfeb5029a22.tar.gz linux-00d83a54aa824b11ebc8c66c4a879cfeb5029a22.tar.bz2 linux-00d83a54aa824b11ebc8c66c4a879cfeb5029a22.zip |
[PATCH] rio driver rework continued #3
Second large chunk of code cleanup. The split between this and #3 and #4 is
fairly arbitary and due to the message length limit on the list. These
patches continue the process of ripping out macros and typedefs while cleaning
up lots of 32bit assumptions. Several inlines for compatibility also get
removed and that causes a lot of noise.
Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/char/rio/rio_linux.c')
-rw-r--r-- | drivers/char/rio/rio_linux.c | 69 |
1 files changed, 24 insertions, 45 deletions
diff --git a/drivers/char/rio/rio_linux.c b/drivers/char/rio/rio_linux.c index c9af283a811d..f1e9e9a20c85 100644 --- a/drivers/char/rio/rio_linux.c +++ b/drivers/char/rio/rio_linux.c @@ -297,7 +297,7 @@ static void my_hd(void *ad, int len) unsigned char *addr = ad; for (i = 0; i < len; i += 16) { - rio_dprintk(RIO_DEBUG_PARAM, "%08x ", (int) addr + i); + rio_dprintk(RIO_DEBUG_PARAM, "%08lx ", (unsigned long) addr + i); for (j = 0; j < 16; j++) { rio_dprintk(RIO_DEBUG_PARAM, "%02x %s", addr[j + i], (j == 7) ? " " : ""); } @@ -340,13 +340,16 @@ int RIODelay_ni(struct Port *PortP, int njiffies) return !RIO_FAIL; } +void rio_copy_to_card(void *to, void *from, int len) +{ + rio_memcpy_toio(NULL, to, from, len); +} int rio_minor(struct tty_struct *tty) { return tty->index + (tty->driver == rio_driver) ? 0 : 256; } - int rio_ismodem(struct tty_struct *tty) { return 1; @@ -379,7 +382,7 @@ static void rio_reset_interrupt(struct Host *HostP) case RIO_AT: case RIO_MCA: case RIO_PCI: - WBYTE(HostP->ResetInt, 0xff); + writeb(0xFF, &HostP->ResetInt); } func_exit(); @@ -397,9 +400,6 @@ static irqreturn_t rio_interrupt(int irq, void *ptr, struct pt_regs *regs) /* AAargh! The order in which to do these things is essential and not trivial. - - Rate limit goes before "recursive". Otherwise a series of - recursive calls will hang the machine in the interrupt routine. - - hardware twiddling goes before "recursive". Otherwise when we poll the card, and a recursive interrupt happens, we won't ack the card, so it might keep on interrupting us. (especially @@ -414,26 +414,6 @@ static irqreturn_t rio_interrupt(int irq, void *ptr, struct pt_regs *regs) - The initialized test goes before recursive. */ - - -#ifdef IRQ_RATE_LIMIT - /* Aaargh! I'm ashamed. This costs more lines-of-code than the - actual interrupt routine!. (Well, used to when I wrote that comment) */ - { - static int lastjif; - static int nintr = 0; - - if (lastjif == jiffies) { - if (++nintr > IRQ_RATE_LIMIT) { - free_irq(HostP->Ivec, ptr); - printk(KERN_ERR "rio: Too many interrupts. Turning off interrupt %d.\n", HostP->Ivec); - } - } else { - lastjif = jiffies; - nintr = 0; - } - } -#endif rio_dprintk(RIO_DEBUG_IFLOW, "rio: We've have noticed the interrupt\n"); if (HostP->Ivec == irq) { /* Tell the card we've noticed the interrupt. */ @@ -444,13 +424,13 @@ static irqreturn_t rio_interrupt(int irq, void *ptr, struct pt_regs *regs) return IRQ_HANDLED; if (test_and_set_bit(RIO_BOARD_INTR_LOCK, &HostP->locks)) { - printk(KERN_ERR "Recursive interrupt! (host %d/irq%d)\n", (int) ptr, HostP->Ivec); + printk(KERN_ERR "Recursive interrupt! (host %p/irq%d)\n", ptr, HostP->Ivec); return IRQ_HANDLED; } RIOServiceHost(p, HostP, irq); - rio_dprintk(RIO_DEBUG_IFLOW, "riointr() doing host %d type %d\n", (int) ptr, HostP->Type); + rio_dprintk(RIO_DEBUG_IFLOW, "riointr() doing host %p type %d\n", ptr, HostP->Type); clear_bit(RIO_BOARD_INTR_LOCK, &HostP->locks); rio_dprintk(RIO_DEBUG_IFLOW, "rio: exit rio_interrupt (%d/%d)\n", irq, HostP->Ivec); @@ -873,7 +853,7 @@ static int rio_init_datastructures(void) #define HOST_SZ sizeof(struct Host) #define PORT_SZ sizeof(struct Port *) #define TMIO_SZ sizeof(struct termios *) - rio_dprintk(RIO_DEBUG_INIT, "getting : %d %d %d %d %d bytes\n", RI_SZ, RIO_HOSTS * HOST_SZ, RIO_PORTS * PORT_SZ, RIO_PORTS * TMIO_SZ, RIO_PORTS * TMIO_SZ); + rio_dprintk(RIO_DEBUG_INIT, "getting : %Zd %Zd %Zd %Zd %Zd bytes\n", RI_SZ, RIO_HOSTS * HOST_SZ, RIO_PORTS * PORT_SZ, RIO_PORTS * TMIO_SZ, RIO_PORTS * TMIO_SZ); if (!(p = ckmalloc(RI_SZ))) goto free0; @@ -963,22 +943,21 @@ static void __exit rio_release_drivers(void) static void fix_rio_pci(struct pci_dev *pdev) { - unsigned int hwbase; - unsigned long rebase; + unsigned long hwbase; + unsigned char *rebase; unsigned int t; #define CNTRL_REG_OFFSET 0x50 #define CNTRL_REG_GOODVALUE 0x18260000 - pci_read_config_dword(pdev, PCI_BASE_ADDRESS_0, &hwbase); - hwbase &= PCI_BASE_ADDRESS_MEM_MASK; - rebase = (ulong) ioremap(hwbase, 0x80); + hwbase = pci_resource_start(pdev, 0); + rebase = ioremap(hwbase, 0x80); t = readl(rebase + CNTRL_REG_OFFSET); if (t != CNTRL_REG_GOODVALUE) { printk(KERN_DEBUG "rio: performing cntrl reg fix: %08x -> %08x\n", t, CNTRL_REG_GOODVALUE); writel(CNTRL_REG_GOODVALUE, rebase + CNTRL_REG_OFFSET); } - iounmap((char *) rebase); + iounmap(rebase); } #endif @@ -1049,7 +1028,7 @@ static int __init rio_init(void) hp->Caddr = ioremap(p->RIOHosts[p->RIONumHosts].PaddrP, RIO_WINDOW_LEN); hp->CardP = (struct DpRam *) hp->Caddr; hp->Type = RIO_PCI; - hp->Copy = rio_pcicopy; + hp->Copy = rio_copy_to_card; hp->Mode = RIO_PCI_BOOT_FROM_RAM; spin_lock_init(&hp->HostLock); rio_reset_interrupt(hp); @@ -1058,10 +1037,10 @@ static int __init rio_init(void) rio_dprintk(RIO_DEBUG_PROBE, "Going to test it (%p/%p).\n", (void *) p->RIOHosts[p->RIONumHosts].PaddrP, p->RIOHosts[p->RIONumHosts].Caddr); if (RIOBoardTest(p->RIOHosts[p->RIONumHosts].PaddrP, p->RIOHosts[p->RIONumHosts].Caddr, RIO_PCI, 0) == RIO_SUCCESS) { rio_dprintk(RIO_DEBUG_INIT, "Done RIOBoardTest\n"); - WBYTE(p->RIOHosts[p->RIONumHosts].ResetInt, 0xff); + writeb(0xFF, &p->RIOHosts[p->RIONumHosts].ResetInt); p->RIOHosts[p->RIONumHosts].UniqueNum = - ((RBYTE(p->RIOHosts[p->RIONumHosts].Unique[0]) & 0xFF) << 0) | - ((RBYTE(p->RIOHosts[p->RIONumHosts].Unique[1]) & 0xFF) << 8) | ((RBYTE(p->RIOHosts[p->RIONumHosts].Unique[2]) & 0xFF) << 16) | ((RBYTE(p->RIOHosts[p->RIONumHosts].Unique[3]) & 0xFF) << 24); + ((readb(&p->RIOHosts[p->RIONumHosts].Unique[0]) & 0xFF) << 0) | + ((readb(&p->RIOHosts[p->RIONumHosts].Unique[1]) & 0xFF) << 8) | ((readb(&p->RIOHosts[p->RIONumHosts].Unique[2]) & 0xFF) << 16) | ((readb(&p->RIOHosts[p->RIONumHosts].Unique[3]) & 0xFF) << 24); rio_dprintk(RIO_DEBUG_PROBE, "Hmm Tested ok, uniqid = %x.\n", p->RIOHosts[p->RIONumHosts].UniqueNum); fix_rio_pci(pdev); @@ -1099,7 +1078,7 @@ static int __init rio_init(void) hp->Caddr = ioremap(p->RIOHosts[p->RIONumHosts].PaddrP, RIO_WINDOW_LEN); hp->CardP = (struct DpRam *) hp->Caddr; hp->Type = RIO_PCI; - hp->Copy = rio_pcicopy; + hp->Copy = rio_copy_to_card; hp->Mode = RIO_PCI_BOOT_FROM_RAM; spin_lock_init(&hp->HostLock); @@ -1110,10 +1089,10 @@ static int __init rio_init(void) rio_start_card_running(hp); rio_dprintk(RIO_DEBUG_PROBE, "Going to test it (%p/%p).\n", (void *) p->RIOHosts[p->RIONumHosts].PaddrP, p->RIOHosts[p->RIONumHosts].Caddr); if (RIOBoardTest(p->RIOHosts[p->RIONumHosts].PaddrP, p->RIOHosts[p->RIONumHosts].Caddr, RIO_PCI, 0) == RIO_SUCCESS) { - WBYTE(p->RIOHosts[p->RIONumHosts].ResetInt, 0xff); + writeb(0xFF, &p->RIOHosts[p->RIONumHosts].ResetInt); p->RIOHosts[p->RIONumHosts].UniqueNum = - ((RBYTE(p->RIOHosts[p->RIONumHosts].Unique[0]) & 0xFF) << 0) | - ((RBYTE(p->RIOHosts[p->RIONumHosts].Unique[1]) & 0xFF) << 8) | ((RBYTE(p->RIOHosts[p->RIONumHosts].Unique[2]) & 0xFF) << 16) | ((RBYTE(p->RIOHosts[p->RIONumHosts].Unique[3]) & 0xFF) << 24); + ((readb(&p->RIOHosts[p->RIONumHosts].Unique[0]) & 0xFF) << 0) | + ((readb(&p->RIOHosts[p->RIONumHosts].Unique[1]) & 0xFF) << 8) | ((readb(&p->RIOHosts[p->RIONumHosts].Unique[2]) & 0xFF) << 16) | ((readb(&p->RIOHosts[p->RIONumHosts].Unique[3]) & 0xFF) << 24); rio_dprintk(RIO_DEBUG_PROBE, "Hmm Tested ok, uniqid = %x.\n", p->RIOHosts[p->RIONumHosts].UniqueNum); p->RIOLastPCISearch = RIO_SUCCESS; @@ -1137,8 +1116,8 @@ static int __init rio_init(void) hp->Caddr = ioremap(p->RIOHosts[p->RIONumHosts].PaddrP, RIO_WINDOW_LEN); hp->CardP = (struct DpRam *) hp->Caddr; hp->Type = RIO_AT; - hp->Copy = rio_pcicopy; /* AT card PCI???? - PVDL - * -- YES! this is now a normal copy. Only the + hp->Copy = rio_copy_to_card; /* AT card PCI???? - PVDL + * -- YES! this is now a normal copy. Only the * old PCI card uses the special PCI copy. * Moreover, the ISA card will work with the * special PCI copy anyway. -- REW */ |