From cd284ae36b6a43d478261bcb7c001db07e3a0ed5 Mon Sep 17 00:00:00 2001 From: Yangtao Li Date: Sat, 16 Feb 2019 10:55:26 -0500 Subject: cpufreq: pcc-cpufreq: remove unneeded semicolon The semicolon is unneeded, so remove it. Signed-off-by: Yangtao Li Signed-off-by: Viresh Kumar --- drivers/cpufreq/pcc-cpufreq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers') diff --git a/drivers/cpufreq/pcc-cpufreq.c b/drivers/cpufreq/pcc-cpufreq.c index 099a849396f6..1e5e64643c3a 100644 --- a/drivers/cpufreq/pcc-cpufreq.c +++ b/drivers/cpufreq/pcc-cpufreq.c @@ -268,7 +268,7 @@ static int pcc_get_offset(int cpu) if (!pccp || pccp->type != ACPI_TYPE_PACKAGE) { ret = -ENODEV; goto out_free; - }; + } offset = &(pccp->package.elements[0]); if (!offset || offset->type != ACPI_TYPE_INTEGER) { -- cgit v1.2.3-59-g8ed1b From 2814335cb3c8b364dcc740b6317bd3297e81995c Mon Sep 17 00:00:00 2001 From: Yangtao Li Date: Sat, 16 Feb 2019 10:55:27 -0500 Subject: cpufreq: longhaul: remove unneeded semicolon The semicolon is unneeded, so remove it. Signed-off-by: Yangtao Li Signed-off-by: Viresh Kumar --- drivers/cpufreq/longhaul.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers') diff --git a/drivers/cpufreq/longhaul.c b/drivers/cpufreq/longhaul.c index 279bd9e9fa95..fb546e0d0356 100644 --- a/drivers/cpufreq/longhaul.c +++ b/drivers/cpufreq/longhaul.c @@ -851,7 +851,7 @@ static int longhaul_cpu_init(struct cpufreq_policy *policy) case TYPE_POWERSAVER: pr_cont("Powersaver supported\n"); break; - }; + } /* Doesn't hurt */ longhaul_setup_southbridge(); -- cgit v1.2.3-59-g8ed1b From 5ae06c237fd05a1e9acf6f35891cfd85de792521 Mon Sep 17 00:00:00 2001 From: Yangtao Li Date: Sat, 16 Feb 2019 12:06:23 -0500 Subject: cpufreq: powernv: fix missing check of return value in init_powernv_pstates() kmalloc() could fail, so insert a check of its return value. And if it fails, returns -ENOMEM. And remove (struct pstate_idx_revmap_data *) to fix coccinelle WARNING by the way. WARNING: casting value returned by memory allocation function to (struct pstate_idx_revmap_data *) is useless. Signed-off-by: Yangtao Li Signed-off-by: Viresh Kumar --- drivers/cpufreq/powernv-cpufreq.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'drivers') diff --git a/drivers/cpufreq/powernv-cpufreq.c b/drivers/cpufreq/powernv-cpufreq.c index 7e7ad3879c4e..d2230812fa4b 100644 --- a/drivers/cpufreq/powernv-cpufreq.c +++ b/drivers/cpufreq/powernv-cpufreq.c @@ -244,6 +244,7 @@ static int init_powernv_pstates(void) u32 len_ids, len_freqs; u32 pstate_min, pstate_max, pstate_nominal; u32 pstate_turbo, pstate_ultra_turbo; + int rc = -ENODEV; power_mgt = of_find_node_by_path("/ibm,opal/power-mgt"); if (!power_mgt) { @@ -327,8 +328,11 @@ next: powernv_freqs[i].frequency = freq * 1000; /* kHz */ powernv_freqs[i].driver_data = id & 0xFF; - revmap_data = (struct pstate_idx_revmap_data *) - kmalloc(sizeof(*revmap_data), GFP_KERNEL); + revmap_data = kmalloc(sizeof(*revmap_data), GFP_KERNEL); + if (!revmap_data) { + rc = -ENOMEM; + goto out; + } revmap_data->pstate_id = id & 0xFF; revmap_data->cpufreq_table_idx = i; @@ -357,7 +361,7 @@ next: return 0; out: of_node_put(power_mgt); - return -ENODEV; + return rc; } /* Returns the CPU frequency corresponding to the pstate_id. */ -- cgit v1.2.3-59-g8ed1b From d6c8e086e9d98a591a6b515078cb0e05fb538b5c Mon Sep 17 00:00:00 2001 From: Yangtao Li Date: Sat, 16 Feb 2019 11:15:01 -0500 Subject: cpufreq: speedstep: convert BUG() to BUG_ON() To fix coccinelle WARNING. WARNING: Use BUG_ON instead of if condition followed by BUG. Signed-off-by: Yangtao Li Signed-off-by: Viresh Kumar --- drivers/cpufreq/speedstep-ich.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'drivers') diff --git a/drivers/cpufreq/speedstep-ich.c b/drivers/cpufreq/speedstep-ich.c index fbbcb88db061..5d8a09b82efb 100644 --- a/drivers/cpufreq/speedstep-ich.c +++ b/drivers/cpufreq/speedstep-ich.c @@ -243,8 +243,7 @@ static unsigned int speedstep_get(unsigned int cpu) unsigned int speed; /* You're supposed to ensure CPU is online. */ - if (smp_call_function_single(cpu, get_freq_data, &speed, 1) != 0) - BUG(); + BUG_ON(smp_call_function_single(cpu, get_freq_data, &speed, 1)); pr_debug("detected %u kHz as current frequency\n", speed); return speed; -- cgit v1.2.3-59-g8ed1b From 40b46b3b2f098e3740f65024099a7c55ff4b9866 Mon Sep 17 00:00:00 2001 From: Bartosz Golaszewski Date: Thu, 14 Feb 2019 18:05:05 +0100 Subject: cpufreq: davinci: move configuration to include/linux/platform_data The header containing the configuration structure for davinci cpufreq driver lives in mach-davinci/include/mach/. This is fine for now but if we want to make davinci part of the multi_v5 build, no code external to mach-davinci should include machine-specific headers. Move the configuration structure to include/linux/platform_data. While we're at it: convert the GPL-2.0 boilerplate to a proper SPDX license identifier. Signed-off-by: Bartosz Golaszewski Acked-by: Sekhar Nori Signed-off-by: Viresh Kumar --- arch/arm/mach-davinci/da850.c | 2 +- arch/arm/mach-davinci/include/mach/cpufreq.h | 26 -------------------------- drivers/cpufreq/davinci-cpufreq.c | 5 +---- include/linux/platform_data/davinci-cpufreq.h | 19 +++++++++++++++++++ 4 files changed, 21 insertions(+), 31 deletions(-) delete mode 100644 arch/arm/mach-davinci/include/mach/cpufreq.h create mode 100644 include/linux/platform_data/davinci-cpufreq.h (limited to 'drivers') diff --git a/arch/arm/mach-davinci/da850.c b/arch/arm/mach-davinci/da850.c index e7b78df2bfef..a02ff431ba47 100644 --- a/arch/arm/mach-davinci/da850.c +++ b/arch/arm/mach-davinci/da850.c @@ -21,6 +21,7 @@ #include #include #include +#include #include #include #include @@ -29,7 +30,6 @@ #include #include -#include #include #include #include diff --git a/arch/arm/mach-davinci/include/mach/cpufreq.h b/arch/arm/mach-davinci/include/mach/cpufreq.h deleted file mode 100644 index 3c089cfb6cd6..000000000000 --- a/arch/arm/mach-davinci/include/mach/cpufreq.h +++ /dev/null @@ -1,26 +0,0 @@ -/* - * TI DaVinci CPUFreq platform support. - * - * Copyright (C) 2009 Texas Instruments, Inc. http://www.ti.com/ - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation version 2. - * - * This program is distributed "as is" WITHOUT ANY WARRANTY of any - * kind, whether express or implied; without even the implied warranty - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - */ -#ifndef _MACH_DAVINCI_CPUFREQ_H -#define _MACH_DAVINCI_CPUFREQ_H - -#include - -struct davinci_cpufreq_config { - struct cpufreq_frequency_table *freq_table; - int (*set_voltage) (unsigned int index); - int (*init) (void); -}; - -#endif diff --git a/drivers/cpufreq/davinci-cpufreq.c b/drivers/cpufreq/davinci-cpufreq.c index d54a27c99121..940fe85db97a 100644 --- a/drivers/cpufreq/davinci-cpufreq.c +++ b/drivers/cpufreq/davinci-cpufreq.c @@ -23,13 +23,10 @@ #include #include #include +#include #include #include -#include -#include -#include - struct davinci_cpufreq { struct device *dev; struct clk *armclk; diff --git a/include/linux/platform_data/davinci-cpufreq.h b/include/linux/platform_data/davinci-cpufreq.h new file mode 100644 index 000000000000..3fbf9f2793b5 --- /dev/null +++ b/include/linux/platform_data/davinci-cpufreq.h @@ -0,0 +1,19 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * TI DaVinci CPUFreq platform support. + * + * Copyright (C) 2009 Texas Instruments, Inc. http://www.ti.com/ + */ + +#ifndef _MACH_DAVINCI_CPUFREQ_H +#define _MACH_DAVINCI_CPUFREQ_H + +#include + +struct davinci_cpufreq_config { + struct cpufreq_frequency_table *freq_table; + int (*set_voltage)(unsigned int index); + int (*init)(void); +}; + +#endif /* _MACH_DAVINCI_CPUFREQ_H */ -- cgit v1.2.3-59-g8ed1b