convert mtd/devices/doc* to symbol_put functions
Subsystems (2)
PATCH 1/1 convert mtd/devices/doc* to symbol_put functions
hi,
this is an attemt at converting the doc mtd drivers from inter_module_* functions to symbol_*
Compile tested with allyes and allmodconfig. Please comment, even if it looks halfways sane, so i know i can start working on mtd/chips/cfi* which is the last module using this stuff in the kernel.
drivers/mtd/devices/doc2000.c +5 -6
@@ -519,11 +519,11 @@static const char im_name[] ="DoC2k_init" ;/* 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 +* EXPORT_SYMBOL. It must only be accessed through +* symbol_get which will bump the use count of this module. The * addresses passed back in mtd 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 <[email protected]> 29 Oct 2000. +* this module is non-zero, i.e. between symbol_get and +* symbol_put. Keith Owens <[email protected]> 29 Oct 2000. */ static void DoC2k_init (struct mtd_info *mtd) {
@@ -622,6 +622,7 @@return ; } } +EXPORT_SYMBOL (DoC2k_init);static int doc_read (struct mtd_info *mtd,loff_t from,size_t len,size_t * retlen,u_char * buf)
@@ -1278,7 +1279,6 @@static int __init init_doc2000 (void ) { -inter_module_register (im_name,THIS_MODULE , &DoC2k_init);return 0 ; }
@@ -1297,7 +1297,6 @@kfree (this->chips);kfree (mtd); } -inter_module_unregister (im_name); }module_exit (cleanup_doc2000);
Files linux-2.6.16-git6/drivers/mtd/devices/.doc2000.c.swp and linux-2.6.16-git6.new/drivers/mtd/devices/.doc2000.c.swp differ
drivers/mtd/devices/doc2001.c +5 -6
@@ -327,11 +327,11 @@static const char im_name[] ="DoCMil_init" ;/* 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 +* EXPORT_SYMBOL. It must only be accessed through +* symbol_get which will bump the use count of this module. The * addresses passed back in mtd 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 <[email protected]> 29 Oct 2000. +* this module is non-zero, i.e. between symbol_get and +* symbol_put. Keith Owens <[email protected]> 29 Oct 2000. */ static void DoCMil_init (struct mtd_info *mtd) {
@@ -401,6 +401,7 @@return ; } } +EXPORT_SYMBOL (DoCMil_init);static int doc_read (struct mtd_info *mtd,loff_t from,size_t len,size_t *retlen,u_char *buf)
@@ -858,7 +859,6 @@static int __init init_doc2001 (void ) { -inter_module_register (im_name,THIS_MODULE , &DoCMil_init);return 0 ; }
@@ -877,7 +877,6 @@kfree (this->chips);kfree (mtd); } -inter_module_unregister (im_name); }module_exit (cleanup_doc2001);
drivers/mtd/devices/doc2001plus.c +5 -6
@@ -450,11 +450,11 @@static const char im_name[] ="DoCMilPlus_init" ;/* 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 +* EXPORT_SYMBOL. It must only be accessed through +* symbol_get which will bump the use count of this module. The * addresses passed back in mtd 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 <[email protected]> 29 Oct 2000. +* this module is non-zero, i.e. between symbol_get and +* symbol_put. Keith Owens <[email protected]> 29 Oct 2000. */ static void DoCMilPlus_init (struct mtd_info *mtd) {
@@ -524,6 +524,7 @@return ; } } +EXPORT_SYMBOL (DoCMilPlus_init);#if 0 static int doc_dumpblk (struct mtd_info *mtd,loff_t from)
@@ -1124,7 +1125,6 @@static int __init init_doc2001plus (void ) { -inter_module_register (im_name,THIS_MODULE , &DoCMilPlus_init);return 0 ; }
@@ -1143,7 +1143,6 @@kfree (this->chips);kfree (mtd); } -inter_module_unregister (im_name); }module_exit (cleanup_doc2001plus);
drivers/mtd/devices/docprobe.c +9 -4
@@ -307,14 +307,19 @@break ; } -if (im_funcname) - initroutine =inter_module_get_request (im_funcname, im_modname); - +if (im_funcname) { +if (!request_module ("%s" , im_modname)) + goto fail; + + initroutine =symbol_get (im_funcname); + } +if (initroutine) { (*initroutine)(mtd); -inter_module_put (im_funcname); +symbol_put (im_funcname);return ; } +fail:printk (KERN_NOTICE "Cannot find driver for DiskOnChip %s at 0x%lX\n" , name, physadr);kfree (mtd); }
_______________________________________________
Kernel-janitors mailing list
[email protected]
https://lists.osdl.org/mailman/listinfo/kernel-janitors
Quoted 4 lines · Eric Sesterhenn
this is an attemt at converting the doc mtd drivers from inter_module_* functions to symbol_*
Compile tested with allyes and allmodconfig. Please comment, even if it looks halfways sane,
Exporting static functions is something interesting.
Quoted 10 lines
so i know
i can start working on mtd/chips/cfi* which is the last module using this stuff in the kernel.drivers/mtd/devices/doc2000.c +0
-0static void DoC2k_init (struct mtd_info *mtd) {
drivers/mtd/devices/doc2000.c line 625
Quoted 4 lines
drivers/mtd/devices/doc2000.c +1
-0@@ -622,6 +622,7 @@return ; } } +EXPORT_SYMBOL (DoC2k_init);
_______________________________________________
Kernel-janitors mailing list
[email protected]
https://lists.osdl.org/mailman/listinfo/kernel-janitors
Quoted 7 lines · Alexey Dobriyan
Quoted 4 lines · Eric Sesterhenn
this is an attemt at converting the doc mtd drivers from inter_module_* functions to symbol_*
Compile tested with allyes and allmodconfig. Please comment, even if it looks halfways sane,Exporting static functions is something interesting.
Second attempt to convert doc* mtd drivers to the symbol_* api. compile tested with allyes and allmod config on i386
drivers/mtd/devices/doc2000.c +6 -7
@@ -520,13 +520,13 @@ static int DoC2k_is_alias(struct DiskOnCstatic const char im_name[] ="DoC2k_init" ;/* 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 +* EXPORT_SYMBOL. It must only be accessed through +* symbol_get which will bump the use count of this module. The * addresses passed back in mtd 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 <[email protected]> 29 Oct 2000. +* this module is non-zero, i.e. between symbol_get and +* symbol_put. Keith Owens <[email protected]> 29 Oct 2000. */ -static void DoC2k_init (struct mtd_info *mtd) +void DoC2k_init (struct mtd_info *mtd) {struct DiskOnChip *this = mtd->priv;struct DiskOnChip *old =NULL ;
@@ -623,6 +623,7 @@ static void DoC2k_init(struct mtd_info *return ; } } +EXPORT_SYMBOL (DoC2k_init);static int doc_read (struct mtd_info *mtd,loff_t from,size_t len,size_t * retlen,u_char * buf)
@@ -1279,7 +1280,6 @@ static int doc_erase(struct mtd_info *mtstatic int __init init_doc2000 (void ) { -inter_module_register (im_name,THIS_MODULE , &DoC2k_init);return 0 ; }
@@ -1298,7 +1298,6 @@ static void __exit cleanup_doc2000(void)kfree (this->chips);kfree (mtd); } -inter_module_unregister (im_name); }module_exit (cleanup_doc2000);
Only in linux-2.6.17-rc1/drivers/mtd/devices/: doc2000.c.orig
drivers/mtd/devices/doc2001.c +6 -7
@@ -327,13 +327,13 @@ static int DoCMil_is_alias(struct DiskOnstatic const char im_name[] ="DoCMil_init" ;/* 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 +* EXPORT_SYMBOL. It must only be accessed through +* symbol_get which will bump the use count of this module. The * addresses passed back in mtd 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 <[email protected]> 29 Oct 2000. +* this module is non-zero, i.e. between symbol_get and +* symbol_put. Keith Owens <[email protected]> 29 Oct 2000. */ -static void DoCMil_init (struct mtd_info *mtd) +void DoCMil_init (struct mtd_info *mtd) {struct DiskOnChip *this = mtd->priv;struct DiskOnChip *old =NULL ;
@@ -401,6 +401,7 @@ static void DoCMil_init(struct mtd_inforeturn ; } } +EXPORT_SYMBOL (DoCMil_init);static int doc_read (struct mtd_info *mtd,loff_t from,size_t len,size_t *retlen,u_char *buf)
@@ -858,7 +859,6 @@ int doc_erase (struct mtd_info *mtd, strstatic int __init init_doc2001 (void ) { -inter_module_register (im_name,THIS_MODULE , &DoCMil_init);return 0 ; }
@@ -877,7 +877,6 @@ static void __exit cleanup_doc2001(void)kfree (this->chips);kfree (mtd); } -inter_module_unregister (im_name); }module_exit (cleanup_doc2001);
drivers/mtd/devices/doc2001plus.c +6 -7
@@ -450,13 +450,13 @@ static int DoCMilPlus_is_alias(struct Distatic const char im_name[] ="DoCMilPlus_init" ;/* 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 +* EXPORT_SYMBOL. It must only be accessed through +* symbol_get which will bump the use count of this module. The * addresses passed back in mtd 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 <[email protected]> 29 Oct 2000. +* this module is non-zero, i.e. between symbol_get and +* symbol_put. Keith Owens <[email protected]> 29 Oct 2000. */ -static void DoCMilPlus_init (struct mtd_info *mtd) +void DoCMilPlus_init (struct mtd_info *mtd) {struct DiskOnChip *this = mtd->priv;struct DiskOnChip *old =NULL ;
@@ -524,6 +524,7 @@ static void DoCMilPlus_init(struct mtd_ireturn ; } } +EXPORT_SYMBOL (DoCMilPlus_init);#if 0 static int doc_dumpblk (struct mtd_info *mtd,loff_t from)
@@ -1124,7 +1125,6 @@ int doc_erase(struct mtd_info *mtd, strustatic int __init init_doc2001plus (void ) { -inter_module_register (im_name,THIS_MODULE , &DoCMilPlus_init);return 0 ; }
@@ -1143,7 +1143,6 @@ static void __exit cleanup_doc2001plus(vkfree (this->chips);kfree (mtd); } -inter_module_unregister (im_name); }module_exit (cleanup_doc2001plus);
drivers/mtd/devices/docprobe.c +9 -4
@@ -307,14 +307,19 @@ static void __init DoC_Probe(unsigned lobreak ; } -if (im_funcname) - initroutine =inter_module_get_request (im_funcname, im_modname); - +if (im_funcname) { +if (!request_module ("%s" , im_modname)) + goto fail; + + initroutine =symbol_get (im_funcname); + } +if (initroutine) { (*initroutine)(mtd); -inter_module_put (im_funcname); +symbol_put (im_funcname);return ; } +fail:printk (KERN_NOTICE "Cannot find driver for DiskOnChip %s at 0x%lX\n" , name, physadr);kfree (mtd); }
_______________________________________________
Kernel-janitors mailing list
[email protected]
https://lists.osdl.org/mailman/listinfo/kernel-janitors