1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _LINUX_TTY_DRIVER_H
3 #define _LINUX_TTY_DRIVER_H
4
5 #include <linux/export.h>
6 #include <linux/fs.h>
7 #include <linux/kref.h>
8 #include <linux/list.h>
9 #include <linux/cdev.h>
10 #include <linux/uaccess.h>
11 #include <linux/termios.h>
12 #include <linux/seq_file.h>
13 #include <linux/android_kabi.h>
14
15 struct tty_struct;
16 struct tty_driver;
17 struct serial_icounter_struct;
18 struct serial_struct;
19
20 /**
21 * struct tty_operations -- interface between driver and tty
22 *
23 * @lookup: ``struct tty_struct *()(struct tty_driver *self, struct file *,
24 * int idx)``
25 *
26 * Return the tty device corresponding to @idx, %NULL if there is not
27 * one currently in use and an %ERR_PTR value on error. Called under
28 * %tty_mutex (for now!)
29 *
30 * Optional method. Default behaviour is to use the @self->ttys array.
31 *
32 * @install: ``int ()(struct tty_driver *self, struct tty_struct *tty)``
33 *
34 * Install a new @tty into the @self's internal tables. Used in
35 * conjunction with @lookup and @remove methods.
36 *
37 * Optional method. Default behaviour is to use the @self->ttys array.
38 *
39 * @remove: ``void ()(struct tty_driver *self, struct tty_struct *tty)``
40 *
41 * Remove a closed @tty from the @self's internal tables. Used in
42 * conjunction with @lookup and @remove methods.
43 *
44 * Optional method. Default behaviour is to use the @self->ttys array.
45 *
46 * @open: ``int ()(struct tty_struct *tty, struct file *)``
47 *
48 * This routine is called when a particular @tty device is opened. This
49 * routine is mandatory; if this routine is not filled in, the attempted
50 * open will fail with %ENODEV.
51 *
52 * Required method. Called with tty lock held. May sleep.
53 *
54 * @close: ``void ()(struct tty_struct *tty, struct file *)``
55 *
56 * This routine is called when a particular @tty device is closed. At the
57 * point of return from this call the driver must make no further ldisc
58 * calls of any kind.
59 *
60 * Remark: called even if the corresponding @open() failed.
61 *
62 * Required method. Called with tty lock held. May sleep.
63 *
64 * @shutdown: ``void ()(struct tty_struct *tty)``
65 *
66 * This routine is called under the tty lock when a particular @tty device
67 * is closed for the last time. It executes before the @tty resources
68 * are freed so may execute while another function holds a @tty kref.
69 *
70 * @cleanup: ``void ()(struct tty_struct *tty)``
71 *
72 * This routine is called asynchronously when a particular @tty device
73 * is closed for the last time freeing up the resources. This is
74 * actually the second part of shutdown for routines that might sleep.
75 *
76 * @write: ``int ()(struct tty_struct *tty, const unsigned char *buf,
77 * int count)``
78 *
79 * This routine is called by the kernel to write a series (@count) of
80 * characters (@buf) to the @tty device. The characters may come from
81 * user space or kernel space. This routine will return the
82 * number of characters actually accepted for writing.
83 *
84 * May occur in parallel in special cases. Because this includes panic
85 * paths drivers generally shouldn't try and do clever locking here.
86 *
87 * Optional: Required for writable devices. May not sleep.
88 *
89 * @put_char: ``int ()(struct tty_struct *tty, unsigned char ch)``
90 *
91 * This routine is called by the kernel to write a single character @ch to
92 * the @tty device. If the kernel uses this routine, it must call the
93 * @flush_chars() routine (if defined) when it is done stuffing characters
94 * into the driver. If there is no room in the queue, the character is
95 * ignored.
96 *
97 * Optional: Kernel will use the @write method if not provided. Do not
98 * call this function directly, call tty_put_char().
99 *
100 * @flush_chars: ``void ()(struct tty_struct *tty)``
101 *
102 * This routine is called by the kernel after it has written a
103 * series of characters to the tty device using @put_char().
104 *
105 * Optional. Do not call this function directly, call
106 * tty_driver_flush_chars().
107 *
108 * @write_room: ``unsigned int ()(struct tty_struct *tty)``
109 *
110 * This routine returns the numbers of characters the @tty driver
111 * will accept for queuing to be written. This number is subject
112 * to change as output buffers get emptied, or if the output flow
113 * control is acted.
114 *
115 * The ldisc is responsible for being intelligent about multi-threading of
116 * write_room/write calls
117 *
118 * Required if @write method is provided else not needed. Do not call this
119 * function directly, call tty_write_room()
120 *
121 * @chars_in_buffer: ``unsigned int ()(struct tty_struct *tty)``
122 *
123 * This routine returns the number of characters in the device private
124 * output queue. Used in tty_wait_until_sent() and for poll()
125 * implementation.
126 *
127 * Optional: if not provided, it is assumed there is no queue on the
128 * device. Do not call this function directly, call tty_chars_in_buffer().
129 *
130 * @ioctl: ``int ()(struct tty_struct *tty, unsigned int cmd,
131 * unsigned long arg)``
132 *
133 * This routine allows the @tty driver to implement device-specific
134 * ioctls. If the ioctl number passed in @cmd is not recognized by the
135 * driver, it should return %ENOIOCTLCMD.
136 *
137 * Optional.
138 *
139 * @compat_ioctl: ``long ()(struct tty_struct *tty, unsigned int cmd,
140 * unsigned long arg)``
141 *
142 * Implement ioctl processing for 32 bit process on 64 bit system.
143 *
144 * Optional.
145 *
146 * @set_termios: ``void ()(struct tty_struct *tty, const struct ktermios *old)``
147 *
148 * This routine allows the @tty driver to be notified when device's
149 * termios settings have changed. New settings are in @tty->termios.
150 * Previous settings are passed in the @old argument.
151 *
152 * The API is defined such that the driver should return the actual modes
153 * selected. This means that the driver is responsible for modifying any
154 * bits in @tty->termios it cannot fulfill to indicate the actual modes
155 * being used.
156 *
157 * Optional. Called under the @tty->termios_rwsem. May sleep.
158 *
159 * @set_ldisc: ``void ()(struct tty_struct *tty)``
160 *
161 * This routine allows the @tty driver to be notified when the device's
162 * line discipline is being changed. At the point this is done the
163 * discipline is not yet usable.
164 *
165 * Optional. Called under the @tty->ldisc_sem and @tty->termios_rwsem.
166 *
167 * @throttle: ``void ()(struct tty_struct *tty)``
168 *
169 * This routine notifies the @tty driver that input buffers for the line
170 * discipline are close to full, and it should somehow signal that no more
171 * characters should be sent to the @tty.
172 *
173 * Serialization including with @unthrottle() is the job of the ldisc
174 * layer.
175 *
176 * Optional: Always invoke via tty_throttle_safe(). Called under the
177 * @tty->termios_rwsem.
178 *
179 * @unthrottle: ``void ()(struct tty_struct *tty)``
180 *
181 * This routine notifies the @tty driver that it should signal that
182 * characters can now be sent to the @tty without fear of overrunning the
183 * input buffers of the line disciplines.
184 *
185 * Optional. Always invoke via tty_unthrottle(). Called under the
186 * @tty->termios_rwsem.
187 *
188 * @stop: ``void ()(struct tty_struct *tty)``
189 *
190 * This routine notifies the @tty driver that it should stop outputting
191 * characters to the tty device.
192 *
193 * Called with @tty->flow.lock held. Serialized with @start() method.
194 *
195 * Optional. Always invoke via stop_tty().
196 *
197 * @start: ``void ()(struct tty_struct *tty)``
198 *
199 * This routine notifies the @tty driver that it resumed sending
200 * characters to the @tty device.
201 *
202 * Called with @tty->flow.lock held. Serialized with stop() method.
203 *
204 * Optional. Always invoke via start_tty().
205 *
206 * @hangup: ``void ()(struct tty_struct *tty)``
207 *
208 * This routine notifies the @tty driver that it should hang up the @tty
209 * device.
210 *
211 * Optional. Called with tty lock held.
212 *
213 * @break_ctl: ``int ()(struct tty_struct *tty, int state)``
214 *
215 * This optional routine requests the @tty driver to turn on or off BREAK
216 * status on the RS-232 port. If @state is -1, then the BREAK status
217 * should be turned on; if @state is 0, then BREAK should be turned off.
218 *
219 * If this routine is implemented, the high-level tty driver will handle
220 * the following ioctls: %TCSBRK, %TCSBRKP, %TIOCSBRK, %TIOCCBRK.
221 *
222 * If the driver sets %TTY_DRIVER_HARDWARE_BREAK in tty_alloc_driver(),
223 * then the interface will also be called with actual times and the
224 * hardware is expected to do the delay work itself. 0 and -1 are still
225 * used for on/off.
226 *
227 * Optional: Required for %TCSBRK/%BRKP/etc. handling. May sleep.
228 *
229 * @flush_buffer: ``void ()(struct tty_struct *tty)``
230 *
231 * This routine discards device private output buffer. Invoked on close,
232 * hangup, to implement %TCOFLUSH ioctl and similar.
233 *
234 * Optional: if not provided, it is assumed there is no queue on the
235 * device. Do not call this function directly, call
236 * tty_driver_flush_buffer().
237 *
238 * @wait_until_sent: ``void ()(struct tty_struct *tty, int timeout)``
239 *
240 * This routine waits until the device has written out all of the
241 * characters in its transmitter FIFO. Or until @timeout (in jiffies) is
242 * reached.
243 *
244 * Optional: If not provided, the device is assumed to have no FIFO.
245 * Usually correct to invoke via tty_wait_until_sent(). May sleep.
246 *
247 * @send_xchar: ``void ()(struct tty_struct *tty, char ch)``
248 *
249 * This routine is used to send a high-priority XON/XOFF character (@ch)
250 * to the @tty device.
251 *
252 * Optional: If not provided, then the @write method is called under
253 * the @tty->atomic_write_lock to keep it serialized with the ldisc.
254 *
255 * @tiocmget: ``int ()(struct tty_struct *tty)``
256 *
257 * This routine is used to obtain the modem status bits from the @tty
258 * driver.
259 *
260 * Optional: If not provided, then %ENOTTY is returned from the %TIOCMGET
261 * ioctl. Do not call this function directly, call tty_tiocmget().
262 *
263 * @tiocmset: ``int ()(struct tty_struct *tty,
264 * unsigned int set, unsigned int clear)``
265 *
266 * This routine is used to set the modem status bits to the @tty driver.
267 * First, @clear bits should be cleared, then @set bits set.
268 *
269 * Optional: If not provided, then %ENOTTY is returned from the %TIOCMSET
270 * ioctl. Do not call this function directly, call tty_tiocmset().
271 *
272 * @resize: ``int ()(struct tty_struct *tty, struct winsize *ws)``
273 *
274 * Called when a termios request is issued which changes the requested
275 * terminal geometry to @ws.
276 *
277 * Optional: the default action is to update the termios structure
278 * without error. This is usually the correct behaviour. Drivers should
279 * not force errors here if they are not resizable objects (e.g. a serial
280 * line). See tty_do_resize() if you need to wrap the standard method
281 * in your own logic -- the usual case.
282 *
283 * @get_icount: ``int ()(struct tty_struct *tty,
284 * struct serial_icounter *icount)``
285 *
286 * Called when the @tty device receives a %TIOCGICOUNT ioctl. Passed a
287 * kernel structure @icount to complete.
288 *
289 * Optional: called only if provided, otherwise %ENOTTY will be returned.
290 *
291 * @get_serial: ``int ()(struct tty_struct *tty, struct serial_struct *p)``
292 *
293 * Called when the @tty device receives a %TIOCGSERIAL ioctl. Passed a
294 * kernel structure @p (&struct serial_struct) to complete.
295 *
296 * Optional: called only if provided, otherwise %ENOTTY will be returned.
297 * Do not call this function directly, call tty_tiocgserial().
298 *
299 * @set_serial: ``int ()(struct tty_struct *tty, struct serial_struct *p)``
300 *
301 * Called when the @tty device receives a %TIOCSSERIAL ioctl. Passed a
302 * kernel structure @p (&struct serial_struct) to set the values from.
303 *
304 * Optional: called only if provided, otherwise %ENOTTY will be returned.
305 * Do not call this function directly, call tty_tiocsserial().
306 *
307 * @show_fdinfo: ``void ()(struct tty_struct *tty, struct seq_file *m)``
308 *
309 * Called when the @tty device file descriptor receives a fdinfo request
310 * from VFS (to show in /proc/<pid>/fdinfo/). @m should be filled with
311 * information.
312 *
313 * Optional: called only if provided, otherwise nothing is written to @m.
314 * Do not call this function directly, call tty_show_fdinfo().
315 *
316 * @poll_init: ``int ()(struct tty_driver *driver, int line, char *options)``
317 *
318 * kgdboc support (Documentation/dev-tools/kgdb.rst). This routine is
319 * called to initialize the HW for later use by calling @poll_get_char or
320 * @poll_put_char.
321 *
322 * Optional: called only if provided, otherwise skipped as a non-polling
323 * driver.
324 *
325 * @poll_get_char: ``int ()(struct tty_driver *driver, int line)``
326 *
327 * kgdboc support (see @poll_init). @driver should read a character from a
328 * tty identified by @line and return it.
329 *
330 * Optional: called only if @poll_init provided.
331 *
332 * @poll_put_char: ``void ()(struct tty_driver *driver, int line, char ch)``
333 *
334 * kgdboc support (see @poll_init). @driver should write character @ch to
335 * a tty identified by @line.
336 *
337 * Optional: called only if @poll_init provided.
338 *
339 * @proc_show: ``int ()(struct seq_file *m, void *driver)``
340 *
341 * Driver @driver (cast to &struct tty_driver) can show additional info in
342 * /proc/tty/driver/<driver_name>. It is enough to fill in the information
343 * into @m.
344 *
345 * Optional: called only if provided, otherwise no /proc entry created.
346 *
347 * This structure defines the interface between the low-level tty driver and
348 * the tty routines. These routines can be defined. Unless noted otherwise,
349 * they are optional, and can be filled in with a %NULL pointer.
350 */
351 struct tty_operations {
352 struct tty_struct * (*lookup)(struct tty_driver *driver,
353 struct file *filp, int idx);
354 int (*install)(struct tty_driver *driver, struct tty_struct *tty);
355 void (*remove)(struct tty_driver *driver, struct tty_struct *tty);
356 int (*open)(struct tty_struct * tty, struct file * filp);
357 void (*close)(struct tty_struct * tty, struct file * filp);
358 void (*shutdown)(struct tty_struct *tty);
359 void (*cleanup)(struct tty_struct *tty);
360 int (*write)(struct tty_struct * tty,
361 const unsigned char *buf, int count);
362 int (*put_char)(struct tty_struct *tty, unsigned char ch);
363 void (*flush_chars)(struct tty_struct *tty);
364 unsigned int (*write_room)(struct tty_struct *tty);
365 unsigned int (*chars_in_buffer)(struct tty_struct *tty);
366 int (*ioctl)(struct tty_struct *tty,
367 unsigned int cmd, unsigned long arg);
368 long (*compat_ioctl)(struct tty_struct *tty,
369 unsigned int cmd, unsigned long arg);
370 void (*set_termios)(struct tty_struct *tty, const struct ktermios *old);
371 void (*throttle)(struct tty_struct * tty);
372 void (*unthrottle)(struct tty_struct * tty);
373 void (*stop)(struct tty_struct *tty);
374 void (*start)(struct tty_struct *tty);
375 void (*hangup)(struct tty_struct *tty);
376 int (*break_ctl)(struct tty_struct *tty, int state);
377 void (*flush_buffer)(struct tty_struct *tty);
378 void (*set_ldisc)(struct tty_struct *tty);
379 void (*wait_until_sent)(struct tty_struct *tty, int timeout);
380 void (*send_xchar)(struct tty_struct *tty, char ch);
381 int (*tiocmget)(struct tty_struct *tty);
382 int (*tiocmset)(struct tty_struct *tty,
383 unsigned int set, unsigned int clear);
384 int (*resize)(struct tty_struct *tty, struct winsize *ws);
385 int (*get_icount)(struct tty_struct *tty,
386 struct serial_icounter_struct *icount);
387 int (*get_serial)(struct tty_struct *tty, struct serial_struct *p);
388 int (*set_serial)(struct tty_struct *tty, struct serial_struct *p);
389 void (*show_fdinfo)(struct tty_struct *tty, struct seq_file *m);
390 #ifdef CONFIG_CONSOLE_POLL
391 int (*poll_init)(struct tty_driver *driver, int line, char *options);
392 int (*poll_get_char)(struct tty_driver *driver, int line);
393 void (*poll_put_char)(struct tty_driver *driver, int line, char ch);
394 #endif
395 int (*proc_show)(struct seq_file *m, void *driver);
396
397 ANDROID_KABI_RESERVE(1);
398 ANDROID_KABI_RESERVE(2);
399 } __randomize_layout;
400
401 /**
402 * struct tty_driver -- driver for TTY devices
403 *
404 * @kref: reference counting. Reaching zero frees all the internals and the
405 * driver.
406 * @cdevs: allocated/registered character /dev devices
407 * @owner: modules owning this driver. Used drivers cannot be rmmod'ed.
408 * Automatically set by tty_alloc_driver().
409 * @driver_name: name of the driver used in /proc/tty
410 * @name: used for constructing /dev node name
411 * @name_base: used as a number base for constructing /dev node name
412 * @major: major /dev device number (zero for autoassignment)
413 * @minor_start: the first minor /dev device number
414 * @num: number of devices allocated
415 * @type: type of tty driver (%TTY_DRIVER_TYPE_)
416 * @subtype: subtype of tty driver (%SYSTEM_TYPE_, %PTY_TYPE_, %SERIAL_TYPE_)
417 * @init_termios: termios to set to each tty initially (e.g. %tty_std_termios)
418 * @flags: tty driver flags (%TTY_DRIVER_)
419 * @proc_entry: proc fs entry, used internally
420 * @other: driver of the linked tty; only used for the PTY driver
421 * @ttys: array of active &struct tty_struct, set by tty_standard_install()
422 * @ports: array of &struct tty_port; can be set during initialization by
423 * tty_port_link_device() and similar
424 * @termios: storage for termios at each TTY close for the next open
425 * @driver_state: pointer to driver's arbitrary data
426 * @ops: driver hooks for TTYs. Set them using tty_set_operations(). Use &struct
427 * tty_port helpers in them as much as possible.
428 * @tty_drivers: used internally to link tty_drivers together
429 *
430 * The usual handling of &struct tty_driver is to allocate it by
431 * tty_alloc_driver(), set up all the necessary members, and register it by
432 * tty_register_driver(). At last, the driver is torn down by calling
433 * tty_unregister_driver() followed by tty_driver_kref_put().
434 *
435 * The fields required to be set before calling tty_register_driver() include
436 * @driver_name, @name, @type, @subtype, @init_termios, and @ops.
437 */
438 struct tty_driver {
439 struct kref kref;
440 struct cdev **cdevs;
441 struct module *owner;
442 const char *driver_name;
443 const char *name;
444 int name_base;
445 int major;
446 int minor_start;
447 unsigned int num;
448 short type;
449 short subtype;
450 struct ktermios init_termios;
451 unsigned long flags;
452 struct proc_dir_entry *proc_entry;
453 struct tty_driver *other;
454
455 /*
456 * Pointer to the tty data structures
457 */
458 struct tty_struct **ttys;
459 struct tty_port **ports;
460 struct ktermios **termios;
461 void *driver_state;
462
463 /*
464 * Driver methods
465 */
466
467 const struct tty_operations *ops;
468 struct list_head tty_drivers;
469
470 ANDROID_KABI_RESERVE(1);
471 ANDROID_KABI_RESERVE(2);
472 } __randomize_layout;
473
474 extern struct list_head tty_drivers;
475
476 struct tty_driver *__tty_alloc_driver(unsigned int lines, struct module *owner,
477 unsigned long flags);
478 struct tty_driver *tty_find_polling_driver(char *name, int *line);
479
480 void tty_driver_kref_put(struct tty_driver *driver);
481
482 /* Use TTY_DRIVER_* flags below */
483 #define tty_alloc_driver(lines, flags) \
484 __tty_alloc_driver(lines, THIS_MODULE, flags)
485
tty_driver_kref_get(struct tty_driver * d)486 static inline struct tty_driver *tty_driver_kref_get(struct tty_driver *d)
487 {
488 kref_get(&d->kref);
489 return d;
490 }
491
tty_set_operations(struct tty_driver * driver,const struct tty_operations * op)492 static inline void tty_set_operations(struct tty_driver *driver,
493 const struct tty_operations *op)
494 {
495 driver->ops = op;
496 }
497
498 /**
499 * DOC: TTY Driver Flags
500 *
501 * TTY_DRIVER_RESET_TERMIOS
502 * Requests the tty layer to reset the termios setting when the last
503 * process has closed the device. Used for PTYs, in particular.
504 *
505 * TTY_DRIVER_REAL_RAW
506 * Indicates that the driver will guarantee not to set any special
507 * character handling flags if this is set for the tty:
508 *
509 * ``(IGNBRK || (!BRKINT && !PARMRK)) && (IGNPAR || !INPCK)``
510 *
511 * That is, if there is no reason for the driver to
512 * send notifications of parity and break characters up to the line
513 * driver, it won't do so. This allows the line driver to optimize for
514 * this case if this flag is set. (Note that there is also a promise, if
515 * the above case is true, not to signal overruns, either.)
516 *
517 * TTY_DRIVER_DYNAMIC_DEV
518 * The individual tty devices need to be registered with a call to
519 * tty_register_device() when the device is found in the system and
520 * unregistered with a call to tty_unregister_device() so the devices will
521 * be show up properly in sysfs. If not set, all &tty_driver.num entries
522 * will be created by the tty core in sysfs when tty_register_driver() is
523 * called. This is to be used by drivers that have tty devices that can
524 * appear and disappear while the main tty driver is registered with the
525 * tty core.
526 *
527 * TTY_DRIVER_DEVPTS_MEM
528 * Don't use the standard arrays (&tty_driver.ttys and
529 * &tty_driver.termios), instead use dynamic memory keyed through the
530 * devpts filesystem. This is only applicable to the PTY driver.
531 *
532 * TTY_DRIVER_HARDWARE_BREAK
533 * Hardware handles break signals. Pass the requested timeout to the
534 * &tty_operations.break_ctl instead of using a simple on/off interface.
535 *
536 * TTY_DRIVER_DYNAMIC_ALLOC
537 * Do not allocate structures which are needed per line for this driver
538 * (&tty_driver.ports) as it would waste memory. The driver will take
539 * care. This is only applicable to the PTY driver.
540 *
541 * TTY_DRIVER_UNNUMBERED_NODE
542 * Do not create numbered ``/dev`` nodes. For example, create
543 * ``/dev/ttyprintk`` and not ``/dev/ttyprintk0``. Applicable only when a
544 * driver for a single tty device is being allocated.
545 */
546 #define TTY_DRIVER_INSTALLED 0x0001
547 #define TTY_DRIVER_RESET_TERMIOS 0x0002
548 #define TTY_DRIVER_REAL_RAW 0x0004
549 #define TTY_DRIVER_DYNAMIC_DEV 0x0008
550 #define TTY_DRIVER_DEVPTS_MEM 0x0010
551 #define TTY_DRIVER_HARDWARE_BREAK 0x0020
552 #define TTY_DRIVER_DYNAMIC_ALLOC 0x0040
553 #define TTY_DRIVER_UNNUMBERED_NODE 0x0080
554
555 /* tty driver types */
556 #define TTY_DRIVER_TYPE_SYSTEM 0x0001
557 #define TTY_DRIVER_TYPE_CONSOLE 0x0002
558 #define TTY_DRIVER_TYPE_SERIAL 0x0003
559 #define TTY_DRIVER_TYPE_PTY 0x0004
560 #define TTY_DRIVER_TYPE_SCC 0x0005 /* scc driver */
561 #define TTY_DRIVER_TYPE_SYSCONS 0x0006
562
563 /* system subtypes (magic, used by tty_io.c) */
564 #define SYSTEM_TYPE_TTY 0x0001
565 #define SYSTEM_TYPE_CONSOLE 0x0002
566 #define SYSTEM_TYPE_SYSCONS 0x0003
567 #define SYSTEM_TYPE_SYSPTMX 0x0004
568
569 /* pty subtypes (magic, used by tty_io.c) */
570 #define PTY_TYPE_MASTER 0x0001
571 #define PTY_TYPE_SLAVE 0x0002
572
573 /* serial subtype definitions */
574 #define SERIAL_TYPE_NORMAL 1
575
576 int tty_register_driver(struct tty_driver *driver);
577 void tty_unregister_driver(struct tty_driver *driver);
578 struct device *tty_register_device(struct tty_driver *driver, unsigned index,
579 struct device *dev);
580 struct device *tty_register_device_attr(struct tty_driver *driver,
581 unsigned index, struct device *device, void *drvdata,
582 const struct attribute_group **attr_grp);
583 void tty_unregister_device(struct tty_driver *driver, unsigned index);
584
585 #ifdef CONFIG_PROC_FS
586 void proc_tty_register_driver(struct tty_driver *);
587 void proc_tty_unregister_driver(struct tty_driver *);
588 #else
proc_tty_register_driver(struct tty_driver * d)589 static inline void proc_tty_register_driver(struct tty_driver *d) {}
proc_tty_unregister_driver(struct tty_driver * d)590 static inline void proc_tty_unregister_driver(struct tty_driver *d) {}
591 #endif
592
593 #endif /* #ifdef _LINUX_TTY_DRIVER_H */
594