From: Grygorii Strashko <grygorii.strashko@ti.com>
To: Andrew Lunn <andrew@lunn.ch>
Cc: Florian Fainelli <f.fainelli@gmail.com>,
"David S. Miller" <davem@davemloft.net>, <netdev@vger.kernel.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Sekhar Nori <nsekhar@ti.com>, <linux-kernel@vger.kernel.org>,
<linux-omap@vger.kernel.org>
Subject: Re: [PATCH 0/2] net: phy: relax error checking when creating sysfs link netdev->phydev
Date: Fri, 16 Mar 2018 15:13:09 -0500 [thread overview]
Message-ID: <0daaae50-ddb9-8a94-d4a7-02861f0a6eb7@ti.com> (raw)
In-Reply-To: <20180316195403.GA8735@lunn.ch>
On 03/16/2018 02:54 PM, Andrew Lunn wrote:
>> The phydrv->mdiodrv.flags can be accessible only after call to of_phy_connect()/phy_connect(),
>
> You need to use a function like of_phy_find_device() to get the
> phydev, set the flag, and then call phy_connect_direct().
So, do you propose me to replace direct calls of of_phy_connect()/phy_connect() in
CPSW driver with buddies of the same functions? Right?
cpsw_slave_open()
{
....
if (slave->data->phy_node) {
phy = of_phy_connect(priv->ndev, slave->data->phy_node,
&cpsw_adjust_link, 0, slave->data->phy_if);
----- replace ^^^^ with below
{
struct phy_device *phy = of_phy_find_device(phy_np);
int ret;
if (!phy)
return NULL;
phy->dev_flags = flags;
----- [set flag in phydrv->mdiodrv.flags]
ret = phy_connect_direct(dev, phy, hndlr, iface);
/* refcount is held by phy_connect_direct() on success */
put_device(&phy->mdio.dev);
return ret ? NULL : phy;
}
-----
if (!phy) {
dev_err(priv->dev, "phy \"%pOF\" not found on slave %d\n",
slave->data->phy_node,
slave->slave_num);
return;
}
} else {
phy = phy_connect(priv->ndev, slave->data->phy_id,
&cpsw_adjust_link, slave->data->phy_if);
----- replace ^^^^ with below
{
struct phy_device *phydev;
struct device *d;
int rc;
/* Search the list of PHY devices on the mdio bus for the
* PHY with the requested name
*/
d = bus_find_device_by_name(&mdio_bus_type, NULL, bus_id);
if (!d) {
pr_err("PHY %s not found\n", bus_id);
return ERR_PTR(-ENODEV);
}
phydev = to_phy_device(d);
----- [set flag in phydrv->mdiodrv.flags]
rc = phy_connect_direct(dev, phydev, handler, interface);
put_device(d);
if (rc)
return ERR_PTR(rc);
return phydev;
}
-----
if (IS_ERR(phy)) {
dev_err(priv->dev,
"phy \"%s\" not found on slave %d, err %ld\n",
slave->data->phy_id, slave->slave_num,
PTR_ERR(phy));
return;
}
}
}
and all above just to set a flag which will be used by just one driver as of now.
Hm. Is this some sort of punishment ;) Sry. I'll probably will take a pause.
--
regards,
-grygorii
next prev parent reply other threads:[~2018-03-16 20:13 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-14 22:26 Grygorii Strashko
2018-03-14 22:26 ` [PATCH 1/2] sysfs: symlink: export sysfs_create_link_nowarn() Grygorii Strashko
2018-03-15 8:38 ` Sergei Shtylyov
2018-03-14 22:26 ` [PATCH 2/2] net: phy: relax error checking when creating sysfs link netdev->phydev Grygorii Strashko
2018-03-15 2:26 ` Greg Kroah-Hartman
2018-03-15 15:47 ` Grygorii Strashko
2018-03-16 17:22 ` [PATCH 0/2] " Andrew Lunn
2018-03-16 17:34 ` Florian Fainelli
2018-03-16 18:42 ` Grygorii Strashko
2018-03-16 19:11 ` Florian Fainelli
2018-03-16 19:41 ` Grygorii Strashko
2018-03-16 19:54 ` Andrew Lunn
2018-03-16 20:13 ` Grygorii Strashko [this message]
2018-03-16 21:09 ` Florian Fainelli
2018-03-16 21:14 ` Andrew Lunn
2018-03-16 22:08 ` Grygorii Strashko
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=0daaae50-ddb9-8a94-d4a7-02861f0a6eb7@ti.com \
--to=grygorii.strashko@ti.com \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=f.fainelli@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-omap@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=nsekhar@ti.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
all inboxes | Powered by JetHome®