[PATCH] staging: wilc1000: use pre-defined macro is_broadcast_ether_addr
From: Hari Prasath Use the kernel pre-defined macro is_broadcast_ether_addr() instead of doing a memcmp here. Signed-off-by: Hari Prasath --- drivers/staging/wilc1000/linux_mon.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/staging/wilc1000/linux_mon.c b/drivers/staging/wilc1000/linux_mon.c index bbdfc7a..f93f411 100644 --- a/drivers/staging/wilc1000/linux_mon.c +++ b/drivers/staging/wilc1000/linux_mon.c @@ -27,7 +27,6 @@ static struct net_device *wilc_wfi_mon; /* global monitor netdev */ static u8 srcadd[6]; static u8 bssid[6]; -static u8 broadcast[] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; /** * @brief WILC_WFI_monitor_rx * @details @@ -193,7 +192,7 @@ static netdev_tx_t WILC_WFI_mon_xmit(struct sk_buff *skb, skb_pull(skb, rtap_len); - if (skb->data[0] == 0xc0 && (!(memcmp(broadcast, &skb->data[4], 6 { + if (skb->data[0] == 0xc0 && is_broadcast_ether_addr(&skb->data[4])) { skb2 = dev_alloc_skb(skb->len + sizeof(struct wilc_wfi_radiotap_cb_hdr)); if (!skb2) return -ENOMEM; -- 2.10.0.GIT ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v4 0/6] staging: Introduce DPAA2 Ethernet Switch driver
This patchset introduces the Ethernet Switch Driver for Freescale/NXP SoCs with DPAA2 (DataPath Acceleration Architecture v2). The driver manages switch objects discovered on the fsl-mc bus. A description of the driver can be found in the associated README file. The patchset consists of: * A set of libraries containing APIs for configuring and controlling Management Complex (MC) switch objects * The DPAA2 Ethernet Switch driver * Patch adding ethtool support Limitations: * no support for control traffic to/from CPU * only DPSW ports can be added to a bridge Changelog: v2: addressed comments from Bogdan P. v3: addressed comments from Andrew L. (patch 3/6 updated) v4: adjust to moving MC-bus out of staging support adding/deleting multicast entries to/from FDB avoid triggering console stack traces due to benign MC errors refactor TCI setting code to avoid code duplication fix sparse warning Razvan Stefanescu (6): staging: fsl-dpaa2/ethsw: Add APIs for DPSW object staging: fsl-dpaa2/ethsw: Add Freescale DPAA2 Ethernet Switch driver staging: fsl-dpaa2/ethsw: Add ethtool support staging: fsl-dpaa2/ethsw: Add maintainer for Ethernet Switch driver staging: fsl-dpaa2/ethsw: Add README staging: fsl-dpaa2/ethsw: Add TODO MAINTAINERS |6 + drivers/staging/fsl-dpaa2/Kconfig |8 + drivers/staging/fsl-dpaa2/Makefile |1 + drivers/staging/fsl-dpaa2/ethsw/Makefile|7 + drivers/staging/fsl-dpaa2/ethsw/README | 106 ++ drivers/staging/fsl-dpaa2/ethsw/TODO| 13 + drivers/staging/fsl-dpaa2/ethsw/dpsw-cmd.h | 371 ++ drivers/staging/fsl-dpaa2/ethsw/dpsw.c | 1148 + drivers/staging/fsl-dpaa2/ethsw/dpsw.h | 611 + drivers/staging/fsl-dpaa2/ethsw/ethsw-ethtool.c | 206 +++ drivers/staging/fsl-dpaa2/ethsw/ethsw.c | 1516 +++ drivers/staging/fsl-dpaa2/ethsw/ethsw.h | 90 ++ 12 files changed, 4083 insertions(+) create mode 100644 drivers/staging/fsl-dpaa2/ethsw/Makefile create mode 100644 drivers/staging/fsl-dpaa2/ethsw/README create mode 100644 drivers/staging/fsl-dpaa2/ethsw/TODO create mode 100644 drivers/staging/fsl-dpaa2/ethsw/dpsw-cmd.h create mode 100644 drivers/staging/fsl-dpaa2/ethsw/dpsw.c create mode 100644 drivers/staging/fsl-dpaa2/ethsw/dpsw.h create mode 100644 drivers/staging/fsl-dpaa2/ethsw/ethsw-ethtool.c create mode 100644 drivers/staging/fsl-dpaa2/ethsw/ethsw.c create mode 100644 drivers/staging/fsl-dpaa2/ethsw/ethsw.h -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v4 1/6] staging: fsl-dpaa2/ethsw: Add APIs for DPSW object
Add the command build/parse APIs for operating on DPSW objects through the DPAA2 Management Complex. Signed-off-by: Razvan Stefanescu --- Changelog: v2: - use u8 for en parameter of dpsw_if_set_flooding/broadcast() v3: - no changes v4: - adjust to moving MC-bus out of staging - fix sparse warnings drivers/staging/fsl-dpaa2/Kconfig |8 + drivers/staging/fsl-dpaa2/Makefile |1 + drivers/staging/fsl-dpaa2/ethsw/Makefile |7 + drivers/staging/fsl-dpaa2/ethsw/dpsw-cmd.h | 358 + drivers/staging/fsl-dpaa2/ethsw/dpsw.c | 1116 drivers/staging/fsl-dpaa2/ethsw/dpsw.h | 579 +++ 6 files changed, 2069 insertions(+) create mode 100644 drivers/staging/fsl-dpaa2/ethsw/Makefile create mode 100644 drivers/staging/fsl-dpaa2/ethsw/dpsw-cmd.h create mode 100644 drivers/staging/fsl-dpaa2/ethsw/dpsw.c create mode 100644 drivers/staging/fsl-dpaa2/ethsw/dpsw.h diff --git a/drivers/staging/fsl-dpaa2/Kconfig b/drivers/staging/fsl-dpaa2/Kconfig index dfff675..8a508ef 100644 --- a/drivers/staging/fsl-dpaa2/Kconfig +++ b/drivers/staging/fsl-dpaa2/Kconfig @@ -16,3 +16,11 @@ config FSL_DPAA2_ETH ---help--- Ethernet driver for Freescale DPAA2 SoCs, using the Freescale MC bus driver + +config FSL_DPAA2_ETHSW + tristate "Freescale DPAA2 Ethernet Switch" + depends on FSL_DPAA2 + depends on NET_SWITCHDEV + ---help--- + Driver for Freescale DPAA2 Ethernet Switch. Select + BRIDGE to have support for bridge tools. diff --git a/drivers/staging/fsl-dpaa2/Makefile b/drivers/staging/fsl-dpaa2/Makefile index 0836ba8..6cfd76b 100644 --- a/drivers/staging/fsl-dpaa2/Makefile +++ b/drivers/staging/fsl-dpaa2/Makefile @@ -3,3 +3,4 @@ # obj-$(CONFIG_FSL_DPAA2_ETH)+= ethernet/ +obj-$(CONFIG_FSL_DPAA2_ETHSW) += ethsw/ diff --git a/drivers/staging/fsl-dpaa2/ethsw/Makefile b/drivers/staging/fsl-dpaa2/ethsw/Makefile new file mode 100644 index 000..db137f7 --- /dev/null +++ b/drivers/staging/fsl-dpaa2/ethsw/Makefile @@ -0,0 +1,7 @@ +# +# Makefile for the Freescale DPAA2 Ethernet Switch +# + +obj-$(CONFIG_FSL_DPAA2_ETHSW) += dpaa2-ethsw.o + +dpaa2-ethsw-objs := dpsw.o diff --git a/drivers/staging/fsl-dpaa2/ethsw/dpsw-cmd.h b/drivers/staging/fsl-dpaa2/ethsw/dpsw-cmd.h new file mode 100644 index 000..36edef6 --- /dev/null +++ b/drivers/staging/fsl-dpaa2/ethsw/dpsw-cmd.h @@ -0,0 +1,358 @@ +/* Copyright 2013-2016 Freescale Semiconductor Inc. + * Copyright 2017-2018 NXP + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the above-listed copyright holders nor the + * names of any contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * + * ALTERNATIVELY, this software may be distributed under the terms of the + * GNU General Public License ("GPL") as published by the Free Software + * Foundation, either version 2 of that License or (at your option) any + * later version. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ +#ifndef __FSL_DPSW_CMD_H +#define __FSL_DPSW_CMD_H + +/* DPSW Version */ +#define DPSW_VER_MAJOR 8 +#define DPSW_VER_MINOR 0 + +#define DPSW_CMD_BASE_VERSION 1 +#define DPSW_CMD_ID_OFFSET 4 + +#define DPSW_CMD_ID(id)(((id) << DPSW_CMD_ID_OFFSET) | DPSW_CMD_BASE_VERSION) + +/* Command IDs */ +#define DPSW_CMDID_CLOSEDPSW_CMD_ID(0x800) +#define DPSW_CMDID_OPEN DPSW_CMD_ID(0x802) + +#define DPSW_CMDID_GET_API_VERSION DPSW_CMD_ID(0xa02) + +#define DPSW_CMDID_ENABLE DPSW_CMD_ID(0x002) +#define DPSW_CMDID_DISABLE
[PATCH v4 3/6] staging: fsl-dpaa2/ethsw: Add ethtool support
Add driver information, link details and hardware statistics to be reported via ethtool -S. Signed-off-by: Razvan Stefanescu --- Changelog: v2: - no changes v3: - removed driver version v4: - no changes drivers/staging/fsl-dpaa2/ethsw/Makefile| 2 +- drivers/staging/fsl-dpaa2/ethsw/dpsw-cmd.h | 13 ++ drivers/staging/fsl-dpaa2/ethsw/dpsw.c | 32 drivers/staging/fsl-dpaa2/ethsw/dpsw.h | 32 drivers/staging/fsl-dpaa2/ethsw/ethsw-ethtool.c | 206 drivers/staging/fsl-dpaa2/ethsw/ethsw.c | 1 + drivers/staging/fsl-dpaa2/ethsw/ethsw.h | 2 + 7 files changed, 287 insertions(+), 1 deletion(-) create mode 100644 drivers/staging/fsl-dpaa2/ethsw/ethsw-ethtool.c diff --git a/drivers/staging/fsl-dpaa2/ethsw/Makefile b/drivers/staging/fsl-dpaa2/ethsw/Makefile index a6d72d1..de92cd9 100644 --- a/drivers/staging/fsl-dpaa2/ethsw/Makefile +++ b/drivers/staging/fsl-dpaa2/ethsw/Makefile @@ -4,4 +4,4 @@ obj-$(CONFIG_FSL_DPAA2_ETHSW) += dpaa2-ethsw.o -dpaa2-ethsw-objs := ethsw.o dpsw.o +dpaa2-ethsw-objs := ethsw.o ethsw-ethtool.o dpsw.o diff --git a/drivers/staging/fsl-dpaa2/ethsw/dpsw-cmd.h b/drivers/staging/fsl-dpaa2/ethsw/dpsw-cmd.h index 36edef6..c45f001 100644 --- a/drivers/staging/fsl-dpaa2/ethsw/dpsw-cmd.h +++ b/drivers/staging/fsl-dpaa2/ethsw/dpsw-cmd.h @@ -74,6 +74,8 @@ #define DPSW_CMDID_IF_SET_FLOODING DPSW_CMD_ID(0x047) #define DPSW_CMDID_IF_SET_BROADCAST DPSW_CMD_ID(0x048) +#define DPSW_CMDID_IF_SET_LINK_CFG DPSW_CMD_ID(0x04C) + #define DPSW_CMDID_VLAN_ADD DPSW_CMD_ID(0x060) #define DPSW_CMDID_VLAN_ADD_IF DPSW_CMD_ID(0x061) #define DPSW_CMDID_VLAN_ADD_IF_UNTAGGED DPSW_CMD_ID(0x062) @@ -262,6 +264,17 @@ struct dpsw_cmd_if_set_max_frame_length { __le16 frame_length; }; +struct dpsw_cmd_if_set_link_cfg { + /* cmd word 0 */ + __le16 if_id; + u8 pad[6]; + /* cmd word 1 */ + __le32 rate; + __le32 pad1; + /* cmd word 2 */ + __le64 options; +}; + struct dpsw_cmd_if_get_link_state { __le16 if_id; }; diff --git a/drivers/staging/fsl-dpaa2/ethsw/dpsw.c b/drivers/staging/fsl-dpaa2/ethsw/dpsw.c index 8e52d74..e63531d 100644 --- a/drivers/staging/fsl-dpaa2/ethsw/dpsw.c +++ b/drivers/staging/fsl-dpaa2/ethsw/dpsw.c @@ -383,6 +383,38 @@ int dpsw_get_attributes(struct fsl_mc_io *mc_io, } /** + * dpsw_if_set_link_cfg() - Set the link configuration. + * @mc_io: Pointer to MC portal's I/O object + * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' + * @token: Token of DPSW object + * @if_id: Interface id + * @cfg: Link configuration + * + * Return: '0' on Success; Error code otherwise. + */ +int dpsw_if_set_link_cfg(struct fsl_mc_io *mc_io, +u32 cmd_flags, +u16 token, +u16 if_id, +struct dpsw_link_cfg *cfg) +{ + struct mc_command cmd = { 0 }; + struct dpsw_cmd_if_set_link_cfg *cmd_params; + + /* prepare command */ + cmd.header = mc_encode_cmd_header(DPSW_CMDID_IF_SET_LINK_CFG, + cmd_flags, + token); + cmd_params = (struct dpsw_cmd_if_set_link_cfg *)cmd.params; + cmd_params->if_id = cpu_to_le16(if_id); + cmd_params->rate = cpu_to_le32(cfg->rate); + cmd_params->options = cpu_to_le64(cfg->options); + + /* send command to mc*/ + return mc_send_command(mc_io, &cmd); +} + +/** * dpsw_if_get_link_state - Return the link state * @mc_io: Pointer to MC portal's I/O object * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' diff --git a/drivers/staging/fsl-dpaa2/ethsw/dpsw.h b/drivers/staging/fsl-dpaa2/ethsw/dpsw.h index d13970c..5a0c7ad 100644 --- a/drivers/staging/fsl-dpaa2/ethsw/dpsw.h +++ b/drivers/staging/fsl-dpaa2/ethsw/dpsw.h @@ -245,6 +245,38 @@ enum dpsw_action { }; /** + * Enable auto-negotiation + */ +#define DPSW_LINK_OPT_AUTONEG 0x0001ULL +/** + * Enable half-duplex mode + */ +#define DPSW_LINK_OPT_HALF_DUPLEX 0x0002ULL +/** + * Enable pause frames + */ +#define DPSW_LINK_OPT_PAUSE0x0004ULL +/** + * Enable a-symmetric pause frames + */ +#define DPSW_LINK_OPT_ASYM_PAUSE 0x0008ULL + +/** + * struct dpsw_link_cfg - Structure representing DPSW link configuration + * @rate: Rate + * @options: Mask of available options; use 'DPSW_LINK_OPT_' values + */ +struct dpsw_link_cfg { + u32 rate; + u64 options; +}; + +int dpsw_if_set_link_cfg(struct fsl_mc_io *mc_io, +u32 cmd_flags, +u16 token, +u16 if_id, +struct dpsw_link_cfg *cfg); +/** * struct dpsw_link_state - Structure representing DPSW link state * @rate: Rate * @
[PATCH v4 6/6] staging: fsl-dpaa2/ethsw: Add TODO
Add a TODO file describing what needs to be added/changed before the driver can be moved out of staging. Signed-off-by: Razvan Stefanescu --- Changelog: v2: - no changes v3: - no changes v4: - remove fsl-mc bus driver dependency as it is out of staging drivers/staging/fsl-dpaa2/ethsw/TODO | 13 + 1 file changed, 13 insertions(+) create mode 100644 drivers/staging/fsl-dpaa2/ethsw/TODO diff --git a/drivers/staging/fsl-dpaa2/ethsw/TODO b/drivers/staging/fsl-dpaa2/ethsw/TODO new file mode 100644 index 000..d186875 --- /dev/null +++ b/drivers/staging/fsl-dpaa2/ethsw/TODO @@ -0,0 +1,13 @@ +* Add I/O capabilities on switch port netdevices. This will allow control +traffic to reach the CPU. +* Add ACL to redirect control traffic to CPU. +* Add support for displaying learned FDB entries +* MC firmware uprev; the DPAA2 objects used by the Ethernet Switch driver +need to be kept in sync with binary interface changes in MC +* refine README file +* cleanup + +NOTE: At least first three of the above are required before getting the +DPAA2 Ethernet Switch driver out of staging. Another requirement is that +dpio driver is moved to drivers/soc (this is required for I/O). + -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v4 2/6] staging: fsl-dpaa2/ethsw: Add Freescale DPAA2 Ethernet Switch driver
Introduce the DPAA2 Ethernet Switch driver, which manages Datapath Switch (DPSW) objects discovered on the MC bus. Suggested-by: Alexandru Marginean Signed-off-by: Razvan Stefanescu --- Changelog: v2: - fix PVID cleanup in ethsw_port_add_vlan() - rename err2 to ret in ethsw_port_add/del_vlan() - avoid duplicate code in ethsw_probe() - move destroy_workqueue to ethsw_takedown() - have a function for unregistering notifiers - above changes implement review comments for v1 from Bogdan P. v3: - no changes v4: - adjust to moving MC-bus out of staging - support adding/deleting multicast entries to/from FDB - selectively discard benign MC errors for calling add/delete fdb entries multiple times to avoid spamming console with stack traces - refactor setting TCI to avoid code duplication - clean probe code error path drivers/staging/fsl-dpaa2/ethsw/Makefile |2 +- drivers/staging/fsl-dpaa2/ethsw/ethsw.c | 1515 ++ drivers/staging/fsl-dpaa2/ethsw/ethsw.h | 88 ++ 3 files changed, 1604 insertions(+), 1 deletion(-) create mode 100644 drivers/staging/fsl-dpaa2/ethsw/ethsw.c create mode 100644 drivers/staging/fsl-dpaa2/ethsw/ethsw.h diff --git a/drivers/staging/fsl-dpaa2/ethsw/Makefile b/drivers/staging/fsl-dpaa2/ethsw/Makefile index db137f7..a6d72d1 100644 --- a/drivers/staging/fsl-dpaa2/ethsw/Makefile +++ b/drivers/staging/fsl-dpaa2/ethsw/Makefile @@ -4,4 +4,4 @@ obj-$(CONFIG_FSL_DPAA2_ETHSW) += dpaa2-ethsw.o -dpaa2-ethsw-objs := dpsw.o +dpaa2-ethsw-objs := ethsw.o dpsw.o diff --git a/drivers/staging/fsl-dpaa2/ethsw/ethsw.c b/drivers/staging/fsl-dpaa2/ethsw/ethsw.c new file mode 100644 index 000..b992434 --- /dev/null +++ b/drivers/staging/fsl-dpaa2/ethsw/ethsw.c @@ -0,0 +1,1515 @@ +/* Copyright 2014-2016 Freescale Semiconductor Inc. + * Copyright 2017-2018 NXP + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the above-listed copyright holders nor the + * names of any contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * + * ALTERNATIVELY, this software may be distributed under the terms of the + * GNU General Public License ("GPL") as published by the Free Software + * Foundation, either version 2 of that License or (at your option) any + * later version. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include + +#include +#include +#include +#include + +#include + +#include "ethsw.h" + +static struct workqueue_struct *ethsw_owq; + +/* Minimal supported DPSW version */ +#define DPSW_MIN_VER_MAJOR 8 +#define DPSW_MIN_VER_MINOR 0 + +#define DEFAULT_VLAN_ID1 + +static int ethsw_add_vlan(struct ethsw_core *ethsw, u16 vid) +{ + int err; + + struct dpsw_vlan_cfgvcfg = { + .fdb_id = 0, + }; + + if (ethsw->vlans[vid]) { + dev_err(ethsw->dev, "VLAN already configured\n"); + return -EEXIST; + } + + err = dpsw_vlan_add(ethsw->mc_io, 0, + ethsw->dpsw_handle, vid, &vcfg); + if (err) { + dev_err(ethsw->dev, "dpsw_vlan_add err %d\n", err); + return err; + } + ethsw->vlans[vid] = ETHSW_VLAN_MEMBER; + + return 0; +} + +static int ethsw_port_set_tci(struct ethsw_port_priv *port_priv, + struct dpsw_tci_cfg *tci_cfg) +{ + struct ethsw_core *ethsw = port_priv->ethsw_data; + struct net_device *netdev = port_priv->netdev; + bool is_oper; + int err, ret; + + /* Interface needs to be down to change PVID */ + is_ope
[PATCH v4 5/6] staging: fsl-dpaa2/ethsw: Add README
Add a README file describing the driver architecture, components and interfaces. Signed-off-by: Razvan Stefanescu --- Changelog: v2: - no changes v3: - no changes v4: - no changes drivers/staging/fsl-dpaa2/ethsw/README | 106 + 1 file changed, 106 insertions(+) create mode 100644 drivers/staging/fsl-dpaa2/ethsw/README diff --git a/drivers/staging/fsl-dpaa2/ethsw/README b/drivers/staging/fsl-dpaa2/ethsw/README new file mode 100644 index 000..f6fc07f --- /dev/null +++ b/drivers/staging/fsl-dpaa2/ethsw/README @@ -0,0 +1,106 @@ +DPAA2 Ethernet Switch driver + + +This file provides documentation for the DPAA2 Ethernet Switch driver + + +Contents + + Supported Platforms + Architecture Overview + Creating an Ethernet Switch + Features + + + Supported Platforms +=== +This driver provides networking support for Freescale LS2085A, LS2088A +DPAA2 SoCs. + + +Architecture Overview += +The Ethernet Switch in the DPAA2 architecture consists of several hardware +resources that provide the functionality. These are allocated and +configured via the Management Complex (MC) portals. MC abstracts most of +these resources as DPAA2 objects and exposes ABIs through which they can +be configured and controlled. + +For a more detailed description of the DPAA2 architecture and its object +abstractions see: + drivers/staging/fsl-mc/README.txt + +The Ethernet Switch is built on top of a Datapath Switch (DPSW) object. + +Configuration interface: + + - + | DPAA2 Switch driver | + - + . + . + -- + | DPSW API | + -- + . software + = . == + . hardware + - + | MC hardware portals | + - + . + . + -- +| DPSW | + -- + +Driver uses the switch device driver model and exposes each switch port as +a network interface, which can be included in a bridge. Traffic switched +between ports is offloaded into the hardware. Exposed network interfaces +are not used for I/O, they are used just for configuration. This +limitation is going to be addressed in the future. + +The DPSW can have ports connected to DPNIs or to PHYs via DPMACs. + + + [ethA] [ethB] [ethC] [ethD] [ethE] [ethF] +: : : : : : +: : : : : : +[eth drv] [eth drv] [ethsw drv ] +: : : : : :kernel + +: : : : : :hardware + [DPNI] [DPNI] [= DPSW =] +| | | | | | +| -- | [DPMAC][DPMAC] + ---| | +| | + [PHY] [PHY] + +For a more detailed description of the Ethernet switch device driver model +see: + Documentation/networking/switchdev.txt + +Creating an Ethernet Switch +=== +A device is created for the switch objects probed on the MC bus. Each DPSW +has a number of properties which determine the configuration options and +associated hardware resources. + +A DPSW object (and the other DPAA2 objects needed for a DPAA2 switch) can +be added to a container on the MC bus in one of two ways: statically, +through a Datapath Layout Binary file (DPL) that is parsed by MC at boot +time; or created dynamically at runtime, via the DPAA2 objects APIs. + +Features + +Driver configures DPSW to perform hardware switching offload of +unicast/multicast/broadcast (VLAN tagged or untagged) traffic between its +ports. + +It allows configuration of hardware learning, flooding, multicast groups, +port VLAN configuration and STP state. + +Static entries can be added/removed from the FDB. + +Hardware statistics for each port are provided through ethtool -S option. -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v4 4/6] staging: fsl-dpaa2/ethsw: Add maintainer for Ethernet Switch driver
Signed-off-by: Razvan Stefanescu --- Changelog: v2: - no changes v3: - no changes v4: - no changes MAINTAINERS | 6 ++ 1 file changed, 6 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index c3c2b75..20d7bf2 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -4410,6 +4410,12 @@ L: linux-ker...@vger.kernel.org S: Maintained F: drivers/staging/fsl-dpaa2/ethernet +DPAA2 ETHERNET SWITCH DRIVER +M: Razvan Stefanescu +L: linux-ker...@vger.kernel.org +S: Maintained +F: drivers/staging/fsl-dpaa2/ethsw + DPT_I2O SCSI RAID DRIVER M: Adaptec OEM Raid Solutions L: linux-s...@vger.kernel.org -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH char-misc 1/1] Drivers: hv: vmbus: Add hooks for per-CPU IRQ
On Sun, Mar 11, 2018 at 08:49:02PM -0700, Michael Kelley wrote: > Add hooks to enable/disable a per-CPU IRQ for VMbus. These hooks > are in the architecture independent setup and shutdown paths for > Hyper-V. They are being added as staging for upcoming code for > Linux guests on Hyper-V on ARM64. The x86/x64 implementation > is null because VMbus interrupts on x86/x64 don't use an IRQ. Please submit this _with_ the new code that uses this "hook". We don't add new apis unless they are actually used. thanks, greg k-h ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] staging: wilc1000: use pre-defined macro is_broadcast_ether_addr
On Mon, Mar 12, 2018 at 02:17:15PM +0530, hariprasath.ela...@gmail.com wrote: > From: Hari Prasath > > Use the kernel pre-defined macro is_broadcast_ether_addr() instead of > doing a memcmp here. > > Signed-off-by: Hari Prasath > --- > drivers/staging/wilc1000/linux_mon.c | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > > diff --git a/drivers/staging/wilc1000/linux_mon.c > b/drivers/staging/wilc1000/linux_mon.c > index bbdfc7a..f93f411 100644 > --- a/drivers/staging/wilc1000/linux_mon.c > +++ b/drivers/staging/wilc1000/linux_mon.c > @@ -27,7 +27,6 @@ static struct net_device *wilc_wfi_mon; /* global monitor > netdev */ > > static u8 srcadd[6]; > static u8 bssid[6]; > -static u8 broadcast[] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; > /** > * @brief WILC_WFI_monitor_rx > * @details > @@ -193,7 +192,7 @@ static netdev_tx_t WILC_WFI_mon_xmit(struct sk_buff *skb, > > skb_pull(skb, rtap_len); > > - if (skb->data[0] == 0xc0 && (!(memcmp(broadcast, &skb->data[4], 6 { > + if (skb->data[0] == 0xc0 && is_broadcast_ether_addr(&skb->data[4])) { > skb2 = dev_alloc_skb(skb->len + sizeof(struct > wilc_wfi_radiotap_cb_hdr)); > if (!skb2) > return -ENOMEM; > -- > 2.10.0.GIT > Kindly discard this patch. I will send a v2 as sent mail ID and signed-off are not matching ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCHv2] staging: wilc1000: use pre-defined macro is_broadcast_ether_addr
From: HariPrasath Elango Use the kernel pre-defined macro is_broadcast_ether_addr() instead of doing a memcmp here. Signed-off-by: HariPrasath Elango --- drivers/staging/wilc1000/linux_mon.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/staging/wilc1000/linux_mon.c b/drivers/staging/wilc1000/linux_mon.c index bbdfc7a..f93f411 100644 --- a/drivers/staging/wilc1000/linux_mon.c +++ b/drivers/staging/wilc1000/linux_mon.c @@ -27,7 +27,6 @@ static struct net_device *wilc_wfi_mon; /* global monitor netdev */ static u8 srcadd[6]; static u8 bssid[6]; -static u8 broadcast[] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; /** * @brief WILC_WFI_monitor_rx * @details @@ -193,7 +192,7 @@ static netdev_tx_t WILC_WFI_mon_xmit(struct sk_buff *skb, skb_pull(skb, rtap_len); - if (skb->data[0] == 0xc0 && (!(memcmp(broadcast, &skb->data[4], 6 { + if (skb->data[0] == 0xc0 && is_broadcast_ether_addr(&skb->data[4])) { skb2 = dev_alloc_skb(skb->len + sizeof(struct wilc_wfi_radiotap_cb_hdr)); if (!skb2) return -ENOMEM; -- 2.10.0.GIT ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
OK
Greetings, Are you capable to handle a profitable transaction valued 15 million Euros?Reply me for more information Ahmed Zama ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 2/2] drivers: android: binder: fixed a brace coding style issue
On Sat, Mar 10, 2018 at 01:16:58PM +0530, Vaibhav Murkute wrote: > Fixed a coding style issue. > This commit log is not the greatest. Say something like "The curly braces aren't needed and checkpatch.pl complains so I removed them." Where is [PATCH 1/2]? regards, dan carpenter ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH v2] staging: vchiq_arm: Clear VLA warning
On Mon, Mar 12, 2018 at 06:58:04AM +0100, Stefan Wahren wrote: > Hi Tobin, > > > "Tobin C. Harding" hat am 12. März 2018 um 06:46 > > geschrieben: > > > > > > On Mon, Mar 12, 2018 at 12:37:53PM +1100, Tobin C. Harding wrote: > > > The kernel would like to have all stack VLA usage removed[1]. The array > > > here is fixed (declared with a const variable) but it appears like a VLA > > > to the compiler. Also, currently we are putting 768 bytes on the > > > stack. This function is only called on the error path so performance is > > > not critical, let's just allocate the memory instead of using the > > > stack. This saves stack space and removes the VLA build warning. > > > > > > kmalloc a buffer for dumping state instead of using the stack. > > > > > > [1]: https://lkml.org/lkml/2018/3/7/621 > > > > > > Signed-off-by: Tobin C. Harding > > > --- > > > > Drop this please, leaks memory. > > except from the leak, did you test this patch on a RPi? > Hm... Yeah. It looks like we're holding a mutex when we call vchiq_check_service() from vchiq_queue_message(). regards, dan carpenter ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 4/4] staging:iio:ad2s1210: Add comments/documentation
On 03/10, Jonathan Cameron wrote: > On Fri, 9 Mar 2018 20:46:40 -0300 > Rodrigo Siqueira wrote: > > > The original code of AD2S1210 does not have documentation for structs > > and register configurations; this difficult the code comprehension. This > > patch adds structs documentation, briefly comments some register > > settings and acronyms, and adds little explanations of some calculation > > found in the code. > > > > Signed-off-by: Rodrigo Siqueira > Various comments inline. > > Only a few of them are about you actual patch - mostly more general. > > I'd look at renaming all those defines to be more consistent. There > is no association between bits of a register and the register at the > moment which will make the code rather error prone. > > Note this is going to be a difficult driver to get out of staging. > There is quite a bit to do and we don't currently have anyone who > has test hardware as far as I know. So brave move ;) Hi Jonathan, After careful reading your email, I believe that is a better idea to divide this kind of work in other patches. So, instead of trying to document the module at once, I will do it step by step in the future patches series; I take note of all your comments. I will put an effort in this module because I think that is an excellent opportunity to learn the IIO subsystem. Finally, I will try to contact Analog Devices; maybe someone can test the module for me. Thanks for all the reviews and comments, I learned a lot with all your explanations :) > Thanks, > > Jonathan > > > --- > > drivers/staging/iio/resolver/ad2s1210.c | 32 > > > > drivers/staging/iio/resolver/ad2s1210.h | 9 - > > 2 files changed, 40 insertions(+), 1 deletion(-) > > > > diff --git a/drivers/staging/iio/resolver/ad2s1210.c > > b/drivers/staging/iio/resolver/ad2s1210.c > > index ac13b99bd9cb..9bb8fd782f5a 100644 > > --- a/drivers/staging/iio/resolver/ad2s1210.c > > +++ b/drivers/staging/iio/resolver/ad2s1210.c > > @@ -24,8 +24,10 @@ > > > > #define DRV_NAME "ad2s1210" > > > > +/* The default value of the control register on power-up */ > > #define AD2S1210_DEF_CONTROL 0x7E > > > > +/* Control Register Bit */ > I would change the defines to make this explicit. > This is a truely odd bit of naming anyway. > #define AD2S1210_ADDRESS 0x80 > #define AD2S1210_DATA 0x00 > and perhaps a > #define AD2S1210_DATA_MASK 0x7F > > would make sense? > > > > #define AD2S1210_MSB_IS_HIGH 0x80 > > #define AD2S1210_MSB_IS_LOW0x7F > > #define AD2S1210_PHASE_LOCK_RANGE_44 0x20 > > @@ -39,14 +41,23 @@ > > > > #define AD2S1210_REG_POSITION 0x80 > > #define AD2S1210_REG_VELOCITY 0x82 > > + > > +/* Loss of Signal (LOS) register address */ > > #define AD2S1210_REG_LOS_THRD 0x88 > > + > > +/* Degradation of Signal (DOS) register address */ > addresses > > > #define AD2S1210_REG_DOS_OVR_THRD 0x89 > > #define AD2S1210_REG_DOS_MIS_THRD 0x8A > > #define AD2S1210_REG_DOS_RST_MAX_THRD 0x8B > > #define AD2S1210_REG_DOS_RST_MIN_THRD 0x8C > > + > > +/* Loss of Tracking (LOT) register address */ > addresses > > > #define AD2S1210_REG_LOT_HIGH_THRD 0x8D > > #define AD2S1210_REG_LOT_LOW_THRD 0x8E > > + > > +/* Excitation Frequency (EXCIT) register address */ > > #define AD2S1210_REG_EXCIT_FREQ0x91 > > + > > #define AD2S1210_REG_CONTROL 0x92 > > #define AD2S1210_REG_SOFT_RESET0xF0 > > #define AD2S1210_REG_FAULT 0xFF > > @@ -69,6 +80,20 @@ enum ad2s1210_mode { > > > > static const unsigned int ad2s1210_resolution_value[] = { 10, 12, 14, 16 }; > > > > +/** > > + * struct ad2s1210_state - device instance specific state. > > + * @pdata: chip model specific constants, gpioin, etc > Except they aren't anything to do with the chip model. This is about > how it is wired not what it is. > > > + * @lock: lock to ensure state is consistent > > + * @sdev: the SPI device for this driver instance > > + * @fclkin:frequency of clock input > > + * @fexcit:excitation frequency > > + * @hysteresis:cache of whether hysteresis is enabled > > + * @old_data: cache of SPI communication after operation > Umm. You got rid of this one in the earlier patch didn't you? > > > + * @resolution:chip resolution could be 10/12/14/16-bit > From reading the datasheet quickly I suspect there is a 'best possible' > resolution given a particular set of controls. I'm not sure we want > to expose this to userspace at all. > > > + * @mode: indicates the operating mode > Where operating mode is what? Comment would be more useful if it > listed them. > > > + * @rx:receive buffer > > + * @tx:transmit buffer > > + */ > > struct ad2s1210_state { > > const struct ad2s1210_platform_data *pdata;
[PATCH] staging: wilc1000: Fix code block alignment
From: HariPrasath Elango Fix the code alignment for a block of code to adhere to coding guidelines Signed-off-by: HariPrasath Elango --- drivers/staging/wilc1000/linux_wlan.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c index fe19bf3..1af3c14 100644 --- a/drivers/staging/wilc1000/linux_wlan.c +++ b/drivers/staging/wilc1000/linux_wlan.c @@ -861,10 +861,10 @@ static int wilc_mac_open(struct net_device *ndev) break; } } - wilc_get_mac_address(vif, mac_add); - netdev_dbg(ndev, "Mac address: %pM\n", mac_add); - memcpy(wl->vif[i]->src_addr, mac_add, ETH_ALEN); + wilc_get_mac_address(vif, mac_add); + netdev_dbg(ndev, "Mac address: %pM\n", mac_add); + memcpy(wl->vif[i]->src_addr, mac_add, ETH_ALEN); memcpy(ndev->dev_addr, wl->vif[i]->src_addr, ETH_ALEN); if (!is_valid_ether_addr(ndev->dev_addr)) { -- 2.10.0.GIT ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] staging: ccree: remove ccree staging copy
On Thu, Mar 8, 2018 at 9:14 AM, Greg Kroah-Hartman wrote: > On Thu, Mar 08, 2018 at 08:44:38AM +, Gilad Ben-Yossef wrote: >> Now when the ccree driver has been accepted into the cryptodev tree >> we can remove the staging tree copy. > > Yeah! Nice job. > >> >> Please note that this commit may cause a merge conflict with the >> cryptodev tree since we needed to disable the staging copy in order >> to get the new copy to compile but the resolution is trivial. >> >> Signed-off-by: Gilad Ben-Yossef >> --- >> drivers/staging/Kconfig |2 - >> drivers/staging/Makefile |1 - >> drivers/staging/ccree/Kconfig| 27 - >> drivers/staging/ccree/Makefile |7 - >> drivers/staging/ccree/TODO | 10 - >> drivers/staging/ccree/cc_aead.c | 2704 >> -- >> drivers/staging/ccree/cc_aead.h | 109 -- >> drivers/staging/ccree/cc_buffer_mgr.c| 1651 -- >> drivers/staging/ccree/cc_buffer_mgr.h| 74 - >> drivers/staging/ccree/cc_cipher.c| 1165 - >> drivers/staging/ccree/cc_cipher.h| 74 - >> drivers/staging/ccree/cc_crypto_ctx.h| 170 -- >> drivers/staging/ccree/cc_debugfs.c | 101 -- >> drivers/staging/ccree/cc_debugfs.h | 32 - >> drivers/staging/ccree/cc_driver.c| 474 -- >> drivers/staging/ccree/cc_driver.h| 194 --- >> drivers/staging/ccree/cc_fips.c | 111 -- >> drivers/staging/ccree/cc_fips.h | 37 - >> drivers/staging/ccree/cc_hash.c | 2296 - >> drivers/staging/ccree/cc_hash.h | 114 -- >> drivers/staging/ccree/cc_host_regs.h | 142 -- >> drivers/staging/ccree/cc_hw_queue_defs.h | 590 --- >> drivers/staging/ccree/cc_ivgen.c | 280 >> drivers/staging/ccree/cc_ivgen.h | 55 - >> drivers/staging/ccree/cc_kernel_regs.h | 167 -- >> drivers/staging/ccree/cc_lli_defs.h | 59 - >> drivers/staging/ccree/cc_pm.c| 122 -- >> drivers/staging/ccree/cc_pm.h| 57 - >> drivers/staging/ccree/cc_request_mgr.c | 713 >> drivers/staging/ccree/cc_request_mgr.h | 51 - >> drivers/staging/ccree/cc_sram_mgr.c | 107 -- >> drivers/staging/ccree/cc_sram_mgr.h | 65 - >> 32 files changed, 11761 deletions(-) >> delete mode 100644 drivers/staging/ccree/Kconfig >> delete mode 100644 drivers/staging/ccree/Makefile >> delete mode 100644 drivers/staging/ccree/TODO >> delete mode 100644 drivers/staging/ccree/cc_aead.c >> delete mode 100644 drivers/staging/ccree/cc_aead.h >> delete mode 100644 drivers/staging/ccree/cc_buffer_mgr.c >> delete mode 100644 drivers/staging/ccree/cc_buffer_mgr.h >> delete mode 100644 drivers/staging/ccree/cc_cipher.c >> delete mode 100644 drivers/staging/ccree/cc_cipher.h >> delete mode 100644 drivers/staging/ccree/cc_crypto_ctx.h >> delete mode 100644 drivers/staging/ccree/cc_debugfs.c >> delete mode 100644 drivers/staging/ccree/cc_debugfs.h >> delete mode 100644 drivers/staging/ccree/cc_driver.c >> delete mode 100644 drivers/staging/ccree/cc_driver.h >> delete mode 100644 drivers/staging/ccree/cc_fips.c >> delete mode 100644 drivers/staging/ccree/cc_fips.h >> delete mode 100644 drivers/staging/ccree/cc_hash.c >> delete mode 100644 drivers/staging/ccree/cc_hash.h >> delete mode 100644 drivers/staging/ccree/cc_host_regs.h >> delete mode 100644 drivers/staging/ccree/cc_hw_queue_defs.h >> delete mode 100644 drivers/staging/ccree/cc_ivgen.c >> delete mode 100644 drivers/staging/ccree/cc_ivgen.h >> delete mode 100644 drivers/staging/ccree/cc_kernel_regs.h >> delete mode 100644 drivers/staging/ccree/cc_lli_defs.h >> delete mode 100644 drivers/staging/ccree/cc_pm.c >> delete mode 100644 drivers/staging/ccree/cc_pm.h >> delete mode 100644 drivers/staging/ccree/cc_request_mgr.c >> delete mode 100644 drivers/staging/ccree/cc_request_mgr.h >> delete mode 100644 drivers/staging/ccree/cc_sram_mgr.c >> delete mode 100644 drivers/staging/ccree/cc_sram_mgr.h >> >> diff --git a/drivers/staging/Kconfig b/drivers/staging/Kconfig >> index e95ab68..7802c26 100644 >> --- a/drivers/staging/Kconfig >> +++ b/drivers/staging/Kconfig >> @@ -114,8 +114,6 @@ source "drivers/staging/greybus/Kconfig" >> >> source "drivers/staging/vc04_services/Kconfig" >> >> -source "drivers/staging/ccree/Kconfig" >> - >> source "drivers/staging/typec/Kconfig" >> >> source "drivers/staging/vboxvideo/Kconfig" >> diff --git a/drivers/staging/Makefile b/drivers/staging/Makefile >> index af8cd6a..56afa21 100644 >> --- a/drivers/staging/Makefile >> +++ b/drivers/staging/Makefile >> @@ -49,6 +49,5 @@ obj-$(CONFIG_MOST) += most/ >> obj-$(CONFIG_KS7010) += ks7010/ >> obj-$(CONFIG_GREYBUS)+= greybus/ >> obj-$(CONFIG_BCM2835_VCHIQ) += vc04_services/ >> -obj-$(CONFIG_CRYPTO_DEV_CCREE) += ccree/ >> obj-$(CONFIG_DRM_VB
[PATCH] staging: wilc1000: Destroy mutex object in deinitialization
From: HariPrasath Elango Destroy the mutex object that is initialized in wlan_init_locks() Signed-off-by: HariPrasath Elango --- drivers/staging/wilc1000/linux_wlan.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c index 1af3c14..38a83bd 100644 --- a/drivers/staging/wilc1000/linux_wlan.c +++ b/drivers/staging/wilc1000/linux_wlan.c @@ -678,6 +678,7 @@ static int wlan_deinit_locks(struct net_device *dev) mutex_destroy(&wilc->hif_cs); mutex_destroy(&wilc->rxq_cs); + mutex_destroy(&wilc->txq_add_to_head_cs); return 0; } -- 2.10.0.GIT ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH v4 2/6] staging: fsl-dpaa2/ethsw: Add Freescale DPAA2 Ethernet Switch driver
On Mon, Mar 12, 2018 at 03:49:51AM -0500, Razvan Stefanescu wrote: > +static irqreturn_t ethsw_irq0_handler(int irq_num, void *arg) > +{ > + return IRQ_WAKE_THREAD; > +} > + > +static int ethsw_setup_irqs(struct fsl_mc_device *sw_dev) > +{ > + struct device *dev = &sw_dev->dev; > + struct ethsw_core *ethsw = dev_get_drvdata(dev); > + u32 mask = DPSW_IRQ_EVENT_LINK_CHANGED; > + struct fsl_mc_device_irq *irq; > + int err; > + > + err = fsl_mc_allocate_irqs(sw_dev); > + if (err) { > + dev_err(dev, "MC irqs allocation failed\n"); > + return err; > + } > + > + if (WARN_ON(sw_dev->obj_desc.irq_count != DPSW_IRQ_NUM)) { > + err = -EINVAL; > + goto free_irq; > + } > + > + err = dpsw_set_irq_enable(ethsw->mc_io, 0, ethsw->dpsw_handle, > + DPSW_IRQ_INDEX_IF, 0); > + if (err) { > + dev_err(dev, "dpsw_set_irq_enable err %d\n", err); > + goto free_irq; > + } > + > + irq = sw_dev->irqs[DPSW_IRQ_INDEX_IF]; > + > + err = devm_request_threaded_irq(dev, irq->msi_desc->irq, > + ethsw_irq0_handler, > + ethsw_irq0_handler_thread, > + IRQF_NO_SUSPEND | IRQF_ONESHOT, > + dev_name(dev), dev); Hi Razvan You can pass NULL instead of ethsw_irq0_handler. Andrew ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH v4 2/6] staging: fsl-dpaa2/ethsw: Add Freescale DPAA2 Ethernet Switch driver
> +static int port_netdevice_event(struct notifier_block *unused, > + unsigned long event, void *ptr) > +{ > + struct net_device *netdev = netdev_notifier_info_to_dev(ptr); > + struct netdev_notifier_changeupper_info *info = ptr; > + struct net_device *upper_dev; > + int err = 0; > + > + if (netdev->netdev_ops != ðsw_port_ops) > + return NOTIFY_DONE; > + > + /* Handle just upper dev link/unlink for the moment */ > + if (event == NETDEV_CHANGEUPPER) { > + upper_dev = info->upper_dev; > + if (netif_is_bridge_master(upper_dev)) { > + if (info->linking) > + err = port_bridge_join(netdev); > + else > + err = port_bridge_leave(netdev); > + } > + } > + > + return notifier_from_errno(err); > +} I could be missing something here, but don't you need to pass to port_bridge_join() which bridge the port is joining. There can be multiple bridges, so you need to ensure the port joins the correct bridge. Andrew ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v4 00/10] posix_clocks: Prepare syscalls for 64 bit time_t conversion
The series is a preparation series for individual architectures to use 64 bit time_t syscalls in compat and 32 bit emulation modes. This is a follow up to the series Arnd Bergmann posted: https://sourceware.org/ml/libc-alpha/2015-05/msg00070.html [1] Thomas, Arnd, this seems ready to be merged now. Can you help get this merged? Big picture is as per the lwn article: https://lwn.net/Articles/643234/ [2] The series is directed at converting posix clock syscalls: clock_gettime, clock_settime, clock_getres and clock_nanosleep to use a new data structure __kernel_timespec at syscall boundaries. __kernel_timespec maintains 64 bit time_t across all execution modes. vdso will be handled as part of each architecture when they enable support for 64 bit time_t. The compat syscalls are repurposed to provide backward compatibility by using them as native syscalls as well for 32 bit architectures. They will continue to use timespec at syscall boundaries. CONFIG_64_BIT_TIME controls whether the syscalls use __kernel_timespec or timespec at syscall boundaries. The series does the following: 1. Enable compat syscalls on 32 bit architectures. 2. Add a new __kernel_timespec type to be used as the data structure for all the new syscalls. 3. Add new config CONFIG_64BIT_TIME(intead of the CONFIG_COMPAT_TIME in [1] and [2] to switch to new definition of __kernel_timespec. It is the same as struct timespec otherwise. 4. Add new CONFIG_32BIT_TIME to conditionally compile compat syscalls. * Changes since v3: * Updated include file ordering * Changes since v2: * Dropped the ARCH_HAS_64BIT_TIME config. * Fixed zeroing out of higher order bits of tv_nsec for real. * Addressed minor review comments from v1. * Changes since v1: * Introduce CONFIG_32BIT_TIME * Fixed zeroing out of higher order bits of tv_nsec * Included Arnd's changes to fix up use of compat headers I decided against using LEGACY_TIME_SYSCALLS to conditionally compile legacy time syscalls such as sys_nanosleep because this will need to enclose compat_sys_nanosleep as well. So, defining it as config LEGACY_TIME_SYSCALLS def_bool 64BIT || !64BIT_TIME will not include compat_sys_nanosleep. We will instead need a new config to exclusively mark legacy syscalls. Deepa Dinamani (10): compat: Make compat helpers independent of CONFIG_COMPAT include: Move compat_timespec/ timeval to compat_time.h compat: enable compat_get/put_timespec64 always arch: introduce CONFIG_64BIT_TIME arch: Introduce CONFIG_COMPAT_32BIT_TIME posix-clocks: Make compat syscalls depend on CONFIG_COMPAT_32BIT_TIME include: Add new y2038 safe __kernel_timespec fix get_timespec64() for y2038 safe compat interfaces change time types to new y2038 safe __kernel_* types nanosleep: change time types to safe __kernel_* types arch/Kconfig | 15 + arch/arm64/include/asm/compat.h| 11 --- arch/arm64/include/asm/stat.h | 1 + arch/arm64/kernel/hw_breakpoint.c | 1 - arch/arm64/kernel/perf_regs.c | 2 +- arch/arm64/kernel/process.c| 1 - arch/mips/include/asm/compat.h | 11 --- arch/mips/kernel/signal32.c| 2 +- arch/parisc/include/asm/compat.h | 11 --- arch/powerpc/include/asm/compat.h | 11 --- arch/powerpc/kernel/asm-offsets.c | 2 +- arch/powerpc/oprofile/backtrace.c | 2 +- arch/s390/hypfs/hypfs_sprp.c | 1 - arch/s390/include/asm/compat.h | 11 --- arch/s390/include/asm/elf.h| 4 +-- arch/s390/kvm/priv.c | 1 - arch/s390/pci/pci_clp.c| 1 - arch/sparc/include/asm/compat.h| 11 --- arch/tile/include/asm/compat.h | 11 --- arch/x86/events/core.c | 2 +- arch/x86/include/asm/compat.h | 11 --- arch/x86/include/asm/ftrace.h | 2 +- arch/x86/include/asm/sys_ia32.h| 2 +- arch/x86/kernel/sys_x86_64.c | 2 +- drivers/s390/block/dasd_ioctl.c| 1 - drivers/s390/char/fs3270.c | 1 - drivers/s390/char/sclp_ctl.c | 1 - drivers/s390/char/vmcp.c | 1 - drivers/s390/cio/chsc_sch.c| 1 - drivers/s390/net/qeth_core_main.c | 2 +- include/linux/compat.h | 11 --- include/linux/compat_time.h| 23 ++ include/linux/restart_block.h | 7 ++-- include/linux/syscalls.h | 12 +++ include/linux/time.h | 4 +-- include/linux/time64.h | 10 +- include/uapi/asm-generic/posix_types.h | 1 + include/uapi/linux/time.h | 7 kernel/compat.c| 52 +- kernel/time/hrtimer.c | 10 -- kernel/time/posix-stubs.c | 12 --- kernel/time/posix-timers.c | 24 ++ kernel/time/time.c | 58 +
[PATCH v4 02/10] include: Move compat_timespec/ timeval to compat_time.h
All the current architecture specific defines for these are the same. Refactor these common defines to a common header file. The new common linux/compat_time.h is also useful as it will eventually be used to hold all the defines that are needed for compat time types that support non y2038 safe types. New architectures need not have to define these new types as they will only use new y2038 safe syscalls. This file can be deleted after y2038 when we stop supporting non y2038 safe syscalls. The patch also requires an operation similar to: git grep "asm/compat\.h" | cut -d ":" -f 1 | xargs -n 1 sed -i -e "s%asm/compat.h%linux/compat.h%g" Cc: a...@kernel.org Cc: b...@kernel.crashing.org Cc: borntrae...@de.ibm.com Cc: catalin.mari...@arm.com Cc: cmetc...@mellanox.com Cc: coh...@redhat.com Cc: da...@davemloft.net Cc: del...@gmx.de Cc: de...@driverdev.osuosl.org Cc: gerald.schae...@de.ibm.com Cc: gre...@linuxfoundation.org Cc: heiko.carst...@de.ibm.com Cc: hoepp...@linux.vnet.ibm.com Cc: h...@zytor.com Cc: j...@parisc-linux.org Cc: j...@linux.vnet.ibm.com Cc: linux-ker...@vger.kernel.org Cc: linux-m...@linux-mips.org Cc: linux-par...@vger.kernel.org Cc: linuxppc-...@lists.ozlabs.org Cc: linux-s...@vger.kernel.org Cc: mark.rutl...@arm.com Cc: mi...@redhat.com Cc: m...@ellerman.id.au Cc: ober...@linux.vnet.ibm.com Cc: oprofile-l...@lists.sf.net Cc: pau...@samba.org Cc: pet...@infradead.org Cc: r...@linux-mips.org Cc: rost...@goodmis.org Cc: r...@kernel.org Cc: schwidef...@de.ibm.com Cc: seb...@linux.vnet.ibm.com Cc: sparcli...@vger.kernel.org Cc: s...@linux.vnet.ibm.com Cc: ubr...@linux.vnet.ibm.com Cc: will.dea...@arm.com Cc: x...@kernel.org Signed-off-by: Arnd Bergmann Signed-off-by: Deepa Dinamani Acked-by: Steven Rostedt (VMware) Acked-by: Catalin Marinas Acked-by: James Hogan Acked-by: Helge Deller --- arch/arm64/include/asm/compat.h | 11 --- arch/arm64/include/asm/stat.h | 1 + arch/arm64/kernel/hw_breakpoint.c | 1 - arch/arm64/kernel/perf_regs.c | 2 +- arch/arm64/kernel/process.c | 1 - arch/mips/include/asm/compat.h| 11 --- arch/mips/kernel/signal32.c | 2 +- arch/parisc/include/asm/compat.h | 11 --- arch/powerpc/include/asm/compat.h | 11 --- arch/powerpc/kernel/asm-offsets.c | 2 +- arch/powerpc/oprofile/backtrace.c | 2 +- arch/s390/hypfs/hypfs_sprp.c | 1 - arch/s390/include/asm/compat.h| 11 --- arch/s390/include/asm/elf.h | 4 ++-- arch/s390/kvm/priv.c | 1 - arch/s390/pci/pci_clp.c | 1 - arch/sparc/include/asm/compat.h | 11 --- arch/tile/include/asm/compat.h| 11 --- arch/x86/events/core.c| 2 +- arch/x86/include/asm/compat.h | 11 --- arch/x86/include/asm/ftrace.h | 2 +- arch/x86/include/asm/sys_ia32.h | 2 +- arch/x86/kernel/sys_x86_64.c | 2 +- drivers/s390/block/dasd_ioctl.c | 1 - drivers/s390/char/fs3270.c| 1 - drivers/s390/char/sclp_ctl.c | 1 - drivers/s390/char/vmcp.c | 1 - drivers/s390/cio/chsc_sch.c | 1 - drivers/s390/net/qeth_core_main.c | 2 +- include/linux/compat.h| 1 + include/linux/compat_time.h | 19 +++ 31 files changed, 32 insertions(+), 109 deletions(-) create mode 100644 include/linux/compat_time.h diff --git a/arch/arm64/include/asm/compat.h b/arch/arm64/include/asm/compat.h index c00c62e1a4a3..0030f79808b3 100644 --- a/arch/arm64/include/asm/compat.h +++ b/arch/arm64/include/asm/compat.h @@ -34,7 +34,6 @@ typedef u32compat_size_t; typedef s32compat_ssize_t; -typedef s32compat_time_t; typedef s32compat_clock_t; typedef s32compat_pid_t; typedef u16__compat_uid_t; @@ -66,16 +65,6 @@ typedef u32 compat_ulong_t; typedef u64compat_u64; typedef u32compat_uptr_t; -struct compat_timespec { - compat_time_t tv_sec; - s32 tv_nsec; -}; - -struct compat_timeval { - compat_time_t tv_sec; - s32 tv_usec; -}; - struct compat_stat { #ifdef __AARCH64EB__ short st_dev; diff --git a/arch/arm64/include/asm/stat.h b/arch/arm64/include/asm/stat.h index 15e35598ac40..eab738019707 100644 --- a/arch/arm64/include/asm/stat.h +++ b/arch/arm64/include/asm/stat.h @@ -20,6 +20,7 @@ #ifdef CONFIG_COMPAT +#include #include /* diff --git a/arch/arm64/kernel/hw_breakpoint.c b/arch/arm64/kernel/hw_breakpoint.c index 74bb56f656ef..413dbe530da8 100644 --- a/arch/arm64/kernel/hw_breakpoint.c +++ b/arch/arm64/kernel/hw_breakpoint.c @@ -30,7 +30,6 @@ #include #include -#include #include #include #include diff --git a/arch/arm64/kernel/perf_regs.c b/arch/arm64/kernel/perf_regs.c index 1d091d048d04..0bbac612146e 100644 --- a/arch/arm64/kernel/perf_regs.c +++ b/arch/arm64/kernel/perf_regs.c @@ -1,11 +1,11 @@ // SPDX-License-Identifier: GPL-2.0
Re: [PATCH v3 02/10] include: Move compat_timespec/ timeval to compat_time.h
I posted the updated series. I fixed up the order of include files where I could find some order. There have been other commits that used scripts to do such replacements and have already stomped on the order. For example: commit 7c0f6ba682b9c7632072ffbedf8d328c8f3c42ba Author: Linus Torvalds Replace with globally -Deepa On Tue, Mar 6, 2018 at 2:58 PM, Deepa Dinamani wrote: > On Tue, Mar 6, 2018 at 4:48 AM, Christian Borntraeger > wrote: >> >> >> On 03/06/2018 01:46 PM, Arnd Bergmann wrote: >>> On Mon, Mar 5, 2018 at 10:30 AM, Christian Borntraeger >>> wrote: On 01/16/2018 03:18 AM, Deepa Dinamani wrote: > All the current architecture specific defines for these > are the same. Refactor these common defines to a common > header file. > > The new common linux/compat_time.h is also useful as it > will eventually be used to hold all the defines that > are needed for compat time types that support non y2038 > safe types. New architectures need not have to define these > new types as they will only use new y2038 safe syscalls. > This file can be deleted after y2038 when we stop supporting > non y2038 safe syscalls. You are now include a from several asm files ( arch/arm64/include/asm/stat.h arch/s390/include/asm/elf.h arch/x86/include/asm/ftrace.h arch/x86/include/asm/sys_ia32.h ) It works, and it is done in many places, but it looks somewhat weird. Would it make sense to have an asm-generic/compate-time.h instead? Asking for opinions here. >>> >>> I don't think we have such a rule. If a header file is common to all >>> architectures (i.e. no architecture uses a different implementation), >>> it should be in include/linux rather than include/asm-generic, regardless >>> of whether it can be used by assembler files or not. >>> > --- a/drivers/s390/net/qeth_core_main.c > +++ b/drivers/s390/net/qeth_core_main.c > @@ -32,7 +32,7 @@ > #include > #include > #include > -#include > +#include > #include > #include > #include Can you move that into the other includes (where all the other includes are. >>> >>> Good catch, this is definitely a rule we have ;-) >> >> FWIW, this was also broken for >> arch/x86/include/asm/sys_ia32.h > > The reason that this was done this way is because of the sed script > mentioned in the commit text. > I was trying to make minimal change apart from the script so that we > don't have other changes like moving the lines to keep the patch > simpler. > I will fix this by hand since this is preferred. > I will post an update. > > -Deepa ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 1/3] staging:iio:ad2s1210: Add channel for fclkin and fexcit
The ad2s1210 does not contain any channel for the fclkin and fexcit. As a result, it uses IIO_DEVICE_ATTR to expose this information. This patch adds one channel for fclkin and another for fexcit. It also adds an enum to easily address the correct channel. Signed-off-by: Rodrigo Siqueira --- drivers/staging/iio/resolver/ad2s1210.c | 43 ++--- 1 file changed, 29 insertions(+), 14 deletions(-) diff --git a/drivers/staging/iio/resolver/ad2s1210.c b/drivers/staging/iio/resolver/ad2s1210.c index ac13b99bd9cb..28c3fd439663 100644 --- a/drivers/staging/iio/resolver/ad2s1210.c +++ b/drivers/staging/iio/resolver/ad2s1210.c @@ -67,6 +67,11 @@ enum ad2s1210_mode { MOD_RESERVED, }; +enum ad2s1210_frequency_channel { + FCLKIN = 0, + FEXCIT, +}; + static const unsigned int ad2s1210_resolution_value[] = { 10, 12, 14, 16 }; struct ad2s1210_state { @@ -88,6 +93,30 @@ static const int ad2s1210_mode_vals[4][2] = { [MOD_CONFIG] = { 1, 0 }, }; +static const struct iio_chan_spec ad2s1210_channels[] = { + { + .type = IIO_ANGL, + .indexed = 1, + .channel = 0, + .info_mask_separate = BIT(IIO_CHAN_INFO_RAW), + }, { + .type = IIO_ANGL_VEL, + .indexed = 1, + .channel = 0, + .info_mask_separate = BIT(IIO_CHAN_INFO_RAW), + }, { + .type = IIO_CHAN_INFO_FREQUENCY, + .indexed = 1, + .channel = FCLKIN, + .info_mask_separate = BIT(IIO_CHAN_INFO_RAW), + }, { + .type = IIO_CHAN_INFO_FREQUENCY, + .indexed = 1, + .channel = FEXCIT, + .info_mask_separate = BIT(IIO_CHAN_INFO_RAW), + }, +}; + static inline void ad2s1210_set_mode(enum ad2s1210_mode mode, struct ad2s1210_state *st) { @@ -552,20 +581,6 @@ static IIO_DEVICE_ATTR(lot_low_thrd, 0644, ad2s1210_show_reg, ad2s1210_store_reg, AD2S1210_REG_LOT_LOW_THRD); -static const struct iio_chan_spec ad2s1210_channels[] = { - { - .type = IIO_ANGL, - .indexed = 1, - .channel = 0, - .info_mask_separate = BIT(IIO_CHAN_INFO_RAW), - }, { - .type = IIO_ANGL_VEL, - .indexed = 1, - .channel = 0, - .info_mask_separate = BIT(IIO_CHAN_INFO_RAW), - } -}; - static struct attribute *ad2s1210_attributes[] = { &iio_dev_attr_fclkin.dev_attr.attr, &iio_dev_attr_fexcit.dev_attr.attr, -- 2.16.2 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 0/3] staging:iio:ad2s1210: Rework read/write operation for fclkin and fexin
This patchset changes the way that frequency of clock input (fclkin) and the excitation frequency (fexcit) are exposed to the userspace. The original code uses the IIO_DEVICE_ATTR to export the configuration of fclkin and fexcit to the userspace which is not in agreement with the current ABI. This patchset adds one channel per clock configuration, updating the read_raw function by adding a handler for the new channels, and introduces the write_raw function. Furthermore, this patchset removes the legacy code responsible for the read and write operation related to fclkin and fexcit. Finally, this patchset uses parts of the original code for handling frequency configuration as an attempt to avoid problems. Rodrigo Siqueira (3): staging:iio:ad2s1210: Add channel for fclkin and fexcit staging:iio:ad2s1210: Add frequency handler in read_raw staging:iio:ad2s1210: Add write_raw to handle frequency drivers/staging/iio/resolver/ad2s1210.c | 201 1 file changed, 102 insertions(+), 99 deletions(-) -- 2.16.2 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 2/3] staging:iio:ad2s1210: Add frequency handler in read_raw
Read data from fclkin and fexcit does not utilize the ad2s1210_read_raw function. This patch, append the required handler in the ad2s1210_read_raw to return the correct value. Also, this patch removes the legacy code related to the read function Signed-off-by: Rodrigo Siqueira --- drivers/staging/iio/resolver/ad2s1210.c | 45 +++-- 1 file changed, 20 insertions(+), 25 deletions(-) diff --git a/drivers/staging/iio/resolver/ad2s1210.c b/drivers/staging/iio/resolver/ad2s1210.c index 28c3fd439663..27a42ed10fcd 100644 --- a/drivers/staging/iio/resolver/ad2s1210.c +++ b/drivers/staging/iio/resolver/ad2s1210.c @@ -210,15 +210,6 @@ static inline int ad2s1210_soft_reset(struct ad2s1210_state *st) return ad2s1210_config_write(st, 0x0); } -static ssize_t ad2s1210_show_fclkin(struct device *dev, - struct device_attribute *attr, - char *buf) -{ - struct ad2s1210_state *st = iio_priv(dev_to_iio_dev(dev)); - - return sprintf(buf, "%u\n", st->fclkin); -} - static ssize_t ad2s1210_store_fclkin(struct device *dev, struct device_attribute *attr, const char *buf, @@ -249,15 +240,6 @@ static ssize_t ad2s1210_store_fclkin(struct device *dev, return ret < 0 ? ret : len; } -static ssize_t ad2s1210_show_fexcit(struct device *dev, - struct device_attribute *attr, - char *buf) -{ - struct ad2s1210_state *st = iio_priv(dev_to_iio_dev(dev)); - - return sprintf(buf, "%u\n", st->fexcit); -} - static ssize_t ad2s1210_store_fexcit(struct device *dev, struct device_attribute *attr, const char *buf, size_t len) @@ -486,7 +468,7 @@ static int ad2s1210_read_raw(struct iio_dev *indio_dev, struct iio_chan_spec const *chan, int *val, int *val2, -long m) +long mask) { struct ad2s1210_state *st = iio_priv(indio_dev); u16 negative; @@ -535,23 +517,36 @@ static int ad2s1210_read_raw(struct iio_dev *indio_dev, *val = vel; ret = IIO_VAL_INT; break; + case IIO_CHAN_INFO_FREQUENCY: + ret = IIO_VAL_INT; + switch (chan->channel) { + case FCLKIN: + *val = st->fclkin; + goto unlock_mutex; + case FEXCIT: + *val = st->fexcit; + goto unlock_mutex; + default: + ret = -EINVAL; + goto unlock_mutex; + } + break; default: - mutex_unlock(&st->lock); - return -EINVAL; + ret = -EINVAL; + goto unlock_mutex; } error_ret: gpio_set_value(st->pdata->sample, 1); /* delay (2 * tck + 20) nano seconds */ udelay(1); +unlock_mutex: mutex_unlock(&st->lock); return ret; } -static IIO_DEVICE_ATTR(fclkin, 0644, - ad2s1210_show_fclkin, ad2s1210_store_fclkin, 0); -static IIO_DEVICE_ATTR(fexcit, 0644, - ad2s1210_show_fexcit,ad2s1210_store_fexcit, 0); +static IIO_DEVICE_ATTR(fclkin, 0644, NULL, ad2s1210_store_fclkin, 0); +static IIO_DEVICE_ATTR(fexcit, 0644, NULL, ad2s1210_store_fexcit, 0); static IIO_DEVICE_ATTR(control, 0644, ad2s1210_show_control, ad2s1210_store_control, 0); static IIO_DEVICE_ATTR(bits, 0644, -- 2.16.2 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 3/3] staging:iio:ad2s1210: Add write_raw to handle frequency
The write interface of AD2S1210 utilizes IIO_DEVICE_ATTR, which violate the official IIO ABI. This patch, add the write_raw function responsible for handling the fclkin and fexcit channel; also it removes the use of IIO_DEVICE_ATTR for fclkin and fexcit. Signed-off-by: Rodrigo Siqueira --- drivers/staging/iio/resolver/ad2s1210.c | 117 +++- 1 file changed, 55 insertions(+), 62 deletions(-) diff --git a/drivers/staging/iio/resolver/ad2s1210.c b/drivers/staging/iio/resolver/ad2s1210.c index 27a42ed10fcd..ea6ade4e563c 100644 --- a/drivers/staging/iio/resolver/ad2s1210.c +++ b/drivers/staging/iio/resolver/ad2s1210.c @@ -60,6 +60,8 @@ #define AD2S1210_DEF_EXCIT 1 +#define ERROR_MESSAGE "ad2s1210: %s out of range\n" + enum ad2s1210_mode { MOD_POS = 0, MOD_VEL, @@ -210,64 +212,6 @@ static inline int ad2s1210_soft_reset(struct ad2s1210_state *st) return ad2s1210_config_write(st, 0x0); } -static ssize_t ad2s1210_store_fclkin(struct device *dev, -struct device_attribute *attr, -const char *buf, -size_t len) -{ - struct ad2s1210_state *st = iio_priv(dev_to_iio_dev(dev)); - unsigned int fclkin; - int ret; - - ret = kstrtouint(buf, 10, &fclkin); - if (ret) - return ret; - if (fclkin < AD2S1210_MIN_CLKIN || fclkin > AD2S1210_MAX_CLKIN) { - dev_err(dev, "ad2s1210: fclkin out of range\n"); - return -EINVAL; - } - - mutex_lock(&st->lock); - st->fclkin = fclkin; - - ret = ad2s1210_update_frequency_control_word(st); - if (ret < 0) - goto error_ret; - ret = ad2s1210_soft_reset(st); -error_ret: - mutex_unlock(&st->lock); - - return ret < 0 ? ret : len; -} - -static ssize_t ad2s1210_store_fexcit(struct device *dev, -struct device_attribute *attr, -const char *buf, size_t len) -{ - struct ad2s1210_state *st = iio_priv(dev_to_iio_dev(dev)); - unsigned int fexcit; - int ret; - - ret = kstrtouint(buf, 10, &fexcit); - if (ret < 0) - return ret; - if (fexcit < AD2S1210_MIN_EXCIT || fexcit > AD2S1210_MAX_EXCIT) { - dev_err(dev, - "ad2s1210: excitation frequency out of range\n"); - return -EINVAL; - } - mutex_lock(&st->lock); - st->fexcit = fexcit; - ret = ad2s1210_update_frequency_control_word(st); - if (ret < 0) - goto error_ret; - ret = ad2s1210_soft_reset(st); -error_ret: - mutex_unlock(&st->lock); - - return ret < 0 ? ret : len; -} - static ssize_t ad2s1210_show_control(struct device *dev, struct device_attribute *attr, char *buf) @@ -545,8 +489,58 @@ static int ad2s1210_read_raw(struct iio_dev *indio_dev, return ret; } -static IIO_DEVICE_ATTR(fclkin, 0644, NULL, ad2s1210_store_fclkin, 0); -static IIO_DEVICE_ATTR(fexcit, 0644, NULL, ad2s1210_store_fexcit, 0); +static int ad2s1210_write_raw(struct iio_dev *indio_dev, + struct iio_chan_spec const *chan, int val, + int val2, long mask) +{ + struct ad2s1210_state *st = iio_priv(indio_dev); + unsigned int clk = val; + int ret; + + switch (mask) { + case IIO_CHAN_INFO_FREQUENCY: + switch (chan->channel) { + case FCLKIN: + if (clk < AD2S1210_MIN_CLKIN || + clk > AD2S1210_MAX_CLKIN) { + dev_err(&indio_dev->dev, ERROR_MESSAGE, + "fclkin"); + ret = -EINVAL; + goto error_ret; + } + mutex_lock(&st->lock); + st->fclkin = clk; + break; + case FEXCIT: + if (clk < AD2S1210_MIN_EXCIT || + clk > AD2S1210_MAX_EXCIT) { + dev_err(&indio_dev->dev, ERROR_MESSAGE, + "excitation frequency"); + ret = -EINVAL; + goto error_ret; + } + mutex_lock(&st->lock); + st->fexcit = clk; + break; + default: + ret = -EINVAL; + goto error_ret; + } + break; + default: + ret = -EINVAL; + goto error_ret; + } + ret = ad2s1210_update_frequency_control_word(st); + if (ret < 0) + goto error_unlock_mutex;
Plan to move cdc:ad7746 driver out of staging
Hi, This is my plan for moving out the ad7746 driver out of staging. I have some specific questions that would be really helpful if someone can point me in the right direction to go. 1. Pick up on David's clean-up patch. Finish cleaning CHECKs from checkpatch.pl if possible. 2. Reorder includes alphabetically. 3. Reorder some variable declarations in an inverse-pyramid scheme. 4. Fix sysfs attrs naming to comply with the ABI, e.g.: in_capacitance0_calibbias_calibration -> in_capacitance0_calibbias 5. Add documentation to the {cap,vt}_filter_rate tables and to the processed info read. There are some magic numbers out there, I will read the datasheet and explain the math that I consider appropiate. 6. There are a few too many defines that are not used at all but they do follow the datasheet. I don't know if there are plans to keep adding functionalities to this driver or if I should just remove them. 8. EXCLVL is duplicated. There's a simple macro in ad7746.c and some defines in ad7746.h. The latter are not used anywhere in the code. Remove them. 7. Move the struct ad7746_platform_data to include/linux/iio. As mentioned in earlier mails, I will avoid adding new features as I have no access to the hardware and, therefore, could not test it. I guess that'd be all. If I'm missing something I would be really grateful if you can let me know or give me some pointers where to look at. Cheers, Hernán ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging: comedi: adl_pci6208: remove redundant initialization of 'val'
From: Colin Ian King Variable 'val' is initialized with a value that is never read, it is updated with a new value again after intitialization. Remove the redundant initialization and move the declaration and assignment into the scope of the for-loop. Cleans up clang warning: drivers/staging/comedi/drivers/adl_pci6208.c:61:15: warning: Value stored to 'val' during its initialization is never read Signed-off-by: Colin Ian King --- drivers/staging/comedi/drivers/adl_pci6208.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/staging/comedi/drivers/adl_pci6208.c b/drivers/staging/comedi/drivers/adl_pci6208.c index d39b4eabce8d..e21840e9002d 100644 --- a/drivers/staging/comedi/drivers/adl_pci6208.c +++ b/drivers/staging/comedi/drivers/adl_pci6208.c @@ -58,12 +58,11 @@ static int pci6208_ao_insn_write(struct comedi_device *dev, unsigned int *data) { unsigned int chan = CR_CHAN(insn->chanspec); - unsigned int val = s->readback[chan]; int ret; int i; for (i = 0; i < insn->n; i++) { - val = data[i]; + unsigned int val = data[i]; /* D/A transfer rate is 2.2us */ ret = comedi_timeout(dev, s, insn, pci6208_ao_eoc, 0); -- 2.15.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
RE: [PATCH v4 2/6] staging: fsl-dpaa2/ethsw: Add Freescale DPAA2 Ethernet Switch driver
> -Original Message- > From: Andrew Lunn [mailto:and...@lunn.ch] > Sent: Monday, March 12, 2018 4:37 PM > To: Razvan Stefanescu > Cc: gre...@linuxfoundation.org; de...@driverdev.osuosl.org; linux- > ker...@vger.kernel.org; net...@vger.kernel.org; Alexander Graf > ; a...@arndb.de; Alexandru Marginean > ; Ruxandra Ioana Ciocoi Radulescu > ; Ioana Ciornei ; > Laurentiu Tudor ; stuyo...@gmail.com > Subject: Re: [PATCH v4 2/6] staging: fsl-dpaa2/ethsw: Add Freescale DPAA2 > Ethernet Switch driver > > > +static int port_netdevice_event(struct notifier_block *unused, > > + unsigned long event, void *ptr) > > +{ > > + struct net_device *netdev = netdev_notifier_info_to_dev(ptr); > > + struct netdev_notifier_changeupper_info *info = ptr; > > + struct net_device *upper_dev; > > + int err = 0; > > + > > + if (netdev->netdev_ops != ðsw_port_ops) > > + return NOTIFY_DONE; > > + > > + /* Handle just upper dev link/unlink for the moment */ > > + if (event == NETDEV_CHANGEUPPER) { > > + upper_dev = info->upper_dev; > > + if (netif_is_bridge_master(upper_dev)) { > > + if (info->linking) > > + err = port_bridge_join(netdev); > > + else > > + err = port_bridge_leave(netdev); > > + } > > + } > > + > > + return notifier_from_errno(err); > > +} > > I could be missing something here, but don't you need to pass to > port_bridge_join() which bridge the port is joining. There can be > multiple bridges, so you need to ensure the port joins the correct > bridge. > Thank you for noticing this. I'll add proper checks in next version. Razvan > Andrew ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging: rtl8723bs: core: rtw_cmd: remove unnecessary initialization
Clean up checkpatch error: ERROR: do not initialise globals to 0 Signed-off-by: Ji-Hun Kim --- drivers/staging/rtl8723bs/core/rtw_cmd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/rtl8723bs/core/rtw_cmd.c b/drivers/staging/rtl8723bs/core/rtw_cmd.c index af0a9e0..9e132f9 100644 --- a/drivers/staging/rtl8723bs/core/rtw_cmd.c +++ b/drivers/staging/rtl8723bs/core/rtw_cmd.c @@ -1742,7 +1742,7 @@ u8 rtw_ps_cmd(struct adapter *padapter) return res; } -u32 g_wait_hiq_empty = 0; +u32 g_wait_hiq_empty; static void rtw_chk_hi_queue_hdl(struct adapter *padapter) { -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging: wilc1000: use kmemdup instead of kmalloc and memcpy
From: HariPrasath Elango Kmalloc followed by memcpy can be replaced by kmemdup. Signed-off-by: HariPrasath Elango --- drivers/staging/wilc1000/linux_mon.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/staging/wilc1000/linux_mon.c b/drivers/staging/wilc1000/linux_mon.c index f93f411..c6fd6b3 100644 --- a/drivers/staging/wilc1000/linux_mon.c +++ b/drivers/staging/wilc1000/linux_mon.c @@ -146,7 +146,7 @@ static int mon_mgmt_tx(struct net_device *dev, const u8 *buf, size_t len) if (!mgmt_tx) return -ENOMEM; - mgmt_tx->buff = kmalloc(len, GFP_ATOMIC); + mgmt_tx->buff = kmemdup(buf, len, GFP_ATOMIC); if (!mgmt_tx->buff) { kfree(mgmt_tx); return -ENOMEM; @@ -154,7 +154,6 @@ static int mon_mgmt_tx(struct net_device *dev, const u8 *buf, size_t len) mgmt_tx->size = len; - memcpy(mgmt_tx->buff, buf, len); wilc_wlan_txq_add_mgmt_pkt(dev, mgmt_tx, mgmt_tx->buff, mgmt_tx->size, mgmt_tx_complete); -- 2.10.0.GIT ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging: ks7010: replace DPRINTK traces in favour of preferred netdev_*
This patch removes custom defined DPRINTK macro and replaces all the associated debug and other traces for preferred ones netdev_*. Signed-off-by: Sergio Paracuellos --- drivers/staging/ks7010/Makefile | 1 - drivers/staging/ks7010/ks7010_sdio.c | 146 +++ drivers/staging/ks7010/ks_hostif.c | 222 ++- drivers/staging/ks7010/ks_wlan.h | 10 -- drivers/staging/ks7010/ks_wlan_net.c | 81 + 5 files changed, 180 insertions(+), 280 deletions(-) diff --git a/drivers/staging/ks7010/Makefile b/drivers/staging/ks7010/Makefile index 69fcf8d..07dc16c 100644 --- a/drivers/staging/ks7010/Makefile +++ b/drivers/staging/ks7010/Makefile @@ -1,4 +1,3 @@ obj-$(CONFIG_KS7010) += ks7010.o -ccflags-y += -DKS_WLAN_DEBUG=0 ks7010-y:= michael_mic.o ks_hostif.o ks_wlan_net.o ks7010_sdio.o diff --git a/drivers/staging/ks7010/ks7010_sdio.c b/drivers/staging/ks7010/ks7010_sdio.c index 7de78d1..5451c04 100644 --- a/drivers/staging/ks7010/ks7010_sdio.c +++ b/drivers/staging/ks7010/ks7010_sdio.c @@ -112,22 +112,20 @@ static void ks_wlan_hw_sleep_doze_request(struct ks_wlan_private *priv) { int ret; - DPRINTK(4, "\n"); - /* clear request */ atomic_set(&priv->sleepstatus.doze_request, 0); if (atomic_read(&priv->sleepstatus.status) == 0) { ret = ks7010_sdio_writeb(priv, GCR_B, GCR_B_DOZE); if (ret) { - DPRINTK(1, " error : GCR_B\n"); + netdev_err(priv->net_dev, " error : GCR_B\n"); goto set_sleep_mode; } - DPRINTK(3, "sleep_mode=SLP_SLEEP\n"); + netdev_dbg(priv->net_dev, "sleep_mode=SLP_SLEEP\n"); atomic_set(&priv->sleepstatus.status, 1); priv->last_doze = jiffies; } else { - DPRINTK(1, "sleep_mode=%d\n", priv->sleep_mode); + netdev_dbg(priv->net_dev, "sleep_mode=%d\n", priv->sleep_mode); } set_sleep_mode: @@ -138,23 +136,21 @@ static void ks_wlan_hw_sleep_wakeup_request(struct ks_wlan_private *priv) { int ret; - DPRINTK(4, "\n"); - /* clear request */ atomic_set(&priv->sleepstatus.wakeup_request, 0); if (atomic_read(&priv->sleepstatus.status) == 1) { ret = ks7010_sdio_writeb(priv, WAKEUP, WAKEUP_REQ); if (ret) { - DPRINTK(1, " error : WAKEUP\n"); + netdev_err(priv->net_dev, " error : WAKEUP\n"); goto set_sleep_mode; } - DPRINTK(4, "wake up : WAKEUP\n"); + netdev_dbg(priv->net_dev, "wake up : WAKEUP\n"); atomic_set(&priv->sleepstatus.status, 0); priv->last_wakeup = jiffies; ++priv->wakeup_count; } else { - DPRINTK(1, "sleep_mode=%d\n", priv->sleep_mode); + netdev_dbg(priv->net_dev, "sleep_mode=%d\n", priv->sleep_mode); } set_sleep_mode: @@ -165,18 +161,17 @@ void ks_wlan_hw_wakeup_request(struct ks_wlan_private *priv) { int ret; - DPRINTK(4, "\n"); if (atomic_read(&priv->psstatus.status) == PS_SNOOZE) { ret = ks7010_sdio_writeb(priv, WAKEUP, WAKEUP_REQ); if (ret) - DPRINTK(1, " error : WAKEUP\n"); + netdev_err(priv->net_dev, " error : WAKEUP\n"); else - DPRINTK(4, "wake up : WAKEUP\n"); + netdev_dbg(priv->net_dev, "wake up : WAKEUP\n"); priv->last_wakeup = jiffies; ++priv->wakeup_count; } else { - DPRINTK(1, "psstatus=%d\n", + netdev_dbg(priv->net_dev, "psstatus=%d\n", atomic_read(&priv->psstatus.status)); } } @@ -201,7 +196,7 @@ static void _ks_wlan_hw_power_save(struct ks_wlan_private *priv) if (atomic_read(&priv->psstatus.status) == PS_SNOOZE) return; - DPRINTK(5, "\npsstatus.status=%d\npsstatus.confirm_wait=%d\npsstatus.snooze_guard=%d\ncnt_txqbody=%d\n", + netdev_dbg(priv->net_dev, "\npsstatus.status=%d\npsstatus.confirm_wait=%d\npsstatus.snooze_guard=%d\ncnt_txqbody=%d\n", atomic_read(&priv->psstatus.status), atomic_read(&priv->psstatus.confirm_wait), atomic_read(&priv->psstatus.snooze_guard), @@ -216,7 +211,7 @@ static void _ks_wlan_hw_power_save(struct ks_wlan_private *priv) ret = ks7010_sdio_readb(priv, INT_PENDING, &byte); if (ret) { - DPRINTK(1, " error : INT_PENDING\n"); + netdev_err(priv->net_dev, " error : INT_PENDING\n"); goto queue_delayed_work; } if (byte) @@ -224,11 +219,11 @@ static void _ks_wlan_hw_power_save(struct ks_wlan_private *priv)