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