Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

um: Use tty_port_operations->destruct

As we setup the SIGWINCH handler in tty_port_operations->activate
it makes sense to tear down it in ->destruct.

Signed-off-by: Richard Weinberger <richard@nod.at>

+14 -14
+14 -12
arch/um/drivers/line.c
··· 315 315 return 0; 316 316 } 317 317 318 + static void unregister_winch(struct tty_struct *tty); 319 + 320 + static void line_destruct(struct tty_port *port) 321 + { 322 + struct tty_struct *tty = tty_port_tty_get(port); 323 + struct line *line = tty->driver_data; 324 + 325 + if (line->sigio) { 326 + unregister_winch(tty); 327 + line->sigio = 0; 328 + } 329 + } 330 + 318 331 static const struct tty_port_operations line_port_ops = { 319 332 .activate = line_activate, 333 + .destruct = line_destruct, 320 334 }; 321 335 322 336 int line_open(struct tty_struct *tty, struct file *filp) ··· 352 338 tty->driver_data = line; 353 339 354 340 return 0; 355 - } 356 - 357 - static void unregister_winch(struct tty_struct *tty); 358 - 359 - void line_cleanup(struct tty_struct *tty) 360 - { 361 - struct line *line = tty->driver_data; 362 - 363 - if (line->sigio) { 364 - unregister_winch(tty); 365 - line->sigio = 0; 366 - } 367 341 } 368 342 369 343 void line_close(struct tty_struct *tty, struct file * filp)
-1
arch/um/drivers/ssl.c
··· 105 105 .throttle = line_throttle, 106 106 .unthrottle = line_unthrottle, 107 107 .install = ssl_install, 108 - .cleanup = line_cleanup, 109 108 .hangup = line_hangup, 110 109 }; 111 110
-1
arch/um/drivers/stdio_console.c
··· 110 110 .set_termios = line_set_termios, 111 111 .throttle = line_throttle, 112 112 .unthrottle = line_unthrottle, 113 - .cleanup = line_cleanup, 114 113 .hangup = line_hangup, 115 114 }; 116 115