lkml.org 
[lkml]   [2020]   [Dec]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 2/2] cpufreq: cppc: convert to a platform driver
    Date
    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
    \
     
     \ /
      Last update: 2020-12-10 15:26    [W:4.853 / U:0.012 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site