Add module autoloading support to input layer
Subsystems (2)
PATCH 1/1 Add module autoloading support to input layer
Hi Vojtech,
Currently, the input device layer relies on the input event handler modules being loaded manually, and doesn't define any module aliases to support autloading of these from userspace or in-kernel.
The attached patch defines MODULE_ALIAS_INPUT which creates modules aliases of the form input-handler-xxx, where xxx is minor >> 5 (to account for the event handlers working with a range of minor numbers). It also modifies input.c to load missing event handler modules.
Does this look good to you? If so, will the powers that be on KJ please consider applying?
Cheers,
Dunk
__________________________________
Do you Yahoo!?
Yahoo! Mail - 250MB free storage. Do more. Manage less.
http://info.mail.yahoo.com/mail_250
include/linux/input.h +3 -0
@@ -1012,5 +1012,8 @@extern struct class_simple *input_class; +#define MODULE_ALIAS_INPUT (x) \ + MODULE_ALIAS("input-handler-" __stringify(x)) +#endif #endif
drivers/input/evdev.c +2 -0
@@ -11,6 +11,7 @@#define EVDEV_MINOR_BASE 64#define EVDEV_MINORS 32#define EVDEV_BUFFER_SIZE 64 +#define EVDEV_HANDLER_ID 2/* EVDEV_MINOR_BASE >> 5 */ #include <linux/poll.h> #include <linux/slab.h>
@@ -487,3 +488,4 @@MODULE_AUTHOR ("Vojtech Pavlik <[email protected]>" );MODULE_DESCRIPTION ("Input driver event char devices" );MODULE_LICENSE ("GPL" ); +MODULE_ALIAS_INPUT (EVDEV_HANDLER_ID );
drivers/input/input.c +6 -1
@@ -536,7 +536,12 @@struct file_operations *old_fops, *new_fops =NULL ;int err; -/* No load-on-demand here? */ +if (!handler) + { +request_module ("input-handler-%d" , (int )(iminor (inode) >>5 )); +/* The module will register itself upon loading */ + handler = input_table[iminor (inode) >>5 ]; + }if (!handler || !(new_fops =fops_get (handler->fops)))return -ENODEV ;
drivers/input/joydev.c +6 -4
@@ -28,14 +28,16 @@#include <linux/device.h> #include <linux/devfs_fs_kernel.h> +#define JOYDEV_MINOR_BASE 0 +#define JOYDEV_MINORS 16 +#define JOYDEV_BUFFER_SIZE 64 +#define JOYDEV_HANDLER_ID 0/* JOYDEV_MINOR_BASE >> 5 */ +MODULE_AUTHOR ("Vojtech Pavlik <[email protected]>" );MODULE_DESCRIPTION ("Joystick device interfaces" );MODULE_SUPPORTED_DEVICE ("input/js" );MODULE_LICENSE ("GPL" ); - -#define JOYDEV_MINOR_BASE 0 -#define JOYDEV_MINORS 16 -#define JOYDEV_BUFFER_SIZE 64 +MODULE_ALIAS_INPUT (JOYDEV_HANDLER_ID );#define MSECS (t) (1000 * ((t) / HZ) + 1000 * ((t) % HZ) / HZ)
drivers/input/mousedev.c +2 -0
@@ -12,6 +12,7 @@#define MOUSEDEV_MINOR_BASE 32#define MOUSEDEV_MINORS 32#define MOUSEDEV_MIX 31 +#define MOUSEDEV_HANDLER_ID 1/* MOUSEDEV_MINOR_BASE >> 5 */ #include <linux/slab.h> #include <linux/poll.h>
@@ -32,6 +33,7 @@MODULE_AUTHOR ("Vojtech Pavlik <[email protected]>" );MODULE_DESCRIPTION ("Mouse (ExplorerPS/2) device interfaces" );MODULE_LICENSE ("GPL" ); +MODULE_ALIAS_INPUT (MOUSEDEV_HANDLER_ID );#ifndef CONFIG_INPUT_MOUSEDEV_SCREEN_X #define CONFIG_INPUT_MOUSEDEV_SCREEN_X 1024
drivers/input/tsdev.c +2 -0
@@ -40,6 +40,7 @@/* First 16 devices are h3600_ts compatible; second 16 are h3600_tsraw */ #define TSDEV_MINOR_MASK 15#define TSDEV_BUFFER_SIZE 64 +#define TSDEV_HANDLER_ID 4/* TSDEV_MINOR_BASE >> 5 */ #include <linux/slab.h> #include <linux/poll.h>
@@ -82,6 +83,7 @@MODULE_AUTHOR ("James Simmons <[email protected]>" );MODULE_DESCRIPTION ("Input driver to touchscreen converter" );MODULE_LICENSE ("GPL" ); +MODULE_ALIAS_INPUT (TSDEV_HANDLER_ID );static int xres =CONFIG_INPUT_TSDEV_SCREEN_X ;module_param (xres, uint,0 );
_______________________________________________
Kernel-janitors mailing list
[email protected]
http://lists.osdl.org/mailman/listinfo/kernel-janitors