[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190825183609.4a9cc0d7@nic.cz>
Date: Sun, 25 Aug 2019 18:36:09 +0200
From: Marek Behun <marek.behun@....cz>
To: Vivien Didelot <vivien.didelot@...il.com>
Cc: netdev@...r.kernel.org, Andrew Lunn <andrew@...n.ch>,
Florian Fainelli <f.fainelli@...il.com>,
Vladimir Oltean <olteanv@...il.com>
Subject: Re: [PATCH net-next v3 4/6] net: dsa: mv88e6xxx: simplify SERDES
code for Topaz and Peridot
On Sun, 25 Aug 2019 12:02:32 -0400
Vivien Didelot <vivien.didelot@...il.com> wrote:
> Aren't you relying on -ENODEV as well?
Vivien, I am not relying o -ENODEV. I changed the serdes_get_lane
semantics:
- previously:
- if port has a lane for current cmode, return given lane number
- otherwise return -ENODEV
- if other error occured during serdes_get_lane, return that error
(this never happened, because all implementations only need port
number and cmode, and cmode is cached, so no function was called
that could err)
- after this commit:
- if port has a lane for current cmode, return 0 and put lane number
into *lane
- otherwise return 0 and put -1 into *lane
- if error occured, return that error number
I removed the -ENODEV semantics for "no lane on port" event.
There are two reasons for this:
1. once you requested lane number to be put into a place pointed to
by a pointer, rather than the return value, the code seemed better
to me (you may of course disagree, this is a personal opinion) when
I did:
if (err)
return err;
if (lane < 0)
return 0;
rather than
if (err == -ENODEV)
return 0;
if (err)
return err;
2. some future implementation may actually need to call some MDIO
read/write functions, which may or may not return -ENODEV. That
could conflict with the -ENODEV returned when there is no lane.
Marek
Powered by blists - more mailing lists