clevo_interfaces: Export method and ID interface

This commit is contained in:
Christoffer Sandberg 2020-12-07 12:19:36 +01:00
parent 1f8b5a66b3
commit bea8621bdb
No known key found for this signature in database
GPG key ID: BF563F71B6C7A96D
2 changed files with 18 additions and 1 deletions

View file

@ -56,5 +56,7 @@ struct clevo_interface_t {
u32 clevo_keyboard_add_interface(struct clevo_interface_t *new_interface); u32 clevo_keyboard_add_interface(struct clevo_interface_t *new_interface);
u32 clevo_keyboard_remove_interface(struct clevo_interface_t *interface); u32 clevo_keyboard_remove_interface(struct clevo_interface_t *interface);
u32 clevo_evaluate_method(u8 cmd, u32 arg, u32 *result);
u32 clevo_get_active_interface_id(char **id_str);
#endif #endif

View file

@ -287,7 +287,7 @@ static ssize_t show_hasextra_fs(struct device *child,
return sprintf(buffer, "%d\n", kbd_led_state.has_extra); return sprintf(buffer, "%d\n", kbd_led_state.has_extra);
} }
static u32 clevo_evaluate_method(u8 cmd, u32 arg, u32 *result) u32 clevo_evaluate_method(u8 cmd, u32 arg, u32 *result)
{ {
if (IS_ERR_OR_NULL(active_clevo_interface)) { if (IS_ERR_OR_NULL(active_clevo_interface)) {
pr_err("clevo_keyboard: no active interface\n"); pr_err("clevo_keyboard: no active interface\n");
@ -295,6 +295,21 @@ static u32 clevo_evaluate_method(u8 cmd, u32 arg, u32 *result)
} }
return active_clevo_interface->method_call(cmd, arg, result); return active_clevo_interface->method_call(cmd, arg, result);
} }
EXPORT_SYMBOL(clevo_evaluate_method);
u32 clevo_get_active_interface_id(char **id_str)
{
if (IS_ERR_OR_NULL(active_clevo_interface)) {
pr_err("clevo_keyboard: no active interface\n");
return -ENODEV;
}
if (!IS_ERR_OR_NULL(id_str))
*id_str = active_clevo_interface->string_id;
return 0;
}
EXPORT_SYMBOL(clevo_get_active_interface_id);
static void set_brightness(u8 brightness) static void set_brightness(u8 brightness)
{ {