Re: [PATCH 2/3] drivers: phy: Add support for optional phys

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
--
To unsubscribe from this list: send the line "unsubscribe linux-ide" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Filesystems]     [Linux SCSI]     [Linux RAID]     [Git]     [Kernel Newbies]     [Linux Newbie]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Samba]     [Device Mapper]

  Powered by Linux