From 745d67d98ac6d4c109c700ef2f7bd149254e3481 Mon Sep 17 00:00:00 2001 From: Liang Chen Date: Tue, 17 Aug 2021 14:17:36 +0800 Subject: [PATCH] cpufreq: rockchip: optimize static memory consume $ ./scripts/bloat-o-meter drivers/cpufreq/rockchip-cpufreq.o.before drivers/cpufreq/rockchip-cpufreq.o add/remove: 0/3 grow/shrink: 0/1 up/down: 0/-2196 (-2196) Function old new delta px30_get_soc_info 208 - -208 rk3399_get_soc_info 360 - -360 rk3288_get_soc_info 648 - -648 rockchip_cpufreq_of_match 1568 588 -980 Total: Before=5053, After=2857, chg -43.46% Change-Id: I7db697bf92ee552b6e3b28211ee64e509e99b0d3 Signed-off-by: Liang Chen --- drivers/cpufreq/rockchip-cpufreq.c | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/drivers/cpufreq/rockchip-cpufreq.c b/drivers/cpufreq/rockchip-cpufreq.c index 173da325ce6d..0a0a44941d29 100644 --- a/drivers/cpufreq/rockchip-cpufreq.c +++ b/drivers/cpufreq/rockchip-cpufreq.c @@ -55,8 +55,9 @@ struct cluster_info { }; static LIST_HEAD(cluster_info_list); -static int px30_get_soc_info(struct device *dev, struct device_node *np, - int *bin, int *process) +static __maybe_unused int px30_get_soc_info(struct device *dev, + struct device_node *np, + int *bin, int *process) { int ret = 0; u8 value = 0; @@ -79,8 +80,9 @@ static int px30_get_soc_info(struct device *dev, struct device_node *np, return ret; } -static int rk3288_get_soc_info(struct device *dev, struct device_node *np, - int *bin, int *process) +static __maybe_unused int rk3288_get_soc_info(struct device *dev, + struct device_node *np, + int *bin, int *process) { int ret = 0; u8 value = 0; @@ -139,8 +141,9 @@ out: return ret; } -static int rk3399_get_soc_info(struct device *dev, struct device_node *np, - int *bin, int *process) +static __maybe_unused int rk3399_get_soc_info(struct device *dev, + struct device_node *np, + int *bin, int *process) { int ret = 0; u8 value = 0; @@ -188,8 +191,9 @@ out: return ret; } -static int rv1126_get_soc_info(struct device *dev, struct device_node *np, - int *bin, int *process) +static __maybe_unused int rv1126_get_soc_info(struct device *dev, + struct device_node *np, + int *bin, int *process) { int ret = 0; u8 value = 0; @@ -212,10 +216,13 @@ static int rv1126_get_soc_info(struct device *dev, struct device_node *np, } static const struct of_device_id rockchip_cpufreq_of_match[] = { +#ifdef CONFIG_CPU_PX30 { .compatible = "rockchip,px30", .data = (void *)&px30_get_soc_info, }, +#endif +#ifdef CONFIG_CPU_RK3288 { .compatible = "rockchip,rk3288", .data = (void *)&rk3288_get_soc_info, @@ -224,14 +231,20 @@ static const struct of_device_id rockchip_cpufreq_of_match[] = { .compatible = "rockchip,rk3288w", .data = (void *)&rk3288_get_soc_info, }, +#endif +#ifdef CONFIG_CPU_PX30 { .compatible = "rockchip,rk3326", .data = (void *)&px30_get_soc_info, }, +#endif +#ifdef CONFIG_CPU_RK3399 { .compatible = "rockchip,rk3399", .data = (void *)&rk3399_get_soc_info, }, +#endif +#ifdef CONFIG_CPU_RV1126 { .compatible = "rockchip,rv1109", .data = (void *)&rv1126_get_soc_info, @@ -240,6 +253,7 @@ static const struct of_device_id rockchip_cpufreq_of_match[] = { .compatible = "rockchip,rv1126", .data = (void *)&rv1126_get_soc_info, }, +#endif {}, };