Commit graph

28 commits

Author SHA1 Message Date
Cai Huoqing
b7b3c35e87 staging: most: net: Make use of the helper macro LIST_HEAD()
Replace "struct list_head head = LIST_HEAD_INIT(head)" with
"LIST_HEAD(head)" to simplify the code.

Signed-off-by: Cai Huoqing <cai.huoqing@linux.dev>
Link: https://lore.kernel.org/r/20220209032645.38305-1-cai.huoqing@linux.dev
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-02-15 17:05:34 +01:00
Jakub Kicinski
349f631da4 staging: use eth_hw_addr_set() instead of ether_addr_copy()
Commit 406f42fa0d ("net-next: When a bond have a massive amount
of VLANs...") introduced a rbtree for faster Ethernet address look
up. To maintain netdev->dev_addr in this tree we need to make all
the writes to it got through appropriate helpers.

Convert staging from ether_addr_copy() to eth_hw_addr_set():

  @@
  expression dev, np;
  @@
  - ether_addr_copy(dev->dev_addr, np)
  + eth_hw_addr_set(dev, np)

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Link: https://lore.kernel.org/r/20211019171243.1412240-3-kuba@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-10-20 19:33:58 +02:00
Lee Jones
2f61c6649f staging: most: net: Fix some kernel-doc formatting issues
Fixes the following W=1 kernel build warning(s):

 drivers/staging/most/net/net.c:548: warning: Function parameter or member 'iface' not described in 'on_netinfo'
 drivers/staging/most/net/net.c:548: warning: Function parameter or member 'link_stat' not described in 'on_netinfo'
 drivers/staging/most/net/net.c:548: warning: Function parameter or member 'mac_addr' not described in 'on_netinfo'

Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Andrey Shvetsov <andrey.shvetsov@k2l.de>
Cc: linux-staging@lists.linux.dev
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Link: https://lore.kernel.org/r/20210414181129.1628598-27-lee.jones@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-05-10 11:19:25 +02:00
Zheng Yongjun
6abeae2adc staging: most: net: use DEFINE_MUTEX() for mutex lock
mutex lock can be initialized automatically with DEFINE_MUTEX()
rather than explicitly calling mutex_init().

Signed-off-by: Zheng Yongjun <zhengyongjun3@huawei.com>
Link: https://lore.kernel.org/r/20201224132519.31504-1-zhengyongjun3@huawei.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-12-28 15:09:28 +01:00
Andy Shevchenko
11c416e3f0 staging: most: Use %pM format specifier for MAC addresses
Convert to %pM instead of using custom code.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20200730151506.38827-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-07-31 09:47:45 +02:00
Christian Gromm
b276527539 staging: most: move core files out of the staging area
This patch moves the core module to the /drivers/most directory
and makes all necessary changes in order to not break the build.

Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
Link: https://lore.kernel.org/r/1583845362-26707-2-git-send-email-christian.gromm@microchip.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-03-24 13:42:44 +01:00
Andrey Shvetsov
4d1356ac12 staging: most: net: fix buffer overflow
If the length of the socket buffer is 0xFFFFFFFF (max size for an
unsigned int), then payload_len becomes 0xFFFFFFF1 after subtracting 14
(ETH_HLEN).  Then, mdp_len is set to payload_len + 16 (MDP_HDR_LEN)
which overflows and results in a value of 2.  These values for
payload_len and mdp_len will pass current buffer size checks.

This patch checks if derived from skb->len sum may overflow.

The check is based on the following idea:

For any `unsigned V1, V2` and derived `unsigned SUM = V1 + V2`,
`V1 + V2` overflows iif `SUM < V1`.

Reported-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Andrey Shvetsov <andrey.shvetsov@k2l.de>
Cc: stable <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20200116172238.6046-1-andrey.shvetsov@microchip.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-01-22 09:51:15 +01:00
Masahiro Yamada
532c291907 staging: most: remove header include path to drivers/staging
There is no need to add "ccflags-y += -I $(srctree)/drivers/staging"
just for including <most/most.h>.

Use the #include "..." directive with the correct relative path.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Link: https://lore.kernel.org/r/20200115164451.13203-1-masahiroy@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-01-16 20:56:31 +01:00
Christian Gromm
6f4d22d76b staging: most: use angle brackets in include path
This patch replaces the double quotes in all include paths
with angle brackets.

Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
Link: https://lore.kernel.org/r/1576238662-16512-7-git-send-email-christian.gromm@microchip.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-17 13:58:31 +01:00
Christian Gromm
45917e7920 staging: most: rename struct core_component
The stuctures defined in the most.h header file will be exposed to the
kernel once the file is moved out of the staging area. That's why the name
is changed into something more descriptive.

Reported-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
Link: https://lore.kernel.org/r/1576238662-16512-3-git-send-email-christian.gromm@microchip.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-17 13:50:04 +01:00
Christian Gromm
c1d3fb8abe staging: most: rename core.h to most.h
This patch renames the core header file core.h to most.h. The intention
behind this is to have a meaningful name once this file is moved to the
/include/linux directory.

Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
Link: https://lore.kernel.org/r/1576238662-16512-2-git-send-email-christian.gromm@microchip.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-17 13:50:03 +01:00
Christian Gromm
08283d3074 staging: most: block module removal while having active configfs items
This patch avoids that core component modules are being unloaded
while the related configfs interface has active items in its directories.
It is needed to prevent the situation where the core module cannot
be unloaded anymore, because the reference count 'used by' indicates that
the module is still being used and the usage count cannot be decreased by
calling rmdir, as the configfs directory has already been removed.

Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
Link: https://lore.kernel.org/r/1573230068-27658-3-git-send-email-christian.gromm@microchip.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-11-11 16:41:00 +01:00
Sebastian Andrzej Siewior
a20eefaee6 staging: most: Use DEFINE_SPINLOCK() instead of struct spinlock
For spinlocks the type spinlock_t should be used instead of "struct
spinlock".

Use DEFINE_SPINLOCK() and spare the run time initialization

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lkml.kernel.org/r/20190704153803.12739-5-bigeasy@linutronix.de
Link: https://lore.kernel.org/r/alpine.DEB.2.21.1907261319100.1791@nanos.tec.linutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-07-30 09:52:04 +02:00
Christian Gromm
c90c1b427b staging: most: deregister net and video config subsystems with configFS
This patch makes the modules net and video deregister its config subsystems
when the modules are removed from the kernel.

Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-06-15 20:54:28 +02:00
Christian Gromm
bb3982b42e staging: most: register net and video config subsystems with configFS
This patch makes the core components net and video register their config
subsystems with configFS. It is needed to have the configuration interface
of the modules exposed to user space.

Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-06-13 11:52:39 +02:00
Christian Gromm
dfee92dd50 staging: most: change signature of function probe_channel
This patch adds the param argument to the function parameter of
the call-back probe_channel. This parameter is needed to configure
the channels of an attached device.

Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-04-16 13:24:58 +02:00
Greg Kroah-Hartman
97ed8eab2a staging: add missing SPDX lines to Makefile files
There are a few remaining drivers/staging/*/Makefile files that do not
have SPDX identifiers in them.  Add the correct GPL-2.0 identifier to
them to make scanning tools happy.

Reviewed-by: Mukesh Ojha <mojha@codeaurora.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-04-03 11:10:15 +02:00
Greg Kroah-Hartman
99b75a4e32 staging: add missing SPDX lines to Kconfig files
There are a few remaining drivers/staging/*/Kconfig files that do not
have SPDX identifiers in them.  Add the correct GPL-2.0 identifier to
them to make scanning tools happy.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-04-03 11:10:15 +02:00
Wentao Cai
5b628549e9 staging: most: Replace '--help--' in Kconfig file
Replace '--help--' with 'help' to silence checkpatch.pl warning:
WARNING: prefer 'help' over '---help---' for new help texts

Signed-off-by: Wentao Cai <etsai042@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-03-18 07:05:24 +01:00
Masahiro Yamada
2fa495892b staging: prefix header search paths with $(srctree)/
Currently, the Kbuild core manipulates header search paths in a crazy
way [1].

To fix this mess, I want all Makefiles to add explicit $(srctree)/ to
the search paths in the srctree. Some Makefiles are already written in
that way, but not all. The goal of this work is to make the notation
consistent, and finally get rid of the gross hacks.

Having whitespaces after -I does not matter since commit 48f6e3cf5b
("kbuild: do not drop -I without parameter").

[1]: https://patchwork.kernel.org/patch/9632347/

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-02-04 12:30:27 +01:00
Colin Ian King
93f5715efd staging: most: net: make array 'broadcast' static, shrinks object size
Don't populate the array 'broadcast' on the stack but instead make it
static. Makes the object code smaller by 53 bytes:

Before:
   text	   data	    bss	    dec	    hex	filename
  10511	   1521	    448	  12480	   30c0	drivers/staging/most/net/net.o

After:
   text	   data	    bss	    dec	    hex	filename
  10394	   1585	    448	  12427	   308b	drivers/staging/most/net/net.o

(gcc version 8.2.0 x86_64)

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-09-10 11:17:47 +02:00
George Edward Bulmer
6724ed7f28 staging: most: convert macro to static function
This fixes checkpatch warning:
CHECK: Macro argument reuse 'buf' - possible side effects?

Signed-off-by: George Edward Bulmer <gebulmer@googlemail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-01-08 16:36:00 +01:00
Christian Gromm
b7937dc413 staging: most: fix comment sections
This patch updates and corrects the comment sections of the code.

Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-11-27 09:20:36 +01:00
Christian Gromm
11b3348f3b staging: most: net: remove aim designators
This patch renames the all aim designators with comp. It is needed because
userspace interfacing modules are referred to as components.

Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-11-27 09:20:36 +01:00
Christian Gromm
ed021a0f8e staging: most: rename functions to register a driver with most_core
This patch renames the functions to register and deregister a component
module with the core. It is needed because the modules that interface the
userspace are referred to as components.

Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-11-27 09:20:35 +01:00
Christian Gromm
a12844410c staging: most: rename struct most_aim
The designator of a module that proivdes means to interface userspace is
called an AIM. Since this name seems to be unappropiate, this kind of
moduels are going to be referred to as componetns. This is done because
such modules function as components to enhance the core with new features.
This patch renames the struct most_aim to core_component.

Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-11-27 09:20:35 +01:00
Christian Gromm
4d5f022f3a staging: most: remove proprietary kobjects
This patch removes the proprietary kobjects used by the driver modules and
replaces them with device structs. The patch is needed to have the driver
being integrated into the kernel's device model.

Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-11-27 09:20:34 +01:00
Christian Gromm
9c7201bfd9 staging: most: net: rename module
This patch renames the folder and the source file of the networking module.
It is needed to clean up the directory layout of the driver.

Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-11-27 09:20:33 +01:00