Commit Graph

52 Commits

Author SHA1 Message Date
Andrey Shvetsov 0540609fe2 staging: most: replace MOST_CH_ISOC_AVP with MOST_CH_ISOC
This patch replaces the enum value MOST_CH_ISOC_AVP with the more
appropriate MOST_CH_ISOC.

Signed-off-by: Andrey Shvetsov <andrey.shvetsov@k2l.de>
Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-09-22 11:54:47 +02:00
Christian Gromm 95f73013ed staging: most: clean up configuration strings
This patch adds the strings 'rx', 'tx' and 'isoc' to the list of accepted
identifiers when setting up a channel configuration. To keep consistency it
removes the prefix "dir_" from strings returned by the attributes
set_direction and available_directions and it removes the suffix "_avp"
from the string "isoc_avp" returned by the attributes set_datatype and
available_datatypes.

Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-09-22 11:54:47 +02:00
Andrey Shvetsov 22ff195b5a staging: most: core: remove trailing zero from text property
This patch removes trailing zeros from the strings returned by the
attributes available_datatypes and available_directions.

Signed-off-by: Andrey Shvetsov <andrey.shvetsov@k2l.de>
Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-09-22 11:54:46 +02:00
Christian Gromm a6f9d846cc staging: most: make function most_submit_mbo return void
Function most_submit_mbo() causes an exception only if either the pointer
mbo or mbo->context equals NULL. From the underlying architecture's point
of view both cases must _not_ come true and would happen only, if something
has tampered with the pointers. This would render runtime code unable to
recover anyway. So, instead trying to hide that things are already
critically out of control we're better off with a WARN_ON() assertion.

This patch replaces the return type of the function most_submit_mbo() with
'void' and adds a WARN_ONCE() assertion. Additionally, code calling the
function is adapted accordingly.

Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-09-22 11:54:46 +02:00
Andrey Shvetsov 602facfd96 staging: most: core: constify structure member
This patch adds the const qualifier to the declaration of the member
name_suffix of structure most_channel_capability. It is needed since it
points to string literals.

Signed-off-by: Andrey Shvetsov <andrey.shvetsov@k2l.de>
Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-09-13 15:01:29 +02:00
Christian Gromm bc5f96a156 staging: most: core: show all linked channels
This patch is needed to have all linked channels being reported by the
show() function of the attribute file add_link. Currently user space can
only read back the latest link that has been established to a certain
channel.

Signed-off-by: Andrey Shvetsov <andrey.shvetsov@k2l.de>
Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-09-13 15:01:29 +02:00
Christian Gromm bf9503f11d staging: most: hdm-usb: fix race between enqueue and most_stop_enqueue
The "broken in pipe" handler of the USB-HDM calls most_stop_enqueue() to
stop the MBO traffic before returning all MBOs back to the Mostcore.  As
the enqueue() call from the Mostcore may run in parallel with the
most_stop_enqueue(), the HDM may run into the inconsistent state and
crash the kernel.

This patch synchronizes enqueue(), most_stop_enqueue() and
most_resume_enqueue() with a mutex, hence avoiding the race condition.

Signed-off-by: Andrey Shvetsov <andrey.shvetsov@k2l.de>
Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-08-21 16:53:57 +02:00
Christian Gromm 99d753463a staging: most: core: rename device struct of core module
This patch gives the struct device variable of the core a more meaningful
name.

Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
Signed-off-by: Andrey Shvetsov <andrey.shvetsov@k2l.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-08-15 20:23:21 +02:00
Christian Gromm 5a63e23a29 staging: most: core: remove debug print
This patch removes the debug print in case an HDM ran out of rx buffers.
This is not needed since the status is reflected in the sysfs
channel_starving flag. Additionally, it prevents the system form slowing
down.

Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
Signed-off-by: Andrey Shvetsov <andrey.shvetsov@k2l.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-08-15 20:23:21 +02:00
Sandhya Bankar 3e8b9fe060 Staging: most: Do not print message if kzalloc() failed.
Do not print message if kzalloc() failed.
kzalloc() has its own messages. So no need to add extra one.

Signed-off-by: Sandhya Bankar <bankarsandhya512@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-25 22:34:19 -08:00
Sudip Mukherjee cc4188b6bb staging: most: return proper error
We were returning ENOMEM on all types of errors. Lets return the actual
error code. At the same time remove the label which became unused as a
result of this patch.

Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-11 19:40:02 -08:00
Hari Prasath Gujulan Elango e7f2b70fd3 staging: most: replace multiple if..else with table lookup
Replace multiple if..else if..statements with simple table lookup in two
functions.

