Sorry for the disturbance folks, but my mailer currently has 
something against Alan.

Alan,

This is the i2o patch I'm going to put into the bigger "move-scsi
things-around" patch. This is just for you to verify.


-- 
Torben Mathiasen <[EMAIL PROTECTED]>
Linux ThunderLAN maintainer 
http://tlan.kernel.dk
diff -urN --exclude-from=/root/torben linux-test9p7-patched/drivers/block/genhd.c 
linux/drivers/block/genhd.c
--- linux-test9p7-patched/drivers/block/genhd.c Sat Sep 30 20:47:06 2000
+++ linux/drivers/block/genhd.c Thu Sep 28 17:18:42 2000
@@ -27,7 +27,6 @@
 extern void console_map_init(void);
 extern int soc_probe(void);
 extern int atmdev_init(void);
-extern int i2o_init(void);
 extern int cpqarray_init(void);
 extern void ieee1394_init(void);
 
@@ -39,9 +38,6 @@
        chr_dev_init();
        blk_dev_init();
        sti();
-#ifdef CONFIG_I2O
-       i2o_init();
-#endif
 #ifdef CONFIG_BLK_DEV_DAC960
        DAC960_Initialize();
 #endif
diff -urN --exclude-from=/root/torben linux-test9p7-patched/drivers/i2o/i2o_block.c 
linux/drivers/i2o/i2o_block.c
--- linux-test9p7-patched/drivers/i2o/i2o_block.c       Fri Jul  7 04:24:51 2000
+++ linux/drivers/i2o/i2o_block.c       Sat Sep 30 17:20:02 2000
@@ -46,6 +46,7 @@
 #include <linux/fs.h>
 #include <linux/stat.h>
 #include <linux/errno.h>
+#include <linux/init.h>
 #include <linux/file.h>
 #include <linux/ioctl.h>
 #include <linux/i2o.h>
@@ -108,6 +109,7 @@
 #define I2O_BSA_DSC_VOLUME_CHANGED      0x000D
 #define I2O_BSA_DSC_TIMEOUT             0x000E
 
+
 /*
  *     Some of these can be made smaller later
  */
@@ -1591,11 +1593,7 @@
  *  (Just smiley confuses emacs :-)
  */
 
-#ifdef MODULE
-#define i2o_block_init init_module
-#endif
-
-int i2o_block_init(void)
+static int __init i2o_block_init(void)
 {
        int i;
 
@@ -1611,9 +1609,8 @@
                       MAJOR_NR);
                return -EIO;
        }
-#ifdef MODULE
+       
        printk(KERN_INFO "i2o_block: registered device at major %d\n", MAJOR_NR);
-#endif
 
        /*
         *      Now fill in the boiler plate
@@ -1694,13 +1691,7 @@
        return 0;
 }
 
-#ifdef MODULE
-
-EXPORT_NO_SYMBOLS;
-MODULE_AUTHOR("Red Hat Software");
-MODULE_DESCRIPTION("I2O Block Device OSM");
-
-void cleanup_module(void)
+static void __exit i2o_block_exit(void)
 {
        struct gendisk **gdp;
        int i;
@@ -1760,4 +1751,11 @@
                        break;
 
 }
-#endif
+
+EXPORT_NO_SYMBOLS;
+MODULE_AUTHOR("Red Hat Software");
+MODULE_DESCRIPTION("I2O Block Device OSM");
+
+module_init(i2o_block_init);
+module_exit(i2o_block_exit);
+
diff -urN --exclude-from=/root/torben linux-test9p7-patched/drivers/i2o/i2o_config.c 
linux/drivers/i2o/i2o_config.c
--- linux-test9p7-patched/drivers/i2o/i2o_config.c      Thu Jul 13 06:58:42 2000
+++ linux/drivers/i2o/i2o_config.c      Thu Sep 28 23:54:09 2000
@@ -910,11 +910,7 @@
        &config_fops
 };     
 
-#ifdef MODULE
-int init_module(void)
-#else
-int __init i2o_config_init(void)
-#endif
+static int __init i2o_config_init(void)
 {
        printk(KERN_INFO "I2O configuration manager v 0.04.\n");
        printk(KERN_INFO "  (C) Copyright 1999 Red Hat Software\n");
@@ -948,9 +944,7 @@
        return 0;
 }
 
-#ifdef MODULE
-
-void cleanup_module(void)
+void __exit i2o_config_exit(void)
 {
        misc_deregister(&i2o_miscdev);
        
@@ -961,9 +955,11 @@
        if(i2o_buffer)
                kfree(i2o_buffer);
 }
+
+module_init(i2o_config_init);
+module_exit(i2o_config_exit);
  
 EXPORT_NO_SYMBOLS;
 MODULE_AUTHOR("Red Hat Software");
 MODULE_DESCRIPTION("I2O Configuration");
 
-#endif
diff -urN --exclude-from=/root/torben linux-test9p7-patched/drivers/i2o/i2o_core.c 
linux/drivers/i2o/i2o_core.c
--- linux-test9p7-patched/drivers/i2o/i2o_core.c        Mon Jun 19 22:30:56 2000
+++ linux/drivers/i2o/i2o_core.c        Sat Sep 30 18:56:33 2000
@@ -19,7 +19,7 @@
  *             Auvo Häkkinen <[EMAIL PROTECTED]> 
  *             Deepak Saxena <[EMAIL PROTECTED]> 
  *             Boji T Kannanthanam <[EMAIL PROTECTED]>
- * 
+ *             Torben Mathiasen <[EMAIL PROTECTED]> 
  */
 
 #include <linux/config.h>
