Commit 0cb595e8 authored by Huisong Li's avatar Huisong Li Committed by Jakub Kicinski
Browse files

net: phy: marvell: Use HWMON_CHANNEL_INFO macro to simplify code



Use HWMON_CHANNEL_INFO macro to simplify code.

Signed-off-by: default avatarHuisong Li <lihuisong@huawei.com>
Link: https://patch.msgid.link/20250210054710.12855-4-lihuisong@huawei.com


Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent e05427c4
Loading
Loading
Loading
Loading
+2 −22
Original line number Diff line number Diff line
@@ -3124,33 +3124,13 @@ static umode_t marvell_hwmon_is_visible(const void *data,
	}
}

static u32 marvell_hwmon_chip_config[] = {
	HWMON_C_REGISTER_TZ,
	0
};

static const struct hwmon_channel_info marvell_hwmon_chip = {
	.type = hwmon_chip,
	.config = marvell_hwmon_chip_config,
};

/* we can define HWMON_T_CRIT and HWMON_T_MAX_ALARM even though these are not
 * defined for all PHYs, because the hwmon code checks whether the attributes
 * exists via the .is_visible method
 */
static u32 marvell_hwmon_temp_config[] = {
	HWMON_T_INPUT | HWMON_T_CRIT | HWMON_T_MAX_ALARM,
	0
};

static const struct hwmon_channel_info marvell_hwmon_temp = {
	.type = hwmon_temp,
	.config = marvell_hwmon_temp_config,
};

static const struct hwmon_channel_info * const marvell_hwmon_info[] = {
	&marvell_hwmon_chip,
	&marvell_hwmon_temp,
	HWMON_CHANNEL_INFO(chip, HWMON_C_REGISTER_TZ),
	HWMON_CHANNEL_INFO(temp, HWMON_T_INPUT | HWMON_T_CRIT | HWMON_T_MAX_ALARM),
	NULL
};