aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorGuenter Roeck <linux@roeck-us.net>2013-03-13 19:40:39 -0400
committerGuenter Roeck <linux@roeck-us.net>2013-04-08 00:16:40 -0400
commit088ce2ac9ebac5c74faf4d39083627875fa6f0f0 (patch)
tree4e62aa545bf3fc762ec35538799dcfc24751e769 /drivers
parent236d9039480059f97dc9d3cd75e3651582b62997 (diff)
hwmon: Fix CamelCase checkpatch warnings
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/hwmon/ads7871.c42
-rw-r--r--drivers/hwmon/asc7621.c56
-rw-r--r--drivers/hwmon/da9052-hwmon.c14
-rw-r--r--drivers/hwmon/da9055-hwmon.c4
-rw-r--r--drivers/hwmon/it87.c24
-rw-r--r--drivers/hwmon/lm93.c38
-rw-r--r--drivers/hwmon/ntc_thermistor.c216
-rw-r--r--drivers/hwmon/via686a.c38
8 files changed, 216 insertions, 216 deletions
diff --git a/drivers/hwmon/ads7871.c b/drivers/hwmon/ads7871.c
index a79875986f91..3eff73b6220d 100644
--- a/drivers/hwmon/ads7871.c
+++ b/drivers/hwmon/ads7871.c
@@ -40,25 +40,25 @@
40 * the instruction byte 40 * the instruction byte
41 */ 41 */
42/*Instruction Bit masks*/ 42/*Instruction Bit masks*/
43#define INST_MODE_bm (1<<7) 43#define INST_MODE_BM (1 << 7)
44#define INST_READ_bm (1<<6) 44#define INST_READ_BM (1 << 6)
45#define INST_16BIT_bm (1<<5) 45#define INST_16BIT_BM (1 << 5)
46 46
47/*From figure 18 in the datasheet*/ 47/*From figure 18 in the datasheet*/
48/*bit masks for Rev/Oscillator Control Register*/ 48/*bit masks for Rev/Oscillator Control Register*/
49#define MUX_CNV_bv 7 49#define MUX_CNV_BV 7
50#define MUX_CNV_bm (1<<MUX_CNV_bv) 50#define MUX_CNV_BM (1 << MUX_CNV_BV)
51#define MUX_M3_bm (1<<3) /*M3 selects single ended*/ 51#define MUX_M3_BM (1 << 3) /*M3 selects single ended*/
52#define MUX_G_bv 4 /*allows for reg = (gain << MUX_G_bv) | ...*/ 52#define MUX_G_BV 4 /*allows for reg = (gain << MUX_G_BV) | ...*/
53 53
54/*From figure 18 in the datasheet*/ 54/*From figure 18 in the datasheet*/
55/*bit masks for Rev/Oscillator Control Register*/ 55/*bit masks for Rev/Oscillator Control Register*/
56#define OSC_OSCR_bm (1<<5) 56#define OSC_OSCR_BM (1 << 5)
57#define OSC_OSCE_bm (1<<4) 57#define OSC_OSCE_BM (1 << 4)
58#define OSC_REFE_bm (1<<3) 58#define OSC_REFE_BM (1 << 3)
59#define OSC_BUFE_bm (1<<2) 59#define OSC_BUFE_BM (1 << 2)
60#define OSC_R2V_bm (1<<1) 60#define OSC_R2V_BM (1 << 1)
61#define OSC_RBG_bm (1<<0) 61#define OSC_RBG_BM (1 << 0)
62 62
63#include <linux/module.h> 63#include <linux/module.h>
64#include <linux/init.h> 64#include <linux/init.h>
@@ -79,7 +79,7 @@ struct ads7871_data {
79static int ads7871_read_reg8(struct spi_device *spi, int reg) 79static int ads7871_read_reg8(struct spi_device *spi, int reg)
80{ 80{
81 int ret; 81 int ret;
82 reg = reg | INST_READ_bm; 82 reg = reg | INST_READ_BM;
83 ret = spi_w8r8(spi, reg); 83 ret = spi_w8r8(spi, reg);
84 return ret; 84 return ret;
85} 85}
@@ -87,7 +87,7 @@ static int ads7871_read_reg8(struct spi_device *spi, int reg)
87static int ads7871_read_reg16(struct spi_device *spi, int reg) 87static int ads7871_read_reg16(struct spi_device *spi, int reg)
88{ 88{
89 int ret; 89 int ret;
90 reg = reg | INST_READ_bm | INST_16BIT_bm; 90 reg = reg | INST_READ_BM | INST_16BIT_BM;
91 ret = spi_w8r16(spi, reg); 91 ret = spi_w8r16(spi, reg);
92 return ret; 92 return ret;
93} 93}
@@ -111,13 +111,13 @@ static ssize_t show_voltage(struct device *dev,
111 * TODO: add support for conversions 111 * TODO: add support for conversions
112 * other than single ended with a gain of 1 112 * other than single ended with a gain of 1
113 */ 113 */
114 /*MUX_M3_bm forces single ended*/ 114 /*MUX_M3_BM forces single ended*/
115 /*This is also where the gain of the PGA would be set*/ 115 /*This is also where the gain of the PGA would be set*/
116 ads7871_write_reg8(spi, REG_GAIN_MUX, 116 ads7871_write_reg8(spi, REG_GAIN_MUX,
117 (MUX_CNV_bm | MUX_M3_bm | channel)); 117 (MUX_CNV_BM | MUX_M3_BM | channel));
118 118
119 ret = ads7871_read_reg8(spi, REG_GAIN_MUX); 119 ret = ads7871_read_reg8(spi, REG_GAIN_MUX);
120 mux_cnv = ((ret & MUX_CNV_bm)>>MUX_CNV_bv); 120 mux_cnv = ((ret & MUX_CNV_BM) >> MUX_CNV_BV);
121 /* 121 /*
122 * on 400MHz arm9 platform the conversion 122 * on 400MHz arm9 platform the conversion
123 * is already done when we do this test 123 * is already done when we do this test
@@ -125,14 +125,14 @@ static ssize_t show_voltage(struct device *dev,
125 while ((i < 2) && mux_cnv) { 125 while ((i < 2) && mux_cnv) {
126 i++; 126 i++;
127 ret = ads7871_read_reg8(spi, REG_GAIN_MUX); 127 ret = ads7871_read_reg8(spi, REG_GAIN_MUX);
128 mux_cnv = ((ret & MUX_CNV_bm)>>MUX_CNV_bv); 128 mux_cnv = ((ret & MUX_CNV_BM) >> MUX_CNV_BV);
129 msleep_interruptible(1); 129 msleep_interruptible(1);
130 } 130 }
131 131
132 if (mux_cnv == 0) { 132 if (mux_cnv == 0) {
133 val = ads7871_read_reg16(spi, REG_LS_BYTE); 133 val = ads7871_read_reg16(spi, REG_LS_BYTE);
134 /*result in volts*10000 = (val/8192)*2.5*10000*/ 134 /*result in volts*10000 = (val/8192)*2.5*10000*/
135 val = ((val>>2) * 25000) / 8192; 135 val = ((val >> 2) * 25000) / 8192;
136 return sprintf(buf, "%d\n", val); 136 return sprintf(buf, "%d\n", val);
137 } else { 137 } else {
138 return -1; 138 return -1;
@@ -189,7 +189,7 @@ static int ads7871_probe(struct spi_device *spi)
189 ads7871_write_reg8(spi, REG_SER_CONTROL, 0); 189 ads7871_write_reg8(spi, REG_SER_CONTROL, 0);
190 ads7871_write_reg8(spi, REG_AD_CONTROL, 0); 190 ads7871_write_reg8(spi, REG_AD_CONTROL, 0);
191 191
192 val = (OSC_OSCR_bm | OSC_OSCE_bm | OSC_REFE_bm | OSC_BUFE_bm); 192 val = (OSC_OSCR_BM | OSC_OSCE_BM | OSC_REFE_BM | OSC_BUFE_BM);
193 ads7871_write_reg8(spi, REG_OSC_CONTROL, val); 193 ads7871_write_reg8(spi, REG_OSC_CONTROL, val);
194 ret = ads7871_read_reg8(spi, REG_OSC_CONTROL); 194 ret = ads7871_read_reg8(spi, REG_OSC_CONTROL);
195 195
diff --git a/drivers/hwmon/asc7621.c b/drivers/hwmon/asc7621.c
index da7f5b5d5db5..3ad9d849add2 100644
--- a/drivers/hwmon/asc7621.c
+++ b/drivers/hwmon/asc7621.c
@@ -159,12 +159,12 @@ static inline int write_byte(struct i2c_client *client, u8 reg, u8 data)
159 * and retrieval of like parameters. 159 * and retrieval of like parameters.
160 */ 160 */
161 161
162#define SETUP_SHOW_data_param(d, a) \ 162#define SETUP_SHOW_DATA_PARAM(d, a) \
163 struct sensor_device_attribute *sda = to_sensor_dev_attr(a); \ 163 struct sensor_device_attribute *sda = to_sensor_dev_attr(a); \
164 struct asc7621_data *data = asc7621_update_device(d); \ 164 struct asc7621_data *data = asc7621_update_device(d); \
165 struct asc7621_param *param = to_asc7621_param(sda) 165 struct asc7621_param *param = to_asc7621_param(sda)
166 166
167#define SETUP_STORE_data_param(d, a) \ 167#define SETUP_STORE_DATA_PARAM(d, a) \
168 struct sensor_device_attribute *sda = to_sensor_dev_attr(a); \ 168 struct sensor_device_attribute *sda = to_sensor_dev_attr(a); \
169 struct i2c_client *client = to_i2c_client(d); \ 169 struct i2c_client *client = to_i2c_client(d); \
170 struct asc7621_data *data = i2c_get_clientdata(client); \ 170 struct asc7621_data *data = i2c_get_clientdata(client); \
@@ -177,7 +177,7 @@ static inline int write_byte(struct i2c_client *client, u8 reg, u8 data)
177static ssize_t show_u8(struct device *dev, struct device_attribute *attr, 177static ssize_t show_u8(struct device *dev, struct device_attribute *attr,
178 char *buf) 178 char *buf)
179{ 179{
180 SETUP_SHOW_data_param(dev, attr); 180 SETUP_SHOW_DATA_PARAM(dev, attr);
181 181
182 return sprintf(buf, "%u\n", data->reg[param->msb[0]]); 182 return sprintf(buf, "%u\n", data->reg[param->msb[0]]);
183} 183}
@@ -185,7 +185,7 @@ static ssize_t show_u8(struct device *dev, struct device_attribute *attr,
185static ssize_t store_u8(struct device *dev, struct device_attribute *attr, 185static ssize_t store_u8(struct device *dev, struct device_attribute *attr,
186 const char *buf, size_t count) 186 const char *buf, size_t count)
187{ 187{
188 SETUP_STORE_data_param(dev, attr); 188 SETUP_STORE_DATA_PARAM(dev, attr);
189 long reqval; 189 long reqval;
190 190
191 if (kstrtol(buf, 10, &reqval)) 191 if (kstrtol(buf, 10, &reqval))
@@ -206,7 +206,7 @@ static ssize_t store_u8(struct device *dev, struct device_attribute *attr,
206static ssize_t show_bitmask(struct device *dev, 206static ssize_t show_bitmask(struct device *dev,
207 struct device_attribute *attr, char *buf) 207 struct device_attribute *attr, char *buf)
208{ 208{
209 SETUP_SHOW_data_param(dev, attr); 209 SETUP_SHOW_DATA_PARAM(dev, attr);
210 210
211 return sprintf(buf, "%u\n", 211 return sprintf(buf, "%u\n",
212 (data->reg[param->msb[0]] >> param-> 212 (data->reg[param->msb[0]] >> param->
@@ -217,7 +217,7 @@ static ssize_t store_bitmask(struct device *dev,
217 struct device_attribute *attr, 217 struct device_attribute *attr,
218 const char *buf, size_t count) 218 const char *buf, size_t count)
219{ 219{
220 SETUP_STORE_data_param(dev, attr); 220 SETUP_STORE_DATA_PARAM(dev, attr);
221 long reqval; 221 long reqval;
222 u8 currval; 222 u8 currval;
223 223
@@ -246,7 +246,7 @@ static ssize_t store_bitmask(struct device *dev,
246static ssize_t show_fan16(struct device *dev, 246static ssize_t show_fan16(struct device *dev,
247 struct device_attribute *attr, char *buf) 247 struct device_attribute *attr, char *buf)
248{ 248{
249 SETUP_SHOW_data_param(dev, attr); 249 SETUP_SHOW_DATA_PARAM(dev, attr);
250 u16 regval; 250 u16 regval;
251 251
252 mutex_lock(&data->update_lock); 252 mutex_lock(&data->update_lock);
@@ -262,7 +262,7 @@ static ssize_t store_fan16(struct device *dev,
262 struct device_attribute *attr, const char *buf, 262 struct device_attribute *attr, const char *buf,
263 size_t count) 263 size_t count)
264{ 264{
265 SETUP_STORE_data_param(dev, attr); 265 SETUP_STORE_DATA_PARAM(dev, attr);
266 long reqval; 266 long reqval;
267 267
268 if (kstrtol(buf, 10, &reqval)) 268 if (kstrtol(buf, 10, &reqval))
@@ -307,7 +307,7 @@ static int asc7621_in_scaling[] = {
307static ssize_t show_in10(struct device *dev, struct device_attribute *attr, 307static ssize_t show_in10(struct device *dev, struct device_attribute *attr,
308 char *buf) 308 char *buf)
309{ 309{
310 SETUP_SHOW_data_param(dev, attr); 310 SETUP_SHOW_DATA_PARAM(dev, attr);
311 u16 regval; 311 u16 regval;
312 u8 nr = sda->index; 312 u8 nr = sda->index;
313 313
@@ -325,7 +325,7 @@ static ssize_t show_in10(struct device *dev, struct device_attribute *attr,
325static ssize_t show_in8(struct device *dev, struct device_attribute *attr, 325static ssize_t show_in8(struct device *dev, struct device_attribute *attr,
326 char *buf) 326 char *buf)
327{ 327{
328 SETUP_SHOW_data_param(dev, attr); 328 SETUP_SHOW_DATA_PARAM(dev, attr);
329 u8 nr = sda->index; 329 u8 nr = sda->index;
330 330
331 return sprintf(buf, "%u\n", 331 return sprintf(buf, "%u\n",
@@ -336,7 +336,7 @@ static ssize_t show_in8(struct device *dev, struct device_attribute *attr,
336static ssize_t store_in8(struct device *dev, struct device_attribute *attr, 336static ssize_t store_in8(struct device *dev, struct device_attribute *attr,
337 const char *buf, size_t count) 337 const char *buf, size_t count)
338{ 338{
339 SETUP_STORE_data_param(dev, attr); 339 SETUP_STORE_DATA_PARAM(dev, attr);
340 long reqval; 340 long reqval;
341 u8 nr = sda->index; 341 u8 nr = sda->index;
342 342
@@ -360,7 +360,7 @@ static ssize_t store_in8(struct device *dev, struct device_attribute *attr,
360static ssize_t show_temp8(struct device *dev, 360static ssize_t show_temp8(struct device *dev,
361 struct device_attribute *attr, char *buf) 361 struct device_attribute *attr, char *buf)
362{ 362{
363 SETUP_SHOW_data_param(dev, attr); 363 SETUP_SHOW_DATA_PARAM(dev, attr);
364 364
365 return sprintf(buf, "%d\n", ((s8) data->reg[param->msb[0]]) * 1000); 365 return sprintf(buf, "%d\n", ((s8) data->reg[param->msb[0]]) * 1000);
366} 366}
@@ -369,7 +369,7 @@ static ssize_t store_temp8(struct device *dev,
369 struct device_attribute *attr, const char *buf, 369 struct device_attribute *attr, const char *buf,
370 size_t count) 370 size_t count)
371{ 371{
372 SETUP_STORE_data_param(dev, attr); 372 SETUP_STORE_DATA_PARAM(dev, attr);
373 long reqval; 373 long reqval;
374 s8 temp; 374 s8 temp;
375 375
@@ -397,7 +397,7 @@ static ssize_t store_temp8(struct device *dev,
397static ssize_t show_temp10(struct device *dev, 397static ssize_t show_temp10(struct device *dev,
398 struct device_attribute *attr, char *buf) 398 struct device_attribute *attr, char *buf)
399{ 399{
400 SETUP_SHOW_data_param(dev, attr); 400 SETUP_SHOW_DATA_PARAM(dev, attr);
401 u8 msb, lsb; 401 u8 msb, lsb;
402 int temp; 402 int temp;
403 403
@@ -414,7 +414,7 @@ static ssize_t show_temp10(struct device *dev,
414static ssize_t show_temp62(struct device *dev, 414static ssize_t show_temp62(struct device *dev,
415 struct device_attribute *attr, char *buf) 415 struct device_attribute *attr, char *buf)
416{ 416{
417 SETUP_SHOW_data_param(dev, attr); 417 SETUP_SHOW_DATA_PARAM(dev, attr);
418 u8 regval = data->reg[param->msb[0]]; 418 u8 regval = data->reg[param->msb[0]];
419 int temp = ((s8) (regval & 0xfc) * 1000) + ((regval & 0x03) * 250); 419 int temp = ((s8) (regval & 0xfc) * 1000) + ((regval & 0x03) * 250);
420 420
@@ -425,7 +425,7 @@ static ssize_t store_temp62(struct device *dev,
425 struct device_attribute *attr, const char *buf, 425 struct device_attribute *attr, const char *buf,
426 size_t count) 426 size_t count)
427{ 427{
428 SETUP_STORE_data_param(dev, attr); 428 SETUP_STORE_DATA_PARAM(dev, attr);
429 long reqval, i, f; 429 long reqval, i, f;
430 s8 temp; 430 s8 temp;
431 431
@@ -459,7 +459,7 @@ static u32 asc7621_range_map[] = {
459static ssize_t show_ap2_temp(struct device *dev, 459static ssize_t show_ap2_temp(struct device *dev,
460 struct device_attribute *attr, char *buf) 460 struct device_attribute *attr, char *buf)
461{ 461{
462 SETUP_SHOW_data_param(dev, attr); 462 SETUP_SHOW_DATA_PARAM(dev, attr);
463 long auto_point1; 463 long auto_point1;
464 u8 regval; 464 u8 regval;
465 int temp; 465 int temp;
@@ -479,7 +479,7 @@ static ssize_t store_ap2_temp(struct device *dev,
479 struct device_attribute *attr, 479 struct device_attribute *attr,
480 const char *buf, size_t count) 480 const char *buf, size_t count)
481{ 481{
482 SETUP_STORE_data_param(dev, attr); 482 SETUP_STORE_DATA_PARAM(dev, attr);
483 long reqval, auto_point1; 483 long reqval, auto_point1;
484 int i; 484 int i;
485 u8 currval, newval = 0; 485 u8 currval, newval = 0;
@@ -510,7 +510,7 @@ static ssize_t store_ap2_temp(struct device *dev,
510static ssize_t show_pwm_ac(struct device *dev, 510static ssize_t show_pwm_ac(struct device *dev,
511 struct device_attribute *attr, char *buf) 511 struct device_attribute *attr, char *buf)
512{ 512{
513 SETUP_SHOW_data_param(dev, attr); 513 SETUP_SHOW_DATA_PARAM(dev, attr);
514 u8 config, altbit, regval; 514 u8 config, altbit, regval;
515 u8 map[] = { 515 u8 map[] = {
516 0x01, 0x02, 0x04, 0x1f, 0x00, 0x06, 0x07, 0x10, 516 0x01, 0x02, 0x04, 0x1f, 0x00, 0x06, 0x07, 0x10,
@@ -530,7 +530,7 @@ static ssize_t store_pwm_ac(struct device *dev,
530 struct device_attribute *attr, 530 struct device_attribute *attr,
531 const char *buf, size_t count) 531 const char *buf, size_t count)
532{ 532{
533 SETUP_STORE_data_param(dev, attr); 533 SETUP_STORE_DATA_PARAM(dev, attr);
534 unsigned long reqval; 534 unsigned long reqval;
535 u8 currval, config, altbit, newval; 535 u8 currval, config, altbit, newval;
536 u16 map[] = { 536 u16 map[] = {
@@ -569,7 +569,7 @@ static ssize_t store_pwm_ac(struct device *dev,
569static ssize_t show_pwm_enable(struct device *dev, 569static ssize_t show_pwm_enable(struct device *dev,
570 struct device_attribute *attr, char *buf) 570 struct device_attribute *attr, char *buf)
571{ 571{
572 SETUP_SHOW_data_param(dev, attr); 572 SETUP_SHOW_DATA_PARAM(dev, attr);
573 u8 config, altbit, minoff, val, newval; 573 u8 config, altbit, minoff, val, newval;
574 574
575 mutex_lock(&data->update_lock); 575 mutex_lock(&data->update_lock);
@@ -599,7 +599,7 @@ static ssize_t store_pwm_enable(struct device *dev,
599 struct device_attribute *attr, 599 struct device_attribute *attr,
600 const char *buf, size_t count) 600 const char *buf, size_t count)
601{ 601{
602 SETUP_STORE_data_param(dev, attr); 602 SETUP_STORE_DATA_PARAM(dev, attr);
603 long reqval; 603 long reqval;
604 u8 currval, config, altbit, newval, minoff = 255; 604 u8 currval, config, altbit, newval, minoff = 255;
605 605
@@ -659,7 +659,7 @@ static u32 asc7621_pwm_freq_map[] = {
659static ssize_t show_pwm_freq(struct device *dev, 659static ssize_t show_pwm_freq(struct device *dev,
660 struct device_attribute *attr, char *buf) 660 struct device_attribute *attr, char *buf)
661{ 661{
662 SETUP_SHOW_data_param(dev, attr); 662 SETUP_SHOW_DATA_PARAM(dev, attr);
663 u8 regval = 663 u8 regval =
664 (data->reg[param->msb[0]] >> param->shift[0]) & param->mask[0]; 664 (data->reg[param->msb[0]] >> param->shift[0]) & param->mask[0];
665 665
@@ -672,7 +672,7 @@ static ssize_t store_pwm_freq(struct device *dev,
672 struct device_attribute *attr, 672 struct device_attribute *attr,
673 const char *buf, size_t count) 673 const char *buf, size_t count)
674{ 674{
675 SETUP_STORE_data_param(dev, attr); 675 SETUP_STORE_DATA_PARAM(dev, attr);
676 unsigned long reqval; 676 unsigned long reqval;
677 u8 currval, newval = 255; 677 u8 currval, newval = 255;
678 int i; 678 int i;
@@ -707,7 +707,7 @@ static u32 asc7621_pwm_auto_spinup_map[] = {
707static ssize_t show_pwm_ast(struct device *dev, 707static ssize_t show_pwm_ast(struct device *dev,
708 struct device_attribute *attr, char *buf) 708 struct device_attribute *attr, char *buf)
709{ 709{
710 SETUP_SHOW_data_param(dev, attr); 710 SETUP_SHOW_DATA_PARAM(dev, attr);
711 u8 regval = 711 u8 regval =
712 (data->reg[param->msb[0]] >> param->shift[0]) & param->mask[0]; 712 (data->reg[param->msb[0]] >> param->shift[0]) & param->mask[0];
713 713
@@ -721,7 +721,7 @@ static ssize_t store_pwm_ast(struct device *dev,
721 struct device_attribute *attr, 721 struct device_attribute *attr,
722 const char *buf, size_t count) 722 const char *buf, size_t count)
723{ 723{
724 SETUP_STORE_data_param(dev, attr); 724 SETUP_STORE_DATA_PARAM(dev, attr);
725 long reqval; 725 long reqval;
726 u8 currval, newval = 255; 726 u8 currval, newval = 255;
727 u32 i; 727 u32 i;
@@ -756,7 +756,7 @@ static u32 asc7621_temp_smoothing_time_map[] = {
756static ssize_t show_temp_st(struct device *dev, 756static ssize_t show_temp_st(struct device *dev,
757 struct device_attribute *attr, char *buf) 757 struct device_attribute *attr, char *buf)
758{ 758{
759 SETUP_SHOW_data_param(dev, attr); 759 SETUP_SHOW_DATA_PARAM(dev, attr);
760 u8 regval = 760 u8 regval =
761 (data->reg[param->msb[0]] >> param->shift[0]) & param->mask[0]; 761 (data->reg[param->msb[0]] >> param->shift[0]) & param->mask[0];
762 regval = clamp_val(regval, 0, 7); 762 regval = clamp_val(regval, 0, 7);
@@ -768,7 +768,7 @@ static ssize_t store_temp_st(struct device *dev,
768 struct device_attribute *attr, 768 struct device_attribute *attr,
769 const char *buf, size_t count) 769 const char *buf, size_t count)
770{ 770{
771 SETUP_STORE_data_param(dev, attr); 771 SETUP_STORE_DATA_PARAM(dev, attr);
772 long reqval; 772 long reqval;
773 u8 currval, newval = 255; 773 u8 currval, newval = 255;
774 u32 i; 774 u32 i;
diff --git a/drivers/hwmon/da9052-hwmon.c b/drivers/hwmon/da9052-hwmon.c
index ab4452c5a98c..960fac3fb166 100644
--- a/drivers/hwmon/da9052-hwmon.c
+++ b/drivers/hwmon/da9052-hwmon.c
@@ -43,19 +43,19 @@ static const char * const input_names[] = {
43}; 43};
44 44
45/* Conversion function for VDDOUT and VBAT */ 45/* Conversion function for VDDOUT and VBAT */
46static inline int volt_reg_to_mV(int value) 46static inline int volt_reg_to_mv(int value)
47{ 47{
48 return DIV_ROUND_CLOSEST(value * 1000, 512) + 2500; 48 return DIV_ROUND_CLOSEST(value * 1000, 512) + 2500;
49} 49}
50 50
51/* Conversion function for ADC channels 4, 5 and 6 */ 51/* Conversion function for ADC channels 4, 5 and 6 */
52static inline int input_reg_to_mV(int value) 52static inline int input_reg_to_mv(int value)
53{ 53{
54 return DIV_ROUND_CLOSEST(value * 2500, 1023); 54 return DIV_ROUND_CLOSEST(value * 2500, 1023);
55} 55}
56 56
57/* Conversion function for VBBAT */ 57/* Conversion function for VBBAT */
58static inline int vbbat_reg_to_mV(int value) 58static inline int vbbat_reg_to_mv(int value)
59{ 59{
60 return DIV_ROUND_CLOSEST(value * 2500, 512); 60 return DIV_ROUND_CLOSEST(value * 2500, 512);
61} 61}
@@ -96,7 +96,7 @@ static ssize_t da9052_read_vddout(struct device *dev,
96 goto hwmon_err; 96 goto hwmon_err;
97 97
98 mutex_unlock(&hwmon->hwmon_lock); 98 mutex_unlock(&hwmon->hwmon_lock);
99 return sprintf(buf, "%d\n", volt_reg_to_mV(vdd)); 99 return sprintf(buf, "%d\n", volt_reg_to_mv(vdd));
100 100
101hwmon_err_release: 101hwmon_err_release:
102 da9052_disable_vddout_channel(hwmon->da9052); 102 da9052_disable_vddout_channel(hwmon->da9052);
@@ -137,7 +137,7 @@ static ssize_t da9052_read_vbat(struct device *dev,
137 if (ret < 0) 137 if (ret < 0)
138 return ret; 138 return ret;
139 139
140 return sprintf(buf, "%d\n", volt_reg_to_mV(ret)); 140 return sprintf(buf, "%d\n", volt_reg_to_mv(ret));
141} 141}
142 142
143static ssize_t da9052_read_misc_channel(struct device *dev, 143static ssize_t da9052_read_misc_channel(struct device *dev,
@@ -152,7 +152,7 @@ static ssize_t da9052_read_misc_channel(struct device *dev,
152 if (ret < 0) 152 if (ret < 0)
153 return ret; 153 return ret;
154 154
155 return sprintf(buf, "%d\n", input_reg_to_mV(ret)); 155 return sprintf(buf, "%d\n", input_reg_to_mv(ret));
156} 156}
157 157
158static ssize_t da9052_read_tjunc(struct device *dev, 158static ssize_t da9052_read_tjunc(struct device *dev,
@@ -187,7 +187,7 @@ static ssize_t da9052_read_vbbat(struct device *dev,
187 if (ret < 0) 187 if (ret < 0)
188 return ret; 188 return ret;
189 189
190 return sprintf(buf, "%d\n", vbbat_reg_to_mV(ret)); 190 return sprintf(buf, "%d\n", vbbat_reg_to_mv(ret));
191} 191}
192 192
193static ssize_t da9052_hwmon_show_name(struct device *dev, 193static ssize_t da9052_hwmon_show_name(struct device *dev,
diff --git a/drivers/hwmon/da9055-hwmon.c b/drivers/hwmon/da9055-hwmon.c
index 9465c050c326..029ecabc4380 100644
--- a/drivers/hwmon/da9055-hwmon.c
+++ b/drivers/hwmon/da9055-hwmon.c
@@ -119,7 +119,7 @@ static irqreturn_t da9055_auxadc_irq(int irq, void *irq_data)
119} 119}
120 120
121/* Conversion function for VSYS and ADCINx */ 121/* Conversion function for VSYS and ADCINx */
122static inline int volt_reg_to_mV(int value, int channel) 122static inline int volt_reg_to_mv(int value, int channel)
123{ 123{
124 if (channel == DA9055_ADC_VSYS) 124 if (channel == DA9055_ADC_VSYS)
125 return DIV_ROUND_CLOSEST(value * 1000, DA9055_VSYS_DIV) + 2500; 125 return DIV_ROUND_CLOSEST(value * 1000, DA9055_VSYS_DIV) + 2500;
@@ -168,7 +168,7 @@ static ssize_t da9055_read_auto_ch(struct device *dev,
168 168
169 mutex_unlock(&hwmon->hwmon_lock); 169 mutex_unlock(&hwmon->hwmon_lock);
170 170
171 return sprintf(buf, "%d\n", volt_reg_to_mV(adc, channel)); 171 return sprintf(buf, "%d\n", volt_reg_to_mv(adc, channel));
172 172
173hwmon_err_release: 173hwmon_err_release:
174 da9055_disable_auto_mode(hwmon->da9055, channel); 174 da9055_disable_auto_mode(hwmon->da9055, channel);
diff --git a/drivers/hwmon/it87.c b/drivers/hwmon/it87.c
index 37fc980fde24..72b21d5b1c62 100644
--- a/drivers/hwmon/it87.c
+++ b/drivers/hwmon/it87.c
@@ -1778,7 +1778,7 @@ static int __init it87_find(unsigned short *address,
1778 superio_select(5); 1778 superio_select(5);
1779 sio_data->beep_pin = superio_inb(IT87_SIO_BEEP_PIN_REG) & 0x3f; 1779 sio_data->beep_pin = superio_inb(IT87_SIO_BEEP_PIN_REG) & 0x3f;
1780 } else if (sio_data->type == it8783) { 1780 } else if (sio_data->type == it8783) {
1781 int reg25, reg27, reg2A, reg2C, regEF; 1781 int reg25, reg27, reg2a, reg2c, regef;
1782 1782
1783 sio_data->skip_vid = 1; /* No VID */ 1783 sio_data->skip_vid = 1; /* No VID */
1784 1784
@@ -1786,15 +1786,15 @@ static int __init it87_find(unsigned short *address,
1786 1786
1787 reg25 = superio_inb(IT87_SIO_GPIO1_REG); 1787 reg25 = superio_inb(IT87_SIO_GPIO1_REG);
1788 reg27 = superio_inb(IT87_SIO_GPIO3_REG); 1788 reg27 = superio_inb(IT87_SIO_GPIO3_REG);
1789 reg2A = superio_inb(IT87_SIO_PINX1_REG); 1789 reg2a = superio_inb(IT87_SIO_PINX1_REG);
1790 reg2C = superio_inb(IT87_SIO_PINX2_REG); 1790 reg2c = superio_inb(IT87_SIO_PINX2_REG);
1791 regEF = superio_inb(IT87_SIO_SPI_REG); 1791 regef = superio_inb(IT87_SIO_SPI_REG);
1792 1792
1793 /* Check if fan3 is there or not */ 1793 /* Check if fan3 is there or not */
1794 if ((reg27 & (1 << 0)) || !(reg2C & (1 << 2))) 1794 if ((reg27 & (1 << 0)) || !(reg2c & (1 << 2)))
1795 sio_data->skip_fan |= (1 << 2); 1795 sio_data->skip_fan |= (1 << 2);
1796 if ((reg25 & (1 << 4)) 1796 if ((reg25 & (1 << 4))
1797 || (!(reg2A & (1 << 1)) && (regEF & (1 << 0)))) 1797 || (!(reg2a & (1 << 1)) && (regef & (1 << 0))))
1798 sio_data->skip_pwm |= (1 << 2); 1798 sio_data->skip_pwm |= (1 << 2);
1799 1799
1800 /* Check if fan2 is there or not */ 1800 /* Check if fan2 is there or not */
@@ -1804,7 +1804,7 @@ static int __init it87_find(unsigned short *address,
1804 sio_data->skip_pwm |= (1 << 1); 1804 sio_data->skip_pwm |= (1 << 1);
1805 1805
1806 /* VIN5 */ 1806 /* VIN5 */
1807 if ((reg27 & (1 << 0)) || (reg2C & (1 << 2))) 1807 if ((reg27 & (1 << 0)) || (reg2c & (1 << 2)))
1808 sio_data->skip_in |= (1 << 5); /* No VIN5 */ 1808 sio_data->skip_in |= (1 << 5); /* No VIN5 */
1809 1809
1810 /* VIN6 */ 1810 /* VIN6 */
@@ -1829,18 +1829,18 @@ static int __init it87_find(unsigned short *address,
1829 * not the case, and ask the user to report if the 1829 * not the case, and ask the user to report if the
1830 * resulting voltage is sane. 1830 * resulting voltage is sane.
1831 */ 1831 */
1832 if (!(reg2C & (1 << 1))) { 1832 if (!(reg2c & (1 << 1))) {
1833 reg2C |= (1 << 1); 1833 reg2c |= (1 << 1);
1834 superio_outb(IT87_SIO_PINX2_REG, reg2C); 1834 superio_outb(IT87_SIO_PINX2_REG, reg2c);
1835 pr_notice("Routing internal VCCH5V to in7.\n"); 1835 pr_notice("Routing internal VCCH5V to in7.\n");
1836 } 1836 }
1837 pr_notice("in7 routed to internal voltage divider, with external pin disabled.\n"); 1837 pr_notice("in7 routed to internal voltage divider, with external pin disabled.\n");
1838 pr_notice("Please report if it displays a reasonable voltage.\n"); 1838 pr_notice("Please report if it displays a reasonable voltage.\n");
1839 } 1839 }
1840 1840
1841 if (reg2C & (1 << 0)) 1841 if (reg2c & (1 << 0))
1842 sio_data->internal |= (1 << 0); 1842 sio_data->internal |= (1 << 0);
1843 if (reg2C & (1 << 1)) 1843 if (reg2c & (1 << 1))
1844 sio_data->internal |= (1 << 1); 1844 sio_data->internal |= (1 << 1);
1845 1845
1846 sio_data->beep_pin = superio_inb(IT87_SIO_BEEP_PIN_REG) & 0x3f; 1846 sio_data->beep_pin = superio_inb(IT87_SIO_BEEP_PIN_REG) & 0x3f;
diff --git a/drivers/hwmon/lm93.c b/drivers/hwmon/lm93.c
index b40f34cdb3ca..340382f173a0 100644
--- a/drivers/hwmon/lm93.c
+++ b/drivers/hwmon/lm93.c
@@ -354,12 +354,12 @@ static const unsigned long lm93_vin_val_max[16] = {
354 354
355static unsigned LM93_IN_FROM_REG(int nr, u8 reg) 355static unsigned LM93_IN_FROM_REG(int nr, u8 reg)
356{ 356{
357 const long uV_max = lm93_vin_val_max[nr] * 1000; 357 const long uv_max = lm93_vin_val_max[nr] * 1000;
358 const long uV_min = lm93_vin_val_min[nr] * 1000; 358 const long uv_min = lm93_vin_val_min[nr] * 1000;
359 359
360 const long slope = (uV_max - uV_min) / 360 const long slope = (uv_max - uv_min) /
361 (lm93_vin_reg_max[nr] - lm93_vin_reg_min[nr]); 361 (lm93_vin_reg_max[nr] - lm93_vin_reg_min[nr]);
362 const long intercept = uV_min - slope * lm93_vin_reg_min[nr]; 362 const long intercept = uv_min - slope * lm93_vin_reg_min[nr];
363 363
364 return (slope * reg + intercept + 500) / 1000; 364 return (slope * reg + intercept + 500) / 1000;
365} 365}
@@ -371,20 +371,20 @@ static unsigned LM93_IN_FROM_REG(int nr, u8 reg)
371static u8 LM93_IN_TO_REG(int nr, unsigned val) 371static u8 LM93_IN_TO_REG(int nr, unsigned val)
372{ 372{
373 /* range limit */ 373 /* range limit */
374 const long mV = clamp_val(val, 374 const long mv = clamp_val(val,
375 lm93_vin_val_min[nr], lm93_vin_val_max[nr]); 375 lm93_vin_val_min[nr], lm93_vin_val_max[nr]);
376 376
377 /* try not to lose too much precision here */ 377 /* try not to lose too much precision here */
378 const long uV = mV * 1000; 378 const long uv = mv * 1000;
379 const long uV_max = lm93_vin_val_max[nr] * 1000; 379 const long uv_max = lm93_vin_val_max[nr] * 1000;
380 const long uV_min = lm93_vin_val_min[nr] * 1000; 380 const long uv_min = lm93_vin_val_min[nr] * 1000;
381 381
382 /* convert */ 382 /* convert */
383 const long slope = (uV_max - uV_min) / 383 const long slope = (uv_max - uv_min) /
384 (lm93_vin_reg_max[nr] - lm93_vin_reg_min[nr]); 384 (lm93_vin_reg_max[nr] - lm93_vin_reg_min[nr]);
385 const long intercept = uV_min - slope * lm93_vin_reg_min[nr]; 385 const long intercept = uv_min - slope * lm93_vin_reg_min[nr];
386 386
387 u8 result = ((uV - intercept + (slope/2)) / slope); 387 u8 result = ((uv - intercept + (slope/2)) / slope);
388 result = clamp_val(result, 388 result = clamp_val(result,
389 lm93_vin_reg_min[nr], lm93_vin_reg_max[nr]); 389 lm93_vin_reg_min[nr], lm93_vin_reg_max[nr]);
390 return result; 390 return result;
@@ -393,10 +393,10 @@ static u8 LM93_IN_TO_REG(int nr, unsigned val)
393/* vid in mV, upper == 0 indicates low limit, otherwise upper limit */ 393/* vid in mV, upper == 0 indicates low limit, otherwise upper limit */
394static unsigned LM93_IN_REL_FROM_REG(u8 reg, int upper, int vid) 394static unsigned LM93_IN_REL_FROM_REG(u8 reg, int upper, int vid)
395{ 395{
396 const long uV_offset = upper ? (((reg >> 4 & 0x0f) + 1) * 12500) : 396 const long uv_offset = upper ? (((reg >> 4 & 0x0f) + 1) * 12500) :
397 (((reg >> 0 & 0x0f) + 1) * -25000); 397 (((reg >> 0 & 0x0f) + 1) * -25000);
398 const long uV_vid = vid * 1000; 398 const long uv_vid = vid * 1000;
399 return (uV_vid + uV_offset + 5000) / 10000; 399 return (uv_vid + uv_offset + 5000) / 10000;
400} 400}
401 401
402#define LM93_IN_MIN_FROM_REG(reg, vid) LM93_IN_REL_FROM_REG((reg), 0, (vid)) 402#define LM93_IN_MIN_FROM_REG(reg, vid) LM93_IN_REL_FROM_REG((reg), 0, (vid))
@@ -409,13 +409,13 @@ static unsigned LM93_IN_REL_FROM_REG(u8 reg, int upper, int vid)
409 */ 409 */
410static u8 LM93_IN_REL_TO_REG(unsigned val, int upper, int vid) 410static u8 LM93_IN_REL_TO_REG(unsigned val, int upper, int vid)
411{ 411{
412 long uV_offset = vid * 1000 - val * 10000; 412 long uv_offset = vid * 1000 - val * 10000;
413 if (upper) { 413 if (upper) {
414 uV_offset = clamp_val(uV_offset, 12500, 200000); 414 uv_offset = clamp_val(uv_offset, 12500, 200000);
415 return (u8)((uV_offset / 12500 - 1) << 4); 415 return (u8)((uv_offset / 12500 - 1) << 4);
416 } else { 416 } else {
417 uV_offset = clamp_val(uV_offset, -400000, -25000); 417 uv_offset = clamp_val(uv_offset, -400000, -25000);
418 return (u8)((uV_offset / -25000 - 1) << 0); 418 return (u8)((uv_offset / -25000 - 1) << 0);
419 } 419 }
420} 420}
421 421
diff --git a/drivers/hwmon/ntc_thermistor.c b/drivers/hwmon/ntc_thermistor.c
index d399197655e6..d6d640a733d5 100644
--- a/drivers/hwmon/ntc_thermistor.c
+++ b/drivers/hwmon/ntc_thermistor.c
@@ -40,7 +40,7 @@
40#include <linux/hwmon-sysfs.h> 40#include <linux/hwmon-sysfs.h>
41 41
42struct ntc_compensation { 42struct ntc_compensation {
43 int temp_C; 43 int temp_c;
44 unsigned int ohm; 44 unsigned int ohm;
45}; 45};
46 46
@@ -60,76 +60,76 @@ static const struct platform_device_id ntc_thermistor_id[] = {
60 * Thermistors Datasheet 60 * Thermistors Datasheet
61 */ 61 */
62static const struct ntc_compensation ncpXXwb473[] = { 62static const struct ntc_compensation ncpXXwb473[] = {
63 { .temp_C = -40, .ohm = 1747920 }, 63 { .temp_c = -40, .ohm = 1747920 },
64 { .temp_C = -35, .ohm = 1245428 }, 64 { .temp_c = -35, .ohm = 1245428 },
65 { .temp_C = -30, .ohm = 898485 }, 65 { .temp_c = -30, .ohm = 898485 },
66 { .temp_C = -25, .ohm = 655802 }, 66 { .temp_c = -25, .ohm = 655802 },
67 { .temp_C = -20, .ohm = 483954 }, 67 { .temp_c = -20, .ohm = 483954 },
68 { .temp_C = -15, .ohm = 360850 }, 68 { .temp_c = -15, .ohm = 360850 },
69 { .temp_C = -10, .ohm = 271697 }, 69 { .temp_c = -10, .ohm = 271697 },
70 { .temp_C = -5, .ohm = 206463 }, 70 { .temp_c = -5, .ohm = 206463 },
71 { .temp_C = 0, .ohm = 158214 }, 71 { .temp_c = 0, .ohm = 158214 },
72 { .temp_C = 5, .ohm = 122259 }, 72 { .temp_c = 5, .ohm = 122259 },
73 { .temp_C = 10, .ohm = 95227 }, 73 { .temp_c = 10, .ohm = 95227 },
74 { .temp_C = 15, .ohm = 74730 }, 74 { .temp_c = 15, .ohm = 74730 },
75 { .temp_C = 20, .ohm = 59065 }, 75 { .temp_c = 20, .ohm = 59065 },
76 { .temp_C = 25, .ohm = 47000 }, 76 { .temp_c = 25, .ohm = 47000 },
77 { .temp_C = 30, .ohm = 37643 }, 77 { .temp_c = 30, .ohm = 37643 },
78 { .temp_C = 35, .ohm = 30334 }, 78 { .temp_c = 35, .ohm = 30334 },
79 { .temp_C = 40, .ohm = 24591 }, 79 { .temp_c = 40, .ohm = 24591 },
80 { .temp_C = 45, .ohm = 20048 }, 80 { .temp_c = 45, .ohm = 20048 },
81 { .temp_C = 50, .ohm = 16433 }, 81 { .temp_c = 50, .ohm = 16433 },
82 { .temp_C = 55, .ohm = 13539 }, 82 { .temp_c = 55, .ohm = 13539 },
83 { .temp_C = 60, .ohm = 11209 }, 83 { .temp_c = 60, .ohm = 11209 },
84 { .temp_C = 65, .ohm = 9328 }, 84 { .temp_c = 65, .ohm = 9328 },
85 { .temp_C = 70, .ohm = 7798 }, 85 { .temp_c = 70, .ohm = 7798 },
86 { .temp_C = 75, .ohm = 6544 }, 86 { .temp_c = 75, .ohm = 6544 },
87 { .temp_C = 80, .ohm = 5518 }, 87 { .temp_c = 80, .ohm = 5518 },
88 { .temp_C = 85, .ohm = 4674 }, 88 { .temp_c = 85, .ohm = 4674 },
89 { .temp_C = 90, .ohm = 3972 }, 89 { .temp_c = 90, .ohm = 3972 },
90 { .temp_C = 95, .ohm = 3388 }, 90 { .temp_c = 95, .ohm = 3388 },
91 { .temp_C = 100, .ohm = 2902 }, 91 { .temp_c = 100, .ohm = 2902 },
92 { .temp_C = 105, .ohm = 2494 }, 92 { .temp_c = 105, .ohm = 2494 },
93 { .temp_C = 110, .ohm = 2150 }, 93 { .temp_c = 110, .ohm = 2150 },
94 { .temp_C = 115, .ohm = 1860 }, 94 { .temp_c = 115, .ohm = 1860 },
95 { .temp_C = 120, .ohm = 1615 }, 95 { .temp_c = 120, .ohm = 1615 },
96 { .temp_C = 125, .ohm = 1406 }, 96 { .temp_c = 125, .ohm = 1406 },
97}; 97};
98static const struct ntc_compensation ncpXXwl333[] = { 98static const struct ntc_compensation ncpXXwl333[] = {
99 { .temp_C = -40, .ohm = 1610154 }, 99 { .temp_c = -40, .ohm = 1610154 },
100 { .temp_C = -35, .ohm = 1130850 }, 100 { .temp_c = -35, .ohm = 1130850 },
101 { .temp_C = -30, .ohm = 802609 }, 101 { .temp_c = -30, .ohm = 802609 },
102 { .temp_C = -25, .ohm = 575385 }, 102 { .temp_c = -25, .ohm = 575385 },
103 { .temp_C = -20, .ohm = 416464 }, 103 { .temp_c = -20, .ohm = 416464 },
104 { .temp_C = -15, .ohm = 304219 }, 104 { .temp_c = -15, .ohm = 304219 },
105 { .temp_C = -10, .ohm = 224193 }, 105 { .temp_c = -10, .ohm = 224193 },
106 { .temp_C = -5, .ohm = 166623 }, 106 { .temp_c = -5, .ohm = 166623 },
107 { .temp_C = 0, .ohm = 124850 }, 107 { .temp_c = 0, .ohm = 124850 },
108 { .temp_C = 5, .ohm = 94287 }, 108 { .temp_c = 5, .ohm = 94287 },
109 { .temp_C = 10, .ohm = 71747 }, 109 { .temp_c = 10, .ohm = 71747 },
110 { .temp_C = 15, .ohm = 54996 }, 110 { .temp_c = 15, .ohm = 54996 },
111 { .temp_C = 20, .ohm = 42455 }, 111 { .temp_c = 20, .ohm = 42455 },
112 { .temp_C = 25, .ohm = 33000 }, 112 { .temp_c = 25, .ohm = 33000 },
113 { .temp_C = 30, .ohm = 25822 }, 113 { .temp_c = 30, .ohm = 25822 },
114 { .temp_C = 35, .ohm = 20335 }, 114 { .temp_c = 35, .ohm = 20335 },
115 { .temp_C = 40, .ohm = 16115 }, 115 { .temp_c = 40, .ohm = 16115 },
116 { .temp_C = 45, .ohm = 12849 }, 116 { .temp_c = 45, .ohm = 12849 },
117 { .temp_C = 50, .ohm = 10306 }, 117 { .temp_c = 50, .ohm = 10306 },
118 { .temp_C = 55, .ohm = 8314 }, 118 { .temp_c = 55, .ohm = 8314 },
119 { .temp_C = 60, .ohm = 6746 }, 119 { .temp_c = 60, .ohm = 6746 },
120 { .temp_C = 65, .ohm = 5503 }, 120 { .temp_c = 65, .ohm = 5503 },
121 { .temp_C = 70, .ohm = 4513 }, 121 { .temp_c = 70, .ohm = 4513 },
122 { .temp_C = 75, .ohm = 3721 }, 122 { .temp_c = 75, .ohm = 3721 },
123 { .temp_C = 80, .ohm = 3084 }, 123 { .temp_c = 80, .ohm = 3084 },
124 { .temp_C = 85, .ohm = 2569 }, 124 { .temp_c = 85, .ohm = 2569 },
125 { .temp_C = 90, .ohm = 2151 }, 125 { .temp_c = 90, .ohm = 2151 },
126 { .temp_C = 95, .ohm = 1809 }, 126 { .temp_c = 95, .ohm = 1809 },
127 { .temp_C = 100, .ohm = 1529 }, 127 { .temp_c = 100, .ohm = 1529 },
128 { .temp_C = 105, .ohm = 1299 }, 128 { .temp_c = 105, .ohm = 1299 },
129 { .temp_C = 110, .ohm = 1108 }, 129 { .temp_c = 110, .ohm = 1108 },
130 { .temp_C = 115, .ohm = 949 }, 130 { .temp_c = 115, .ohm = 949 },
131 { .temp_C = 120, .ohm = 817 }, 131 { .temp_c = 120, .ohm = 817 },
132 { .temp_C = 125, .ohm = 707 }, 132 { .temp_c = 125, .ohm = 707 },
133}; 133};
134 134
135struct ntc_data { 135struct ntc_data {
@@ -155,7 +155,7 @@ static int ntc_adc_iio_read(struct ntc_thermistor_platform_data *pdata)
155 } 155 }
156 156
157 /* unit: mV */ 157 /* unit: mV */
158 result = pdata->pullup_uV * val; 158 result = pdata->pullup_uv * val;
159 result >>= 12; 159 result >>= 12;
160 160
161 return result; 161 return result;
@@ -194,7 +194,7 @@ ntc_thermistor_parse_dt(struct platform_device *pdev)
194 if (IS_ERR(chan)) 194 if (IS_ERR(chan))
195 return ERR_CAST(chan); 195 return ERR_CAST(chan);
196 196
197 if (of_property_read_u32(np, "pullup-uv", &pdata->pullup_uV)) 197 if (of_property_read_u32(np, "pullup-uv", &pdata->pullup_uv))
198 return ERR_PTR(-ENODEV); 198 return ERR_PTR(-ENODEV);
199 if (of_property_read_u32(np, "pullup-ohm", &pdata->pullup_ohm)) 199 if (of_property_read_u32(np, "pullup-ohm", &pdata->pullup_ohm))
200 return ERR_PTR(-ENODEV); 200 return ERR_PTR(-ENODEV);
@@ -207,7 +207,7 @@ ntc_thermistor_parse_dt(struct platform_device *pdev)
207 pdata->connect = NTC_CONNECTED_GROUND; 207 pdata->connect = NTC_CONNECTED_GROUND;
208 208
209 pdata->chan = chan; 209 pdata->chan = chan;
210 pdata->read_uV = ntc_adc_iio_read; 210 pdata->read_uv = ntc_adc_iio_read;
211 211
212 return pdata; 212 return pdata;
213} 213}
@@ -236,37 +236,37 @@ static inline u64 div64_u64_safe(u64 dividend, u64 divisor)
236 return div64_u64(dividend, divisor); 236 return div64_u64(dividend, divisor);
237} 237}
238 238
239static int get_ohm_of_thermistor(struct ntc_data *data, unsigned int uV) 239static int get_ohm_of_thermistor(struct ntc_data *data, unsigned int uv)
240{ 240{
241 struct ntc_thermistor_platform_data *pdata = data->pdata; 241 struct ntc_thermistor_platform_data *pdata = data->pdata;
242 u64 mV = uV / 1000; 242 u64 mv = uv / 1000;
243 u64 pmV = pdata->pullup_uV / 1000; 243 u64 pmv = pdata->pullup_uv / 1000;
244 u64 N, puO, pdO; 244 u64 n, puo, pdo;
245 puO = pdata->pullup_ohm; 245 puo = pdata->pullup_ohm;
246 pdO = pdata->pulldown_ohm; 246 pdo = pdata->pulldown_ohm;
247 247
248 if (mV == 0) { 248 if (mv == 0) {
249 if (pdata->connect == NTC_CONNECTED_POSITIVE) 249 if (pdata->connect == NTC_CONNECTED_POSITIVE)
250 return INT_MAX; 250 return INT_MAX;
251 return 0; 251 return 0;
252 } 252 }
253 if (mV >= pmV) 253 if (mv >= pmv)
254 return (pdata->connect == NTC_CONNECTED_POSITIVE) ? 254 return (pdata->connect == NTC_CONNECTED_POSITIVE) ?
255 0 : INT_MAX; 255 0 : INT_MAX;
256 256
257 if (pdata->connect == NTC_CONNECTED_POSITIVE && puO == 0) 257 if (pdata->connect == NTC_CONNECTED_POSITIVE && puo == 0)
258 N = div64_u64_safe(pdO * (pmV - mV), mV); 258 n = div64_u64_safe(pdo * (pmv - mv), mv);
259 else if (pdata->connect == NTC_CONNECTED_GROUND && pdO == 0) 259 else if (pdata->connect == NTC_CONNECTED_GROUND && pdo == 0)
260 N = div64_u64_safe(puO * mV, pmV - mV); 260 n = div64_u64_safe(puo * mv, pmv - mv);
261 else if (pdata->connect == NTC_CONNECTED_POSITIVE) 261 else if (pdata->connect == NTC_CONNECTED_POSITIVE)
262 N = div64_u64_safe(pdO * puO * (pmV - mV), 262 n = div64_u64_safe(pdo * puo * (pmv - mv),
263 puO * mV - pdO * (pmV - mV)); 263 puo * mv - pdo * (pmv - mv));
264 else 264 else
265 N = div64_u64_safe(pdO * puO * mV, pdO * (pmV - mV) - puO * mV); 265 n = div64_u64_safe(pdo * puo * mv, pdo * (pmv - mv) - puo * mv);
266 266
267 if (N > INT_MAX) 267 if (n > INT_MAX)
268 N = INT_MAX; 268 n = INT_MAX;
269 return N; 269 return n;
270} 270}
271 271
272static void lookup_comp(struct ntc_data *data, unsigned int ohm, 272static void lookup_comp(struct ntc_data *data, unsigned int ohm,
@@ -335,7 +335,7 @@ static void lookup_comp(struct ntc_data *data, unsigned int ohm,
335 *i_high = end - 1; 335 *i_high = end - 1;
336} 336}
337 337
338static int get_temp_mC(struct ntc_data *data, unsigned int ohm) 338static int get_temp_mc(struct ntc_data *data, unsigned int ohm)
339{ 339{
340 int low, high; 340 int low, high;
341 int temp; 341 int temp;
@@ -343,10 +343,10 @@ static int get_temp_mC(struct ntc_data *data, unsigned int ohm)
343 lookup_comp(data, ohm, &low, &high); 343 lookup_comp(data, ohm, &low, &high);
344 if (low == high) { 344 if (low == high) {
345 /* Unable to use linear approximation */ 345 /* Unable to use linear approximation */
346 temp = data->comp[low].temp_C * 1000; 346 temp = data->comp[low].temp_c * 1000;
347 } else { 347 } else {
348 temp = data->comp[low].temp_C * 1000 + 348 temp = data->comp[low].temp_c * 1000 +
349 ((data->comp[high].temp_C - data->comp[low].temp_C) * 349 ((data->comp[high].temp_c - data->comp[low].temp_c) *
350 1000 * ((int)ohm - (int)data->comp[low].ohm)) / 350 1000 * ((int)ohm - (int)data->comp[low].ohm)) /
351 ((int)data->comp[high].ohm - (int)data->comp[low].ohm); 351 ((int)data->comp[high].ohm - (int)data->comp[low].ohm);
352 } 352 }
@@ -355,16 +355,16 @@ static int get_temp_mC(struct ntc_data *data, unsigned int ohm)
355 355
356static int ntc_thermistor_get_ohm(struct ntc_data *data) 356static int ntc_thermistor_get_ohm(struct ntc_data *data)
357{ 357{
358 int read_uV; 358 int read_uv;
359 359
360 if (data->pdata->read_ohm) 360 if (data->pdata->read_ohm)
361 return data->pdata->read_ohm(); 361 return data->pdata->read_ohm();
362 362
363 if (data->pdata->read_uV) { 363 if (data->pdata->read_uv) {
364 read_uV = data->pdata->read_uV(data->pdata); 364 read_uv = data->pdata->read_uv(data->pdata);
365 if (read_uV < 0) 365 if (read_uv < 0)
366 return read_uV; 366 return read_uv;
367 return get_ohm_of_thermistor(data, read_uV); 367 return get_ohm_of_thermistor(data, read_uv);
368 } 368 }
369 return -EINVAL; 369 return -EINVAL;
370} 370}
@@ -393,7 +393,7 @@ static ssize_t ntc_show_temp(struct device *dev,
393 if (ohm < 0) 393 if (ohm < 0)
394 return ohm; 394 return ohm;
395 395
396 return sprintf(buf, "%d\n", get_temp_mC(data, ohm)); 396 return sprintf(buf, "%d\n", get_temp_mc(data, ohm));
397} 397}
398 398
399static SENSOR_DEVICE_ATTR(temp1_type, S_IRUGO, ntc_show_type, NULL, 0); 399static SENSOR_DEVICE_ATTR(temp1_type, S_IRUGO, ntc_show_type, NULL, 0);
@@ -432,19 +432,19 @@ static int ntc_thermistor_probe(struct platform_device *pdev)
432 } 432 }
433 433
434 /* Either one of the two is required. */ 434 /* Either one of the two is required. */
435 if (!pdata->read_uV && !pdata->read_ohm) { 435 if (!pdata->read_uv && !pdata->read_ohm) {
436 dev_err(&pdev->dev, 436 dev_err(&pdev->dev,
437 "Both read_uV and read_ohm missing. Need either one of the two.\n"); 437 "Both read_uv and read_ohm missing. Need either one of the two.\n");
438 return -EINVAL; 438 return -EINVAL;
439 } 439 }
440 440
441 if (pdata->read_uV && pdata->read_ohm) { 441 if (pdata->read_uv && pdata->read_ohm) {
442 dev_warn(&pdev->dev, 442 dev_warn(&pdev->dev,
443 "Only one of read_uV and read_ohm is needed; ignoring read_uV.\n"); 443 "Only one of read_uv and read_ohm is needed; ignoring read_uv.\n");
444 pdata->read_uV = NULL; 444 pdata->read_uv = NULL;
445 } 445 }
446 446
447 if (pdata->read_uV && (pdata->pullup_uV == 0 || 447 if (pdata->read_uv && (pdata->pullup_uv == 0 ||
448 (pdata->pullup_ohm == 0 && pdata->connect == 448 (pdata->pullup_ohm == 0 && pdata->connect ==
449 NTC_CONNECTED_GROUND) || 449 NTC_CONNECTED_GROUND) ||
450 (pdata->pulldown_ohm == 0 && pdata->connect == 450 (pdata->pulldown_ohm == 0 && pdata->connect ==
@@ -452,7 +452,7 @@ static int ntc_thermistor_probe(struct platform_device *pdev)
452 (pdata->connect != NTC_CONNECTED_POSITIVE && 452 (pdata->connect != NTC_CONNECTED_POSITIVE &&
453 pdata->connect != NTC_CONNECTED_GROUND))) { 453 pdata->connect != NTC_CONNECTED_GROUND))) {
454 dev_err(&pdev->dev, 454 dev_err(&pdev->dev,
455 "Required data to use read_uV not supplied.\n"); 455 "Required data to use read_uv not supplied.\n");
456 return -EINVAL; 456 return -EINVAL;
457 } 457 }
458 458
diff --git a/drivers/hwmon/via686a.c b/drivers/hwmon/via686a.c
index 3123b30208c5..9427e95f7903 100644
--- a/drivers/hwmon/via686a.c
+++ b/drivers/hwmon/via686a.c
@@ -125,7 +125,7 @@ static const u8 VIA686A_REG_TEMP_HYST[] = { 0x3a, 0x3e, 0x1e };
125 * (These conversions were contributed by Jonathan Teh Soon Yew 125 * (These conversions were contributed by Jonathan Teh Soon Yew
126 * <j.teh@iname.com>) 126 * <j.teh@iname.com>)
127 */ 127 */
128static inline u8 IN_TO_REG(long val, int inNum) 128static inline u8 IN_TO_REG(long val, int in_num)
129{ 129{
130 /* 130 /*
131 * To avoid floating point, we multiply constants by 10 (100 for +12V). 131 * To avoid floating point, we multiply constants by 10 (100 for +12V).
@@ -134,29 +134,29 @@ static inline u8 IN_TO_REG(long val, int inNum)
134 * by an additional 10000 (100000 for +12V): 1000 for val and 10 (100) 134 * by an additional 10000 (100000 for +12V): 1000 for val and 10 (100)
135 * for the constants. 135 * for the constants.
136 */ 136 */
137 if (inNum <= 1) 137 if (in_num <= 1)
138 return (u8) clamp_val((val * 21024 - 1205000) / 250000, 0, 255); 138 return (u8) clamp_val((val * 21024 - 1205000) / 250000, 0, 255);
139 else if (inNum == 2) 139 else if (in_num == 2)
140 return (u8) clamp_val((val * 15737 - 1205000) / 250000, 0, 255); 140 return (u8) clamp_val((val * 15737 - 1205000) / 250000, 0, 255);
141 else if (inNum == 3) 141 else if (in_num == 3)
142 return (u8) clamp_val((val * 10108 - 1205000) / 250000, 0, 255); 142 return (u8) clamp_val((val * 10108 - 1205000) / 250000, 0, 255);
143 else 143 else
144 return (u8) clamp_val((val * 41714 - 12050000) / 2500000, 0, 144 return (u8) clamp_val((val * 41714 - 12050000) / 2500000, 0,
145 255); 145 255);
146} 146}
147 147
148static inline long IN_FROM_REG(u8 val, int inNum) 148static inline long IN_FROM_REG(u8 val, int in_num)
149{ 149{
150 /* 150 /*
151 * To avoid floating point, we multiply constants by 10 (100 for +12V). 151 * To avoid floating point, we multiply constants by 10 (100 for +12V).
152 * We also multiply them by 1000 because we want 0.001V/bit for the 152 * We also multiply them by 1000 because we want 0.001V/bit for the
153 * output value. Rounding is done. 153 * output value. Rounding is done.
154 */ 154 */
155 if (inNum <= 1) 155 if (in_num <= 1)
156 return (long) ((250000 * val + 1330000 + 21024 / 2) / 21024); 156 return (long) ((250000 * val + 1330000 + 21024 / 2) / 21024);
157 else if (inNum == 2) 157 else if (in_num == 2)
158 return (long) ((250000 * val + 1330000 + 15737 / 2) / 15737); 158 return (long) ((250000 * val + 1330000 + 15737 / 2) / 15737);
159 else if (inNum == 3) 159 else if (in_num == 3)
160 return (long) ((250000 * val + 1330000 + 10108 / 2) / 10108); 160 return (long) ((250000 * val + 1330000 + 10108 / 2) / 10108);
161 else 161 else
162 return (long) ((2500000 * val + 13300000 + 41714 / 2) / 41714); 162 return (long) ((2500000 * val + 13300000 + 41714 / 2) / 41714);
@@ -210,10 +210,10 @@ static inline u8 FAN_TO_REG(long rpm, int div)
210 * VIA register values 0-255. I *10 before rounding, so we get tenth-degree 210 * VIA register values 0-255. I *10 before rounding, so we get tenth-degree
211 * precision. (I could have done all 1024 values for our 10-bit readings, 211 * precision. (I could have done all 1024 values for our 10-bit readings,
212 * but the function is very linear in the useful range (0-80 deg C), so 212 * but the function is very linear in the useful range (0-80 deg C), so
213 * we'll just use linear interpolation for 10-bit readings.) So, tempLUT 213 * we'll just use linear interpolation for 10-bit readings.) So, temp_lut
214 * is the temp at via register values 0-255: 214 * is the temp at via register values 0-255:
215 */ 215 */
216static const s16 tempLUT[] = { 216static const s16 temp_lut[] = {
217 -709, -688, -667, -646, -627, -607, -589, -570, -553, -536, -519, 217 -709, -688, -667, -646, -627, -607, -589, -570, -553, -536, -519,
218 -503, -487, -471, -456, -442, -428, -414, -400, -387, -375, 218 -503, -487, -471, -456, -442, -428, -414, -400, -387, -375,
219 -362, -350, -339, -327, -316, -305, -295, -285, -275, -265, 219 -362, -350, -339, -327, -316, -305, -295, -285, -275, -265,
@@ -261,7 +261,7 @@ static const s16 tempLUT[] = {
261 * - 2.525453e-04*val^3 + 1.424593e-02*val^2 + 2.148941e+00*val +7.275808e+01) 261 * - 2.525453e-04*val^3 + 1.424593e-02*val^2 + 2.148941e+00*val +7.275808e+01)
262 * Note that n=161: 262 * Note that n=161:
263 */ 263 */
264static const u8 viaLUT[] = { 264static const u8 via_lut[] = {
265 12, 12, 13, 14, 14, 15, 16, 16, 17, 18, 18, 19, 20, 20, 21, 22, 23, 265 12, 12, 13, 14, 14, 15, 16, 16, 17, 18, 18, 19, 20, 20, 21, 22, 23,
266 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 35, 36, 37, 39, 40, 266 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 35, 36, 37, 39, 40,
267 41, 43, 45, 46, 48, 49, 51, 53, 55, 57, 59, 60, 62, 64, 66, 267 41, 43, 45, 46, 48, 49, 51, 53, 55, 57, 59, 60, 62, 64, 66,
@@ -284,26 +284,26 @@ static const u8 viaLUT[] = {
284 */ 284 */
285static inline u8 TEMP_TO_REG(long val) 285static inline u8 TEMP_TO_REG(long val)
286{ 286{
287 return viaLUT[val <= -50000 ? 0 : val >= 110000 ? 160 : 287 return via_lut[val <= -50000 ? 0 : val >= 110000 ? 160 :
288 (val < 0 ? val - 500 : val + 500) / 1000 + 50]; 288 (val < 0 ? val - 500 : val + 500) / 1000 + 50];
289} 289}
290 290
291/* for 8-bit temperature hyst and over registers */ 291/* for 8-bit temperature hyst and over registers */
292#define TEMP_FROM_REG(val) ((long)tempLUT[val] * 100) 292#define TEMP_FROM_REG(val) ((long)temp_lut[val] * 100)
293 293
294/* for 10-bit temperature readings */ 294/* for 10-bit temperature readings */
295static inline long TEMP_FROM_REG10(u16 val) 295static inline long TEMP_FROM_REG10(u16 val)
296{ 296{
297 u16 eightBits = val >> 2; 297 u16 eight_bits = val >> 2;
298 u16 twoBits = val & 3; 298 u16 two_bits = val & 3;
299 299
300 /* no interpolation for these */ 300 /* no interpolation for these */
301 if (twoBits == 0 || eightBits == 255) 301 if (two_bits == 0 || eight_bits == 255)
302 return TEMP_FROM_REG(eightBits); 302 return TEMP_FROM_REG(eight_bits);
303 303
304 /* do some linear interpolation */ 304 /* do some linear interpolation */
305 return (tempLUT[eightBits] * (4 - twoBits) + 305 return (temp_lut[eight_bits] * (4 - two_bits) +
306 tempLUT[eightBits + 1] * twoBits) * 25; 306 temp_lut[eight_bits + 1] * two_bits) * 25;
307} 307}
308 308
309#define DIV_FROM_REG(val) (1 << (val)) 309#define DIV_FROM_REG(val) (1 << (val))