@@ -119,7 +119,6 @@
  */
 static spinlock_t i2o_dev_lock = SPIN_LOCK_UNLOCKED;
 
-#ifdef MODULE
 /* 
  * Function table to send to bus specific layers
  * See <include/linux/i2o.h> for explanation of this
@@ -134,12 +133,9 @@
        i2o_delete_controller
 };
 
-#ifdef CONFIG_I2O_PCI_MODULE
 extern int i2o_pci_core_attach(struct i2o_core_func_table *);
 extern void i2o_pci_core_detach(void);
-#endif /* CONFIG_I2O_PCI_MODULE */
 
-#endif /* MODULE */
 
 /*
  * Structures and definitions for synchronous message posting.
@@ -3115,8 +3111,6 @@
 }
 
 
-#ifdef MODULE
-
 EXPORT_SYMBOL(i2o_controller_chain);
 EXPORT_SYMBOL(i2o_num_controllers);
 EXPORT_SYMBOL(i2o_find_controller);
@@ -3152,8 +3146,7 @@
 MODULE_AUTHOR("Red Hat Software");
 MODULE_DESCRIPTION("I2O Core");
 
-
-int init_module(void)
+static int __init init_i2o(void)
 {
        printk(KERN_INFO "I2O Core - (C) Copyright 1999 Red Hat Software\n");
        if (i2o_install_handler(&i2o_core_handler) < 0)
@@ -3168,10 +3161,8 @@
        /*
         * Attach core to I2O PCI transport (and others as they are developed)
         */
-#ifdef CONFIG_I2O_PCI_MODULE
        if(i2o_pci_core_attach(&i2o_core_functions) < 0)
                printk(KERN_INFO "i2o: No PCI I2O controllers found\n");
-#endif
 
        /*
         * Initialize event handling thread
@@ -3195,7 +3186,7 @@
        return 0;
 }
 
-void cleanup_module(void)
+static void __exit exit_i2o(void)
 {
        int stat;
 
@@ -3221,72 +3212,14 @@
                }
        }
 
-#ifdef CONFIG_I2O_PCI_MODULE
        i2o_pci_core_detach();
-#endif
 
        i2o_remove_handler(&i2o_core_handler);
 
        unregister_reboot_notifier(&i2o_reboot_notifier);
 }
 
-#else
-
-extern int i2o_block_init(void);
-extern int i2o_config_init(void);
-extern int i2o_lan_init(void);
-extern int i2o_pci_init(void);
-extern int i2o_proc_init(void);
-extern int i2o_scsi_init(void);
-
-int __init i2o_init(void)
-{
-       printk(KERN_INFO "Loading I2O Core - (c) Copyright 1999 Red Hat Software\n");
-       
-       if (i2o_install_handler(&i2o_core_handler) < 0)
-       {
-               printk(KERN_ERR 
-                       "i2o_core: Unable to install core handler.\nI2O stack not 
loaded!");
-               return 0;
-       }
-
-       core_context = i2o_core_handler.context;
-
-       /*
-        * Initialize event handling thread
-        * We may not find any controllers, but still want this as 
-        * down the road we may have hot pluggable controllers that
-        * need to be dealt with.
-        */     
-       init_MUTEX_LOCKED(&evt_sem);
-       if((evt_pid = kernel_thread(i2o_core_evt, &evt_reply, CLONE_SIGHAND)) < 0)
-       {
-               printk(KERN_ERR "I2O: Could not create event handler kernel thread\n");
-               i2o_remove_handler(&i2o_core_handler);
-               return 0;
-       }
-
+module_init(init_i2o);
+module_exit(exit_i2o);
 
-#ifdef CONFIG_I2O_PCI
-       i2o_pci_init();
-#endif
 
-       if(i2o_num_controllers)
-               i2o_sys_init();
-
-       register_reboot_notifier(&i2o_reboot_notifier);
-
-       i2o_config_init();
-#ifdef CONFIG_I2O_BLOCK
-       i2o_block_init();
-#endif
-#ifdef CONFIG_I2O_LAN
-       i2o_lan_init();
-#endif
-#ifdef CONFIG_I2O_PROC
-       i2o_proc_init();
-#endif
-       return 0;
-}
-
-#endif
diff -urN --exclude-from=/root/torben linux-test9p7-patched/drivers/i2o/i2o_lan.c 
linux/drivers/i2o/i2o_lan.c
--- linux-test9p7-patched/drivers/i2o/i2o_lan.c Mon Jun 19 22:30:56 2000
+++ linux/drivers/i2o/i2o_lan.c Fri Sep 29 00:42:45 2000
@@ -1421,11 +1421,8 @@
        return dev;
 }
 
