diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2011-09-26 16:35:43 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-09-26 16:35:43 -0400 |
commit | ef82bdc57a204bf452da9f7c273c21462f17344e (patch) | |
tree | a4e53f30c976a0c7cf224ec5114a210eec177b41 /drivers | |
parent | 231e58e7d9494bddbd05479f9f50ed0be66794d7 (diff) | |
parent | 2f1c3db0a6adcfd12d556afa3605d4923658b307 (diff) |
Merge branch 'hwmon-for-linus' of git://github.com/groeck/linux
* 'hwmon-for-linus' of git://github.com/groeck/linux:
hwmon: (coretemp) remove struct platform_data * parameter from create_core_data()
hwmon: (coretemp) constify static data
hwmon: (coretemp) don't use kernel assigned CPU number as platform device ID
hwmon: (ds620) Fix handling of negative temperatures
hwmon: (w83791d) rename prototype parameter from 'register' to 'reg'
hwmon: (coretemp) Don't use threshold registers for tempX_max
hwmon: (coretemp) Let the user force TjMax
hwmon: (coretemp) Drop duplicate function get_pkg_tjmax
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/hwmon/coretemp.c | 193 | ||||
-rw-r--r-- | drivers/hwmon/ds620.c | 2 | ||||
-rw-r--r-- | drivers/hwmon/w83791d.c | 4 |
3 files changed, 43 insertions, 156 deletions
diff --git a/drivers/hwmon/coretemp.c b/drivers/hwmon/coretemp.c index 411257676133..44b23917d4cc 100644 --- a/drivers/hwmon/coretemp.c +++ b/drivers/hwmon/coretemp.c | |||
@@ -36,17 +36,25 @@ | |||
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 <linux/smp.h> |
39 | #include <linux/moduleparam.h> | ||
39 | #include <asm/msr.h> | 40 | #include <asm/msr.h> |
40 | #include <asm/processor.h> | 41 | #include <asm/processor.h> |
41 | 42 | ||
42 | #define DRVNAME "coretemp" | 43 | #define DRVNAME "coretemp" |
43 | 44 | ||
45 | /* | ||
46 | * force_tjmax only matters when TjMax can't be read from the CPU itself. | ||
47 | * When set, it replaces the driver's suboptimal heuristic. | ||
48 | */ | ||
49 | static int force_tjmax; | ||
50 | module_param_named(tjmax, force_tjmax, int, 0444); | ||
51 | MODULE_PARM_DESC(tjmax, "TjMax value in degrees Celsius"); | ||
52 | |||
44 | #define BASE_SYSFS_ATTR_NO 2 /* Sysfs Base attr no for coretemp */ | 53 | #define BASE_SYSFS_ATTR_NO 2 /* Sysfs Base attr no for coretemp */ |
45 | #define NUM_REAL_CORES 16 /* Number of Real cores per cpu */ | 54 | #define NUM_REAL_CORES 16 /* Number of Real cores per cpu */ |
46 | #define CORETEMP_NAME_LENGTH 17 /* String Length of attrs */ | 55 | #define CORETEMP_NAME_LENGTH 17 /* String Length of attrs */ |
47 | #define MAX_CORE_ATTRS 4 /* Maximum no of basic attrs */ | 56 | #define MAX_CORE_ATTRS 4 /* Maximum no of basic attrs */ |
48 | #define MAX_THRESH_ATTRS 3 /* Maximum no of Threshold attrs */ | 57 | #define TOTAL_ATTRS (MAX_CORE_ATTRS + 1) |
49 | #define TOTAL_ATTRS (MAX_CORE_ATTRS + MAX_THRESH_ATTRS) | ||
50 | #define MAX_CORE_DATA (NUM_REAL_CORES + BASE_SYSFS_ATTR_NO) | 58 | #define MAX_CORE_DATA (NUM_REAL_CORES + BASE_SYSFS_ATTR_NO) |
51 | 59 | ||
52 | #ifdef CONFIG_SMP | 60 | #ifdef CONFIG_SMP |
@@ -69,8 +77,6 @@ | |||
69 | * This value is passed as "id" field to rdmsr/wrmsr functions. | 77 | * This value is passed as "id" field to rdmsr/wrmsr functions. |
70 | * @status_reg: One of IA32_THERM_STATUS or IA32_PACKAGE_THERM_STATUS, | 78 | * @status_reg: One of IA32_THERM_STATUS or IA32_PACKAGE_THERM_STATUS, |
71 | * from where the temperature values should be read. | 79 | * from where the temperature values should be read. |
72 | * @intrpt_reg: One of IA32_THERM_INTERRUPT or IA32_PACKAGE_THERM_INTERRUPT, | ||
73 | * from where the thresholds are read. | ||
74 | * @attr_size: Total number of pre-core attrs displayed in the sysfs. | 80 | * @attr_size: Total number of pre-core attrs displayed in the sysfs. |
75 | * @is_pkg_data: If this is 1, the temp_data holds pkgtemp data. | 81 | * @is_pkg_data: If this is 1, the temp_data holds pkgtemp data. |
76 | * Otherwise, temp_data holds coretemp data. | 82 | * Otherwise, temp_data holds coretemp data. |
@@ -79,13 +85,11 @@ | |||
79 | struct temp_data { | 85 | struct temp_data { |
80 | int temp; | 86 | int temp; |
81 | int ttarget; | 87 | int ttarget; |
82 | int tmin; | ||
83 | int tjmax; | 88 | int tjmax; |
84 | unsigned long last_updated; | 89 | unsigned long last_updated; |
85 | unsigned int cpu; | 90 | unsigned int cpu; |
86 | u32 cpu_core_id; | 91 | u32 cpu_core_id; |
87 | u32 status_reg; | 92 | u32 status_reg; |
88 | u32 intrpt_reg; | ||
89 | int attr_size; | 93 | int attr_size; |
90 | bool is_pkg_data; | 94 | bool is_pkg_data; |
91 | bool valid; | 95 | bool valid; |
@@ -143,19 +147,6 @@ static ssize_t show_crit_alarm(struct device *dev, | |||
143 | return sprintf(buf, "%d\n", (eax >> 5) & 1); | 147 | return sprintf(buf, "%d\n", (eax >> 5) & 1); |
144 | } | 148 | } |
145 | 149 | ||
146 | static ssize_t show_max_alarm(struct device *dev, | ||
147 | struct device_attribute *devattr, char *buf) | ||
148 | { | ||
149 | u32 eax, edx; | ||
150 | struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); | ||
151 | struct platform_data *pdata = dev_get_drvdata(dev); | ||
152 | struct temp_data *tdata = pdata->core_data[attr->index]; | ||
153 | |||
154 | rdmsr_on_cpu(tdata->cpu, tdata->status_reg, &eax, &edx); | ||
155 | |||
156 | return sprintf(buf, "%d\n", !!(eax & THERM_STATUS_THRESHOLD1)); | ||
157 | } | ||
158 | |||
159 | static ssize_t show_tjmax(struct device *dev, | 150 | static ssize_t show_tjmax(struct device *dev, |
160 | struct device_attribute *devattr, char *buf) | 151 | struct device_attribute *devattr, char *buf) |
161 | { | 152 | { |
@@ -174,83 +165,6 @@ static ssize_t show_ttarget(struct device *dev, | |||
174 | return sprintf(buf, "%d\n", pdata->core_data[attr->index]->ttarget); | 165 | return sprintf(buf, "%d\n", pdata->core_data[attr->index]->ttarget); |
175 | } | 166 | } |
176 | 167 | ||
177 | static ssize_t store_ttarget(struct device *dev, | ||
178 | struct device_attribute *devattr, | ||
179 | const char *buf, size_t count) | ||
180 | { | ||
181 | struct platform_data *pdata = dev_get_drvdata(dev); | ||
182 | struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); | ||
183 | struct temp_data *tdata = pdata->core_data[attr->index]; | ||
184 | u32 eax, edx; | ||
185 | unsigned long val; | ||
186 | int diff; | ||
187 | |||
188 | if (strict_strtoul(buf, 10, &val)) | ||
189 | return -EINVAL; | ||
190 | |||
191 | /* | ||
192 | * THERM_MASK_THRESHOLD1 is 7 bits wide. Values are entered in terms | ||
193 | * of milli degree celsius. Hence don't accept val > (127 * 1000) | ||
194 | */ | ||
195 | if (val > tdata->tjmax || val > 127000) | ||
196 | return -EINVAL; | ||
197 | |||
198 | diff = (tdata->tjmax - val) / 1000; | ||
199 | |||
200 | mutex_lock(&tdata->update_lock); | ||
201 | rdmsr_on_cpu(tdata->cpu, tdata->intrpt_reg, &eax, &edx); | ||
202 | eax = (eax & ~THERM_MASK_THRESHOLD1) | | ||
203 | (diff << THERM_SHIFT_THRESHOLD1); | ||
204 | wrmsr_on_cpu(tdata->cpu, tdata->intrpt_reg, eax, edx); | ||
205 | tdata->ttarget = val; | ||
206 | mutex_unlock(&tdata->update_lock); | ||
207 | |||
208 | return count; | ||
209 | } | ||
210 | |||
211 | static ssize_t show_tmin(struct device *dev, | ||
212 | struct device_attribute *devattr, char *buf) | ||
213 | { | ||
214 | struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); | ||
215 | struct platform_data *pdata = dev_get_drvdata(dev); | ||
216 | |||
217 | return sprintf(buf, "%d\n", pdata->core_data[attr->index]->tmin); | ||
218 | } | ||
219 | |||
220 | static ssize_t store_tmin(struct device *dev, | ||
221 | struct device_attribute *devattr, | ||
222 | const char *buf, size_t count) | ||
223 | { | ||
224 | struct platform_data *pdata = dev_get_drvdata(dev); | ||
225 | struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); | ||
226 | struct temp_data *tdata = pdata->core_data[attr->index]; | ||
227 | u32 eax, edx; | ||
228 | unsigned long val; | ||
229 | int diff; | ||
230 | |||
231 | if (strict_strtoul(buf, 10, &val)) | ||
232 | return -EINVAL; | ||
233 | |||
234 | /* | ||
235 | * THERM_MASK_THRESHOLD0 is 7 bits wide. Values are entered in terms | ||
236 | * of milli degree celsius. Hence don't accept val > (127 * 1000) | ||
237 | */ | ||
238 | if (val > tdata->tjmax || val > 127000) | ||
239 | return -EINVAL; | ||
240 | |||
241 | diff = (tdata->tjmax - val) / 1000; | ||
242 | |||
243 | mutex_lock(&tdata->update_lock); | ||
244 | rdmsr_on_cpu(tdata->cpu, tdata->intrpt_reg, &eax, &edx); | ||
245 | eax = (eax & ~THERM_MASK_THRESHOLD0) | | ||
246 | (diff << THERM_SHIFT_THRESHOLD0); | ||
247 | wrmsr_on_cpu(tdata->cpu, tdata->intrpt_reg, eax, edx); | ||
248 | tdata->tmin = val; | ||
249 | mutex_unlock(&tdata->update_lock); | ||
250 | |||
251 | return count; | ||
252 | } | ||
253 | |||
254 | static ssize_t show_temp(struct device *dev, | 168 | static ssize_t show_temp(struct device *dev, |
255 | struct device_attribute *devattr, char *buf) | 169 | struct device_attribute *devattr, char *buf) |
256 | { | 170 | { |
@@ -374,7 +288,6 @@ static int adjust_tjmax(struct cpuinfo_x86 *c, u32 id, struct device *dev) | |||
374 | 288 | ||
375 | static int get_tjmax(struct cpuinfo_x86 *c, u32 id, struct device *dev) | 289 | static int get_tjmax(struct cpuinfo_x86 *c, u32 id, struct device *dev) |
376 | { | 290 | { |
377 | /* The 100C is default for both mobile and non mobile CPUs */ | ||
378 | int err; | 291 | int err; |
379 | u32 eax, edx; | 292 | u32 eax, edx; |
380 | u32 val; | 293 | u32 val; |
@@ -385,7 +298,8 @@ static int get_tjmax(struct cpuinfo_x86 *c, u32 id, struct device *dev) | |||
385 | */ | 298 | */ |
386 | err = rdmsr_safe_on_cpu(id, MSR_IA32_TEMPERATURE_TARGET, &eax, &edx); | 299 | err = rdmsr_safe_on_cpu(id, MSR_IA32_TEMPERATURE_TARGET, &eax, &edx); |
387 | if (err) { | 300 | if (err) { |
388 | dev_warn(dev, "Unable to read TjMax from CPU.\n"); | 301 | if (c->x86_model > 0xe && c->x86_model != 0x1c) |
302 | dev_warn(dev, "Unable to read TjMax from CPU %u\n", id); | ||
389 | } else { | 303 | } else { |
390 | val = (eax >> 16) & 0xff; | 304 | val = (eax >> 16) & 0xff; |
391 | /* | 305 | /* |
@@ -393,11 +307,17 @@ static int get_tjmax(struct cpuinfo_x86 *c, u32 id, struct device *dev) | |||
393 | * will be used | 307 | * will be used |
394 | */ | 308 | */ |
395 | if (val) { | 309 | if (val) { |
396 | dev_info(dev, "TjMax is %d C.\n", val); | 310 | dev_dbg(dev, "TjMax is %d degrees C\n", val); |
397 | return val * 1000; | 311 | return val * 1000; |
398 | } | 312 | } |
399 | } | 313 | } |
400 | 314 | ||
315 | if (force_tjmax) { | ||
316 | dev_notice(dev, "TjMax forced to %d degrees C by user\n", | ||
317 | force_tjmax); | ||
318 | return force_tjmax * 1000; | ||
319 | } | ||
320 | |||
401 | /* | 321 | /* |
402 | * An assumption is made for early CPUs and unreadable MSR. | 322 | * An assumption is made for early CPUs and unreadable MSR. |
403 | * NOTE: the calculated value may not be correct. | 323 | * NOTE: the calculated value may not be correct. |
@@ -414,21 +334,6 @@ static void __devinit get_ucode_rev_on_cpu(void *edx) | |||
414 | rdmsr(MSR_IA32_UCODE_REV, eax, *(u32 *)edx); | 334 | rdmsr(MSR_IA32_UCODE_REV, eax, *(u32 *)edx); |
415 | } | 335 | } |
416 | 336 | ||
417 | static int get_pkg_tjmax(unsigned int cpu, struct device *dev) | ||
418 | { | ||
419 | int err; | ||
420 | u32 eax, edx, val; | ||
421 | |||
422 | err = rdmsr_safe_on_cpu(cpu, MSR_IA32_TEMPERATURE_TARGET, &eax, &edx); | ||
423 | if (!err) { | ||
424 | val = (eax >> 16) & 0xff; | ||
425 | if (val) | ||
426 | return val * 1000; | ||
427 | } | ||
428 | dev_warn(dev, "Unable to read Pkg-TjMax from CPU:%u\n", cpu); | ||
429 | return 100000; /* Default TjMax: 100 degree celsius */ | ||
430 | } | ||
431 | |||
432 | static int create_name_attr(struct platform_data *pdata, struct device *dev) | 337 | static int create_name_attr(struct platform_data *pdata, struct device *dev) |
433 | { | 338 | { |
434 | sysfs_attr_init(&pdata->name_attr.attr); | 339 | sysfs_attr_init(&pdata->name_attr.attr); |
@@ -442,19 +347,14 @@ static int create_core_attrs(struct temp_data *tdata, struct device *dev, | |||
442 | int attr_no) | 347 | int attr_no) |
443 | { | 348 | { |
444 | int err, i; | 349 | int err, i; |
445 | static ssize_t (*rd_ptr[TOTAL_ATTRS]) (struct device *dev, | 350 | static ssize_t (*const rd_ptr[TOTAL_ATTRS]) (struct device *dev, |
446 | struct device_attribute *devattr, char *buf) = { | 351 | struct device_attribute *devattr, char *buf) = { |
447 | show_label, show_crit_alarm, show_temp, show_tjmax, | 352 | show_label, show_crit_alarm, show_temp, show_tjmax, |
448 | show_max_alarm, show_ttarget, show_tmin }; | 353 | show_ttarget }; |
449 | static ssize_t (*rw_ptr[TOTAL_ATTRS]) (struct device *dev, | 354 | static const char *const names[TOTAL_ATTRS] = { |
450 | struct device_attribute *devattr, const char *buf, | ||
451 | size_t count) = { NULL, NULL, NULL, NULL, NULL, | ||
452 | store_ttarget, store_tmin }; | ||
453 | static const char *names[TOTAL_ATTRS] = { | ||
454 | "temp%d_label", "temp%d_crit_alarm", | 355 | "temp%d_label", "temp%d_crit_alarm", |
455 | "temp%d_input", "temp%d_crit", | 356 | "temp%d_input", "temp%d_crit", |
456 | "temp%d_max_alarm", "temp%d_max", | 357 | "temp%d_max" }; |
457 | "temp%d_max_hyst" }; | ||
458 | 358 | ||
459 | for (i = 0; i < tdata->attr_size; i++) { | 359 | for (i = 0; i < tdata->attr_size; i++) { |
460 | snprintf(tdata->attr_name[i], CORETEMP_NAME_LENGTH, names[i], | 360 | snprintf(tdata->attr_name[i], CORETEMP_NAME_LENGTH, names[i], |
@@ -462,10 +362,6 @@ static int create_core_attrs(struct temp_data *tdata, struct device *dev, | |||
462 | sysfs_attr_init(&tdata->sd_attrs[i].dev_attr.attr); | 362 | sysfs_attr_init(&tdata->sd_attrs[i].dev_attr.attr); |
463 | tdata->sd_attrs[i].dev_attr.attr.name = tdata->attr_name[i]; | 363 | tdata->sd_attrs[i].dev_attr.attr.name = tdata->attr_name[i]; |
464 | tdata->sd_attrs[i].dev_attr.attr.mode = S_IRUGO; | 364 | tdata->sd_attrs[i].dev_attr.attr.mode = S_IRUGO; |
465 | if (rw_ptr[i]) { | ||
466 | tdata->sd_attrs[i].dev_attr.attr.mode |= S_IWUSR; | ||
467 | tdata->sd_attrs[i].dev_attr.store = rw_ptr[i]; | ||
468 | } | ||
469 | tdata->sd_attrs[i].dev_attr.show = rd_ptr[i]; | 365 | tdata->sd_attrs[i].dev_attr.show = rd_ptr[i]; |
470 | tdata->sd_attrs[i].index = attr_no; | 366 | tdata->sd_attrs[i].index = attr_no; |
471 | err = device_create_file(dev, &tdata->sd_attrs[i].dev_attr); | 367 | err = device_create_file(dev, &tdata->sd_attrs[i].dev_attr); |
@@ -538,8 +434,6 @@ static struct temp_data *init_temp_data(unsigned int cpu, int pkg_flag) | |||
538 | 434 | ||
539 | tdata->status_reg = pkg_flag ? MSR_IA32_PACKAGE_THERM_STATUS : | 435 | tdata->status_reg = pkg_flag ? MSR_IA32_PACKAGE_THERM_STATUS : |
540 | MSR_IA32_THERM_STATUS; | 436 | MSR_IA32_THERM_STATUS; |
541 | tdata->intrpt_reg = pkg_flag ? MSR_IA32_PACKAGE_THERM_INTERRUPT : | ||
542 | MSR_IA32_THERM_INTERRUPT; | ||
543 | tdata->is_pkg_data = pkg_flag; | 437 | tdata->is_pkg_data = pkg_flag; |
544 | tdata->cpu = cpu; | 438 | tdata->cpu = cpu; |
545 | tdata->cpu_core_id = TO_CORE_ID(cpu); | 439 | tdata->cpu_core_id = TO_CORE_ID(cpu); |
@@ -548,11 +442,11 @@ static struct temp_data *init_temp_data(unsigned int cpu, int pkg_flag) | |||
548 | return tdata; | 442 | return tdata; |
549 | } | 443 | } |
550 | 444 | ||
551 | static int create_core_data(struct platform_data *pdata, | 445 | static int create_core_data(struct platform_device *pdev, |
552 | struct platform_device *pdev, | ||
553 | unsigned int cpu, int pkg_flag) | 446 | unsigned int cpu, int pkg_flag) |
554 | { | 447 | { |
555 | struct temp_data *tdata; | 448 | struct temp_data *tdata; |
449 | struct platform_data *pdata = platform_get_drvdata(pdev); | ||
556 | struct cpuinfo_x86 *c = &cpu_data(cpu); | 450 | struct cpuinfo_x86 *c = &cpu_data(cpu); |
557 | u32 eax, edx; | 451 | u32 eax, edx; |
558 | int err, attr_no; | 452 | int err, attr_no; |
@@ -588,25 +482,21 @@ static int create_core_data(struct platform_data *pdata, | |||
588 | goto exit_free; | 482 | goto exit_free; |
589 | 483 | ||
590 | /* We can access status register. Get Critical Temperature */ | 484 | /* We can access status register. Get Critical Temperature */ |
591 | if (pkg_flag) | 485 | tdata->tjmax = get_tjmax(c, cpu, &pdev->dev); |
592 | tdata->tjmax = get_pkg_tjmax(pdev->id, &pdev->dev); | ||
593 | else | ||
594 | tdata->tjmax = get_tjmax(c, cpu, &pdev->dev); | ||
595 | 486 | ||
596 | /* | 487 | /* |
597 | * Test if we can access the intrpt register. If so, increase the | 488 | * Read the still undocumented bits 8:15 of IA32_TEMPERATURE_TARGET. |
598 | * 'size' enough to have ttarget/tmin/max_alarm interfaces. | 489 | * The target temperature is available on older CPUs but not in this |
599 | * Initialize ttarget with bits 16:22 of MSR_IA32_THERM_INTERRUPT | 490 | * register. Atoms don't have the register at all. |
600 | */ | 491 | */ |
601 | err = rdmsr_safe_on_cpu(cpu, tdata->intrpt_reg, &eax, &edx); | 492 | if (c->x86_model > 0xe && c->x86_model != 0x1c) { |
602 | if (!err) { | 493 | err = rdmsr_safe_on_cpu(cpu, MSR_IA32_TEMPERATURE_TARGET, |
603 | tdata->attr_size += MAX_THRESH_ATTRS; | 494 | &eax, &edx); |
604 | tdata->tmin = tdata->tjmax - | 495 | if (!err) { |
605 | ((eax & THERM_MASK_THRESHOLD0) >> | 496 | tdata->ttarget |
606 | THERM_SHIFT_THRESHOLD0) * 1000; | 497 | = tdata->tjmax - ((eax >> 8) & 0xff) * 1000; |
607 | tdata->ttarget = tdata->tjmax - | 498 | tdata->attr_size++; |
608 | ((eax & THERM_MASK_THRESHOLD1) >> | 499 | } |
609 | THERM_SHIFT_THRESHOLD1) * 1000; | ||
610 | } | 500 | } |
611 | 501 | ||
612 | pdata->core_data[attr_no] = tdata; | 502 | pdata->core_data[attr_no] = tdata; |
@@ -624,16 +514,13 @@ exit_free: | |||
624 | 514 | ||
625 | static void coretemp_add_core(unsigned int cpu, int pkg_flag) | 515 | static void coretemp_add_core(unsigned int cpu, int pkg_flag) |
626 | { | 516 | { |
627 | struct platform_data *pdata; | ||
628 | struct platform_device *pdev = coretemp_get_pdev(cpu); | 517 | struct platform_device *pdev = coretemp_get_pdev(cpu); |
629 | int err; | 518 | int err; |
630 | 519 | ||
631 | if (!pdev) | 520 | if (!pdev) |
632 | return; | 521 | return; |
633 | 522 | ||
634 | pdata = platform_get_drvdata(pdev); | 523 | err = create_core_data(pdev, cpu, pkg_flag); |
635 | |||
636 | err = create_core_data(pdata, pdev, cpu, pkg_flag); | ||
637 | if (err) | 524 | if (err) |
638 | dev_err(&pdev->dev, "Adding Core %u failed\n", cpu); | 525 | dev_err(&pdev->dev, "Adding Core %u failed\n", cpu); |
639 | } | 526 | } |
@@ -671,7 +558,7 @@ static int __devinit coretemp_probe(struct platform_device *pdev) | |||
671 | if (err) | 558 | if (err) |
672 | goto exit_free; | 559 | goto exit_free; |
673 | 560 | ||
674 | pdata->phys_proc_id = TO_PHYS_ID(pdev->id); | 561 | pdata->phys_proc_id = pdev->id; |
675 | platform_set_drvdata(pdev, pdata); | 562 | platform_set_drvdata(pdev, pdata); |
676 | 563 | ||
677 | pdata->hwmon_dev = hwmon_device_register(&pdev->dev); | 564 | pdata->hwmon_dev = hwmon_device_register(&pdev->dev); |
@@ -723,7 +610,7 @@ static int __cpuinit coretemp_device_add(unsigned int cpu) | |||
723 | 610 | ||
724 | mutex_lock(&pdev_list_mutex); | 611 | mutex_lock(&pdev_list_mutex); |
725 | 612 | ||
726 | pdev = platform_device_alloc(DRVNAME, cpu); | 613 | pdev = platform_device_alloc(DRVNAME, TO_PHYS_ID(cpu)); |
727 | if (!pdev) { | 614 | if (!pdev) { |
728 | err = -ENOMEM; | 615 | err = -ENOMEM; |
729 | pr_err("Device allocation failed\n"); | 616 | pr_err("Device allocation failed\n"); |
diff --git a/drivers/hwmon/ds620.c b/drivers/hwmon/ds620.c index 257957c69d92..4f7c3fc40a89 100644 --- a/drivers/hwmon/ds620.c +++ b/drivers/hwmon/ds620.c | |||
@@ -72,7 +72,7 @@ struct ds620_data { | |||
72 | char valid; /* !=0 if following fields are valid */ | 72 | char valid; /* !=0 if following fields are valid */ |
73 | unsigned long last_updated; /* In jiffies */ | 73 | unsigned long last_updated; /* In jiffies */ |
74 | 74 | ||
75 | u16 temp[3]; /* Register values, word */ | 75 | s16 temp[3]; /* Register values, word */ |
76 | }; | 76 | }; |
77 | 77 | ||
78 | /* | 78 | /* |
diff --git a/drivers/hwmon/w83791d.c b/drivers/hwmon/w83791d.c index 17cf1ab95521..8c2844e5691c 100644 --- a/drivers/hwmon/w83791d.c +++ b/drivers/hwmon/w83791d.c | |||
@@ -329,8 +329,8 @@ static int w83791d_detect(struct i2c_client *client, | |||
329 | struct i2c_board_info *info); | 329 | struct i2c_board_info *info); |
330 | static int w83791d_remove(struct i2c_client *client); | 330 | static int w83791d_remove(struct i2c_client *client); |
331 | 331 | ||
332 | static int w83791d_read(struct i2c_client *client, u8 register); | 332 | static int w83791d_read(struct i2c_client *client, u8 reg); |
333 | static int w83791d_write(struct i2c_client *client, u8 register, u8 value); | 333 | static int w83791d_write(struct i2c_client *client, u8 reg, u8 value); |
334 | static struct w83791d_data *w83791d_update_device(struct device *dev); | 334 | static struct w83791d_data *w83791d_update_device(struct device *dev); |
335 | 335 | ||
336 | #ifdef DEBUG | 336 | #ifdef DEBUG |