aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging/dgnc/dgnc_driver.c (follow)
AgeCommit message (Collapse)AuthorFilesLines
2018-01-17staging: dgnc: remove "vpd" board variableGreg Kroah-Hartman1-3/+0
It was only ever read from the device, and spit out to the kernel log for no good reason. So remove it, and the way it was read from the device, and the now unused "board file" callback. Cc: Lidza Louina <lidza.louina@gmail.com> Cc: Mark Hounschell <markh@compro.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-01-17staging: dgnc: delete a bunch of PCI board variablesGreg Kroah-Hartman1-8/+0
None of these were being used at all, only set and never used again, so remove them from the code. Cc: Lidza Louina <lidza.louina@gmail.com> Cc: Mark Hounschell <markh@compro.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-01-17staging: dgnc: delete is_pci_express board type variable.Greg Kroah-Hartman1-3/+0
It was only set, and never looked at, so drop the thing as no one cares about it. And when it was set, it was not even set correctly, the index it was using to read from was incorrect, so this has never even been correct... Cc: Lidza Louina <lidza.louina@gmail.com> Cc: Mark Hounschell <markh@compro.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-01-17staging: dgnc: delete dpastatus board type variable.Greg Kroah-Hartman1-3/+0
It was only set, and never looked at, so drop the thing as no one cares about it. Cc: Lidza Louina <lidza.louina@gmail.com> Cc: Mark Hounschell <markh@compro.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-01-17staging: dgnc: delete dpatype board type variable.Greg Kroah-Hartman1-3/+0
It was only set, and never looked at, so drop the thing as no one cares about it. Cc: Lidza Louina <lidza.louina@gmail.com> Cc: Mark Hounschell <markh@compro.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-01-17staging: dgnc: delete dgnc_pci.hGreg Kroah-Hartman1-1/+11
Move the few #defines we actually use into the dgnc_driver.c file, no need to have a .h file for a driver that is only used by a single .c file. Cc: Lidza Louina <lidza.louina@gmail.com> Cc: Mark Hounschell <markh@compro.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-01-17staging: dgnc: delete dgnc_neo.* filesGreg Kroah-Hartman1-1/+0
As the Neo devices were never actually supported by the driver, delete the files that purported to control that type of device as they are not needed. This will let us shrink the driver a lot over time. Cc: Lidza Louina <lidza.louina@gmail.com> Cc: Mark Hounschell <markh@compro.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-01-17staging: dgnc: remove PCI_DEVICE_NEO stuffGreg Kroah-Hartman1-62/+0
The "Neo" devices are never allowed to be bound to this driver, as they are not in the valid list of PCI ids, so delete them from the driver as the code in the probe function has no way to ever run. Also delete the defines that are no longer used in relation to the Neo devices, as they are not needed anymore. Cc: Lidza Louina <lidza.louina@gmail.com> Cc: Mark Hounschell <markh@compro.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-01-15staging: dgnc: make dgnc_poll_tick staticGreg Kroah-Hartman1-1/+1
No one needs to see this global variable, so make it static. Cc: Lidza Louina <lidza.louina@gmail.com> Cc: Mark Hounschell <markh@compro.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-01-15staging: dgnc: remove some global variablesGreg Kroah-Hartman1-1/+0
There were some global variables not being used at all, so just delete them. Cc: Lidza Louina <lidza.louina@gmail.com> Cc: Mark Hounschell <markh@compro.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-01-15staging: dgnc: make dgnc_poll_lock staticGreg Kroah-Hartman1-1/+1
There's no need for this spinlock to be global, so make it a static variable. Cc: Lidza Louina <lidza.louina@gmail.com> Cc: Mark Hounschell <markh@compro.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-01-15staging: dgnc: make dgnc_num_boards staticGreg Kroah-Hartman1-1/+1
There's no need for the world to know the number of dgnc boards in the system, so just make it a static variable. Cc: Lidza Louina <lidza.louina@gmail.com> Cc: Mark Hounschell <markh@compro.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-01-15staging: dgnc: remove crazy "management" device nodeGreg Kroah-Hartman1-47/+0
There's no need for a special character device just to get some random information out of a single serial port driver. So remove the dgnc_mgmt.c file, and some structures and ioctl definitions that only it was using. Cc: Lidza Louina <lidza.louina@gmail.com> Cc: Mark Hounschell <markh@compro.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-01-15staging: dgnc: remove redundant license textGreg Kroah-Hartman1-10/+0
Now that the SPDX tag is in all drivers/staging/dgnc files, that identifies the license in a specific and legally-defined manner. So the extra GPL text wording can be removed as it is no longer needed at all. This is done on a quest to remove the 700+ different ways that files in the kernel describe the GPL license text. And there's unneeded stuff like the address (sometimes incorrect) for the FSF which is never needed. No copyright headers or other non-license-description text was removed. Cc: Lidza Louina <lidza.louina@gmail.com> Cc: Mark Hounschell <markh@compro.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-01-15staging: dgnc: add SPDX identifier.Greg Kroah-Hartman1-0/+1
It's good to have SPDX identifiers in all files to make it easier to audit the kernel tree for correct licenses. Fix up the staging dgnc driver to have a proper SPDX identifier, based on the license text in the file itself. The SPDX identifier is a legally binding shorthand, which can be used instead of the full boiler plate text. This work is based on a script and data from Thomas Gleixner, Philippe Ombredanne, and Kate Stewart. Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Kate Stewart <kstewart@linuxfoundation.org> Cc: Philippe Ombredanne <pombredanne@nexb.com> Cc: Lidza Louina <lidza.louina@gmail.com> Cc: Mark Hounschell <markh@compro.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-10-18staging: dgnc: Convert timers to use timer_setup()Kees Cook1-5/+3
In preparation for unconditionally passing the struct timer_list pointer to all timer callbacks, switch to using the new timer_setup() and from_timer() to pass the timer pointer explicitly. Cc: Lidza Louina <lidza.louina@gmail.com> Cc: Mark Hounschell <markh@compro.net> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: driverdev-devel@linuxdriverproject.org Cc: devel@driverdev.osuosl.org Signed-off-by: Kees Cook <keescook@chromium.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-05-25dgnc: fix multiple blank lines coding style problemAliza Minkov1-2/+0
According to the coding-style documentation, functions in source files should be separated with one blank line. Redundant blank lines were removed from this source file, in accordance with coding-style documentation. Signed-off-by: Aliza Minkov <minkov.al@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-29staging: dgnc: remove struct member magic numbersTobin C. Harding1-2/+1
Driver uses magic number members within structs, this is an antiquated method of catching data errors. We don't do things that way any more. Remove magic number struct members. Remove all checks to magic numbers. Signed-off-by: Tobin C. Harding <me@tobin.cc> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-29staging: dgnc: remove unnecessary commentsTobin C. Harding1-77/+8
TODO file lists task to remove unnecessary comments. Make initial attempt at removing unnecessary comments. Choose not to be to vicious in removal. We can remove more once the driver is cleaned up/tested some more. For functions with internal linkage, reduce the function comment where possible. For functions with external linkage, migrate the function comment to kernel doc format. Signed-off-by: Tobin C. Harding <me@tobin.cc> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-14staging: dgnc: fix whitespace before returnTobin C. Harding1-1/+5
Checkpatch emits CHECK: Blank lines aren't necessary before a close brace '}'. Previous attempts were made to make uniform the error handling in dgnc but improvements are still possible. Undo whitespace changes that should not have been made :(. Make return statement placement uniform throughout dgnc. Fix checkpatch CHECK. Make whitespace changes only. Signed-off-by: Tobin C. Harding <me@tobin.cc> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-12staging: dgnc: audit goto's in dgnc_driverTobin C. Harding1-18/+5
TODO file requests fix up of error handling. Audit dgnc_driver.c and fix all return paths to be uniform and inline with kernel coding style. Signed-off-by: Tobin C. Harding <me@tobin.cc> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-12-01staging: dgnc: remove sysfs filesGreg Kroah-Hartman1-11/+3
The dgnc driver has no business creating "custom" sysfs files just for a single tty driver. Combined with the odd way they are created, it's just a mess, so remove them entirely as I am tired of tripping over them when doing driver core changes. Cc: Lidza Louina <lidza.louina@gmail.com> Cc: Mark Hounschell <markh@compro.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-11-19staging: dgnc: dgnc_driver.c Blank line before }Walt Feasel1-1/+0
Make suggested checkpatch modification for CHECK: Blank lines aren't necessary before a close brace '}' Signed-off-by: Walt Feasel <waltfeasel@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-11-19staging: dgnc: dgnc_driver.c Remove blank linesWalt Feasel1-4/+0
Make suggested checkpatch modification for CHECK: Please don't use multiple blank lines Signed-off-by: Walt Feasel <waltfeasel@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-11-19staging: dgnc: dgnc_driver.c Comment style modificationsWalt Feasel1-37/+20
Make modifications to comment styles Signed-off-by: Walt Feasel <waltfeasel@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-11-14staging: dgnc: re-arrange functions for removing forward declarationsDaeseok Youn1-272/+261
Re-arrange the functions for removing forward declarations in dgnc_driver.c Signed-off-by: Daeseok Youn <daeseok.youn@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-10-25staging: dgnc: Remove some redundant functionsPankaj Bharadiya1-13/+0
dgnc_tty_preinit() and dgnc_tty_post_uninit() functions are used to allocate and free "dgnc_TmpWriteBuf" and this "dgnc_TmpWriteBuf" is not really getting used. Hence remove these redundant functions. Also remove dgnc_TmpWriteBuf variable as it is not used anymore. Signed-off-by: Pankaj Bharadiya <pankaj.bharadiya@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-10-17staging: dgnc: Add const qualifier to struct declaration.Elise Lennion1-1/+1
Const qualifier added to struct declaration to avoid data overwrite during runtime and improve security. Signed-off-by: Elise Lennion <elise.lennion@gmail.com> Acked-by: Julia Lawall <julia.lawall@lip6.fr> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-09-27staging: dgnc: rename dgnc_tty_uninit() to dgnc_cleanup_tty()Daeseok Youn1-1/+1
The dgnc_tty_uninit() doesn't match with dgnc_tty_init() at all. And also the dgnc_cleanup_tty() is only called for exiting the module. Signed-off-by: Daeseok Youn <daeseok.youn@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-09-27staging: dgnc: introduce the dgnc_free_irq()Daeseok Youn1-1/+10
The dgnc_free_irq() will free the requested IRQ from the dgnc_request_irq(). Signed-off-by: Daeseok Youn <daeseok.youn@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-09-27staging: dgnc: rename dgnc_finalize_board_init() to dgnc_request_irq()Daeseok Youn1-3/+3
The dgnc_finalize_board_init() function has only job for requesting the IRQ. It should be renamed to dgnc_request_irq() Signed-off-by: Daeseok Youn <daeseok.youn@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-09-27staging: dgnc: introduce the dgnc_tty_unregister()Daeseok Youn1-2/+5
The dgnc_tty_unregister() will be called when the dgnc_tty_register() is failed. Signed-off-by: Daeseok Youn <daeseok.youn@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-09-27staging: dgnc: move functions unrelated with dgnc_found_board()Daeseok Youn1-38/+43
The functions related with tty device initialization are needed to be moved from dgnc_found_board() to dgnc_init_one(). Signed-off-by: Daeseok Youn <daeseok.youn@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-09-27staging: dgnc: kfree for board structure in dgnc_found_board()Daeseok Youn1-8/+9
The board structure should be freed when any function was failed in dgnc_found_board(). And the board strucure will be stored into dgnc_board array when the dgnc_found_board() function has no error. Signed-off-by: Daeseok Youn <daeseok.youn@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-09-27staging: dgnc: missing NULL check for ioremap in dgnc_do_remap()Daeseok Youn1-10/+21
The ioremap() function can be failed, so it need to have error handling in dgnc_do_remap(). And also the return type of dgnc_do_remap() should be changed from "void" to "int" Signed-off-by: Daeseok Youn <daeseok.youn@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-09-27staging: dgnc: remove useless message bufferDaeseok Youn1-28/+0
There is a temporary message buffer for the boot message in dgnc_found_board() but the buffer was not used anywhere in dgnc driver. Signed-off-by: Daeseok Youn <daeseok.youn@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-09-27staging: dgnc: remove redundant initialization for channel arrayDaeseok Youn1-3/+0
The channel array in board_t was initialized in dgnc_found_board() with NULL. But the channel is going to initialize in dgnc_tty_init(). So the channel array doesn't need to set NULL for initailization. Signed-off-by: Daeseok Youn <daeseok.youn@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-09-12staging: dgnc: Fix multi line comment alignmentFernando Apesteguia1-25/+25
Fix alignment in multi line comment block. Remove extra '*' to use the preferred comment style as in Documentation/CodingStyle Signed-off-by: Fernando Apesteguia <fernando.apesteguia@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-08-15staging: dgnc: remove redundant null check inDaeseok Youn1-3/+0
the "brd" was already checked for NULL before calling dgnc_do_remap(). the dgnc_do_remap() function was called only from the dgnc_found_board() and the DGNC_BOARD_MAGIC value was assigned to "brd->magic" in dgcn_found_board(). So it doesn't need to check about magic value. Signed-off-by: Daeseok Youn <daeseok.youn@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-08-15staging: dgnc: remove redundant NULL check for brdDaeseok Youn1-3/+0
the "brd" value cannot be NULL in dgnc_finalize_board_init(). Because "brd" as a parameter of this function was already checked for NULL. the dgnc_finalize_board_init() as a static function was called only from dgnc_found_board() function and brd->magic value was assigned once in dgnc_found_board(). So it doesn't need to check for DGNC_BOARD_MAGIC value. Signed-off-by: Daeseok Youn <daeseok.youn@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-08-15staging: dgnc: add __exit macro to dgnc_driver.cJoshua Houghton1-1/+1
Add the __exit macro to the dgnc_cleanup_module(void) function in dgnc_driver.c Signed-off-by: Joshua Houghton <josh@awful.name> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-28staging: dgnc: fix CamelCase in dgnc_driver.cDaeseok Youn1-26/+26
fix checkpatch.pl warning about CamelCase. Signed-off-by: Daeseok Youn <daeseok.youn@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-11staging: dgnc: cleanup properlySudip Mukherjee1-8/+13
dgnc_cleanup_module() was called when the module unloaded to do a total cleanup and it was also called if pci_register_driver() fails. But dgnc_cleanup_module() will try dgnc_remove_driver_sysfiles() but the sysfiles will be created only if pci_register_driver() succeeds. So if pci_register_driver() fails and we try dgnc_cleanup_module() then we were getting: [ 942.001479] BUG: unable to handle kernel NULL pointer dereference at 00000018 [ 942.001482] IP: [<c122c7a8>] sysfs_remove_file_ns+0x8/0x20 with part of the call trace as: [ 942.001544] Call Trace: [ 942.001555] [<c149acc6>] driver_remove_file+0x16/0x20 [ 942.001571] [<f864a708>] dgnc_remove_driver_sysfiles+0x18/0x40 [dgnc] [ 942.001575] [<f8643ac7>] dgnc_cleanup_module+0x47/0x260 [dgnc] [ 942.001577] [<f86cb000>] ? 0xf86cb000 [ 942.001580] [<f86cb1e6>] dgnc_init_module+0x1e6/0x1000 [dgnc] Lets have a separate cleanup function which will execute dgnc_remove_driver_sysfiles() depending on the argument passed to it. Reported-by: Navy Cheng <navych@126.com> Signed-off-by: Sudip Mukherjee <sudip.mukherjee@codethink.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-11staging: dgnc: unregister pci driverSudip Mukherjee1-2/+1
We may choose to load the module without the hardware present. That will register the pci driver but since probe will not succeed so dgnc_NumBoards will be 0. Now if we unload the module then the pci driver stays registered as dgnc_NumBoards is 0. And if we try to load the module again it fails with the error: "Driver 'dgnc' is already registered." Signed-off-by: Sudip Mukherjee <sudip.mukherjee@codethink.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-11staging: dgnc: remove pci_unregister_driverSudip Mukherjee1-14/+5
If pci_register_driver() fails then dgnc_NumBoards can never be more than zero. dgnc_NumBoards is incremented only at the end of a successful probe. And moreover if the pci driver has failed to register then we never need to unregister it. Lets just print the warning, perform the cleanup and exit with the error code. Signed-off-by: Sudip Mukherjee <sudip.mukherjee@codethink.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-11staging: dgnc: remove unneeded elseSudip Mukherjee1-7/+7
If pci_enable_device() fails then we can return directly. Signed-off-by: Sudip Mukherjee <sudip.mukherjee@codethink.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-16staging: dgnc: dgnc_driver: Remove useless initialisationAmitoj Kaur Chawla1-1/+1
Remove intialisation of a variable that is immediately reassigned. The semantic patch used to find this is: // <smpl> @@ type T; identifier x; constant C; expression e; @@ T x - = C ; x = e; // </smpl> Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-12staging: dgnc: alignment styleSudip Mukherjee1-1/+1
checkpatch was warning us that the alignment should match the open parenthesis. Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-12staging: dgnc: remove space after castSudip Mukherjee1-3/+3
Space is not necessary after typecast. Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-12staging: dgnc: remove blankline after braceSudip Mukherjee1-3/+0
Blank lines are not needed after opening braces. checkpatch was giving us warnings about this. Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>