Commit 4b138cf7 authored by Thomas Gleixner's avatar Thomas Gleixner Committed by Guenter Roeck

hwmon: (coretemp) Avoid redundant lookups

No point in looking up the same thing over and over.
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
parent e1b370b6
...@@ -533,21 +533,14 @@ static int create_core_data(struct platform_device *pdev, unsigned int cpu, ...@@ -533,21 +533,14 @@ static int create_core_data(struct platform_device *pdev, unsigned int cpu,
return err; return err;
} }
static void coretemp_add_core(unsigned int cpu, int pkg_flag) static void
coretemp_add_core(struct platform_device *pdev, unsigned int cpu, int pkg_flag)
{ {
struct platform_device *pdev = coretemp_get_pdev(cpu); if (create_core_data(pdev, cpu, pkg_flag))
int err;
if (!pdev)
return;
err = create_core_data(pdev, cpu, pkg_flag);
if (err)
dev_err(&pdev->dev, "Adding Core %u failed\n", cpu); dev_err(&pdev->dev, "Adding Core %u failed\n", cpu);
} }
static void coretemp_remove_core(struct platform_data *pdata, static void coretemp_remove_core(struct platform_data *pdata, int indx)
int indx)
{ {
struct temp_data *tdata = pdata->core_data[indx]; struct temp_data *tdata = pdata->core_data[indx];
...@@ -692,7 +685,7 @@ static void get_core_online(unsigned int cpu) ...@@ -692,7 +685,7 @@ static void get_core_online(unsigned int cpu)
* If so, add interfaces for pkgtemp. * If so, add interfaces for pkgtemp.
*/ */
if (cpu_has(c, X86_FEATURE_PTS)) if (cpu_has(c, X86_FEATURE_PTS))
coretemp_add_core(cpu, 1); coretemp_add_core(pdev, cpu, 1);
} }
pdata = platform_get_drvdata(pdev); pdata = platform_get_drvdata(pdev);
...@@ -701,7 +694,7 @@ static void get_core_online(unsigned int cpu) ...@@ -701,7 +694,7 @@ static void get_core_online(unsigned int cpu)
* interface for this CPU core. * interface for this CPU core.
*/ */
if (!cpumask_intersects(&pdata->cpumask, topology_sibling_cpumask(cpu))) if (!cpumask_intersects(&pdata->cpumask, topology_sibling_cpumask(cpu)))
coretemp_add_core(cpu, 0); coretemp_add_core(pdev, cpu, 0);
cpumask_set_cpu(cpu, &pdata->cpumask); cpumask_set_cpu(cpu, &pdata->cpumask);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment