aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/mtd/chips/Kconfig1
-rw-r--r--drivers/mtd/chips/Makefile7
-rw-r--r--drivers/mtd/chips/amd_flash.c7
-rw-r--r--drivers/mtd/chips/cfi_cmdset_0001.c36
-rw-r--r--drivers/mtd/chips/cfi_cmdset_0002.c21
-rw-r--r--drivers/mtd/chips/cfi_cmdset_0020.c16
-rw-r--r--drivers/mtd/chips/gen_probe.c25
7 files changed, 20 insertions, 93 deletions
diff --git a/drivers/mtd/chips/Kconfig b/drivers/mtd/chips/Kconfig
index a7ec5954caf5..6d8f30deb868 100644
--- a/drivers/mtd/chips/Kconfig
+++ b/drivers/mtd/chips/Kconfig
@@ -30,7 +30,6 @@ config MTD_JEDECPROBE
30 30
31config MTD_GEN_PROBE 31config MTD_GEN_PROBE
32 tristate 32 tristate
33 select OBSOLETE_INTERMODULE
34 33
35config MTD_CFI_ADV_OPTIONS 34config MTD_CFI_ADV_OPTIONS
36 bool "Flash chip driver advanced configuration options" 35 bool "Flash chip driver advanced configuration options"
diff --git a/drivers/mtd/chips/Makefile b/drivers/mtd/chips/Makefile
index 8afe3092c4e3..75bc1c2a0f43 100644
--- a/drivers/mtd/chips/Makefile
+++ b/drivers/mtd/chips/Makefile
@@ -3,13 +3,6 @@
3# 3#
4# $Id: Makefile.common,v 1.5 2005/11/07 11:14:22 gleixner Exp $ 4# $Id: Makefile.common,v 1.5 2005/11/07 11:14:22 gleixner Exp $
5 5
6# *** BIG UGLY NOTE ***
7#
8# The removal of get_module_symbol() and replacement with
9# inter_module_register() et al has introduced a link order dependency
10# here where previously there was none. We now have to ensure that
11# the CFI command set drivers are linked before gen_probe.o
12
13obj-$(CONFIG_MTD) += chipreg.o 6obj-$(CONFIG_MTD) += chipreg.o
14obj-$(CONFIG_MTD_AMDSTD) += amd_flash.o 7obj-$(CONFIG_MTD_AMDSTD) += amd_flash.o
15obj-$(CONFIG_MTD_CFI) += cfi_probe.o 8obj-$(CONFIG_MTD_CFI) += cfi_probe.o
diff --git a/drivers/mtd/chips/amd_flash.c b/drivers/mtd/chips/amd_flash.c
index 57115618c496..9e466509a23d 100644
--- a/drivers/mtd/chips/amd_flash.c
+++ b/drivers/mtd/chips/amd_flash.c
@@ -97,7 +97,6 @@ struct amd_flash_private {
97 int interleave; 97 int interleave;
98 int numchips; 98 int numchips;
99 unsigned long chipshift; 99 unsigned long chipshift;
100// const char *im_name;
101 struct flchip chips[0]; 100 struct flchip chips[0];
102}; 101};
103 102
@@ -131,12 +130,6 @@ static struct mtd_chip_driver amd_flash_chipdrv = {
131 .module = THIS_MODULE 130 .module = THIS_MODULE
132}; 131};
133 132
134
135
136static const char im_name[] = "amd_flash";
137
138
139
140static inline __u32 wide_read(struct map_info *map, __u32 addr) 133static inline __u32 wide_read(struct map_info *map, __u32 addr)
141{ 134{
142 if (map->buswidth == 1) { 135 if (map->buswidth == 1) {
diff --git a/drivers/mtd/chips/cfi_cmdset_0001.c b/drivers/mtd/chips/cfi_cmdset_0001.c
index 1c074d63ff3a..fe00af3f9195 100644
--- a/drivers/mtd/chips/cfi_cmdset_0001.c
+++ b/drivers/mtd/chips/cfi_cmdset_0001.c
@@ -331,13 +331,6 @@ read_pri_intelext(struct map_info *map, __u16 adr)
331 return extp; 331 return extp;
332} 332}
333 333
334/* This routine is made available to other mtd code via
335 * inter_module_register. It must only be accessed through
336 * inter_module_get which will bump the use count of this module. The
337 * addresses passed back in cfi are valid as long as the use count of
338 * this module is non-zero, i.e. between inter_module_get and
339 * inter_module_put. Keith Owens <kaos@ocs.com.au> 29 Oct 2000.
340 */
341struct mtd_info *cfi_cmdset_0001(struct map_info *map, int primary) 334struct mtd_info *cfi_cmdset_0001(struct map_info *map, int primary)
342{ 335{
343 struct cfi_private *cfi = map->fldrv_priv; 336 struct cfi_private *cfi = map->fldrv_priv;
@@ -415,6 +408,11 @@ struct mtd_info *cfi_cmdset_0001(struct map_info *map, int primary)
415 408
416 return cfi_intelext_setup(mtd); 409 return cfi_intelext_setup(mtd);
417} 410}
411struct mtd_info *cfi_cmdset_0003(struct map_info *map, int primary) __attribute__((alias("cfi_cmdset_0001")));
412struct mtd_info *cfi_cmdset_0200(struct map_info *map, int primary) __attribute__((alias("cfi_cmdset_0001")));
413EXPORT_SYMBOL_GPL(cfi_cmdset_0001);
414EXPORT_SYMBOL_GPL(cfi_cmdset_0003);
415EXPORT_SYMBOL_GPL(cfi_cmdset_0200);
418 416
419static struct mtd_info *cfi_intelext_setup(struct mtd_info *mtd) 417static struct mtd_info *cfi_intelext_setup(struct mtd_info *mtd)
420{ 418{
@@ -2445,28 +2443,8 @@ static void cfi_intelext_destroy(struct mtd_info *mtd)
2445 kfree(mtd->eraseregions); 2443 kfree(mtd->eraseregions);
2446} 2444}
2447 2445
2448static char im_name_0001[] = "cfi_cmdset_0001";
2449static char im_name_0003[] = "cfi_cmdset_0003";
2450static char im_name_0200[] = "cfi_cmdset_0200";
2451
2452static int __init cfi_intelext_init(void)
2453{
2454 inter_module_register(im_name_0001, THIS_MODULE, &cfi_cmdset_0001);
2455 inter_module_register(im_name_0003, THIS_MODULE, &cfi_cmdset_0001);
2456 inter_module_register(im_name_0200, THIS_MODULE, &cfi_cmdset_0001);
2457 return 0;
2458}
2459
2460static void __exit cfi_intelext_exit(void)
2461{
2462 inter_module_unregister(im_name_0001);
2463 inter_module_unregister(im_name_0003);
2464 inter_module_unregister(im_name_0200);
2465}
2466
2467module_init(cfi_intelext_init);
2468module_exit(cfi_intelext_exit);
2469
2470MODULE_LICENSE("GPL"); 2446MODULE_LICENSE("GPL");
2471MODULE_AUTHOR("David Woodhouse <dwmw2@infradead.org> et al."); 2447MODULE_AUTHOR("David Woodhouse <dwmw2@infradead.org> et al.");
2472MODULE_DESCRIPTION("MTD chip driver for Intel/Sharp flash chips"); 2448MODULE_DESCRIPTION("MTD chip driver for Intel/Sharp flash chips");
2449MODULE_ALIAS("cfi_cmdset_0003");
2450MODULE_ALIAS("cfi_cmdset_0200");
diff --git a/drivers/mtd/chips/cfi_cmdset_0002.c b/drivers/mtd/chips/cfi_cmdset_0002.c
index aed10bd5c3c3..26fb63ec67fa 100644
--- a/drivers/mtd/chips/cfi_cmdset_0002.c
+++ b/drivers/mtd/chips/cfi_cmdset_0002.c
@@ -326,7 +326,7 @@ struct mtd_info *cfi_cmdset_0002(struct map_info *map, int primary)
326 326
327 return cfi_amdstd_setup(mtd); 327 return cfi_amdstd_setup(mtd);
328} 328}
329 329EXPORT_SYMBOL(cfi_cmdset_0002);
330 330
331static struct mtd_info *cfi_amdstd_setup(struct mtd_info *mtd) 331static struct mtd_info *cfi_amdstd_setup(struct mtd_info *mtd)
332{ 332{
@@ -1758,25 +1758,6 @@ static void cfi_amdstd_destroy(struct mtd_info *mtd)
1758 kfree(mtd->eraseregions); 1758 kfree(mtd->eraseregions);
1759} 1759}
1760 1760
1761static char im_name[]="cfi_cmdset_0002";
1762
1763
1764static int __init cfi_amdstd_init(void)
1765{
1766 inter_module_register(im_name, THIS_MODULE, &cfi_cmdset_0002);
1767 return 0;
1768}
1769
1770
1771static void __exit cfi_amdstd_exit(void)
1772{
1773 inter_module_unregister(im_name);
1774}
1775
1776
1777module_init(cfi_amdstd_init);
1778module_exit(cfi_amdstd_exit);
1779
1780MODULE_LICENSE("GPL"); 1761MODULE_LICENSE("GPL");
1781MODULE_AUTHOR("Crossnet Co. <info@crossnet.co.jp> et al."); 1762MODULE_AUTHOR("Crossnet Co. <info@crossnet.co.jp> et al.");
1782MODULE_DESCRIPTION("MTD chip driver for AMD/Fujitsu flash chips"); 1763MODULE_DESCRIPTION("MTD chip driver for AMD/Fujitsu flash chips");
diff --git a/drivers/mtd/chips/cfi_cmdset_0020.c b/drivers/mtd/chips/cfi_cmdset_0020.c
index 0807c1c91e55..37dd25536ca5 100644
--- a/drivers/mtd/chips/cfi_cmdset_0020.c
+++ b/drivers/mtd/chips/cfi_cmdset_0020.c
@@ -1410,20 +1410,4 @@ static void cfi_staa_destroy(struct mtd_info *mtd)
1410 kfree(cfi); 1410 kfree(cfi);
1411} 1411}
1412 1412
1413static char im_name[]="cfi_cmdset_0020";
1414
1415static int __init cfi_staa_init(void)
1416{
1417 inter_module_register(im_name, THIS_MODULE, &cfi_cmdset_0020);
1418 return 0;
1419}
1420
1421static void __exit cfi_staa_exit(void)
1422{
1423 inter_module_unregister(im_name);
1424}
1425
1426module_init(cfi_staa_init);
1427module_exit(cfi_staa_exit);
1428
1429MODULE_LICENSE("GPL"); 1413MODULE_LICENSE("GPL");
diff --git a/drivers/mtd/chips/gen_probe.c b/drivers/mtd/chips/gen_probe.c
index 41bd59d20d85..9b252d2e4a70 100644
--- a/drivers/mtd/chips/gen_probe.c
+++ b/drivers/mtd/chips/gen_probe.c
@@ -194,25 +194,28 @@ static inline struct mtd_info *cfi_cmdset_unknown(struct map_info *map,
194{ 194{
195 struct cfi_private *cfi = map->fldrv_priv; 195 struct cfi_private *cfi = map->fldrv_priv;
196 __u16 type = primary?cfi->cfiq->P_ID:cfi->cfiq->A_ID; 196 __u16 type = primary?cfi->cfiq->P_ID:cfi->cfiq->A_ID;
197#if defined(CONFIG_MODULES) && defined(HAVE_INTER_MODULE) 197#ifdef CONFIG_MODULES
198 char probename[32]; 198 char probename[32];
199 cfi_cmdset_fn_t *probe_function; 199 cfi_cmdset_fn_t *probe_function;
200 200
201 sprintf(probename, "cfi_cmdset_%4.4X", type); 201 sprintf(probename, "cfi_cmdset_%4.4X", type);
202 202
203 probe_function = inter_module_get_request(probename, probename); 203 probe_function = (void *)symbol_get(probename);
204 if (!probe_function) {
205 request_module(probename);
206 probe_function = (void *)symbol_get(probename);
207 }
204 208
205 if (probe_function) { 209 if (probe_function) {
206 struct mtd_info *mtd; 210 struct mtd_info *mtd;
207 211
208 mtd = (*probe_function)(map, primary); 212 mtd = (*probe_function)(map, primary);
209 /* If it was happy, it'll have increased its own use count */ 213 /* If it was happy, it'll have increased its own use count */
210 inter_module_put(probename); 214 symbol_put_addr(probe_function);
211 return mtd; 215 return mtd;
212 } 216 }
213#endif 217#endif
214 printk(KERN_NOTICE "Support for command set %04X not present\n", 218 printk(KERN_NOTICE "Support for command set %04X not present\n", type);
215 type);
216 219
217 return NULL; 220 return NULL;
218} 221}
@@ -226,12 +229,8 @@ static struct mtd_info *check_cmd_set(struct map_info *map, int primary)
226 return NULL; 229 return NULL;
227 230
228 switch(type){ 231 switch(type){
229 /* Urgh. Ifdefs. The version with weak symbols was 232 /* We need these for the !CONFIG_MODULES case,
230 * _much_ nicer. Shame it didn't seem to work on 233 because symbol_get() doesn't work there */
231 * anything but x86, really.
232 * But we can't rely in inter_module_get() because
233 * that'd mean we depend on link order.
234 */
235#ifdef CONFIG_MTD_CFI_INTELEXT 234#ifdef CONFIG_MTD_CFI_INTELEXT
236 case 0x0001: 235 case 0x0001:
237 case 0x0003: 236 case 0x0003:
@@ -246,9 +245,9 @@ static struct mtd_info *check_cmd_set(struct map_info *map, int primary)
246 case 0x0020: 245 case 0x0020:
247 return cfi_cmdset_0020(map, primary); 246 return cfi_cmdset_0020(map, primary);
248#endif 247#endif
248 default:
249 return cfi_cmdset_unknown(map, primary);
249 } 250 }
250
251 return cfi_cmdset_unknown(map, primary);
252} 251}
253 252
254MODULE_LICENSE("GPL"); 253MODULE_LICENSE("GPL");