Skip to contentSkip to conversation

mips: add module.h to cobalt/mtd.c to avoid compile fail

PATCH New Paul Gortmaker 1 participant 2 messages Jun 15, 2015 – Jun 16, 2015 MIPS

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mips: add module.h to cobalt/mtd.c to avoid compile fail

This file is built off of a tristate Kconfig option and also contains modular function calls so it should explicitly include module.h to avoid compile breakage during header shuffles done in the future.

---

[
To be appended to the branch with content originally sent here:
"Fix implicit includes of <module.h> that will break."
https://lkml.kernel.org/r/[email protected]
]

 arch/mips/cobalt/mtd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/mips/cobalt/mtd.c +1 -1
index 8db7b5d81560..1c38e757f238 100644
@@ -17,7 +17,7 @@
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  */
-#include <linux/init.h>
+#include <linux/module.h>
 #include <linux/platform_device.h>
 #include <linux/mtd/partitions.h>
 #include <linux/mtd/physmap.h>
Signature · 1 line
2.2.1
#1 lore raw

PATCH v2 1/1 MIPS: don't use module_init in non-modular cobalt/mtd.c file

As of commit 34b1252bd91851f77f89fbb6829a04efad900f41 ("MIPS:
Cobalt: Do not build MTD platform device registration code as module.") this file became built-in instead of modular. So we should also stop using module_init as an alias for __initcall as that can be rather misleading.

Fix this up now, so that we can relocate module_init from init.h into module.h in the future. If we don't do this, we'd have to add module.h to obviously non-modular code, and that would be a worse thing.

Direct use of __initcall is discouraged, vs prioritized ones. Use of device_initcall is consistent with what __initcall maps onto, and hence does not change the init order, making the impact of this change zero.

---

[
v2: rebase from rc6 to rc8 so 34b1252 is present, and that changes the patch from being an implicit module.h user to a misleading module_init() user.

To be appended to the branch content originally sent as:
"Replace module_init with device_initcall in non modules"
https://lkml.kernel.org/r/[email protected]
]

 arch/mips/cobalt/mtd.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
arch/mips/cobalt/mtd.c +1 -2
index 8db7b5d81560..83e1b1093d5f 100644
@@ -57,5 +57,4 @@ static int __init cobalt_mtd_init(void)
 
 	return 0;
 }
-
-module_init(cobalt_mtd_init);
+device_initcall(cobalt_mtd_init);
Signature · 1 line
2.2.1