Skip to content

Commit a15bdee

Browse files
committed
Remove use of inter_module_crap in NOR flash chip drivers.
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
1 parent 396674e commit a15bdee

7 files changed

Lines changed: 20 additions & 93 deletions

File tree

‎drivers/mtd/chips/Kconfig‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ config MTD_JEDECPROBE
3030

3131
config MTD_GEN_PROBE
3232
tristate
33-
select OBSOLETE_INTERMODULE
3433

3534
config MTD_CFI_ADV_OPTIONS
3635
bool "Flash chip driver advanced configuration options"

‎drivers/mtd/chips/Makefile‎

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,6 @@
33
#
44
# $Id: Makefile.common,v 1.5 2005/11/07 11:14:22 gleixner Exp $
55

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-
136
obj-$(CONFIG_MTD) += chipreg.o
147
obj-$(CONFIG_MTD_AMDSTD) += amd_flash.o
158
obj-$(CONFIG_MTD_CFI) += cfi_probe.o

‎drivers/mtd/chips/amd_flash.c‎

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,6 @@ struct amd_flash_private {
9797
int interleave;
9898
int numchips;
9999
unsigned long chipshift;
100-
// const char *im_name;
101100
struct flchip chips[0];
102101
};
103102

@@ -131,12 +130,6 @@ static struct mtd_chip_driver amd_flash_chipdrv = {
131130
.module = THIS_MODULE
132131
};
133132

134-
135-
136-
static const char im_name[] = "amd_flash";
137-
138-
139-
140133
static inline __u32 wide_read(struct map_info *map, __u32 addr)
141134
{
142135
if (map->buswidth == 1) {

‎drivers/mtd/chips/cfi_cmdset_0001.c‎

Lines changed: 7 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -331,13 +331,6 @@ read_pri_intelext(struct map_info *map, __u16 adr)
331331
return extp;
332332
}
333333

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-
*/
341334
struct mtd_info *cfi_cmdset_0001(struct map_info *map, int primary)
342335
{
343336
struct cfi_private *cfi = map->fldrv_priv;
@@ -415,6 +408,11 @@ struct mtd_info *cfi_cmdset_0001(struct map_info *map, int primary)
415408

416409
return cfi_intelext_setup(mtd);
417410
}
411+
struct mtd_info *cfi_cmdset_0003(struct map_info *map, int primary) __attribute__((alias("cfi_cmdset_0001")));
412+
struct mtd_info *cfi_cmdset_0200(struct map_info *map, int primary) __attribute__((alias("cfi_cmdset_0001")));
413+
EXPORT_SYMBOL_GPL(cfi_cmdset_0001);
414+
EXPORT_SYMBOL_GPL(cfi_cmdset_0003);
415+
EXPORT_SYMBOL_GPL(cfi_cmdset_0200);
418416

419417
static struct mtd_info *cfi_intelext_setup(struct mtd_info *mtd)
420418
{
@@ -2445,28 +2443,8 @@ static void cfi_intelext_destroy(struct mtd_info *mtd)
24452443
kfree(mtd->eraseregions);
24462444
}
24472445

2448-
static char im_name_0001[] = "cfi_cmdset_0001";
2449-
static char im_name_0003[] = "cfi_cmdset_0003";
2450-
static char im_name_0200[] = "cfi_cmdset_0200";
2451-
2452-
static 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-
2460-
static 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-
2467-
module_init(cfi_intelext_init);
2468-
module_exit(cfi_intelext_exit);
2469-
24702446
MODULE_LICENSE("GPL");
24712447
MODULE_AUTHOR("David Woodhouse <dwmw2@infradead.org> et al.");
24722448
MODULE_DESCRIPTION("MTD chip driver for Intel/Sharp flash chips");
2449+
MODULE_ALIAS("cfi_cmdset_0003");
2450+
MODULE_ALIAS("cfi_cmdset_0200");

‎drivers/mtd/chips/cfi_cmdset_0002.c‎

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,7 @@ struct mtd_info *cfi_cmdset_0002(struct map_info *map, int primary)
326326

327327
return cfi_amdstd_setup(mtd);
328328
}
329-
329+
EXPORT_SYMBOL(cfi_cmdset_0002);
330330

