Skip to content

Commit 5ad7346

Browse files
aff-tarrafaeljw
authored andcommitted
cpufreq: kryo: Add module remove and exit
Add device remove and module exit code to make the driver functioning as a loadable module. Fixes: ac28927 (cpufreq: kryo: allow building as a loadable module) Signed-off-by: Ilia Lin <ilia.lin@gmail.com> Acked-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
1 parent ee3dbcf commit 5ad7346

File tree

1 file changed

+19
-3
lines changed

1 file changed

+19
-3
lines changed

drivers/cpufreq/qcom-cpufreq-kryo.c

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ enum _msm8996_version {
4242
NUM_OF_MSM8996_VERSIONS,
4343
};
4444

45+
struct platform_device *cpufreq_dt_pdev, *kryo_cpufreq_pdev;
46+
4547
static enum _msm8996_version __init qcom_cpufreq_kryo_get_msm_id(void)
4648
{
4749
size_t len;
@@ -74,7 +76,6 @@ static enum _msm8996_version __init qcom_cpufreq_kryo_get_msm_id(void)
7476
static int qcom_cpufreq_kryo_probe(struct platform_device *pdev)
7577
{
7678
struct opp_table *opp_tables[NR_CPUS] = {0};
77-
struct platform_device *cpufreq_dt_pdev;
7879
enum _msm8996_version msm8996_version;
7980
struct nvmem_cell *speedbin_nvmem;
8081
struct device_node *np;
@@ -165,8 +166,15 @@ static int qcom_cpufreq_kryo_probe(struct platform_device *pdev)
165166
return ret;
166167
}
167168

169+
static int qcom_cpufreq_kryo_remove(struct platform_device *pdev)
170+
{
171+
platform_device_unregister(cpufreq_dt_pdev);
172+
return 0;
173+
}
174+
168175
static struct platform_driver qcom_cpufreq_kryo_driver = {
169176
.probe = qcom_cpufreq_kryo_probe,
177+
.remove = qcom_cpufreq_kryo_remove,
170178
.driver = {
171179
.name = "qcom-cpufreq-kryo",
172180
},
@@ -201,8 +209,9 @@ static int __init qcom_cpufreq_kryo_init(void)
201209
if (unlikely(ret < 0))
202210
return ret;
203211

204-
ret = PTR_ERR_OR_ZERO(platform_device_register_simple(
205-
"qcom-cpufreq-kryo", -1, NULL, 0));
212+
kryo_cpufreq_pdev = platform_device_register_simple(
213+
"qcom-cpufreq-kryo", -1, NULL, 0);
214+
ret = PTR_ERR_OR_ZERO(kryo_cpufreq_pdev);
206215
if (0 == ret)
207216
return 0;
208217

@@ -211,5 +220,12 @@ static int __init qcom_cpufreq_kryo_init(void)
211220
}
212221
module_init(qcom_cpufreq_kryo_init);
213222

223+
static void __init qcom_cpufreq_kryo_exit(void)
224+
{
225+
platform_device_unregister(kryo_cpufreq_pdev);
226+
platform_driver_unregister(&qcom_cpufreq_kryo_driver);
227+
}
228+
module_exit(qcom_cpufreq_kryo_exit);
229+
214230
MODULE_DESCRIPTION("Qualcomm Technologies, Inc. Kryo CPUfreq driver");
215231
MODULE_LICENSE("GPL v2");

0 commit comments

Comments
 (0)