Signed-off-by: Hari Prasath Gujulan Elango <hgujulan@visteon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-07 17:34:58 -08:00
Sudip Mukherjee 17ac98ac73 staging: most: fix error comparison
device_create() returns ERR_PTR on error, it does not return NULL.

Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-07 17:34:58 -08:00
Christian Gromm cdc293d589 staging: most: fix retrieval of buffer availability
This patch fixes the function channel_has_mbo that delivers the false
information in case two AIMs are using the same tx channel.

Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-07 17:34:58 -08:00
Christian Gromm 61f6bfcbae staging: most: remove redundant mutexes
This patch removes the mutexes stop_task_mutex and deregister mutex,
since they can safely be left out.

Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-07 17:34:58 -08:00
Christian Gromm b522e61fb6 staging: most: remove code to destroy channel
This patch removes unnecessary code to destroy channel objects. It is
needed, because function most_stop_channel, which is indirectly
triggered by function most_deregister_interface, already destroys the
channels.

Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-07 17:34:58 -08:00
Christian Gromm 9cda3007ab staging: most: remove reference counter
This patch removes the unnecessary reference conter mod_ref.

Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-07 17:34:58 -08:00
Christian Gromm 6ed90e3622 staging: most: remove tainted flag
This patch removes the atomic tainted flag. It is needed to get rid of
logical overhead.

Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-07 17:34:58 -08:00
Christian Gromm a0fceb1fb8 staging: most: move channel disconnect to function most_deregister_interface
This patch moves the code that disconnects linked channels. It is needed
to have cleaning things up done right.

Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-07 17:34:58 -08:00
Christian Gromm 245dc23d23 staging: most: move mutex
This patch removes mutex from code that doesn't need any locking.

Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-07 17:34:58 -08:00
Christian Gromm 42e252a65d staging: most: move initialization of pointer
This patch makes function store_add_link initialize the pointer to an AIM
right before the channel is probed. It is needed, the AIM may already call
most_start_channel while probe_channel is still running. At this point the
pointer to the AIM must not be NULL.

Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-07 17:34:58 -08:00
Christian Gromm 44fe57818b staging: most: move call to disconnect_channel callback
This patch invokes AIM's disconnect_channel callback before the
corresponding pointers are re-initialized to NULL.

Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-07 17:34:58 -08:00
Christian Gromm b7382d44a5 staging: most: add missing call to ida_simple_remove
This patch adds two missing calls to function ida_simpel_remove.

Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-07 17:34:58 -08:00
Christian Gromm 9ce039a08a staging: most: remove function destroy_most_c_obj
This patch removes the function destroy_most_c_obj and executes its code
within function destroy_most_inst_obj.

Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-07 17:34:58 -08:00
Markus Elfring e23afff948 staging: most: Delete an unnecessary check before the function call "module_put"
The module_put() function tests whether its argument is NULL and then
returns immediately. Thus the test around the call is not needed.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-11-15 20:02:47 -08:00
Chaehyun Lim fabb93f18f staging: most: remove multiple blank lines
This patch removes multiple blank lines found by checkpatch.
CHECK: Please don't use multiple blank lines

Signed-off-by: Chaehyun Lim <chaehyun.lim@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-11-15 20:02:47 -08:00
Christian Gromm 2aa9b96ff6 staging: most: use preferred kernel types
This patch makes use of the preferred kernel types such as u16, u32.

Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-24 19:08:20 -07:00
Christian Gromm 623d800252 staging: most: fix logical operator position
This patch puts logical continuations on the previous line to meet
coding style.

Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-24 19:08:20 -07:00
Christian Gromm 9cbe5aa65d staging: most: use blank line after declarations
This patch fixes style violation regarding blank lines after
function/struct/union/enum declarations.

Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-24 19:08:16 -07:00
Christian Gromm 9deba73de5 staging: most: use braces on all arms of statement
This patch fixes style issues regarding braces on all arms of a statement.

Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-24 19:08:16 -07:00
Christian Gromm edaa1e33e2 staging: most: make alignment match open parenthesis
This patch fixes coding style violations by making alignments match
open parenthesis.

Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-24 19:08:16 -07:00
Christian Gromm 9ac23b344e staging: most: remove multiple blank lines
This patch removes the usage of multiple blank lines from driver modules.

Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-24 19:08:16 -07:00
Christian Gromm 1446ff09ff staging: most: fix line-over-80-characters violations
This patch prevents code from crossing the 80 character margin.

Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-16 23:09:41 -07:00
Christian Gromm b2db4b245e staging: most: change parameter description
This patch changes the description of a function parameter for a better
understanding.

Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-16 23:09:41 -07:00
Christian Gromm 47af41b0d9 staging: most: fix misplaced constants in comparisons
This patch removes and fixes constants being misplaced in comparisons.

Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-16 23:09:41 -07:00
Shraddha Barke 246ed517eb Staging: most: Remove exceptional & on function name
In this file, function names are otherwise used as pointers without &.

