Commit Graph

35 Commits

Author SHA1 Message Date
Tobin C. Harding 0053fe0eba staging: dgnc: remove struct member magic numbers
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-29 09:37:10 +02:00
Tobin C. Harding 510616521f staging: dgnc: remove unnecessary comments
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-29 09:37:10 +02:00
Tobin C. Harding 7261fb9bcb staging: dgnc: fix whitespace before return
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-14 06:27:31 +08:00
Tobin C. Harding 7029064dd1 staging: dgnc: audit goto's in dgnc_mgmt
TODO file requests fix up of error handling.

Audit dgnc_mgmt.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>
2017-03-12 14:46:34 +01:00
Walt Feasel 29e9b7bf0d staging: dgnc: dgnc_mgmt.c Comment style modifications
Make modifications for comment style

Signed-off-by: Walt Feasel <waltfeasel@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-11-19 14:25:11 +01:00
Daeseok Youn 80e3e241fa staging: dgnc: fix CamelCase in dgnc_driver.c
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-28 07:30:36 -07:00
Eva Rachel Retuya 0b7ceaa665 staging: dgnc: delete parentheses around right hand side of assignment
Eliminate unneeded parentheses around the right hand side of an
assignment. Coccinelle semantic patch used:
@@
expression e1, e2;
identifier v;
@@

(
 v = (e1 == e2)
|
 v = (e1 != e2)
|
 v = (e1 <= e2)
|
 v = (e1 >= e2)
|
 v =
- (
	e1
- )
)

Signed-off-by: Eva Rachel Retuya <eraretuya@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-11 22:09:09 -08:00
Salva Peiró 4b6184336e staging/dgnc: fix info leak in ioctl
The dgnc_mgmt_ioctl() code fails to initialize the 16 _reserved bytes of
struct digi_dinfo after the ->dinfo_nboards member. Add an explicit
memset(0) before filling the structure to avoid the info leak.

Signed-off-by: Salva Peiró <speirofr@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-16 22:51:40 -07:00
Sudip Mukherjee 6f418259ec staging: dgnc: remove space after cast
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-12 21:08:51 -07:00
Sudip Mukherjee 205fc1fc95 staging: dgnc: remove blankline after brace
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>
2015-10-12 21:08:51 -07:00
Sudip Mukherjee 40215ddffc staging: dgnc: remove blankline before brace
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>
2015-10-12 21:08:51 -07:00
Sudip Mukherjee 9753007ed7 staging: dgnc: remove multiple blank lines
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>
2015-10-12 21:08:51 -07:00
Anjali Menon 4ddc2f06c8 staging: dgnc: Fixed line over 80 characters long
This is a patch that fixes line over 80 characters coding style
warning detected by checkpatch.pl.

WARNING: line over 80 characters

Signed-off-by: Anjali Menon <cse.anjalimenon@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-09-14 08:50:44 -07:00
Giedrius Statkevičius 20dad75285 dgnc: remove old 2.4-2.6 compat kernel defines
dgnc_kcompat.h contains some old legacy defines in case the kernel
doesn't have __user defined but for current kernel versions these
defines don't make sense and are useless so remove them. Move the
TTY_FLIPBUF_SIZE define to digi.h because it's used in the code.

Signed-off-by: Giedrius Statkevičius <giedrius.statkevicius@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-03-24 15:40:59 +01:00
Giedrius Statkevičius 850b41f7ba dgnc: get rid of dpacompat.h, move remaining stuff to digi.h
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>
2015-03-24 15:40:59 +01:00
Dan Carpenter 4bef52f377 staging: dgnc: some off by one bugs
"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>
2015-03-24 15:31:24 +01:00
Giedrius Statkevičius 1f2e089f68 dgnc: clean up comments at start of files
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>
2015-03-12 11:11:17 +01:00
Dan Carpenter cb1185a4ae staging: dgnc: off by one in dgnc_mgmt_ioctl()
"dgnc_NumBoards" is the number of initialized elements in the
dgnc_Board[] array so the comparison should be ">=" instead of ">" so we
don't read invalid data.  We can remove the special handling of the
empty array now that we've fixed this bug.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-03-12 11:08:58 +01:00
Ebru Akagunduz 446393e960 staging: dgnc: Fix do not add new typedefs
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>
2014-10-02 09:37:44 -07:00
Roberta Dobrescu 9a03d7c8cf staging: dgnc: dgnc_mgmt.c: Replace non-standard spinlock's macros
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>
2014-09-28 22:50:54 -04:00
Seunghun Lee f1e51745eb staging: dgnc: remove DPR Macros and related codes.
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>
2014-08-30 14:02:34 -07:00
Iulia Manda 0469c7471e Staging: dgnc: fix indentation in dgnc_mgmt.c
Align test parts in if statement on separate lines.

