Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 364596
b: refs/heads/master
c: d1e3d75
h: refs/heads/master
v: v3
  • Loading branch information
Felipe Balbi committed Mar 18, 2013
1 parent 7cb10db commit 0453752
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: b15a762f02acb4f1e695a17435f719350f9d5bc1
refs/heads/master: d1e3d757f7aa91f15db347fc05ffd7ef7f413091
21 changes: 21 additions & 0 deletions trunk/drivers/usb/usb-common.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,25 @@ const char *usb_speed_string(enum usb_device_speed speed)
}
EXPORT_SYMBOL_GPL(usb_speed_string);

const char *usb_state_string(enum usb_device_state state)
{
static const char *const names[] = {
[USB_STATE_NOTATTACHED] = "not attached",
[USB_STATE_ATTACHED] = "attached",
[USB_STATE_POWERED] = "powered",
[USB_STATE_RECONNECTING] = "reconnecting",
[USB_STATE_UNAUTHENTICATED] = "unauthenticated",
[USB_STATE_DEFAULT] = "default",
[USB_STATE_ADDRESS] = "addresssed",
[USB_STATE_CONFIGURED] = "configured",
[USB_STATE_SUSPENDED] = "suspended",
};

if (state < 0 || state >= ARRAY_SIZE(names))
return "UNKNOWN";

return names[state];
}
EXPORT_SYMBOL_GPL(usb_state_string);

MODULE_LICENSE("GPL");
9 changes: 9 additions & 0 deletions trunk/include/linux/usb/ch9.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,13 @@
*/
extern const char *usb_speed_string(enum usb_device_speed speed);


/**
* usb_state_string - Returns human readable name for the state.
* @state: The state to return a human-readable name for. If it's not
* any of the states devices in usb_device_state_string enum,
* the string UNKNOWN will be returned.
*/
extern const char *usb_state_string(enum usb_device_state state);

#endif /* __LINUX_USB_CH9_H */

0 comments on commit 0453752

Please sign in to comment.