A simplified version of the Coccinelle semantic patch that makes this
change is as follows:

// <smpl>
@r@
identifier f;
@@

f(...) { ... }
@@
identifier r.f;
@@

- &f
+ f
// </smpl>

Signed-off-by: Shraddha Barke <shraddha.6596@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-13 10:11:03 -07:00
Christian Gromm aac997dfdd staging: most: add poll syscall to AIM cdev
This patch adds the implementation of the poll syscall to the AIM cdev.
To have the full functionality, a helper function is needed in the
core module to retrieve the instantaneous availability of tx buffers.

Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-09-29 03:18:53 +02:00
Christian Gromm ccfbaee033 staging: most: refactor channel structure
The struct most_c_obj has the same set of attributes for each of two AIMs.
This patch cleans up the code by introducing the new struct most_c_aim_obj
hat contains those fields.

Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-09-29 03:18:51 +02:00
Christian Gromm 71457d4827 staging: most: add fair buffer distribution
This patch ensures a fair distribution of buffers, when two AIMs share a
single channel. The AIMs then won't be able to use more than half of all
pre-allocated buffers of the linked channel. However, in case the channel
is not shared, the AIM can exclusively use all available buffers.

Signed-off-by: Andrey Shvetsov <andrey.shvetsov@k2l.de>
Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-09-29 03:18:51 +02:00
Christian Gromm f13f6981bc staging: most: fix channel operation in multi-aim context
This patch fixes the opening and closing process of a physical channel
when used by different AIMs.

Signed-off-by: Andrey Shvetsov <andrey.shvetsov@k2l.de>
Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-09-29 03:18:49 +02:00
Christian Gromm bf358040c4 staging: most: remove aim reset
This patch partly reverts a modification of function most_stop_channel()
that is trying to reset an established link between an AIM and an HDM in
all suitable places. But since the function most_stop_channel() is
stopping the data transfer it is the wrong place to do so.

Signed-off-by: Andrey Shvetsov <andrey.shvetsov@k2l.de>
Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-09-29 03:18:49 +02:00
Greg Kroah-Hartman bcabc6f328 Merge 4.3-rc3 into staging-next
We want the staging fixes in here as well.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-09-29 01:52:40 +02:00
Geert Uytterhoeven b786a8ad6a Staging: most: MOST and MOSTCORE should depend on HAS_DMA
If NO_DMA=y:

    ERROR: "dma_free_coherent" [drivers/staging/most/mostcore/mostcore.ko] undefined!
    ERROR: "dma_alloc_coherent" [drivers/staging/most/mostcore/mostcore.ko] undefined!

As all MOST sub drivers use DMA functionality, add a dependency on
HAS_DMA to MOSTCORE, and to MOST, which selects MOSTCORE.

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Acked-by: Christian Gromm <christian.gromm@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-09-13 09:24:44 -07:00
Sudip Mukherjee ec58d2a872 staging: most: style of bool comparison
BOOLEAN tests do not need any comparison to TRUE or FALSE.

Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-09-12 18:24:44 -07:00
Sudip Mukherjee 0834be6c52 staging: most: remove unneeded NULL check
The loop cursor of list_for_each_entry_safe() can never be NULL.

Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-09-12 18:24:44 -07:00
Adrian Remonda 04ca58372c Staging: most: mostcore/core.c. Fix "Using plain integer as NULL pointer" warnings
This patch fixes the warning generated by sparse: "Using plain integer
as NULL pointer" by replacing the pointer test against 0 with a logical test.

Signed-off-by: Adrian Remonda <adrianremonda@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-08-14 17:34:42 -07:00
Adrian Remonda c942ea7a37 Staging: most: mostcore/core.c. Fix "missing static keyword" warnings
This is a patch to the mostcore/core.c file. It makes
several local functions and structures static to prevent global
visibility.

Signed-off-by: Adrian Remonda <adrianremonda@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-08-14 17:34:41 -07:00
Christian Gromm 2ae0751007 Staging: most: avoid possible integer overflow
This patch prevents a potential integer overlow.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-08-03 17:39:51 -07:00
Christian Gromm 3f78f6116d Staging: most: replace min() by min_t()
This patch fixes wrong casting.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-07-31 16:17:20 -07:00
Christian Gromm 7ac5c9f0a0 Staging: most: fix snprintf() is printing too much
This patch prevents snprintf from exceeding a given buffer size.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-07-29 13:43:15 -07:00