ethtool: untangle the linkmode and ethtool headers

Commit 26c5334d34 ("ethtool: Add forced speed to supported link
modes maps") added a dependency between ethtool.h and linkmode.h.
The dependency in the opposite direction already exists so the
new code was inserted in an awkward place.

The reason for ethtool.h to include linkmode.h, is that
ethtool_forced_speed_maps_init() is a static inline helper.
That's not really necessary.

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Reviewed-by: Paul Greenwalt <paul.greenwalt@intel.com>
Reviewed-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Reviewed-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Jakub Kicinski
2023-10-19 08:28:15 -07:00
committed by David S. Miller
parent b4a11b2033
commit 20c6e05bd3
3 changed files with 37 additions and 35 deletions

View File

@@ -685,3 +685,24 @@ ethtool_params_from_link_mode(struct ethtool_link_ksettings *link_ksettings,
link_ksettings->base.duplex = link_info->duplex;
}
EXPORT_SYMBOL_GPL(ethtool_params_from_link_mode);
/**
* ethtool_forced_speed_maps_init
* @maps: Pointer to an array of Ethtool forced speed map
* @size: Array size
*
* Initialize an array of Ethtool forced speed map to Ethtool link modes. This
* should be called during driver module init.
*/
void
ethtool_forced_speed_maps_init(struct ethtool_forced_speed_map *maps, u32 size)
{
for (u32 i = 0; i < size; i++) {
struct ethtool_forced_speed_map *map = &maps[i];
linkmode_set_bit_array(map->cap_arr, map->arr_size, map->caps);
map->cap_arr = NULL;
map->arr_size = 0;
}
}
EXPORT_SYMBOL_GPL(ethtool_forced_speed_maps_init);