aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon
diff options
context:
space:
mode:
authorGuenter Roeck <guenter.roeck@ericsson.com>2011-05-19 17:45:48 -0400
committerGuenter Roeck <guenter.roeck@ericsson.com>2011-05-21 10:29:17 -0400
commit4cc452758fd250bb5968c583d825bb0e68d65db0 (patch)
treea7377699334474e5f9f963b6b6bb3a37a7fec684 /drivers/hwmon
parent5e99c2f1e0c86d27ed2a5261442126cd0935bc69 (diff)
hwmon: (coretemp) Fix checkpatch errors
Fix remaining checkpatch errors in the coretemp driver. Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com> Cc: Fenghua Yu <fenghua.yu@intel.com> Cc: Durgadoss R <durgadoss.r@intel.com> Acked-by: Jean Delvare <khali@linux-fr.org>
Diffstat (limited to 'drivers/hwmon')
-rw-r--r--drivers/hwmon/coretemp.c67
1 files changed, 37 insertions, 30 deletions
diff --git a/drivers/hwmon/coretemp.c b/drivers/hwmon/coretemp.c
index ece3b7da6538..5c7cd60d5f9d 100644
--- a/drivers/hwmon/coretemp.c
+++ b/drivers/hwmon/coretemp.c
@@ -35,9 +35,9 @@
35#include <linux/platform_device.h> 35#include <linux/platform_device.h>
36#include <linux/cpu.h> 36#include <linux/cpu.h>
37#include <linux/pci.h> 37#include <linux/pci.h>
38#include <linux/smp.h>
38#include <asm/msr.h> 39#include <asm/msr.h>
39#include <asm/processor.h> 40#include <asm/processor.h>
40#include <asm/smp.h>
41 41
42#define DRVNAME "coretemp" 42#define DRVNAME "coretemp"
43 43
@@ -170,7 +170,7 @@ static ssize_t show_temp(struct device *dev,
170 /* Check whether the data is valid */ 170 /* Check whether the data is valid */
171 if (eax & 0x80000000) { 171 if (eax & 0x80000000) {
172 tdata->temp = tdata->tjmax - 172 tdata->temp = tdata->tjmax -
173 (((eax >> 16) & 0x7f) * 1000); 173 ((eax >> 16) & 0x7f) * 1000;
174 tdata->valid = 1; 174 tdata->valid = 1;
175 } 175 }
176 tdata->last_updated = jiffies; 176 tdata->last_updated = jiffies;
@@ -193,9 +193,8 @@ static int adjust_tjmax(struct cpuinfo_x86 *c, u32 id, struct device *dev)
193 193
194 /* Early chips have no MSR for TjMax */ 194 /* Early chips have no MSR for TjMax */
195 195
196 if ((c->x86_model == 0xf) && (c->x86_mask < 4)) { 196 if (c->x86_model == 0xf && c->x86_mask < 4)
197 usemsr_ee = 0; 197 usemsr_ee = 0;
198 }
199 198
200 /* Atom CPUs */ 199 /* Atom CPUs */
201 200
@@ -214,14 +213,14 @@ static int adjust_tjmax(struct cpuinfo_x86 *c, u32 id, struct device *dev)
214 pci_dev_put(host_bridge); 213 pci_dev_put(host_bridge);
215 } 214 }
216 215
217 if ((c->x86_model > 0xe) && (usemsr_ee)) { 216 if (c->x86_model > 0xe && usemsr_ee) {
218 u8 platform_id; 217 u8 platform_id;
219 218
220 /* Now we can detect the mobile CPU using Intel provided table 219 /*
221 http://softwarecommunity.intel.com/Wiki/Mobility/720.htm 220 * Now we can detect the mobile CPU using Intel provided table
222 For Core2 cores, check MSR 0x17, bit 28 1 = Mobile CPU 221 * http://softwarecommunity.intel.com/Wiki/Mobility/720.htm
223 */ 222 * For Core2 cores, check MSR 0x17, bit 28 1 = Mobile CPU
224 223 */
225 err = rdmsr_safe_on_cpu(id, 0x17, &eax, &edx); 224 err = rdmsr_safe_on_cpu(id, 0x17, &eax, &edx);
226 if (err) { 225 if (err) {
227 dev_warn(dev, 226 dev_warn(dev,
@@ -229,20 +228,26 @@ static int adjust_tjmax(struct cpuinfo_x86 *c, u32 id, struct device *dev)
229 " CPU\n"); 228 " CPU\n");
230 usemsr_ee = 0; 229 usemsr_ee = 0;
231 } else if (c->x86_model < 0x17 && !(eax & 0x10000000)) { 230 } else if (c->x86_model < 0x17 && !(eax & 0x10000000)) {
232 /* Trust bit 28 up to Penryn, I could not find any 231 /*
233 documentation on that; if you happen to know 232 * Trust bit 28 up to Penryn, I could not find any
234 someone at Intel please ask */ 233 * documentation on that; if you happen to know
234 * someone at Intel please ask
235 */
235 usemsr_ee = 0; 236 usemsr_ee = 0;
236 } else { 237 } else {
237 /* Platform ID bits 52:50 (EDX starts at bit 32) */ 238 /* Platform ID bits 52:50 (EDX starts at bit 32) */
238 platform_id = (edx >> 18) & 0x7; 239 platform_id = (edx >> 18) & 0x7;
239 240
240 /* Mobile Penryn CPU seems to be platform ID 7 or 5 241 /*
241 (guesswork) */ 242 * Mobile Penryn CPU seems to be platform ID 7 or 5
242 if ((c->x86_model == 0x17) && 243 * (guesswork)
243 ((platform_id == 5) || (platform_id == 7))) { 244 */
244 /* If MSR EE bit is set, set it to 90 degrees C, 245 if (c->x86_model == 0x17 &&
245 otherwise 105 degrees C */ 246 (platform_id == 5 || platform_id == 7)) {
247 /*
248 * If MSR EE bit is set, set it to 90 degrees C,
249 * otherwise 105 degrees C
250 */
246 tjmax_ee = 90000; 251 tjmax_ee = 90000;
247 tjmax = 105000; 252 tjmax = 105000;
248 } 253 }
@@ -250,7 +255,6 @@ static int adjust_tjmax(struct cpuinfo_x86 *c, u32 id, struct device *dev)
250 } 255 }
251 256
252 if (usemsr_ee) { 257 if (usemsr_ee) {
253
254 err = rdmsr_safe_on_cpu(id, 0xee, &eax, &edx); 258 err = rdmsr_safe_on_cpu(id, 0xee, &eax, &edx);
255 if (err) { 259 if (err) {
256 dev_warn(dev, 260 dev_warn(dev,
@@ -259,9 +263,11 @@ static int adjust_tjmax(struct cpuinfo_x86 *c, u32 id, struct device *dev)
259 } else if (eax & 0x40000000) { 263 } else if (eax & 0x40000000) {
260 tjmax = tjmax_ee; 264 tjmax = tjmax_ee;
261 } 265 }
262 /* if we dont use msr EE it means we are desktop CPU (with exeception
263 of Atom) */
264 } else if (tjmax == 100000) { 266 } else if (tjmax == 100000) {
267 /*
268 * If we don't use msr EE it means we are desktop CPU
269 * (with exeception of Atom)
270 */
265 dev_warn(dev, "Using relative temperature scale!\n"); 271 dev_warn(dev, "Using relative temperature scale!\n");
266 } 272 }
267 273
@@ -275,8 +281,10 @@ static int get_tjmax(struct cpuinfo_x86 *c, u32 id, struct device *dev)
275 u32 eax, edx; 281 u32 eax, edx;
276 u32 val; 282 u32 val;
277 283
278 /* A new feature of current Intel(R) processors, the 284 /*
279 IA32_TEMPERATURE_TARGET contains the TjMax value */ 285 * A new feature of current Intel(R) processors, the
286 * IA32_TEMPERATURE_TARGET contains the TjMax value
287 */
280 err = rdmsr_safe_on_cpu(id, MSR_IA32_TEMPERATURE_TARGET, &eax, &edx); 288 err = rdmsr_safe_on_cpu(id, MSR_IA32_TEMPERATURE_TARGET, &eax, &edx);
281 if (err) { 289 if (err) {
282 dev_warn(dev, "Unable to read TjMax from CPU.\n"); 290 dev_warn(dev, "Unable to read TjMax from CPU.\n");
@@ -286,7 +294,7 @@ static int get_tjmax(struct cpuinfo_x86 *c, u32 id, struct device *dev)
286 * If the TjMax is not plausible, an assumption 294 * If the TjMax is not plausible, an assumption
287 * will be used 295 * will be used
288 */ 296 */
289 if ((val > 80) && (val < 120)) { 297 if (val > 80 && val < 120) {
290 dev_info(dev, "TjMax is %d C.\n", val); 298 dev_info(dev, "TjMax is %d C.\n", val);
291 return val * 1000; 299 return val * 1000;
292 } 300 }
@@ -331,7 +339,7 @@ static int get_pkg_tjmax(unsigned int cpu, struct device *dev)
331 err = rdmsr_safe_on_cpu(cpu, MSR_IA32_TEMPERATURE_TARGET, &eax, &edx); 339 err = rdmsr_safe_on_cpu(cpu, MSR_IA32_TEMPERATURE_TARGET, &eax, &edx);
332 if (!err) { 340 if (!err) {
333 val = (eax >> 16) & 0xff; 341 val = (eax >> 16) & 0xff;
334 if ((val > 80) && (val < 120)) 342 if (val > 80 && val < 120)
335 return val * 1000; 343 return val * 1000;
336 } 344 }
337 dev_warn(dev, "Unable to read Pkg-TjMax from CPU:%u\n", cpu); 345 dev_warn(dev, "Unable to read Pkg-TjMax from CPU:%u\n", cpu);
@@ -399,7 +407,7 @@ static void update_ttarget(__u8 cpu_model, struct temp_data *tdata,
399 * on older CPUs but not in this register, 407 * on older CPUs but not in this register,
400 * Atoms don't have it either. 408 * Atoms don't have it either.
401 */ 409 */
402 if ((cpu_model > 0xe) && (cpu_model != 0x1c)) { 410 if (cpu_model > 0xe && cpu_model != 0x1c) {
403 err = rdmsr_safe_on_cpu(tdata->cpu, 411 err = rdmsr_safe_on_cpu(tdata->cpu,
404 MSR_IA32_TEMPERATURE_TARGET, &eax, &edx); 412 MSR_IA32_TEMPERATURE_TARGET, &eax, &edx);
405 if (err) { 413 if (err) {
@@ -407,7 +415,7 @@ static void update_ttarget(__u8 cpu_model, struct temp_data *tdata,
407 "Unable to read IA32_TEMPERATURE_TARGET MSR\n"); 415 "Unable to read IA32_TEMPERATURE_TARGET MSR\n");
408 } else { 416 } else {
409 tdata->ttarget = tdata->tjmax - 417 tdata->ttarget = tdata->tjmax -
410 (((eax >> 8) & 0xff) * 1000); 418 ((eax >> 8) & 0xff) * 1000;
411 } 419 }
412 } 420 }
413} 421}
@@ -423,7 +431,7 @@ static int chk_ucode_version(struct platform_device *pdev)
423 * Readings might stop update when processor visited too deep sleep, 431 * Readings might stop update when processor visited too deep sleep,
424 * fixed for stepping D0 (6EC). 432 * fixed for stepping D0 (6EC).
425 */ 433 */
426 if ((c->x86_model == 0xe) && (c->x86_mask < 0xc)) { 434 if (c->x86_model == 0xe && c->x86_mask < 0xc) {
427 /* check for microcode update */ 435 /* check for microcode update */
428 err = smp_call_function_single(pdev->id, get_ucode_rev_on_cpu, 436 err = smp_call_function_single(pdev->id, get_ucode_rev_on_cpu,
429 &edx, 1); 437 &edx, 1);
@@ -791,7 +799,6 @@ static struct notifier_block coretemp_cpu_notifier __refdata = {
791 .notifier_call = coretemp_cpu_callback, 799 .notifier_call = coretemp_cpu_callback,
792}; 800};
793 801
794
795static int __init coretemp_init(void) 802static int __init coretemp_init(void)
796{ 803{
797 int i, err = -ENODEV; 804 int i, err = -ENODEV;