|
|
|
RE: [PATCH v5 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] |
|
>
> 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.
>
Sorry, I not understand, you would like to say the usb_phy will be released
on its user's detach routine automatically?
>
> @@ -34,6 +35,48 @@ static struct usb_phy *__usb_find_phy(struct list_head
> *list,
> return ERR_PTR(-ENODEV);
> }
>
> +static void devm_usb_phy_release(struct device *dev, void *res)
> +{
> + struct usb_phy *phy = *(struct usb_phy **)res;
> +
> + usb_put_phy(phy);
> +}
> +
> +static int devm_usb_phy_match(struct device *dev, void *res, void
> *match_data)
> +{
> + return res == match_data;
> +}
> +
> +/**
> + * devm_usb_get_phy - find the USB PHY
> + * @dev - device that requests this phy
> + * @type - the type of the phy the controller requires
> + *
> + * Gets the phy using usb_get_phy(), and associates a device with it
> using
> + * devres. On driver detach, release function is invoked on the devres
> data,
> + * then, devres data is freed.
> + *
> + * For use by USB host and peripheral drivers.
> + */
It may not be used by host and peripheral driver only, other drivers(otg?)
like handing id interrupt may also use it.
--
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

[Linux Media] [Video for Linux] [Linux Input] [Linux Audio Users] [Photo] [Yosemite News] [Yosemite Photos] [Free Online Dating] [Linux Kernel] [Linux SCSI] [Old Linux USB Devel Archive] [More Archives]
![]() |
![]() |