1USB_SET_DEVICE_STATE(9) USB Core APIs USB_SET_DEVICE_STATE(9)
2
3
4
6 usb_set_device_state - change a device´s current state (usbcore, hcds)
7
9 void usb_set_device_state(struct usb_device * udev,
10 enum usb_device_state new_state);
11
13 udev
14 pointer to device whose state should be changed
15
16 new_state
17 new state value to be stored
18
20 udev->state is _not_ fully protected by the device lock. Although most
21 transitions are made only while holding the lock, the state can can
22 change to USB_STATE_NOTATTACHED at almost any time. This is so that
23 devices can be marked as disconnected as soon as possible, without
24 having to wait for any semaphores to be released. As a result, all
25 changes to any device´s state must be protected by the
26 device_state_lock spinlock.
27
28 Once a device has been added to the device tree, all changes to its
29 state should be made using this routine. The state should _not_ be set
30 directly.
31
32 If udev->state is already USB_STATE_NOTATTACHED then no change is made.
33 Otherwise udev->state is set to new_state, and if new_state is
34 USB_STATE_NOTATTACHED then all of udev´s descendants´ states are also
35 set to USB_STATE_NOTATTACHED.
36
38Kernel Hackers Manual 2.6. June 2019 USB_SET_DEVICE_STATE(9)