diff options
author | David Woodhouse <dwmw2@infradead.org> | 2006-05-21 13:38:51 -0400 |
---|---|---|
committer | David Woodhouse <dwmw2@infradead.org> | 2006-05-21 13:38:51 -0400 |
commit | ecde26313076e5055dcd54d6537632275346203f (patch) | |
tree | c6b0f54717bd50efaf984ec88156b94af859a366 | |
parent | 3d12c0c75db0cd85beb11c4e2d86a49cabe3cfff (diff) |
[MTD] Use symbol_request() in old DiskOnChip probe code to find actual driver
The previous code wouldn't work correctly on architectures which have a
non-empty MODULE_SYMBOL_PREFIX, and this version is neater if slightly
less optimal in the built-in case.
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
-rw-r--r-- | drivers/mtd/devices/docprobe.c | 47 |
1 files changed, 5 insertions, 42 deletions
diff --git a/drivers/mtd/devices/docprobe.c b/drivers/mtd/devices/docprobe.c index dce4c904b636..593bb033a3fa 100644 --- a/drivers/mtd/devices/docprobe.c +++ b/drivers/mtd/devices/docprobe.c | |||
@@ -231,26 +231,9 @@ static inline int __init doccheck(void __iomem *potential, unsigned long physadr | |||
231 | 231 | ||
232 | static int docfound; | 232 | static int docfound; |
233 | 233 | ||
234 | #ifdef CONFIG_MTD_DOC2000 | ||
235 | extern void DoC2k_init(struct mtd_info *); | 234 | extern void DoC2k_init(struct mtd_info *); |
236 | #define doc2k_initfunc (&DoC2k_init) | ||
237 | #else | ||
238 | #define doc2k_initfunc NULL | ||
239 | #endif | ||
240 | |||
241 | #ifdef CONFIG_MTD_DOC2001 | ||
242 | extern void DoCMil_init(struct mtd_info *); | 235 | extern void DoCMil_init(struct mtd_info *); |
243 | #define docmil_initfunc (&DoCMil_init) | ||
244 | #else | ||
245 | #define docmil_initfunc NULL | ||
246 | #endif | ||
247 | |||
248 | #ifdef CONFIG_MTD_DOC2001PLUS | ||
249 | extern void DoCMilPlus_init(struct mtd_info *); | 236 | extern void DoCMilPlus_init(struct mtd_info *); |
250 | #define docmplus_initfunc (&DoCMilPlus_init) | ||
251 | #else | ||
252 | #define docmplus_initfunc NULL | ||
253 | #endif | ||
254 | 237 | ||
255 | static void __init DoC_Probe(unsigned long physadr) | 238 | static void __init DoC_Probe(unsigned long physadr) |
256 | { | 239 | { |
@@ -260,8 +243,6 @@ static void __init DoC_Probe(unsigned long physadr) | |||
260 | int ChipID; | 243 | int ChipID; |
261 | char namebuf[15]; | 244 | char namebuf[15]; |
262 | char *name = namebuf; | 245 | char *name = namebuf; |
263 | char *im_funcname = NULL; | ||
264 | char *im_modname = NULL; | ||
265 | void (*initroutine)(struct mtd_info *) = NULL; | 246 | void (*initroutine)(struct mtd_info *) = NULL; |
266 | 247 | ||
267 | docptr = ioremap(physadr, DOC_IOREMAP_LEN); | 248 | docptr = ioremap(physadr, DOC_IOREMAP_LEN); |
@@ -299,48 +280,30 @@ static void __init DoC_Probe(unsigned long physadr) | |||
299 | switch(ChipID) { | 280 | switch(ChipID) { |
300 | case DOC_ChipID_Doc2kTSOP: | 281 | case DOC_ChipID_Doc2kTSOP: |
301 | name="2000 TSOP"; | 282 | name="2000 TSOP"; |
302 | im_funcname = "DoC2k_init"; | 283 | initroutine = symbol_request(DoC2k_init); |
303 | im_modname = "doc2000"; | ||
304 | initroutine = doc2k_initfunc; | ||
305 | break; | 284 | break; |
306 | 285 | ||
307 | case DOC_ChipID_Doc2k: | 286 | case DOC_ChipID_Doc2k: |
308 | name="2000"; | 287 | name="2000"; |
309 | im_funcname = "DoC2k_init"; | 288 | initroutine = symbol_request(DoC2k_init); |
310 | im_modname = "doc2000"; | ||
311 | initroutine = doc2k_initfunc; | ||
312 | break; | 289 | break; |
313 | 290 | ||
314 | case DOC_ChipID_DocMil: | 291 | case DOC_ChipID_DocMil: |
315 | name="Millennium"; | 292 | name="Millennium"; |
316 | #ifdef DOC_SINGLE_DRIVER | 293 | #ifdef DOC_SINGLE_DRIVER |
317 | im_funcname = "DoC2k_init"; | 294 | initroutine = symbol_request(DoC2k_init); |
318 | im_modname = "doc2000"; | ||
319 | initroutine = doc2k_initfunc; | ||
320 | #else | 295 | #else |
321 | im_funcname = "DoCMil_init"; | 296 | initroutine = symbol_request(DoCMil_init); |
322 | im_modname = "doc2001"; | ||
323 | initroutine = docmil_initfunc; | ||
324 | #endif /* DOC_SINGLE_DRIVER */ | 297 | #endif /* DOC_SINGLE_DRIVER */ |
325 | break; | 298 | break; |
326 | 299 | ||
327 | case DOC_ChipID_DocMilPlus16: | 300 | case DOC_ChipID_DocMilPlus16: |
328 | case DOC_ChipID_DocMilPlus32: | 301 | case DOC_ChipID_DocMilPlus32: |
329 | name="MillenniumPlus"; | 302 | name="MillenniumPlus"; |
330 | im_funcname = "DoCMilPlus_init"; | 303 | initroutine = symbol_request(DoCMilPlus_init); |
331 | im_modname = "doc2001plus"; | ||
332 | initroutine = docmplus_initfunc; | ||
333 | break; | 304 | break; |
334 | } | 305 | } |
335 | 306 | ||
336 | #ifdef CONFIG_MODULES | ||
337 | if (im_funcname && !initroutine) | ||
338 | initroutine = __symbol_get(im_funcname); | ||
339 | if (im_funcname && !initroutine) { | ||
340 | request_module(im_modname); | ||
341 | initroutine = __symbol_get(im_funcname); | ||
342 | } | ||
343 | #endif | ||
344 | if (initroutine) { | 307 | if (initroutine) { |
345 | (*initroutine)(mtd); | 308 | (*initroutine)(mtd); |
346 | symbol_put_addr(initroutine); | 309 | symbol_put_addr(initroutine); |