mirror of
https://github.com/linux-sunxi/u-boot-sunxi.git
synced 2024-02-12 11:16:03 +08:00
usb: emul: Expose find_descriptor() as a public API
This can be useful outside of the sandbox usb emulation uclass driver. Expose it as a public API with a proper prefix (usb_emul_). Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
This commit is contained in:
@ -52,7 +52,7 @@ static int usb_emul_get_string(struct usb_string *strings, int index,
|
|||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct usb_generic_descriptor **find_descriptor(
|
struct usb_generic_descriptor **usb_emul_find_descriptor(
|
||||||
struct usb_generic_descriptor **ptr, int type, int index)
|
struct usb_generic_descriptor **ptr, int type, int index)
|
||||||
{
|
{
|
||||||
debug("%s: type=%x, index=%d\n", __func__, type, index);
|
debug("%s: type=%x, index=%d\n", __func__, type, index);
|
||||||
@ -91,8 +91,7 @@ static int usb_emul_get_descriptor(struct usb_dev_platdata *plat, int value,
|
|||||||
length);
|
length);
|
||||||
}
|
}
|
||||||
|
|
||||||
ptr = find_descriptor((struct usb_generic_descriptor **)plat->desc_list,
|
ptr = usb_emul_find_descriptor(plat->desc_list, type, index);
|
||||||
type, index);
|
|
||||||
if (!ptr) {
|
if (!ptr) {
|
||||||
debug("%s: Could not find descriptor type %d, index %d\n",
|
debug("%s: Could not find descriptor type %d, index %d\n",
|
||||||
__func__, type, index);
|
__func__, type, index);
|
||||||
|
@ -1055,6 +1055,17 @@ int usb_emul_find(struct udevice *bus, ulong pipe, int port1,
|
|||||||
*/
|
*/
|
||||||
int usb_emul_find_for_dev(struct udevice *dev, struct udevice **emulp);
|
int usb_emul_find_for_dev(struct udevice *dev, struct udevice **emulp);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* usb_emul_find_descriptor() - Find a USB descriptor of a particular device
|
||||||
|
*
|
||||||
|
* @ptr: a pointer to a list of USB descriptor pointers
|
||||||
|
* @type: type of USB descriptor to find
|
||||||
|
* @index: if @type is USB_DT_CONFIG, this is the configuration value
|
||||||
|
* @return a pointer to the USB descriptor found, NULL if not found
|
||||||
|
*/
|
||||||
|
struct usb_generic_descriptor **usb_emul_find_descriptor(
|
||||||
|
struct usb_generic_descriptor **ptr, int type, int index);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* usb_emul_reset() - Reset all emulators ready for use
|
* usb_emul_reset() - Reset all emulators ready for use
|
||||||
*
|
*
|
||||||
|
Reference in New Issue
Block a user