From e5fd91f1ef340da553f7a79da9540c3db711c937 Mon Sep 17 00:00:00 2001 From: André Fabian Silva Delgado Date: Tue, 8 Sep 2015 01:01:14 -0300 Subject: Linux-libre 4.2-gnu --- drivers/staging/dgap/dgap.c | 133 ++++++++++++++++++++------------------------ drivers/staging/dgap/dgap.h | 2 +- 2 files changed, 60 insertions(+), 75 deletions(-) (limited to 'drivers/staging/dgap') diff --git a/drivers/staging/dgap/dgap.c b/drivers/staging/dgap/dgap.c index 3dc011655..bb5176983 100644 --- a/drivers/staging/dgap/dgap.c +++ b/drivers/staging/dgap/dgap.c @@ -290,8 +290,7 @@ static struct toklist dgap_tlist[] = { /* * dgap_sindex: much like index(), but it looks for a match of any character in - * the group, and returns that position. If the first character is a ^, then - * this will match the first occurrence not in that group. + * the group, and returns that position. */ static char *dgap_sindex(char *string, char *group) { @@ -300,23 +299,11 @@ static char *dgap_sindex(char *string, char *group) if (!string || !group) return NULL; - if (*group == '^') { - group++; - for (; *string; string++) { - for (ptr = group; *ptr; ptr++) { - if (*ptr == *string) - break; - } - if (*ptr == '\0') + for (; *string; string++) { + for (ptr = group; *ptr; ptr++) { + if (*ptr == *string) return string; } - } else { - for (; *string; string++) { - for (ptr = group; *ptr; ptr++) { - if (*ptr == *string) - return string; - } - } } return NULL; @@ -2658,7 +2645,7 @@ static void dgap_cmdw_ext(struct channel_t *ch, u16 cmd, u16 word, uint ncmds) * dgap_wmove - Write data to FEP buffer. * * ch - Pointer to channel structure. - * buf - Poiter to characters to be moved. + * buf - Pointer to characters to be moved. * cnt - Number of characters to move. * *=======================================================================*/ @@ -6987,9 +6974,62 @@ cleanup_brd: return rc; } +/* + * dgap_cleanup_board() + * + * Free all the memory associated with a board + */ +static void dgap_cleanup_board(struct board_t *brd) +{ + unsigned int i; + + if (!brd || brd->magic != DGAP_BOARD_MAGIC) + return; + + dgap_free_irq(brd); + + tasklet_kill(&brd->helper_tasklet); + + dgap_unmap(brd); + + /* Free all allocated channels structs */ + for (i = 0; i < MAXPORTS ; i++) + kfree(brd->channels[i]); + + kfree(brd->flipbuf); + kfree(brd->flipflagbuf); + + dgap_board[brd->boardnum] = NULL; + + kfree(brd); +} + static void dgap_remove_one(struct pci_dev *dev) { - /* Do Nothing */ + unsigned int i; + ulong lock_flags; + struct pci_driver *drv = to_pci_driver(dev->dev.driver); + + spin_lock_irqsave(&dgap_poll_lock, lock_flags); + dgap_poll_stop = 1; + spin_unlock_irqrestore(&dgap_poll_lock, lock_flags); + + /* Turn off poller right away. */ + del_timer_sync(&dgap_poll_timer); + + dgap_remove_driver_sysfiles(drv); + + device_destroy(dgap_class, MKDEV(DIGI_DGAP_MAJOR, 0)); + class_destroy(dgap_class); + unregister_chrdev(DIGI_DGAP_MAJOR, "dgap"); + + for (i = 0; i < dgap_numboards; ++i) { + dgap_remove_ports_sysfiles(dgap_board[i]); + dgap_cleanup_tty(dgap_board[i]); + dgap_cleanup_board(dgap_board[i]); + } + + dgap_cleanup_nodes(); } static struct pci_driver dgap_driver = { @@ -7071,37 +7111,6 @@ static void dgap_stop(void) unregister_chrdev(DIGI_DGAP_MAJOR, "dgap"); } -/* - * dgap_cleanup_board() - * - * Free all the memory associated with a board - */ -static void dgap_cleanup_board(struct board_t *brd) -{ - unsigned int i; - - if (!brd || brd->magic != DGAP_BOARD_MAGIC) - return; - - dgap_free_irq(brd); - - tasklet_kill(&brd->helper_tasklet); - - dgap_unmap(brd); - - /* Free all allocated channels structs */ - for (i = 0; i < MAXPORTS ; i++) - kfree(brd->channels[i]); - - kfree(brd->flipbuf); - kfree(brd->flipflagbuf); - - dgap_board[brd->boardnum] = NULL; - - kfree(brd); -} - - /************************************************************************ * * Driver load/unload functions @@ -7150,30 +7159,6 @@ err_stop: */ static void dgap_cleanup_module(void) { - unsigned int i; - ulong lock_flags; - - spin_lock_irqsave(&dgap_poll_lock, lock_flags); - dgap_poll_stop = 1; - spin_unlock_irqrestore(&dgap_poll_lock, lock_flags); - - /* Turn off poller right away. */ - del_timer_sync(&dgap_poll_timer); - - dgap_remove_driver_sysfiles(&dgap_driver); - - device_destroy(dgap_class, MKDEV(DIGI_DGAP_MAJOR, 0)); - class_destroy(dgap_class); - unregister_chrdev(DIGI_DGAP_MAJOR, "dgap"); - - for (i = 0; i < dgap_numboards; ++i) { - dgap_remove_ports_sysfiles(dgap_board[i]); - dgap_cleanup_tty(dgap_board[i]); - dgap_cleanup_board(dgap_board[i]); - } - - dgap_cleanup_nodes(); - if (dgap_numboards) pci_unregister_driver(&dgap_driver); } diff --git a/drivers/staging/dgap/dgap.h b/drivers/staging/dgap/dgap.h index a2e5b26c6..e707ed5fe 100644 --- a/drivers/staging/dgap/dgap.h +++ b/drivers/staging/dgap/dgap.h @@ -172,7 +172,7 @@ /* * Define a local default termios struct. All ports will be created * with this termios initially. This is the same structure that is defined - * as the default in tty_io.c with the same settings overriden as in serial.c + * as the default in tty_io.c with the same settings overridden as in serial.c * * In short, this should match the internal serial ports' defaults. */ -- cgit v1.2.3-54-g00ecf