X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=drivers%2Fchar%2Fapplicom.c;h=148ea29328598026c0322e9a7dcaca8d417f9337;hb=c7b5ebbddf7bcd3651947760f423e3783bbe6573;hp=4d4eaf2e4a9b319c824eba43842bbdf364f9823e;hpb=5273a3df6485dc2ad6aa7ddd441b9a21970f003b;p=linux-2.6.git diff --git a/drivers/char/applicom.c b/drivers/char/applicom.c index 4d4eaf2e4..148ea2932 100644 --- a/drivers/char/applicom.c +++ b/drivers/char/applicom.c @@ -89,7 +89,7 @@ MODULE_SUPPORTED_DEVICE("ac"); static struct applicom_board { unsigned long PhysIO; - unsigned long RamIO; + void __iomem *RamIO; wait_queue_head_t FlagSleepSend; long irq; spinlock_t mutex; @@ -105,8 +105,8 @@ static unsigned int WriteErrorCount; /* number of write error */ static unsigned int ReadErrorCount; /* number of read error */ static unsigned int DeviceErrorCount; /* number of device error */ -static ssize_t ac_read (struct file *, char *, size_t, loff_t *); -static ssize_t ac_write (struct file *, const char *, size_t, loff_t *); +static ssize_t ac_read (struct file *, char __user *, size_t, loff_t *); +static ssize_t ac_write (struct file *, const char __user *, size_t, loff_t *); static int ac_ioctl(struct inode *, struct file *, unsigned int, unsigned long); static irqreturn_t ac_interrupt(int, void *, struct pt_regs *); @@ -127,7 +127,7 @@ static struct miscdevice ac_miscdev = { static int dummy; /* dev_id for request_irq() */ -static int ac_register_board(unsigned long physloc, unsigned long loc, +static int ac_register_board(unsigned long physloc, void __iomem *loc, unsigned char boardno) { volatile unsigned char byte_reset_it; @@ -179,11 +179,11 @@ void cleanup_module(void) if (!apbs[i].RamIO) continue; - - iounmap((void *) apbs[i].RamIO); if (apbs[i].irq) free_irq(apbs[i].irq, &dummy); + + iounmap(apbs[i].RamIO); } } @@ -193,7 +193,7 @@ int __init applicom_init(void) { int i, numisa = 0; struct pci_dev *dev = NULL; - void *RamIO; + void __iomem *RamIO; int boardno; printk(KERN_INFO "Applicom driver: $Id: ac.c,v 1.30 2000/03/22 16:03:57 dwmw2 Exp $\n"); @@ -223,8 +223,8 @@ int __init applicom_init(void) applicom_pci_devnames[dev->device-1], dev->resource[0].start, dev->irq); - if (!(boardno = ac_register_board(dev->resource[0].start, - (unsigned long)RamIO,0))) { + boardno = ac_register_board(dev->resource[0].start, RamIO,0); + if (!boardno) { printk(KERN_INFO "ac.o: PCI Applicom device doesn't have correct signature.\n"); iounmap(RamIO); pci_disable_device(dev); @@ -235,7 +235,7 @@ int __init applicom_init(void) printk(KERN_INFO "Could not allocate IRQ %d for PCI Applicom device.\n", dev->irq); iounmap(RamIO); pci_disable_device(dev); - apbs[boardno - 1].RamIO = 0; + apbs[boardno - 1].RamIO = NULL; continue; } @@ -270,7 +270,7 @@ int __init applicom_init(void) } if (!(boardno = ac_register_board((unsigned long)mem+ (LEN_RAM_IO*i), - (unsigned long)RamIO,i+1))) { + RamIO,i+1))) { iounmap(RamIO); continue; } @@ -280,8 +280,8 @@ int __init applicom_init(void) if (!numisa) { if (request_irq(irq, &ac_interrupt, SA_SHIRQ, "Applicom ISA", &dummy)) { printk(KERN_WARNING "Could not allocate IRQ %d for ISA Applicom device.\n", irq); - iounmap((void *) RamIO); - apbs[boardno - 1].RamIO = 0; + iounmap(RamIO); + apbs[boardno - 1].RamIO = NULL; } else apbs[boardno - 1].irq = irq; @@ -343,7 +343,7 @@ int __init applicom_init(void) __initcall(applicom_init); #endif -static ssize_t ac_write(struct file *file, const char *buf, size_t count, loff_t * ppos) +static ssize_t ac_write(struct file *file, const char __user *buf, size_t count, loff_t * ppos) { unsigned int NumCard; /* Board number 1 -> 8 */ unsigned int IndexCard; /* Index board number 0 -> 7 */ @@ -449,7 +449,7 @@ static ssize_t ac_write(struct file *file, const char *buf, size_t count, loff_t because it works with 2.2 still */ { unsigned char *from = (unsigned char *) &tmpmailbox; - unsigned long to = (unsigned long) apbs[IndexCard].RamIO + RAM_FROM_PC; + void __iomem *to = apbs[IndexCard].RamIO + RAM_FROM_PC; int c; for (c = 0; c < sizeof(struct mailbox); c++) @@ -467,10 +467,10 @@ static ssize_t ac_write(struct file *file, const char *buf, size_t count, loff_t return 0; } -static int do_ac_read(int IndexCard, char *buf, +static int do_ac_read(int IndexCard, char __user *buf, struct st_ram_io *st_loc, struct mailbox *mailbox) { - unsigned long from = (unsigned long)apbs[IndexCard].RamIO + RAM_TO_PC; + void __iomem *from = apbs[IndexCard].RamIO + RAM_TO_PC; unsigned char *to = (unsigned char *)&mailbox; #ifdef DEBUG int c; @@ -521,7 +521,7 @@ static int do_ac_read(int IndexCard, char *buf, return (sizeof(struct st_ram_io) + sizeof(struct mailbox)); } -static ssize_t ac_read (struct file *filp, char *buf, size_t count, loff_t *ptr) +static ssize_t ac_read (struct file *filp, char __user *buf, size_t count, loff_t *ptr) { unsigned long flags; unsigned int i; @@ -685,10 +685,11 @@ static int ac_ioctl(struct inode *inode, struct file *file, unsigned int cmd, un { /* @ ADG ou ATO selon le cas */ int i; unsigned char IndexCard; - unsigned long pmem; + void __iomem *pmem; int ret = 0; volatile unsigned char byte_reset_it; struct st_ram_io *adgl; + void __user *argp = (void __user *)arg; /* In general, the device is only openable by root anyway, so we're not particularly concerned that bogus ioctls can flood the console. */ @@ -697,7 +698,7 @@ static int ac_ioctl(struct inode *inode, struct file *file, unsigned int cmd, un if (!adgl) return -ENOMEM; - if (copy_from_user(adgl, (void *)arg,sizeof(struct st_ram_io))) { + if (copy_from_user(adgl, argp, sizeof(struct st_ram_io))) { kfree(adgl); return -EFAULT; } @@ -721,7 +722,7 @@ static int ac_ioctl(struct inode *inode, struct file *file, unsigned int cmd, un pmem = apbs[IndexCard].RamIO; for (i = 0; i < sizeof(struct st_ram_io); i++) ((unsigned char *)adgl)[i]=readb(pmem++); - if (copy_to_user((void *)arg, adgl, sizeof(struct st_ram_io))) + if (copy_to_user(argp, adgl, sizeof(struct st_ram_io))) ret = -EFAULT; break; case 1: @@ -742,7 +743,7 @@ static int ac_ioctl(struct inode *inode, struct file *file, unsigned int cmd, un (readb(apbs[IndexCard].RamIO + SERIAL_NUMBER + 1) << 8) + (readb(apbs[IndexCard].RamIO + SERIAL_NUMBER + 2) ); - if (copy_to_user((void *)arg, adgl, sizeof(struct st_ram_io))) + if (copy_to_user(argp, adgl, sizeof(struct st_ram_io))) ret = -EFAULT; break; case 2: @@ -768,7 +769,7 @@ static int ac_ioctl(struct inode *inode, struct file *file, unsigned int cmd, un pmem = apbs[IndexCard].RamIO + TIC_OWNER_TO_PC; adgl->tic_owner_to_pc = readb(pmem++); adgl->numcard_owner_to_pc = readb(pmem); - if (copy_to_user((void *)arg, adgl,sizeof(struct st_ram_io))) + if (copy_to_user(argp, adgl,sizeof(struct st_ram_io))) ret = -EFAULT; break; case 5: