From: Florian Fainelli <f.fainelli@gmail.com>
To: David Miller <davem@davemloft.net>, geert+renesas@glider.be
Cc: rmk+kernel@armlinux.org.uk, andrew@lunn.ch,
netdev@vger.kernel.org, linux-renesas-soc@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] net: phy: Fix phy_modify() semantic difference fallout
Date: Thu, 11 Jan 2018 12:28:36 -0800 [thread overview]
Message-ID: <a2cc8462-be89-cc53-46b9-f172921b01a9@gmail.com> (raw)
In-Reply-To: <20180111.104835.381039264896352436.davem@davemloft.net>
On 01/11/2018 07:48 AM, David Miller wrote:
> From: Geert Uytterhoeven <geert+renesas@glider.be>
> Date: Tue, 9 Jan 2018 12:11:21 +0100
>
>> In case of success, the return values of (__)phy_write() and
>> (__)phy_modify() are not compatible: (__)phy_write() returns 0, while
>> (__)phy_modify() returns the old PHY register value.
>>
>> Apparently this change was catered for in drivers/net/phy/marvell.c, but
>> not in other source files.
>>
>> Hence genphy_restart_aneg() now returns 4416 instead zero, which is
>> considered an error:
>>
>> ravb e6800000.ethernet eth0: failed to connect PHY
>> IP-Config: Failed to open eth0
>> IP-Config: No network devices available
>>
>> Fix this by converting positive values to zero in all callers of
>> phy_modify().
>>
>> Fixes: fea23fb591cce995 ("net: phy: convert read-modify-write to phy_modify()")
>> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
>> ---
>> Alternatively, __phy_modify() could be changed to follow __phy_write()
>> semantics?
>
> I really want a resolution to this quickly, this broke lots of stuff
> for people.
>
> __phy_modify() wants to return multiple values, so it should be coded
> up to do so explicitly rather than trying to encode two values from
> overlapping value spaces in one return value.
>
> That means the original value should be returned by-reference. And
> this will make the error/no-error return value unambiguous.
>
> int __phy_modify(struct phy_device *phydev, u32 regnum, u16 mask, u16 set,
> u16 *orig_val);
I am fine with that approach, there should only be a handful of
locations where we care about the old value that __phy_modify() returns
so we should be able to wrap these accessors in a way that is not
disruptive and requires less code auditing that the patch currently
submitted.
Thanks!
--
Florian
prev parent reply other threads:[~2018-01-11 20:28 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-09 11:11 [PATCH] net: phy: Fix phy_modify() semantic difference fallout Geert Uytterhoeven
2018-01-09 14:10 ` Andrew Lunn
2018-01-09 14:22 ` Russell King - ARM Linux
2018-01-09 14:35 ` Geert Uytterhoeven
2018-01-09 14:48 ` Andrew Lunn
2018-01-09 14:50 ` Russell King - ARM Linux
2018-01-09 18:25 ` Geert Uytterhoeven
2018-01-09 18:31 ` Russell King - ARM Linux
2018-01-09 18:36 ` Geert Uytterhoeven
2018-01-09 14:35 ` Niklas Cassel
2018-01-11 15:48 ` David Miller
2018-01-11 15:53 ` Russell King - ARM Linux
2018-01-11 15:54 ` Geert Uytterhoeven
2018-01-11 16:00 ` Geert Uytterhoeven
2018-01-11 16:05 ` Russell King - ARM Linux
2018-01-11 17:04 ` Andrew Lunn
2018-01-11 20:28 ` Florian Fainelli [this message]
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=a2cc8462-be89-cc53-46b9-f172921b01a9@gmail.com \
--to=f.fainelli@gmail.com \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=geert+renesas@glider.be \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=rmk+kernel@armlinux.org.uk \
/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).