Re: [PATCH v7 03/10] misc: amd-sbi: Move hwmon device sensor as separate entity

From: Arnd Bergmann
Date: Wed Apr 02 2025 - 07:04:20 EST


On Wed, Apr 2, 2025, at 07:58, Akshay Gupta wrote:

> +
> +int create_hwmon_sensor_device(struct device *dev, struct sbrmi_data *data)
> +{
> + if (IS_REACHABLE(CONFIG_HWMON)) {
> + struct device *hwmon_dev;
> +
> + hwmon_dev = devm_hwmon_device_register_with_info(dev, "sbrmi", data,
> + &sbrmi_chip_info, NULL);
> + return PTR_ERR_OR_ZERO(hwmon_dev);
> + }
> + return 0;

I just one more problems with this bit. This was already in the
existing code, but should still be addressed:

Using IS_REACHABLE() is usually a sign that the Kconfig dependencies
are wrong. Fix the dependencies instead so the hwmon driver can
only be enabled if the subsystem is enabled. You can either add a
separate Kconfig symbol or make the driver 'depends on HWMON || !HWMON'
to express this.

Arnd