usb_alloc_urb
Prev | Chapter 5. USB Core APIs | Next

## Name

usb_alloc_urb — creates a new urb for a USB driver to use

## Synopsis

`struct urb * usb_alloc_urb (` | int | iso_packets,
| gfp_t | mem_flags`)`;

## Arguments

`iso_packets`

  number of iso packets for this urb

`mem_flags`

  the type of memory to allocate, see `kmalloc` for a list of valid options for this.

## Description

Creates an urb for the USB driver to use, initializes a few internal structures, incrementes the usage counter, and returns a pointer to it.

If no memory is available, NULL is returned.

If the driver want to use this urb for interrupt, control, or bulk endpoints, pass '0' as the number of iso packets.

The driver must call `usb_free_urb` when it is finished with the urb.

Prev | Up | Next
usb_init_urb | Home | usb_free_urb