qcom: core_ctl_helper: Add wrapper for CPU hotplug

Different kernel version needs to use different kernel APIs for
hotplug. Add wrapper for CPU hotplug so that external module can be
used across different kernel releases.

Use device_online/offline() API for CPU hotplug.

Change-Id: Id21855f4ddc62bc9e9e6b45a856c245fd18d1514
Signed-off-by: Junjie Wu <junjiew@codeaurora.org>
This commit is contained in:
Junjie Wu 2015-11-17 11:36:00 -08:00 committed by David Keitel
parent bcbb9ead97
commit f4c9a4a1f9
2 changed files with 20 additions and 3 deletions

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2014, The Linux Foundation. All rights reserved.
* Copyright (c) 2014-2015, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
@ -57,6 +57,22 @@ EXPORT_SYMBOL(core_ctl_find_cpu_device);
int __ref core_ctl_online_core(unsigned int cpu)
{
return cpu_up(cpu);
int ret;
lock_device_hotplug();
ret = device_online(get_cpu_device(cpu));
unlock_device_hotplug();
return ret;
}
EXPORT_SYMBOL(core_ctl_online_core);
int __ref core_ctl_offline_core(unsigned int cpu)
{
int ret;
lock_device_hotplug();
ret = device_offline(get_cpu_device(cpu));
unlock_device_hotplug();
return ret;
}
EXPORT_SYMBOL(core_ctl_offline_core);

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2014, The Linux Foundation. All rights reserved.
* Copyright (c) 2014-2015, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
@ -21,5 +21,6 @@ extern struct cpufreq_policy *core_ctl_get_policy(int cpu);
extern void core_ctl_put_policy(struct cpufreq_policy *policy);
extern struct device *core_ctl_find_cpu_device(unsigned cpu);
extern int core_ctl_online_core(unsigned int cpu);
extern int core_ctl_offline_core(unsigned int cpu);
#endif