summaryrefslogtreecommitdiffstats
path: root/drivers/staging/dgnc/dgnc_tty.c
Commit message (Collapse)AuthorAgeFilesLines
* staging: dgnc: dgnc_tty: Remove useless initialisationAmitoj Kaur Chawla2015-10-171-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>
* staging: dgnc: simplify a trivial if-return sequenceParshuram Thombare2015-10-131-4/+1Star
| | | | | Signed-off-by: Parshuram Thombare <thombarepr@yahoo.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: dgnc: remove parenthesisSudip Mukherjee2015-10-131-7/+7
| | | | | | | checkpatch was warning us about extra unneeded parenthesis. Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: dgnc: alignment styleSudip Mukherjee2015-10-131-13/+13
| | | | | | | | 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>
* staging: dgnc: remove space after castSudip Mukherjee2015-10-131-12/+12
| | | | | | | Space is not necessary after typecast. Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: dgnc: remove blankline after braceSudip Mukherjee2015-10-131-11/+0Star
| | | | | | | | 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>
* staging: dgnc: remove blankline before braceSudip Mukherjee2015-10-131-4/+0Star
| | | | | | | | Blank lines are not needed before closing braces. checkpatch was giving warning about this. Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: dgnc: remove multiple blank linesSudip Mukherjee2015-10-131-51/+0Star
| | | | | | | | checkpatch warns us about multiple blank lines which are not needed. Remove them. Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: dgnc: change style of NULL comparisonSudip Mukherjee2015-10-041-3/+3
| | | | | | | Change the NULL comparison style as warned by checkpatch. Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: dgnc: remove unused variablesSudip Mukherjee2015-10-041-9/+2Star
| | | | | | | These variables were only assigned some values but were never used. Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: dgnc: Fix line over 80 characters warningCristina Moraru2015-10-041-58/+128
| | | | | | | Fix 'line over 80 characters' checkpatch warning Signed-off-by: Cristina Moraru <cristina.moraru09@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: dgnc: free memory allocatedHari Prasath Gujulan Elango2015-06-191-0/+4
| | | | | | | | | The memory allocated in dgnc_tty_register() for two objects is not freed anywhere.This patch addresses this by freeing the memory in dgnc_tty_uninit. Signed-off-by: Hari Prasath Gujulan Elango <hgujulan@visteon.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: dgnc: remove redundant checkGiedrius Statkevičius2015-05-081-6/+0Star
| | | | | | | | count doesn't get changed in between identical checks in dgnc_tty_write() so remove the second check Signed-off-by: Giedrius Statkevičius <giedrius.statkevicius@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: dgnc: remove dead code in dgnc_tty_write()Giedrius Statkevičius2015-05-081-44/+1Star
| | | | | | | | | Remove the dead code protected by in_user in dgnc_tty_write() because it is set to 0 and never changed to 1 thus the code in ifs never gets executed. Signed-off-by: Giedrius Statkevičius <giedrius.statkevicius@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: dgnc: don't forget to check if ->channels[i] is NULL in ↵Giedrius Statkevičius2015-05-081-2/+6
| | | | | | | | | | | dgnc_tty_uninit() Add a check if ->channels[i] is NULL because a NULL pointer may be dereferenced in case one of the allocations failed Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Giedrius Statkevičius <giedrius.statkevicius@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: dgnc: clean up allocation of ->channels[i]Giedrius Statkevičius2015-05-081-16/+15Star
| | | | | | | | | | | | | Check if kzalloc fails in dgnc_tty_init() and if it does then free all previously allocated ->channels[i] and set them to NULL. This makes the code less error/bug prone because instead of needing programmers attention to add checks everywhere we do that in one place. Also, remove a bogus comment and check in the same loop because ->channels[i] isn't allocated anywhere else. Finally, remove a unnecessary check if ->channels[i] is NULL in the next loop because it can't be. Signed-off-by: Giedrius Statkevičius <giedrius.statkevicius@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: dgnc: remove some dead code from dgnc_tty.cGiedrius Statkevičius2015-05-081-16/+0Star
| | | | | | | Remove some dead code that will never be executed or which serves no purpose Signed-off-by: Giedrius Statkevičius <giedrius.statkevicius@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* dgnc: use linux/types.h instead of dgnc_types.hGiedrius Statkevičius2015-03-241-5/+5
| | | | | | | | | | Dgnc_types.h unnecesarily defines TRUE as 1 and FALSE as 0 because we already have a widely used linux/types.h so convert all TRUE to true, FALSE to false and edit the dgnc_board struct to make sure it uses "bool". Signed-off-by: Giedrius Statkevičius <giedrius.statkevicius@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* dgnc: get rid of dpacompat.h, move remaining stuff to digi.hGiedrius Statkevičius2015-03-241-1/+0Star
| | | | | | | | | Dpacompat.h contained a lot of unused #defines and only few things are used from it so since we've trimmed down digi.h, now we can delete dpacompat.h and move remaining stuff into digi.h. Signed-off-by: Giedrius Statkevičius <giedrius.statkevicius@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: dgnc: some off by one bugsDan Carpenter2015-03-241-1/+1
| | | | | | | | | | | | | | | | "dgnc_NumBoards" is the number of filled out elements in the dgnc_Board[] array. "->nasync" and "->maxports" are the same value. They are the number of channels in the ->channels[] array so these tests should be ">=" instead of ">" so we avoid reading past the end of the arrays. I cleaned up the conditions in dgnc_mgmt_ioctl() a bit. There was a work around for the off by one bug in the case where there were no boards which is no longer needed. "channel" is unsigned so it can't be negative. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* Staging: dgnc: release the lock before testing for nullityQuentin Lambert2015-03-181-1/+1
| | | | | | | | | | | | The refactoring intrduced in c84a083b995b ("Staging: dgnc: Use goto for spinlock release before return") inverts the order in which the lock is released and ld is tested for nullity. This patch restores the execution flow. Fixes: c84a083b995b ("Staging: dgnc: Use goto for spinlock release before return") Signed-off-by: Quentin Lambert <lambert.quentin@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* Staging: dgnc: Use goto for spinlock release before returnQuentin Lambert2015-03-121-25/+23Star
| | | | | | | | | | | spin_unlock_irqrestore() is called at several different places before exiting. This patch uses a goto statement to factorize these calls. Coccinelle was used to generate this patch. Signed-off-by: Quentin Lambert <lambert.quentin@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* dgnc: clean up comments at start of filesGiedrius Statkevičius2015-03-121-15/+0Star
| | | | | | | | | | | | | Remove FSF address because it's known in the past that it has changed. Also, remove the pointless "do not change the coding style" comments because it's one of the reasons why it's in staging and it's quite contradictory to what it says in TODO. Also, they contain wrong e-mails of people which are responsible for these drivers - see TODO or MAINTAINERS for that. We can preserve the original copyright at the top of the most files because it shows who originally made them. Signed-off-by: Giedrius Statkevičius <giedrius.statkevicius@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: dgnc: fix braces {} are not necessary for single statement blocksSalah Triki2015-03-071-4/+0Star
| | | | | | | | This patch fixes the following checkpatch.pl warning: braces {} are not necessary for single statement blocks Signed-off-by: Salah Triki <salah.triki@acm.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: dgnc: delete successive assignments to the same locationJiayi Ye2014-10-281-2/+0Star
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Successive assignments to the same location is meaningless and can be deleted. The Coccinelle semantic patch was used to find cases. @@ expression e1,e2,e3; @@ ( (<+...e1++...+>)=e2; | (<+...e1--...+>)=e2; | (<+...++e1...+>)=e2; | (<+...--e1...+>)=e2; | e1=e2; e1 = <+...e1...+>; | *e1=e2; *e1=e3; ) Signed-off-by: Jiayi Ye <yejiayily@gmail.com> Reviewed-by: Josh Triplett <josh@joshtriplett.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* Staging: dgnc: Remove unused sniff codeSomya Anand2014-10-231-127/+0Star
| | | | | | | | | | | | | | | | | The output written by dgnc_sniff_nowait_nolock() is never used anywhere since commit 35cf90459312f ("staging: dgnc: removes proc code") deleted the code that used to copy it to user space. dgnc_sniff_nowait_nolock() uses 'timeval' to create header timestamps for the data dump. 32-bit systems using 'struct timeval' will break in the year 2038, This patch removes dgnc_sniff_nowait_nolock() and all ch_sniff_* members of struct channel_t defined in "dgnc_driver.h". It also removes their usage from the driver files and hence y2038 issue is also resolved. Signed-off-by: Somya Anand <somyaanand214@gmail.com> Reviewed-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: dgnc: Remove space before tabsDilek Uzulmez2014-10-201-1/+1
| | | | | | | | This patch fixes the warning of "Please, no space before tab" produced by checkpatch.pl. The modified file: dgnc_tty.c Signed-off-by: Dilek Uzulmez <dilekuzulmez@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: dgnc: Remove non-standard APR/RAPR printing macrosRoberta Dobrescu2014-10-201-4/+11
| | | | | | | | | | | This patch removes non-standard macros used by dgnc driver for printing error or debugging messages. These are replaced by dev_err/dev_dbg (when possible) or pr_err. There were cases where the message is completely removed since is not adding any useful information. Signed-off-by: Roberta Dobrescu <roberta.dobrescu@gmail.com> Reviewed-by: Josh Triplett <josh@joshtriplett.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: dgnc: Fix do not add new typedefsEbru Akagunduz2014-10-021-4/+4
| | | | | | | | This patch fixes "do not add new typedefs" checkpatch.pl warning in dgnc_types.h Signed-off-by: Ebru Akagunduz <ebru.akagunduz@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* Staging: dgnc: Add missing blank lineMahati Chamarthy2014-10-021-0/+2
| | | | | | | | This fixes the following checkpatch.pl warning: WARNING: Missing a blank line after declarations Signed-off-by: Mahati Chamarthy <mahati.chamarthy@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* Staging: dgnc: Remove unnecessary bracesMahati Chamarthy2014-10-021-8/+4Star
| | | | | | | | This fixes the following checkpatch.pl warnings: WARNING: braces {} are not necessary for single statement blocks Signed-off-by: Mahati Chamarthy <mahati.chamarthy@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* Staging: dgnc: Remove return in void functionMahati Chamarthy2014-10-021-3/+0Star
| | | | | | | | This fixes the following checkpatch.pl warnings: WARNING: void function return statements are not generally useful Signed-off-by: Mahati Chamarthy <mahati.chamarthy@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: dgnc: dgnc_tty.c: Replace non-standard spinlock's macrosRoberta Dobrescu2014-09-291-146/+147
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch replaces non-standard spinlock's macros. It is done using coccinelle and the following semantic patch: @@ expression x; @@ - DGNC_SPINLOCK_INIT(x) + spin_lock_init(&x) @@ expression x, y; @@ - DGNC_LOCK(x, y) + spin_lock_irqsave(&x, y) @@ expression x, y; @@ - DGNC_UNLOCK(x, y) + spin_unlock_irqrestore(&x, y) @used_by_lock exists@ typedef ulong; symbol lock_flags; position p1, p2; @@ ( ulong lock_flags@p1; | unsigned long lock_flags@p2; ) ... ( spin_lock_irqsave(..., lock_flags) | spin_unlock_irqrestore(..., lock_flags) ) @@ position used_by_lock.p1, used_by_lock.p2; @@ ( - ulong lock_flags@p1; + unsigned long flags; | - unsigned long lock_flags@p2; + unsigned long flags; ) <... - lock_flags + flags ...> Signed-off-by: Roberta Dobrescu <roberta.dobrescu@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* Staging: dgnc: Merge lines and remove unused variable for immediate returnVaishali Thakkar2014-09-201-4/+1Star
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch merges two lines in a single line if immediate return is found. It also removes unnecessory variable rc as it is no longer needed. This is done using Coccinelle. Semantic patch used for this is as follows: @@ type T; identifier i; identifier f; constant C; @@ - T i; ...when != i when strict ( return -C; | - i = + return f(...); - return i; ) Signed-off-by: Vaishali Thakkar <vthakkar1994@gmail.com> Reviewed-by: Julia Lawall <julia.lawall@lip6.fr> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: dgnc: Move open brace on previous lineRoberta Dobrescu2014-09-201-8/+4Star
| | | | | | | | | | This fixes the following checkpatch.pl errors: ERROR: that open brace { should be on the previous line Signed-off-by: Roberta Dobrescu <roberta.dobrescu@gmail.com> Acked-by: Julia Lawall <julia.lawall@lip6.fr> Reviewed-by: Josh Triplett <josh@joshtriplett.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: dgnc: Do not initialise statics to 0 or NULLRoberta Dobrescu2014-09-201-1/+1
| | | | | | | | | This fixes the following checkpatch.pl error: ERROR: do not initialise statics to 0 or NULL Signed-off-by: Roberta Dobrescu <roberta.dobrescu@gmail.com> Acked-by: Daniel Baluta <daniel.baluta@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: dgnc: Replace kzalloc with kcallocRoberta Dobrescu2014-09-201-4/+4
| | | | | | | | This fixes the following checkpatch.pl warnings: WARNING: Prefer kcalloc over kzalloc with multiply Signed-off-by: Roberta Dobrescu <roberta.dobrescu@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: dgnc: Fix warnings relating to printk()Roberta Dobrescu2014-09-201-2/+2
| | | | | | | | | | | This fixes the following checkpatch.pl warnings: WARNING: printk() should include KERN_ facility level It replaces printk() with dev_dbg() in order to avoid the warning that a more specific function should be used. Signed-off-by: Roberta Dobrescu <roberta.dobrescu@gmail.com> Acked-by: Julia Lawall <julia.lawall@lip6.fr> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: dgnc: split two assignments into the two assignments on two lines.Seunghun Lee2014-09-021-3/+6
| | | | | | | | | split two assignments into the two assignments on two lines. CC: Lidza Louina <lidza.louina@gmail.com> CC: Mark Hounschell <markh@compro.net> Signed-off-by: Seunghun Lee <waydi1@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: dgnc: Fix sleeping under spinlock bugKonrad Zapalowicz2014-09-021-1/+1
| | | | | | | | This commit changes the memory allocation flags to ATOMIC in order to avoid sleeping in the nowait/nolock code. Signed-off-by: Konrad Zapalowicz <bergo.torino+kernel@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: dgnc: Fix checkpatch include warningKieron Browne2014-08-301-1/+1
| | | | | | | | checkpatch.pl fix. Use #include <linux/uaccess.h> instead of <asm/uaccess.h> Signed-off-by: Kieron Browne <kieron.browne@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: dgnc: remove DPR Macros and related codes.Seunghun Lee2014-08-301-230/+19Star
| | | | | | | | | | | In dgnc_drivers.h, DPR macro and DPR_* macros are defined but do nothing. So remove them and related codes. CC: Lidza Louina <lidza.louina@gmail.com> CC: Mark Hounschell <markh@compro.net> Signed-off-by: Seunghun Lee <waydi1@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: dgnc: Move utility functions out of dgnc_driver.cKonrad Zapalowicz2014-08-161-0/+1
| | | | | | | | | This commit moves the utility functions out of dgnc_driver.c file and puts them in the new dgnc_utils.{c,h} files. The accompanying changes adjust the existing code to work with this design. Signed-off-by: Konrad Zapalowicz <bergo.torino@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: dgnc: Fix frame size is larger than 1024BKonrad Zapalowicz2014-08-161-4/+12
| | | | | | | | | | | | | | This comit fixes the following sparse warnign: drivers/staging/dgnc/dgnc_tty.c:572:1: warning: the frame size of 1060 bytes is larger than 1024 bytes [-Wframe-larger-than=] This was caused by having buffer as an automatic variable. This commit moves it from the stack to the heap. Signed-off-by: Konrad Zapalowicz <bergo.torino@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: dgnc: Remove unneeded dgnc_trace.c and dgnc_trace.hSeunghun Lee2014-08-011-1/+0Star
| | | | | | | | | Removes unneeded dgnc_trace.c and dgnc_trace.h CC: Lidza Louina <lidza.louina@gmail.com> CC: Mark Hounschell <markh@compro.net> Signed-off-by: Seunghun Lee <waydi1@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: dgnc: remove commented codeSeunghun Lee2014-07-271-18/+0Star
| | | | | | | | | This patch removes commented code in dgnc driver. CC: Lidza Louina <lidza.louina@gmail.com> CC: Mark Hounschell <markh@compro.net> Signed-off-by: Seunghun Lee <waydi1@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: dgnc: remove redundant memset callDaeseok Youn2014-07-091-3/+0Star
| | | | | | | | The brd is allocated by kzalloc() in dgnc_found_board() so do not need to set 0 to member variable. Signed-off-by: Daeseok Youn <daeseok.youn@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: dgnc: removes unreachable codeDaeseok Youn2014-07-091-7/+0Star
| | | | | | | dgnc_tty_ioctl() cannot reach the end of function. Signed-off-by: Daeseok Youn <daeseok.youn@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: dgnc: Fix unsigned value for less than zeroDaeseok Youn2014-07-091-3/+3
| | | | | | | | The "un->un_open_count" is unsigned variable, so it cannot be less than zero. Signed-off-by: Daeseok Youn <daeseok.youn@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: dgnc: remove redundant null check for kfree()Daeseok Youn2014-07-091-12/+6Star
| | | | | Signed-off-by: Daeseok Youn <daeseok.youn@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>