.. | .. |
---|
17 | 17 | #include <linux/kref.h> |
---|
18 | 18 | #include <linux/mutex.h> |
---|
19 | 19 | #include <linux/serial.h> |
---|
20 | | -#include <linux/sysrq.h> |
---|
21 | 20 | #include <linux/kfifo.h> |
---|
22 | 21 | |
---|
23 | 22 | /* The maximum number of ports one device can grab at once */ |
---|
24 | 23 | #define MAX_NUM_PORTS 16 |
---|
25 | 24 | |
---|
26 | | -/* parity check flag */ |
---|
27 | | -#define RELEVANT_IFLAG(iflag) (iflag & (IGNBRK|BRKINT|IGNPAR|PARMRK|INPCK)) |
---|
28 | | - |
---|
29 | 25 | /* USB serial flags */ |
---|
30 | 26 | #define USB_SERIAL_WRITE_BUSY 0 |
---|
| 27 | +#define USB_SERIAL_THROTTLED 1 |
---|
31 | 28 | |
---|
32 | 29 | /** |
---|
33 | 30 | * usb_serial_port: structure for the specific ports of a device. |
---|
.. | .. |
---|
67 | 64 | * @flags: usb serial port flags |
---|
68 | 65 | * @write_wait: a wait_queue_head_t used by the port. |
---|
69 | 66 | * @work: work queue entry for the line discipline waking up. |
---|
70 | | - * @throttled: nonzero if the read urb is inactive to throttle the device |
---|
71 | | - * @throttle_req: nonzero if the tty wants to throttle us |
---|
72 | 67 | * @dev: pointer to the serial device |
---|
73 | 68 | * |
---|
74 | 69 | * This structure is used by the usb-serial core and drivers for the specific |
---|
.. | .. |
---|
115 | 110 | unsigned long flags; |
---|
116 | 111 | wait_queue_head_t write_wait; |
---|
117 | 112 | struct work_struct work; |
---|
118 | | - char throttled; |
---|
119 | | - char throttle_req; |
---|
120 | 113 | unsigned long sysrq; /* sysrq timeout */ |
---|
121 | 114 | struct device dev; |
---|
122 | 115 | }; |
---|
.. | .. |
---|
219 | 212 | * Return 0 to continue on with the initialization sequence. Anything |
---|
220 | 213 | * else will abort it. |
---|
221 | 214 | * @attach: pointer to the driver's attach function. |
---|
222 | | - * This will be called when the struct usb_serial structure is fully set |
---|
| 215 | + * This will be called when the struct usb_serial structure is fully |
---|
223 | 216 | * set up. Do any local initialization of the device, or any private |
---|
224 | 217 | * memory structure allocation at this point in time. |
---|
225 | 218 | * @disconnect: pointer to the driver's disconnect function. This will be |
---|
.. | .. |
---|
285 | 278 | int (*write_room)(struct tty_struct *tty); |
---|
286 | 279 | int (*ioctl)(struct tty_struct *tty, |
---|
287 | 280 | unsigned int cmd, unsigned long arg); |
---|
| 281 | + int (*get_serial)(struct tty_struct *tty, struct serial_struct *ss); |
---|
| 282 | + int (*set_serial)(struct tty_struct *tty, struct serial_struct *ss); |
---|
288 | 283 | void (*set_termios)(struct tty_struct *tty, |
---|
289 | 284 | struct usb_serial_port *port, struct ktermios *old); |
---|
290 | 285 | void (*break_ctl)(struct tty_struct *tty, int break_state); |
---|
.. | .. |
---|
320 | 315 | #define to_usb_serial_driver(d) \ |
---|
321 | 316 | container_of(d, struct usb_serial_driver, driver) |
---|
322 | 317 | |
---|
323 | | -extern int usb_serial_register_drivers(struct usb_serial_driver *const serial_drivers[], |
---|
| 318 | +int usb_serial_register_drivers(struct usb_serial_driver *const serial_drivers[], |
---|
324 | 319 | const char *name, const struct usb_device_id *id_table); |
---|
325 | | -extern void usb_serial_deregister_drivers(struct usb_serial_driver *const serial_drivers[]); |
---|
326 | | -extern void usb_serial_port_softint(struct usb_serial_port *port); |
---|
| 320 | +void usb_serial_deregister_drivers(struct usb_serial_driver *const serial_drivers[]); |
---|
| 321 | +void usb_serial_port_softint(struct usb_serial_port *port); |
---|
327 | 322 | |
---|
328 | | -extern int usb_serial_suspend(struct usb_interface *intf, pm_message_t message); |
---|
329 | | -extern int usb_serial_resume(struct usb_interface *intf); |
---|
| 323 | +int usb_serial_suspend(struct usb_interface *intf, pm_message_t message); |
---|
| 324 | +int usb_serial_resume(struct usb_interface *intf); |
---|
330 | 325 | |
---|
331 | 326 | /* USB Serial console functions */ |
---|
332 | 327 | #ifdef CONFIG_USB_SERIAL_CONSOLE |
---|
333 | | -extern void usb_serial_console_init(int minor); |
---|
334 | | -extern void usb_serial_console_exit(void); |
---|
335 | | -extern void usb_serial_console_disconnect(struct usb_serial *serial); |
---|
| 328 | +void usb_serial_console_init(int minor); |
---|
| 329 | +void usb_serial_console_exit(void); |
---|
| 330 | +void usb_serial_console_disconnect(struct usb_serial *serial); |
---|
336 | 331 | #else |
---|
337 | 332 | static inline void usb_serial_console_init(int minor) { } |
---|
338 | 333 | static inline void usb_serial_console_exit(void) { } |
---|
.. | .. |
---|
340 | 335 | #endif |
---|
341 | 336 | |
---|
342 | 337 | /* Functions needed by other parts of the usbserial core */ |
---|
343 | | -extern struct usb_serial_port *usb_serial_port_get_by_minor(unsigned int minor); |
---|
344 | | -extern void usb_serial_put(struct usb_serial *serial); |
---|
345 | | -extern int usb_serial_generic_open(struct tty_struct *tty, |
---|
346 | | - struct usb_serial_port *port); |
---|
347 | | -extern int usb_serial_generic_write_start(struct usb_serial_port *port, |
---|
348 | | - gfp_t mem_flags); |
---|
349 | | -extern int usb_serial_generic_write(struct tty_struct *tty, |
---|
350 | | - struct usb_serial_port *port, const unsigned char *buf, int count); |
---|
351 | | -extern void usb_serial_generic_close(struct usb_serial_port *port); |
---|
352 | | -extern int usb_serial_generic_resume(struct usb_serial *serial); |
---|
353 | | -extern int usb_serial_generic_write_room(struct tty_struct *tty); |
---|
354 | | -extern int usb_serial_generic_chars_in_buffer(struct tty_struct *tty); |
---|
355 | | -extern void usb_serial_generic_wait_until_sent(struct tty_struct *tty, |
---|
356 | | - long timeout); |
---|
357 | | -extern void usb_serial_generic_read_bulk_callback(struct urb *urb); |
---|
358 | | -extern void usb_serial_generic_write_bulk_callback(struct urb *urb); |
---|
359 | | -extern void usb_serial_generic_throttle(struct tty_struct *tty); |
---|
360 | | -extern void usb_serial_generic_unthrottle(struct tty_struct *tty); |
---|
361 | | -extern int usb_serial_generic_tiocmiwait(struct tty_struct *tty, |
---|
362 | | - unsigned long arg); |
---|
363 | | -extern int usb_serial_generic_get_icount(struct tty_struct *tty, |
---|
364 | | - struct serial_icounter_struct *icount); |
---|
365 | | -extern int usb_serial_generic_register(void); |
---|
366 | | -extern void usb_serial_generic_deregister(void); |
---|
367 | | -extern int usb_serial_generic_submit_read_urbs(struct usb_serial_port *port, |
---|
368 | | - gfp_t mem_flags); |
---|
369 | | -extern void usb_serial_generic_process_read_urb(struct urb *urb); |
---|
370 | | -extern int usb_serial_generic_prepare_write_buffer(struct usb_serial_port *port, |
---|
371 | | - void *dest, size_t size); |
---|
372 | | -extern int usb_serial_handle_sysrq_char(struct usb_serial_port *port, |
---|
373 | | - unsigned int ch); |
---|
374 | | -extern int usb_serial_handle_break(struct usb_serial_port *port); |
---|
375 | | -extern void usb_serial_handle_dcd_change(struct usb_serial_port *usb_port, |
---|
376 | | - struct tty_struct *tty, |
---|
377 | | - unsigned int status); |
---|
| 338 | +struct usb_serial_port *usb_serial_port_get_by_minor(unsigned int minor); |
---|
| 339 | +void usb_serial_put(struct usb_serial *serial); |
---|
| 340 | +int usb_serial_generic_open(struct tty_struct *tty, struct usb_serial_port *port); |
---|
| 341 | +int usb_serial_generic_write_start(struct usb_serial_port *port, gfp_t mem_flags); |
---|
| 342 | +int usb_serial_generic_write(struct tty_struct *tty, struct usb_serial_port *port, |
---|
| 343 | + const unsigned char *buf, int count); |
---|
| 344 | +void usb_serial_generic_close(struct usb_serial_port *port); |
---|
| 345 | +int usb_serial_generic_resume(struct usb_serial *serial); |
---|
| 346 | +int usb_serial_generic_write_room(struct tty_struct *tty); |
---|
| 347 | +int usb_serial_generic_chars_in_buffer(struct tty_struct *tty); |
---|
| 348 | +void usb_serial_generic_wait_until_sent(struct tty_struct *tty, long timeout); |
---|
| 349 | +void usb_serial_generic_read_bulk_callback(struct urb *urb); |
---|
| 350 | +void usb_serial_generic_write_bulk_callback(struct urb *urb); |
---|
| 351 | +void usb_serial_generic_throttle(struct tty_struct *tty); |
---|
| 352 | +void usb_serial_generic_unthrottle(struct tty_struct *tty); |
---|
| 353 | +int usb_serial_generic_tiocmiwait(struct tty_struct *tty, unsigned long arg); |
---|
| 354 | +int usb_serial_generic_get_icount(struct tty_struct *tty, struct serial_icounter_struct *icount); |
---|
| 355 | +int usb_serial_generic_register(void); |
---|
| 356 | +void usb_serial_generic_deregister(void); |
---|
| 357 | +int usb_serial_generic_submit_read_urbs(struct usb_serial_port *port, gfp_t mem_flags); |
---|
| 358 | +void usb_serial_generic_process_read_urb(struct urb *urb); |
---|
| 359 | +int usb_serial_generic_prepare_write_buffer(struct usb_serial_port *port, void *dest, size_t size); |
---|
| 360 | + |
---|
| 361 | +#if defined(CONFIG_USB_SERIAL_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) |
---|
| 362 | +int usb_serial_handle_sysrq_char(struct usb_serial_port *port, unsigned int ch); |
---|
| 363 | +int usb_serial_handle_break(struct usb_serial_port *port); |
---|
| 364 | +#else |
---|
| 365 | +static inline int usb_serial_handle_sysrq_char(struct usb_serial_port *port, unsigned int ch) |
---|
| 366 | +{ |
---|
| 367 | + return 0; |
---|
| 368 | +} |
---|
| 369 | +static inline int usb_serial_handle_break(struct usb_serial_port *port) |
---|
| 370 | +{ |
---|
| 371 | + return 0; |
---|
| 372 | +} |
---|
| 373 | +#endif |
---|
| 374 | + |
---|
| 375 | +void usb_serial_handle_dcd_change(struct usb_serial_port *usb_port, |
---|
| 376 | + struct tty_struct *tty, unsigned int status); |
---|
378 | 377 | |
---|
379 | 378 | |
---|
380 | | -extern int usb_serial_bus_register(struct usb_serial_driver *device); |
---|
381 | | -extern void usb_serial_bus_deregister(struct usb_serial_driver *device); |
---|
| 379 | +int usb_serial_bus_register(struct usb_serial_driver *device); |
---|
| 380 | +void usb_serial_bus_deregister(struct usb_serial_driver *device); |
---|
382 | 381 | |
---|
383 | 382 | extern struct bus_type usb_serial_bus_type; |
---|
384 | 383 | extern struct tty_driver *usb_serial_tty_driver; |
---|