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.
Unified · Split
| @@ -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 boots | 159 | * 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 CPU | 160 | * 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 | */ |
| 241 | static void __cpuidle_unregister_driver(struct cpuidle_driver *drv) | 239 | static 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 | } |
| 350 | EXPORT_SYMBOL_GPL(cpuidle_get_cpu_driver); | 345 | EXPORT_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 | */ | ||
| 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 | |||
| 393 | /** | 347 | /** |
| 394 | * cpuidle_driver_state_disabled - Disable or enable an idle state | 348 | * cpuidle_driver_state_disabled - Disable or enable an idle state |
| 395 | * @drv: cpuidle driver owning the state | 349 | * @drv: cpuidle driver owning the state |
| @@ -115,7 +115,6 @@ DECLARE_PER_CPU(struct cpuidle_device, cpuidle_dev); · 114 unmodified lines | |||
| 115 | struct cpuidle_driver { | 115 | struct 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 | ||
| 148 | extern int cpuidle_register_driver(struct cpuidle_driver *drv); | 147 | extern int cpuidle_register_driver(struct cpuidle_driver *drv); |
| 149 | extern struct cpuidle_driver *cpuidle_get_driver(void); | 148 | extern struct cpuidle_driver *cpuidle_get_driver(void); |
| 150 | extern struct cpuidle_driver *cpuidle_driver_ref(void); | ||
| 151 | extern void cpuidle_driver_unref(void); | ||
| 152 | extern void cpuidle_driver_state_disabled(struct cpuidle_driver *drv, int idx, | 149 | extern void cpuidle_driver_state_disabled(struct cpuidle_driver *drv, int idx, |
| 153 | bool disable); | 150 | bool disable); |
| 154 | extern void cpuidle_unregister_driver(struct cpuidle_driver *drv); | 151 | 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 | |||
| 186 | static inline int cpuidle_register_driver(struct cpuidle_driver *drv) | 183 | static inline int cpuidle_register_driver(struct cpuidle_driver *drv) |
| 187 | {return -ENODEV; } | 184 | {return -ENODEV; } |
| 188 | static inline struct cpuidle_driver *cpuidle_get_driver(void) {return NULL; } | 185 | 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) {} | ||
| 191 | static inline void cpuidle_driver_state_disabled(struct cpuidle_driver *drv, | 186 | static inline void cpuidle_driver_state_disabled(struct cpuidle_driver *drv, |
| 192 | int idx, bool disable) { } | 187 | int idx, bool disable) { } |
| 193 | static inline void cpuidle_unregister_driver(struct cpuidle_driver *drv) { } | 188 | static inline void cpuidle_unregister_driver(struct cpuidle_driver *drv) { } |