Re: [RFC PATCH v6 10/11] net: dsa: qca8k: add LEDs support
From: Andrew Lunn
Date: Wed May 04 2022 - 21:46:27 EST
> +config NET_DSA_QCA8K_LEDS_SUPPORT
> + tristate "Qualcomm Atheros QCA8K Ethernet switch family LEDs support"
> + select NET_DSA_QCA8K
The should be a depends, not a select. It will then become visible
when the NET_DSA_QCA8K directly above it is enabled.
> + select LEDS_OFFLOAD_TRIGGERS
and this should also be a depends. If the LED core does not have
support, the QCA8K driver should not enable its support.
> +static int
> +qca8k_parse_netdev(unsigned long rules, u32 *offload_trigger, u32 *mask)
> +{
> + /* Parsing specific to netdev trigger */
> + if (test_bit(TRIGGER_NETDEV_LINK, &rules))
> + *offload_trigger = QCA8K_LED_LINK_10M_EN_MASK |
> + QCA8K_LED_LINK_100M_EN_MASK |
> + QCA8K_LED_LINK_1000M_EN_MASK;
> + if (test_bit(TRIGGER_NETDEV_LINK_10, &rules))
> + *offload_trigger = QCA8K_LED_LINK_10M_EN_MASK;
> + if (test_bit(TRIGGER_NETDEV_LINK_100, &rules))
> + *offload_trigger = QCA8K_LED_LINK_100M_EN_MASK;
> + if (test_bit(TRIGGER_NETDEV_LINK_1000, &rules))
> + *offload_trigger = QCA8K_LED_LINK_1000M_EN_MASK;
> + if (test_bit(TRIGGER_NETDEV_HALF_DUPLEX, &rules))
> + *offload_trigger = QCA8K_LED_HALF_DUPLEX_MASK;
> + if (test_bit(TRIGGER_NETDEV_FULL_DUPLEX, &rules))
> + *offload_trigger = QCA8K_LED_FULL_DUPLEX_MASK;
> + if (test_bit(TRIGGER_NETDEV_TX, &rules))
> + *offload_trigger = QCA8K_LED_TX_BLINK_MASK;
> + if (test_bit(TRIGGER_NETDEV_RX, &rules))
> + *offload_trigger = QCA8K_LED_RX_BLINK_MASK;
> + if (test_bit(TRIGGER_NETDEV_BLINK_2HZ, &rules))
> + *offload_trigger = QCA8K_LED_BLINK_2HZ;
> + if (test_bit(TRIGGER_NETDEV_BLINK_4HZ, &rules))
> + *offload_trigger = QCA8K_LED_BLINK_4HZ;
> + if (test_bit(TRIGGER_NETDEV_BLINK_8HZ, &rules))
> + *offload_trigger = QCA8K_LED_BLINK_8HZ;
> +
> + pr_info("OFFLOAD TRIGGER %x\n", *offload_trigger);
leftover debug print.
Andrew