Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

hwmon: Fix CamelCase checkpatch warnings

Signed-off-by: Guenter Roeck <linux@roeck-us.net>

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