Signed-off-by: Iulia Manda <iulia.manda21@gmail.com>
Acked-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Signed-off-by: Peter P Waskiewicz Jr <peter.p.waskiewicz.jr@intel.com>
2014-03-13 16:17:59 -07:00
Iulia Manda 3393fe9077 Staging:dgnc: Fixed space prohibited between function name and '('
Deleted space between sizeof and open parenthethis.

Signed-off-by: Iulia Manda <iulia.manda21@gmail.com>
Acked-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Signed-off-by: Peter P Waskiewicz Jr <peter.p.waskiewicz.jr@intel.com>
2014-03-10 23:01:06 -07:00
Iulia Manda 8dd64acdbd Staging:dgnc: Use uaccess.h header from linux dir instead of asm
Include <linux/uaccess.h> instead of <asm/uaccess.h>

Signed-off-by: Iulia Manda <iulia.manda21@gmail.com>
Signed-off-by: Peter P Waskiewicz Jr <peter.p.waskiewicz.jr@intel.com>
2014-03-10 22:58:33 -07:00
Iulia Manda 969fbc860a Stagind:dgnc: Fixed unnecessary braces for single statement blocks
Deleted unnecessary braces for single statement if blocks.

Signed-off-by: Iulia Manda <iulia.manda21@gmail.com>
Acked-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Signed-off-by: Peter P Waskiewicz Jr <peter.p.waskiewicz.jr@intel.com>
2014-03-10 22:58:25 -07:00
Iulia Manda 1c1dd2a06d Staging:dgnc: Fixed else not following close brace error
Fix checkpatch.pl warning - else should follow close brace.

Signed-off-by: Iulia Manda <iulia.manda21@gmail.com>
Acked-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Signed-off-by: Peter P Waskiewicz Jr <peter.p.waskiewicz.jr@intel.com>
2014-03-10 22:58:02 -07:00
Ashvini Varatharaj e15b0c4eeb Staging: dgnc: removing the comparison 'board<0'
Fix dgnc_mgmt_ioctl() warn: unsigned 'board' is never less than zero.

Signed-off-by: Ashvini Varatharaj <ashvinivaratharaj@gmail.com>
Reviewed-by: Peter P Waskiewicz Jr <peter.p.waskiewicz.jr@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-10-19 14:35:05 -07:00
Lidza Louina a07bf39a65 staging: dgnc: changes arguments in sizeof
The arguments that were passed into sizeof were
generic. This patch changes this by putting
the actual item that we need a size of instead.

For example:
-   kzalloc(sizeof(struct dgnc_board), GFP_KERNEL);
+   kzalloc(sizeof(*brd), GFP_KERNEL);

Signed-off-by: Lidza Louina <lidza.louina@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-10-05 17:52:58 -07:00
Lidza Louina 8f90ef8049 staging: dgnc: removes parentheses around return statements
This patch removes parentheses around return
statements. They aren't needed.

Signed-off-by: Lidza Louina <lidza.louina@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-09-17 07:47:43 -07:00
Lidza Louina 4cfa73097f staging: dgnc: removes CVS code from files
This patch removes the code supporting CVS
from its files.

Signed-off-by: Lidza Louina <lidza.louina@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-08-21 10:48:40 -07:00
Lidza Louina 0986cda11e staging: dgnc: mgmt.c: removes trailing whitespace
This patch removes trailing whitespace in
the dgnc_mgmt.c file.

Signed-off-by: Lidza Louina <lidza.louina@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-08-21 09:43:53 -07:00
Lidza Louina 62a86e50e7 staging: dgnc: removes ifdef HAVE_UNLOCKED_IOCTL conditionals
This patch removes the HAVE_UNLOCKED_IOCTL conditional
statements from driver.c, mgmt.c and mgmt.h. This was
used to support older kernels. It isn't needed now.

Signed-off-by: Lidza Louina <lidza.louina@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-08-20 16:28:40 -07:00
Lidza Louina 35cf904593 staging: dgnc: removes proc code
This patch removes the dgnc_proc.c and dgnc_proc.h files and all
references to proc functions in dgnc_driver.c. This also removes proc.h
from the include headers in driver.c, mgmt.c and sysfs.c and proc.o
from the Makefile.

Drivers now use sysfs instead of proc.

Signed-off-by: Lidza Louina <lidza.louina@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-08-15 10:14:29 -07:00
Sachin Kamat c397d5ecf5 staging: dgnc: Remove version.h header inclusion in dgnc_mgmt.c
version.h header inclusion is not necessary as detected by
versioncheck.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-08-03 11:11:46 +08:00
Lidza Louina 0b99d58902 staging: dgnc: add dgnc digi driver
This patch adds the DGNC driver. This is a TTY Serial Port
Driver for the Digi International Neo and Classic PCI based product
line by Digi International <http://www.digi.com>.

This driver isn't hooked up to the build system because it doesn't
build, it merely adds the driver written by Digi to the kernel tree so
that it can be cleaned up and fixed up properly over time.

Cc: Mark Hounschell <markh@compro.net>
Signed-off-by: Lidza Louina <lidza.louina@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-08-02 05:42:45 +08:00