Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5214f9b7 authored by Junjie Wu's avatar Junjie Wu
Browse files

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: default avatarJunjie Wu <junjiew@codeaurora.org>
parent fa3dfef9
Loading
Loading
Loading
Loading
+18 −2
Original line number Diff line number Diff line
/*
 * 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);
+2 −1
Original line number Diff line number Diff line
/*
 * 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