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.

ACPI: TAD: Rearrange runtime PM operations in acpi_tad_remove()

It is not necessary to resume the device upfront in acpi_tad_remove()
because both acpi_tad_disable_timer() and acpi_tad_clear_status()
attempt to resume it, but it is better to prevent it from suspending
between these calls by incrementing its runtime PM usage counter.

Accordingly, replace the pm_runtime_get_sync() call in acpi_tad_remove()
with a pm_runtime_get_noresume() one and put the latter right before the
first invocation of acpi_tad_disable_timer().

In addition, use pm_runtime_put_noidle() to drop the device's runtime
PM usage counter after using pm_runtime_get_noresume() to bump it up
to follow a common pattern and use pm_runtime_suspend() for suspending
the device afterward.

No intentional functional impact.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Link: https://patch.msgid.link/5031965.GXAFRqVoOG@rafael.j.wysocki

+4 -3
+4 -3
drivers/acpi/acpi_tad.c
··· 563 563 564 564 device_init_wakeup(dev, false); 565 565 566 - pm_runtime_get_sync(dev); 567 - 568 566 if (dd->capabilities & ACPI_TAD_RT) 569 567 sysfs_remove_group(&dev->kobj, &acpi_tad_time_attr_group); 570 568 ··· 571 573 572 574 sysfs_remove_group(&dev->kobj, &acpi_tad_attr_group); 573 575 576 + pm_runtime_get_noresume(dev); 577 + 574 578 acpi_tad_disable_timer(dev, ACPI_TAD_AC_TIMER); 575 579 acpi_tad_clear_status(dev, ACPI_TAD_AC_TIMER); 576 580 if (dd->capabilities & ACPI_TAD_DC_WAKE) { ··· 580 580 acpi_tad_clear_status(dev, ACPI_TAD_DC_TIMER); 581 581 } 582 582 583 - pm_runtime_put_sync(dev); 583 + pm_runtime_put_noidle(dev); 584 + pm_runtime_suspend(dev); 584 585 pm_runtime_disable(dev); 585 586 acpi_remove_cmos_rtc_space_handler(handle); 586 587 }