mirror of
https://github.com/wessel-novacustom/clevo-keyboard.git
synced 2024-11-15 03:34:01 +01:00
Move module parameter handling from .h to .c file
Other compilation units (CUs) including this header file do not need module parameter handling. It's specific to our CU. Header files are meant to communicate/interface with outside CUs
This commit is contained in:
parent
8f827c8761
commit
4d57e59887
|
@ -36,6 +36,51 @@ MODULE_VERSION("1.0.0");
|
|||
struct platform_device *tuxedo_platform_device;
|
||||
static struct input_dev *tuxedo_input_device;
|
||||
|
||||
// Param Validators
|
||||
static int mode_validator(const char *val, const struct kernel_param *kp);
|
||||
static const struct kernel_param_ops param_ops_mode_ops = {
|
||||
.set = mode_validator,
|
||||
.get = param_get_int,
|
||||
};
|
||||
|
||||
static int brightness_validator(const char *val, const struct kernel_param *kp);
|
||||
static const struct kernel_param_ops param_ops_brightness_ops = {
|
||||
.set = brightness_validator,
|
||||
.get = param_get_int,
|
||||
};
|
||||
|
||||
|
||||
// Params Variables
|
||||
static uint param_color_left = KB_COLOR_DEFAULT;
|
||||
module_param_named(color_left, param_color_left, uint, S_IRUSR);
|
||||
MODULE_PARM_DESC(color_left, "Color for the Left Section");
|
||||
|
||||
static uint param_color_center = KB_COLOR_DEFAULT;
|
||||
module_param_named(color_center, param_color_center, uint, S_IRUSR);
|
||||
MODULE_PARM_DESC(color_center, "Color for the Center Section");
|
||||
|
||||
static uint param_color_right = KB_COLOR_DEFAULT;
|
||||
module_param_named(color_right, param_color_right, uint, S_IRUSR);
|
||||
MODULE_PARM_DESC(color_right, "Color for the Right Right");
|
||||
|
||||
static uint param_color_extra = KB_COLOR_DEFAULT;
|
||||
module_param_named(color_extra, param_color_extra, uint, S_IRUSR);
|
||||
MODULE_PARM_DESC(color_extra, "Color for the Extra Section");
|
||||
|
||||
static ushort param_mode = DEFAULT_MODE;
|
||||
module_param_cb(mode, ¶m_ops_mode_ops, ¶m_mode, S_IRUSR);
|
||||
MODULE_PARM_DESC(mode, "Set the mode");
|
||||
|
||||
static ushort param_brightness = BRIGHTNESS_DEFAULT;
|
||||
module_param_cb(brightness, ¶m_ops_brightness_ops, ¶m_brightness,
|
||||
S_IRUSR);
|
||||
MODULE_PARM_DESC(brightness, "Set the Keyboard Brightness");
|
||||
|
||||
static bool param_state = true;
|
||||
module_param_named(state, param_state, bool, S_IRUSR);
|
||||
MODULE_PARM_DESC(state,
|
||||
"Set the State of the Keyboard TRUE = ON | FALSE = OFF");
|
||||
|
||||
// Init and Exit methods
|
||||
static int __init tuxdeo_keyboard_init(void);
|
||||
static void __exit tuxdeo_keyboard_exit(void);
|
||||
|
|
|
@ -80,50 +80,6 @@
|
|||
|
||||
|
||||
|
||||
// Param Validators
|
||||
static int mode_validator(const char *val, const struct kernel_param *kp);
|
||||
static const struct kernel_param_ops param_ops_mode_ops = {
|
||||
.set = mode_validator,
|
||||
.get = param_get_int,
|
||||
};
|
||||
|
||||
static int brightness_validator(const char *val, const struct kernel_param *kp);
|
||||
static const struct kernel_param_ops param_ops_brightness_ops = {
|
||||
.set = brightness_validator,
|
||||
.get = param_get_int,
|
||||
};
|
||||
|
||||
// Params Variables
|
||||
static uint param_color_left = KB_COLOR_DEFAULT;
|
||||
module_param_named(color_left, param_color_left, uint, S_IRUSR);
|
||||
MODULE_PARM_DESC(color_left, "Color for the Left Section");
|
||||
|
||||
static uint param_color_center = KB_COLOR_DEFAULT;
|
||||
module_param_named(color_center, param_color_center, uint, S_IRUSR);
|
||||
MODULE_PARM_DESC(color_center, "Color for the Center Section");
|
||||
|
||||
static uint param_color_right = KB_COLOR_DEFAULT;
|
||||
module_param_named(color_right, param_color_right, uint, S_IRUSR);
|
||||
MODULE_PARM_DESC(color_right, "Color for the Right Right");
|
||||
|
||||
static uint param_color_extra = KB_COLOR_DEFAULT;
|
||||
module_param_named(color_extra, param_color_extra, uint, S_IRUSR);
|
||||
MODULE_PARM_DESC(color_extra, "Color for the Extra Section");
|
||||
|
||||
static ushort param_mode = DEFAULT_MODE;
|
||||
module_param_cb(mode, ¶m_ops_mode_ops, ¶m_mode, S_IRUSR);
|
||||
MODULE_PARM_DESC(mode, "Set the mode");
|
||||
|
||||
static ushort param_brightness = BRIGHTNESS_DEFAULT;
|
||||
module_param_cb(brightness, ¶m_ops_brightness_ops, ¶m_brightness,
|
||||
S_IRUSR);
|
||||
MODULE_PARM_DESC(brightness, "Set the Keyboard Brightness");
|
||||
|
||||
static bool param_state = true;
|
||||
module_param_named(state, param_state, bool, S_IRUSR);
|
||||
MODULE_PARM_DESC(state,
|
||||
"Set the State of the Keyboard TRUE = ON | FALSE = OFF");
|
||||
|
||||
// Sysfs device Attributes
|
||||
static DEVICE_ATTR(state, 0644, show_state_fs, set_state_fs);
|
||||
static DEVICE_ATTR(color_left, 0644, show_color_left_fs, set_color_left_fs);
|
||||
|
|
Loading…
Reference in a new issue