Commit Graph

226 Commits

Author SHA1 Message Date
Daeseok Youn
c749201247 staging: dgap: use dgap_release_remap() in dgap_cleanup_board()
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-23 23:39:25 -07:00
Daeseok Youn
b23e487903 staging: dgap: adds missing iounmap for re_map_port in dgap_release_remap()
Signed-off-by: Daeseok Youn <daeseok.youn@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-09-23 23:39:25 -07:00
Daeseok Youn
476f6bc80b staging: dgap: remove unused 'runwait' variable
Signed-off-by: Daeseok Youn <daeseok.youn@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-09-23 23:39:24 -07:00
Daeseok Youn
492a1e7be5 staging: dgap: use schedule_timeout_interruptible() instead of dgap_ms_sleep()
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-19 16:53:57 -07:00
Piotr Witoslawski
70c0ed9825 drivers: staging: dgap: fix the checkpatch.pl issue "Warning: line over 80 characters"
Break lines exceeding 80 characters

Signed-off-by: Piotr Witoslawski <pwitos@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-09-06 21:46:55 -07:00
Daeseok Youn
c643794eb3 staging: dgap: remove useless a variable within board_t
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-30 14:04:58 -07:00
Daeseok Youn
9f20ecc51b staging: dgap: remove redundant setting a variable
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-30 14:04:58 -07:00
Daeseok Youn
6c66843dab staging: dgap: cleanup print messages for dgap driver
* 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-16 12:23:06 -07:00
Daeseok Youn
3cfa648b12 staging: dgap: Simplify to set a module type
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>
2014-08-16 12:23:06 -07:00
Daeseok Youn
f6aa0164cd staging: dgap: Simplify to set a concentrator type
It is same manner with setting a board type.
For example of config file for concentrator,
    "conc ccon" or
    "conc epcon"

After allocating a type of "CNODE" then set a type of concentrator.
So remove cases in swith statement, just get a token from string
and set to "conc.type". And also it doesn't need to "conc.v_type".

Signed-off-by: Daeseok Youn <daeseok.youn@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-08-16 12:23:06 -07:00
Daeseok Youn
77a4492fcc staging: dgap: Simplify set a board type from configration file
Board types need to separate normal command like IO, MEM and so on.
And the board type will come after "board" string in config file normally.
(If it is not, dgap_gettok returns an error with zero)
After that, set a variable of a number which is matched with specific
a board number to "board.type". The dgap_gettok() returns that number so
just set to "board.type" and also "v_type" can be removed.

In case of boards of PCI type are set variables to zero. These can
be removed because "p" as cnode get memory from kzalloc so already
set to zero.

Signed-off-by: Daeseok Youn <daeseok.youn@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-08-16 12:23:06 -07:00
Daeseok Youn
35edf11bed staging: dgap: cleanup duplicated warning message on dgap_tty_init()
If true_count is not same with brd->nasync, warning messages are
printed. But it has duplicated messages within if statement.

Signed-off-by: Daeseok Youn <daeseok.youn@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-08-16 12:23:05 -07:00
Daeseok Youn
274d8b35f8 staging: dgap: remove redundant declarations.
These are already defined in dgap.h.

Signed-off-by: Daeseok Youn <daeseok.youn@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-08-16 12:23:05 -07:00
Daeseok Youn
83d24f8229 staging: dgap: remove useless variable
dgap_major_serial_registered and dgap_major_transparent_print_registered
could be checked whether a board is initialized.
But it doesn't need to check that variables becasue dgap module
isn't calling the dgap_cleanup_tty() without initializing
for a board completely.

Signed-off-by: Daeseok Youn <daeseok.youn@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-08-16 12:23:05 -07:00
Daeseok Youn
99a643b8ae staging: dgap: introduce dgap_cleanup_nodes()
When a configration file is parsed with dgap_parsefile(),
makes nodes for saving configrations for board.

Making a node will allocate node memory and strings for saving
configrations with kstrdup().

So these are freed when dgap is unloaded or failed to initialize.

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-08-16 12:23:05 -07:00
Daeseok Youn
825122353a staging: dgap: remove dgap_newnode()
The dgap_newnode() is useless for creating new node.
So just use kzalloc and set a type in case statement.

Signed-off-by: Daeseok Youn <daeseok.youn@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-07-15 08:26:29 -07:00
Daeseok Youn
7bab00ff65 staging: dgap: remove unused a parameter in dgap_gettok()
The "p" as parameter is unused.

Signed-off-by: Daeseok Youn <daeseok.youn@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-07-15 08:26:29 -07:00
Daeseok Youn
e9cc5b2bb1 staging: dgap: fix a typo in dgap_gettok()
The "boar" should be "board".

Signed-off-by: Daeseok Youn <daeseok.youn@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-07-15 08:26:29 -07:00
Daeseok Youn
8e82ce0223 staging: dgap: remove unused case value in dgap_parsefile()
If rc is zero, this function will returns with an error and
cannot reach switch-case statement.

