lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:	Wed, 19 Sep 2012 14:16:42 +0100
From:	"Jan Beulich" <JBeulich@...e.com>
To:	<linus.walleij@...aro.org>, <grant.likely@...retlab.ca>
Cc:	"Ryan Mallon" <rmallon@...il.com>, <linux-kernel@...r.kernel.org>
Subject: [PATCH, v2] allow gpiolib to be a module

Without ARCH_REQUIRE_GPIOLIB there's no reason to force this code, when
enabled, to always be built into the kernel, which requires only minor
Makefile and source code adjustments.

Signed-off-by: Jan Beulich <jbeulich@...e.com>
Cc: Ryan Mallon <rmallon@...il.com>

---
v2: Make gpiolib_init() static. Properly handle !CONFIG_DEBUG_FS case.

---
 drivers/gpio/Kconfig       |    2 +-
 drivers/gpio/Makefile      |    3 ++-
 drivers/gpio/gpiolib.c     |   21 +++++++++++++++++++++
 include/asm-generic/gpio.h |    3 ++-
 4 files changed, 26 insertions(+), 3 deletions(-)

--- 3.6-rc6/drivers/gpio/Kconfig
+++ 3.6-rc6-gpiolib-module/drivers/gpio/Kconfig
@@ -33,7 +33,7 @@ config ARCH_REQUIRE_GPIOLIB
 
 
 menuconfig GPIOLIB
-	bool "GPIO Support"
+	tristate "GPIO Support"
 	depends on ARCH_WANT_OPTIONAL_GPIOLIB || ARCH_REQUIRE_GPIOLIB
 	select GENERIC_GPIO
 	help
--- 3.6-rc6/drivers/gpio/Makefile
+++ 3.6-rc6-gpiolib-module/drivers/gpio/Makefile
@@ -2,7 +2,8 @@
 
 ccflags-$(CONFIG_DEBUG_GPIO)	+= -DDEBUG
 
-obj-$(CONFIG_GPIOLIB)		+= gpiolib.o devres.o
+gpio-lib-y			:= gpiolib.o devres.o
+obj-$(CONFIG_GPIOLIB)		+= gpio-lib.o
 obj-$(CONFIG_OF_GPIO)		+= gpiolib-of.o
 
 # Device drivers. Generally keep list sorted alphabetically
--- 3.6-rc6/drivers/gpio/gpiolib.c
+++ 3.6-rc6-gpiolib-module/drivers/gpio/gpiolib.c
@@ -1003,7 +1003,9 @@ static int __init gpiolib_sysfs_init(voi
 
 	return status;
 }
+#ifndef MODULE
 postcore_initcall(gpiolib_sysfs_init);
+#endif
 
 #else
 static inline int gpiochip_export(struct gpio_chip *chip)
@@ -1832,6 +1834,25 @@ static int __init gpiolib_debugfs_init(v
 				NULL, NULL, &gpiolib_operations);
 	return 0;
 }
+#ifndef MODULE
 subsys_initcall(gpiolib_debugfs_init);
+#endif
 
 #endif	/* DEBUG_FS */
+
+#ifdef MODULE
+static int __init gpiolib_init(void)
+{
+	int err = gpiolib_sysfs_init();
+
+#ifdef CONFIG_DEBUG_FS
+	if (!err)
+		err = gpiolib_debugfs_init();
+#endif
+	return err;
+}
+module_init(gpiolib_init);
+
+MODULE_DESCRIPTION("GPIO library");
+MODULE_LICENSE("GPL");
+#endif
--- 3.6-rc6/include/asm-generic/gpio.h
+++ 3.6-rc6-gpiolib-module/include/asm-generic/gpio.h
@@ -4,9 +4,10 @@
 #include <linux/kernel.h>
 #include <linux/types.h>
 #include <linux/errno.h>
+#include <linux/kconfig.h>
 #include <linux/of.h>
 
-#ifdef CONFIG_GPIOLIB
+#if IS_ENABLED(CONFIG_GPIOLIB)
 
 #include <linux/compiler.h>
 



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