All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mian Yousaf Kaukab <yousaf.kaukab@suse.com>
To: rjw@rjwysocki.net, lenb@kernel.org, viresh.kumar@linaro.org,
	ionela.voinescu@arm.com
Cc: linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-pm@vger.kernel.org, Mian Yousaf Kaukab <ykaukab@suse.de>
Subject: [PATCH 2/2] cpufreq: cppc: convert to a platform driver
Date: Thu, 10 Dec 2020 15:21:39 +0100	[thread overview]
Message-ID: <20201210142139.20490-2-yousaf.kaukab@suse.com> (raw)
In-Reply-To: <20201210142139.20490-1-yousaf.kaukab@suse.com>

From: Mian Yousaf Kaukab <ykaukab@suse.de>

Instead of piggybacking on ACPI_PROCESSOR_DEVICE_HID, convert the driver
to a proper platform driver with its own ID. Driver will only be probed
when cppc-cpufreq device is available.

Fixes: 28f06f770454 ("cppc_cpufreq: replace per-cpu structures with lists")
Signed-off-by: Mian Yousaf Kaukab <ykaukab@suse.de>
---
 drivers/cpufreq/cppc_cpufreq.c | 29 +++++++++++++++--------------
 1 file changed, 15 insertions(+), 14 deletions(-)

diff --git a/drivers/cpufreq/cppc_cpufreq.c b/drivers/cpufreq/cppc_cpufreq.c
index bb4c068601db..defac1dd9a2a 100644
--- a/drivers/cpufreq/cppc_cpufreq.c
+++ b/drivers/cpufreq/cppc_cpufreq.c
@@ -11,13 +11,13 @@
 #define pr_fmt(fmt)	"CPPC Cpufreq:"	fmt
 
 #include <linux/kernel.h>
-#include <linux/module.h>
 #include <linux/delay.h>
 #include <linux/cpu.h>
 #include <linux/cpufreq.h>
 #include <linux/dmi.h>
 #include <linux/time.h>
 #include <linux/vmalloc.h>
+#include <linux/platform_device.h>
 
 #include <asm/unaligned.h>
 
@@ -512,7 +512,7 @@ static void cppc_check_hisi_workaround(void)
 	acpi_put_table(tbl);
 }
 
-static int __init cppc_cpufreq_init(void)
+static int cppc_cpufreq_probe(struct platform_device *pdev)
 {
 	if (acpi_disabled)
 		return -ENODEV;
@@ -533,26 +533,27 @@ static inline void free_cpu_data(void)
 		list_del(&iter->node);
 		kfree(iter);
 	}
-
 }
 
-static void __exit cppc_cpufreq_exit(void)
+static int cppc_cpufreq_remove(struct platform_device *pdev)
 {
 	cpufreq_unregister_driver(&cppc_cpufreq_driver);
 
 	free_cpu_data();
+
+	return 0;
 }
 
-module_exit(cppc_cpufreq_exit);
+static struct platform_driver cppc_cpufreq_platform_driver = {
+	.driver = {
+		.name = "cppc-cpufreq",
+	},
+	.probe = cppc_cpufreq_probe,
+	.remove = cppc_cpufreq_remove,
+};
+module_platform_driver(cppc_cpufreq_platform_driver);
+
+MODULE_ALIAS("platform:cppc-cpufreq");
 MODULE_AUTHOR("Ashwin Chaugule");
 MODULE_DESCRIPTION("CPUFreq driver based on the ACPI CPPC v5.0+ spec");
 MODULE_LICENSE("GPL");
-
-late_initcall(cppc_cpufreq_init);
-
-static const struct acpi_device_id cppc_acpi_ids[] __used = {
-	{ACPI_PROCESSOR_DEVICE_HID, },
-	{}
-};
-
-MODULE_DEVICE_TABLE(acpi, cppc_acpi_ids);
-- 
2.26.2


  reply	other threads:[~2020-12-10 14:24 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-10 14:21 [PATCH 1/2] acpi: cppc: add cpufreq device Mian Yousaf Kaukab
2020-12-10 14:21 ` Mian Yousaf Kaukab [this message]
2020-12-10 14:32 ` Rafael J. Wysocki
2020-12-10 15:02   ` Ionela Voinescu
2020-12-10 15:04   ` Mian Yousaf Kaukab
2020-12-10 16:55     ` Rafael J. Wysocki
2020-12-10 17:23       ` Ionela Voinescu
2020-12-10 18:54         ` Rafael J. Wysocki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201210142139.20490-2-yousaf.kaukab@suse.com \
    --to=yousaf.kaukab@suse.com \
    --cc=ionela.voinescu@arm.com \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=rjw@rjwysocki.net \
    --cc=viresh.kumar@linaro.org \
    --cc=ykaukab@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.