Skip to content

Commit 381abb9

Browse files
vireshkrafaeljw
authored andcommitted
cpufreq: stats: Remove locking
The locking isn't required anymore as stats can get updated only from one place at a time. Remove it. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
1 parent 40c3bd4 commit 381abb9

1 file changed

Lines changed: 0 additions & 6 deletions

File tree

drivers/cpufreq/cpufreq_stats.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ struct cpufreq_stats {
1919
unsigned int state_num;
2020
unsigned int last_index;
2121
u64 *time_in_state;
22-
spinlock_t lock;
2322
unsigned int *freq_table;
2423
unsigned int *trans_table;
2524

@@ -41,7 +40,6 @@ static void cpufreq_stats_reset_table(struct cpufreq_stats *stats)
4140
{
4241
unsigned int count = stats->max_state;
4342

44-
spin_lock(&stats->lock);
4543
memset(stats->time_in_state, 0, count * sizeof(u64));
4644
memset(stats->trans_table, 0, count * count * sizeof(int));
4745
stats->last_time = get_jiffies_64();
@@ -50,7 +48,6 @@ static void cpufreq_stats_reset_table(struct cpufreq_stats *stats)
5048
/* Adjust for the time elapsed since reset was requested */
5149
WRITE_ONCE(stats->reset_pending, 0);
5250
cpufreq_stats_update(stats, READ_ONCE(stats->reset_time));
53-
spin_unlock(&stats->lock);
5451
}
5552

5653
static ssize_t show_total_trans(struct cpufreq_policy *policy, char *buf)
@@ -244,7 +241,6 @@ void cpufreq_stats_create_table(struct cpufreq_policy *policy)
244241
stats->state_num = i;
245242
stats->last_time = get_jiffies_64();
246243
stats->last_index = freq_table_get_index(stats, policy->cur);
247-
spin_lock_init(&stats->lock);
248244

249245
policy->stats = stats;
250246
ret = sysfs_create_group(&policy->kobj, &stats_attr_group);
@@ -277,11 +273,9 @@ void cpufreq_stats_record_transition(struct cpufreq_policy *policy,
277273
if (old_index == -1 || new_index == -1 || old_index == new_index)
278274
return;
279275

280-
spin_lock(&stats->lock);
281276
cpufreq_stats_update(stats, stats->last_time);
282277

283278
stats->last_index = new_index;
284279
stats->trans_table[old_index * stats->max_state + new_index]++;
285280
stats->total_trans++;
286-
spin_unlock(&stats->lock);
287281
}

0 commit comments

Comments
 (0)