-#ifdef MODULE
-#define i2o_lan_init   init_module
-#endif
 
-int __init i2o_lan_init(void)
+static int __init i2o_lan_init(void)
 {
        struct net_device *dev;
        int i;
@@ -1506,9 +1503,8 @@
        return 0;
 }
 
-#ifdef MODULE
 
-void cleanup_module(void)
+static void __exit i2o_lan_exit(void)
 {
        int i;
 
@@ -1565,4 +1561,5 @@
 MODULE_PARM(tx_batch_mode, "0-2" "i");
 MODULE_PARM_DESC(tx_batch_mode, "0=Send immediatelly, 1=Send in batches, 2=Switch 
automatically");
 
-#endif
+module_init(i2o_lan_init);
+module_exit(i2o_lan_exit);
diff -urN --exclude-from=/root/torben linux-test9p7-patched/drivers/i2o/i2o_pci.c 
linux/drivers/i2o/i2o_pci.c
--- linux-test9p7-patched/drivers/i2o/i2o_pci.c Mon Jun 19 22:30:56 2000
+++ linux/drivers/i2o/i2o_pci.c Fri Sep 29 21:22:28 2000
@@ -31,7 +31,6 @@
 #include <asm/mtrr.h>
 #endif // CONFIG_MTRR
 
-#ifdef MODULE
 /*
  * Core function table
  * See <include/linux/i2o.h> for an explanation
@@ -41,7 +40,6 @@
 /* Core attach function */
 extern int i2o_pci_core_attach(struct i2o_core_func_table *);
 extern void i2o_pci_core_detach(void);
-#endif /* MODULE */
 
 /*
  *     Free bus specific resources
@@ -304,8 +302,6 @@
 }
 #endif // I2O_HOTPLUG_SUPPORT
 
-#ifdef MODULE
-
 int i2o_pci_core_attach(struct i2o_core_func_table *table)
 {
        MOD_INC_USE_COUNT;
@@ -322,7 +318,7 @@
        MOD_DEC_USE_COUNT;
 }
 
-int init_module(void)
+static int __init i2o_pci_init(void)
 {
        printk(KERN_INFO "Linux I2O PCI support (c) 1999 Red Hat Software.\n");
        
@@ -332,20 +328,16 @@
  
 }
 
-void cleanup_module(void)
+static void __exit i2o_pci_exit(void)
 {
 }
 
+module_init(i2o_pci_init);
+module_exit(i2o_pci_exit);
+
 EXPORT_SYMBOL(i2o_pci_core_attach);
 EXPORT_SYMBOL(i2o_pci_core_detach);
 
 MODULE_AUTHOR("Red Hat Software");
 MODULE_DESCRIPTION("I2O PCI Interface");
 
-#else
-void __init i2o_pci_init(void)
-{
-       printk(KERN_INFO "Linux I2O PCI support (c) 1999 Red Hat Software.\n");
-       i2o_pci_scan();
-}
-#endif
diff -urN --exclude-from=/root/torben linux-test9p7-patched/drivers/i2o/i2o_proc.c 
linux/drivers/i2o/i2o_proc.c
--- linux-test9p7-patched/drivers/i2o/i2o_proc.c        Sat Sep 30 20:47:06 2000
+++ linux/drivers/i2o/i2o_proc.c        Fri Sep 29 00:41:35 2000
@@ -3365,8 +3365,6 @@
        i2o_remove_handler(&i2o_proc_handler);
 }
 
-#ifdef MODULE
 module_init(i2o_proc_init);
-#endif
 module_exit(i2o_proc_exit);
 
diff -urN --exclude-from=/root/torben linux-test9p7-patched/drivers/i2o/i2o_scsi.c 
linux/drivers/i2o/i2o_scsi.c
--- linux-test9p7-patched/drivers/i2o/i2o_scsi.c        Wed Apr 12 18:38:53 2000
+++ linux/drivers/i2o/i2o_scsi.c        Fri Sep 29 00:48:12 2000
@@ -902,12 +902,8 @@
        return 0;
 }
 
-/* Loadable module support */
-#ifdef MODULE
-
 MODULE_AUTHOR("Red Hat Software");
 
 Scsi_Host_Template driver_template = I2OSCSI;
 
 #include "../scsi/scsi_module.c"
-#endif
diff -urN --exclude-from=/root/torben linux-test9p7-patched/include/linux/i2o.h 
linux/include/linux/i2o.h
--- linux-test9p7-patched/include/linux/i2o.h   Thu May 11 01:56:43 2000
+++ linux/include/linux/i2o.h   Sat Sep 30 18:51:07 2000
@@ -173,7 +173,6 @@
        /* User data follows */
 };
 
-#ifdef MODULE
 /*
  * Used by bus specific modules to communicate with the core
  *
@@ -193,7 +192,6 @@
        void    (*run_queue)(struct i2o_controller *c);
        int     (*delete)(struct i2o_controller *);
 };
-#endif // MODULE
 
 /*
  * I2O System table entry

Reply via email to