History

cpuidle: Drop unused cpuidle_driver_ref/unref() functions

The cpuidle_driver_ref() and cpuidle_driver_unref() functions are not used and the refcnt field in struct cpuidle_driver operated by them is not updated anywhere else (so it is permanently equal to 0), so drop both of them along with refcnt.

Rafael J. Wysocki committed 6 years ago

Commit 577a2f41 parent 85c3ebd2 files · +0 −51Browse files

Unified · Split

2 files
  1. drivers/cpuidle/driver.c +0 −46
  2. include/linux/cpuidle.h +0 −5
drivers/cpuidle/driver.c+0−46
@@ -155,8 +155,6 @@ static void __cpuidle_driver_init(struct cpuidle_driver *drv) · 154 unmodified lines
155155 {
156156 int i;
157157
158− drv->refcnt = 0;
159−
160158 /*
161159 * Use all possible CPUs as the default, because if the kernel boots
162160 * with some CPUs offline and then we online one of them, the CPU
@@ -240,9 +238,6 @@ static int __cpuidle_register_driver(struct cpuidle_driver *drv) · 77 unmodified lines
240238 */
241239 static void __cpuidle_unregister_driver(struct cpuidle_driver *drv)
242240 {
243− if (WARN_ON(drv->refcnt > 0))
244− return;
245−
246241 if (drv->bctimer) {
247242 drv->bctimer = 0;
248243 on_each_cpu_mask(drv->cpumask, cpuidle_setup_broadcast_timer,
@@ -349,47 +344,6 @@ struct cpuidle_driver *cpuidle_get_cpu_driver(struct cpuidle_device *dev) · 100 unmodified lines
349344 }
350345 EXPORT_SYMBOL_GPL(cpuidle_get_cpu_driver);
351346
352−/**
353− * cpuidle_driver_ref - get a reference to the driver.
354− *
355− * Increment the reference counter of the cpuidle driver associated with
356− * the current CPU.
357− *
358− * Returns a pointer to the driver, or NULL if the current CPU has no driver.
359− */
360−struct cpuidle_driver *cpuidle_driver_ref(void)
361−{
362− struct cpuidle_driver *drv;
363−
364− spin_lock(&cpuidle_driver_lock);
365−
366− drv = cpuidle_get_driver();
367− if (drv)
368− drv->refcnt++;
369−
370− spin_unlock(&cpuidle_driver_lock);
371− return drv;
372−}
373−
374−/**
375− * cpuidle_driver_unref - puts down the refcount for the driver
376− *
377− * Decrement the reference counter of the cpuidle driver associated with
378− * the current CPU.
379− */
380−void cpuidle_driver_unref(void)
381−{
382− struct cpuidle_driver *drv;
383−
384− spin_lock(&cpuidle_driver_lock);
385−
386− drv = cpuidle_get_driver();
387− if (drv && !WARN_ON(drv->refcnt <= 0))
388− drv->refcnt--;
389−
390− spin_unlock(&cpuidle_driver_lock);
391−}
392−
393347 /**
394348 * cpuidle_driver_state_disabled - Disable or enable an idle state
395349 * @drv: cpuidle driver owning the state
include/linux/cpuidle.h+0−5
@@ -115,7 +115,6 @@ DECLARE_PER_CPU(struct cpuidle_device, cpuidle_dev); · 114 unmodified lines
115115 struct cpuidle_driver {
116116 const char *name;
117117 struct module *owner;
118− int refcnt;
119118
120119 /* used by the cpuidle framework to setup the broadcast timer */
121120 unsigned int bctimer:1;
@@ -147,8 +146,6 @@ extern u64 cpuidle_poll_time(struct cpuidle_driver *drv, · 25 unmodified lines
147146
148147 extern int cpuidle_register_driver(struct cpuidle_driver *drv);
149148 extern struct cpuidle_driver *cpuidle_get_driver(void);
150−extern struct cpuidle_driver *cpuidle_driver_ref(void);
151−extern void cpuidle_driver_unref(void);
152149 extern void cpuidle_driver_state_disabled(struct cpuidle_driver *drv, int idx,
153150 bool disable);
154151 extern void cpuidle_unregister_driver(struct cpuidle_driver *drv);
@@ -186,8 +183,6 @@ static inline u64 cpuidle_poll_time(struct cpuidle_driver *drv, · 31 unmodified lines
186183 static inline int cpuidle_register_driver(struct cpuidle_driver *drv)
187184 {return -ENODEV; }
188185 static inline struct cpuidle_driver *cpuidle_get_driver(void) {return NULL; }
189−static inline struct cpuidle_driver *cpuidle_driver_ref(void) {return NULL; }
190−static inline void cpuidle_driver_unref(void) {}
191186 static inline void cpuidle_driver_state_disabled(struct cpuidle_driver *drv,
192187 int idx, bool disable) { }
193188 static inline void cpuidle_unregister_driver(struct cpuidle_driver *drv) { }