mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Grygorii Strashko <grygorii.strashko@ti.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: "David S. Miller" <davem@davemloft.net>, <netdev@vger.kernel.org>,
	Andrew Lunn <andrew@lunn.ch>,
	Florian Fainelli <f.fainelli@gmail.com>,
	Sekhar Nori <nsekhar@ti.com>, <linux-kernel@vger.kernel.org>,
	<linux-omap@vger.kernel.org>
Subject: Re: [PATCH 2/2] net: phy: relax error checking when creating sysfs link netdev->phydev
Date: Thu, 15 Mar 2018 10:47:13 -0500	[thread overview]
Message-ID: <add8a8dc-f417-d2ca-764b-07948d5d1c5b@ti.com> (raw)
In-Reply-To: <20180315022637.GA20975@kroah.com>



On 03/14/2018 09:26 PM, Greg Kroah-Hartman wrote:
> On Wed, Mar 14, 2018 at 05:26:24PM -0500, Grygorii Strashko wrote:
>> Some ethernet drivers (like TI CPSW) may connect and manage >1 Net PHYs per
>> one netdevice, as result such drivers will produce warning during system
>> boot and fail to connect second phy to netdevice when PHYLIB framework
>> will try to create sysfs link netdev->phydev for second PHY
>> in phy_attach_direct(), because sysfs link with the same name has been
>> created already for the first PHY. As result, second CPSW external
>> port will became unusable.
>>
>> Fix it by relaxing error checking when PHYLIB framework is creating sysfs
>> link netdev->phydev in phy_attach_direct(), suppressing warning by using
>> sysfs_create_link_nowarn() and adding debug message instead.
>>
>> Cc: Florian Fainelli <f.fainelli@gmail.com>
>> Fixes: a3995460491d ("net: phy: Relax error checking on sysfs_create_link()")
>> Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
>> ---
>>   drivers/net/phy/phy_device.c | 15 +++++++++++----
>>   1 file changed, 11 insertions(+), 4 deletions(-)
>>
>> diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
>> index 478405e..fe16f58 100644
>> --- a/drivers/net/phy/phy_device.c
>> +++ b/drivers/net/phy/phy_device.c
>> @@ -1012,10 +1012,17 @@ int phy_attach_direct(struct net_device *dev, struct phy_device *phydev,
>>   	err = sysfs_create_link(&phydev->mdio.dev.kobj, &dev->dev.kobj,
>>   				"attached_dev");
>>   	if (!err) {
>> -		err = sysfs_create_link(&dev->dev.kobj, &phydev->mdio.dev.kobj,
>> -					"phydev");
>> -		if (err)
>> -			goto error;
>> +		err = sysfs_create_link_nowarn(&dev->dev.kobj,
>> +					       &phydev->mdio.dev.kobj,
>> +					       "phydev");
>> +		if (err) {
>> +			dev_err(&dev->dev, "could not add device link to %s err %d\n",
>> +				kobject_name(&phydev->mdio.dev.kobj),
>> +				err);
> 
> dev_err() is not a "debugging" message :)

Sry for the mess. I've originally did it as dev_dbg() after searching for
other occurrences of sysfs_create_link_nowarn() in kernel.
And honestly, I was unsure what to use dbg or err here.

> 
> What is a user going to do with this new error?  If it's not important
> at all, why care about it?

Now I think that dev_err() is better to use here:
1) It will notify about link creation error in other drivers (which is
still not critical as networking functionality will not be broken and device
will be able to boot (in case of NFS usage for example).
2) in case of TI CPSW driver we can live with this error message and
it will stimulate us (or any other user of this driver) to find time and
do fix/rework TI CPSW driver.

> 
>> +			/* non-fatal - some net drivers can use one netdevice
>> +			 * with more then one phy
>> +			 */
> 
> What about devices that do not have more than one phy and this call
> fails for?  Shouldn't you check for that?

As I mentioned before, this is not critical error. More over, as per code and
commit a3995460491d ("net: phy: Relax error checking on sysfs_create_link()")
- the error of creating link phydev->netdev already ignored in PHYLIB due to
"incorrect" initialization sequence of some network drivers.

if no objection i will repost after fixing commit messages. 

-- 
regards,
-grygorii

  reply	other threads:[~2018-03-15 15:47 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-14 22:26 [PATCH 0/2] " 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 [this message]
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
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=add8a8dc-f417-d2ca-764b-07948d5d1c5b@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®