Skip to content

Commit

Permalink
PM / devfreq: Remove unnecessary separate _remove_devfreq()
Browse files Browse the repository at this point in the history
The _remove_devfreq() releases the all resources of the devfreq
device. This function is only called in the devfreq_dev_release().
For that reason, the devfreq core doesn't need to leave the
_remove_devfreq() separately. This patch releases the all
resources in the devfreq_dev_release() and then removes the
_remove_devfreq().

Signed-off-by: Chanwoo Choi <[email protected]>
Signed-off-by: MyungJoo Ham <[email protected]>
  • Loading branch information
chanwoochoi authored and myungjoo committed Jan 31, 2017
1 parent 30582c2 commit 29b6968
Showing 1 changed file with 7 additions and 16 deletions.
23 changes: 7 additions & 16 deletions drivers/devfreq/devfreq.c
Original file line number Diff line number Diff line change
Expand Up @@ -475,11 +475,15 @@ static int devfreq_notifier_call(struct notifier_block *nb, unsigned long type,
}

/**
* _remove_devfreq() - Remove devfreq from the list and release its resources.
* @devfreq: the devfreq struct
* devfreq_dev_release() - Callback for struct device to release the device.
* @dev: the devfreq device
*
* Remove devfreq from the list and release its resources.
*/
static void _remove_devfreq(struct devfreq *devfreq)
static void devfreq_dev_release(struct device *dev)
{
struct devfreq *devfreq = to_devfreq(dev);

mutex_lock(&devfreq_list_lock);
if (IS_ERR(find_device_devfreq(devfreq->dev.parent))) {
mutex_unlock(&devfreq_list_lock);
Expand All @@ -500,19 +504,6 @@ static void _remove_devfreq(struct devfreq *devfreq)
kfree(devfreq);
}

/**
* devfreq_dev_release() - Callback for struct device to release the device.
* @dev: the devfreq device
*
* This calls _remove_devfreq() if _remove_devfreq() is not called.
*/
static void devfreq_dev_release(struct device *dev)
{
struct devfreq *devfreq = to_devfreq(dev);

_remove_devfreq(devfreq);
}

/**
* devfreq_add_device() - Add devfreq feature to the device
* @dev: the device to add devfreq feature.
Expand Down

0 comments on commit 29b6968

Please sign in to comment.