aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging/dgap (follow)
AgeCommit message (Collapse)AuthorFilesLines
2015-10-24staging: dgap: add spaces around binary operator '|'Ioana Ciornei1-29/+29
This patch adds spaces around binary operator '|'. Done with coccinelle semantic patch: @@ identifier x, y, z; @@ ( - x|y|z + x | y | z | - x|y + x | y ) Signed-off-by: Ioana Ciornei <ciorneiioana@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-24staging: dgap: remove unnecessary bracketsIoana Ciornei1-95/+95
This patch removes unnecessary brackets when dealing with unary operators like '&'. Done with coccinelle semantic patch: @@ expression e; @@ ( - &(e) + &e ) Signed-off-by: Ioana Ciornei <ciorneiioana@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-24staging: dgap: remove unnecessary space after castIoana Ciornei1-44/+44
This patch removes unnecessary spaces after the cast. Patch done with coccinelle semantic patch: @rule0@ type t; identifier e; constant c; expression expr; @@ ( - (t) e + (t)e | - (t) c + (t)c | - (t) expr + (t)expr ) Signed-off-by: Ioana Ciornei <ciorneiioana@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-24staging: dgap: properly indent to match open paranthesisIoana Ciornei1-28/+27
Indent parameters and arguments passed to function calls to match open paranthesis Signed-off-by: Ioana Ciornei <ciorneiioana@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-24staging: dgap: remove unnecessary blank linesIoana Ciornei1-44/+0
This patch removes the unnecessary blank lines before a closed bracket and after an open bracket. Signed-off-by: Ioana Ciornei <ciorneiioana@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-16Staging: dgap: Remove unnecessary test expressionShivani Bhardwaj1-1/+1
struct bd is already NULL tested so, any further NULL checks should be removed. Signed-off-by: Shivani Bhardwaj <shivanib134@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-12staging: dgap: remove unused configurationSudip Mukherjee2-25/+0
The IO configuration was not used to configure the board. It was only read from the configuration file. Stop reading it and also remove the other related variables defined for it. Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-09-30staging: dgap: fix memory leak in dgap_parsefile()Ronit Halder1-1/+11
In dgap_parsefile() char pointers are set with kstrdup() without checking that some string is allocated to that char pointer before. This patch frees the memory if already allocated and then set the poniter with kstrdup(). Signed-off-by: Ronit halder <ronit.crj@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-09-29staging: dgap: fix returned errno code in dgap_parsefile()Javier Martinez Canillas1-16/+16
The driver is using -1 instead of the -ENOMEM defined macro to specify that a buffer allocation failed. Since the error number is propagated, the caller will get a -EPERM which is the wrong error condition. Also, the smatch tool complains with the following warning: dgap_parsefile() warn: returning -1 instead of -ENOMEM is sloppy Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-09-12staging/dgap: Use strpbrk() instead of dgap_sindex()Alexander Kuleshov1-23/+1
The <linux/string.h> provides strpbrk() function that does the same that the dgap_sindex(). Let's use already defined function instead of writing custom. Signed-off-by: Alexander Kuleshov <kuleshovmail@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-09-12staging: dgap: remove unused variableSudip Mukherjee1-5/+1
These variables were assigned some values but they were never used. Removed them but kept one call to ioread8() as it might affect the hardware. Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-09-12staging: dgap: fix possible NULL dereferenceSudip Mukherjee1-0/+2
The return pointer from dgap_getword() is used in strcmp() where it is dereferenced. But dgap_getword() can return NULL. Lets put a check there and return 0 as error. Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-07-31Staging:dgap :Compression of lines for immediate returnShraddha Barke1-2/+1
This patch compresses two lines into a single line if immediate return statement is found. Remove variable rc as it is no longer needed. It is done using script Coccinelle. And coccinelle uses the following semantic patch for this compression function: @@ type T; identifier i,f; constant C; @@ - T i; ...when != i when strict ( return -C; | - i = + return f(...); - return i; ) Signed-off-by: Shraddha Barke <shraddha.6596@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-07-16staging: dgap: remove duplicate codeSudip Mukherjee1-14/+1
Remove the duplicate code of dgap_remove_one() and dgap_stop(). Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-07-16staging: dgap: new arguments to dgap_stopSudip Mukherjee1-2/+4
In a later patch we will remove the duplicate codes. But the code also needs to execute dgap_remove_driver_sysfiles() if it is being called from dgap_remove_one() but if being called fron the error path of the dgap_init_module() then the sysfiles should not be removed. Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-07-16staging: dgap: rearrange functionSudip Mukherjee1-15/+15
Relocate the function dgap_stop() so that in a later patch we can remove the duplicate codes between dgap_stop() and dgap_remove_one(). Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-07-16staging: dgap: fix error pathSudip Mukherjee1-5/+4
The code in dgap_stop() is almost a duplicate of the code that will be executed on pci_unregister_driver(). So the error code was stopping and unregistering everything twice. Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-05-31Staging: dgap: dgap: Fixed spelling errorsColin Cronin2-2/+2
Fixed comment spelling errors Signed-off-by: Colin Cronin <colinpatrickcronin@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-05-10staging: dgap: remove unused codeSudip Mukherjee1-17/+4
dgap_sindex() is being only called from dgap_getword() which searches for either ' ' or '\t' or '\n'. this part of the code with '^' at the beginning is never used. Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-05-10staging: dgap: use remove functionSudip Mukherjee1-25/+24
the remove callback will be called in two cases, 1) if the driver is removed and 2) if the pci device is removed. as of now all the board cleanups were being done in the module unload section so if the module is unloaded everything works. But if the pci device is removed then the loaded driver will be left in an inconsistent state. So moved the cleanups in the remove callback and since there was no reference of dgap_driver in remove_one(), so had to define the pci_driver in the function. Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-05-10staging: dgap: move function before removeSudip Mukherjee1-31/+30
move the cleanup function before the remove call as the next patch of the series is going to use that. Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-03-16Staging: dgap: Use setup_timer to combine initializationSomya Anand1-2/+1
The function setup_timer combines the initialization of a timer with the initialization of the timer's function and data fields. So, this patch combines the multiline code for timer initialization using the function setup_timer. This issue is identified via coccinelle script. @@ expression E1, E2, E3; type T; @@ - init_timer(&E1); ... ( - E1.function = E2; ... - E1.data = (T)E3; + setup_timer(&E1, E2, (T)E3); | - E1.data = (T)E3; ... - E1.function = E2; + setup_timer(&E1, E2, (T)E3); | - E1.function = E2; + setup_timer(&E1, E2, 0); ) Signed-off-by: Somya Anand <somyaanand214@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-03-09Staging: dgap: Remove unused variableHaneen Mohammed1-3/+1
This patch removes variable that was used to store only the return value of a function call. The issue was detected and resolved using the following coccinelle script: @@ expression ret; identifier f; @@ -ret = +return f(...); -return ret; Signed-off-by: Haneen Mohammed <hamohammed.sa@gmail.com> Reviewed-by: Daniel Baluta <daniel.baluta@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-03-06staging: dgap: Avoid name collisionFabio Estevam2-2/+2
Building for ARM64 leads to the following build warning: In file included from drivers/staging/dgap/dgap.c:66:0: drivers/staging/dgap/dgap.h:124:0: warning: "PCI_IO_SIZE" redefined #define PCI_IO_SIZE 0x00200000 ^ In file included from ./arch/arm64/include/asm/page.h:66:0, from include/linux/mm_types.h:15, from include/linux/sched.h:27, from ./arch/arm64/include/asm/compat.h:25, from ./arch/arm64/include/asm/stat.h:23, from include/linux/stat.h:5, from include/linux/module.h:10, from drivers/staging/dgap/dgap.c:47: ./arch/arm64/include/asm/memory.h:39:0: note: this is the location of the previous definition #define PCI_IO_SIZE SZ_16M ^ Use PCI_IO_SIZE_DGAP to avoid the name collision. Reported-by: Olof's autobuilder <build@lixom.net> Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-03-01staging: dgap: remove unused variableAya Mahfouz1-4/+1
This patch removes a variable that was simply used to store the return value of a function call before returning it. The issue was detected and resolved using the following coccinelle script: @@ identifier len,f; @@ -int len; ... when != len when strict -len = +return f(...); -return len; Signed-off-by: Aya Mahfouz <mahfouz.saif.elyazal@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-01-25staging: dgap: fix "if" statement that always evaluates to trueDaeseok Youn1-4/+4
cppcheck warning: (warnning) Logical disjunction always evaluates to true Reported-by: David Binderman <dcb314@hotmail.com> Signed-off-by: Daeseok Youn <daeseok.youn@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-01-17staging: dgap: use gotos for handling error in dgap_remap()Daeseok Youn1-15/+15
Signed-off-by: Daeseok Youn <daeseok.youn@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-26Drivers:staging:dgap: Added a blank line after declarationAnjana Sasindran1-0/+1
This patch fixes the checkpatch.pl warning: WARNING:Missing a blank line after declaration Signed-off-by: Anjana Sasindran <anjanasasindran123@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-07staging: dgap: introducing find_board_by_major()Daeseok Youn1-11/+17
use find_board_by_major function instead of getting a brd from static arrary. Becasue tty's major number doesn't start zero and we can find a brd from dgap_board[]. Signed-off-by: Daeseok Youn <daeseok.youn@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-07staging: dgap: remove useless variables for saving tty's majorDaeseok Youn2-10/+2
The board_t has a tty_struct(serial_driver and print_driver) that has a major number. When major number is compared in dgap_tty_open(), just use brd->serial_driver{print_driver}->major. Signed-off-by: Daeseok Youn <daeseok.youn@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-07staging: dgap: fix memory leak caused by double allocation of tty_structsDaeseok Youn1-16/+0
The tty_struct of serial_driver and print_driver were getting allocated twice. One is allocated in tty_alloc_driver(), the other is in dgap_tty_register(). So remove these in dgap_tty_register(). Signed-off-by: Daeseok Youn <daeseok.youn@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-07staging: dgap: set tty's flags by tty_alloc_driver()Daeseok Youn1-8/+8
tty's flags can be set by calling tty_alloc_driver(). Signed-off-by: Daeseok Youn <daeseok.youn@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-05staging: dgap: remove unnecessary functionDaeseok Youn1-23/+0
The dgap_init_global() initialize the dgap_board that is a global variable as static and dgap_poll_timer. But init_timer() is called twice in dgap_start() and dgap_board doesn't need to be initialized to NULL. Signed-off-by: Daeseok Youn <daeseok.youn@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-03staging: dgap: re-arrange functions for removing forward declarationsDaeseok Youn1-3794/+3669
Re-arrange the functions for removing forward declarations. Signed-off-by: Daeseok Youn <daeseok.youn@gmail.com> Tested-by: Mark Hounschell <markh@compro.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-10-30staging: dgap: Remove useless cast on NULLTapasweni Pathak1-2/+2
Cast on NULL to a pointer type is not required. This patch removes NULL casted to some pointer type. The sematic patch used is: @r@ type T; @@ - (T *)NULL + NULL Build tested it. Signed-off-by: Tapasweni Pathak <tapaswenipathak@gmail.com> Reviewed-by: Josh Triplett <josh@joshtriplett.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-10-30staging: dgap: Remove useless cast on void pointerTapasweni Pathak1-1/+1
void pointers do not need to be cast to other pointer types. The semantic patch used to find this: @r@ expression x; void* e; type T; identifier f; @@ ( *((T *)e) | ((T *)x)[...] | ((T *)x)->f | - (T *) e ) Build tested it. Signed-off-by: Tapasweni Pathak <tapaswenipathak@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-10-28staging: dgap: Use unsigned for loop indexTapasweni Pathak1-18/+18
The following semantic patch is used to do this @r exists@ // find anything that might decrement the variable identifier i; expression E; position p; @@ int i@p; ... ( &i | i-- | --i | i-=E | i+=E ) @x disable decl_init@ identifier r.i; expression E; position p1 != r.p; @@ ( volatile int i = 0; | volatile int i; | + unsigned int i@p1 = 0; | + unsigned int i@p1; ) <... when != i = E ( i = 0 | i = 1 ) ...> Signed-off-by: Tapasweni Pathak <tapaswenipathak@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-10-20staging: dgap: introduce dgap_stop()Daeseok Youn1-5/+22
The dgap_init_module() need to unwind for cleanup variables properly. Because dgap_init_module() calls dgap_cleanup_module() for freeing variables but this function is possible to free variables which are not allocated. Signed-off-by: Daeseok Youn <daeseok.youn@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-10-20staging: dgap: change function names properlyDaeseok Youn1-7/+7
dgap_do_remap() and dgap_release_remap() names could be changed to dgap_remap() and dgap_unmap(). Signed-off-by: Daeseok Youn <daeseok.youn@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-10-20staging: dgap: remove unnecessary if statement for checking NULLDaeseok Youn1-9/+4
dgap_release_remap() function is only called after the memory has been remapped so if statement for checking NULL doesn't need. And also release_mem_region() calls are moved after iounmap() calls. Signed-off-by: Daeseok Youn <daeseok.youn@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-10-20staging: dgap: remove unused variable 'orig_count'Rahul Bedarkar1-8/+0
This patch fixes sparse warning warning: variable ‘orig_count’ set but not used [-Wunused-but-set-variable] Signed-off-by: Rahul Bedarkar <rahulbedarkar89@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-09-23staging: dgap: use dgap_release_remap() in dgap_cleanup_board()Daeseok Youn1-15/+10
Just simply use dgap_release_remap() in dgap_cleanup_board() for releasing map memory. Signed-off-by: Daeseok Youn <daeseok.youn@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-09-23staging: dgap: adds missing iounmap for re_map_port in dgap_release_remap()Daeseok Youn1-0/+1
Signed-off-by: Daeseok Youn <daeseok.youn@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-09-23staging: dgap: remove unused 'runwait' variableDaeseok Youn2-2/+0
Signed-off-by: Daeseok Youn <daeseok.youn@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-09-19staging: dgap: use schedule_timeout_interruptible() instead of dgap_ms_sleep()Daeseok Youn2-33/+7
Using schedule_timeout_interruptible() is exactly same as setting a status of current process and calling schedule_timeout(). Removes dgap_ms_sleep(), because this function is used only when closing tty channel on dgap_tty_close(). And also removes ch_close_delay that is always set to 250 on dgap_tty_init(). Signed-off-by: Daeseok Youn <daeseok.youn@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-09-06drivers: staging: dgap: fix the checkpatch.pl issue "Warning: line over 80 characters"Piotr Witoslawski1-6/+10
Break lines exceeding 80 characters Signed-off-by: Piotr Witoslawski <pwitos@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-08-30staging: dgap: remove useless a variable within board_tDaeseok Youn2-4/+1
The use_interrupts is used only in dagp_request_irq() for checking a value from user config file. It doesn't need in board_t struct. Signed-off-by: Daeseok Youn <daeseok.youn@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-08-30staging: dgap: remove redundant setting a variableDaeseok Youn1-6/+1
The brd(board_t) is initialized with zero, so "intr_used" is not needed to set zero when request_irq() is failed. Signed-off-by: Daeseok Youn <daeseok.youn@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-08-16staging: dgap: cleanup print messages for dgap driverDaeseok Youn1-159/+126
* use dev_{warn,err} instead of pr_{warn,err} * removes dgap_err() and just use pr_err(). pr_err() used in dgap_parsefile() not dev_err() because if dgap_parsefile() is failed, just one message is printed. * removes "out of memory" messages. Signed-off-by: Daeseok Youn <daeseok.youn@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-08-16staging: dgap: Simplify to set a module typeDaeseok Youn2-20/+7
It is same manner with setting a board type. After allocating a type of "MNODE", get a token value set to "module.type". Signed-off-by: Daeseok Youn <daeseok.youn@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>