linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tejun Heo <tj@kernel.org>
To: Andrew Lunn <andrew@lunn.ch>
Cc: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>,
	linux-ide@vger.kernel.org,
	Thomas Petazzoni <thomas.petazzoni@free-electrons.com>,
	Gregory Clement <gregory.clement@free-electrons.com>,
	Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>,
	Jason Cooper <jason@lakedaemon.net>
Subject: Re: [PATCH] ATA: SATA_MV: Fix probe failure when no phy exists
Date: Fri, 31 Jan 2014 06:48:57 -0500	[thread overview]
Message-ID: <20140131114857.GC26148@htj.dyndns.org> (raw)
In-Reply-To: <20140131114619.GD26003@lunn.ch>

On Fri, Jan 31, 2014 at 12:46:19PM +0100, Andrew Lunn wrote:
> The problem here is there is a different between optional and non
> optional phys. If it is not optional, ENODEV is fatal. If it is
> optional ENODEV is not fatal. So it needs at least to be
> 
> bool is_phy_error_fatal(struct phy *phy, bool optional)
> 
> Also, EPROBE_DEFER is not fatal, but still needs the probe to return
> an error code. So the code ends up something like
> 
> 	phy = devm_phy_get(...);
>    	if (IS_ERR(phy) {
>       		if (is_phy_error_fatal(phy, true)) {
> 			dev_err(dev, "Fatal phy error);
> 	 		goto out;
>       		}
> 		if (PTR_ERR(phy) == -EPROBE_DEFER)
> 			goto out;
> 	}
> 
> I can implement this if you want.

Ugh... it's too ugly.  This really should be contained in phy layer.
How about introducing devm_phy_get_optional() which does the error
value interpretation inside it and just returns 0 if probing can go on
and -errno if it shouldn't.

Thanks.

-- 
tejun

  reply	other threads:[~2014-01-31 11:49 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-30 20:50 [PATCH] ATA: SATA_MV: Fix probe failure when no phy exists Andrew Lunn
2014-01-30 22:12 ` Ezequiel Garcia
2014-01-31 10:54   ` Andrew Lunn
2014-01-31 11:04     ` Tejun Heo
2014-01-31 11:46       ` Andrew Lunn
2014-01-31 11:48         ` Tejun Heo [this message]
2014-02-03 15:32     ` Gregory CLEMENT
2014-02-03 16:50       ` Jason Cooper
2014-02-03 17:27         ` Gregory CLEMENT
2014-02-03 17:32         ` Tejun Heo
2014-02-03 18:43           ` Jason Cooper

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=20140131114857.GC26148@htj.dyndns.org \
    --to=tj@kernel.org \
    --cc=andrew@lunn.ch \
    --cc=ezequiel.garcia@free-electrons.com \
    --cc=gregory.clement@free-electrons.com \
    --cc=jason@lakedaemon.net \
    --cc=linux-ide@vger.kernel.org \
    --cc=sebastian.hesselbarth@gmail.com \
    --cc=thomas.petazzoni@free-electrons.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;
as well as URLs for NNTP newsgroup(s).