[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <1c4d8c46-3124-4a90-bc50-788cc3883d93@lunn.ch>
Date: Wed, 5 Jun 2024 18:48:10 +0200
From: Andrew Lunn <andrew@...n.ch>
To: Csókás Bence <csokas.bence@...lan.hu>
Cc: Vladimir Oltean <olteanv@...il.com>, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org, trivial@...nel.org,
Heiner Kallweit <hkallweit1@...il.com>,
Russell King <linux@...linux.org.uk>
Subject: Re: [RFC PATCH 2/2] net: include: mii: Refactor: Use BIT() for
ADVERTISE_* bits
On Wed, Jun 05, 2024 at 04:47:27PM +0200, Csókás Bence wrote:
> Hi!
>
> On 6/5/24 16:13, Vladimir Oltean wrote:
> > On Wed, Jun 05, 2024 at 02:16:49PM +0200, Csókás, Bence wrote:
> > > Replace hex values with BIT() and GENMASK() for readability
> > >
> > > Cc: trivial@...nel.org
> > >
> > > Signed-off-by: "Csókás, Bence" <csokas.bence@...lan.hu>
> > > ---
> >
> > You can't use BIT() and GENMASK() in headers exported to user space.
> >
> > I mean you can, but the BIT() and GENMASK() macros themselves aren't
> > exported to user space, and you would break any application which used
> > values dependent on them.
> >
>
> I thought the vDSO headers (which currently hold the definition for `BIT()`)
> *are* exported. Though `GENMASK()`, and the headers which would normally
> include vdso/bits.h, might not be... But then again, is uapi/linux/mii.h
> itself even exported?
uapi .... I would expect everything below that is considered exported.
Take a look at the sources for mii-tool.c:
if (bmcr & BMCR_ANENABLE) {
if (bmsr & BMSR_ANEGCOMPLETE) {
if (advert & lkpar) {
strcat(buf, (lkpar & LPA_LPACK) ?
"negotiated" : "no autonegotiation,");
strcat(buf, media_list(advert & lkpar, bmcr2 & lpa2>>2, 1));
strcat(buf, ", ");
} else {
strcat(buf, "autonegotiation failed, ");
}
} else if (bmcr & BMCR_ANRESTART) {
strcat(buf, "autonegotiation restarted, ");
}
} else {
sprintf(buf+strlen(buf), "%s Mbit, %s duplex, ",
((bmcr2 & (ADVERTISE_1000HALF | ADVERTISE_1000FULL)) & lpa2 >> 2)
? "1000"
: (bmcr & BMCR_SPEED100) ? "100" : "10",
(bmcr & BMCR_FULLDPLX) ? "full" : "half");
}
strcat(buf, (bmsr & BMSR_LSTATUS) ? "link ok" : "no link");
So they are actually used as well. Try compiling this with your
changes made.
Andrew
Powered by blists - more mailing lists