Input: iforce - split into core and transport modules
authorDmitry Torokhov <dmitry.torokhov@gmail.com>
Wed, 25 Jul 2018 00:32:24 +0000 (17:32 -0700)
committerDmitry Torokhov <dmitry.torokhov@gmail.com>
Sun, 23 Jun 2019 06:55:20 +0000 (23:55 -0700)
Now that we have moved enough transport details into separate source files
we can change them into transport modules so that they are only loaded when
needed.

Tested-by: Tim Schumacher <timschumi@gmx.de>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
drivers/input/joystick/iforce/Kconfig
drivers/input/joystick/iforce/Makefile
drivers/input/joystick/iforce/iforce-main.c
drivers/input/joystick/iforce/iforce-packets.c
drivers/input/joystick/iforce/iforce-serio.c
drivers/input/joystick/iforce/iforce-usb.c
drivers/input/joystick/iforce/iforce.h

index ab4dbcbcbf50b4ef42450df75446f6d2e35e512d..55f6ae1da6b02120209dc72da3aa3f3d10f41c31 100644 (file)
@@ -13,15 +13,15 @@ config JOYSTICK_IFORCE
          module will be called iforce.
 
 config JOYSTICK_IFORCE_USB
-       bool "I-Force USB joysticks and wheels"
-       depends on JOYSTICK_IFORCE && (JOYSTICK_IFORCE=m || USB=y) && USB
+       tristate "I-Force USB joysticks and wheels"
+       depends on JOYSTICK_IFORCE && USB
        help
          Say Y here if you have an I-Force joystick or steering wheel
          connected to your USB port.
 
 config JOYSTICK_IFORCE_232
-       bool "I-Force Serial joysticks and wheels"
-       depends on JOYSTICK_IFORCE && (JOYSTICK_IFORCE=m || SERIO=y) && SERIO
+       tristate "I-Force Serial joysticks and wheels"
+       depends on JOYSTICK_IFORCE && SERIO
        help
          Say Y here if you have an I-Force joystick or steering wheel
          connected to your serial (COM) port.
index bc5bda22f15ee8bdc1240421437ac05159761ef2..414075019a4f778f4452c93f9acfd9795d67c7b2 100644 (file)
@@ -4,8 +4,7 @@
 # By Johann Deneux <johann.deneux@gmail.com>
 #
 
-obj-$(CONFIG_JOYSTICK_IFORCE)  += iforce.o
-
+obj-$(CONFIG_JOYSTICK_IFORCE)          += iforce.o
 iforce-y := iforce-ff.o iforce-main.o iforce-packets.o
-iforce-$(CONFIG_JOYSTICK_IFORCE_232)   += iforce-serio.o
-iforce-$(CONFIG_JOYSTICK_IFORCE_USB)   += iforce-usb.o
+obj-$(CONFIG_JOYSTICK_IFORCE_232)      += iforce-serio.o
+obj-$(CONFIG_JOYSTICK_IFORCE_USB)      += iforce-usb.o
index 894769d03df35a54480e67270aad3851d46d124c..3a0698327c4267af482c643c41f657bbb4fa5ab6 100644 (file)
@@ -24,7 +24,7 @@
 #include "iforce.h"
 
 MODULE_AUTHOR("Vojtech Pavlik <vojtech@ucw.cz>, Johann Deneux <johann.deneux@gmail.com>");
-MODULE_DESCRIPTION("USB/RS232 I-Force joysticks and wheels driver");
+MODULE_DESCRIPTION("Core I-Force joysticks and wheels driver");
 MODULE_LICENSE("GPL");
 
 static signed short btn_joystick[] =
@@ -411,35 +411,4 @@ int iforce_init_device(struct device *parent, u16 bustype,
  fail: input_free_device(input_dev);
        return error;
 }
-
-static int __init iforce_init(void)
-{
-       int err = 0;
-
-#ifdef CONFIG_JOYSTICK_IFORCE_USB
-       err = usb_register(&iforce_usb_driver);
-       if (err)
-               return err;
-#endif
-#ifdef CONFIG_JOYSTICK_IFORCE_232
-       err = serio_register_driver(&iforce_serio_drv);
-#ifdef CONFIG_JOYSTICK_IFORCE_USB
-       if (err)
-               usb_deregister(&iforce_usb_driver);
-#endif
-#endif
-       return err;
-}
-
-static void __exit iforce_exit(void)
-{
-#ifdef CONFIG_JOYSTICK_IFORCE_USB
-       usb_deregister(&iforce_usb_driver);
-#endif
-#ifdef CONFIG_JOYSTICK_IFORCE_232
-       serio_unregister_driver(&iforce_serio_drv);
-#endif
-}
-
-module_init(iforce_init);
-module_exit(iforce_exit);
+EXPORT_SYMBOL(iforce_init_device);
index 8a9a152bb595819b4641c1597ad0735046527740..70db273e50452e0d9dd71bd8f6b054c3c7c0610d 100644 (file)
@@ -96,6 +96,7 @@ int iforce_send_packet(struct iforce *iforce, u16 cmd, unsigned char* data)
 
        return 0;
 }
+EXPORT_SYMBOL(iforce_send_packet);
 
 /* Start or stop an effect */
 int iforce_control_playback(struct iforce* iforce, u16 id, unsigned int value)
@@ -203,3 +204,4 @@ void iforce_process_packet(struct iforce *iforce, u16 cmd, unsigned char *data)
                        break;
        }
 }
+EXPORT_SYMBOL(iforce_process_packet);
index 6ff1bbeeb49443581c1ba36536b058db6a156b4e..6c6411fbdc32cb7fdc0ae8742944618202f729f9 100644 (file)
@@ -21,6 +21,7 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  */
 
+#include <linux/serio.h>
 #include "iforce.h"
 
 struct iforce_serio {
@@ -250,3 +251,9 @@ struct serio_driver iforce_serio_drv = {
        .connect        = iforce_serio_connect,
        .disconnect     = iforce_serio_disconnect,
 };
+
+module_serio_driver(iforce_serio_drv);
+
+MODULE_AUTHOR("Vojtech Pavlik <vojtech@ucw.cz>, Johann Deneux <johann.deneux@gmail.com>");
+MODULE_DESCRIPTION("RS232 I-Force joysticks and wheels driver");
+MODULE_LICENSE("GPL");
index d4e7a24922cd337aafd4201e4d8361da9ee96027..9d635f01cf1962ba180898d1d630ec43fa071da7 100644 (file)
@@ -21,6 +21,7 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  */
 
+#include <linux/usb.h>
 #include "iforce.h"
 
 struct iforce_usb {
@@ -316,3 +317,9 @@ struct usb_driver iforce_usb_driver = {
        .disconnect =   iforce_usb_disconnect,
        .id_table =     iforce_usb_ids,
 };
+
+module_usb_driver(iforce_usb_driver);
+
+MODULE_AUTHOR("Vojtech Pavlik <vojtech@ucw.cz>, Johann Deneux <johann.deneux@gmail.com>");
+MODULE_DESCRIPTION("USB I-Force joysticks and wheels driver");
+MODULE_LICENSE("GPL");
index d9712c48ba74325383560074370ce9315ab7474b..3e3df83b9d774d49c4eae12133aaa8d2f886c3b0 100644 (file)
@@ -26,8 +26,6 @@
 #include <linux/input.h>
 #include <linux/module.h>
 #include <linux/spinlock.h>
-#include <linux/usb.h>
-#include <linux/serio.h>
 #include <linux/circ_buf.h>
 #include <linux/mutex.h>