Commit 835f1281 authored by Rafael J. Wysocki's avatar Rafael J. Wysocki

Merge branch 'pm-devfreq'

* pm-devfreq:
  PM / devfreq: Fix memory leak when fail to register device
  PM / devfreq: Add dependency on PM_OPP
  PM / devfreq: Move private devfreq_update_stats() into devfreq
  PM / devfreq: Convert to using %pOF instead of full_name
parents 7b01463e 0a9f429f
menuconfig PM_DEVFREQ menuconfig PM_DEVFREQ
bool "Generic Dynamic Voltage and Frequency Scaling (DVFS) support" bool "Generic Dynamic Voltage and Frequency Scaling (DVFS) support"
select SRCU select SRCU
select PM_OPP
help help
A device may have a list of frequencies and voltages available. A device may have a list of frequencies and voltages available.
devfreq, a generic DVFS framework can be registered for a device devfreq, a generic DVFS framework can be registered for a device
......
...@@ -277,8 +277,8 @@ int devfreq_event_get_edev_count(struct device *dev) ...@@ -277,8 +277,8 @@ int devfreq_event_get_edev_count(struct device *dev)
sizeof(u32)); sizeof(u32));
if (count < 0) { if (count < 0) {
dev_err(dev, dev_err(dev,
"failed to get the count of devfreq-event in %s node\n", "failed to get the count of devfreq-event in %pOF node\n",
dev->of_node->full_name); dev->of_node);
return count; return count;
} }
......
...@@ -564,7 +564,7 @@ struct devfreq *devfreq_add_device(struct device *dev, ...@@ -564,7 +564,7 @@ struct devfreq *devfreq_add_device(struct device *dev,
err = device_register(&devfreq->dev); err = device_register(&devfreq->dev);
if (err) { if (err) {
mutex_unlock(&devfreq->lock); mutex_unlock(&devfreq->lock);
goto err_out; goto err_dev;
} }
devfreq->trans_table = devm_kzalloc(&devfreq->dev, devfreq->trans_table = devm_kzalloc(&devfreq->dev,
...@@ -610,6 +610,9 @@ struct devfreq *devfreq_add_device(struct device *dev, ...@@ -610,6 +610,9 @@ struct devfreq *devfreq_add_device(struct device *dev,
mutex_unlock(&devfreq_list_lock); mutex_unlock(&devfreq_list_lock);
device_unregister(&devfreq->dev); device_unregister(&devfreq->dev);
err_dev:
if (devfreq)
kfree(devfreq);
err_out: err_out:
return ERR_PTR(err); return ERR_PTR(err);
} }
......
...@@ -69,4 +69,8 @@ extern int devfreq_remove_governor(struct devfreq_governor *governor); ...@@ -69,4 +69,8 @@ extern int devfreq_remove_governor(struct devfreq_governor *governor);
extern int devfreq_update_status(struct devfreq *devfreq, unsigned long freq); extern int devfreq_update_status(struct devfreq *devfreq, unsigned long freq);
static inline int devfreq_update_stats(struct devfreq *df)
{
return df->profile->get_dev_status(df->dev.parent, &df->last_status);
}
#endif /* _GOVERNOR_H */ #endif /* _GOVERNOR_H */
...@@ -214,19 +214,6 @@ extern void devm_devfreq_unregister_notifier(struct device *dev, ...@@ -214,19 +214,6 @@ extern void devm_devfreq_unregister_notifier(struct device *dev,
extern struct devfreq *devfreq_get_devfreq_by_phandle(struct device *dev, extern struct devfreq *devfreq_get_devfreq_by_phandle(struct device *dev,
int index); int index);
/**
* devfreq_update_stats() - update the last_status pointer in struct devfreq
* @df: the devfreq instance whose status needs updating
*
* Governors are recommended to use this function along with last_status,
* which allows other entities to reuse the last_status without affecting
* the values fetched later by governors.
*/
static inline int devfreq_update_stats(struct devfreq *df)
{
return df->profile->get_dev_status(df->dev.parent, &df->last_status);
}
#if IS_ENABLED(CONFIG_DEVFREQ_GOV_SIMPLE_ONDEMAND) #if IS_ENABLED(CONFIG_DEVFREQ_GOV_SIMPLE_ONDEMAND)
/** /**
* struct devfreq_simple_ondemand_data - void *data fed to struct devfreq * struct devfreq_simple_ondemand_data - void *data fed to struct devfreq
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment