+static inline int lprocfs_stats_lock(struct lprocfs_stats *stats, int type)
+{
+ int rc = 0;
+
+ if (stats->ls_flags & LPROCFS_STATS_FLAG_NOPERCPU) {
+ if (type & LPROCFS_GET_NUM_CPU)
+ rc = 1;
+ if (type & LPROCFS_GET_SMP_ID)
+ rc = 0;
+ spin_lock(&stats->ls_lock);
+ } else {
+ if (type & LPROCFS_GET_NUM_CPU)
+ rc = num_possible_cpus();
+ if (type & LPROCFS_GET_SMP_ID)
+ rc = smp_processor_id();
+ }
+ return rc;
+}
+
+static inline void lprocfs_stats_unlock(struct lprocfs_stats *stats)
+{
+ if (stats->ls_flags & LPROCFS_STATS_FLAG_NOPERCPU)
+ spin_unlock(&stats->ls_lock);
+}
+