---
name: "usb_lock_device_for_reset"
section: "9"
platform: "linux"
package: "linux-manual-4.9"
version: "4.9.228-1"
release: "Debian 9 (Stretch)"
platforms: ["linux"]
url: "https://new.carta.tech/usb_lock_device_for_reset"
---

# usb\_lock\_device\_for\_reset(9)

cautiously acquire the lock for a usb device structure

## NAME

usb\_lock\_device\_for\_reset - cautiously acquire the lock for a usb device structure

## SYNOPSIS

**int usb\_lock\_device\_for\_reset(struct usb\_device \*** *udev***, const struct usb\_interface \*** *iface***);**

## ARGUMENTS

*udev*

device that's being locked

*iface*

interface bound to the driver making the request (optional)

## DESCRIPTION

Attempts to acquire the device lock, but fails if the device is NOTATTACHED or SUSPENDED, or if iface is specified and the interface is neither BINDING nor BOUND. Rather than sleeping to wait for the lock, the routine polls repeatedly. This is to prevent deadlock with disconnect; in some drivers (such as usb-storage) the **disconnect** or **suspend** method will block waiting for a device reset to complete.

## RETURN

A negative error code for failure, otherwise 0.

## COPYRIGHT
