From: Andrew Lunn <andrew@lunn.ch>
To: Heiner Kallweit <hkallweit1@gmail.com>
Cc: "Thomas Hämmerle" <Thomas.Haemmerle@wolfvision.net>,
"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
"f.fainelli@gmail.com" <f.fainelli@gmail.com>,
"davem@davemloft.net" <davem@davemloft.net>,
"m.tretter@pengutronix.de" <m.tretter@pengutronix.de>
Subject: Re: [PATCH v2] net: phy: dp83867: support Wake on LAN
Date: Tue, 22 Oct 2019 21:15:20 +0200 [thread overview]
Message-ID: <20191022191520.GA12558@lunn.ch> (raw)
In-Reply-To: <7916e170-116d-421b-e95b-b3c3cca7f97a@gmail.com>
> > +static int dp83867_set_wol(struct phy_device *phydev,
> > + struct ethtool_wolinfo *wol)
> > +{
> > + struct net_device *ndev = phydev->attached_dev;
> > + u16 val_rxcfg, val_micr;
> > + const u8 *mac;
> > +
> > + val_rxcfg = phy_read_mmd(phydev, DP83867_DEVADDR, DP83867_RXFCFG);
> > + val_micr = phy_read(phydev, MII_DP83867_MICR);
> > +
> > + if (wol->wolopts & (WAKE_MAGIC | WAKE_MAGICSECURE | WAKE_UCAST |
> > + WAKE_BCAST)) {
> > + val_rxcfg |= DP83867_WOL_ENH_MAC;
> > + val_micr |= MII_DP83867_MICR_WOL_INT_EN;
> > +
> > + if (wol->wolopts & WAKE_MAGIC) {
> > + mac = (const u8 *)ndev->dev_addr;
>
> Using a cast to add/remove a const qualifier usually isn't too nice.
> Why not simply declare mac w/o const?
>
> Also PHY might not be attached. I think ndev should be checked for NULL.
Hi Heiner
I thought about that as well. But the ethtool API is invoked using a
network interface name. It would be odd to call into the PHY driver if
the PHY was not attached. And the resulting Oops would help us
identify the bug.
Plus all the other PHY drivers which implement magic packet WoL assume
the PHY is attached. It could be they are all broken i suppose...
Andrew
next prev parent reply other threads:[~2019-10-22 19:15 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-22 11:11 [PATCH] net: phy: dp83867: support Wake on LAN Thomas Hämmerle
2019-10-22 12:34 ` Andrew Lunn
2019-10-22 13:06 ` [PATCH v2] " Thomas Hämmerle
2019-10-22 13:30 ` Michael Tretter
2019-10-22 14:00 ` Andrew Lunn
2019-10-22 18:40 ` Heiner Kallweit
2019-10-22 19:15 ` Andrew Lunn [this message]
2019-10-24 22:16 ` David Miller
2019-10-25 7:55 ` Thomas Hämmerle
2019-10-28 8:08 ` [PATCH v3] " Thomas Hämmerle
2019-10-29 23:43 ` David Miller
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=20191022191520.GA12558@lunn.ch \
--to=andrew@lunn.ch \
--cc=Thomas.Haemmerle@wolfvision.net \
--cc=davem@davemloft.net \
--cc=f.fainelli@gmail.com \
--cc=hkallweit1@gmail.com \
--cc=m.tretter@pengutronix.de \
--cc=netdev@vger.kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.