mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-31 12:10:52 -04:00
PM / Domains: add setter for dev.pm_domain
Adds a function that sets the pointer to dev_pm_domain in struct device and that warns if the device has already finished probing. The reason why we want to enforce that is because in the general case that can cause problems and also that we can simplify code quite a bit if we can always assume that. This patch also changes all current code that directly sets the dev.pm_domain pointer. Signed-off-by: Tomeu Vizoso <[email protected]> Reviewed-by: Ulf Hansson <[email protected]> Signed-off-by: Rafael J. Wysocki <[email protected]>
This commit is contained in:
parent
6b9cb42752
commit
989561de9b
10 changed files with 54 additions and 19 deletions
|
|
@ -18,6 +18,7 @@
|
|||
#include <linux/mutex.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/platform_data/clk-lpss.h>
|
||||
#include <linux/pm_domain.h>
|
||||
#include <linux/pm_runtime.h>
|
||||
#include <linux/delay.h>
|
||||
|
||||
|
|
@ -875,13 +876,14 @@ static int acpi_lpss_platform_notify(struct notifier_block *nb,
|
|||
|
||||
switch (action) {
|
||||
case BUS_NOTIFY_BIND_DRIVER:
|
||||
pdev->dev.pm_domain = &acpi_lpss_pm_domain;
|
||||
dev_pm_domain_set(&pdev->dev, &acpi_lpss_pm_domain);
|
||||
break;
|
||||
case BUS_NOTIFY_DRIVER_NOT_BOUND:
|
||||
case BUS_NOTIFY_UNBOUND_DRIVER:
|
||||
pdev->dev.pm_domain = NULL;
|
||||
break;
|
||||
case BUS_NOTIFY_ADD_DEVICE:
|
||||
dev_pm_domain_set(&pdev->dev, &acpi_lpss_pm_domain);
|
||||
if (pdata->dev_desc->flags & LPSS_LTR)
|
||||
return sysfs_create_group(&pdev->dev.kobj,
|
||||
&lpss_attr_group);
|
||||
|
|
@ -889,6 +891,7 @@ static int acpi_lpss_platform_notify(struct notifier_block *nb,
|
|||
case BUS_NOTIFY_DEL_DEVICE:
|
||||
if (pdata->dev_desc->flags & LPSS_LTR)
|
||||
sysfs_remove_group(&pdev->dev.kobj, &lpss_attr_group);
|
||||
dev_pm_domain_set(&pdev->dev, NULL);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@
|
|||
#include <linux/export.h>
|
||||
#include <linux/mutex.h>
|
||||
#include <linux/pm_qos.h>
|
||||
#include <linux/pm_domain.h>
|
||||
#include <linux/pm_runtime.h>
|
||||
|
||||
#include "internal.h"
|
||||
|
|
@ -1059,7 +1060,7 @@ static void acpi_dev_pm_detach(struct device *dev, bool power_off)
|
|||
struct acpi_device *adev = ACPI_COMPANION(dev);
|
||||
|
||||
if (adev && dev->pm_domain == &acpi_general_pm_domain) {
|
||||
dev->pm_domain = NULL;
|
||||
dev_pm_domain_set(dev, NULL);
|
||||
acpi_remove_pm_notifier(adev);
|
||||
if (power_off) {
|
||||
/*
|
||||
|
|
@ -1111,7 +1112,7 @@ int acpi_dev_pm_attach(struct device *dev, bool power_on)
|
|||
return -EBUSY;
|
||||
|
||||
acpi_add_pm_notifier(adev, dev, acpi_pm_notify_work_func);
|
||||
dev->pm_domain = &acpi_general_pm_domain;
|
||||
dev_pm_domain_set(dev, &acpi_general_pm_domain);
|
||||
if (power_on) {
|
||||
acpi_dev_pm_full_power(adev);
|
||||
acpi_device_wakeup(adev, ACPI_STATE_S0, false);
|
||||
|
|
|
|||
Loading…
Reference in a new issue