Re: [PATCH] leds: triggers: netdev: add a check, whether device is up

From: Klaus Kudielka
Date: Sat Nov 04 2023 - 12:32:30 EST


On Sat, 2023-11-04 at 16:27 +0100, Klaus Kudielka wrote:
>
> phylink_start() is the first one that does netif_carrier_off() and thus
> sets the NOCARRIER bit, but that only happens when bringing the device up.
>
> Before that, I would not know who cares about setting the NOCARRIER bit.

A different, driver-specific solution could be like this (tested and working):

--- a/drivers/net/ethernet/marvell/mvneta.c
+++ b/drivers/net/ethernet/marvell/mvneta.c
@@ -5690,6 +5690,7 @@ static int mvneta_probe(struct platform_device *pdev)
/* 9676 == 9700 - 20 and rounding to 8 */
dev->max_mtu = 9676;

+ netif_carrier_off(dev);
err = register_netdev(dev);
if (err < 0) {
dev_err(&pdev->dev, "failed to register\n");


Would that be the "correct" approach?

Regards, Klaus