hwmon: (vexpress) use IS_ENABLED() for CONFIG_REGULATOR_VEXPRESS
Subsystems (2)
PATCH 1/1 hwmon: (vexpress) use IS_ENABLED() for CONFIG_REGULATOR_VEXPRESS
Both the Versatile Express regulator and hwmon drivers match the voltage node. The hwmon driver is intended to expose voltage only when the regulator driver is not configured; its current guard still claims voltage when the regulator is modular.
Use IS_ENABLED for the voltage attributes and match entry. The other hwmon sensors remain available.
The issue was found by our static-analysis tool and manually reviewed.
---
The original patch was prepared with Gemini. Codex assisted with this review and revision (Assisted-by: gpt 5).
Built vexpress-hwmon.o for arm64 with Clang 18 and W=1, with SENSORS_VEXPRESS=m and REGULATOR_VEXPRESS=m. The arm,vexpress-volt string was present before the change and absent afterwards; arm,vexpress-temp remained present. No board was used.
drivers/hwmon/vexpress-hwmon.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/hwmon/vexpress-hwmon.c +2 -2
@@ -83,7 +83,7 @@ struct vexpress_hwmon_type {const struct attribute_group **attr_groups; }; -#if !defined(CONFIG_REGULATOR_VEXPRESS ) +#if !IS_ENABLED (CONFIG_REGULATOR_VEXPRESS ) static DEVICE_ATTR(in1_label, 0444, vexpress_hwmon_label_show, NULL); static SENSOR_DEVICE_ATTR_RO(in1_input, vexpress_hwmon_u32, 1000); static struct attribute *vexpress_hwmon_attrs_volt[] = {
@@ -181,7 +181,7 @@ static struct vexpress_hwmon_type vexpress_hwmon_energy = { };static const struct of_device_id vexpress_hwmon_of_match[] = { -#if !defined(CONFIG_REGULATOR_VEXPRESS) +#if !IS_ENABLED(CONFIG_REGULATOR_VEXPRESS) { .compatible ="arm,vexpress-volt" , .data = &vexpress_hwmon_volt,
base-commit: d06ce6f1eb5eeffd4ebcfde345dc34a98131d106
[email protected]
AI reviewSashiko has reviewed this patch and found no issues.
Quoted 5 lines
Both the Versatile Express regulator and hwmon drivers match the voltage node. The hwmon driver is intended to expose voltage only when the regulator driver is not configured; its current guard still claims voltage when the regulator is modular.
Quoted 7 lines
Use
IS_ENABLEDfor the voltage attributes and match entry. The other hwmon sensors remain available.The issue was found by our static-analysis tool and manually reviewed.
Fixes 48ed88772446 ("hwmon: Versatile Express hwmon driver")Signed-off-by Pengpeng Hou <[email protected]>
Sashiko has reviewed this patch and found no issues.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
Quoted 5 lines · Pengpeng Hou
Both the Versatile Express regulator and hwmon drivers match the voltage node. The hwmon driver is intended to expose voltage only when the regulator driver is not configured; its current guard still claims voltage when the regulator is modular.
Quoted 7 lines
Use
IS_ENABLEDfor the voltage attributes and match entry. The other hwmon sensors remain available.The issue was found by our static-analysis tool and manually reviewed.
Fixes 48ed88772446 ("hwmon: Versatile Express hwmon driver")Signed-off-by Pengpeng Hou <[email protected]>
Applied.
Thanks,
Guenter