Re: [PATCH v3 3/3] usb: otg: utils: devres: Add API's to associate a device with the phy

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

 



Hi,

On Fri, Jun 1, 2012 at 6:36 AM, Chen Peter-B29397 <B29397@xxxxxxxxxxxxx> wrote:
>
>> >>
>> >> Used devres API's to associate the phy with a device so that on
>> >> driver detach, release function is invoked on the devres data(usb_phy)
>> >> and devres data(usb_phy) is released.
>> > If the phy is got by two devices (like otg and device), will it cause
>> any
>> > problems?
>>
>> No. In that case the phy will be just associated with two devices
>> (because devm_usb_get_phy will be called twice) and on driver detach,
>> usb_put_phy will be called twice (corresponding to each driver that
>> called  devm_usb_get_phy). Do you suspect of any problems?
>>
> So the devm_usb_phy_release will only be called when last phy user's detach?

No. It will be called for every user's (device) detach. Thats how
you'll have a usb_put_phy() corresponding to every usb_get_phy(). (Pls
have a look inside of devm_usb_get_phy() and devm_usb_phy_release()).

devm_usb_phy_release _DOES NOT_ do a usb_remove_phy, if that was your
concern :-)

Thanks
Kishon
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux