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

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

 



> >  /**
> > + * 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

How about i append, 

, and so will never return -ENODEV.

to the next but last sentence?

> > + */
> > +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

	Andrew
--
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