[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <6485f180.5d0a0220.31c81.a179@mx.google.com>
Date: Sun, 11 Jun 2023 09:54:44 +0200
From: Christian Marangi <ansuelsmth@...il.com>
To: Andrew Lunn <andrew@...n.ch>
Cc: Pavel Machek <pavel@....cz>, Lee Jones <lee@...nel.org>,
"David S. Miller" <davem@...emloft.net>,
Yang Li <yang.lee@...ux.alibaba.com>,
linux-leds@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 2/2] leds: trigger: netdev: add additional specific
link duplex mode
On Sun, Jun 11, 2023 at 06:01:46PM +0200, Andrew Lunn wrote:
> > static ssize_t device_name_show(struct device *dev,
> > @@ -230,6 +241,7 @@ static int set_device_name(struct led_netdev_data *trigger_data,
> >
> > trigger_data->carrier_link_up = false;
> > trigger_data->link_speed = 0;
> > + trigger_data->duplex = 0;
>
> /* Duplex, half or full. */
> #define DUPLEX_HALF 0x00
> #define DUPLEX_FULL 0x01
> #define DUPLEX_UNKNOWN 0xff
>
> You probably want to initialise it to DUPLEX_UNKNOWN, not DUPLEX_HALF.
>
> There is also SPEED_UNKNOWN, which might be good to use, rather than
> 0.
>
Nice catch!
Fun this for SPEED_UNKNOWN. The value is -1 but the speed type is
unsigned (I used the same definition from ksettings)
So from what I can see ksettings report 0 (I assume) but other struct
(link_mode_info) use speed as int and correctly use SPEED_UNKNOWN.
So I guess for speed we should stick to 0?
--
Ansuel
Powered by blists - more mailing lists