Re: [net-next PATCH v3 02/14] net: dsa: qca8k: add LEDs basic support
From: Vladimir Oltean
Date: Tue Mar 14 2023 - 20:23:25 EST
On Tue, Mar 14, 2023 at 11:15:04AM +0100, Christian Marangi wrote:
> Add LEDs basic support for qca8k Switch Family by adding basic
> brightness_set() support.
>
> Since these LEDs refelect port status, the default label is set to
> ":port". DT binding should describe the color, function and number of
> the leds using standard LEDs api.
>
> These LEDs supports only blocking variant of the brightness_set()
> function since they can sleep during access of the switch leds to set
> the brightness.
>
> While at it add to the qca8k header file each mode defined by the Switch
> Documentation for future use.
>
> Signed-off-by: Christian Marangi <ansuelsmth@xxxxxxxxx>
> ---
> drivers/net/dsa/qca/Kconfig | 7 ++
> drivers/net/dsa/qca/Makefile | 1 +
> drivers/net/dsa/qca/qca8k-8xxx.c | 4 +
> drivers/net/dsa/qca/qca8k-leds.c | 191 +++++++++++++++++++++++++++++++
> drivers/net/dsa/qca/qca8k.h | 69 +++++++++++
> 5 files changed, 272 insertions(+)
> create mode 100644 drivers/net/dsa/qca/qca8k-leds.c
>
> diff --git a/drivers/net/dsa/qca/Kconfig b/drivers/net/dsa/qca/Kconfig
> index ba339747362c..9ed9d9cf80eb 100644
> --- a/drivers/net/dsa/qca/Kconfig
> +++ b/drivers/net/dsa/qca/Kconfig
> @@ -15,3 +15,10 @@ config NET_DSA_QCA8K
> help
> This enables support for the Qualcomm Atheros QCA8K Ethernet
> switch chips.
> +
> +config NET_DSA_QCA8K_LEDS_SUPPORT
> + bool "Qualcomm Atheros QCA8K Ethernet switch family LEDs support"
> + depends on NET_DSA_QCA8K
> + help
> + This enabled support for LEDs present on the Qualcomm Atheros
> + QCA8K Ethernet switch chips.
> diff --git a/drivers/net/dsa/qca/Makefile b/drivers/net/dsa/qca/Makefile
> index 701f1d199e93..330ae389e489 100644
> --- a/drivers/net/dsa/qca/Makefile
> +++ b/drivers/net/dsa/qca/Makefile
> @@ -2,3 +2,4 @@
> obj-$(CONFIG_NET_DSA_AR9331) += ar9331.o
> obj-$(CONFIG_NET_DSA_QCA8K) += qca8k.o
> qca8k-y += qca8k-common.o qca8k-8xxx.o
> +obj-$(CONFIG_NET_DSA_QCA8K_LEDS_SUPPORT) += qca8k-leds.o
Isn't this what you want instead?
ifdef CONFIG_NET_DSA_QCA8K_LEDS_SUPPORT
qca8k-y += qca8k-leds.o
endif
you don't want to have to export the qca8k_setup_led_ctrl() symbol...
you want it to be part of the same module AFAIU.
> +/* Leds Support function */
> +#ifdef CONFIG_NET_DSA_QCA8K_LEDS_SUPPORT
> +int qca8k_setup_led_ctrl(struct qca8k_priv *priv);
> +#else
> +static inline int qca8k_setup_led_ctrl(struct qca8k_priv *priv)
> +{
> + return 0;
> +}
> +#endif
Could there be just a qca8k-leds.h with the function prototypes exported
by qca8k-leds.c?