Signed-off-by: Daeseok Youn <daeseok.youn@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-07-15 08:26:29 -07:00
Daeseok Youn
dfa30ac139 staging: dgap: remove redundant error value check
The retval in dgap_block_til_ready() is initialized to zero,
and if no error has occurred in this function, the retval has a zero.
So it doesn't need to check "retval" itself.

Signed-off-by: Daeseok Youn <daeseok.youn@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-07-15 08:26:29 -07:00
Daeseok Youn
db6fc2df9c staging: dgap: removes redundant null check and change paramter for dgap_tty_digisetcustombaud()
Null checks in dgap_tty_digisetcustombaud() are already done by
dgap_tty_ioctl() and change "tty" as a paramter of this function
to "ch", "bd and "un".

Signed-off-by: Daeseok Youn <daeseok.youn@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-07-11 17:36:19 -07:00
Daeseok Youn
501bcd4f9b staging: dgap: removes redundant null check and change paramter for dgap_tty_digigetcustombaud()
Null checks in dgap_tty_digigetcustombaud() are already done by
dgap_tty_ioctl() and change "tty" as a paramter of this function
to "ch" and "un".

Signed-off-by: Daeseok Youn <daeseok.youn@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-07-11 17:35:45 -07:00
Daeseok Youn
ccbe7e59e6 staging: dgap: removes redundant null check and change paramter for dgap_tty_digisetedelay()
Null checks in dgap_tty_digisetedelay() are already done by
dgap_tty_ioctl() and change "tty" as a paramter of this function
to "ch", "bd and "un".

Signed-off-by: Daeseok Youn <daeseok.youn@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-07-11 17:35:45 -07:00
Daeseok Youn
4285c97476 staging: dgap: removes redundant null check and change paramter for dgap_set_modem_info()
Null checks in dgap_set_modem_info() are already done by
dgap_tty_ioctl() and change "tty" as a paramter of this function
to "ch", "bd" and "un".

Signed-off-by: Daeseok Youn <daeseok.youn@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-07-11 17:35:45 -07:00
Daeseok Youn
29a171c18f staging: dgap: removes redundant null check and change paramter for dgap_tty_digigeta()
Null checks in dgap_tty_digigeta() are already done by
dgap_tty_ioctl() and change "tty" as a paramter of this function
to "ch" and "un".

Signed-off-by: Daeseok Youn <daeseok.youn@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-07-11 17:35:45 -07:00
Daeseok Youn
ffc11c103a staging: dgap: removes redundant null check and change paramter for dgap_tty_digiseta()
Null checks in dgap_tty_digiseta() are already done by
dgap_tty_ioctl() and change "tty" as a paramter of this function
to "ch" and "bd" which are used in dgap_tty_digiseta().

Signed-off-by: Daeseok Youn <daeseok.youn@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-07-11 17:35:45 -07:00
Daeseok Youn
ab6cdcb426 staging: dgap: removes redundant null check and change the paramter for dgap_param()
The dgap_param() has a paramter which is tty_struct and
use variables in that struct. That variables which are "ch", "bd", "bs"
and "un" do not need to check NULL so these statements are removed.

And also change the parameter of this function because
it is possible to let someone know what paramters
are needed for this function.

Signed-off-by: Daeseok Youn <daeseok.youn@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-07-11 17:35:45 -07:00
Daeseok Youn
9d9011bd86 staging: dgap: remove unused variable in dgap_param()
The "ts" is not used in dgap_param().

Signed-off-by: Daeseok Youn <daeseok.youn@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-07-11 17:35:45 -07:00
Daeseok Youn
6299ae5aa7 staging: dgap: redundant NULL and magic check in dgap_get_modem_info()
The "ch" is already checking in caller.

Signed-off-by: Daeseok Youn <daeseok.youn@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-07-11 17:35:45 -07:00
Daeseok Youn
bdf4d4f23b staging: dgap: removes redundant null check and change paramter for dgap_maxcps_room()
Null checks for tty, un and ch are already done by caller,
so replace parameter "tty" with "ch" and "un".

Signed-off-by: Daeseok Youn <daeseok.youn@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-07-09 21:16:52 -07:00
Daeseok Youn
4c0e01496b staging: dgap: remove redundant NULL check in dgap_tty_init()
The brd is already checked by earlier function in dgap_init_one().

Signed-off-by: Daeseok Youn <daeseok.youn@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-07-09 12:02:16 -07:00
Daeseok Youn
039879e8c1 staging: dgap: use kzalloc instead of kmalloc/memset
Signed-off-by: Daeseok Youn <daeseok.youn@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-07-09 12:02:16 -07:00
Daeseok Youn
32af5ae73c staging: dgap: remove unused waitqueues
dgap_dl_wait and kme_wait are not used in dgap.

Signed-off-by: Daeseok Youn <daeseok.youn@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-07-09 12:02:16 -07:00
Daeseok Youn
77343eb973 staging: dgap: remove unneccessary dgap_init_pci() function
The dgap_init_pci() calls only pci_register_driver().
It doesn't need to make a function for that.

