hc
2024-05-10 cde9070d9970eef1f7ec2360586c802a16230ad8
kernel/drivers/base/power/common.c
....@@ -1,11 +1,9 @@
1
+// SPDX-License-Identifier: GPL-2.0
12 /*
23 * drivers/base/power/common.c - Common device power management code.
34 *
45 * Copyright (C) 2011 Rafael J. Wysocki <rjw@sisk.pl>, Renesas Electronics Corp.
5
- *
6
- * This file is released under the GPLv2.
76 */
8
-
97 #include <linux/kernel.h>
108 #include <linux/device.h>
119 #include <linux/export.h>
....@@ -160,7 +158,7 @@
160158 * For a detailed function description, see dev_pm_domain_attach_by_id().
161159 */
162160 struct device *dev_pm_domain_attach_by_name(struct device *dev,
163
- char *name)
161
+ const char *name)
164162 {
165163 if (dev->pm_domain)
166164 return ERR_PTR(-EEXIST);
....@@ -190,6 +188,26 @@
190188 EXPORT_SYMBOL_GPL(dev_pm_domain_detach);
191189
192190 /**
191
+ * dev_pm_domain_start - Start the device through its PM domain.
192
+ * @dev: Device to start.
193
+ *
194
+ * This function should typically be called during probe by a subsystem/driver,
195
+ * when it needs to start its device from the PM domain's perspective. Note
196
+ * that, it's assumed that the PM domain is already powered on when this
197
+ * function is called.
198
+ *
199
+ * Returns 0 on success and negative error values on failures.
200
+ */
201
+int dev_pm_domain_start(struct device *dev)
202
+{
203
+ if (dev->pm_domain && dev->pm_domain->start)
204
+ return dev->pm_domain->start(dev);
205
+
206
+ return 0;
207
+}
208
+EXPORT_SYMBOL_GPL(dev_pm_domain_start);
209
+
210
+/**
193211 * dev_pm_domain_set - Set PM domain of a device.
194212 * @dev: Device whose PM domain is to be set.
195213 * @pd: PM domain to be set, or NULL.