Adding usb_role_switch_get/set_drvdata() functions that the switch drivers can use for setting and getting private data pointer that is associated with the switch.
Showing the changes to include/linux (1 of 2 files). Show all
Unified · Split
| @@ -25,6 +25,7 @@ typedef enum usb_role (*usb_role_switch_get_t)(struct device *dev); · 24 unmodified lines | |||
| 25 | * @set: Callback for setting the role | 25 | * @set: Callback for setting the role |
| 26 | * @get: Callback for getting the role (optional) | 26 | * @get: Callback for getting the role (optional) |
| 27 | * @allow_userspace_control: If true userspace may change the role through sysfs | 27 | * @allow_userspace_control: If true userspace may change the role through sysfs |
| 28 | * @driver_data: Private data pointer | ||
| 28 | * | 29 | * |
| 29 | * @usb2_port and @usb3_port will point to the USB host port and @udc to the USB | 30 | * @usb2_port and @usb3_port will point to the USB host port and @udc to the USB |
| 30 | * device controller behind the USB connector with the role switch. If | 31 | * device controller behind the USB connector with the role switch. If |
| @@ -40,6 +41,7 @@ struct usb_role_switch_desc { · 9 unmodified lines | |||
| 40 | usb_role_switch_set_t set; | 41 | usb_role_switch_set_t set; |
| 41 | usb_role_switch_get_t get; | 42 | usb_role_switch_get_t get; |
| 42 | bool allow_userspace_control; | 43 | bool allow_userspace_control; |
| 44 | void *driver_data; | ||
| 43 | }; | 45 | }; |
| 44 | 46 | ||
| 45 | 47 | ||
| @@ -57,6 +59,9 @@ struct usb_role_switch * · 11 unmodified lines | |||
| 57 | usb_role_switch_register(struct device *parent, | 59 | usb_role_switch_register(struct device *parent, |
| 58 | const struct usb_role_switch_desc *desc); | 60 | const struct usb_role_switch_desc *desc); |
| 59 | void usb_role_switch_unregister(struct usb_role_switch *sw); | 61 | void usb_role_switch_unregister(struct usb_role_switch *sw); |
| 62 | |||
| 63 | void usb_role_switch_set_drvdata(struct usb_role_switch *sw, void *data); | ||
| 64 | void *usb_role_switch_get_drvdata(struct usb_role_switch *sw); | ||
| 60 | #else | 65 | #else |
| 61 | static inline int usb_role_switch_set_role(struct usb_role_switch *sw, | 66 | static inline int usb_role_switch_set_role(struct usb_role_switch *sw, |
| 62 | enum usb_role role) | 67 | enum usb_role role) |
| @@ -90,6 +95,17 @@ usb_role_switch_register(struct device *parent, · 27 unmodified lines | |||
| 90 | } | 95 | } |
| 91 | 96 | ||
| 92 | static inline void usb_role_switch_unregister(struct usb_role_switch *sw) { } | 97 | static inline void usb_role_switch_unregister(struct usb_role_switch *sw) { } |
| 98 | |||
| 99 | static inline void | ||
| 100 | usb_role_switch_set_drvdata(struct usb_role_switch *sw, void *data) | ||
| 101 | { | ||
| 102 | } | ||
| 103 | |||
| 104 | static inline void *usb_role_switch_get_drvdata(struct usb_role_switch *sw) | ||
| 105 | { | ||
| 106 | return NULL; | ||
| 107 | } | ||
| 108 | |||
| 93 | #endif | 109 | #endif |
| 94 | 110 | ||
| 95 | #endif /* __LINUX_USB_ROLE_H */ | 111 | #endif /* __LINUX_USB_ROLE_H */ |