331331
static struct mtd_info *cfi_amdstd_setup(struct mtd_info *mtd)
332332
{
@@ -1758,25 +1758,6 @@ static void cfi_amdstd_destroy(struct mtd_info *mtd)
17581758
kfree(mtd->eraseregions);
17591759
}
17601760

1761-
static char im_name[]="cfi_cmdset_0002";
1762-
1763-
1764-
static int __init cfi_amdstd_init(void)
1765-
{
1766-
inter_module_register(im_name, THIS_MODULE, &cfi_cmdset_0002);
1767-
return 0;
1768-
}
1769-
1770-
1771-
static void __exit cfi_amdstd_exit(void)
1772-
{
1773-
inter_module_unregister(im_name);
1774-
}
1775-
1776-
1777-
module_init(cfi_amdstd_init);
1778-
module_exit(cfi_amdstd_exit);
1779-
17801761
MODULE_LICENSE("GPL");
17811762
MODULE_AUTHOR("Crossnet Co. <info@crossnet.co.jp> et al.");
17821763
MODULE_DESCRIPTION("MTD chip driver for AMD/Fujitsu flash chips");

‎drivers/mtd/chips/cfi_cmdset_0020.c‎

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1410,20 +1410,4 @@ static void cfi_staa_destroy(struct mtd_info *mtd)
14101410
kfree(cfi);
14111411
}
14121412

1413-
static char im_name[]="cfi_cmdset_0020";
1414-
1415-
static int __init cfi_staa_init(void)
1416-
{
1417-
inter_module_register(im_name, THIS_MODULE, &cfi_cmdset_0020);
1418-
return 0;
1419-
}
1420-
1421-
static void __exit cfi_staa_exit(void)
1422-
{
1423-
inter_module_unregister(im_name);
1424-
}
1425-
1426-
module_init(cfi_staa_init);
1427-
module_exit(cfi_staa_exit);
1428-
14291413
MODULE_LICENSE("GPL");

‎drivers/mtd/chips/gen_probe.c‎

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -194,25 +194,28 @@ static inline struct mtd_info *cfi_cmdset_unknown(struct map_info *map,
194194
{
195195
struct cfi_private *cfi = map->fldrv_priv;
196196
__u16 type = primary?cfi->cfiq->P_ID:cfi->cfiq->A_ID;
197-
#if defined(CONFIG_MODULES) && defined(HAVE_INTER_MODULE)
197+
#ifdef CONFIG_MODULES
198198
char probename[32];
199199
cfi_cmdset_fn_t *probe_function;
200200

201201
sprintf(probename, "cfi_cmdset_%4.4X", type);
202202

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+
}
204208

205209
if (probe_function) {
206210
struct mtd_info *mtd;
207211

208212
mtd = (*probe_function)(map, primary);
209213
/* If it was happy, it'll have increased its own use count */
210-
inter_module_put(probename);
214+
symbol_put_addr(probe_function);
211215
return mtd;
212216
}
213217
#endif
214-
printk(KERN_NOTICE "Support for command set %04X not present\n",
215-
type);
218+
printk(KERN_NOTICE "Support for command set %04X not present\n", type);
216219

217220
return NULL;
218221
}
@@ -226,12 +229,8 @@ static struct mtd_info *check_cmd_set(struct map_info *map, int primary)
226229
return NULL;
227230

228231
switch(type){
229-
/* Urgh. Ifdefs. The version with weak symbols was
230-
* _much_ nicer. Shame it didn't seem to work on
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-
*/
232+
/* We need these for the !CONFIG_MODULES case,
233+
because symbol_get() doesn't work there */
235234
#ifdef CONFIG_MTD_CFI_INTELEXT
236235
case 0x0001:
237236
case 0x0003:
@@ -246,9 +245,9 @@ static struct mtd_info *check_cmd_set(struct map_info *map, int primary)
246245
case 0x0020:
247246
return cfi_cmdset_0020(map, primary);
248247
#endif
248+
default:
249+
return cfi_cmdset_unknown(map, primary);
249250
}
250-
251-
return cfi_cmdset_unknown(map, primary);
252251
}
253252

254253
MODULE_LICENSE("GPL");

0 commit comments

Comments
 (0)