summaryrefslogtreecommitdiff
path: root/drivers/hwmon/coretemp.c
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2016-11-22 20:42:03 +0300
committerGuenter Roeck <linux@roeck-us.net>2016-12-10 08:54:09 +0300
commit4b138cf73f4548d256f26006a756bc0fe3ad786e (patch)
treeb854b0641622d1bef6126d0c5089cbeb25ec4fea /drivers/hwmon/coretemp.c
parente1b370b64031a01bb0c4158ce250073a88921fe1 (diff)
downloadlinux-4b138cf73f4548d256f26006a756bc0fe3ad786e.tar.xz
hwmon: (coretemp) Avoid redundant lookups
No point in looking up the same thing over and over. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Diffstat (limited to 'drivers/hwmon/coretemp.c')
-rw-r--r--drivers/hwmon/coretemp.c19
1 files changed, 6 insertions, 13 deletions
diff --git a/drivers/hwmon/coretemp.c b/drivers/hwmon/coretemp.c
index cda09cf2e84b..1bcc90a20ed1 100644
--- a/drivers/hwmon/coretemp.c
+++ b/drivers/hwmon/coretemp.c
@@ -533,21 +533,14 @@ exit_free:
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);
- int err;
-
- if (!pdev)
- return;
-
- err = create_core_data(pdev, cpu, pkg_flag);
- if (err)
+ if (create_core_data(pdev, cpu, pkg_flag))
dev_err(&pdev->dev, "Adding Core %u failed\n", cpu);
}
-static void coretemp_remove_core(struct platform_data *pdata,
- int indx)
+static void coretemp_remove_core(struct platform_data *pdata, int indx)
{
struct temp_data *tdata = pdata->core_data[indx];
@@ -692,7 +685,7 @@ static void get_core_online(unsigned int cpu)
* If so, add interfaces for pkgtemp.
*/
if (cpu_has(c, X86_FEATURE_PTS))
- coretemp_add_core(cpu, 1);
+ coretemp_add_core(pdev, cpu, 1);
}
pdata = platform_get_drvdata(pdev);
@@ -701,7 +694,7 @@ static void get_core_online(unsigned int cpu)
* interface for this CPU core.
*/
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);
}