Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp4847109pxu; Thu, 10 Dec 2020 06:58:15 -0800 (PST) X-Google-Smtp-Source: ABdhPJw8NzIbn3MgUzYMk9jUWUzj3fejcmb37b2rwXFK76HcHh4uRxjm2vZMIgds/NLTUuiP6PUf X-Received: by 2002:a17:906:13da:: with SMTP id g26mr6649841ejc.285.1607612295647; Thu, 10 Dec 2020 06:58:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607612295; cv=none; d=google.com; s=arc-20160816; b=lTizSvA9qvOh2aBBZCQYnTCqXtJyLbIqQ9rwfrz+85V/Xq9dKUPQiJAnqAvmAtLetq ai60AoD7RIP0MUGgqbQnaGHxtF/OlEh0Itw4NUDVU67QuUC7gXvyCJxL1HvKTttIUAk9 t2HcKMe7CxNL5rF/yHgOqqmRbn4eBEIb0TEv5A7A1QrBIocIlA/mkEEAPs5K/nPwVQPg Y55c9Vc/LiCrlFk4ifoxeVYGv/MzNElm1zNb6rcNktmVJ/o9z/8a21gdzrfAMKw9AGl1 IP0d+JIvUMjStAN5L/j3yW4+J1T6WJETWGsSrm5+iU1zkiPvW2CQpn/sheiIndS8hUEB UBAA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=cI2dIHenqZhZfuz+AUEF2/qcGKhgN5TrogEWAPJ0ubE=; b=BQSs4BG9+DK73fGXVyb2KLuayIrkmS4dj8dhjumyTxR7JD/BK0XYDKV58mXsCix2Y4 xFa6eCtsiw2r8l6/odcA8NgH55f9bLLtMjFlAIHvSv6KCVEe039YMnI71ZtFnNvjznAW CgDFdJT8wLbUqOJh1bldnsd1SbHI1T4a4yFzcOPZ2PJ5KVCO+xIZ48zvsa8x+diE9GF8 rm8/XsUsl+0GQ219IU8cpHWd2NRBQB+KSEsVsXOrTh8HUN/XkSsfAiUF2IOlh5IAh2Eh uXGb97Q+56+vy0AjeBEUP9NuWxWyxnEmyGNYmBqQfCdw+3w7RSRTe3gN5FINefosUFv4 qvBg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=NQjW7t36; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=suse.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z17si2785472eda.610.2020.12.10.06.57.52; Thu, 10 Dec 2020 06:58:15 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=NQjW7t36; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=suse.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389980AbgLJOYL (ORCPT + 99 others); Thu, 10 Dec 2020 09:24:11 -0500 Received: from mx2.suse.de ([195.135.220.15]:57660 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389923AbgLJOXt (ORCPT ); Thu, 10 Dec 2020 09:23:49 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1607610183; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=cI2dIHenqZhZfuz+AUEF2/qcGKhgN5TrogEWAPJ0ubE=; b=NQjW7t36xxYUr0eeZgcnyS+0nqRGiiCMrYI00xc0oWzdyr2kxmzcvH4AWoVdETVUxENfgk tBogUClmqow860HxIPKyWu5SnZTI7zXz5RjzZtclEokE7T8XMRro+Gmu2tiRlX/+PRLVkm kyv/tRuai+e85hjcuFn9nzzPNt03S70= Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 72F52AEC3; Thu, 10 Dec 2020 14:23:03 +0000 (UTC) From: Mian Yousaf Kaukab 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 Subject: [PATCH 2/2] cpufreq: cppc: convert to a platform driver Date: Thu, 10 Dec 2020 15:21:39 +0100 Message-Id: <20201210142139.20490-2-yousaf.kaukab@suse.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201210142139.20490-1-yousaf.kaukab@suse.com> References: <20201210142139.20490-1-yousaf.kaukab@suse.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Mian Yousaf Kaukab 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 --- 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 -#include #include #include #include #include #include #include +#include #include @@ -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