From: Thomas Gleixner <tglx@linutronix.de>
To: LKML <linux-kernel@vger.kernel.org>
Cc: Fenghua Yu <fenghua.yu@intel.com>,
Jean Delvare <jdelvare@suse.com>,
Guenter Roeck <linux@roeck-us.net>,
linux-hwmon@vger.kernel.org,
Sebastian Siewior <bigeasy@linutronix.de>,
Peter Zijlstra <peterz@infradead.org>,
x86@kernel.org
Subject: [patch 3/6] hwmon/coretemp: Avoid redundant lookups
Date: Tue, 22 Nov 2016 17:42:03 -0000 [thread overview]
Message-ID: <20161122173731.680477115@linutronix.de> (raw)
In-Reply-To: 20161122173622.771252945@linutronix.de
[-- Attachment #1: hwmon-coretemp--Avoid-redundant-lookups.patch --]
[-- Type: text/plain, Size: 1534 bytes --]
No point in looking up the same thing over and over.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
drivers/hwmon/coretemp.c | 19 ++++++-------------
1 file changed, 6 insertions(+), 13 deletions(-)
--- a/drivers/hwmon/coretemp.c
+++ b/drivers/hwmon/coretemp.c
@@ -533,21 +533,14 @@ static int create_core_data(struct platf
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
* 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
* 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);
}
next prev parent reply other threads:[~2016-11-22 17:45 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-22 17:42 [patch 0/6] hwmon/coretemp: Hotplug fixes, cleanups and state machine conversion Thomas Gleixner
2016-11-22 17:42 ` [patch 1/6] hwmon/coretemp: Fixup target cpu for package when cpu is offlined Thomas Gleixner
2016-11-22 17:42 ` [patch 2/6] hwmon/coretemp: Simplify sibling management Thomas Gleixner
2016-11-22 17:42 ` Thomas Gleixner [this message]
2016-11-22 17:42 ` [patch 4/6] [PREEMPT-RT] hwmon/coretemp: Convert to hotplug state machine Thomas Gleixner
2016-11-22 17:42 ` [patch 5/6] hwmon/coretemp: Use proper error codes in cpu online callback Thomas Gleixner
2016-11-22 17:42 ` [patch 6/6] hwmon/coretemp: Simplify package management Thomas Gleixner
2016-11-23 15:28 ` [patch 0/6] hwmon/coretemp: Hotplug fixes, cleanups and state machine conversion Guenter Roeck
2017-04-12 8:31 ` Tommi Rantala
2017-04-12 9:28 ` Thomas Gleixner
2017-04-12 10:43 ` Tommi Rantala
2017-04-12 10:52 ` Thomas Gleixner
2017-04-12 11:00 ` Tommi Rantala
2017-04-12 14:53 ` Thomas Gleixner
2017-04-14 17:35 ` Thomas Gleixner
2017-04-15 17:22 ` Tommi Rantala
2017-04-23 15:01 ` Thomas Gleixner
2017-05-04 15:39 ` Tommi Rantala
2017-05-09 7:16 ` Thomas Gleixner
2017-05-10 13:52 ` Tommi Rantala
2017-05-10 14:01 ` Thomas Gleixner
2017-05-10 14:02 ` Tommi Rantala
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20161122173731.680477115@linutronix.de \
--to=tglx@linutronix.de \
--cc=bigeasy@linutronix.de \
--cc=fenghua.yu@intel.com \
--cc=jdelvare@suse.com \
--cc=linux-hwmon@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@roeck-us.net \
--cc=peterz@infradead.org \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox