Skip to content

Commit

Permalink
Merge branch 'pm-devfreq'
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
Rafael J. Wysocki committed Sep 3, 2017
2 parents 7b01463 + 0a9f429 commit 835f128
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 16 deletions.
1 change: 1 addition & 0 deletions drivers/devfreq/Kconfig
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
menuconfig PM_DEVFREQ
bool "Generic Dynamic Voltage and Frequency Scaling (DVFS) support"
select SRCU
select PM_OPP
help
A device may have a list of frequencies and voltages available.
devfreq, a generic DVFS framework can be registered for a device
Expand Down
4 changes: 2 additions & 2 deletions drivers/devfreq/devfreq-event.c
Original file line number Diff line number Diff line change
Expand Up @@ -277,8 +277,8 @@ int devfreq_event_get_edev_count(struct device *dev)
sizeof(u32));
if (count < 0) {
dev_err(dev,
"failed to get the count of devfreq-event in %s node\n",
dev->of_node->full_name);
"failed to get the count of devfreq-event in %pOF node\n",
dev->of_node);
return count;
}

Expand Down
5 changes: 4 additions & 1 deletion drivers/devfreq/devfreq.c
Original file line number Diff line number Diff line change
Expand Up @@ -564,7 +564,7 @@ struct devfreq *devfreq_add_device(struct device *dev,
err = device_register(&devfreq->dev);
if (err) {
mutex_unlock(&devfreq->lock);
goto err_out;
goto err_dev;
}

devfreq->trans_table = devm_kzalloc(&devfreq->dev,
Expand Down Expand Up @@ -610,6 +610,9 @@ struct devfreq *devfreq_add_device(struct device *dev,
mutex_unlock(&devfreq_list_lock);

device_unregister(&devfreq->dev);
err_dev:
if (devfreq)
kfree(devfreq);
err_out:
return ERR_PTR(err);
}
Expand Down
4 changes: 4 additions & 0 deletions drivers/devfreq/governor.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,4 +69,8 @@ extern int devfreq_remove_governor(struct devfreq_governor *governor);

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 */
13 changes: 0 additions & 13 deletions include/linux/devfreq.h
Original file line number Diff line number Diff line change
Expand Up @@ -214,19 +214,6 @@ extern void devm_devfreq_unregister_notifier(struct device *dev,
extern struct devfreq *devfreq_get_devfreq_by_phandle(struct device *dev,
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)
/**
* struct devfreq_simple_ondemand_data - void *data fed to struct devfreq
Expand Down

0 comments on commit 835f128

Please sign in to comment.