mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2025-03-10 05:05:04 +07:00
Merge branch 'opp/fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/vireshk/pm
Pull operating performance points (OPP) framework fixes for 5.9-rc4 from Viresh Kumar: "This fixes reference counting for OPP tables. Few patches are getting queued (for various subsystems) for 5.10 which depend on this to be fixed first." * 'opp/fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/vireshk/pm: opp: Don't drop reference for an OPP table that was never parsed
This commit is contained in:
commit
763700f5e0
@ -1296,13 +1296,19 @@ void dev_pm_opp_remove(struct device *dev, unsigned long freq)
|
|||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(dev_pm_opp_remove);
|
EXPORT_SYMBOL_GPL(dev_pm_opp_remove);
|
||||||
|
|
||||||
void _opp_remove_all_static(struct opp_table *opp_table)
|
bool _opp_remove_all_static(struct opp_table *opp_table)
|
||||||
{
|
{
|
||||||
struct dev_pm_opp *opp, *tmp;
|
struct dev_pm_opp *opp, *tmp;
|
||||||
|
bool ret = true;
|
||||||
|
|
||||||
mutex_lock(&opp_table->lock);
|
mutex_lock(&opp_table->lock);
|
||||||
|
|
||||||
if (!opp_table->parsed_static_opps || --opp_table->parsed_static_opps)
|
if (!opp_table->parsed_static_opps) {
|
||||||
|
ret = false;
|
||||||
|
goto unlock;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (--opp_table->parsed_static_opps)
|
||||||
goto unlock;
|
goto unlock;
|
||||||
|
|
||||||
list_for_each_entry_safe(opp, tmp, &opp_table->opp_list, node) {
|
list_for_each_entry_safe(opp, tmp, &opp_table->opp_list, node) {
|
||||||
@ -1312,6 +1318,8 @@ void _opp_remove_all_static(struct opp_table *opp_table)
|
|||||||
|
|
||||||
unlock:
|
unlock:
|
||||||
mutex_unlock(&opp_table->lock);
|
mutex_unlock(&opp_table->lock);
|
||||||
|
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -2414,12 +2422,14 @@ void _dev_pm_opp_find_and_remove_table(struct device *dev)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
_opp_remove_all_static(opp_table);
|
/*
|
||||||
|
* Drop the extra reference only if the OPP table was successfully added
|
||||||
/* Drop reference taken by _find_opp_table() */
|
* with dev_pm_opp_of_add_table() earlier.
|
||||||
|
**/
|
||||||
|
if (_opp_remove_all_static(opp_table))
|
||||||
dev_pm_opp_put_opp_table(opp_table);
|
dev_pm_opp_put_opp_table(opp_table);
|
||||||
|
|
||||||
/* Drop reference taken while the OPP table was added */
|
/* Drop reference taken by _find_opp_table() */
|
||||||
dev_pm_opp_put_opp_table(opp_table);
|
dev_pm_opp_put_opp_table(opp_table);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -212,7 +212,7 @@ struct opp_table {
|
|||||||
|
|
||||||
/* Routines internal to opp core */
|
/* Routines internal to opp core */
|
||||||
void dev_pm_opp_get(struct dev_pm_opp *opp);
|
void dev_pm_opp_get(struct dev_pm_opp *opp);
|
||||||
void _opp_remove_all_static(struct opp_table *opp_table);
|
bool _opp_remove_all_static(struct opp_table *opp_table);
|
||||||
void _get_opp_table_kref(struct opp_table *opp_table);
|
void _get_opp_table_kref(struct opp_table *opp_table);
|
||||||
int _get_opp_count(struct opp_table *opp_table);
|
int _get_opp_count(struct opp_table *opp_table);
|
||||||
struct opp_table *_find_opp_table(struct device *dev);
|
struct opp_table *_find_opp_table(struct device *dev);
|
||||||
|
Loading…
Reference in New Issue
Block a user