From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
To: Andrew Lunn <andrew@lunn.ch>
Cc: tj@kernel.org, kishon@ti.com, Jason Cooper <jason@lakedaemon.net>,
Gregory Clement <gregory.clement@free-electrons.com>,
linux-ide@vger.kernel.org
Subject: Re: [patch v2 1/3] drivers: phy: Make NULL a valid phy reference
Date: Mon, 03 Feb 2014 22:17:24 +0300 [thread overview]
Message-ID: <52EFEB44.30208@cogentembedded.com> (raw)
In-Reply-To: <20140203181311.GA15442@lunn.ch>
On 02/03/2014 09:13 PM, Andrew Lunn wrote:
>>> The common clock framework considers NULL a valid clock
>>> reference. This makes handling optional clocks simple, in that if the
>>> optional clock is not available, a NULL reference can be used in the
>>> place of a real clock, simplifying the clock consumer.
>>> Extend this concept to the phy consumer API. A NULL can be passed to
>>> the release calls, the phy_init() and phy_exit() calls, and
>>> phy_power_on() and phy_power_off() and a NOP is performed.
>>> Signed-off-by: Andrew Lunn <andrew@lunn.ch>
>> [...]
>>> When the controller no longer needs the PHY, it has to release the reference
>>> diff --git a/drivers/phy/phy-core.c b/drivers/phy/phy-core.c
>>> index 645c867c1257..56535253e50c 100644
>>> --- a/drivers/phy/phy-core.c
>>> +++ b/drivers/phy/phy-core.c
>> [...]
>>> @@ -308,6 +320,9 @@ err0:
>>> */
>>> void phy_put(struct phy *phy)
>>> {
>>> + if (!phy)
>>> + return;
>>> +
>>> if (IS_ERR(phy))
>>> return;
>> Why not merge these two?
> Hi Sergei
> Have you heard Russell King talk about IS_ERR_NULL()?
Probably not but I didn't think of it actually, just:
if (!phy || IS_ERR(phy))
return;
PS: BTW, I'm not sure why phy_put() has to handle error pointers...
> Andrew
WBR, Sergei
next prev parent reply other threads:[~2014-02-03 18:17 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <0140131114857.GC26148@htj.dyndns.org>
2014-02-01 14:15 ` [PATCH 1/3] drivers: phy: Make NULL a valid phy reference Andrew Lunn
2014-02-01 14:15 ` [PATCH 2/3] drivers: phy: Add support for optional phys Andrew Lunn
2014-02-03 5:51 ` Kishon Vijay Abraham I
2014-02-03 9:36 ` Andrew Lunn
2014-02-03 10:19 ` Kishon Vijay Abraham I
2014-02-03 18:00 ` [patch v2 1/3] drivers: phy: Make NULL a valid phy reference Andrew Lunn
2014-02-03 18:00 ` [patch v2 2/3] drivers: phy: Add support for optional phys Andrew Lunn
2014-02-03 18:00 ` [patch v2 3/3] ata: sata_mv: Fix probe failures with " Andrew Lunn
2014-02-03 18:02 ` Tejun Heo
2014-02-03 19:04 ` Sergei Shtylyov
2014-02-03 18:17 ` [patch v3 " Andrew Lunn
2014-02-03 19:21 ` Sergei Shtylyov
2014-02-03 19:06 ` [patch v2 1/3] drivers: phy: Make NULL a valid phy reference Sergei Shtylyov
2014-02-03 18:13 ` Andrew Lunn
2014-02-03 19:17 ` Sergei Shtylyov [this message]
2014-02-03 21:15 ` Gregory CLEMENT
2014-02-01 14:15 ` [PATCH 3/3] ata: sata_mv: Fix probe failures with optional phys Andrew Lunn
2014-02-01 14:44 ` Ezequiel Garcia
2014-02-01 14:56 ` Andrew Lunn
2014-02-01 15:36 ` Ezequiel Garcia
2014-02-03 16:03 ` Tejun Heo
2014-02-03 16:20 ` Andrew Lunn
2014-02-03 16:21 ` Tejun Heo
2014-02-03 16:21 ` Gregory CLEMENT
2014-02-03 17:17 ` Gregory CLEMENT
2014-02-03 17:23 ` 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=52EFEB44.30208@cogentembedded.com \
--to=sergei.shtylyov@cogentembedded.com \
--cc=andrew@lunn.ch \
--cc=gregory.clement@free-electrons.com \
--cc=jason@lakedaemon.net \
--cc=kishon@ti.com \
--cc=linux-ide@vger.kernel.org \
--cc=tj@kernel.org \
/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).