From 4e73e8ed5e43a405ff62173b8fc0903d383dc82a Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Wed, 1 Dec 2004 01:10:06 -0800 Subject: [PATCH] [PATCH] Fix parameter handling in ibm_acpi.c You can't call module_param et al inside a function. It doesn't make sense, and it doesn't work. Signed-off-by: Rusty Russell Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/acpi/ibm_acpi.c | 47 +++++++++++++++++++++++------------------ 1 file changed, 26 insertions(+), 21 deletions(-) diff --git a/drivers/acpi/ibm_acpi.c b/drivers/acpi/ibm_acpi.c index 95f7210c748a..b435b3e3eb02 100644 --- a/drivers/acpi/ibm_acpi.c +++ b/drivers/acpi/ibm_acpi.c @@ -1147,21 +1147,26 @@ static int ibm_handle_init(char *name, object##_paths, sizeof(object##_paths)/sizeof(char*), required) -static void ibm_param(char *feature, char *cmd) +static int set_ibm_param(const char *val, struct kernel_param *kp) { - int i; + unsigned int i; + char arg_with_comma[32]; + + if (strlen(val) > 30) + return -ENOSPC; + + strcpy(arg_with_comma, val); + strcat(arg_with_comma, ","); - strcat(cmd, ","); for (i=0; iname) == 0) + return ibms[i].write(&ibms[i], arg_with_comma); + BUG(); + return -EINVAL; +} -#define IBM_PARAM(feature) do { \ - static char cmd[32]; \ - module_param_string(feature, cmd, sizeof(cmd) - 1, 0); \ - ibm_param(#feature, cmd); \ -} while (0) +#define IBM_PARAM(feature) \ + module_param_call(feature, set_ibm_param, NULL, NULL, 0) static void __exit acpi_ibm_exit(void) { @@ -1216,16 +1221,6 @@ static int __init acpi_ibm_init(void) } } - IBM_PARAM(hotkey); - IBM_PARAM(bluetooth); - IBM_PARAM(video); - IBM_PARAM(light); - IBM_PARAM(dock); - IBM_PARAM(bay); - IBM_PARAM(cmos); - IBM_PARAM(led); - IBM_PARAM(beep); - return 0; } @@ -1235,3 +1230,13 @@ module_exit(acpi_ibm_exit); MODULE_AUTHOR("Borislav Deianov"); MODULE_DESCRIPTION(IBM_DESC); MODULE_LICENSE("GPL"); + +IBM_PARAM(hotkey); +IBM_PARAM(bluetooth); +IBM_PARAM(video); +IBM_PARAM(light); +IBM_PARAM(dock); +IBM_PARAM(bay); +IBM_PARAM(cmos); +IBM_PARAM(led); +IBM_PARAM(beep); -- 2.39.5