From: Christian Marangi <ansuelsmth@gmail.com>
To: Andrew Lunn <andrew@lunn.ch>
Cc: Pavel Machek <pavel@ucw.cz>, Lee Jones <lee@kernel.org>,
"David S. Miller" <davem@davemloft.net>,
Yang Li <yang.lee@linux.alibaba.com>,
linux-leds@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 2/2] leds: trigger: netdev: add additional specific link duplex mode
Date: Sun, 11 Jun 2023 09:54:44 +0200 [thread overview]
Message-ID: <6485f180.5d0a0220.31c81.a179@mx.google.com> (raw)
In-Reply-To: <bc342289-5008-490d-b98f-6826a11574b3@lunn.ch>
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
prev parent reply other threads:[~2023-06-11 16:08 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-10 4:16 [PATCH v2 0/2] leds: trigger: netdev: add additional modes Christian Marangi
2023-06-10 4:16 ` [PATCH v2 1/2] leds: trigger: netdev: add additional specific link speed mode Christian Marangi
2023-06-11 15:57 ` Andrew Lunn
2023-06-10 4:16 ` [PATCH v2 2/2] leds: trigger: netdev: add additional specific link duplex mode Christian Marangi
2023-06-11 16:01 ` Andrew Lunn
2023-06-11 7:54 ` Christian Marangi [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=6485f180.5d0a0220.31c81.a179@mx.google.com \
--to=ansuelsmth@gmail.com \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=lee@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-leds@vger.kernel.org \
--cc=pavel@ucw.cz \
--cc=yang.lee@linux.alibaba.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox