diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/devfreq/devfreq.c | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c index 2042ec3656ba..af4af7708574 100644 --- a/drivers/devfreq/devfreq.c +++ b/drivers/devfreq/devfreq.c | |||
@@ -394,7 +394,7 @@ static int devfreq_notifier_call(struct notifier_block *nb, unsigned long type, | |||
394 | * @devfreq: the devfreq struct | 394 | * @devfreq: the devfreq struct |
395 | * @skip: skip calling device_unregister(). | 395 | * @skip: skip calling device_unregister(). |
396 | */ | 396 | */ |
397 | static void _remove_devfreq(struct devfreq *devfreq, bool skip) | 397 | static void _remove_devfreq(struct devfreq *devfreq) |
398 | { | 398 | { |
399 | mutex_lock(&devfreq_list_lock); | 399 | mutex_lock(&devfreq_list_lock); |
400 | if (IS_ERR(find_device_devfreq(devfreq->dev.parent))) { | 400 | if (IS_ERR(find_device_devfreq(devfreq->dev.parent))) { |
@@ -412,11 +412,6 @@ static void _remove_devfreq(struct devfreq *devfreq, bool skip) | |||
412 | if (devfreq->profile->exit) | 412 | if (devfreq->profile->exit) |
413 | devfreq->profile->exit(devfreq->dev.parent); | 413 | devfreq->profile->exit(devfreq->dev.parent); |
414 | 414 | ||
415 | if (!skip && get_device(&devfreq->dev)) { | ||
416 | device_unregister(&devfreq->dev); | ||
417 | put_device(&devfreq->dev); | ||
418 | } | ||
419 | |||
420 | mutex_destroy(&devfreq->lock); | 415 | mutex_destroy(&devfreq->lock); |
421 | kfree(devfreq); | 416 | kfree(devfreq); |
422 | } | 417 | } |
@@ -426,14 +421,12 @@ static void _remove_devfreq(struct devfreq *devfreq, bool skip) | |||
426 | * @dev: the devfreq device | 421 | * @dev: the devfreq device |
427 | * | 422 | * |
428 | * This calls _remove_devfreq() if _remove_devfreq() is not called. | 423 | * This calls _remove_devfreq() if _remove_devfreq() is not called. |
429 | * Note that devfreq_dev_release() could be called by _remove_devfreq() as | ||
430 | * well as by others unregistering the device. | ||
431 | */ | 424 | */ |
432 | static void devfreq_dev_release(struct device *dev) | 425 | static void devfreq_dev_release(struct device *dev) |
433 | { | 426 | { |
434 | struct devfreq *devfreq = to_devfreq(dev); | 427 | struct devfreq *devfreq = to_devfreq(dev); |
435 | 428 | ||
436 | _remove_devfreq(devfreq, true); | 429 | _remove_devfreq(devfreq); |
437 | } | 430 | } |
438 | 431 | ||
439 | /** | 432 | /** |
@@ -544,7 +537,8 @@ int devfreq_remove_device(struct devfreq *devfreq) | |||
544 | if (!devfreq) | 537 | if (!devfreq) |
545 | return -EINVAL; | 538 | return -EINVAL; |
546 | 539 | ||
547 | _remove_devfreq(devfreq, false); | 540 | device_unregister(&devfreq->dev); |
541 | put_device(&devfreq->dev); | ||
548 | 542 | ||
549 | return 0; | 543 | return 0; |
550 | } | 544 | } |