mirror of
https://github.com/openwrt/openwrt.git
synced 2026-10-13 19:48:16 +04:00
The RTL838x and RTL839x families use different mechanisms for reading and configuring the port egress rate. Add get_egress_rate and set_egress_rate callbacks to rtldsa_config and use them from debugfs instead of selecting the implementation based on priv->family_id. Rename the existing functions to use the rtldsa_838x and rtldsa_839x prefixes consistently with the other SoC-specific callbacks. This removes another family_id dependency from the common debugfs code and keeps the SoC-specific implementation selected through rtldsa_config. While we are here do some minor type cleanups: - Change the value used by port_egress_rate_read() from int to u32 and remove the negative value check. Both get_egress_rate callbacks return u32, so value can never be negative and the check could not report an error. The callbacks return 0 for an invalid port instead. - Change the res size_t variable type to ssize_t. This fixes the dead comparison "res < 0". - Remove the uninitialized read in rtldsa_839x_get_egress_rate() Assisted-by: ChatGPT (OpenAI GPT-5.6 Sol) Link: https://github.com/openwrt/openwrt/pull/24918 Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>