On Tue, Nov 17, 2015 at 06:03:25PM +0000, Suzuki K. Poulose wrote:
+static void __maybe_unused
+pmu_disable_counters(struct cci_pmu *cci_pmu, unsigned long *mask)
+{
+ int i;
+
+ for (i = 0; i < cci_pmu->num_cntrs; i++) {
+ if (pmu_counter_is_enabled(cci_pmu, i)) {
+ set_bit(i, mask);
+ pmu_disable_counter(cci_pmu, i);
+ } else
+ clear_bit(i, mask);
Can we not assume a clean mask to begin with?
+ }
+}
+
+/*
+ * Restore the status of the counters. Reversal of the pmu_disable_counters().
+ * For each counter set in the mask, enable the counter back.
+ */
+static void __maybe_unused
+pmu_restore_counters(struct cci_pmu *cci_pmu, unsigned long *mask)
This would probably be better with s/restore/enable/ for consistency
with pmu_disable_counters.
Other than that this looks fine to me.