Commit 577a2f41 authored by Rafael J. Wysocki's avatar Rafael J. Wysocki

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.
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
Acked-by: default avatarDaniel Lezcano <daniel.lezcano@linaro.org>
parent 85c3ebd4
...@@ -155,8 +155,6 @@ static void __cpuidle_driver_init(struct cpuidle_driver *drv) ...@@ -155,8 +155,6 @@ static void __cpuidle_driver_init(struct cpuidle_driver *drv)
{ {
int i; int i;
drv->refcnt = 0;
/* /*
* Use all possible CPUs as the default, because if the kernel boots * Use all possible CPUs as the default, because if the kernel boots
* with some CPUs offline and then we online one of them, the CPU * 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) ...@@ -240,9 +238,6 @@ static int __cpuidle_register_driver(struct cpuidle_driver *drv)
*/ */
static void __cpuidle_unregister_driver(struct cpuidle_driver *drv) static void __cpuidle_unregister_driver(struct cpuidle_driver *drv)
{ {
if (WARN_ON(drv->refcnt > 0))
return;
if (drv->bctimer) { if (drv->bctimer) {
drv->bctimer = 0; drv->bctimer = 0;
on_each_cpu_mask(drv->cpumask, cpuidle_setup_broadcast_timer, 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) ...@@ -349,47 +344,6 @@ struct cpuidle_driver *cpuidle_get_cpu_driver(struct cpuidle_device *dev)
} }
EXPORT_SYMBOL_GPL(cpuidle_get_cpu_driver); EXPORT_SYMBOL_GPL(cpuidle_get_cpu_driver);
/**
* cpuidle_driver_ref - get a reference to the driver.
*
* Increment the reference counter of the cpuidle driver associated with
* the current CPU.
*
* Returns a pointer to the driver, or NULL if the current CPU has no driver.
*/
struct cpuidle_driver *cpuidle_driver_ref(void)
{
struct cpuidle_driver *drv;
spin_lock(&cpuidle_driver_lock);
drv = cpuidle_get_driver();
if (drv)
drv->refcnt++;
spin_unlock(&cpuidle_driver_lock);
return drv;
}
/**
* cpuidle_driver_unref - puts down the refcount for the driver
*
* Decrement the reference counter of the cpuidle driver associated with
* the current CPU.
*/
void cpuidle_driver_unref(void)
{
struct cpuidle_driver *drv;
spin_lock(&cpuidle_driver_lock);
drv = cpuidle_get_driver();
if (drv && !WARN_ON(drv->refcnt <= 0))
drv->refcnt--;
spin_unlock(&cpuidle_driver_lock);
}
/** /**
* cpuidle_driver_state_disabled - Disable or enable an idle state * cpuidle_driver_state_disabled - Disable or enable an idle state
* @drv: cpuidle driver owning the state * @drv: cpuidle driver owning the state
......
...@@ -115,7 +115,6 @@ DECLARE_PER_CPU(struct cpuidle_device, cpuidle_dev); ...@@ -115,7 +115,6 @@ DECLARE_PER_CPU(struct cpuidle_device, cpuidle_dev);
struct cpuidle_driver { struct cpuidle_driver {
const char *name; const char *name;
struct module *owner; struct module *owner;
int refcnt;
/* used by the cpuidle framework to setup the broadcast timer */ /* used by the cpuidle framework to setup the broadcast timer */
unsigned int bctimer:1; unsigned int bctimer:1;
...@@ -147,8 +146,6 @@ extern u64 cpuidle_poll_time(struct cpuidle_driver *drv, ...@@ -147,8 +146,6 @@ extern u64 cpuidle_poll_time(struct cpuidle_driver *drv,
extern int cpuidle_register_driver(struct cpuidle_driver *drv); extern int cpuidle_register_driver(struct cpuidle_driver *drv);
extern struct cpuidle_driver *cpuidle_get_driver(void); extern struct cpuidle_driver *cpuidle_get_driver(void);
extern struct cpuidle_driver *cpuidle_driver_ref(void);
extern void cpuidle_driver_unref(void);
extern void cpuidle_driver_state_disabled(struct cpuidle_driver *drv, int idx, extern void cpuidle_driver_state_disabled(struct cpuidle_driver *drv, int idx,
bool disable); bool disable);
extern void cpuidle_unregister_driver(struct cpuidle_driver *drv); extern void cpuidle_unregister_driver(struct cpuidle_driver *drv);
...@@ -186,8 +183,6 @@ static inline u64 cpuidle_poll_time(struct cpuidle_driver *drv, ...@@ -186,8 +183,6 @@ static inline u64 cpuidle_poll_time(struct cpuidle_driver *drv,
static inline int cpuidle_register_driver(struct cpuidle_driver *drv) static inline int cpuidle_register_driver(struct cpuidle_driver *drv)
{return -ENODEV; } {return -ENODEV; }
static inline struct cpuidle_driver *cpuidle_get_driver(void) {return NULL; } static inline struct cpuidle_driver *cpuidle_get_driver(void) {return NULL; }
static inline struct cpuidle_driver *cpuidle_driver_ref(void) {return NULL; }
static inline void cpuidle_driver_unref(void) {}
static inline void cpuidle_driver_state_disabled(struct cpuidle_driver *drv, static inline void cpuidle_driver_state_disabled(struct cpuidle_driver *drv,
int idx, bool disable) { } int idx, bool disable) { }
static inline void cpuidle_unregister_driver(struct cpuidle_driver *drv) { } static inline void cpuidle_unregister_driver(struct cpuidle_driver *drv) { }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment