diff options
-rw-r--r-- | drivers/acpi/button.c | 48 |
1 files changed, 24 insertions, 24 deletions
diff --git a/drivers/acpi/button.c b/drivers/acpi/button.c index 8ef8f443f539..9f6d2e6844a7 100644 --- a/drivers/acpi/button.c +++ b/drivers/acpi/button.c | |||
@@ -300,6 +300,7 @@ static int acpi_button_add(struct acpi_device *device) | |||
300 | { | 300 | { |
301 | struct acpi_button *button; | 301 | struct acpi_button *button; |
302 | struct input_dev *input; | 302 | struct input_dev *input; |
303 | char *hid, *name, *class; | ||
303 | int error; | 304 | int error; |
304 | 305 | ||
305 | button = kzalloc(sizeof(struct acpi_button), GFP_KERNEL); | 306 | button = kzalloc(sizeof(struct acpi_button), GFP_KERNEL); |
@@ -315,40 +316,41 @@ static int acpi_button_add(struct acpi_device *device) | |||
315 | goto err_free_button; | 316 | goto err_free_button; |
316 | } | 317 | } |
317 | 318 | ||
319 | hid = acpi_device_hid(device); | ||
320 | name = acpi_device_name(device); | ||
321 | class = acpi_device_class(device); | ||
322 | |||
318 | /* | 323 | /* |
319 | * Determine the button type (via hid), as fixed-feature buttons | 324 | * Determine the button type (via hid), as fixed-feature buttons |
320 | * need to be handled a bit differently than generic-space. | 325 | * need to be handled a bit differently than generic-space. |
321 | */ | 326 | */ |
322 | if (!strcmp(acpi_device_hid(device), ACPI_BUTTON_HID_POWER)) { | 327 | if (!strcmp(hid, ACPI_BUTTON_HID_POWER)) { |
323 | button->type = ACPI_BUTTON_TYPE_POWER; | 328 | button->type = ACPI_BUTTON_TYPE_POWER; |
324 | strcpy(acpi_device_name(device), ACPI_BUTTON_DEVICE_NAME_POWER); | 329 | strcpy(name, ACPI_BUTTON_DEVICE_NAME_POWER); |
325 | sprintf(acpi_device_class(device), "%s/%s", | 330 | sprintf(class, "%s/%s", |
326 | ACPI_BUTTON_CLASS, ACPI_BUTTON_SUBCLASS_POWER); | 331 | ACPI_BUTTON_CLASS, ACPI_BUTTON_SUBCLASS_POWER); |
327 | } else if (!strcmp(acpi_device_hid(device), ACPI_BUTTON_HID_POWERF)) { | 332 | } else if (!strcmp(hid, ACPI_BUTTON_HID_POWERF)) { |
328 | button->type = ACPI_BUTTON_TYPE_POWERF; | 333 | button->type = ACPI_BUTTON_TYPE_POWERF; |
329 | strcpy(acpi_device_name(device), | 334 | strcpy(name, ACPI_BUTTON_DEVICE_NAME_POWERF); |
330 | ACPI_BUTTON_DEVICE_NAME_POWERF); | 335 | sprintf(class, "%s/%s", |
331 | sprintf(acpi_device_class(device), "%s/%s", | ||
332 | ACPI_BUTTON_CLASS, ACPI_BUTTON_SUBCLASS_POWER); | 336 | ACPI_BUTTON_CLASS, ACPI_BUTTON_SUBCLASS_POWER); |
333 | } else if (!strcmp(acpi_device_hid(device), ACPI_BUTTON_HID_SLEEP)) { | 337 | } else if (!strcmp(hid, ACPI_BUTTON_HID_SLEEP)) { |
334 | button->type = ACPI_BUTTON_TYPE_SLEEP; | 338 | button->type = ACPI_BUTTON_TYPE_SLEEP; |
335 | strcpy(acpi_device_name(device), ACPI_BUTTON_DEVICE_NAME_SLEEP); | 339 | strcpy(name, ACPI_BUTTON_DEVICE_NAME_SLEEP); |
336 | sprintf(acpi_device_class(device), "%s/%s", | 340 | sprintf(class, "%s/%s", |
337 | ACPI_BUTTON_CLASS, ACPI_BUTTON_SUBCLASS_SLEEP); | 341 | ACPI_BUTTON_CLASS, ACPI_BUTTON_SUBCLASS_SLEEP); |
338 | } else if (!strcmp(acpi_device_hid(device), ACPI_BUTTON_HID_SLEEPF)) { | 342 | } else if (!strcmp(hid, ACPI_BUTTON_HID_SLEEPF)) { |
339 | button->type = ACPI_BUTTON_TYPE_SLEEPF; | 343 | button->type = ACPI_BUTTON_TYPE_SLEEPF; |
340 | strcpy(acpi_device_name(device), | 344 | strcpy(name, ACPI_BUTTON_DEVICE_NAME_SLEEPF); |
341 | ACPI_BUTTON_DEVICE_NAME_SLEEPF); | 345 | sprintf(class, "%s/%s", |
342 | sprintf(acpi_device_class(device), "%s/%s", | ||
343 | ACPI_BUTTON_CLASS, ACPI_BUTTON_SUBCLASS_SLEEP); | 346 | ACPI_BUTTON_CLASS, ACPI_BUTTON_SUBCLASS_SLEEP); |
344 | } else if (!strcmp(acpi_device_hid(device), ACPI_BUTTON_HID_LID)) { | 347 | } else if (!strcmp(hid, ACPI_BUTTON_HID_LID)) { |
345 | button->type = ACPI_BUTTON_TYPE_LID; | 348 | button->type = ACPI_BUTTON_TYPE_LID; |
346 | strcpy(acpi_device_name(device), ACPI_BUTTON_DEVICE_NAME_LID); | 349 | strcpy(name, ACPI_BUTTON_DEVICE_NAME_LID); |
347 | sprintf(acpi_device_class(device), "%s/%s", | 350 | sprintf(class, "%s/%s", |
348 | ACPI_BUTTON_CLASS, ACPI_BUTTON_SUBCLASS_LID); | 351 | ACPI_BUTTON_CLASS, ACPI_BUTTON_SUBCLASS_LID); |
349 | } else { | 352 | } else { |
350 | printk(KERN_ERR PREFIX "Unsupported hid [%s]\n", | 353 | printk(KERN_ERR PREFIX "Unsupported hid [%s]\n", hid); |
351 | acpi_device_hid(device)); | ||
352 | error = -ENODEV; | 354 | error = -ENODEV; |
353 | goto err_free_input; | 355 | goto err_free_input; |
354 | } | 356 | } |
@@ -357,10 +359,9 @@ static int acpi_button_add(struct acpi_device *device) | |||
357 | if (error) | 359 | if (error) |
358 | goto err_free_input; | 360 | goto err_free_input; |
359 | 361 | ||
360 | snprintf(button->phys, sizeof(button->phys), | 362 | snprintf(button->phys, sizeof(button->phys), "%s/button/input0", hid); |
361 | "%s/button/input0", acpi_device_hid(device)); | ||
362 | 363 | ||
363 | input->name = acpi_device_name(device); | 364 | input->name = name; |
364 | input->phys = button->phys; | 365 | input->phys = button->phys; |
365 | input->id.bustype = BUS_HOST; | 366 | input->id.bustype = BUS_HOST; |
366 | input->id.product = button->type; | 367 | input->id.product = button->type; |
@@ -401,8 +402,7 @@ static int acpi_button_add(struct acpi_device *device) | |||
401 | device->wakeup.state.enabled = 1; | 402 | device->wakeup.state.enabled = 1; |
402 | } | 403 | } |
403 | 404 | ||
404 | printk(KERN_INFO PREFIX "%s [%s]\n", | 405 | printk(KERN_INFO PREFIX "%s [%s]\n", name, acpi_device_bid(device)); |
405 | acpi_device_name(device), acpi_device_bid(device)); | ||
406 | return 0; | 406 | return 0; |
407 | 407 | ||
408 | err_remove_fs: | 408 | err_remove_fs: |