diff options
Diffstat (limited to 'include/linux/usb/serial.h')
-rw-r--r-- | include/linux/usb/serial.h | 32 |
1 files changed, 28 insertions, 4 deletions
diff --git a/include/linux/usb/serial.h b/include/linux/usb/serial.h index 8cdfed738fe4..44801d26a37a 100644 --- a/include/linux/usb/serial.h +++ b/include/linux/usb/serial.h | |||
@@ -15,6 +15,7 @@ | |||
15 | 15 | ||
16 | #include <linux/kref.h> | 16 | #include <linux/kref.h> |
17 | #include <linux/mutex.h> | 17 | #include <linux/mutex.h> |
18 | #include <linux/sysrq.h> | ||
18 | 19 | ||
19 | #define SERIAL_TTY_MAJOR 188 /* Nice legal number now */ | 20 | #define SERIAL_TTY_MAJOR 188 /* Nice legal number now */ |
20 | #define SERIAL_TTY_MINORS 254 /* loads of devices :) */ | 21 | #define SERIAL_TTY_MINORS 254 /* loads of devices :) */ |
@@ -26,6 +27,13 @@ | |||
26 | /* parity check flag */ | 27 | /* parity check flag */ |
27 | #define RELEVANT_IFLAG(iflag) (iflag & (IGNBRK|BRKINT|IGNPAR|PARMRK|INPCK)) | 28 | #define RELEVANT_IFLAG(iflag) (iflag & (IGNBRK|BRKINT|IGNPAR|PARMRK|INPCK)) |
28 | 29 | ||
30 | enum port_dev_state { | ||
31 | PORT_UNREGISTERED, | ||
32 | PORT_REGISTERING, | ||
33 | PORT_REGISTERED, | ||
34 | PORT_UNREGISTERING, | ||
35 | }; | ||
36 | |||
29 | /** | 37 | /** |
30 | * usb_serial_port: structure for the specific ports of a device. | 38 | * usb_serial_port: structure for the specific ports of a device. |
31 | * @serial: pointer back to the struct usb_serial owner of this port. | 39 | * @serial: pointer back to the struct usb_serial owner of this port. |
@@ -91,12 +99,17 @@ struct usb_serial_port { | |||
91 | int write_urb_busy; | 99 | int write_urb_busy; |
92 | __u8 bulk_out_endpointAddress; | 100 | __u8 bulk_out_endpointAddress; |
93 | 101 | ||
102 | int tx_bytes_flight; | ||
103 | int urbs_in_flight; | ||
104 | |||
94 | wait_queue_head_t write_wait; | 105 | wait_queue_head_t write_wait; |
95 | struct work_struct work; | 106 | struct work_struct work; |
96 | char throttled; | 107 | char throttled; |
97 | char throttle_req; | 108 | char throttle_req; |
98 | char console; | 109 | char console; |
110 | unsigned long sysrq; /* sysrq timeout */ | ||
99 | struct device dev; | 111 | struct device dev; |
112 | enum port_dev_state dev_state; | ||
100 | }; | 113 | }; |
101 | #define to_usb_serial_port(d) container_of(d, struct usb_serial_port, dev) | 114 | #define to_usb_serial_port(d) container_of(d, struct usb_serial_port, dev) |
102 | 115 | ||
@@ -181,8 +194,10 @@ static inline void usb_set_serial_data(struct usb_serial *serial, void *data) | |||
181 | * This will be called when the struct usb_serial structure is fully set | 194 | * This will be called when the struct usb_serial structure is fully set |
182 | * set up. Do any local initialization of the device, or any private | 195 | * set up. Do any local initialization of the device, or any private |
183 | * memory structure allocation at this point in time. | 196 | * memory structure allocation at this point in time. |
184 | * @shutdown: pointer to the driver's shutdown function. This will be | 197 | * @disconnect: pointer to the driver's disconnect function. This will be |
185 | * called when the device is removed from the system. | 198 | * called when the device is unplugged or unbound from the driver. |
199 | * @release: pointer to the driver's release function. This will be called | ||
200 | * when the usb_serial data structure is about to be destroyed. | ||
186 | * @usb_driver: pointer to the struct usb_driver that controls this | 201 | * @usb_driver: pointer to the struct usb_driver that controls this |
187 | * device. This is necessary to allow dynamic ids to be added to | 202 | * device. This is necessary to allow dynamic ids to be added to |
188 | * the driver from sysfs. | 203 | * the driver from sysfs. |
@@ -207,12 +222,14 @@ struct usb_serial_driver { | |||
207 | struct device_driver driver; | 222 | struct device_driver driver; |
208 | struct usb_driver *usb_driver; | 223 | struct usb_driver *usb_driver; |
209 | struct usb_dynids dynids; | 224 | struct usb_dynids dynids; |
225 | int max_in_flight_urbs; | ||
210 | 226 | ||
211 | int (*probe)(struct usb_serial *serial, const struct usb_device_id *id); | 227 | int (*probe)(struct usb_serial *serial, const struct usb_device_id *id); |
212 | int (*attach)(struct usb_serial *serial); | 228 | int (*attach)(struct usb_serial *serial); |
213 | int (*calc_num_ports) (struct usb_serial *serial); | 229 | int (*calc_num_ports) (struct usb_serial *serial); |
214 | 230 | ||
215 | void (*shutdown)(struct usb_serial *serial); | 231 | void (*disconnect)(struct usb_serial *serial); |
232 | void (*release)(struct usb_serial *serial); | ||
216 | 233 | ||
217 | int (*port_probe)(struct usb_serial_port *port); | 234 | int (*port_probe)(struct usb_serial_port *port); |
218 | int (*port_remove)(struct usb_serial_port *port); | 235 | int (*port_remove)(struct usb_serial_port *port); |
@@ -294,9 +311,16 @@ extern void usb_serial_generic_read_bulk_callback(struct urb *urb); | |||
294 | extern void usb_serial_generic_write_bulk_callback(struct urb *urb); | 311 | extern void usb_serial_generic_write_bulk_callback(struct urb *urb); |
295 | extern void usb_serial_generic_throttle(struct tty_struct *tty); | 312 | extern void usb_serial_generic_throttle(struct tty_struct *tty); |
296 | extern void usb_serial_generic_unthrottle(struct tty_struct *tty); | 313 | extern void usb_serial_generic_unthrottle(struct tty_struct *tty); |
297 | extern void usb_serial_generic_shutdown(struct usb_serial *serial); | 314 | extern void usb_serial_generic_disconnect(struct usb_serial *serial); |
315 | extern void usb_serial_generic_release(struct usb_serial *serial); | ||
298 | extern int usb_serial_generic_register(int debug); | 316 | extern int usb_serial_generic_register(int debug); |
299 | extern void usb_serial_generic_deregister(void); | 317 | extern void usb_serial_generic_deregister(void); |
318 | extern void usb_serial_generic_resubmit_read_urb(struct usb_serial_port *port, | ||
319 | gfp_t mem_flags); | ||
320 | extern int usb_serial_handle_sysrq_char(struct usb_serial_port *port, | ||
321 | unsigned int ch); | ||
322 | extern int usb_serial_handle_break(struct usb_serial_port *port); | ||
323 | |||
300 | 324 | ||
301 | extern int usb_serial_bus_register(struct usb_serial_driver *device); | 325 | extern int usb_serial_bus_register(struct usb_serial_driver *device); |
302 | extern void usb_serial_bus_deregister(struct usb_serial_driver *device); | 326 | extern void usb_serial_bus_deregister(struct usb_serial_driver *device); |