summaryrefslogtreecommitdiff
path: root/drivers/soc
diff options
context:
space:
mode:
authorTapas Kumar Kundu <tkundu@codeaurora.org>2016-03-10 15:15:23 -0800
committerDavid Keitel <dkeitel@codeaurora.org>2016-03-23 21:22:35 -0700
commit03e7659014b7f5f7afc8bed8f1a40b2570363218 (patch)
treeb2895fd75fd6c95dc8385f0c5b3da5288ce7ea97 /drivers/soc
parent5151ee897d65c53123a4c1fe78d872243fe19bcb (diff)
soc: qcom: msm_perf: Replace obsolete cpulist_scnprintf api
Replace obsolete cpulist_scnprintf api with cpumap_print_to_pagebuf for kernel-4.4 Signed-off-by: Tapas Kumar Kundu <tkundu@codeaurora.org>
Diffstat (limited to 'drivers/soc')
-rw-r--r--drivers/soc/qcom/msm_performance.c53
1 files changed, 39 insertions, 14 deletions
diff --git a/drivers/soc/qcom/msm_performance.c b/drivers/soc/qcom/msm_performance.c
index 71f2810713aa..7f03ce4518a6 100644
--- a/drivers/soc/qcom/msm_performance.c
+++ b/drivers/soc/qcom/msm_performance.c
@@ -184,6 +184,7 @@ static struct input_handler *handler;
#define CLUSTER_0_THRESHOLD_FREQ 147000
#define CLUSTER_1_THRESHOLD_FREQ 190000
#define INPUT_EVENT_CNT_THRESHOLD 15
+#define MAX_LENGTH_CPU_STRING 256
@@ -307,20 +308,33 @@ static int set_managed_cpus(const char *buf, const struct kernel_param *kp)
static int get_managed_cpus(char *buf, const struct kernel_param *kp)
{
- int i, cnt = 0;
+ int i, cnt = 0, total_cnt = 0;
+ char tmp[MAX_LENGTH_CPU_STRING];
if (!clusters_inited)
return cnt;
for (i = 0; i < num_clusters; i++) {
- cnt += cpulist_scnprintf(buf + cnt, PAGE_SIZE - cnt,
+ cnt = cpumap_print_to_pagebuf(true, buf,
managed_clusters[i]->cpus);
- if ((i + 1) >= num_clusters)
+ if ((i + 1) < num_clusters &&
+ (total_cnt + cnt + 1) <= MAX_LENGTH_CPU_STRING) {
+ snprintf(tmp + total_cnt, cnt, "%s", buf);
+ tmp[cnt-1] = ':';
+ tmp[cnt] = '\0';
+ total_cnt += cnt;
+ } else if ((i + 1) == num_clusters &&
+ (total_cnt + cnt) <= MAX_LENGTH_CPU_STRING) {
+ snprintf(tmp + total_cnt, cnt, "%s", buf);
+ total_cnt += cnt;
+ } else {
+ pr_err("invalid string for managed_cpu:%s%s\n", tmp,
+ buf);
break;
- cnt += snprintf(buf + cnt, PAGE_SIZE - cnt, ":");
+ }
}
-
- return cnt;
+ snprintf(buf, PAGE_SIZE, "%s", tmp);
+ return total_cnt;
}
static const struct kernel_param_ops param_ops_managed_cpus = {
@@ -332,7 +346,8 @@ device_param_cb(managed_cpus, &param_ops_managed_cpus, NULL, 0644);
/* Read-only node: To display all the online managed CPUs */
static int get_managed_online_cpus(char *buf, const struct kernel_param *kp)
{
- int i, cnt = 0;
+ int i, cnt = 0, total_cnt = 0;
+ char tmp[MAX_LENGTH_CPU_STRING];
struct cpumask tmp_mask;
struct cluster *i_cl;
@@ -346,15 +361,25 @@ static int get_managed_online_cpus(char *buf, const struct kernel_param *kp)
cpumask_complement(&tmp_mask, i_cl->offlined_cpus);
cpumask_and(&tmp_mask, i_cl->cpus, &tmp_mask);
- cnt += cpulist_scnprintf(buf + cnt, PAGE_SIZE - cnt,
- &tmp_mask);
-
- if ((i + 1) >= num_clusters)
+ cnt = cpumap_print_to_pagebuf(true, buf, &tmp_mask);
+ if ((i + 1) < num_clusters &&
+ (total_cnt + cnt + 1) <= MAX_LENGTH_CPU_STRING) {
+ snprintf(tmp + total_cnt, cnt, "%s", buf);
+ tmp[cnt-1] = ':';
+ tmp[cnt] = '\0';
+ total_cnt += cnt;
+ } else if ((i + 1) == num_clusters &&
+ (total_cnt + cnt) <= MAX_LENGTH_CPU_STRING) {
+ snprintf(tmp + total_cnt, cnt, "%s", buf);
+ total_cnt += cnt;
+ } else {
+ pr_err("invalid string for managed_cpu:%s%s\n", tmp,
+ buf);
break;
- cnt += snprintf(buf + cnt, PAGE_SIZE - cnt, ":");
+ }
}
-
- return cnt;
+ snprintf(buf, PAGE_SIZE, "%s", tmp);
+ return total_cnt;
}
static const struct kernel_param_ops param_ops_managed_online_cpus = {