linux 2.6.16.38 w/ vs2.0.3-rc1
[linux-2.6.git] / drivers / char / applicom.c
index 10a389d..927a5bb 100644 (file)
@@ -112,7 +112,7 @@ static int ac_ioctl(struct inode *, struct file *, unsigned int,
                    unsigned long);
 static irqreturn_t ac_interrupt(int, void *, struct pt_regs *);
 
-static const struct file_operations ac_fops = {
+static struct file_operations ac_fops = {
        .owner = THIS_MODULE,
        .llseek = no_llseek,
        .read = ac_read,
@@ -142,7 +142,7 @@ static int ac_register_board(unsigned long physloc, void __iomem *loc,
        if (!boardno)
                boardno = readb(loc + NUMCARD_OWNER_TO_PC);
 
-       if (!boardno || boardno > MAX_BOARD) {
+       if (!boardno && boardno > MAX_BOARD) {
                printk(KERN_WARNING "Board #%d (at 0x%lx) is out of range (1 <= x <= %d).\n",
                       boardno, physloc, MAX_BOARD);
                return 0;
@@ -166,7 +166,11 @@ static int ac_register_board(unsigned long physloc, void __iomem *loc,
        return boardno + 1;
 }
 
-static void __exit applicom_exit(void)
+#ifdef MODULE
+
+#define applicom_init init_module
+
+void cleanup_module(void)
 {
        unsigned int i;
 
@@ -184,7 +188,9 @@ static void __exit applicom_exit(void)
        }
 }
 
-static int __init applicom_init(void)
+#endif                         /* MODULE */
+
+int __init applicom_init(void)
 {
        int i, numisa = 0;
        struct pci_dev *dev = NULL;
@@ -209,16 +215,13 @@ static int __init applicom_init(void)
                RamIO = ioremap(dev->resource[0].start, LEN_RAM_IO);
 
                if (!RamIO) {
-                       printk(KERN_INFO "ac.o: Failed to ioremap PCI memory "
-                               "space at 0x%llx\n",
-                               (unsigned long long)dev->resource[0].start);
+                       printk(KERN_INFO "ac.o: Failed to ioremap PCI memory space at 0x%lx\n", dev->resource[0].start);
                        pci_disable_device(dev);
                        return -EIO;
                }
 
-               printk(KERN_INFO "Applicom %s found at mem 0x%llx, irq %d\n",
-                      applicom_pci_devnames[dev->device-1],
-                          (unsigned long long)dev->resource[0].start,
+               printk(KERN_INFO "Applicom %s found at mem 0x%lx, irq %d\n",
+                      applicom_pci_devnames[dev->device-1], dev->resource[0].start, 
                       dev->irq);
 
                boardno = ac_register_board(dev->resource[0].start, RamIO,0);
@@ -229,7 +232,7 @@ static int __init applicom_init(void)
                        continue;
                }
 
-               if (request_irq(dev->irq, &ac_interrupt, IRQF_SHARED, "Applicom PCI", &dummy)) {
+               if (request_irq(dev->irq, &ac_interrupt, SA_SHIRQ, "Applicom PCI", &dummy)) {
                        printk(KERN_INFO "Could not allocate IRQ %d for PCI Applicom device.\n", dev->irq);
                        iounmap(RamIO);
                        pci_disable_device(dev);
@@ -276,7 +279,7 @@ static int __init applicom_init(void)
                printk(KERN_NOTICE "Applicom ISA card found at mem 0x%lx, irq %d\n", mem + (LEN_RAM_IO*i), irq);
 
                if (!numisa) {
-                       if (request_irq(irq, &ac_interrupt, IRQF_SHARED, "Applicom ISA", &dummy)) {
+                       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(RamIO);
                                apbs[boardno - 1].RamIO = NULL;
@@ -352,9 +355,10 @@ out:
        return ret;
 }
 
-module_init(applicom_init);
-module_exit(applicom_exit);
 
+#ifndef MODULE
+__initcall(applicom_init);
+#endif
 
 static ssize_t ac_write(struct file *file, const char __user *buf, size_t count, loff_t * ppos)
 {
@@ -847,3 +851,28 @@ static int ac_ioctl(struct inode *inode, struct file *file, unsigned int cmd, un
        return 0;
 }
 
+#ifndef MODULE
+static int __init applicom_setup(char *str)
+{
+       int ints[4];
+
+       (void) get_options(str, 4, ints);
+
+       if (ints[0] > 2) {
+               printk(KERN_WARNING "Too many arguments to 'applicom=', expected mem,irq only.\n");
+       }
+
+       if (ints[0] < 2) {
+               printk(KERN_INFO"applicom numargs: %d\n", ints[0]);
+               return 0;
+       }
+
+       mem = ints[1];
+       irq = ints[2];
+       return 1;
+}
+
+__setup("applicom=", applicom_setup);
+
+#endif                         /* MODULE */
+