Signed-off-by: Daeseok Youn <daeseok.youn@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-07-09 12:02:16 -07:00
Daeseok Youn
96045db8a4 staging: dgap: Adds a blank line after declaration
clean up checkpatch.pl warning:
WARNING: Missing a blank line after declarations

Signed-off-by: Daeseok Youn <daeseok.youn@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-07-09 12:00:30 -07:00
Daeseok Youn
c10fccf82a staging: dgap: remove "return" statement in void function
clean up checkpatch warning:
WARNING: void function return statements are not generally useful

Signed-off-by: Daeseok Youn <daeseok.youn@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-07-09 12:00:30 -07:00
Daeseok Youn
1b804e2b12 staging: dgap: fixed "foo* bar should be foo * bar" in dgap.c
clean up checkpatch.pl error:
ERROR: "foo* bar" should be "foo *bar"

Signed-off-by: Daeseok Youn <daeseok.youn@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-07-09 12:00:30 -07:00
Daeseok Youn
7bc26a68ed staging: dgap: make dgap_found_board() return a brd pointer
Make dgap_found_board() return a brd pointer and that brd pointer
assign to dgap_board[] in the end of the dgap_init_one().

Signed-off-by: Daeseok Youn <daeseok.youn@gmail.com>
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-06-20 08:28:02 -07:00
Daeseok Youn
91177d53a3 staging: dgap: unwind on error in dgap_init_one()
The dgap_init_one() needs to handle error properly
if one of functions in dgap_init_one() is failed.

Introduce some functions for handling error in dgap_init_one()
 - dgap_tty_unregister() : unregister tty driver
 - dgap_free_flipbuf() : free flip buffer
 - dgap_release_remap() : release memory region and unmapped memory.

Signed-off-by: Daeseok Youn <daeseok.youn@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-06-19 15:23:32 -07:00
Daeseok Youn
3c3befef8f staging: dgap: move unrelated functions in dgap_firmware_load()
The dgap_firmware_load() has a lot of stuff which are
unrelated with loading firmware.
So just moved to dgap_init_one().

Signed-off-by: Daeseok Youn <daeseok.youn@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-06-19 15:23:32 -07:00
Daeseok Youn
3f7fa94b68 staging: dgap: rename dgap_after_config_loaded() to dgap_alloc_flipbuf()
dgap_after_config_loaded() as function name doesn't tell
what it does.

Signed-off-by: Daeseok Youn <daeseok.youn@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-06-19 15:23:32 -07:00
Daeseok Youn
78a7966ec8 staging: dgap: introduce dgap_free_irq()
dgap_free_irq() will free the irq which is requested in
dgap_request_irq().

Signed-off-by: Daeseok Youn <daeseok.youn@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-06-19 15:23:32 -07:00
Daeseok Youn
08f53f61af staging: dgap: introduce dgap_tty_free() for freeing channels.
It should be called after dgap_tty_register_ports() is failed.
So channels which are allocated in dgap_tty_init() will be freed.

Signed-off-by: Daeseok Youn <daeseok.youn@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-06-19 15:23:31 -07:00
Daeseok Youn
219a40d099 staging: dgap: get rid of brd->firstminor because it is 0
firstminor in struct borad_t is always zero, so it
can be removed.

Signed-off-by: Daeseok Youn <daeseok.youn@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-06-19 15:23:31 -07:00
Daeseok Youn
c7873665bb staging: dgap: remove unused paramter in dgap_parsefile()
"remove" parameter is not used in dgap_parsefile().

Signed-off-by: Daeseok Youn <daeseok.youn@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-06-19 15:23:31 -07:00
Daeseok Youn
7bf0a4ccdc staging: dgap: rename dgap_tty_uninit() to dgap_cleanup_tty()
- dgap_tty_uninit() doesn't match dgap_tty_init() at all.
so rename it. It is just used for cleanup when this module is
exited or failed to initialize by dgap_init_module.

Signed-off-by: Daeseok Youn <daeseok.youn@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-06-19 15:22:25 -07:00
Daeseok Youn
f19eda73ea staging: dgap: rename dgap_finalize_board_init() to dgap_request_irq()
Signed-off-by: Daeseok Youn <daeseok.youn@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-06-19 15:22:25 -07:00
Daeseok Youn
8148f37b33 staging: dgap: pass "brd" as a paramter to dgap_after_config_loaded()
Pass "brd" to dgap_after_config_loaded() instead of passing
"dgap_numboards" and looking up brd again.

Signed-off-by: Daeseok Youn <daeseok.youn@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-06-19 15:22:25 -07:00
Daeseok Youn
efd9618939 staging: dgap: pass "dgap_numboards" as a paramter to dgap_found_board()
- Pass "dgap_numboards" to dgap_found_board() instead of
using a global variable.

Signed-off-by: Daeseok Youn <daeseok.youn@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-06-19 15:22:25 -07:00
Daeseok Youn
67987aeb44 staging: dgap: make dgap_config_buf a local buffer
The dgap_config_buf is only used in dgap_firmware_load().

Signed-off-by: Daeseok Youn <daeseok.youn@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-06-19 15:21:47 -07:00