From: Kishon Vijay Abraham I <kishon@ti.com>
To: Andrew Lunn <andrew@lunn.ch>
Cc: tj@kernel.org, linux-ide@vger.kernel.org
Subject: Re: [PATCH 2/3] drivers: phy: Add support for optional phys
Date: Mon, 3 Feb 2014 15:49:36 +0530 [thread overview]
Message-ID: <52EF6D38.4060200@ti.com> (raw)
In-Reply-To: <20140203093606.GA8038@lunn.ch>
On Monday 03 February 2014 03:06 PM, Andrew Lunn wrote:
>>> /**
>>> + * devm_phy_optional_get() - lookup and obtain a reference to an optional phy.
>>> + * @dev: device that requests this phy
>>> + * @string: the phy name as given in the dt data or phy device name
>>> + * for non-dt case
>>> + *
>>> + * Gets the phy using phy_get(), and associates a device with it using
>>> + * devres. On driver detach, release function is invoked on the devres data,
>>> + * then, devres data is freed. This differs to devm_phy_get() in that if the
>>> + * phy does not exist, it is not considered an error. Instead the NULL phy
>>> + * is returned, which can be passed to all other phy consumer calls.
>>
>> It doesn't explain how devm_phy_optional_get is different from phy_get :-s
ah.. it actually explained. Sorry.
>
> How about i append,
>
> , and so will never return -ENODEV.
>
> to the next but last sentence?
Yeah, that can be added too.
>
>>> + */
>>> +struct phy *devm_phy_optional_get(struct device *dev, const char *string)
>>> +{
>>> + struct phy *phy = devm_phy_get(dev, string);
>>> +
>>> + if (PTR_ERR(phy) == -ENODEV)
>>> + phy = NULL;
>>
>> Do we need an API in phy-core to handle this? Can't this be done in the
>> controller driver itself?
>
> Sure it can be done in the consumer, but the code is ugly. Take a look
> at:
>
> http://marc.info/?l=linux-ide&m=139116894403306&w=2
Ok. Just one comment though. Implement phy_get_optional too so that we have
both the devres and the other variant.
Thanks
Kishon
next prev parent reply other threads:[~2014-02-03 10:19 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 [this message]
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
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=52EF6D38.4060200@ti.com \
--to=kishon@ti.com \
--cc=andrew@lunn.ch \
--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).