Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 325660
b: refs/heads/master
c: 16a1065
h: refs/heads/master
v: v3
  • Loading branch information
Jiri Slaby authored and Greg Kroah-Hartman committed Aug 13, 2012
1 parent a87f295 commit 541783c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 13 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 737586fe51e6d0031f83d781c0cb2f3abf8caada
refs/heads/master: 16a1065f2113b2c068ea108a681fb6b1f3a02ce0
27 changes: 15 additions & 12 deletions trunk/drivers/char/pcmcia/synclink_cs.c
Original file line number Diff line number Diff line change
Expand Up @@ -2731,6 +2731,8 @@ static void mgslpc_add_device(MGSLPC_INFO *info)
#if SYNCLINK_GENERIC_HDLC
hdlcdev_init(info);
#endif
tty_port_register_device(&info->port, serial_driver, info->line,
&info->p_dev.dev);
}

static void mgslpc_remove_device(MGSLPC_INFO *remove_info)
Expand All @@ -2744,6 +2746,7 @@ static void mgslpc_remove_device(MGSLPC_INFO *remove_info)
last->next_device = info->next_device;
else
mgslpc_device_list = info->next_device;
tty_unregister_device(serial_driver, info->line);
#if SYNCLINK_GENERIC_HDLC
hdlcdev_exit(info);
#endif
Expand Down Expand Up @@ -2807,13 +2810,12 @@ static int __init synclink_cs_init(void)
BREAKPOINT();
}

if ((rc = pcmcia_register_driver(&mgslpc_driver)) < 0)
return rc;

serial_driver = alloc_tty_driver(MAX_DEVICE_COUNT);
serial_driver = tty_alloc_driver(MAX_DEVICE_COUNT,
TTY_DRIVER_REAL_RAW |
TTY_DRIVER_DYNAMIC_DEV);
if (!serial_driver) {
rc = -ENOMEM;
goto err_pcmcia_drv;
goto err;
}

/* Initialize the tty_driver structure */
Expand All @@ -2827,7 +2829,6 @@ static int __init synclink_cs_init(void)
serial_driver->init_termios = tty_std_termios;
serial_driver->init_termios.c_cflag =
B9600 | CS8 | CREAD | HUPCL | CLOCAL;
serial_driver->flags = TTY_DRIVER_REAL_RAW;
tty_set_operations(serial_driver, &mgslpc_ops);

if ((rc = tty_register_driver(serial_driver)) < 0) {
Expand All @@ -2836,26 +2837,28 @@ static int __init synclink_cs_init(void)
goto err_put_tty;
}

rc = pcmcia_register_driver(&mgslpc_driver);
if (rc < 0)
goto err_unreg_tty;

printk("%s %s, tty major#%d\n",
driver_name, driver_version,
serial_driver->major);

return 0;
err_unreg_tty:
tty_unregister_driver(serial_driver);
err_put_tty:
put_tty_driver(serial_driver);
err_pcmcia_drv:
pcmcia_unregister_driver(&mgslpc_driver);
err:
return rc;
}

static void __exit synclink_cs_exit(void)
{
while (mgslpc_device_list)
mgslpc_remove_device(mgslpc_device_list);

pcmcia_unregister_driver(&mgslpc_driver);
tty_unregister_driver(serial_driver);
put_tty_driver(serial_driver);
pcmcia_unregister_driver(&mgslpc_driver);
}

module_init(synclink_cs_init);
Expand Down

0 comments on commit 541783c

Please sign in to comment.