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
155{155{
156 int i;156 int i;
157 157
158 drv->refcnt = 0;
159
160 /*158 /*
161 * Use all possible CPUs as the default, because if the kernel boots159 * Use all possible CPUs as the default, because if the kernel boots
162 * with some CPUs offline and then we online one of them, the CPU160 * 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
240 */238 */
241static void __cpuidle_unregister_driver(struct cpuidle_driver *drv)239static void __cpuidle_unregister_driver(struct cpuidle_driver *drv)
242{240{
243 if (WARN_ON(drv->refcnt > 0))
244 return;
245
246 if (drv->bctimer) {241 if (drv->bctimer) {
247 drv->bctimer = 0;242 drv->bctimer = 0;
248 on_each_cpu_mask(drv->cpumask, cpuidle_setup_broadcast_timer,243 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
349}344}
350EXPORT_SYMBOL_GPL(cpuidle_get_cpu_driver);345EXPORT_SYMBOL_GPL(cpuidle_get_cpu_driver);
351 346
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 */
360struct 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 */
380void 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
393/**347/**
394 * cpuidle_driver_state_disabled - Disable or enable an idle state348 * cpuidle_driver_state_disabled - Disable or enable an idle state
395 * @drv: cpuidle driver owning the state349 * @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
115struct cpuidle_driver {115struct cpuidle_driver {
116 const char *name;116 const char *name;
117 struct module *owner;117 struct module *owner;
118 int refcnt;
119 118
120 /* used by the cpuidle framework to setup the broadcast timer */119 /* used by the cpuidle framework to setup the broadcast timer */
121 unsigned int bctimer:1;120 unsigned int bctimer:1;
@@ -147,8 +146,6 @@ extern u64 cpuidle_poll_time(struct cpuidle_driver *drv, · 25 unmodified lines
147 146
148extern int cpuidle_register_driver(struct cpuidle_driver *drv);147extern int cpuidle_register_driver(struct cpuidle_driver *drv);
149extern struct cpuidle_driver *cpuidle_get_driver(void);148extern struct cpuidle_driver *cpuidle_get_driver(void);
150extern struct cpuidle_driver *cpuidle_driver_ref(void);
151extern void cpuidle_driver_unref(void);
152extern void cpuidle_driver_state_disabled(struct cpuidle_driver *drv, int idx,149extern void cpuidle_driver_state_disabled(struct cpuidle_driver *drv, int idx,
153 bool disable);150 bool disable);
154extern void cpuidle_unregister_driver(struct cpuidle_driver *drv);151extern 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
186static inline int cpuidle_register_driver(struct cpuidle_driver *drv)183static inline int cpuidle_register_driver(struct cpuidle_driver *drv)
187{return -ENODEV; }184{return -ENODEV; }
188static inline struct cpuidle_driver *cpuidle_get_driver(void) {return NULL; }185static inline struct cpuidle_driver *cpuidle_get_driver(void) {return NULL; }
189static inline struct cpuidle_driver *cpuidle_driver_ref(void) {return NULL; }
190static inline void cpuidle_driver_unref(void) {}
191static inline void cpuidle_driver_state_disabled(struct cpuidle_driver *drv,186static inline void cpuidle_driver_state_disabled(struct cpuidle_driver *drv,
192 int idx, bool disable) { }187 int idx, bool disable) { }
193static inline void cpuidle_unregister_driver(struct cpuidle_driver *drv) { }188static inline void cpuidle_unregister_driver(struct cpuidle_driver *drv) { }