diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2021-04-26 14:59:21 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2021-04-26 14:59:21 -0700 |
commit | 47080f2286110c371b9cf75ac7b34a6f2f1cf4ba (patch) | |
tree | fdc9cf3da77cffd1add8a9e7c44df988291837c7 /drivers/hwmon/occ/common.c | |
parent | 55ba0fe059a577fa08f23223991b24564962620f (diff) | |
parent | 9049572fb145746725b198a19e27fa2671b80448 (diff) | |
download | linux-47080f2286110c371b9cf75ac7b34a6f2f1cf4ba.tar.bz2 |
Merge tag 'hwmon-for-v5.13' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging
Pull hwmon updates from Guenter Roeck:
"The most notable change is the removal of the amd_energy driver. It
was rendered all but unusable by making its attributes privileged-only
to work around a security issue. A suggested remedy was rejected by
AMD, so the only real solution was to remove the driver. For the
future, we'll have to make sure that no privileged-access-only drivers
are accepted into the hwmon subsystem in the first place. The hwmon
ABI document was updated accordingly.
Other changes:
PMBus drivers:
- Added driver for MAX15301
- Added driver for BluTek BPA-RS600
- Added driver for fsp-3y PSUs and PDUs
- Added driver for Infineon IR36021
- Added driver for ST STPDDC60
- Added support for TI TPS53676 to tps53679 driver
- Introduced PMBUS symbol namespace. This was made necessary by a
suggestion to use its exported functions from outside the hwmon
subsystem.
- Minor improvements and bug fixes
New drivers:
- Driver for NZXT Kraken X42/X52/X62/X72
Driver enhancements:
- Added support for Intel D5005 to intel-m10-bmc-hwmon driver
- Added support for NCT6686D to nct6683 driver
Other:
- Converted sch5627 and amd9240 drivers to
hwmon_device_register_with_info()
- Added support for fan drawers capability and present registers to
mlxreg-fan driver
- Added Dell Latitude E7440 to fan control whitelist in dell-smm
driver
- Replaced snprintf in show functions with sysfs_emit. Done with
coccinelle script for all drivers to preempt endless per-driver
submissions of the same change.
- Use kobj_to_dev(). Another coccinelle based change to preempt
endless per-driver submissions of the same change.
- Various minor fixes and improvements"
* tag 'hwmon-for-v5.13' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging: (38 commits)
hwmon: Remove amd_energy driver
hwmon: Clarify scope of attribute access
hwmon: (pmbus) Introduce PMBUS symbol namespace
hwmon: (pmbus) Add pmbus driver for MAX15301
hwmon: (sch5627) Remove unnecessary error path
hwmon: (sch5627) Use devres function
hwmon: (pmbus/pxe1610) don't bail out when not all pages are active
hwmon: Add driver for fsp-3y PSUs and PDUs
hwmon: (intel-m10-bmc-hwmon) add sensor support of Intel D5005 card
hwmon: (sch5627) Split sch5627_update_device()
hwmon: (sch5627) Convert to hwmon_device_register_with_info()
hwmon: (nct6683) remove useless function
hwmon: (dell-smm) Add Dell Latitude E7440 to fan control whitelist
MAINTAINERS: Add keyword pattern for hwmon registration functions
hwmon: (mlxreg-fan) Add support for fan drawers capability and present registers
hwmon: (pmbus/tps53679) Add support for TI TPS53676
dt-bindings: Add trivial device entry for TPS53676
hwmon: (ftsteutates) Rudimentary typo fixes
hwmon: (pmbus) Add driver for BluTek BPA-RS600
dt-bindings: Add vendor prefix and trivial device for BluTek BPA-RS600
...
Diffstat (limited to 'drivers/hwmon/occ/common.c')
-rw-r--r-- | drivers/hwmon/occ/common.c | 69 |
1 files changed, 35 insertions, 34 deletions
diff --git a/drivers/hwmon/occ/common.c b/drivers/hwmon/occ/common.c index 7a5e539b567b..f1ac153d0b56 100644 --- a/drivers/hwmon/occ/common.c +++ b/drivers/hwmon/occ/common.c @@ -261,7 +261,7 @@ static ssize_t occ_show_temp_1(struct device *dev, return -EINVAL; } - return snprintf(buf, PAGE_SIZE - 1, "%u\n", val); + return sysfs_emit(buf, "%u\n", val); } static ssize_t occ_show_temp_2(struct device *dev, @@ -312,7 +312,7 @@ static ssize_t occ_show_temp_2(struct device *dev, return -EINVAL; } - return snprintf(buf, PAGE_SIZE - 1, "%u\n", val); + return sysfs_emit(buf, "%u\n", val); } static ssize_t occ_show_temp_10(struct device *dev, @@ -366,7 +366,7 @@ static ssize_t occ_show_temp_10(struct device *dev, return -EINVAL; } - return snprintf(buf, PAGE_SIZE - 1, "%u\n", val); + return sysfs_emit(buf, "%u\n", val); } static ssize_t occ_show_freq_1(struct device *dev, @@ -396,7 +396,7 @@ static ssize_t occ_show_freq_1(struct device *dev, return -EINVAL; } - return snprintf(buf, PAGE_SIZE - 1, "%u\n", val); + return sysfs_emit(buf, "%u\n", val); } static ssize_t occ_show_freq_2(struct device *dev, @@ -426,7 +426,7 @@ static ssize_t occ_show_freq_2(struct device *dev, return -EINVAL; } - return snprintf(buf, PAGE_SIZE - 1, "%u\n", val); + return sysfs_emit(buf, "%u\n", val); } static ssize_t occ_show_power_1(struct device *dev, @@ -465,7 +465,7 @@ static ssize_t occ_show_power_1(struct device *dev, return -EINVAL; } - return snprintf(buf, PAGE_SIZE - 1, "%llu\n", val); + return sysfs_emit(buf, "%llu\n", val); } static u64 occ_get_powr_avg(u64 *accum, u32 *samples) @@ -494,9 +494,9 @@ static ssize_t occ_show_power_2(struct device *dev, switch (sattr->nr) { case 0: - return snprintf(buf, PAGE_SIZE - 1, "%u_%u_%u\n", - get_unaligned_be32(&power->sensor_id), - power->function_id, power->apss_channel); + return sysfs_emit(buf, "%u_%u_%u\n", + get_unaligned_be32(&power->sensor_id), + power->function_id, power->apss_channel); case 1: val = occ_get_powr_avg(&power->accumulator, &power->update_tag); @@ -512,7 +512,7 @@ static ssize_t occ_show_power_2(struct device *dev, return -EINVAL; } - return snprintf(buf, PAGE_SIZE - 1, "%llu\n", val); + return sysfs_emit(buf, "%llu\n", val); } static ssize_t occ_show_power_a0(struct device *dev, @@ -533,8 +533,8 @@ static ssize_t occ_show_power_a0(struct device *dev, switch (sattr->nr) { case 0: - return snprintf(buf, PAGE_SIZE - 1, "%u_system\n", - get_unaligned_be32(&power->sensor_id)); + return sysfs_emit(buf, "%u_system\n", + get_unaligned_be32(&power->sensor_id)); case 1: val = occ_get_powr_avg(&power->system.accumulator, &power->system.update_tag); @@ -547,8 +547,8 @@ static ssize_t occ_show_power_a0(struct device *dev, val = get_unaligned_be16(&power->system.value) * 1000000ULL; break; case 4: - return snprintf(buf, PAGE_SIZE - 1, "%u_proc\n", - get_unaligned_be32(&power->sensor_id)); + return sysfs_emit(buf, "%u_proc\n", + get_unaligned_be32(&power->sensor_id)); case 5: val = occ_get_powr_avg(&power->proc.accumulator, &power->proc.update_tag); @@ -561,8 +561,8 @@ static ssize_t occ_show_power_a0(struct device *dev, val = get_unaligned_be16(&power->proc.value) * 1000000ULL; break; case 8: - return snprintf(buf, PAGE_SIZE - 1, "%u_vdd\n", - get_unaligned_be32(&power->sensor_id)); + return sysfs_emit(buf, "%u_vdd\n", + get_unaligned_be32(&power->sensor_id)); case 9: val = occ_get_powr_avg(&power->vdd.accumulator, &power->vdd.update_tag); @@ -575,8 +575,8 @@ static ssize_t occ_show_power_a0(struct device *dev, val = get_unaligned_be16(&power->vdd.value) * 1000000ULL; break; case 12: - return snprintf(buf, PAGE_SIZE - 1, "%u_vdn\n", - get_unaligned_be32(&power->sensor_id)); + return sysfs_emit(buf, "%u_vdn\n", + get_unaligned_be32(&power->sensor_id)); case 13: val = occ_get_powr_avg(&power->vdn.accumulator, &power->vdn.update_tag); @@ -592,7 +592,7 @@ static ssize_t occ_show_power_a0(struct device *dev, return -EINVAL; } - return snprintf(buf, PAGE_SIZE - 1, "%llu\n", val); + return sysfs_emit(buf, "%llu\n", val); } static ssize_t occ_show_caps_1_2(struct device *dev, @@ -613,7 +613,7 @@ static ssize_t occ_show_caps_1_2(struct device *dev, switch (sattr->nr) { case 0: - return snprintf(buf, PAGE_SIZE - 1, "system\n"); + return sysfs_emit(buf, "system\n"); case 1: val = get_unaligned_be16(&caps->cap) * 1000000ULL; break; @@ -642,7 +642,7 @@ static ssize_t occ_show_caps_1_2(struct device *dev, return -EINVAL; } - return snprintf(buf, PAGE_SIZE - 1, "%llu\n", val); + return sysfs_emit(buf, "%llu\n", val); } static ssize_t occ_show_caps_3(struct device *dev, @@ -663,7 +663,7 @@ static ssize_t occ_show_caps_3(struct device *dev, switch (sattr->nr) { case 0: - return snprintf(buf, PAGE_SIZE - 1, "system\n"); + return sysfs_emit(buf, "system\n"); case 1: val = get_unaligned_be16(&caps->cap) * 1000000ULL; break; @@ -689,7 +689,7 @@ static ssize_t occ_show_caps_3(struct device *dev, return -EINVAL; } - return snprintf(buf, PAGE_SIZE - 1, "%llu\n", val); + return sysfs_emit(buf, "%llu\n", val); } static ssize_t occ_store_caps_user(struct device *dev, @@ -732,21 +732,22 @@ static ssize_t occ_show_extended(struct device *dev, switch (sattr->nr) { case 0: - if (extn->flags & EXTN_FLAG_SENSOR_ID) - rc = snprintf(buf, PAGE_SIZE - 1, "%u", - get_unaligned_be32(&extn->sensor_id)); - else - rc = snprintf(buf, PAGE_SIZE - 1, "%02x%02x%02x%02x\n", - extn->name[0], extn->name[1], - extn->name[2], extn->name[3]); + if (extn->flags & EXTN_FLAG_SENSOR_ID) { + rc = sysfs_emit(buf, "%u", + get_unaligned_be32(&extn->sensor_id)); + } else { + rc = sysfs_emit(buf, "%02x%02x%02x%02x\n", + extn->name[0], extn->name[1], + extn->name[2], extn->name[3]); + } break; case 1: - rc = snprintf(buf, PAGE_SIZE - 1, "%02x\n", extn->flags); + rc = sysfs_emit(buf, "%02x\n", extn->flags); break; case 2: - rc = snprintf(buf, PAGE_SIZE - 1, "%02x%02x%02x%02x%02x%02x\n", - extn->data[0], extn->data[1], extn->data[2], - extn->data[3], extn->data[4], extn->data[5]); + rc = sysfs_emit(buf, "%02x%02x%02x%02x%02x%02x\n", + extn->data[0], extn->data[1], extn->data[2], + extn->data[3], extn->data[4], extn->data[5]); break; default: return -EINVAL; |