Skip to content

Commit 00c1675

Browse files
bevanweissrobimarko
authored andcommitted
realtek: RTL930x led_set count error message tidy up + dev_ print fixups
Whilst testing Hasivo s1100wp-8gt-se LED configuration, several error messages were presented which didn't indicate which led_set they were referencing, nor what the value was that caused the invalid configuration. Migrate to use dev_ print messages for this function. And tidy up both when the error message is reported (don't show it when an led_set isn't in the DTS) and what details the message presents. Signed-off-by: Bevan Weiss <[email protected]> Link: openwrt/openwrt#19791 Signed-off-by: Robert Marko <[email protected]>
1 parent 5d44b11 commit 00c1675

File tree

1 file changed

+9
-5
lines changed
  • target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx

1 file changed

+9
-5
lines changed

target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/rtl930x.c

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2244,12 +2244,12 @@ static void rtl930x_set_distribution_algorithm(int group, int algoidx, u32 algom
22442244
static void rtl930x_led_init(struct rtl838x_switch_priv *priv)
22452245
{
22462246
struct device_node *node;
2247+
struct device *dev = priv->dev;
22472248
u32 pm = 0;
22482249

2249-
pr_debug("%s called\n", __func__);
22502250
node = of_find_compatible_node(NULL, NULL, "realtek,rtl9300-leds");
22512251
if (!node) {
2252-
pr_debug("%s No compatible LED node found\n", __func__);
2252+
dev_dbg(dev, "No compatible LED node found\n");
22532253
return;
22542254
}
22552255

@@ -2271,10 +2271,14 @@ static void rtl930x_led_init(struct rtl838x_switch_priv *priv)
22712271
sprintf(set_name, "led_set%d", set);
22722272
leds_in_this_set = of_property_count_u32_elems(node, set_name);
22732273

2274-
if (leds_in_this_set == 0 || leds_in_this_set > sizeof(set_config)) {
2275-
pr_err("%s led_set configuration invalid skipping over this set\n", __func__);
2274+
if (leds_in_this_set <= 0 || leds_in_this_set > sizeof(set_config)) {
2275+
if (leds_in_this_set != -EINVAL) {
2276+
dev_err(dev, "%s invalid, skipping this set, leds_in_this_set=%d, should be (0, %d]\n",
2277+
set_name, leds_in_this_set, sizeof(set_config));
2278+
}
22762279
continue;
22772280
}
2281+
dev_info(dev, "%s has %d LEDs configured\n", set_name, leds_in_this_set);
22782282

22792283
if (of_property_read_u32_array(node, set_name, set_config, leds_in_this_set)) {
22802284
break;
@@ -2323,7 +2327,7 @@ static void rtl930x_led_init(struct rtl838x_switch_priv *priv)
23232327
sw_w32(pm, RTL930X_LED_PORT_COMBO_MASK_CTRL);
23242328

23252329
for (int i = 0; i < 24; i++)
2326-
pr_debug("%s %08x: %08x\n",__func__, 0xbb00cc00 + i * 4, sw_r32(0xcc00 + i * 4));
2330+
dev_dbg(dev, "%08x: %08x\n", 0xbb00cc00 + i * 4, sw_r32(0xcc00 + i * 4));
23272331
}
23282332

23292333
const struct rtl838x_reg rtl930x_reg = {

0 commit comments

Comments
 (0)