Skip to content

Commit 55e15c9

Browse files
Ulf Hanssonrafaeljw
authored andcommitted
PM / domains: Remove the pm_genpd_add|remove_callbacks APIs
There are no users of these APIs. To simplify the generic power domain let's remove them. Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org> Reviewed-by: Kevin Hilman <khilman@linaro.org> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
1 parent 2ce7598 commit 55e15c9

2 files changed

Lines changed: 0 additions & 125 deletions

File tree

‎drivers/base/power/domain.c‎

Lines changed: 0 additions & 106 deletions
Original file line numberDiff line numberDiff line change
@@ -1743,112 +1743,6 @@ int pm_genpd_remove_subdomain(struct generic_pm_domain *genpd,
17431743
return ret;
17441744
}
17451745

1746-
/**
1747-
* pm_genpd_add_callbacks - Add PM domain callbacks to a given device.
1748-
* @dev: Device to add the callbacks to.
1749-
* @ops: Set of callbacks to add.
1750-
* @td: Timing data to add to the device along with the callbacks (optional).
1751-
*
1752-
* Every call to this routine should be balanced with a call to
1753-
* __pm_genpd_remove_callbacks() and they must not be nested.
1754-
*/
1755-
int pm_genpd_add_callbacks(struct device *dev, struct gpd_dev_ops *ops,
1756-
struct gpd_timing_data *td)
1757-
{
1758-
struct generic_pm_domain_data *gpd_data_new, *gpd_data = NULL;
1759-
int ret = 0;
1760-
1761-
if (!(dev && ops))
1762-
return -EINVAL;
1763-
1764-
gpd_data_new = __pm_genpd_alloc_dev_data(dev);
1765-
if (!gpd_data_new)
1766-
return -ENOMEM;
1767-
1768-
pm_runtime_disable(dev);
1769-
device_pm_lock();
1770-
1771-
ret = dev_pm_get_subsys_data(dev);
1772-
if (ret)
1773-
goto out;
1774-
1775-
spin_lock_irq(&dev->power.lock);
1776-
1777-
if (dev->power.subsys_data->domain_data) {
1778-
gpd_data = to_gpd_data(dev->power.subsys_data->domain_data);
1779-
} else {
1780-
gpd_data = gpd_data_new;
1781-
dev->power.subsys_data->domain_data = &gpd_data->base;
1782-
}
1783-
gpd_data->refcount++;
1784-
gpd_data->ops = *ops;
1785-
if (td)
1786-
gpd_data->td = *td;
1787-
1788-
spin_unlock_irq(&dev->power.lock);
1789-
1790-
out:
1791-
device_pm_unlock();
1792-
pm_runtime_enable(dev);
1793-
1794-
if (gpd_data != gpd_data_new)
1795-
__pm_genpd_free_dev_data(dev, gpd_data_new);
1796-
1797-
return ret;
1798-
}
1799-
EXPORT_SYMBOL_GPL(pm_genpd_add_callbacks);
1800-
1801-
/**
1802-
* __pm_genpd_remove_callbacks - Remove PM domain callbacks from a given device.
1803-
* @dev: Device to remove the callbacks from.
1804-
* @clear_td: If set, clear the device's timing data too.
1805-
*
1806-
* This routine can only be called after pm_genpd_add_callbacks().
1807-
*/
1808-
int __pm_genpd_remove_callbacks(struct device *dev, bool clear_td)
1809-
{
1810-
struct generic_pm_domain_data *gpd_data = NULL;
1811-
bool remove = false;
1812-
int ret = 0;
1813-
1814-
if (!(dev && dev->power.subsys_data))
1815-
return -EINVAL;
1816-
1817-
pm_runtime_disable(dev);
1818-
device_pm_lock();
1819-
1820-
spin_lock_irq(&dev->power.lock);
1821-
1822-
if (dev->power.subsys_data->domain_data) {
1823-
gpd_data = to_gpd_data(dev->power.subsys_data->domain_data);
1824-
gpd_data->ops = (struct gpd_dev_ops){ NULL };
1825-
if (clear_td)
1826-
gpd_data->td = (struct gpd_timing_data){ 0 };
1827-
1828-
if (--gpd_data->refcount == 0) {
1829-
dev->power.subsys_data->domain_data = NULL;
1830-
remove = true;
1831-
}
1832-
} else {
1833-
ret = -EINVAL;
1834-
}
1835-
1836-
spin_unlock_irq(&dev->power.lock);
1837-
1838-
device_pm_unlock();
1839-
pm_runtime_enable(dev);
1840-
1841-
if (ret)
1842-
return ret;
1843-
1844-
dev_pm_put_subsys_data(dev);
1845-
if (remove)
1846-
__pm_genpd_free_dev_data(dev, gpd_data);
1847-
1848-
return 0;
1849-
}
1850-
EXPORT_SYMBOL_GPL(__pm_genpd_remove_callbacks);
1851-
18521746
/**
18531747
* pm_genpd_attach_cpuidle - Connect the given PM domain with cpuidle.
18541748
* @genpd: PM domain to be connected with cpuidle.

‎include/linux/pm_domain.h‎

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -151,10 +151,6 @@ extern int pm_genpd_add_subdomain_names(const char *master_name,
151151
const char *subdomain_name);
152152
extern int pm_genpd_remove_subdomain(struct generic_pm_domain *genpd,
153153
struct generic_pm_domain *target);
154-
extern int pm_genpd_add_callbacks(struct device *dev,
155-
struct gpd_dev_ops *ops,
156-
struct gpd_timing_data *td);
157-
extern int __pm_genpd_remove_callbacks(struct device *dev, bool clear_td);
158154
extern int pm_genpd_attach_cpuidle(struct generic_pm_domain *genpd, int state);
159155
extern int pm_genpd_name_attach_cpuidle(const char *name, int state);
160156
extern int pm_genpd_detach_cpuidle(struct generic_pm_domain *genpd);
@@ -217,16 +213,6 @@ static inline int pm_genpd_remove_subdomain(struct generic_pm_domain *genpd,
217213
{
218214
return -ENOSYS;
219215
}
220-
static inline int pm_genpd_add_callbacks(struct device *dev,
221-
struct gpd_dev_ops *ops,
222-
struct gpd_timing_data *td)
223-
{
224-
return -ENOSYS;
225-
}
226-
static inline int __pm_genpd_remove_callbacks(struct device *dev, bool clear_td)
227-
{
228-
return -ENOSYS;
229-
}
230216
static inline int pm_genpd_attach_cpuidle(struct generic_pm_domain *genpd, int st)
231217
{
232218
return -ENOSYS;
@@ -281,11 +267,6 @@ static inline int pm_genpd_name_add_device(const char *domain_name,
281267
return __pm_genpd_name_add_device(domain_name, dev, NULL);
282268
}
283269

284-
static inline int pm_genpd_remove_callbacks(struct device *dev)
285-
{
286-
return __pm_genpd_remove_callbacks(dev, true);
287-
}
288-
289270
#ifdef CONFIG_PM_GENERIC_DOMAINS_RUNTIME
290271
extern void genpd_queue_power_off_work(struct generic_pm_domain *genpd);
291272
extern void pm_genpd_poweroff_unused(void);

0 commit comments

Comments
 (0)