From: Lukas Wunner <lukas@wunner.de>
To: Bartosz Golaszewski <brgl@bgdev.pl>
Cc: Grygorii Strashko <grygorii.strashko@ti.com>,
"David S . Miller" <davem@davemloft.net>,
Florian Fainelli <f.fainelli@gmail.com>,
Dan Carpenter <dan.carpenter@oracle.com>,
Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org>,
Rob Herring <robh@kernel.org>, Kevin Hilman <khilman@kernel.org>,
David Lechner <david@lechnology.com>,
Sekhar Nori <nsekhar@ti.com>, Andrew Lunn <andrew@lunn.ch>,
linux-omap@vger.kernel.org, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org,
Bartosz Golaszewski <bgolaszewski@baylibre.com>,
stable@vger.kernel.org
Subject: Re: [PATCH 1/3] net: ethernet: fix suspend/resume in davinci_emac
Date: Tue, 19 Jun 2018 20:00:19 +0200 [thread overview]
Message-ID: <20180619180019.GA25396@wunner.de> (raw)
In-Reply-To: <20180619160950.6283-2-brgl@bgdev.pl>
On Tue, Jun 19, 2018 at 06:09:48PM +0200, Bartosz Golaszewski wrote:
> From: Bartosz Golaszewski <bgolaszewski@baylibre.com>
>
> This patch reverts commit 3243ff2a05ec ("net: ethernet: davinci_emac:
> Deduplicate bus_find_device() by name matching") and adds a comment
> which should stop anyone from reintroducing the same "fix" in the future.
>
> We can't use bus_find_device_by_name() here because the device name is
> not guaranteed to be 'davinci_mdio'. On some systems it can be
> 'davinci_mdio.0' so we need to use strncmp() against the first part of
> the string to correctly match it.
>
> Fixes: 3243ff2a05ec ("net: ethernet: davinci_emac: Deduplicate bus_find_device() by name matching")
> Cc: stable@vger.kernel.org
> Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
This is still
Acked-by: Lukas Wunner <lukas@wunner.de>
given that my patch which is reverted here seems to have been incorrect.
Feel free to keep the ack if you respin in response to Florian Fainelli's
comments.
Thanks,
Lukas
> ---
> drivers/net/ethernet/ti/davinci_emac.c | 15 +++++++++++++--
> 1 file changed, 13 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/ethernet/ti/davinci_emac.c b/drivers/net/ethernet/ti/davinci_emac.c
> index 06d7c9e4dcda..a1a6445b5a7e 100644
> --- a/drivers/net/ethernet/ti/davinci_emac.c
> +++ b/drivers/net/ethernet/ti/davinci_emac.c
> @@ -1385,6 +1385,11 @@ static int emac_devioctl(struct net_device *ndev, struct ifreq *ifrq, int cmd)
> return -EOPNOTSUPP;
> }
>
> +static int match_first_device(struct device *dev, void *data)
> +{
> + return !strncmp(dev_name(dev), "davinci_mdio", 12);
> +}
> +
> /**
> * emac_dev_open - EMAC device open
> * @ndev: The DaVinci EMAC network adapter
> @@ -1484,8 +1489,14 @@ static int emac_dev_open(struct net_device *ndev)
>
> /* use the first phy on the bus if pdata did not give us a phy id */
> if (!phydev && !priv->phy_id) {
> - phy = bus_find_device_by_name(&mdio_bus_type, NULL,
> - "davinci_mdio");
> + /* NOTE: we can't use bus_find_device_by_name() here because
> + * the device name is not guaranteed to be 'davinci_mdio'. On
> + * some systems it can be 'davinci_mdio.0' so we need to use
> + * strncmp() against the first part of the string to correctly
> + * match it.
> + */
> + phy = bus_find_device(&mdio_bus_type, NULL, NULL,
> + match_first_device);
> if (phy) {
> priv->phy_id = dev_name(phy);
> if (!priv->phy_id || !*priv->phy_id)
> --
> 2.17.1
>
next prev parent reply other threads:[~2018-06-19 18:00 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-19 16:09 [PATCH 0/3] net: davinci_emac: fix suspend/resume (both a regression and a common clk problem) Bartosz Golaszewski
2018-06-19 16:09 ` [PATCH 1/3] net: ethernet: fix suspend/resume in davinci_emac Bartosz Golaszewski
2018-06-19 16:55 ` Florian Fainelli
2018-06-20 7:56 ` Bartosz Golaszewski
2018-06-19 18:00 ` Lukas Wunner [this message]
2018-06-19 16:09 ` [PATCH 2/3] net: phy: set the of_node in the mdiodev's struct device Bartosz Golaszewski
2018-06-19 16:55 ` Florian Fainelli
2018-06-19 16:09 ` [PATCH 3/3] net: davinci_emac: match the mdio device against its compatible if possible Bartosz Golaszewski
2018-06-19 16:56 ` Florian Fainelli
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=20180619180019.GA25396@wunner.de \
--to=lukas@wunner.de \
--cc=andrew@lunn.ch \
--cc=bgolaszewski@baylibre.com \
--cc=brgl@bgdev.pl \
--cc=dan.carpenter@oracle.com \
--cc=davem@davemloft.net \
--cc=david@lechnology.com \
--cc=f.fainelli@gmail.com \
--cc=grygorii.strashko@ti.com \
--cc=ivan.khoronzhuk@linaro.org \
--cc=khilman@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-omap@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=nsekhar@ti.com \
--cc=robh@kernel.org \
--cc=stable@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).