config MTD_GEN_PROBE
        tristate
-       select OBSOLETE_INTERMODULE
 
 config MTD_CFI_ADV_OPTIONS
        bool "Flash chip driver advanced configuration options"
 
 #
 # $Id: Makefile.common,v 1.5 2005/11/07 11:14:22 gleixner Exp $
 
-#                       *** BIG UGLY NOTE ***
-#
-# The removal of get_module_symbol() and replacement with
-# inter_module_register() et al has introduced a link order dependency
-# here where previously there was none.  We now have to ensure that
-# the CFI command set drivers are linked before gen_probe.o
-
 obj-$(CONFIG_MTD)              += chipreg.o
 obj-$(CONFIG_MTD_AMDSTD)       += amd_flash.o
 obj-$(CONFIG_MTD_CFI)          += cfi_probe.o
 
        int interleave;
        int numchips;
        unsigned long chipshift;
-//     const char *im_name;
        struct flchip chips[0];
 };
 
        .module = THIS_MODULE
 };
 
-
-
-static const char im_name[] = "amd_flash";
-
-
-
 static inline __u32 wide_read(struct map_info *map, __u32 addr)
 {
        if (map->buswidth == 1) {
 
        return extp;
 }
 
-/* This routine is made available to other mtd code via
- * inter_module_register.  It must only be accessed through
- * inter_module_get which will bump the use count of this module.  The
- * addresses passed back in cfi are valid as long as the use count of
- * this module is non-zero, i.e. between inter_module_get and
- * inter_module_put.  Keith Owens <kaos@ocs.com.au> 29 Oct 2000.
- */
 struct mtd_info *cfi_cmdset_0001(struct map_info *map, int primary)
 {
        struct cfi_private *cfi = map->fldrv_priv;
 
        return cfi_intelext_setup(mtd);
 }
+struct mtd_info *cfi_cmdset_0003(struct map_info *map, int primary) __attribute__((alias("cfi_cmdset_0001")));
+struct mtd_info *cfi_cmdset_0200(struct map_info *map, int primary) __attribute__((alias("cfi_cmdset_0001")));
+EXPORT_SYMBOL_GPL(cfi_cmdset_0001);
+EXPORT_SYMBOL_GPL(cfi_cmdset_0003);
+EXPORT_SYMBOL_GPL(cfi_cmdset_0200);
 
 static struct mtd_info *cfi_intelext_setup(struct mtd_info *mtd)
 {
        kfree(mtd->eraseregions);
 }
 
-static char im_name_0001[] = "cfi_cmdset_0001";
-static char im_name_0003[] = "cfi_cmdset_0003";
-static char im_name_0200[] = "cfi_cmdset_0200";
-
-static int __init cfi_intelext_init(void)
-{
-       inter_module_register(im_name_0001, THIS_MODULE, &cfi_cmdset_0001);
-       inter_module_register(im_name_0003, THIS_MODULE, &cfi_cmdset_0001);
-       inter_module_register(im_name_0200, THIS_MODULE, &cfi_cmdset_0001);
-       return 0;
-}
-
-static void __exit cfi_intelext_exit(void)
-{
-       inter_module_unregister(im_name_0001);
-       inter_module_unregister(im_name_0003);
-       inter_module_unregister(im_name_0200);
-}
-
-module_init(cfi_intelext_init);
-module_exit(cfi_intelext_exit);
-
 MODULE_LICENSE("GPL");
 MODULE_AUTHOR("David Woodhouse <dwmw2@infradead.org> et al.");
 MODULE_DESCRIPTION("MTD chip driver for Intel/Sharp flash chips");
+MODULE_ALIAS("cfi_cmdset_0003");
+MODULE_ALIAS("cfi_cmdset_0200");
 
 
        return cfi_amdstd_setup(mtd);
 }
-
+EXPORT_SYMBOL(cfi_cmdset_0002);
 
 static struct mtd_info *cfi_amdstd_setup(struct mtd_info *mtd)
 {
        kfree(mtd->eraseregions);
 }
 
-static char im_name[]="cfi_cmdset_0002";
-
-
-static int __init cfi_amdstd_init(void)
-{
-       inter_module_register(im_name, THIS_MODULE, &cfi_cmdset_0002);
-       return 0;
-}
-
-
-static void __exit cfi_amdstd_exit(void)
-{
-       inter_module_unregister(im_name);
-}
-
-
-module_init(cfi_amdstd_init);
-module_exit(cfi_amdstd_exit);
-
 MODULE_LICENSE("GPL");
 MODULE_AUTHOR("Crossnet Co. <info@crossnet.co.jp> et al.");
 MODULE_DESCRIPTION("MTD chip driver for AMD/Fujitsu flash chips");
 
        kfree(cfi);
 }
 
-static char im_name[]="cfi_cmdset_0020";
-
-static int __init cfi_staa_init(void)
-{
-       inter_module_register(im_name, THIS_MODULE, &cfi_cmdset_0020);
-       return 0;
-}
-
-static void __exit cfi_staa_exit(void)
-{
-       inter_module_unregister(im_name);
-}
-
-module_init(cfi_staa_init);
-module_exit(cfi_staa_exit);
-
 MODULE_LICENSE("GPL");
 
 {
        struct cfi_private *cfi = map->fldrv_priv;
        __u16 type = primary?cfi->cfiq->P_ID:cfi->cfiq->A_ID;
-#if defined(CONFIG_MODULES) && defined(HAVE_INTER_MODULE)
+#ifdef CONFIG_MODULES
        char probename[32];
        cfi_cmdset_fn_t *probe_function;
 
        sprintf(probename, "cfi_cmdset_%4.4X", type);
 
-       probe_function = inter_module_get_request(probename, probename);
+       probe_function = (void *)symbol_get(probename);
+       if (!probe_function) {
+               request_module(probename);
+               probe_function = (void *)symbol_get(probename);
+       }
 
        if (probe_function) {
                struct mtd_info *mtd;
 
                mtd = (*probe_function)(map, primary);
                /* If it was happy, it'll have increased its own use count */
-               inter_module_put(probename);
+               symbol_put_addr(probe_function);
                return mtd;
        }
 #endif
-       printk(KERN_NOTICE "Support for command set %04X not present\n",
-              type);
+       printk(KERN_NOTICE "Support for command set %04X not present\n", type);
 
        return NULL;
 }
                return NULL;
 
        switch(type){
-               /* Urgh. Ifdefs. The version with weak symbols was
-                * _much_ nicer. Shame it didn't seem to work on
-                * anything but x86, really.
-                * But we can't rely in inter_module_get() because
-                * that'd mean we depend on link order.
-                */
+               /* We need these for the !CONFIG_MODULES case,
+                  because symbol_get() doesn't work there */
 #ifdef CONFIG_MTD_CFI_INTELEXT
        case 0x0001:
        case 0x0003:
         case 0x0020:
                return cfi_cmdset_0020(map, primary);
 #endif
+       default:
+               return cfi_cmdset_unknown(map, primary);
        }
-
-       return cfi_cmdset_unknown(map, primary);
 }
 
 MODULE_LICENSE("GPL");