Message ID | 974c2bd6d6e622e47c85af65a200b4079d25002b.1568764439.git.leonard.crestez@nxp.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | PM / devfreq: Add dev_pm_qos support | expand |
On 19. 9. 18. 오전 9:18, Leonard Crestez wrote: > An opp notifier can be registered by devfreq in order to respond to OPPs > being enabled or disabled at runtime (for example by thermal). This is > currently handled explicitly by drivers. > > Move notifier handling to devfreq_add_device because this shouldn't be > hardware-specific. > > Handling this inside the core also takes less code. > > Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com> > --- > drivers/devfreq/devfreq.c | 84 +++--------------------------------- > drivers/devfreq/exynos-bus.c | 7 --- > drivers/devfreq/rk3399_dmc.c | 6 --- > include/linux/devfreq.h | 8 ---- > 4 files changed, 6 insertions(+), 99 deletions(-) > > diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c > index 7977bad93949..b9177430ae8f 100644 > --- a/drivers/devfreq/devfreq.c > +++ b/drivers/devfreq/devfreq.c > @@ -663,10 +663,11 @@ static void devfreq_dev_release(struct device *dev) > > mutex_lock(&devfreq_list_lock); > list_del(&devfreq->node); > mutex_unlock(&devfreq_list_lock); > > + dev_pm_opp_unregister_notifier(devfreq->dev.parent, &devfreq->nb); > dev_pm_qos_remove_notifier(devfreq->dev.parent, &devfreq->nb_max, > DEV_PM_QOS_MAX_FREQUENCY); > dev_pm_qos_remove_notifier(devfreq->dev.parent, &devfreq->nb_min, > DEV_PM_QOS_MIN_FREQUENCY); > > @@ -728,11 +729,10 @@ struct devfreq *devfreq_add_device(struct device *dev, > devfreq->profile = profile; > strncpy(devfreq->governor_name, governor_name, DEVFREQ_NAME_LEN); > devfreq->previous_freq = profile->initial_freq; > devfreq->last_status.current_frequency = profile->initial_freq; > devfreq->data = data; > - devfreq->nb.notifier_call = devfreq_notifier_call; > > if (!devfreq->profile->max_state && !devfreq->profile->freq_table) { > err = set_freq_table(devfreq); > if (err < 0) > goto err_dev; > @@ -810,10 +810,15 @@ struct devfreq *devfreq_add_device(struct device *dev, > err = dev_pm_qos_add_notifier(devfreq->dev.parent, &devfreq->nb_max, > DEV_PM_QOS_MAX_FREQUENCY); > if (err) > goto err_devfreq; > > + devfreq->nb.notifier_call = devfreq_notifier_call; > + err = dev_pm_opp_register_notifier(devfreq->dev.parent, &devfreq->nb); > + if (err) > + goto err_devfreq; > + > mutex_lock(&devfreq_list_lock); > > governor = try_then_request_governor(devfreq->governor_name); > if (IS_ERR(governor)) { > dev_err(dev, "%s: Unable to find governor for the device\n", > @@ -1624,87 +1629,10 @@ struct dev_pm_opp *devfreq_recommended_opp(struct device *dev, > > return opp; > } > EXPORT_SYMBOL(devfreq_recommended_opp); > > -/** > - * devfreq_register_opp_notifier() - Helper function to get devfreq notified > - * for any changes in the OPP availability > - * changes > - * @dev: The devfreq user device. (parent of devfreq) > - * @devfreq: The devfreq object. > - */ > -int devfreq_register_opp_notifier(struct device *dev, struct devfreq *devfreq) > -{ > - return dev_pm_opp_register_notifier(dev, &devfreq->nb); > -} > -EXPORT_SYMBOL(devfreq_register_opp_notifier); > - > -/** > - * devfreq_unregister_opp_notifier() - Helper function to stop getting devfreq > - * notified for any changes in the OPP > - * availability changes anymore. > - * @dev: The devfreq user device. (parent of devfreq) > - * @devfreq: The devfreq object. > - * > - * At exit() callback of devfreq_dev_profile, this must be included if > - * devfreq_recommended_opp is used. > - */ > -int devfreq_unregister_opp_notifier(struct device *dev, struct devfreq *devfreq) > -{ > - return dev_pm_opp_unregister_notifier(dev, &devfreq->nb); > -} > -EXPORT_SYMBOL(devfreq_unregister_opp_notifier); > - > -static void devm_devfreq_opp_release(struct device *dev, void *res) > -{ > - devfreq_unregister_opp_notifier(dev, *(struct devfreq **)res); > -} > - > -/** > - * devm_devfreq_register_opp_notifier() - Resource-managed > - * devfreq_register_opp_notifier() > - * @dev: The devfreq user device. (parent of devfreq) > - * @devfreq: The devfreq object. > - */ > -int devm_devfreq_register_opp_notifier(struct device *dev, > - struct devfreq *devfreq) > -{ > - struct devfreq **ptr; > - int ret; > - > - ptr = devres_alloc(devm_devfreq_opp_release, sizeof(*ptr), GFP_KERNEL); > - if (!ptr) > - return -ENOMEM; > - > - ret = devfreq_register_opp_notifier(dev, devfreq); > - if (ret) { > - devres_free(ptr); > - return ret; > - } > - > - *ptr = devfreq; > - devres_add(dev, ptr); > - > - return 0; > -} > -EXPORT_SYMBOL(devm_devfreq_register_opp_notifier); > - > -/** > - * devm_devfreq_unregister_opp_notifier() - Resource-managed > - * devfreq_unregister_opp_notifier() > - * @dev: The devfreq user device. (parent of devfreq) > - * @devfreq: The devfreq object. > - */ > -void devm_devfreq_unregister_opp_notifier(struct device *dev, > - struct devfreq *devfreq) > -{ > - WARN_ON(devres_release(dev, devm_devfreq_opp_release, > - devm_devfreq_dev_match, devfreq)); > -} > -EXPORT_SYMBOL(devm_devfreq_unregister_opp_notifier); > - > /** > * devfreq_register_notifier() - Register a driver with devfreq > * @devfreq: The devfreq object. > * @nb: The notifier block to register. > * @list: DEVFREQ_TRANSITION_NOTIFIER. > diff --git a/drivers/devfreq/exynos-bus.c b/drivers/devfreq/exynos-bus.c > index c832673273a2..29f422469960 100644 > --- a/drivers/devfreq/exynos-bus.c > +++ b/drivers/devfreq/exynos-bus.c > @@ -356,17 +356,10 @@ static int exynos_bus_probe(struct platform_device *pdev) > dev_err(dev, "failed to add devfreq device\n"); > ret = PTR_ERR(bus->devfreq); > goto err; > } > > - /* Register opp_notifier to catch the change of OPP */ > - ret = devm_devfreq_register_opp_notifier(dev, bus->devfreq); > - if (ret < 0) { > - dev_err(dev, "failed to register opp notifier\n"); > - goto err; > - } > - > /* > * Enable devfreq-event to get raw data which is used to determine > * current bus load. > */ > ret = exynos_bus_enable_edev(bus); > diff --git a/drivers/devfreq/rk3399_dmc.c b/drivers/devfreq/rk3399_dmc.c > index 2e65d7279d79..f660d2031e8a 100644 > --- a/drivers/devfreq/rk3399_dmc.c > +++ b/drivers/devfreq/rk3399_dmc.c > @@ -454,12 +454,10 @@ static int rk3399_dmcfreq_probe(struct platform_device *pdev) > if (IS_ERR(data->devfreq)) { > ret = PTR_ERR(data->devfreq); > goto err_free_opp; > } > > - devm_devfreq_register_opp_notifier(dev, data->devfreq); > - > data->dev = dev; > platform_set_drvdata(pdev, data); > > return 0; > > @@ -470,14 +468,10 @@ static int rk3399_dmcfreq_probe(struct platform_device *pdev) > > static int rk3399_dmcfreq_remove(struct platform_device *pdev) > { > struct rk3399_dmcfreq *dmcfreq = dev_get_drvdata(&pdev->dev); > > - /* > - * Before remove the opp table we need to unregister the opp notifier. > - */ > - devm_devfreq_unregister_opp_notifier(dmcfreq->dev, dmcfreq->devfreq); > dev_pm_opp_of_remove_table(dmcfreq->dev); > > return 0; > } > > diff --git a/include/linux/devfreq.h b/include/linux/devfreq.h > index 4b5cc80abbe3..bf6ebfbc1e8a 100644 > --- a/include/linux/devfreq.h > +++ b/include/linux/devfreq.h > @@ -220,18 +220,10 @@ extern void devfreq_resume(void); > extern int update_devfreq(struct devfreq *devfreq); > > /* Helper functions for devfreq user device driver with OPP. */ > extern struct dev_pm_opp *devfreq_recommended_opp(struct device *dev, > unsigned long *freq, u32 flags); > -extern int devfreq_register_opp_notifier(struct device *dev, > - struct devfreq *devfreq); > -extern int devfreq_unregister_opp_notifier(struct device *dev, > - struct devfreq *devfreq); > -extern int devm_devfreq_register_opp_notifier(struct device *dev, > - struct devfreq *devfreq); > -extern void devm_devfreq_unregister_opp_notifier(struct device *dev, > - struct devfreq *devfreq); > extern int devfreq_register_notifier(struct devfreq *devfreq, > struct notifier_block *nb, > unsigned int list); > extern int devfreq_unregister_notifier(struct devfreq *devfreq, > struct notifier_block *nb, > It looks good to me. But, this patch don't remove the inline functions in devfreq.h. - devfreq_register_opp_notifier - devfreq_unregister_opp_notifier - devm_devfreq_register_opp_notifier - devm_devfreq_unregister_opp_notifier
On 01.10.2019 00:44, Chanwoo Choi wrote: > On 19. 9. 18. 오전 9:18, Leonard Crestez wrote: >> An opp notifier can be registered by devfreq in order to respond to OPPs >> being enabled or disabled at runtime (for example by thermal). This is >> currently handled explicitly by drivers. >> >> Move notifier handling to devfreq_add_device because this shouldn't be >> hardware-specific. >> >> Handling this inside the core also takes less code. >> >> Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com> >> --- >> drivers/devfreq/devfreq.c | 84 +++--------------------------------- >> drivers/devfreq/exynos-bus.c | 7 --- >> drivers/devfreq/rk3399_dmc.c | 6 --- >> include/linux/devfreq.h | 8 ---- >> 4 files changed, 6 insertions(+), 99 deletions(-) >> >> diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c >> index 7977bad93949..b9177430ae8f 100644 >> --- a/drivers/devfreq/devfreq.c >> +++ b/drivers/devfreq/devfreq.c >> @@ -663,10 +663,11 @@ static void devfreq_dev_release(struct device *dev) >> >> mutex_lock(&devfreq_list_lock); >> list_del(&devfreq->node); >> mutex_unlock(&devfreq_list_lock); >> >> + dev_pm_opp_unregister_notifier(devfreq->dev.parent, &devfreq->nb); >> dev_pm_qos_remove_notifier(devfreq->dev.parent, &devfreq->nb_max, >> DEV_PM_QOS_MAX_FREQUENCY); >> dev_pm_qos_remove_notifier(devfreq->dev.parent, &devfreq->nb_min, >> DEV_PM_QOS_MIN_FREQUENCY); >> >> @@ -728,11 +729,10 @@ struct devfreq *devfreq_add_device(struct device *dev, >> devfreq->profile = profile; >> strncpy(devfreq->governor_name, governor_name, DEVFREQ_NAME_LEN); >> devfreq->previous_freq = profile->initial_freq; >> devfreq->last_status.current_frequency = profile->initial_freq; >> devfreq->data = data; >> - devfreq->nb.notifier_call = devfreq_notifier_call; >> >> if (!devfreq->profile->max_state && !devfreq->profile->freq_table) { >> err = set_freq_table(devfreq); >> if (err < 0) >> goto err_dev; >> @@ -810,10 +810,15 @@ struct devfreq *devfreq_add_device(struct device *dev, >> err = dev_pm_qos_add_notifier(devfreq->dev.parent, &devfreq->nb_max, >> DEV_PM_QOS_MAX_FREQUENCY); >> if (err) >> goto err_devfreq; >> >> + devfreq->nb.notifier_call = devfreq_notifier_call; >> + err = dev_pm_opp_register_notifier(devfreq->dev.parent, &devfreq->nb); >> + if (err) >> + goto err_devfreq; >> + >> mutex_lock(&devfreq_list_lock); >> >> governor = try_then_request_governor(devfreq->governor_name); >> if (IS_ERR(governor)) { >> dev_err(dev, "%s: Unable to find governor for the device\n", >> @@ -1624,87 +1629,10 @@ struct dev_pm_opp *devfreq_recommended_opp(struct device *dev, >> >> return opp; >> } >> EXPORT_SYMBOL(devfreq_recommended_opp); >> >> -/** >> - * devfreq_register_opp_notifier() - Helper function to get devfreq notified >> - * for any changes in the OPP availability >> - * changes >> - * @dev: The devfreq user device. (parent of devfreq) >> - * @devfreq: The devfreq object. >> - */ >> -int devfreq_register_opp_notifier(struct device *dev, struct devfreq *devfreq) >> -{ >> - return dev_pm_opp_register_notifier(dev, &devfreq->nb); >> -} >> -EXPORT_SYMBOL(devfreq_register_opp_notifier); >> - >> -/** >> - * devfreq_unregister_opp_notifier() - Helper function to stop getting devfreq >> - * notified for any changes in the OPP >> - * availability changes anymore. >> - * @dev: The devfreq user device. (parent of devfreq) >> - * @devfreq: The devfreq object. >> - * >> - * At exit() callback of devfreq_dev_profile, this must be included if >> - * devfreq_recommended_opp is used. >> - */ >> -int devfreq_unregister_opp_notifier(struct device *dev, struct devfreq *devfreq) >> -{ >> - return dev_pm_opp_unregister_notifier(dev, &devfreq->nb); >> -} >> -EXPORT_SYMBOL(devfreq_unregister_opp_notifier); >> - >> -static void devm_devfreq_opp_release(struct device *dev, void *res) >> -{ >> - devfreq_unregister_opp_notifier(dev, *(struct devfreq **)res); >> -} >> - >> -/** >> - * devm_devfreq_register_opp_notifier() - Resource-managed >> - * devfreq_register_opp_notifier() >> - * @dev: The devfreq user device. (parent of devfreq) >> - * @devfreq: The devfreq object. >> - */ >> -int devm_devfreq_register_opp_notifier(struct device *dev, >> - struct devfreq *devfreq) >> -{ >> - struct devfreq **ptr; >> - int ret; >> - >> - ptr = devres_alloc(devm_devfreq_opp_release, sizeof(*ptr), GFP_KERNEL); >> - if (!ptr) >> - return -ENOMEM; >> - >> - ret = devfreq_register_opp_notifier(dev, devfreq); >> - if (ret) { >> - devres_free(ptr); >> - return ret; >> - } >> - >> - *ptr = devfreq; >> - devres_add(dev, ptr); >> - >> - return 0; >> -} >> -EXPORT_SYMBOL(devm_devfreq_register_opp_notifier); >> - >> -/** >> - * devm_devfreq_unregister_opp_notifier() - Resource-managed >> - * devfreq_unregister_opp_notifier() >> - * @dev: The devfreq user device. (parent of devfreq) >> - * @devfreq: The devfreq object. >> - */ >> -void devm_devfreq_unregister_opp_notifier(struct device *dev, >> - struct devfreq *devfreq) >> -{ >> - WARN_ON(devres_release(dev, devm_devfreq_opp_release, >> - devm_devfreq_dev_match, devfreq)); >> -} >> -EXPORT_SYMBOL(devm_devfreq_unregister_opp_notifier); >> - >> /** >> * devfreq_register_notifier() - Register a driver with devfreq >> * @devfreq: The devfreq object. >> * @nb: The notifier block to register. >> * @list: DEVFREQ_TRANSITION_NOTIFIER. >> diff --git a/drivers/devfreq/exynos-bus.c b/drivers/devfreq/exynos-bus.c >> index c832673273a2..29f422469960 100644 >> --- a/drivers/devfreq/exynos-bus.c >> +++ b/drivers/devfreq/exynos-bus.c >> @@ -356,17 +356,10 @@ static int exynos_bus_probe(struct platform_device *pdev) >> dev_err(dev, "failed to add devfreq device\n"); >> ret = PTR_ERR(bus->devfreq); >> goto err; >> } >> >> - /* Register opp_notifier to catch the change of OPP */ >> - ret = devm_devfreq_register_opp_notifier(dev, bus->devfreq); >> - if (ret < 0) { >> - dev_err(dev, "failed to register opp notifier\n"); >> - goto err; >> - } >> - >> /* >> * Enable devfreq-event to get raw data which is used to determine >> * current bus load. >> */ >> ret = exynos_bus_enable_edev(bus); >> diff --git a/drivers/devfreq/rk3399_dmc.c b/drivers/devfreq/rk3399_dmc.c >> index 2e65d7279d79..f660d2031e8a 100644 >> --- a/drivers/devfreq/rk3399_dmc.c >> +++ b/drivers/devfreq/rk3399_dmc.c >> @@ -454,12 +454,10 @@ static int rk3399_dmcfreq_probe(struct platform_device *pdev) >> if (IS_ERR(data->devfreq)) { >> ret = PTR_ERR(data->devfreq); >> goto err_free_opp; >> } >> >> - devm_devfreq_register_opp_notifier(dev, data->devfreq); >> - >> data->dev = dev; >> platform_set_drvdata(pdev, data); >> >> return 0; >> >> @@ -470,14 +468,10 @@ static int rk3399_dmcfreq_probe(struct platform_device *pdev) >> >> static int rk3399_dmcfreq_remove(struct platform_device *pdev) >> { >> struct rk3399_dmcfreq *dmcfreq = dev_get_drvdata(&pdev->dev); >> >> - /* >> - * Before remove the opp table we need to unregister the opp notifier. >> - */ >> - devm_devfreq_unregister_opp_notifier(dmcfreq->dev, dmcfreq->devfreq); >> dev_pm_opp_of_remove_table(dmcfreq->dev); >> >> return 0; >> } >> >> diff --git a/include/linux/devfreq.h b/include/linux/devfreq.h >> index 4b5cc80abbe3..bf6ebfbc1e8a 100644 >> --- a/include/linux/devfreq.h >> +++ b/include/linux/devfreq.h >> @@ -220,18 +220,10 @@ extern void devfreq_resume(void); >> extern int update_devfreq(struct devfreq *devfreq); >> >> /* Helper functions for devfreq user device driver with OPP. */ >> extern struct dev_pm_opp *devfreq_recommended_opp(struct device *dev, >> unsigned long *freq, u32 flags); >> -extern int devfreq_register_opp_notifier(struct device *dev, >> - struct devfreq *devfreq); >> -extern int devfreq_unregister_opp_notifier(struct device *dev, >> - struct devfreq *devfreq); >> -extern int devm_devfreq_register_opp_notifier(struct device *dev, >> - struct devfreq *devfreq); >> -extern void devm_devfreq_unregister_opp_notifier(struct device *dev, >> - struct devfreq *devfreq); >> extern int devfreq_register_notifier(struct devfreq *devfreq, >> struct notifier_block *nb, >> unsigned int list); >> extern int devfreq_unregister_notifier(struct devfreq *devfreq, >> struct notifier_block *nb, >> > > It looks good to me. > But, this patch don't remove the inline functions in devfreq.h. > - devfreq_register_opp_notifier > - devfreq_unregister_opp_notifier > - devm_devfreq_register_opp_notifier > - devm_devfreq_unregister_opp_notifier Will fix. I dropped this patch from later versions of the 'PM QoS' series because it's not required for PM QoS. It does however touch devfreq_add_device in a way that can cause a conflict. -- Regards, Leonard
diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c index 7977bad93949..b9177430ae8f 100644 --- a/drivers/devfreq/devfreq.c +++ b/drivers/devfreq/devfreq.c @@ -663,10 +663,11 @@ static void devfreq_dev_release(struct device *dev) mutex_lock(&devfreq_list_lock); list_del(&devfreq->node); mutex_unlock(&devfreq_list_lock); + dev_pm_opp_unregister_notifier(devfreq->dev.parent, &devfreq->nb); dev_pm_qos_remove_notifier(devfreq->dev.parent, &devfreq->nb_max, DEV_PM_QOS_MAX_FREQUENCY); dev_pm_qos_remove_notifier(devfreq->dev.parent, &devfreq->nb_min, DEV_PM_QOS_MIN_FREQUENCY); @@ -728,11 +729,10 @@ struct devfreq *devfreq_add_device(struct device *dev, devfreq->profile = profile; strncpy(devfreq->governor_name, governor_name, DEVFREQ_NAME_LEN); devfreq->previous_freq = profile->initial_freq; devfreq->last_status.current_frequency = profile->initial_freq; devfreq->data = data; - devfreq->nb.notifier_call = devfreq_notifier_call; if (!devfreq->profile->max_state && !devfreq->profile->freq_table) { err = set_freq_table(devfreq); if (err < 0) goto err_dev; @@ -810,10 +810,15 @@ struct devfreq *devfreq_add_device(struct device *dev, err = dev_pm_qos_add_notifier(devfreq->dev.parent, &devfreq->nb_max, DEV_PM_QOS_MAX_FREQUENCY); if (err) goto err_devfreq; + devfreq->nb.notifier_call = devfreq_notifier_call; + err = dev_pm_opp_register_notifier(devfreq->dev.parent, &devfreq->nb); + if (err) + goto err_devfreq; + mutex_lock(&devfreq_list_lock); governor = try_then_request_governor(devfreq->governor_name); if (IS_ERR(governor)) { dev_err(dev, "%s: Unable to find governor for the device\n", @@ -1624,87 +1629,10 @@ struct dev_pm_opp *devfreq_recommended_opp(struct device *dev, return opp; } EXPORT_SYMBOL(devfreq_recommended_opp); -/** - * devfreq_register_opp_notifier() - Helper function to get devfreq notified - * for any changes in the OPP availability - * changes - * @dev: The devfreq user device. (parent of devfreq) - * @devfreq: The devfreq object. - */ -int devfreq_register_opp_notifier(struct device *dev, struct devfreq *devfreq) -{ - return dev_pm_opp_register_notifier(dev, &devfreq->nb); -} -EXPORT_SYMBOL(devfreq_register_opp_notifier); - -/** - * devfreq_unregister_opp_notifier() - Helper function to stop getting devfreq - * notified for any changes in the OPP - * availability changes anymore. - * @dev: The devfreq user device. (parent of devfreq) - * @devfreq: The devfreq object. - * - * At exit() callback of devfreq_dev_profile, this must be included if - * devfreq_recommended_opp is used. - */ -int devfreq_unregister_opp_notifier(struct device *dev, struct devfreq *devfreq) -{ - return dev_pm_opp_unregister_notifier(dev, &devfreq->nb); -} -EXPORT_SYMBOL(devfreq_unregister_opp_notifier); - -static void devm_devfreq_opp_release(struct device *dev, void *res) -{ - devfreq_unregister_opp_notifier(dev, *(struct devfreq **)res); -} - -/** - * devm_devfreq_register_opp_notifier() - Resource-managed - * devfreq_register_opp_notifier() - * @dev: The devfreq user device. (parent of devfreq) - * @devfreq: The devfreq object. - */ -int devm_devfreq_register_opp_notifier(struct device *dev, - struct devfreq *devfreq) -{ - struct devfreq **ptr; - int ret; - - ptr = devres_alloc(devm_devfreq_opp_release, sizeof(*ptr), GFP_KERNEL); - if (!ptr) - return -ENOMEM; - - ret = devfreq_register_opp_notifier(dev, devfreq); - if (ret) { - devres_free(ptr); - return ret; - } - - *ptr = devfreq; - devres_add(dev, ptr); - - return 0; -} -EXPORT_SYMBOL(devm_devfreq_register_opp_notifier); - -/** - * devm_devfreq_unregister_opp_notifier() - Resource-managed - * devfreq_unregister_opp_notifier() - * @dev: The devfreq user device. (parent of devfreq) - * @devfreq: The devfreq object. - */ -void devm_devfreq_unregister_opp_notifier(struct device *dev, - struct devfreq *devfreq) -{ - WARN_ON(devres_release(dev, devm_devfreq_opp_release, - devm_devfreq_dev_match, devfreq)); -} -EXPORT_SYMBOL(devm_devfreq_unregister_opp_notifier); - /** * devfreq_register_notifier() - Register a driver with devfreq * @devfreq: The devfreq object. * @nb: The notifier block to register. * @list: DEVFREQ_TRANSITION_NOTIFIER. diff --git a/drivers/devfreq/exynos-bus.c b/drivers/devfreq/exynos-bus.c index c832673273a2..29f422469960 100644 --- a/drivers/devfreq/exynos-bus.c +++ b/drivers/devfreq/exynos-bus.c @@ -356,17 +356,10 @@ static int exynos_bus_probe(struct platform_device *pdev) dev_err(dev, "failed to add devfreq device\n"); ret = PTR_ERR(bus->devfreq); goto err; } - /* Register opp_notifier to catch the change of OPP */ - ret = devm_devfreq_register_opp_notifier(dev, bus->devfreq); - if (ret < 0) { - dev_err(dev, "failed to register opp notifier\n"); - goto err; - } - /* * Enable devfreq-event to get raw data which is used to determine * current bus load. */ ret = exynos_bus_enable_edev(bus); diff --git a/drivers/devfreq/rk3399_dmc.c b/drivers/devfreq/rk3399_dmc.c index 2e65d7279d79..f660d2031e8a 100644 --- a/drivers/devfreq/rk3399_dmc.c +++ b/drivers/devfreq/rk3399_dmc.c @@ -454,12 +454,10 @@ static int rk3399_dmcfreq_probe(struct platform_device *pdev) if (IS_ERR(data->devfreq)) { ret = PTR_ERR(data->devfreq); goto err_free_opp; } - devm_devfreq_register_opp_notifier(dev, data->devfreq); - data->dev = dev; platform_set_drvdata(pdev, data); return 0; @@ -470,14 +468,10 @@ static int rk3399_dmcfreq_probe(struct platform_device *pdev) static int rk3399_dmcfreq_remove(struct platform_device *pdev) { struct rk3399_dmcfreq *dmcfreq = dev_get_drvdata(&pdev->dev); - /* - * Before remove the opp table we need to unregister the opp notifier. - */ - devm_devfreq_unregister_opp_notifier(dmcfreq->dev, dmcfreq->devfreq); dev_pm_opp_of_remove_table(dmcfreq->dev); return 0; } diff --git a/include/linux/devfreq.h b/include/linux/devfreq.h index 4b5cc80abbe3..bf6ebfbc1e8a 100644 --- a/include/linux/devfreq.h +++ b/include/linux/devfreq.h @@ -220,18 +220,10 @@ extern void devfreq_resume(void); extern int update_devfreq(struct devfreq *devfreq); /* Helper functions for devfreq user device driver with OPP. */ extern struct dev_pm_opp *devfreq_recommended_opp(struct device *dev, unsigned long *freq, u32 flags); -extern int devfreq_register_opp_notifier(struct device *dev, - struct devfreq *devfreq); -extern int devfreq_unregister_opp_notifier(struct device *dev, - struct devfreq *devfreq); -extern int devm_devfreq_register_opp_notifier(struct device *dev, - struct devfreq *devfreq); -extern void devm_devfreq_unregister_opp_notifier(struct device *dev, - struct devfreq *devfreq); extern int devfreq_register_notifier(struct devfreq *devfreq, struct notifier_block *nb, unsigned int list); extern int devfreq_unregister_notifier(struct devfreq *devfreq, struct notifier_block *nb,
An opp notifier can be registered by devfreq in order to respond to OPPs being enabled or disabled at runtime (for example by thermal). This is currently handled explicitly by drivers. Move notifier handling to devfreq_add_device because this shouldn't be hardware-specific. Handling this inside the core also takes less code. Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com> --- drivers/devfreq/devfreq.c | 84 +++--------------------------------- drivers/devfreq/exynos-bus.c | 7 --- drivers/devfreq/rk3399_dmc.c | 6 --- include/linux/devfreq.h | 8 ---- 4 files changed, 6 insertions(+), 99 deletions(-)