Skip to content

Commit 2f16669

Browse files
Jiri Slabygregkh
authored andcommitted
TTY: remove re-assignments to tty_driver members
All num, magic and owner are set by alloc_tty_driver. No need to re-set them on each allocation site. pti driver sets something different to what it passes to alloc_tty_driver. It is not a bug, since we don't use the lines parameter in any way. Anyway this is fixed, and now we do the right thing. Signed-off-by: Jiri Slaby <jslaby@suse.cz> Acked-by: Tilman Schmidt <tilman@imap.cc> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 87cab16 commit 2f16669

41 files changed

Lines changed: 3 additions & 59 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎arch/ia64/hp/sim/simserial.c‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -928,7 +928,6 @@ simrs_init (void)
928928

929929
/* Initialize the tty_driver structure */
930930

931-
hp_simserial_driver->owner = THIS_MODULE;
932931
hp_simserial_driver->driver_name = "simserial";
933932
hp_simserial_driver->name = "ttyS";
934933
hp_simserial_driver->major = TTY_MAJOR;

‎arch/m68k/emu/nfcon.c‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,6 @@ static int __init nfcon_init(void)
127127
if (!nfcon_tty_driver)
128128
return -ENOMEM;
129129

130-
nfcon_tty_driver->owner = THIS_MODULE;
131130
nfcon_tty_driver->driver_name = "nfcon";
132131
nfcon_tty_driver->name = "nfcon";
133132
nfcon_tty_driver->type = TTY_DRIVER_TYPE_SYSTEM;

‎arch/xtensa/platforms/iss/console.c‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,6 @@ int __init rs_init(void)
216216

217217
/* Initialize the tty_driver structure */
218218

219-
serial_driver->owner = THIS_MODULE;
220219
serial_driver->driver_name = "iss_serial";
221220
serial_driver->name = "ttyS";
222221
serial_driver->major = TTY_MAJOR;

‎drivers/char/pcmcia/synclink_cs.c‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2836,7 +2836,6 @@ static int __init synclink_cs_init(void)
28362836

28372837
/* Initialize the tty_driver structure */
28382838

2839-
serial_driver->owner = THIS_MODULE;
28402839
serial_driver->driver_name = "synclink_cs";
28412840
serial_driver->name = "ttySLP";
28422841
serial_driver->major = ttymajor;

‎drivers/char/ttyprintk.c‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,12 +184,10 @@ static int __init ttyprintk_init(void)
184184
if (!ttyprintk_driver)
185185
return ret;
186186

187-
ttyprintk_driver->owner = THIS_MODULE;
188187
ttyprintk_driver->driver_name = "ttyprintk";
189188
ttyprintk_driver->name = "ttyprintk";
190189
ttyprintk_driver->major = TTYAUX_MAJOR;
191190
ttyprintk_driver->minor_start = 3;
192-
ttyprintk_driver->num = 1;
193191
ttyprintk_driver->type = TTY_DRIVER_TYPE_CONSOLE;
194192
ttyprintk_driver->init_termios = tty_std_termios;
195193
ttyprintk_driver->init_termios.c_oflag = OPOST | OCRNL | ONOCR | ONLRET;

‎drivers/isdn/capi/capi.c‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1287,7 +1287,6 @@ static int __init capinc_tty_init(void)
12871287
kfree(capiminors);
12881288
return -ENOMEM;
12891289
}
1290-
drv->owner = THIS_MODULE;
12911290
drv->driver_name = "capi_nc";
12921291
drv->name = "capi";
12931292
drv->major = 0;

‎drivers/isdn/gigaset/interface.c‎

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -669,27 +669,22 @@ EXPORT_SYMBOL_GPL(gigaset_if_receive);
669669
void gigaset_if_initdriver(struct gigaset_driver *drv, const char *procname,
670670
const char *devname)
671671
{
672-
unsigned minors = drv->minors;
673672
int ret;
674673
struct tty_driver *tty;
675674

676675
drv->have_tty = 0;
677676

678-
drv->tty = tty = alloc_tty_driver(minors);
677+
drv->tty = tty = alloc_tty_driver(drv->minors);
679678
if (tty == NULL)
680679
goto enomem;
681680

682-
tty->magic = TTY_DRIVER_MAGIC,
683681
tty->type = TTY_DRIVER_TYPE_SERIAL,
684682
tty->subtype = SERIAL_TYPE_NORMAL,
685683
tty->flags = TTY_DRIVER_REAL_RAW | TTY_DRIVER_DYNAMIC_DEV;
686684

687685
tty->driver_name = procname;
688686
tty->name = devname;
689687
tty->minor_start = drv->minor;
690-
tty->num = drv->minors;
691-
692-
tty->owner = THIS_MODULE;
693688

694689
tty->init_termios = tty_std_termios;
695690
tty->init_termios.c_cflag = B9600 | CS8 | CREAD | HUPCL | CLOCAL;

‎drivers/misc/pti.c‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -907,20 +907,17 @@ static int __init pti_init(void)
907907

908908
/* First register module as tty device */
909909

910-
pti_tty_driver = alloc_tty_driver(1);
910+
pti_tty_driver = alloc_tty_driver(PTITTY_MINOR_NUM);
911911
if (pti_tty_driver == NULL) {
912912
pr_err("%s(%d): Memory allocation failed for ptiTTY driver\n",
913913
__func__, __LINE__);
914914
return -ENOMEM;
915915
}
916916

917-
pti_tty_driver->owner = THIS_MODULE;
918-
pti_tty_driver->magic = TTY_DRIVER_MAGIC;
919917
pti_tty_driver->driver_name = DRIVERNAME;
920918
pti_tty_driver->name = TTYNAME;
921919
pti_tty_driver->major = 0;
922920
pti_tty_driver->minor_start = PTITTY_MINOR_START;
923-
pti_tty_driver->num = PTITTY_MINOR_NUM;
924921
pti_tty_driver->type = TTY_DRIVER_TYPE_SYSTEM;
925922
pti_tty_driver->subtype = SYSTEM_TYPE_SYSCONS;
926923
pti_tty_driver->flags = TTY_DRIVER_REAL_RAW |

‎drivers/mmc/card/sdio_uart.c‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1175,7 +1175,6 @@ static int __init sdio_uart_init(void)
11751175
if (!tty_drv)
11761176
return -ENOMEM;
11771177

1178-
tty_drv->owner = THIS_MODULE;
11791178
tty_drv->driver_name = "sdio_uart";
11801179
tty_drv->name = "ttySDIO";
11811180
tty_drv->major = 0; /* dynamically allocated */

‎drivers/net/usb/hso.c‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3313,7 +3313,6 @@ static int __init hso_init(void)
33133313

33143314
/* fill in all needed values */
33153315
tty_drv->magic = TTY_DRIVER_MAGIC;
3316-
tty_drv->owner = THIS_MODULE;
33173316
tty_drv->driver_name = driver_name;
33183317
tty_drv->name = tty_filename;
33193318

@@ -3322,7 +3321,6 @@ static int __init hso_init(void)
33223321
tty_drv->major = tty_major;
33233322

33243323
tty_drv->minor_start = 0;
3325-
tty_drv->num = HSO_SERIAL_TTY_MINORS;
33263324
tty_drv->type = TTY_DRIVER_TYPE_SERIAL;
33273325
tty_drv->subtype = SERIAL_TYPE_NORMAL;
33283326
tty_drv->flags = TTY_DRIVER_REAL_RAW | TTY_DRIVER_DYNAMIC_DEV;

0 commit comments

Comments
 (0)