'\" t .\" Title: usb_set_device_state .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.78.1 .\" Date: May 2018 .\" Manual: USB Core APIs .\" Source: Kernel Hackers Manual 3.16.56 .\" Language: English .\" .TH "USB_SET_DEVICE_STATE" "9" "May 2018" "Kernel Hackers Manual 3\&.16\&" "USB Core APIs" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .\" http://bugs.debian.org/507673 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) .ad l .\" ----------------------------------------------------------------- .\" * MAIN CONTENT STARTS HERE * .\" ----------------------------------------------------------------- .SH "NAME" usb_set_device_state \- change a device\*(Aqs current state (usbcore, hcds) .SH "SYNOPSIS" .HP \w'void\ usb_set_device_state('u .BI "void usb_set_device_state(struct\ usb_device\ *\ " "udev" ", enum\ usb_device_state\ " "new_state" ");" .SH "ARGUMENTS" .PP \fIudev\fR .RS 4 pointer to device whose state should be changed .RE .PP \fInew_state\fR .RS 4 new state value to be stored .RE .SH "DESCRIPTION" .PP udev\->state is _not_ fully protected by the device lock\&. Although most transitions are made only while holding the lock, the state can can change to USB_STATE_NOTATTACHED at almost any time\&. This is so that devices can be marked as disconnected as soon as possible, without having to wait for any semaphores to be released\&. As a result, all changes to any device\*(Aqs state must be protected by the device_state_lock spinlock\&. .PP Once a device has been added to the device tree, all changes to its state should be made using this routine\&. The state should _not_ be set directly\&. .PP If udev\->state is already USB_STATE_NOTATTACHED then no change is made\&. Otherwise udev\->state is set to new_state, and if new_state is USB_STATE_NOTATTACHED then all of udev\*(Aqs descendants\*(Aq states are also set to USB_STATE_NOTATTACHED\&. .SH "COPYRIGHT" .br