Commit 815f5f57 authored by Beniamin Sandu's avatar Beniamin Sandu Committed by Jakub Kicinski

net: sfp: use simplified HWMON_CHANNEL_INFO macro

This makes the code look cleaner and easier to read.
Signed-off-by: default avatarBeniamin Sandu <beniaminsandu@gmail.com>
Link: https://lore.kernel.org/r/20220813204658.848372-1-beniaminsandu@gmail.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 5417197d
......@@ -1195,62 +1195,31 @@ static const struct hwmon_ops sfp_hwmon_ops = {
.read_string = sfp_hwmon_read_string,
};
static u32 sfp_hwmon_chip_config[] = {
HWMON_C_REGISTER_TZ,
0,
};
static const struct hwmon_channel_info sfp_hwmon_chip = {
.type = hwmon_chip,
.config = sfp_hwmon_chip_config,
};
static u32 sfp_hwmon_temp_config[] = {
HWMON_T_INPUT |
HWMON_T_MAX | HWMON_T_MIN |
HWMON_T_MAX_ALARM | HWMON_T_MIN_ALARM |
HWMON_T_CRIT | HWMON_T_LCRIT |
HWMON_T_CRIT_ALARM | HWMON_T_LCRIT_ALARM |
HWMON_T_LABEL,
0,
};
static const struct hwmon_channel_info sfp_hwmon_temp_channel_info = {
.type = hwmon_temp,
.config = sfp_hwmon_temp_config,
};
static u32 sfp_hwmon_vcc_config[] = {
static const struct hwmon_channel_info *sfp_hwmon_info[] = {
HWMON_CHANNEL_INFO(chip,
HWMON_C_REGISTER_TZ),
HWMON_CHANNEL_INFO(in,
HWMON_I_INPUT |
HWMON_I_MAX | HWMON_I_MIN |
HWMON_I_MAX_ALARM | HWMON_I_MIN_ALARM |
HWMON_I_CRIT | HWMON_I_LCRIT |
HWMON_I_CRIT_ALARM | HWMON_I_LCRIT_ALARM |
HWMON_I_LABEL,
0,
};
static const struct hwmon_channel_info sfp_hwmon_vcc_channel_info = {
.type = hwmon_in,
.config = sfp_hwmon_vcc_config,
};
static u32 sfp_hwmon_bias_config[] = {
HWMON_I_LABEL),
HWMON_CHANNEL_INFO(temp,
HWMON_T_INPUT |
HWMON_T_MAX | HWMON_T_MIN |
HWMON_T_MAX_ALARM | HWMON_T_MIN_ALARM |
HWMON_T_CRIT | HWMON_T_LCRIT |
HWMON_T_CRIT_ALARM | HWMON_T_LCRIT_ALARM |
HWMON_T_LABEL),
HWMON_CHANNEL_INFO(curr,
HWMON_C_INPUT |
HWMON_C_MAX | HWMON_C_MIN |
HWMON_C_MAX_ALARM | HWMON_C_MIN_ALARM |
HWMON_C_CRIT | HWMON_C_LCRIT |
HWMON_C_CRIT_ALARM | HWMON_C_LCRIT_ALARM |
HWMON_C_LABEL,
0,
};
static const struct hwmon_channel_info sfp_hwmon_bias_channel_info = {
.type = hwmon_curr,
.config = sfp_hwmon_bias_config,
};
static u32 sfp_hwmon_power_config[] = {
HWMON_C_LABEL),
HWMON_CHANNEL_INFO(power,
/* Transmit power */
HWMON_P_INPUT |
HWMON_P_MAX | HWMON_P_MIN |
......@@ -1264,21 +1233,7 @@ static u32 sfp_hwmon_power_config[] = {
HWMON_P_MAX_ALARM | HWMON_P_MIN_ALARM |
HWMON_P_CRIT | HWMON_P_LCRIT |
HWMON_P_CRIT_ALARM | HWMON_P_LCRIT_ALARM |
HWMON_P_LABEL,
0,
};
static const struct hwmon_channel_info sfp_hwmon_power_channel_info = {
.type = hwmon_power,
.config = sfp_hwmon_power_config,
};
static const struct hwmon_channel_info *sfp_hwmon_info[] = {
&sfp_hwmon_chip,
&sfp_hwmon_vcc_channel_info,
&sfp_hwmon_temp_channel_info,
&sfp_hwmon_bias_channel_info,
&sfp_hwmon_power_channel_info,
HWMON_P_LABEL),
NULL,
};
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment