diff options
Diffstat (limited to 'drivers/tty/n_gsm.c')
-rw-r--r-- | drivers/tty/n_gsm.c | 34 |
1 files changed, 19 insertions, 15 deletions
diff --git a/drivers/tty/n_gsm.c b/drivers/tty/n_gsm.c index 5fea02cfb0cc..e907b7a5cab5 100644 --- a/drivers/tty/n_gsm.c +++ b/drivers/tty/n_gsm.c @@ -512,7 +512,7 @@ static void gsm_print_packet(const char *hdr, int addr, int cr, */ /** - * gsm_stuff_packet - bytestuff a packet + * gsm_stuff_frame - bytestuff a packet * @input: input buffer * @output: output buffer * @len: length of input @@ -1594,7 +1594,7 @@ static void gsm_dlci_data(struct gsm_dlci *dlci, const u8 *data, int clen) } /** - * gsm_dlci_control - data arrived on control channel + * gsm_dlci_command - data arrived on control channel * @dlci: channel * @data: block of bytes received * @len: length of received block @@ -2424,7 +2424,7 @@ static void gsmld_detach_gsm(struct tty_struct *tty, struct gsm_mux *gsm) } static void gsmld_receive_buf(struct tty_struct *tty, const unsigned char *cp, - char *fp, int count) + const char *fp, int count) { struct gsm_mux *gsm = tty->disc_data; char flags = TTY_NORMAL; @@ -2557,6 +2557,8 @@ static void gsmld_write_wakeup(struct tty_struct *tty) * @file: file object * @buf: userspace buffer pointer * @nr: size of I/O + * @cookie: unused + * @offset: unused * * Perform reads for the line discipline. We are guaranteed that the * line discipline will not be closed under us but we may get multiple @@ -2857,6 +2859,7 @@ static int gsm_create_network(struct gsm_dlci *dlci, struct gsm_netconfig *nc) /* Line discipline for real tty */ static struct tty_ldisc_ops tty_ldisc_packet = { .owner = THIS_MODULE, + .num = N_GSM0710, .name = "n_gsm", .open = gsmld_open, .close = gsmld_close, @@ -3055,7 +3058,7 @@ static int gsmtty_write(struct tty_struct *tty, const unsigned char *buf, return sent; } -static int gsmtty_write_room(struct tty_struct *tty) +static unsigned int gsmtty_write_room(struct tty_struct *tty) { struct gsm_dlci *dlci = tty->driver_data; if (dlci->state == DLCI_CLOSED) @@ -3063,7 +3066,7 @@ static int gsmtty_write_room(struct tty_struct *tty) return TX_SIZE - kfifo_len(&dlci->fifo); } -static int gsmtty_chars_in_buffer(struct tty_struct *tty) +static unsigned int gsmtty_chars_in_buffer(struct tty_struct *tty) { struct gsm_dlci *dlci = tty->driver_data; if (dlci->state == DLCI_CLOSED) @@ -3242,7 +3245,7 @@ static const struct tty_operations gsmtty_ops = { static int __init gsm_init(void) { /* Fill in our line protocol discipline, and register it */ - int status = tty_register_ldisc(N_GSM0710, &tty_ldisc_packet); + int status = tty_register_ldisc(&tty_ldisc_packet); if (status != 0) { pr_err("n_gsm: can't register line discipline (err = %d)\n", status); @@ -3251,9 +3254,9 @@ static int __init gsm_init(void) gsm_tty_driver = alloc_tty_driver(256); if (!gsm_tty_driver) { - tty_unregister_ldisc(N_GSM0710); pr_err("gsm_init: tty allocation failed.\n"); - return -EINVAL; + status = -ENOMEM; + goto err_unreg_ldisc; } gsm_tty_driver->driver_name = "gsmtty"; gsm_tty_driver->name = "gsmtty"; @@ -3269,22 +3272,23 @@ static int __init gsm_init(void) tty_set_operations(gsm_tty_driver, &gsmtty_ops); if (tty_register_driver(gsm_tty_driver)) { - put_tty_driver(gsm_tty_driver); - tty_unregister_ldisc(N_GSM0710); pr_err("gsm_init: tty registration failed.\n"); - return -EBUSY; + status = -EBUSY; + goto err_put_driver; } pr_debug("gsm_init: loaded as %d,%d.\n", gsm_tty_driver->major, gsm_tty_driver->minor_start); return 0; +err_put_driver: + put_tty_driver(gsm_tty_driver); +err_unreg_ldisc: + tty_unregister_ldisc(&tty_ldisc_packet); + return status; } static void __exit gsm_exit(void) { - int status = tty_unregister_ldisc(N_GSM0710); - if (status != 0) - pr_err("n_gsm: can't unregister line discipline (err = %d)\n", - status); + tty_unregister_ldisc(&tty_ldisc_packet); tty_unregister_driver(gsm_tty_driver); put_tty_driver(gsm_tty_driver); } |