History

usb: typec: Separate the operations vector

Introducing struct typec_operations which has the same callbacks as struct typec_capability. The old callbacks are kept for now, but after all users have been converted, they will be removed.

Heikki Krogerus committed 7 years ago

Commit 46310e41 parent 8c127a42 files · +49 −10Browse files

Showing the changes to include/linux (1 of 2 files). Show all

Unified · Split

include/linux/usb/typec.h+20−0
@@ -168,6 +168,23 @@ struct typec_partner_desc { · 167 unmodified lines
168168 struct usb_pd_identity *identity;
169169 };
170170
171+/**
172+ * struct typec_operations - USB Type-C Port Operations
173+ * @try_role: Set data role preference for DRP port
174+ * @dr_set: Set Data Role
175+ * @pr_set: Set Power Role
176+ * @vconn_set: Source VCONN
177+ * @port_type_set: Set port type
178+ */
179+struct typec_operations {
180+ int (*try_role)(struct typec_port *port, int role);
181+ int (*dr_set)(struct typec_port *port, enum typec_data_role role);
182+ int (*pr_set)(struct typec_port *port, enum typec_role role);
183+ int (*vconn_set)(struct typec_port *port, enum typec_role role);
184+ int (*port_type_set)(struct typec_port *port,
185+ enum typec_port_type type);
186+};
187+
171188 /*
172189 * struct typec_capability - USB Type-C Port Capabilities
173190 * @type: Supported power role of the port
@@ -180,6 +197,7 @@ struct typec_partner_desc { · 6 unmodified lines
180197 * @mux: Multiplexer switch for Alternate/Accessory Modes
181198 * @fwnode: Optional fwnode of the port
182199 * @driver_data: Private pointer for driver specific info
200+ * @ops: Port operations vector
183201 * @try_role: Set data role preference for DRP port
184202 * @dr_set: Set Data Role
185203 * @pr_set: Set Power Role
@@ -201,6 +219,8 @@ struct typec_capability { · 15 unmodified lines
201219 struct fwnode_handle *fwnode;
202220 void *driver_data;
203221
222+ const struct typec_operations *ops;
223+
204224 int (*try_role)(const struct typec_capability *,
205225 int role);
206226

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t