Commit 0dc5b8ab authored by Krzysztof Kozlowski's avatar Krzysztof Kozlowski Committed by Georgi Djakov

interconnect: constify of_phandle_args in xlate

The xlate callbacks are supposed to translate of_phandle_args to proper
provider without modifying the of_phandle_args.  Make the argument
pointer to const for code safety and readability.
Acked-by: default avatarKonrad Dybcio <konrad.dybcio@linaro.org>
Acked-by: Thierry Reding <treding@nvidia.com> # Tegra
Signed-off-by: default avatarKrzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Acked-by: Alim Akhtar <alim.akhtar@samsung.com> # Samsung
Link: https://lore.kernel.org/r/20240220072213.35779-1-krzysztof.kozlowski@linaro.orgSigned-off-by: default avatarGeorgi Djakov <djakov@kernel.org>
parent 64eec958
...@@ -343,7 +343,7 @@ EXPORT_SYMBOL_GPL(icc_std_aggregate); ...@@ -343,7 +343,7 @@ EXPORT_SYMBOL_GPL(icc_std_aggregate);
* an array of icc nodes specified in the icc_onecell_data struct when * an array of icc nodes specified in the icc_onecell_data struct when
* registering the provider. * registering the provider.
*/ */
struct icc_node *of_icc_xlate_onecell(struct of_phandle_args *spec, struct icc_node *of_icc_xlate_onecell(const struct of_phandle_args *spec,
void *data) void *data)
{ {
struct icc_onecell_data *icc_data = data; struct icc_onecell_data *icc_data = data;
...@@ -368,7 +368,7 @@ EXPORT_SYMBOL_GPL(of_icc_xlate_onecell); ...@@ -368,7 +368,7 @@ EXPORT_SYMBOL_GPL(of_icc_xlate_onecell);
* Returns a valid pointer to struct icc_node_data on success or ERR_PTR() * Returns a valid pointer to struct icc_node_data on success or ERR_PTR()
* on failure. * on failure.
*/ */
struct icc_node_data *of_icc_get_from_provider(struct of_phandle_args *spec) struct icc_node_data *of_icc_get_from_provider(const struct of_phandle_args *spec)
{ {
struct icc_node *node = ERR_PTR(-EPROBE_DEFER); struct icc_node *node = ERR_PTR(-EPROBE_DEFER);
struct icc_node_data *data = NULL; struct icc_node_data *data = NULL;
......
...@@ -9,7 +9,8 @@ ...@@ -9,7 +9,8 @@
#include "icc-common.h" #include "icc-common.h"
struct icc_node_data *qcom_icc_xlate_extended(struct of_phandle_args *spec, void *data) struct icc_node_data *qcom_icc_xlate_extended(const struct of_phandle_args *spec,
void *data)
{ {
struct icc_node_data *ndata; struct icc_node_data *ndata;
struct icc_node *node; struct icc_node *node;
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#include <linux/interconnect-provider.h> #include <linux/interconnect-provider.h>
struct icc_node_data *qcom_icc_xlate_extended(struct of_phandle_args *spec, void *data); struct icc_node_data *qcom_icc_xlate_extended(const struct of_phandle_args *spec,
void *data);
#endif #endif
...@@ -82,7 +82,7 @@ static int exynos_generic_icc_set(struct icc_node *src, struct icc_node *dst) ...@@ -82,7 +82,7 @@ static int exynos_generic_icc_set(struct icc_node *src, struct icc_node *dst)
return 0; return 0;
} }
static struct icc_node *exynos_generic_icc_xlate(struct of_phandle_args *spec, static struct icc_node *exynos_generic_icc_xlate(const struct of_phandle_args *spec,
void *data) void *data)
{ {
struct exynos_icc_priv *priv = data; struct exynos_icc_priv *priv = data;
......
...@@ -755,7 +755,7 @@ const char *const tegra_mc_error_names[8] = { ...@@ -755,7 +755,7 @@ const char *const tegra_mc_error_names[8] = {
[6] = "SMMU translation error", [6] = "SMMU translation error",
}; };
struct icc_node *tegra_mc_icc_xlate(struct of_phandle_args *spec, void *data) struct icc_node *tegra_mc_icc_xlate(const struct of_phandle_args *spec, void *data)
{ {
struct tegra_mc *mc = icc_provider_to_tegra_mc(data); struct tegra_mc *mc = icc_provider_to_tegra_mc(data);
struct icc_node *node; struct icc_node *node;
......
...@@ -1285,7 +1285,7 @@ to_tegra_emc_provider(struct icc_provider *provider) ...@@ -1285,7 +1285,7 @@ to_tegra_emc_provider(struct icc_provider *provider)
} }
static struct icc_node_data * static struct icc_node_data *
emc_of_icc_xlate_extended(struct of_phandle_args *spec, void *data) emc_of_icc_xlate_extended(const struct of_phandle_args *spec, void *data)
{ {
struct icc_provider *provider = data; struct icc_provider *provider = data;
struct icc_node_data *ndata; struct icc_node_data *ndata;
......
...@@ -1170,7 +1170,7 @@ static int tegra124_mc_icc_aggreate(struct icc_node *node, u32 tag, u32 avg_bw, ...@@ -1170,7 +1170,7 @@ static int tegra124_mc_icc_aggreate(struct icc_node *node, u32 tag, u32 avg_bw,
} }
static struct icc_node_data * static struct icc_node_data *
tegra124_mc_of_icc_xlate_extended(struct of_phandle_args *spec, void *data) tegra124_mc_of_icc_xlate_extended(const struct of_phandle_args *spec, void *data)
{ {
struct tegra_mc *mc = icc_provider_to_tegra_mc(data); struct tegra_mc *mc = icc_provider_to_tegra_mc(data);
const struct tegra_mc_client *client; const struct tegra_mc_client *client;
......
...@@ -236,7 +236,7 @@ static int tegra_emc_icc_set_bw(struct icc_node *src, struct icc_node *dst) ...@@ -236,7 +236,7 @@ static int tegra_emc_icc_set_bw(struct icc_node *src, struct icc_node *dst)
} }
static struct icc_node * static struct icc_node *
tegra_emc_of_icc_xlate(struct of_phandle_args *spec, void *data) tegra_emc_of_icc_xlate(const struct of_phandle_args *spec, void *data)
{ {
struct icc_provider *provider = data; struct icc_provider *provider = data;
struct icc_node *node; struct icc_node *node;
......
...@@ -950,7 +950,7 @@ to_tegra_emc_provider(struct icc_provider *provider) ...@@ -950,7 +950,7 @@ to_tegra_emc_provider(struct icc_provider *provider)
} }
static struct icc_node_data * static struct icc_node_data *
emc_of_icc_xlate_extended(struct of_phandle_args *spec, void *data) emc_of_icc_xlate_extended(const struct of_phandle_args *spec, void *data)
{ {
struct icc_provider *provider = data; struct icc_provider *provider = data;
struct icc_node_data *ndata; struct icc_node_data *ndata;
......
...@@ -390,7 +390,7 @@ static int tegra20_mc_icc_aggreate(struct icc_node *node, u32 tag, u32 avg_bw, ...@@ -390,7 +390,7 @@ static int tegra20_mc_icc_aggreate(struct icc_node *node, u32 tag, u32 avg_bw,
} }
static struct icc_node_data * static struct icc_node_data *
tegra20_mc_of_icc_xlate_extended(struct of_phandle_args *spec, void *data) tegra20_mc_of_icc_xlate_extended(const struct of_phandle_args *spec, void *data)
{ {
struct tegra_mc *mc = icc_provider_to_tegra_mc(data); struct tegra_mc *mc = icc_provider_to_tegra_mc(data);
unsigned int i, idx = spec->args[0]; unsigned int i, idx = spec->args[0];
......
...@@ -1468,7 +1468,7 @@ to_tegra_emc_provider(struct icc_provider *provider) ...@@ -1468,7 +1468,7 @@ to_tegra_emc_provider(struct icc_provider *provider)
} }
static struct icc_node_data * static struct icc_node_data *
emc_of_icc_xlate_extended(struct of_phandle_args *spec, void *data) emc_of_icc_xlate_extended(const struct of_phandle_args *spec, void *data)
{ {
struct icc_provider *provider = data; struct icc_provider *provider = data;
struct icc_node_data *ndata; struct icc_node_data *ndata;
......
...@@ -1332,7 +1332,7 @@ static int tegra30_mc_icc_aggreate(struct icc_node *node, u32 tag, u32 avg_bw, ...@@ -1332,7 +1332,7 @@ static int tegra30_mc_icc_aggreate(struct icc_node *node, u32 tag, u32 avg_bw,
} }
static struct icc_node_data * static struct icc_node_data *
tegra30_mc_of_icc_xlate_extended(struct of_phandle_args *spec, void *data) tegra30_mc_of_icc_xlate_extended(const struct of_phandle_args *spec, void *data)
{ {
struct tegra_mc *mc = icc_provider_to_tegra_mc(data); struct tegra_mc *mc = icc_provider_to_tegra_mc(data);
const struct tegra_mc_client *client; const struct tegra_mc_client *client;
......
...@@ -36,7 +36,7 @@ struct icc_onecell_data { ...@@ -36,7 +36,7 @@ struct icc_onecell_data {
struct icc_node *nodes[] __counted_by(num_nodes); struct icc_node *nodes[] __counted_by(num_nodes);
}; };
struct icc_node *of_icc_xlate_onecell(struct of_phandle_args *spec, struct icc_node *of_icc_xlate_onecell(const struct of_phandle_args *spec,
void *data); void *data);
/** /**
...@@ -65,8 +65,9 @@ struct icc_provider { ...@@ -65,8 +65,9 @@ struct icc_provider {
u32 peak_bw, u32 *agg_avg, u32 *agg_peak); u32 peak_bw, u32 *agg_avg, u32 *agg_peak);
void (*pre_aggregate)(struct icc_node *node); void (*pre_aggregate)(struct icc_node *node);
int (*get_bw)(struct icc_node *node, u32 *avg, u32 *peak); int (*get_bw)(struct icc_node *node, u32 *avg, u32 *peak);
struct icc_node* (*xlate)(struct of_phandle_args *spec, void *data); struct icc_node* (*xlate)(const struct of_phandle_args *spec, void *data);
struct icc_node_data* (*xlate_extended)(struct of_phandle_args *spec, void *data); struct icc_node_data* (*xlate_extended)(const struct of_phandle_args *spec,
void *data);
struct device *dev; struct device *dev;
int users; int users;
bool inter_set; bool inter_set;
...@@ -124,7 +125,7 @@ int icc_nodes_remove(struct icc_provider *provider); ...@@ -124,7 +125,7 @@ int icc_nodes_remove(struct icc_provider *provider);
void icc_provider_init(struct icc_provider *provider); void icc_provider_init(struct icc_provider *provider);
int icc_provider_register(struct icc_provider *provider); int icc_provider_register(struct icc_provider *provider);
void icc_provider_deregister(struct icc_provider *provider); void icc_provider_deregister(struct icc_provider *provider);
struct icc_node_data *of_icc_get_from_provider(struct of_phandle_args *spec); struct icc_node_data *of_icc_get_from_provider(const struct of_phandle_args *spec);
void icc_sync_state(struct device *dev); void icc_sync_state(struct device *dev);
#else #else
...@@ -171,7 +172,7 @@ static inline int icc_provider_register(struct icc_provider *provider) ...@@ -171,7 +172,7 @@ static inline int icc_provider_register(struct icc_provider *provider)
static inline void icc_provider_deregister(struct icc_provider *provider) { } static inline void icc_provider_deregister(struct icc_provider *provider) { }
static inline struct icc_node_data *of_icc_get_from_provider(struct of_phandle_args *spec) static inline struct icc_node_data *of_icc_get_from_provider(const struct of_phandle_args *spec)
{ {
return ERR_PTR(-ENOTSUPP); return ERR_PTR(-ENOTSUPP);
} }
......
...@@ -146,13 +146,14 @@ struct tegra_mc_icc_ops { ...@@ -146,13 +146,14 @@ struct tegra_mc_icc_ops {
int (*set)(struct icc_node *src, struct icc_node *dst); int (*set)(struct icc_node *src, struct icc_node *dst);
int (*aggregate)(struct icc_node *node, u32 tag, u32 avg_bw, int (*aggregate)(struct icc_node *node, u32 tag, u32 avg_bw,
u32 peak_bw, u32 *agg_avg, u32 *agg_peak); u32 peak_bw, u32 *agg_avg, u32 *agg_peak);
struct icc_node* (*xlate)(struct of_phandle_args *spec, void *data); struct icc_node* (*xlate)(const struct of_phandle_args *spec, void *data);
struct icc_node_data *(*xlate_extended)(struct of_phandle_args *spec, struct icc_node_data *(*xlate_extended)(const struct of_phandle_args *spec,
void *data); void *data);
int (*get_bw)(struct icc_node *node, u32 *avg, u32 *peak); int (*get_bw)(struct icc_node *node, u32 *avg, u32 *peak);
}; };
struct icc_node *tegra_mc_icc_xlate(struct of_phandle_args *spec, void *data); struct icc_node *tegra_mc_icc_xlate(const struct of_phandle_args *spec,
void *data);
extern const struct tegra_mc_icc_ops tegra_mc_icc_ops; extern const struct tegra_mc_icc_ops tegra_mc_icc_ops;
struct tegra_mc_ops { struct tegra_mc_ops {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment