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

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'hwmon-for-v5.8-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging into master

Pull hwmon fixes from Guenter Roeck:

- Using SCT on some Tohsiba drives causes firmware hangs. Disable its
use in the drivetemp driver.

- Handle potential buffer overflows in scmi and aspeed-pwm-tacho
driver.

- Energy reporting does not work well on all AMD CPUs. Restrict
amd_energy to known working models.

- Enable reading the CPU temperature on NCT6798D using undocumented
registers.

- Fix read errors seen if PEC is enabled in adm1275 driver.

- Fix setting the pwm1_enable in emc2103 driver.

* tag 'hwmon-for-v5.8-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging:
hwmon: (drivetemp) Avoid SCT usage on Toshiba DT01ACA family drives
hwmon: (scmi) Fix potential buffer overflow in scmi_hwmon_probe()
hwmon: (nct6775) Accept PECI Calibration as temperature source for NCT6798D
hwmon: (adm1275) Make sure we are reading enough data for different chips
hwmon: (emc2103) fix unable to change fan pwm1_enable attribute
hwmon: (amd_energy) match for supported models
hwmon: (aspeed-pwm-tacho) Avoid possible buffer overflow

+59 -8
+1 -1
drivers/hwmon/amd_energy.c
··· 362 362 static struct platform_device *amd_energy_platdev; 363 363 364 364 static const struct x86_cpu_id cpu_ids[] __initconst = { 365 - X86_MATCH_VENDOR_FAM(AMD, 0x17, NULL), 365 + X86_MATCH_VENDOR_FAM_MODEL(AMD, 0x17, 0x31, NULL), 366 366 {} 367 367 }; 368 368 MODULE_DEVICE_TABLE(x86cpu, cpu_ids);
+2
drivers/hwmon/aspeed-pwm-tacho.c
··· 851 851 ret = of_property_read_u32(child, "reg", &pwm_port); 852 852 if (ret) 853 853 return ret; 854 + if (pwm_port >= ARRAY_SIZE(pwm_port_params)) 855 + return -EINVAL; 854 856 aspeed_create_pwm_port(priv, (u8)pwm_port); 855 857 856 858 ret = of_property_count_u8_elems(child, "cooling-levels");
+43
drivers/hwmon/drivetemp.c
··· 285 285 return err; 286 286 } 287 287 288 + static const char * const sct_avoid_models[] = { 289 + /* 290 + * These drives will have WRITE FPDMA QUEUED command timeouts and sometimes just 291 + * freeze until power-cycled under heavy write loads when their temperature is 292 + * getting polled in SCT mode. The SMART mode seems to be fine, though. 293 + * 294 + * While only the 3 TB model (DT01ACA3) was actually caught exhibiting the 295 + * problem let's play safe here to avoid data corruption and ban the whole 296 + * DT01ACAx family. 297 + 298 + * The models from this array are prefix-matched. 299 + */ 300 + "TOSHIBA DT01ACA", 301 + }; 302 + 303 + static bool drivetemp_sct_avoid(struct drivetemp_data *st) 304 + { 305 + struct scsi_device *sdev = st->sdev; 306 + unsigned int ctr; 307 + 308 + if (!sdev->model) 309 + return false; 310 + 311 + /* 312 + * The "model" field contains just the raw SCSI INQUIRY response 313 + * "product identification" field, which has a width of 16 bytes. 314 + * This field is space-filled, but is NOT NULL-terminated. 315 + */ 316 + for (ctr = 0; ctr < ARRAY_SIZE(sct_avoid_models); ctr++) 317 + if (!strncmp(sdev->model, sct_avoid_models[ctr], 318 + strlen(sct_avoid_models[ctr]))) 319 + return true; 320 + 321 + return false; 322 + } 323 + 288 324 static int drivetemp_identify_sata(struct drivetemp_data *st) 289 325 { 290 326 struct scsi_device *sdev = st->sdev; ··· 362 326 /* bail out if this is not a SATA device */ 363 327 if (!is_ata || !is_sata) 364 328 return -ENODEV; 329 + 330 + if (have_sct && drivetemp_sct_avoid(st)) { 331 + dev_notice(&sdev->sdev_gendev, 332 + "will avoid using SCT for temperature monitoring\n"); 333 + have_sct = false; 334 + } 335 + 365 336 if (!have_sct) 366 337 goto skip_sct; 367 338
+1 -1
drivers/hwmon/emc2103.c
··· 443 443 } 444 444 445 445 result = read_u8_from_i2c(client, REG_FAN_CONF1, &conf_reg); 446 - if (result) { 446 + if (result < 0) { 447 447 count = result; 448 448 goto err; 449 449 }
+3 -3
drivers/hwmon/nct6775.c
··· 786 786 "Agent1 Dimm1", 787 787 "BYTE_TEMP0", 788 788 "BYTE_TEMP1", 789 - "", 790 - "", 789 + "PECI Agent 0 Calibration", /* undocumented */ 790 + "PECI Agent 1 Calibration", /* undocumented */ 791 791 "", 792 792 "Virtual_TEMP" 793 793 }; 794 794 795 - #define NCT6798_TEMP_MASK 0x8fff0ffe 795 + #define NCT6798_TEMP_MASK 0xbfff0ffe 796 796 #define NCT6798_VIRT_TEMP_MASK 0x80000c00 797 797 798 798 /* NCT6102D/NCT6106D specific data */
+8 -2
drivers/hwmon/pmbus/adm1275.c
··· 465 465 static int adm1275_probe(struct i2c_client *client, 466 466 const struct i2c_device_id *id) 467 467 { 468 + s32 (*config_read_fn)(const struct i2c_client *client, u8 reg); 468 469 u8 block_buffer[I2C_SMBUS_BLOCK_MAX + 1]; 469 470 int config, device_config; 470 471 int ret; ··· 511 510 "Device mismatch: Configured %s, detected %s\n", 512 511 id->name, mid->name); 513 512 514 - config = i2c_smbus_read_byte_data(client, ADM1275_PMON_CONFIG); 513 + if (mid->driver_data == adm1272 || mid->driver_data == adm1278 || 514 + mid->driver_data == adm1293 || mid->driver_data == adm1294) 515 + config_read_fn = i2c_smbus_read_word_data; 516 + else 517 + config_read_fn = i2c_smbus_read_byte_data; 518 + config = config_read_fn(client, ADM1275_PMON_CONFIG); 515 519 if (config < 0) 516 520 return config; 517 521 518 - device_config = i2c_smbus_read_byte_data(client, ADM1275_DEVICE_CONFIG); 522 + device_config = config_read_fn(client, ADM1275_DEVICE_CONFIG); 519 523 if (device_config < 0) 520 524 return device_config; 521 525
+1 -1
drivers/hwmon/scmi-hwmon.c
··· 147 147 [ENERGY] = hwmon_energy, 148 148 }; 149 149 150 - static u32 hwmon_attributes[] = { 150 + static u32 hwmon_attributes[hwmon_max] = { 151 151 [hwmon_chip] = HWMON_C_REGISTER_TZ, 152 152 [hwmon_temp] = HWMON_T_INPUT | HWMON_T_LABEL, 153 153 [hwmon_in] = HWMON_I_INPUT | HWMON_I_LABEL,