OPP: Migrate set-supported-hw API to use set-config helpers

Now that we have a central API to handle all OPP table configurations,
migrate the set-supported-hw family of helpers to use the new
infrastructure.

The return type and parameter to the APIs change a bit due to this,
update the current users as well in the same commit in order to avoid
breaking builds.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
This commit is contained in:
Viresh Kumar 2022-05-26 09:36:27 +05:30
parent b0ec094286
commit 89f03984fa
5 changed files with 66 additions and 105 deletions

View file

@ -184,9 +184,6 @@ int dev_pm_opp_set_config(struct device *dev, struct dev_pm_opp_config *config);
int devm_pm_opp_set_config(struct device *dev, struct dev_pm_opp_config *config);
void dev_pm_opp_clear_config(int token);
struct opp_table *dev_pm_opp_set_supported_hw(struct device *dev, const u32 *versions, unsigned int count);
void dev_pm_opp_put_supported_hw(struct opp_table *opp_table);
int devm_pm_opp_set_supported_hw(struct device *dev, const u32 *versions, unsigned int count);
struct opp_table *dev_pm_opp_set_prop_name(struct device *dev, const char *name);
void dev_pm_opp_put_prop_name(struct opp_table *opp_table);
struct opp_table *dev_pm_opp_set_clkname(struct device *dev, const char *name);
@ -369,22 +366,6 @@ static inline int dev_pm_opp_unregister_notifier(struct device *dev, struct noti
return -EOPNOTSUPP;
}
static inline struct opp_table *dev_pm_opp_set_supported_hw(struct device *dev,
const u32 *versions,
unsigned int count)
{
return ERR_PTR(-EOPNOTSUPP);
}
static inline void dev_pm_opp_put_supported_hw(struct opp_table *opp_table) {}
static inline int devm_pm_opp_set_supported_hw(struct device *dev,
const u32 *versions,
unsigned int count)
{
return -EOPNOTSUPP;
}
static inline struct opp_table *dev_pm_opp_register_set_opp_helper(struct device *dev,
int (*set_opp)(struct dev_pm_set_opp_data *data))
{
@ -618,4 +599,34 @@ static inline int devm_pm_opp_set_regulators(struct device *dev,
return devm_pm_opp_set_config(dev, &config);
}
/* Supported-hw helpers */
static inline int dev_pm_opp_set_supported_hw(struct device *dev,
const u32 *versions,
unsigned int count)
{
struct dev_pm_opp_config config = {
.supported_hw = versions,
.supported_hw_count = count,
};
return dev_pm_opp_set_config(dev, &config);
}
static inline void dev_pm_opp_put_supported_hw(int token)
{
dev_pm_opp_clear_config(token);
}
static inline int devm_pm_opp_set_supported_hw(struct device *dev,
const u32 *versions,
unsigned int count)
{
struct dev_pm_opp_config config = {
.supported_hw = versions,
.supported_hw_count = count,
};
return devm_pm_opp_set_config(dev, &config);
}
#endif /* __LINUX_OPP_H__ */