mlxsw: core_hwmon: Extend internal structures to support multi hwmon objects
authorVadim Pasternak <vadimp@nvidia.com>
Wed, 13 Apr 2022 15:17:28 +0000 (18:17 +0300)
committerDavid S. Miller <davem@davemloft.net>
Fri, 15 Apr 2022 10:06:13 +0000 (11:06 +0100)
commitb890ad418e1feada06dddc3f00ee2c8cccf77c13
tree185ebe20a5aec28697048022a451db4790f3611e
parentb244143a085e1e6b9bee83bafe99b4e1fc9ee51e
mlxsw: core_hwmon: Extend internal structures to support multi hwmon objects

Currently, mlxsw supports a single hwmon device and registers it with
attributes corresponding to the various objects found on the main
board such as fans and gearboxes.

Line cards can have the same objects, but unlike the main board they
can be added and removed while the system is running. The various
hwmon objects found on these line cards should be created when the
line card becomes available and destroyed when the line card becomes
unavailable.

The above can be achieved by representing each line card as a
different hwmon device and registering / unregistering it when the
line card becomes available / unavailable.

Prepare for multi hwmon device support by splitting
'struct mlxsw_hwmon' into 'struct mlxsw_hwmon' and
'struct mlxsw_hwmon_dev'. The first will hold information relevant to
all hwmon devices, whereas the second will hold per-hwmon device
information.

Signed-off-by: Vadim Pasternak <vadimp@nvidia.com>
Reviewed-by: Jiri Pirko <jiri@nvidia.com>
Signed-off-by: Ido Schimmel <idosch@nvidia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/mellanox/mlxsw/core_hwmon.c