Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

platform/x86: dell/dell-rbtn: Register ACPI notify handler directly

To facilitate subsequent conversion of the driver to a platform one,
make it install an ACPI notify handler directly instead of using
a .notify() callback in struct acpi_driver.

No intentional functional impact.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Link: https://patch.msgid.link/9591832.CDJkKcVGEf@rafael.j.wysocki
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>

authored by

Rafael J. Wysocki and committed by
Ilpo Järvinen
da71de1b 80b8f68b

+33 -17
+33 -17
drivers/platform/x86/dell/dell-rbtn.c
··· 207 207 208 208 static int rbtn_add(struct acpi_device *device); 209 209 static void rbtn_remove(struct acpi_device *device); 210 - static void rbtn_notify(struct acpi_device *device, u32 event); 210 + static void rbtn_notify(acpi_handle handle, u32 event, void *data); 211 211 212 212 static const struct acpi_device_id rbtn_ids[] = { 213 213 { "DELRBTN", 0 }, ··· 293 293 .ops = { 294 294 .add = rbtn_add, 295 295 .remove = rbtn_remove, 296 - .notify = rbtn_notify, 297 296 }, 298 297 }; 299 298 ··· 381 382 * acpi driver functions 382 383 */ 383 384 385 + static void rbtn_cleanup(struct acpi_device *device) 386 + { 387 + struct rbtn_data *rbtn_data = device->driver_data; 388 + 389 + switch (rbtn_data->type) { 390 + case RBTN_TOGGLE: 391 + rbtn_input_exit(rbtn_data); 392 + break; 393 + case RBTN_SLIDER: 394 + rbtn_rfkill_exit(device); 395 + break; 396 + default: 397 + break; 398 + } 399 + } 400 + 384 401 static int rbtn_add(struct acpi_device *device) 385 402 { 386 403 struct rbtn_data *rbtn_data; ··· 437 422 break; 438 423 } 439 424 if (ret) 440 - rbtn_acquire(device, false); 425 + goto err; 441 426 427 + ret = acpi_dev_install_notify_handler(device, ACPI_DEVICE_NOTIFY, 428 + rbtn_notify, device); 429 + if (ret) 430 + goto err_cleanup; 431 + 432 + return 0; 433 + 434 + err_cleanup: 435 + rbtn_cleanup(device); 436 + err: 437 + rbtn_acquire(device, false); 442 438 return ret; 443 439 } 444 440 445 441 static void rbtn_remove(struct acpi_device *device) 446 442 { 447 - struct rbtn_data *rbtn_data = device->driver_data; 448 - 449 - switch (rbtn_data->type) { 450 - case RBTN_TOGGLE: 451 - rbtn_input_exit(rbtn_data); 452 - break; 453 - case RBTN_SLIDER: 454 - rbtn_rfkill_exit(device); 455 - break; 456 - default: 457 - break; 458 - } 459 - 443 + acpi_dev_remove_notify_handler(device, ACPI_DEVICE_NOTIFY, rbtn_notify); 444 + rbtn_cleanup(device); 460 445 rbtn_acquire(device, false); 461 446 } 462 447 463 - static void rbtn_notify(struct acpi_device *device, u32 event) 448 + static void rbtn_notify(acpi_handle handle, u32 event, void *data) 464 449 { 450 + struct acpi_device *device = data; 465 451 struct rbtn_data *rbtn_data = device->driver_data; 466 452 467 453 /*