linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Lunn <andrew@lunn.ch>
To: "Petr Štetiar" <ynezz@true.cz>
Cc: netdev@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	Nicolas Ferre <nicolas.ferre@microchip.com>,
	"David S. Miller" <davem@davemloft.net>,
	Florian Fainelli <f.fainelli@gmail.com>,
	Heiner Kallweit <hkallweit1@gmail.com>,
	Rob Herring <robh+dt@kernel.org>,
	Frank Rowand <frowand.list@gmail.com>,
	Srinivas Kandagatla <srinivas.kandagatla@linaro.org>,
	Maxime Ripard <maxime.ripard@bootlin.com>,
	Alban Bedel <albeu@free.fr>
Subject: Re: [PATCH v2 3/4] net: macb: Drop nvmem_get_mac_address usage
Date: Mon, 29 Apr 2019 15:02:48 +0200	[thread overview]
Message-ID: <20190429130248.GC10772@lunn.ch> (raw)
In-Reply-To: <20190429075514.GB346@meh.true.cz>

On Mon, Apr 29, 2019 at 09:55:14AM +0200, Petr Štetiar wrote:
> Andrew Lunn <andrew@lunn.ch> [2019-04-28 23:36:40]:
> 
> Hi Andrew,
> 
> > > so if I understand this correctly, it probably means, that this approach with
> > > modified of_get_mac_address is dead end as current of_get_mac_address users
> > > don't expect and handle possible -EPROBE_DEFER error, so I would need to
> > > change all the current users, which is nonsense.
> > 
> > I would not say it is dead, it just needs a bit more work.
> 
> ok, that's good news, I've probably just misunderstood your concern about the
> random MAC address in case when platform/nvmem subsystem returns -EPROBE_DEFER.
> 
> > The current users should always be checking for a NULL pointer.  You
> > just need to change that to !IS_ERR(). You can then return
> > ERR_PTR(-PROBE_DEFER) from the NVMEM operation.
> 
> I'm more then happy to address this in v3, but I'm still curious, what is it
> going to change in the current state of the tree. 
> 
> My understanding of -PROBE_DEFER is, that it needs to be propagated back from
> the driver's probe callback/hook to the upper device/driver subsystem in order
> to be moved to the list of pending drivers and considered for probe later
> again. This is not going to happen in any of the current drivers, thus it will
> probably still always result in random MAC address in case of -EPROBE_DEFER
> error from the nvmem subsystem.

Hi Petr

All current drivers which don't look in NVMEM don't expect
EPROBE_DEFER. So not returning it as the result of the probe is fine.
The one driver which does expect EPROBE_DEFER already has the code to
handle it.

What you have to be careful of, is the return value from your new code
looking in NVMEM. It should only return EPROBE_DEFER, or another error
if there really is expected to be a value in NVMEM, or getting it from
NVMEM resulted in an error.

I've not looked at the details of nvmem_get_mac_address(), but it
should be a two stage process. The first is to look in device tree to
find the properties. Device tree is always accessible. So performing a
lookup will never return EPROBE_DEFER. If there are no properties, it
probably return -ENODEV. You need to consider that as not being a real
error, since these are optional properties. of_get_mac_address() needs
to try the next source of the MAC address. The second stage is to look
into the NVMEM. That could return -EPROBE_DEFER and you should return
that error, or any other error at this stage. The MAC address should
exist in NVMEM so we want to know about the error.

      Andrew

  reply	other threads:[~2019-04-29 13:02 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-28 12:53 [PATCH v2 0/4] of_net: Add NVMEM support to of_get_mac_address Petr Štetiar
2019-04-28 12:53 ` [PATCH v2 1/4] " Petr Štetiar
2019-05-01 20:19   ` Rob Herring
2019-05-02  9:05     ` Petr Štetiar
2019-05-07 16:06       ` Rob Herring
2019-05-08  9:02         ` Petr Štetiar
2019-04-28 12:53 ` [PATCH v2 2/4] dt-bindings: doc: Reflect new NVMEM of_get_mac_address behaviour Petr Štetiar
2019-04-28 16:53   ` Andrew Lunn
2019-05-01 20:22     ` Rob Herring
2019-04-28 12:53 ` [PATCH v2 3/4] net: macb: Drop nvmem_get_mac_address usage Petr Štetiar
2019-04-28 16:56   ` Andrew Lunn
2019-04-28 21:08     ` Petr Štetiar
2019-04-28 21:36       ` Andrew Lunn
2019-04-29  7:55         ` Petr Štetiar
2019-04-29 13:02           ` Andrew Lunn [this message]
2019-04-30 14:13             ` Handling of EPROBE_DEFER in of_get_mac_address [Was: Re: [PATCH v2 3/4] net: macb: Drop nvmem_get_mac_address usage] Petr Štetiar
2019-05-01 13:54               ` Andrew Lunn
2019-04-28 12:53 ` [PATCH v2 4/4] net: davinci_emac: Drop nvmem_get_mac_address usage Petr Štetiar
2019-04-28 16:58   ` Andrew Lunn

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=20190429130248.GC10772@lunn.ch \
    --to=andrew@lunn.ch \
    --cc=albeu@free.fr \
    --cc=davem@davemloft.net \
    --cc=devicetree@vger.kernel.org \
    --cc=f.fainelli@gmail.com \
    --cc=frowand.list@gmail.com \
    --cc=hkallweit1@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maxime.ripard@bootlin.com \
    --cc=netdev@vger.kernel.org \
    --cc=nicolas.ferre@microchip.com \
    --cc=robh+dt@kernel.org \
    --cc=srinivas.kandagatla@linaro.org \
    --cc=ynezz@true.cz \
    /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).