[PATCH] staging: emxx_udc: remove incorrect __init annotations

2016-12-16 Thread Arnd Bergmann
The probe function is not marked __init, but some other functions
are. This leads to a warning on older compilers (e.g. gcc-4.3),
and can cause executing freed memory when built with those
compilers:

WARNING: drivers/staging/emxx_udc/emxx_udc.o(.text+0x2d78): Section mismatch in 
reference from the function nbu2ss_drv_probe() to the function 
.init.text:nbu2ss_drv_contest_init()

This removes the annotations.

Fixes: 33aa8d45a4fe ("staging: emxx_udc: Add Emma Mobile USB Gadget driver")
Signed-off-by: Arnd Bergmann 
---
 drivers/staging/emxx_udc/emxx_udc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/emxx_udc/emxx_udc.c 
b/drivers/staging/emxx_udc/emxx_udc.c
index 3f42fa8b0bf3..4a3da2406f48 100644
--- a/drivers/staging/emxx_udc/emxx_udc.c
+++ b/drivers/staging/emxx_udc/emxx_udc.c
@@ -3137,7 +3137,7 @@ static const struct {
 };
 
 /*-*/
-static void __init nbu2ss_drv_ep_init(struct nbu2ss_udc *udc)
+static void nbu2ss_drv_ep_init(struct nbu2ss_udc *udc)
 {
int i;
 
@@ -3168,7 +3168,7 @@ static void __init nbu2ss_drv_ep_init(struct nbu2ss_udc 
*udc)
 
 /*-*/
 /* platform_driver */
-static int __init nbu2ss_drv_contest_init(
+static int nbu2ss_drv_contest_init(
struct platform_device *pdev,
struct nbu2ss_udc *udc)
 {
-- 
2.9.0

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] staging : lustre : Remove braces from single-line body.

2016-12-16 Thread Tabrez khan
Remove unnecessary braces {} for single while statement.
This warning is found using checkpatch.pl.

Signed-off-by: Tabrez khan 
---
 drivers/staging/lustre/lustre/obdclass/cl_io.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/lustre/lustre/obdclass/cl_io.c 
b/drivers/staging/lustre/lustre/obdclass/cl_io.c
index bc4b7b6..2daede8 100644
--- a/drivers/staging/lustre/lustre/obdclass/cl_io.c
+++ b/drivers/staging/lustre/lustre/obdclass/cl_io.c
@@ -1371,9 +1371,9 @@ int cl_sync_io_wait(const struct lu_env *env, struct 
cl_sync_io *anchor,
LASSERT(atomic_read(&anchor->csi_sync_nr) == 0);
 
/* wait until cl_sync_io_note() has done wakeup */
-   while (unlikely(atomic_read(&anchor->csi_barrier) != 0)) {
+   while (unlikely(atomic_read(&anchor->csi_barrier) != 0))
cpu_relax();
-   }
+
 
return rc;
 }
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


RE: [PATCH 3/3] hv_netvsc: Implement VF matching based on serial numbers

2016-12-16 Thread Haiyang Zhang


> -Original Message-
> From: KY Srinivasan
> Sent: Thursday, December 15, 2016 8:11 PM
> To: Stephen Hemminger ; Greg KH
> 
> Cc: o...@aepfle.de; jasow...@redhat.com; linux-ker...@vger.kernel.org;
> bjorn.helg...@gmail.com; a...@canonical.com; de...@linuxdriverproject.org;
> leann.ogasaw...@canonical.com; Haiyang Zhang 
> Subject: RE: [PATCH 3/3] hv_netvsc: Implement VF matching based on
> serial numbers
> 
> 
> 
> > -Original Message-
> > From: devel [mailto:driverdev-devel-boun...@linuxdriverproject.org] On
> > Behalf Of Stephen Hemminger
> > Sent: Wednesday, December 14, 2016 3:52 PM
> > To: Greg KH 
> > Cc: o...@aepfle.de; jasow...@redhat.com; linux-ker...@vger.kernel.org;
> > bjorn.helg...@gmail.com; a...@canonical.com;
> > de...@linuxdriverproject.org; leann.ogasaw...@canonical.com; Haiyang
> > Zhang 
> > Subject: Re: [PATCH 3/3] hv_netvsc: Implement VF matching based on
> serial
> > numbers
> >
> > Normally, that would work but in this case we have one driver (netvsc)
> > which is managing another driver which is unaware of Hyper-V or netvsc
> > drivers existence.  The callback is happening in netvsc driver and it
> > needs to say "hey I know that SR-IOV device, it is associated with my
> > network device". This problem is how to know that N is associated with
> > V? The V device has to be a network device, that is easy. But then it
> > also has to be a PCI device, not to bad. But then the netvsc code
> > is matching based on hyper-V only PCI bus metadata (the serial #).
> >
> > The Microsoft developers made the rational decision not to go
> modifying
> > all the possible SR-IOV network devices from Intel and Mellanox to add
> > the functionality there. That would have been much worse.
> >
> > Maybe, rather than trying to do the management in the kernel it
> > could have been done better in user space. Unfortunately, this would
> > only move the problem.  The PCI-hyperv host driver could expose serial
> > value through sysfs (with some pain). But the problem would be how
> > to make a new API to  join the two V and N device.  Doing a private
> > ioctl is worse than the notifier.
> 
> All this has been discussed earlier in the thread. I think I have a
> solution
> to the problem:
> The only PCI (non-VF) NIC that may be present in the VM is the emulated
> NIC and
> we know exactly the device ID and vendor ID of this NIC. Furthermore,
> as a platform we are not going to be emulating additional NICs. So,
> if the PCI NIC is not the emulated NIC, it must be a VF and we can
> extract the
> serial number.

How about direct pass-through NIC devices. Do they have vPCI serial number?
And, the numbers should be different from VF NIC?

Thanks,
- Haiyang

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] staging : lustre : Remove braces from single-line body.

2016-12-16 Thread Joe Perches
On Fri, 2016-12-16 at 19:59 +0530, Tabrez khan wrote:
> Remove unnecessary braces {} for single while statement.

Your patch is fine Tabrez, but to the lustre folk:

> diff --git a/drivers/staging/lustre/lustre/obdclass/cl_io.c 
> b/drivers/staging/lustre/lustre/obdclass/cl_io.c
[]
> @@ -1371,9 +1371,9 @@ int cl_sync_io_wait(const struct lu_env *env, struct 
> cl_sync_io *anchor,
LASSERT(atomic_read(&anchor->csi_sync_nr) == 0);
 
/* wait until cl_sync_io_note() has done wakeup */
-   while (unlikely(atomic_read(&anchor->csi_barrier) != 0)) {
+   while (unlikely(atomic_read(&anchor->csi_barrier) != 0))
cpu_relax();
-   }
+

What if the wakeup never occurs/succeeds?
Should there be a timeout?
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


RE: [PATCH v4 5/8] bus: fsl-mc: dpio: add QBMan portal APIs for DPAA2

2016-12-16 Thread Stuart Yoder


> -Original Message-
> From: kbuild test robot [mailto:l...@intel.com]
> Sent: Friday, December 16, 2016 1:57 AM
> To: Stuart Yoder 
> Cc: kbuild-...@01.org; gre...@linuxfoundation.org; 
> de...@driverdev.osuosl.org; ag...@suse.de;
> a...@arndb.de; Haiying Wang ; Roy Pledge 
> ; linux-
> ker...@vger.kernel.org; Leo Li ; Catalin Horghidan 
> ;
> Ioana Ciornei ; Stuart Yoder ; 
> Laurentiu Tudor
> 
> Subject: Re: [PATCH v4 5/8] bus: fsl-mc: dpio: add QBMan portal APIs for DPAA2
> 
> Hi Roy,
> 
> [auto build test ERROR on staging/staging-testing]
> [also build test ERROR on next-20161215]
> [cannot apply to v4.9]
> [if your patch is applied to the wrong git tree, please drop us a note to 
> help improve the system]
> 
> url:
> https://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2F0day-
> ci%2Flinux%2Fcommits%2FStuart-Yoder%2Fstaging-fsl-mc-add-dpio-driver%2F20161216-
> 114620&data=01%7C01%7Cstuart.yoder%40nxp.com%7C0eec622fda6c4ba7b20808d425893386%7C686ea1d3bc2b4c6fa92cd9
> 9c5c301635%7C0&sdata=3DcsmOyC%2FMv%2B8A1n%2Fzq%2FWIxSsP3EjA%2F2XLyKTkvbRSA%3D&reserved=0
> config: arm64-allmodconfig (attached as .config)
> compiler: aarch64-linux-gnu-gcc (Debian 6.1.1-9) 6.1.1 20160705
> reproduce:
> wget
> https://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgit.kernel.org%2Fcgit%2Flinux%2Fkerne
> l%2Fgit%2Fwfg%2Flkp-
> tests.git%2Fplain%2Fsbin%2Fmake.cross&data=01%7C01%7Cstuart.yoder%40nxp.com%7C0eec622fda6c4ba7b20808d425
> 893386%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0&sdata=tKbhJjq7jjDBYPLhMB%2FfnR1t%2BKEffwh8mZb7leKtxF4%3D&r
> eserved=0 -O ~/bin/make.cross
> chmod +x ~/bin/make.cross
> # save the attached .config to linux build tree
> make.cross ARCH=arm64
> 
> All errors (new ones prefixed by >>):
> 
> >> drivers/staging/fsl-mc/bus/dpio/qbman-portal.c:996:10: error: expected 
> >> declaration specifiers or
> '...' before numeric constant
>  64 ctx)
>  ^~
> 
> vim +996 drivers/staging/fsl-mc/bus/dpio/qbman-portal.c
> 
>990u16 ch;
>991u8 reserved[60];
>992};
>993
>994int qbman_swp_CDAN_set(struct qbman_swp *s, u16 channelid,
>995   u8 we_mask, u8 cdan_en,
>  > 996   64 ctx)
>997{
>998struct qbman_cdan_ctrl_desc *p = NULL;
>999struct qbman_cdan_ctrl_rslt *r = NULL;

Ugh...made a last minute fix to the alignment and made a typo, and
while I could have sworn I recompiled everything I obviously didn't.
Will respin.

Stuart
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v5 1/8] bus: fsl-mc: dpio: add DPIO driver overview document

2016-12-16 Thread Stuart Yoder
add document describing the dpio driver and it's role, components
and major interfaces

Signed-off-by: Stuart Yoder 
---

Notes:
-v4
   -updated copyright

 drivers/staging/fsl-mc/bus/dpio/dpio-driver.txt | 135 
 1 file changed, 135 insertions(+)
 create mode 100644 drivers/staging/fsl-mc/bus/dpio/dpio-driver.txt

diff --git a/drivers/staging/fsl-mc/bus/dpio/dpio-driver.txt 
b/drivers/staging/fsl-mc/bus/dpio/dpio-driver.txt
new file mode 100644
index 000..0ba6771
--- /dev/null
+++ b/drivers/staging/fsl-mc/bus/dpio/dpio-driver.txt
@@ -0,0 +1,135 @@
+Copyright 2016 NXP
+
+Introduction
+
+
+A DPAA2 DPIO (Data Path I/O) is a hardware object that provides
+interfaces to enqueue and dequeue frames to/from network interfaces
+and other accelerators.  A DPIO also provides hardware buffer
+pool management for network interfaces.
+
+This document provides an overview the Linux DPIO driver, its
+subcomponents, and its APIs.
+
+See Documentation/dpaa2/overview.txt for a general overview of DPAA2
+and the general DPAA2 driver architecture in Linux.
+
+Driver Overview
+---
+
+The DPIO driver is bound to DPIO objects discovered on the fsl-mc bus and
+provides services that:
+  A) allow other drivers, such as the Ethernet driver, to enqueue and dequeue
+ frames for their respective objects
+  B) allow drivers to register callbacks for data availability notifications
+ when data becomes available on a queue or channel
+  C) allow drivers to manage hardware buffer pools
+
+The Linux DPIO driver consists of 3 primary components--
+   DPIO object driver-- fsl-mc driver that manages the DPIO object
+   DPIO service-- provides APIs to other Linux drivers for services
+   QBman portal interface-- sends portal commands, gets responses
+
+  fsl-mc  other
+   bus   drivers
+|   |
++---++   +--+-+
+|DPIO obj|   |DPIO service|
+| driver |---|  (DPIO)|
+++   +--+-+
+|
+ +--+-+
+ |QBman   |
+ | portal i/f |
+ ++
+|
+ hardware
+
+The diagram below shows how the DPIO driver components fit with the other
+DPAA2 Linux driver components:
+   ++
+   | OS Network |
+   |   Stack|
+ ++++
+ | Allocator  |. . . . . . .   |  Ethernet  |
+ |(DPMCP,DPBP)||   (DPNI)   |
+ +-.--++---+---++
+  .  . ^   |
+ ..|   | dequeue>
++-+ .  |   |
+| DPRC driver |  .++ ++
+|   (DPRC)|   . . |DPIO obj| |DPIO service|
++--+--+   | driver |-|  (DPIO)|
+   |  ++ +--+-+
+   | +--|-+
+   | |   QBman|
+  ++--+  | portal i/f |
+  |   MC-bus driver   |  ++
+  |   | |
+  | /soc/fsl-mc   | |
+  +---+ |
+|
+ =|=|
++-+--DPIO---|---+
+|   |   |
+|QBman Portal   |
++---+
+
+ 
+
+
+DPIO Object Driver (dpio-driver.c)
+--
+
+   The dpio-driver component registers with the fsl-mc bus to handle objects of
+   type "dpio".  The implementation of probe() handles basic initialization
+   of the DPIO including mapping of the DPIO regions (the QBman SW portal)
+   and initializing interrupts and registering irq handlers.  The dpio-driver
+   registers the probed DPIO with dpio-service.
+
+DPIO service  (dpio-service.c, dpaa2-io.h)
+--
+
+   The dpio service component provides queuing, notification, and buffers
+   management services to DPAA2 drivers, such as the Ethernet driver.  A system
+   will typically allocate 1 DPIO object per CPU to allow queuing operations
+   to happen simu

[PATCH v5 4/8] bus: fsl-mc: dpio: add global dpaa2 definitions

2016-12-16 Thread Stuart Yoder
From: Roy Pledge 

Create header for global dpaa2 definitions.  Add definitions
for dequeue results.

Signed-off-by: Roy Pledge 
Signed-off-by: Stuart Yoder 
---

Notes:
-v4
   -adjust file location to be in drivers/staging
   -whitespace/alignment cleanup, make dpaa2_dq_is_pull_complete()
return bool, fix spelling typo
   -updated copyright

 drivers/staging/fsl-mc/include/dpaa2-global.h | 202 ++
 1 file changed, 202 insertions(+)
 create mode 100644 drivers/staging/fsl-mc/include/dpaa2-global.h

diff --git a/drivers/staging/fsl-mc/include/dpaa2-global.h 
b/drivers/staging/fsl-mc/include/dpaa2-global.h
new file mode 100644
index 000..0326447
--- /dev/null
+++ b/drivers/staging/fsl-mc/include/dpaa2-global.h
@@ -0,0 +1,202 @@
+/*
+ * Copyright 2014-2016 Freescale Semiconductor Inc.
+ * Copyright 2016 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 Freescale Semiconductor nor the
+ *   names of its 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 Freescale Semiconductor ``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 Freescale Semiconductor 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_DPAA2_GLOBAL_H
+#define __FSL_DPAA2_GLOBAL_H
+
+#include 
+#include 
+#include "dpaa2-fd.h"
+
+struct dpaa2_dq {
+   union {
+   struct common {
+   u8 verb;
+   u8 reserved[63];
+   } common;
+   struct dq {
+   u8 verb;
+   u8 stat;
+   __le16 seqnum;
+   __le16 oprid;
+   u8 reserved;
+   u8 tok;
+   __le32 fqid;
+   u32 reserved2;
+   __le32 fq_byte_cnt;
+   __le32 fq_frm_cnt;
+   __le64 fqd_ctx;
+   u8 fd[32];
+   } dq;
+   struct scn {
+   u8 verb;
+   u8 stat;
+   u8 state;
+   u8 reserved;
+   __le32 rid_tok;
+   __le64 ctx;
+   } scn;
+   };
+};
+
+/* Parsing frame dequeue results */
+/* FQ empty */
+#define DPAA2_DQ_STAT_FQEMPTY   0x80
+/* FQ held active */
+#define DPAA2_DQ_STAT_HELDACTIVE0x40
+/* FQ force eligible */
+#define DPAA2_DQ_STAT_FORCEELIGIBLE 0x20
+/* valid frame */
+#define DPAA2_DQ_STAT_VALIDFRAME0x10
+/* FQ ODP enable */
+#define DPAA2_DQ_STAT_ODPVALID  0x04
+/* volatile dequeue */
+#define DPAA2_DQ_STAT_VOLATILE  0x02
+/* volatile dequeue command is expired */
+#define DPAA2_DQ_STAT_EXPIRED   0x01
+
+#define DQ_FQID_MASK   0x00FF
+#define DQ_FRAME_COUNT_MASK0x00FF
+
+/**
+ * dpaa2_dq_flags() - Get the stat field of dequeue response
+ * @dq: the dequeue result.
+ */
+static inline u32 dpaa2_dq_flags(const struct dpaa2_dq *dq)
+{
+   return dq->dq.stat;
+}
+
+/**
+ * dpaa2_dq_is_pull() - Check whether the dq response is from a pull
+ *  command.
+ * @dq: the dequeue result
+ *
+ * Return 1 for volatile(pull) dequeue, 0 for static dequeue.
+ */
+static inline int dpaa2_dq_is_pull(const struct dpaa2_dq *dq)
+{
+   return (int)(dpaa2_dq_flags(dq) & DPAA2_DQ_STAT_VOLATILE);
+}
+
+/**
+ * dpaa2_dq_is_pull_complete() - Check whether the pull command is completed.
+ * @dq: the dequeue result
+ *
+ * Return boolean.
+ */
+static inline bool

[PATCH v5 3/8] bus: fsl-mc: dpio: add frame descriptor and scatter/gather APIs

2016-12-16 Thread Stuart Yoder
From: Roy Pledge 

Add global definitions for DPAA2 frame descriptors and scatter
gather entries.

Signed-off-by: Roy Pledge 
Signed-off-by: Stuart Yoder 
---

Notes:
-v4
   -updated copyright
   -adjust file location to be in drivers/staging
   -address cleanup comments-- whitespace cleanup, use !! consistently
to convert expression to bool, remove unneeded parenthesis
-v3
   -no changes
-v2
   -added setter/getter for the FD ctrl field
   -corrected comment for SG format_offset field description
   -added support for short length field in FD

 drivers/staging/fsl-mc/include/dpaa2-fd.h | 448 ++
 1 file changed, 448 insertions(+)
 create mode 100644 drivers/staging/fsl-mc/include/dpaa2-fd.h

diff --git a/drivers/staging/fsl-mc/include/dpaa2-fd.h 
b/drivers/staging/fsl-mc/include/dpaa2-fd.h
new file mode 100644
index 000..21102e6
--- /dev/null
+++ b/drivers/staging/fsl-mc/include/dpaa2-fd.h
@@ -0,0 +1,448 @@
+/*
+ * Copyright 2014-2016 Freescale Semiconductor Inc.
+ * Copyright 2016 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 Freescale Semiconductor nor the
+ *   names of its 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 Freescale Semiconductor ``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 Freescale Semiconductor 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_DPAA2_FD_H
+#define __FSL_DPAA2_FD_H
+
+#include 
+
+/**
+ * DOC: DPAA2 FD - Frame Descriptor APIs for DPAA2
+ *
+ * Frame Descriptors (FDs) are used to describe frame data in the DPAA2.
+ * Frames can be enqueued and dequeued to Frame Queues (FQs) which are consumed
+ * by the various DPAA accelerators (WRIOP, SEC, PME, DCE)
+ *
+ * There are three types of frames: single, scatter gather, and frame lists.
+ *
+ * The set of APIs in this file must be used to create, manipulate and
+ * query Frame Descriptors.
+ */
+
+/**
+ * struct dpaa2_fd - Struct describing FDs
+ * @words: for easier/faster copying the whole FD structure
+ * @addr:  address in the FD
+ * @len:   length in the FD
+ * @bpid:  buffer pool ID
+ * @format_offset: format, offset, and short-length fields
+ * @frc:   frame context
+ * @ctrl:  control bits...including dd, sc, va, err, etc
+ * @flc:   flow context address
+ *
+ * This structure represents the basic Frame Descriptor used in the system.
+ */
+struct dpaa2_fd {
+   union {
+   u32 words[8];
+   struct dpaa2_fd_simple {
+   __le64 addr;
+   __le32 len;
+   __le16 bpid;
+   __le16 format_offset;
+   __le32 frc;
+   __le32 ctrl;
+   __le64 flc;
+   } simple;
+   };
+};
+
+#define FD_SHORT_LEN_FLAG_MASK 0x1
+#define FD_SHORT_LEN_FLAG_SHIFT14
+#define FD_SHORT_LEN_MASK  0x1
+#define FD_OFFSET_MASK 0x0FFF
+#define FD_FORMAT_MASK 0x3
+#define FD_FORMAT_SHIFT12
+#define SG_SHORT_LEN_FLAG_MASK 0x1
+#define SG_SHORT_LEN_FLAG_SHIFT14
+#define SG_SHORT_LEN_MASK  0x1
+#define SG_OFFSET_MASK 0x0FFF
+#define SG_FORMAT_MASK 0x3
+#define SG_FORMAT_SHIFT12
+#define SG_BPID_MASK   0x3FFF
+#define SG_FINAL_FLAG_MASK 0x1
+#define SG_FINAL_FLAG_SHIFT15
+
+enum dpaa2_fd_format {
+   dpaa2_fd_single = 0,
+   dpaa2_fd_list,
+   dpaa

[PATCH v5 5/8] bus: fsl-mc: dpio: add QBMan portal APIs for DPAA2

2016-12-16 Thread Stuart Yoder
From: Roy Pledge 

Add QBman APIs for frame queue and buffer pool operations.

Signed-off-by: Roy Pledge 
Signed-off-by: Haiying Wang 
Signed-off-by: Stuart Yoder 
---

Notes:
-v5
   -fixed typo that caused a compile error
-v4
   -adjust file location to be in drivers/staging
   -updated copyright
   -added definition for static dequeue token value
   -fixed bug in SDQCR #define
   -added missing #include guard in qbman-portal.h
   -added #define for QMAN_REV_MASK
   -whitespace, alignment cleanup
-v3
   -replace hardcoded dequeue token with a #define and check that
token when checking for a new result (bug fix suggested by
Ioana Radulescu)
-v2
   -fix bug in buffer release command, by setting bpid field
   -handle error (NULL) return value from qbman_swp_mc_complete()
   -error message cleanup
   -fix bug in sending management commands where the verb was
properly initialized

 drivers/staging/fsl-mc/bus/dpio/Makefile   |2 +-
 drivers/staging/fsl-mc/bus/dpio/qbman-portal.c | 1033 
 drivers/staging/fsl-mc/bus/dpio/qbman-portal.h |  469 +++
 3 files changed, 1503 insertions(+), 1 deletion(-)
 create mode 100644 drivers/staging/fsl-mc/bus/dpio/qbman-portal.c
 create mode 100644 drivers/staging/fsl-mc/bus/dpio/qbman-portal.h

diff --git a/drivers/staging/fsl-mc/bus/dpio/Makefile 
b/drivers/staging/fsl-mc/bus/dpio/Makefile
index 128befc..6588498 100644
--- a/drivers/staging/fsl-mc/bus/dpio/Makefile
+++ b/drivers/staging/fsl-mc/bus/dpio/Makefile
@@ -6,4 +6,4 @@ subdir-ccflags-y := -Werror
 
 obj-$(CONFIG_FSL_MC_DPIO) += fsl-mc-dpio.o
 
-fsl-mc-dpio-objs := dpio.o
+fsl-mc-dpio-objs := dpio.o qbman-portal.o
diff --git a/drivers/staging/fsl-mc/bus/dpio/qbman-portal.c 
b/drivers/staging/fsl-mc/bus/dpio/qbman-portal.c
new file mode 100644
index 000..4949102
--- /dev/null
+++ b/drivers/staging/fsl-mc/bus/dpio/qbman-portal.c
@@ -0,0 +1,1033 @@
+/*
+ * Copyright (C) 2014-2016 Freescale Semiconductor, Inc.
+ * Copyright 2016 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 Freescale Semiconductor nor the
+ *   names of its 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 Freescale Semiconductor ``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 Freescale Semiconductor 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/dpaa2-global.h"
+
+#include "qbman-portal.h"
+
+#define QMAN_REV_4000   0x0400
+#define QMAN_REV_4100   0x0401
+#define QMAN_REV_4101   0x04010001
+#define QMAN_REV_MASK   0x
+
+/* All QBMan command and result structures use this "valid bit" encoding */
+#define QB_VALID_BIT ((u32)0x80)
+
+/* QBMan portal management command codes */
+#define QBMAN_MC_ACQUIRE   0x30
+#define QBMAN_WQCHAN_CONFIGURE 0x46
+
+/* CINH register offsets */
+#define QBMAN_CINH_SWP_EQAR0x8c0
+#define QBMAN_CINH_SWP_DQPI0xa00
+#define QBMAN_CINH_SWP_DCAP0xac0
+#define QBMAN_CINH_SWP_SDQCR   0xb00
+#define QBMAN_CINH_SWP_RAR 0xcc0
+#define QBMAN_CINH_SWP_ISR 0xe00
+#define QBMAN_CINH_SWP_IER 0xe40
+#define QBMAN_CINH_SWP_ISDR0xe80
+#define QBMAN_CINH_SWP_IIR 0xec0
+
+/* CENA register offsets */
+#define QBMAN_CENA_SWP_EQCR(n) (0x000 + ((u32)(n) << 6))
+#define QBMAN_CENA_SWP_DQRR(n) (0x200 + ((u32)(n) << 6))
+#define QBMAN_CENA_SWP_RCR(n)  (0x400 + ((u32)(n) << 6))
+#define QBMAN_CENA_SWP_CR  0x600
+#define QBMAN_CENA_SWP_RR(vb)  (0x7

[PATCH v5 7/8] bus: fsl-mc: dpio: add the DPAA2 DPIO object driver

2016-12-16 Thread Stuart Yoder
From: Roy Pledge 

The DPIO driver registers with the fsl-mc bus to handle bus-related
events for DPIO objects.  Key responsibility is mapping I/O
regions, setting up interrupt handlers, and calling the DPIO
service initialization during probe.

Signed-off-by: Roy Pledge 
Signed-off-by: Haiying Wang 
Signed-off-by: Stuart Yoder 
---

Notes:
-v4
   -updated copyright
   -adjust file location to be in drivers/staging
   -whitespace alignment cleanup
-v3
   -no changes
-v2
   -handle error case where number of DPIOs > NR_CPUs

 drivers/staging/fsl-mc/bus/dpio/Makefile  |   2 +-
 drivers/staging/fsl-mc/bus/dpio/dpio-driver.c | 296 ++
 2 files changed, 297 insertions(+), 1 deletion(-)
 create mode 100644 drivers/staging/fsl-mc/bus/dpio/dpio-driver.c

diff --git a/drivers/staging/fsl-mc/bus/dpio/Makefile 
b/drivers/staging/fsl-mc/bus/dpio/Makefile
index 0778da7..837d330 100644
--- a/drivers/staging/fsl-mc/bus/dpio/Makefile
+++ b/drivers/staging/fsl-mc/bus/dpio/Makefile
@@ -6,4 +6,4 @@ subdir-ccflags-y := -Werror
 
 obj-$(CONFIG_FSL_MC_DPIO) += fsl-mc-dpio.o
 
-fsl-mc-dpio-objs := dpio.o qbman-portal.o dpio-service.o
+fsl-mc-dpio-objs := dpio.o qbman-portal.o dpio-service.o dpio-driver.o
diff --git a/drivers/staging/fsl-mc/bus/dpio/dpio-driver.c 
b/drivers/staging/fsl-mc/bus/dpio/dpio-driver.c
new file mode 100644
index 000..e36da20
--- /dev/null
+++ b/drivers/staging/fsl-mc/bus/dpio/dpio-driver.c
@@ -0,0 +1,296 @@
+/*
+ * Copyright 2014-2016 Freescale Semiconductor Inc.
+ * Copyright NXP 2016
+ *
+ * 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 Freescale Semiconductor nor the
+ *  names of its 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 Freescale Semiconductor ``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 Freescale Semiconductor 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 
+#include 
+
+#include "../../include/mc.h"
+#include "../../include/dpaa2-io.h"
+
+#include "qbman-portal.h"
+#include "dpio.h"
+#include "dpio-cmd.h"
+
+MODULE_LICENSE("Dual BSD/GPL");
+MODULE_AUTHOR("Freescale Semiconductor, Inc");
+MODULE_DESCRIPTION("DPIO Driver");
+
+struct dpio_priv {
+   struct dpaa2_io *io;
+};
+
+static irqreturn_t dpio_irq_handler(int irq_num, void *arg)
+{
+   struct device *dev = (struct device *)arg;
+   struct dpio_priv *priv = dev_get_drvdata(dev);
+
+   return dpaa2_io_irq(priv->io);
+}
+
+static void unregister_dpio_irq_handlers(struct fsl_mc_device *dpio_dev)
+{
+   struct fsl_mc_device_irq *irq;
+
+   irq = dpio_dev->irqs[0];
+
+   /* clear the affinity hint */
+   irq_set_affinity_hint(irq->msi_desc->irq, NULL);
+}
+
+static int register_dpio_irq_handlers(struct fsl_mc_device *dpio_dev, int cpu)
+{
+   struct dpio_priv *priv;
+   int error;
+   struct fsl_mc_device_irq *irq;
+   cpumask_t mask;
+
+   priv = dev_get_drvdata(&dpio_dev->dev);
+
+   irq = dpio_dev->irqs[0];
+   error = devm_request_irq(&dpio_dev->dev,
+irq->msi_desc->irq,
+dpio_irq_handler,
+0,
+dev_name(&dpio_dev->dev),
+&dpio_dev->dev);
+   if (error < 0) {
+   dev_err(&dpio_dev->dev,
+   "devm_request_irq() failed: %d\n",
+   error);
+   return error;
+   

[PATCH v5 6/8] bus: fsl-mc: dpio: add the DPAA2 DPIO service interface

2016-12-16 Thread Stuart Yoder
From: Roy Pledge 

The DPIO service interface handles initialization of DPIO objects
and exports APIs to be used by other DPAA2 object drivers to perform
queuing and buffer management related operations.  The service allows
registration of callbacks when frames or notifications are received.

Signed-off-by: Roy Pledge 
Signed-off-by: Haiying Wang 
Signed-off-by: Stuart Yoder 
---

Notes:
-v4
   -updated copyright
   -adjust file location to be in drivers/staging
   -updated copyright
   -added missing free on error path
   -fixed typo in comment
   -whitespace and alignment cleanup
-v3
   -zero memory allocated for a dpio store (bug fix suggested
by Ioana Radulescu)
-v2
   -use service_select_by_cpu() for re-arming DPIO interrupts
   -replace use of NR_CPUS with num_possible_cpus()

 drivers/staging/fsl-mc/bus/dpio/Makefile   |   2 +-
 drivers/staging/fsl-mc/bus/dpio/dpio-service.c | 616 +
 drivers/staging/fsl-mc/include/dpaa2-io.h  | 139 ++
 3 files changed, 756 insertions(+), 1 deletion(-)
 create mode 100644 drivers/staging/fsl-mc/bus/dpio/dpio-service.c
 create mode 100644 drivers/staging/fsl-mc/include/dpaa2-io.h

diff --git a/drivers/staging/fsl-mc/bus/dpio/Makefile 
b/drivers/staging/fsl-mc/bus/dpio/Makefile
index 6588498..0778da7 100644
--- a/drivers/staging/fsl-mc/bus/dpio/Makefile
+++ b/drivers/staging/fsl-mc/bus/dpio/Makefile
@@ -6,4 +6,4 @@ subdir-ccflags-y := -Werror
 
 obj-$(CONFIG_FSL_MC_DPIO) += fsl-mc-dpio.o
 
-fsl-mc-dpio-objs := dpio.o qbman-portal.o
+fsl-mc-dpio-objs := dpio.o qbman-portal.o dpio-service.o
diff --git a/drivers/staging/fsl-mc/bus/dpio/dpio-service.c 
b/drivers/staging/fsl-mc/bus/dpio/dpio-service.c
new file mode 100644
index 000..394727b
--- /dev/null
+++ b/drivers/staging/fsl-mc/bus/dpio/dpio-service.c
@@ -0,0 +1,616 @@
+/*
+ * Copyright 2014-2016 Freescale Semiconductor Inc.
+ * Copyright 2016 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 Freescale Semiconductor nor the
+ *  names of its 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 Freescale Semiconductor ``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 Freescale Semiconductor 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/mc.h"
+#include "../../include/dpaa2-io.h"
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "dpio.h"
+#include "qbman-portal.h"
+
+struct dpaa2_io {
+   atomic_t refs;
+   struct dpaa2_io_desc dpio_desc;
+   struct qbman_swp_desc swp_desc;
+   struct qbman_swp *swp;
+   struct list_head node;
+   spinlock_t lock_mgmt_cmd;
+   spinlock_t lock_notifications;
+   struct list_head notifications;
+};
+
+struct dpaa2_io_store {
+   unsigned int max;
+   dma_addr_t paddr;
+   struct dpaa2_dq *vaddr;
+   void *alloced_addr;/* unaligned value from kmalloc() */
+   unsigned int idx;  /* position of the next-to-be-returned entry */
+   struct qbman_swp *swp; /* portal used to issue VDQCR */
+   struct device *dev;/* device used for DMA mapping */
+};
+
+/* keep a per cpu array of DPIOs for fast access */
+static struct dpaa2_io *dpio_by_cpu[NR_CPUS];
+static struct list_head dpio_list = LIST_HEAD_INIT(dpio_list);
+static DEFINE_SPINLOCK(dpio_list_lock);
+
+static inline struct dpaa2_io *service_select_by_cpu(struct dpaa2_io *d,
+int cpu)
+{
+   if (d)
+

[PATCH v5 8/8] bus: fsl-mc: dpio: add maintainer for DPIO

2016-12-16 Thread Stuart Yoder
From: Roy Pledge 

add Roy Pledge as maintainer of DPIO

Signed-off-by: Roy Pledge 
Signed-off-by: Stuart Yoder 
---

Notes:
-v4
   -adjust file location to be in drivers/staging
-v3
   -no changes
-v2
   -corrected location of maintainer entry

 MAINTAINERS | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index 8695516..add3de4 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -3980,6 +3980,12 @@ S:   Maintained
 F: drivers/char/dtlk.c
 F: include/linux/dtlk.h
 
+DPAA2 DATAPATH I/O (DPIO) DRIVER
+M: Roy Pledge 
+L: linux-ker...@vger.kernel.org
+S: Maintained
+F: drivers/staging/fsl-mc/bus/dpio
+
 DPT_I2O SCSI RAID DRIVER
 M: Adaptec OEM Raid Solutions 
 L: linux-s...@vger.kernel.org
-- 
1.9.0

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v5 2/8] bus: fsl-mc: dpio: add APIs for DPIO objects

2016-12-16 Thread Stuart Yoder
From: Ioana Radulescu 

Add the command build/parse APIs for operating on DPIO objects through
the DPAA2 Management Complex.

Signed-off-by: Ioana Radulescu 
Signed-off-by: Roy Pledge 
Signed-off-by: Stuart Yoder 
---

Notes:
-v4
  -adjust file location to be in drivers/staging
  -remove unneeded comments
  -updated copyright
-v3
  -no changes
-v2
  -removed unused structs and defines

 drivers/staging/fsl-mc/bus/Kconfig |  10 ++
 drivers/staging/fsl-mc/bus/Makefile|   3 +
 drivers/staging/fsl-mc/bus/dpio/Makefile   |   9 ++
 drivers/staging/fsl-mc/bus/dpio/dpio-cmd.h |  76 ++
 drivers/staging/fsl-mc/bus/dpio/dpio.c | 224 +
 drivers/staging/fsl-mc/bus/dpio/dpio.h | 109 ++
 6 files changed, 431 insertions(+)
 create mode 100644 drivers/staging/fsl-mc/bus/dpio/Makefile
 create mode 100644 drivers/staging/fsl-mc/bus/dpio/dpio-cmd.h
 create mode 100644 drivers/staging/fsl-mc/bus/dpio/dpio.c
 create mode 100644 drivers/staging/fsl-mc/bus/dpio/dpio.h

diff --git a/drivers/staging/fsl-mc/bus/Kconfig 
b/drivers/staging/fsl-mc/bus/Kconfig
index 5c009ab..a10aaf0 100644
--- a/drivers/staging/fsl-mc/bus/Kconfig
+++ b/drivers/staging/fsl-mc/bus/Kconfig
@@ -15,3 +15,13 @@ config FSL_MC_BUS
  architecture.  The fsl-mc bus driver handles discovery of
  DPAA2 objects (which are represented as Linux devices) and
  binding objects to drivers.
+
+config FSL_MC_DPIO
+tristate "QorIQ DPAA2 DPIO driver"
+depends on FSL_MC_BUS
+help
+ Driver for the DPAA2 DPIO object.  A DPIO provides queue and
+ buffer management facilities for software to interact with
+ other DPAA2 objects. This driver does not expose the DPIO
+ objects individually, but groups them under a service layer
+ API.
diff --git a/drivers/staging/fsl-mc/bus/Makefile 
b/drivers/staging/fsl-mc/bus/Makefile
index 38716fd..577e9fa 100644
--- a/drivers/staging/fsl-mc/bus/Makefile
+++ b/drivers/staging/fsl-mc/bus/Makefile
@@ -18,3 +18,6 @@ mc-bus-driver-objs := fsl-mc-bus.o \
  irq-gic-v3-its-fsl-mc-msi.o \
  dpmcp.o \
  dpbp.o
+
+# MC DPIO driver
+obj-$(CONFIG_FSL_MC_DPIO) += dpio/
diff --git a/drivers/staging/fsl-mc/bus/dpio/Makefile 
b/drivers/staging/fsl-mc/bus/dpio/Makefile
new file mode 100644
index 000..128befc
--- /dev/null
+++ b/drivers/staging/fsl-mc/bus/dpio/Makefile
@@ -0,0 +1,9 @@
+#
+# QorIQ DPAA2 DPIO driver
+#
+
+subdir-ccflags-y := -Werror
+
+obj-$(CONFIG_FSL_MC_DPIO) += fsl-mc-dpio.o
+
+fsl-mc-dpio-objs := dpio.o
diff --git a/drivers/staging/fsl-mc/bus/dpio/dpio-cmd.h 
b/drivers/staging/fsl-mc/bus/dpio/dpio-cmd.h
new file mode 100644
index 000..c237d5f
--- /dev/null
+++ b/drivers/staging/fsl-mc/bus/dpio/dpio-cmd.h
@@ -0,0 +1,76 @@
+/*
+ * Copyright 2013-2016 Freescale Semiconductor Inc.
+ * Copyright 2016 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_DPIO_CMD_H
+#define _FSL_DPIO_CMD_H
+
+/* DPIO Version */
+#define DPIO_VER_MAJOR 4
+#define DPIO_VER_MINOR 2
+
+/* Command Versioning */
+
+#define DPIO_CMD_ID_OFFSET 4
+#define DPIO_CMD_BASE_VE

Re: [PATCH 3/3] hv_netvsc: Implement VF matching based on serial numbers

2016-12-16 Thread Greg KH
On Wed, Dec 14, 2016 at 03:51:34PM -0800, Stephen Hemminger wrote:
> On Wed, 14 Dec 2016 15:27:58 -0800
> Greg KH  wrote:
> 
> > On Wed, Dec 14, 2016 at 11:18:59PM +, Haiyang Zhang wrote:
> > > 
> > >   
> > > > -Original Message-
> > > > From: Greg KH [mailto:gre...@linuxfoundation.org]
> > > > Sent: Saturday, December 10, 2016 7:21 AM
> > > > To: Stephen Hemminger 
> > > > Cc: Haiyang Zhang ; o...@aepfle.de;
> > > > jasow...@redhat.com; linux-ker...@vger.kernel.org;
> > > > bjorn.helg...@gmail.com; a...@canonical.com; 
> > > > de...@linuxdriverproject.org;
> > > > leann.ogasaw...@canonical.com
> > > > Subject: Re: [PATCH 3/3] hv_netvsc: Implement VF matching based on
> > > > serial numbers
> > > > 
> > > > On Fri, Dec 09, 2016 at 04:21:48PM -0800, Stephen Hemminger wrote:  
> > > > > On Fri, 9 Dec 2016 22:35:05 +
> > > > > Haiyang Zhang  wrote:
> > > > >  
> > > > > > > > >
> > > > > > > > > Emulated NIC is already excluded in start of netvc notifier  
> > > > handler.  
> > > > > > > > >
> > > > > > > > > static int netvsc_netdev_event(struct notifier_block *this,
> > > > > > > > >  unsigned long event, void *ptr)
> > > > > > > > > {
> > > > > > > > >   struct net_device *event_dev =  
> > > > netdev_notifier_info_to_dev(ptr);  
> > > > > > > > >
> > > > > > > > >   /* Skip our own events */
> > > > > > > > >   if (event_dev->netdev_ops == &device_ops)
> > > > > > > > >   return NOTIFY_DONE;
> > > > > > > > >  
> > > > > > > >
> > > > > > > > Emulated device is not based on netvsc. It's the native Linux  
> > > > > > > (dec100M?)  
> > > > > > > > Driver. So this line doesn't exclude it. And how about other 
> > > > > > > > NIC  
> > > > type  
> > > > > > > > may be added in the future?  
> > > > > > >
> > > > > > > Sorry, forgot about that haven't used emulated device in years.
> > > > > > > The emulated device should appear to be on a PCI bus, but the  
> > > > serial  
> > > > > > > would not match??  
> > > > > >
> > > > > > It's not a vmbus device, not a hv_pci device either. Hv_PCI is a  
> > > > subset  
> > > > > > of vmbus devices. So emulated NIC won't have hv_pci serial number.
> > > > > >
> > > > > > In my patch, the following code ensure, we only try to get serial  
> > > > number  
> > > > > > after confirming it's vmbus and hv_pci device:
> > > > > >
> > > > > > +   if (!dev_is_vmbus(dev))
> > > > > > +   continue;
> > > > > > +
> > > > > > +   hdev = device_to_hv_device(dev);
> > > > > > +   if (hdev->device_id != HV_PCIE)
> > > > > > +   continue;  
> > > > >
> > > > > Ok, the walk back up the device tree is logically ok, but I don't
> > > > > know enough about PCI device tree to be assured that it is safe.
> > > > > Also, you could short circuit away most of the unwanted devices
> > > > > by making sure the vf_netdev->dev.parent is a PCI device.  
> > > > 
> > > > Ugh, this seems really really messy.  Can't we just have the
> > > > netdev_event interface pass back a pointer to something that we "know"
> > > > what it is?  This walking the device tree is a mess, and not good.
> > > > 
> > > > I'd even argue that dev_is_pci() needs to be removed from the tree too,
> > > > as it shouldn't be needed either.  We did a lot of work on the driver
> > > > model to prevent the need for having to declare the "type" of 'struct
> > > > device' at all, and by doing this type of thing it goes against the
> > > > basic design of the model.
> > > > 
> > > > Yes, it makes things a bit "tougher" in places, but you don't do crazy
> > > > things like walk device trees to try to find random devices and then
> > > > think it's safe to actually use them :(
> > > >   
> > > 
> > > We register a notifier_block with:
> > >   register_netdevice_notifier(struct notifier_block *nb)
> > > 
> > > The "struct notifier_block" basically contains a callback function:
> > > struct notifier_block {
> > > notifier_fn_t notifier_call;
> > > struct notifier_block __rcu *next;
> > > int priority;
> > > };
> > > 
> > > It doesn't specify which device we want, so all net devices can trigger
> > > this event. Seems we can't have this notifier return VF device only.  
> > 
> > Ok, I dug in the kernel and it looks like people check the netdev_ops
> > structure to see if it matches up with their function pointers to "know"
> > if this is their device or not.  Why not do that here?  Or compare the
> > "string" of the driver name?  Or any other such trick that the drivers
> > that call register_netdevice_notifier do?
> > 
> > All of which are more sane than walking the device tree...
> > 
> > And why am I having to do network driver development, ick ick ick :)
> > 
> > Come on, 'git grep' is your friend.  Even better yet, use a good tool
> > like 'vgrep' which makes git grep work really really well.
> 
> Normally, that would work but in this case we have one driver (ne

[PATCH v5 0/8] staging: fsl-mc: add dpio driver

2016-12-16 Thread Stuart Yoder
This patch series adds the driver for the DPIO object which is a 
step to addressing the final item in the staging TODO list-- adding
a functional driver on top of the bus driver.  The DPIO driver is a
dependency for other functional drivers such as Ethernet.

An overview of the DPIO object and driver components are in patch 1.
Patches 2-6 are internal components of the DPIO driver-- bit twiddling
of hardware registers, DPAA2 data structures, and the queuing APIs exposed
to other drivers.

Patch 7 adds the fsl-mc driver for the DPIO object.  It provides
the probe/remove functions, demonstrating a working example of
how fsl-mc drivers initialize, interact with the management
complex hardware, map their mappable MMIO regions, initialize
interrupts, register an ISR, etc.  All other DPAA2 drivers will
follow a similar initialization pattern.

version 5 changes
   -fixed typo in patch 5 that caused compile issue

version 4 changes
   -removed the patch moving the bus driver out of staging, updated
all paths referenced in dpio (e.g. includes) to be drivers/staging
   -defined macros for constants where needed
   -copyright updates
   -cleanup: fixed whitespace, alignment issues, typos, removed unneeded
comments
   -fixed bug in SDQCR #define
   -adding missing free in an error path

version 3 changes
   -zero memory allocated for a dpio store
   -replace hardcoded dequeue token with a #define and look for
that token when checking for a new result

version 2 changes (mostly feedback from Ioana Radulescu)
   -removed unused structs and defines in dpio command definitions
   -added setter/getter for the FD ctrl field
   -corrected comment for SG format_offset field description
   -added support for short length field in FD
   -fix bug in buffer release command, by setting bpid field
   -handle error (NULL) return value from qbman_swp_mc_complete()
   -fix bug in sending management commands where the verb was
properly initialized
   -use service_select_by_cpu() for re-arming DPIO interrupts
   -replace use of NR_CPUS with num_possible_cpus()
   -handle error case where number of DPIOs exceeds number of possible
CPUs
   -error message cleanup
   -updated MAINTAINERS file with proper location for both fsl-mc bus
driver and dpio driver


Ioana Radulescu (1):
  bus: fsl-mc: dpio: add APIs for DPIO objects

Roy Pledge (6):
  bus: fsl-mc: dpio: add frame descriptor and scatter/gather APIs
  bus: fsl-mc: dpio: add global dpaa2 definitions
  bus: fsl-mc: dpio: add QBMan portal APIs for DPAA2
  bus: fsl-mc: dpio: add the DPAA2 DPIO service interface
  bus: fsl-mc: dpio: add the DPAA2 DPIO object driver
  bus: fsl-mc: dpio: add maintainer for DPIO

Stuart Yoder (1):
  bus: fsl-mc: dpio: add DPIO driver overview document

 MAINTAINERS |6 +
 drivers/staging/fsl-mc/bus/Kconfig  |   10 +
 drivers/staging/fsl-mc/bus/Makefile |3 +
 drivers/staging/fsl-mc/bus/dpio/Makefile|9 +
 drivers/staging/fsl-mc/bus/dpio/dpio-cmd.h  |   76 ++
 drivers/staging/fsl-mc/bus/dpio/dpio-driver.c   |  296 +++
 drivers/staging/fsl-mc/bus/dpio/dpio-driver.txt |  135 +++
 drivers/staging/fsl-mc/bus/dpio/dpio-service.c  |  616 ++
 drivers/staging/fsl-mc/bus/dpio/dpio.c  |  224 +
 drivers/staging/fsl-mc/bus/dpio/dpio.h  |  109 +++
 drivers/staging/fsl-mc/bus/dpio/qbman-portal.c  | 1033 +++
 drivers/staging/fsl-mc/bus/dpio/qbman-portal.h  |  469 ++
 drivers/staging/fsl-mc/include/dpaa2-fd.h   |  448 ++
 drivers/staging/fsl-mc/include/dpaa2-global.h   |  202 +
 drivers/staging/fsl-mc/include/dpaa2-io.h   |  139 +++
 15 files changed, 3775 insertions(+)
 create mode 100644 drivers/staging/fsl-mc/bus/dpio/Makefile
 create mode 100644 drivers/staging/fsl-mc/bus/dpio/dpio-cmd.h
 create mode 100644 drivers/staging/fsl-mc/bus/dpio/dpio-driver.c
 create mode 100644 drivers/staging/fsl-mc/bus/dpio/dpio-driver.txt
 create mode 100644 drivers/staging/fsl-mc/bus/dpio/dpio-service.c
 create mode 100644 drivers/staging/fsl-mc/bus/dpio/dpio.c
 create mode 100644 drivers/staging/fsl-mc/bus/dpio/dpio.h
 create mode 100644 drivers/staging/fsl-mc/bus/dpio/qbman-portal.c
 create mode 100644 drivers/staging/fsl-mc/bus/dpio/qbman-portal.h
 create mode 100644 drivers/staging/fsl-mc/include/dpaa2-fd.h
 create mode 100644 drivers/staging/fsl-mc/include/dpaa2-global.h
 create mode 100644 drivers/staging/fsl-mc/include/dpaa2-io.h

-- 
1.9.0

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [lustre-devel] [PATCH] staging : lustre : Remove braces from single-line body.

2016-12-16 Thread Xiong, Jinshan

> On Dec 16, 2016, at 8:05 AM, Joe Perches  wrote:
> 
> On Fri, 2016-12-16 at 19:59 +0530, Tabrez khan wrote:
>> Remove unnecessary braces {} for single while statement.
> 
> Your patch is fine Tabrez, but to the lustre folk:
> 
>> diff --git a/drivers/staging/lustre/lustre/obdclass/cl_io.c 
>> b/drivers/staging/lustre/lustre/obdclass/cl_io.c
> []
>> @@ -1371,9 +1371,9 @@ int cl_sync_io_wait(const struct lu_env *env, struct 
>> cl_sync_io *anchor,
>   LASSERT(atomic_read(&anchor->csi_sync_nr) == 0);
> 
>   /* wait until cl_sync_io_note() has done wakeup */
> - while (unlikely(atomic_read(&anchor->csi_barrier) != 0)) {
> + while (unlikely(atomic_read(&anchor->csi_barrier) != 0))
>   cpu_relax();
> - }
> +
> 
> What if the wakeup never occurs/succeeds?
> Should there be a timeout?

There is no wakeup at all. This piece of code is to solve the preempting race 
condition in cl_sync_io_end(), where it calls wake_up_all() to wake up the 
cl_sync_io_wait() process, and then is preempted _inside_ wake_up_all(), and 
then cl_sync_io_wait() process gains the CPU and frees memory cl_sync_io. 
Therefore when cl_sync_io_end() comes back to finish its work in wake_up_all(), 
a piece of freed memory will be accessed.

csi_barrier is proposed to solve this problem, which makes sure wake_up_all() 
is complete before cl_sync_io_wait() can continue. It should be a really short 
time so it’s reasonable for cl_sync_io_wait() to do a busy loop wait.

Jinshan

> ___
> lustre-devel mailing list
> lustre-de...@lists.lustre.org
> http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] staging : lustre : Remove braces from single-line body.

2016-12-16 Thread Tabrez khan
Remove unnecessary braces {} from single line if statement.
This warning is found using checkpatch.pl.

Signed-off-by: Tabrez khan 
---
 drivers/staging/lustre/lustre/ptlrpc/import.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/lustre/lustre/ptlrpc/import.c 
b/drivers/staging/lustre/lustre/ptlrpc/import.c
index a23d0a0..477d832 100644
--- a/drivers/staging/lustre/lustre/ptlrpc/import.c
+++ b/drivers/staging/lustre/lustre/ptlrpc/import.c
@@ -1134,9 +1134,9 @@ static int ptlrpc_connect_interpret(const struct lu_env 
*env,
}
 
/* Sanity checks for a reconnected import. */
-   if (!(imp->imp_replayable) != !(msg_flags & MSG_CONNECT_REPLAYABLE)) {
+   if (!(imp->imp_replayable) != !(msg_flags & MSG_CONNECT_REPLAYABLE))
CERROR("imp_replayable flag does not match server after 
reconnect. We should LBUG right here.\n");
-   }
+
 
if (lustre_msg_get_last_committed(request->rq_repmsg) > 0 &&
lustre_msg_get_last_committed(request->rq_repmsg) <
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


RE: [PATCH 3/3] hv_netvsc: Implement VF matching based on serial numbers

2016-12-16 Thread KY Srinivasan


> -Original Message-
> From: Haiyang Zhang
> Sent: Friday, December 16, 2016 7:21 AM
> To: KY Srinivasan ; Stephen Hemminger
> ; Greg KH 
> Cc: o...@aepfle.de; jasow...@redhat.com; linux-ker...@vger.kernel.org;
> bjorn.helg...@gmail.com; a...@canonical.com;
> de...@linuxdriverproject.org; leann.ogasaw...@canonical.com
> Subject: RE: [PATCH 3/3] hv_netvsc: Implement VF matching based on serial
> numbers
> 
> 
> 
> > -Original Message-
> > From: KY Srinivasan
> > Sent: Thursday, December 15, 2016 8:11 PM
> > To: Stephen Hemminger ; Greg KH
> > 
> > Cc: o...@aepfle.de; jasow...@redhat.com; linux-ker...@vger.kernel.org;
> > bjorn.helg...@gmail.com; a...@canonical.com;
> de...@linuxdriverproject.org;
> > leann.ogasaw...@canonical.com; Haiyang Zhang
> 
> > Subject: RE: [PATCH 3/3] hv_netvsc: Implement VF matching based on
> > serial numbers
> >
> >
> >
> > > -Original Message-
> > > From: devel [mailto:driverdev-devel-boun...@linuxdriverproject.org]
> On
> > > Behalf Of Stephen Hemminger
> > > Sent: Wednesday, December 14, 2016 3:52 PM
> > > To: Greg KH 
> > > Cc: o...@aepfle.de; jasow...@redhat.com; linux-
> ker...@vger.kernel.org;
> > > bjorn.helg...@gmail.com; a...@canonical.com;
> > > de...@linuxdriverproject.org; leann.ogasaw...@canonical.com; Haiyang
> > > Zhang 
> > > Subject: Re: [PATCH 3/3] hv_netvsc: Implement VF matching based on
> > serial
> > > numbers
> > >
> > > Normally, that would work but in this case we have one driver (netvsc)
> > > which is managing another driver which is unaware of Hyper-V or netvsc
> > > drivers existence.  The callback is happening in netvsc driver and it
> > > needs to say "hey I know that SR-IOV device, it is associated with my
> > > network device". This problem is how to know that N is associated with
> > > V? The V device has to be a network device, that is easy. But then it
> > > also has to be a PCI device, not to bad. But then the netvsc code
> > > is matching based on hyper-V only PCI bus metadata (the serial #).
> > >
> > > The Microsoft developers made the rational decision not to go
> > modifying
> > > all the possible SR-IOV network devices from Intel and Mellanox to add
> > > the functionality there. That would have been much worse.
> > >
> > > Maybe, rather than trying to do the management in the kernel it
> > > could have been done better in user space. Unfortunately, this would
> > > only move the problem.  The PCI-hyperv host driver could expose serial
> > > value through sysfs (with some pain). But the problem would be how
> > > to make a new API to  join the two V and N device.  Doing a private
> > > ioctl is worse than the notifier.
> >
> > All this has been discussed earlier in the thread. I think I have a
> > solution
> > to the problem:
> > The only PCI (non-VF) NIC that may be present in the VM is the emulated
> > NIC and
> > we know exactly the device ID and vendor ID of this NIC. Furthermore,
> > as a platform we are not going to be emulating additional NICs. So,
> > if the PCI NIC is not the emulated NIC, it must be a VF and we can
> > extract the
> > serial number.
> 
> How about direct pass-through NIC devices. Do they have vPCI serial
> number?
> And, the numbers should be different from VF NIC?

This may not have a valid serial number; but is still a descendent of vmbus.

K. Y  
> 
> Thanks,
> - Haiyang

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] staging : lustre : Remove braces from single-line body.

2016-12-16 Thread Joe Perches
On Fri, 2016-12-16 at 23:29 +0530, Tabrez khan wrote:
> Remove unnecessary braces {} from single line if statement.
> This warning is found using checkpatch.pl.
[]
> diff --git a/drivers/staging/lustre/lustre/ptlrpc/import.c 
> b/drivers/staging/lustre/lustre/ptlrpc/import.c
[]
> @@ -1134,9 +1134,9 @@ static int ptlrpc_connect_interpret(const struct lu_env 
> *env,
>   }
>  
>   /* Sanity checks for a reconnected import. */
> - if (!(imp->imp_replayable) != !(msg_flags & MSG_CONNECT_REPLAYABLE)) {
> + if (!(imp->imp_replayable) != !(msg_flags & MSG_CONNECT_REPLAYABLE))
>   CERROR("imp_replayable flag does not match server after 
> reconnect. We should LBUG right here.\n");
> - }
> +

There are one too many blank lines now.

And that's an awful lot of !s.

Generically, it might make simpler reading code to
cast to bool instead of using !.

Most code uses !! to make sure whatever value is
either 0 or 1 without changing the logic/polarity.

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] staging : lustre : Remove braces from single-line body.

2016-12-16 Thread Dan Carpenter
On Fri, Dec 16, 2016 at 10:43:24AM -0800, Joe Perches wrote:
> On Fri, 2016-12-16 at 23:29 +0530, Tabrez khan wrote:
> > Remove unnecessary braces {} from single line if statement.
> > This warning is found using checkpatch.pl.
> []
> > diff --git a/drivers/staging/lustre/lustre/ptlrpc/import.c 
> > b/drivers/staging/lustre/lustre/ptlrpc/import.c
> []
> > @@ -1134,9 +1134,9 @@ static int ptlrpc_connect_interpret(const struct 
> > lu_env *env,
> > }
> >  
> > /* Sanity checks for a reconnected import. */
> > -   if (!(imp->imp_replayable) != !(msg_flags & MSG_CONNECT_REPLAYABLE)) {
> > +   if (!(imp->imp_replayable) != !(msg_flags & MSG_CONNECT_REPLAYABLE))
> > CERROR("imp_replayable flag does not match server after 
> > reconnect. We should LBUG right here.\n");
> > -   }
> > +
> 
> There are one too many blank lines now.

I was expecting checkpatch.pl to catch the extra blank.  It was there in
the last patch as well.  Apparently it doesn't.

regards,
dan carpenter

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 2/3] staging: comedi: cb_pcidas64: use preferred kernel type u16

2016-12-16 Thread Saber Rezvani
Fix the checkpatch.pl issue:
CHECK: Prefer kernel type 'u16' over 'uint16_t'

Signed-off-by: Saber Rezvani 
---
 drivers/staging/comedi/drivers/cb_pcidas64.c | 58 ++--
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/drivers/staging/comedi/drivers/cb_pcidas64.c 
b/drivers/staging/comedi/drivers/cb_pcidas64.c
index 55e84d0..f60096d 100644
--- a/drivers/staging/comedi/drivers/cb_pcidas64.c
+++ b/drivers/staging/comedi/drivers/cb_pcidas64.c
@@ -238,7 +238,7 @@ enum daq_atrig_low_4020_contents {
EXT_START_TRIG_BNC_BIT = 0x2000,
 };
 
-static inline uint16_t analog_trig_low_threshold_bits(uint16_t threshold)
+static inline u16 analog_trig_low_threshold_bits(u16 threshold)
 {
return threshold & 0xfff;
 }
@@ -280,17 +280,17 @@ enum adc_control1_contents {
ADC_MODE_MASK = 0xf000,
 };
 
-static inline uint16_t adc_lo_chan_4020_bits(unsigned int channel)
+static inline u16 adc_lo_chan_4020_bits(unsigned int channel)
 {
return (channel & 0x3) << 8;
 };
 
-static inline uint16_t adc_hi_chan_4020_bits(unsigned int channel)
+static inline u16 adc_hi_chan_4020_bits(unsigned int channel)
 {
return (channel & 0x3) << 10;
 };
 
-static inline uint16_t adc_mode_bits(unsigned int mode)
+static inline u16 adc_mode_bits(unsigned int mode)
 {
return (mode & 0xf) << 12;
 };
@@ -318,12 +318,12 @@ enum calibration_contents {
  *  7 : dac channel 1
  */
 
-static inline uint16_t adc_src_bits(unsigned int source)
+static inline u16 adc_src_bits(unsigned int source)
 {
return (source & 0xf) << 3;
 };
 
-static inline uint16_t adc_convert_chan_4020_bits(unsigned int channel)
+static inline u16 adc_convert_chan_4020_bits(unsigned int channel)
 {
return (channel & 0x3) << 8;
 };
@@ -337,7 +337,7 @@ enum adc_queue_load_contents {
QUEUE_EOSCAN_BIT = 0x8000,  /* queue end of scan */
 };
 
-static inline uint16_t adc_chan_bits(unsigned int channel)
+static inline u16 adc_chan_bits(unsigned int channel)
 {
return channel & 0x3f;
 };
@@ -384,22 +384,22 @@ enum hw_status_contents {
ADC_STOP_BIT = 0x200,
 };
 
-static inline uint16_t pipe_full_bits(uint16_t hw_status_bits)
+static inline u16 pipe_full_bits(u16 hw_status_bits)
 {
return (hw_status_bits >> 10) & 0x3;
 };
 
-static inline unsigned int dma_chain_flag_bits(uint16_t prepost_bits)
+static inline unsigned int dma_chain_flag_bits(u16 prepost_bits)
 {
return (prepost_bits >> 6) & 0x3;
 }
 
-static inline unsigned int adc_upper_read_ptr_code(uint16_t prepost_bits)
+static inline unsigned int adc_upper_read_ptr_code(u16 prepost_bits)
 {
return (prepost_bits >> 12) & 0x3;
 }
 
-static inline unsigned int adc_upper_write_ptr_code(uint16_t prepost_bits)
+static inline unsigned int adc_upper_write_ptr_code(u16 prepost_bits)
 {
return (prepost_bits >> 14) & 0x3;
 }
@@ -594,7 +594,7 @@ struct hw_fifo_info {
unsigned int num_segments;
unsigned int max_segment_length;
unsigned int sample_packing_ratio;
-   uint16_t fifo_size_reg_mask;
+   u16 fifo_size_reg_mask;
 };
 
 enum pcidas64_boardid {
@@ -1135,7 +1135,7 @@ struct pcidas64_private {
uint32_t local0_iobase;
uint32_t local1_iobase;
/* dma buffers for analog input */
-   uint16_t *ai_buffer[MAX_AI_DMA_RING_COUNT];
+   u16 *ai_buffer[MAX_AI_DMA_RING_COUNT];
/* physical addresses of ai dma buffers */
dma_addr_t ai_buffer_bus_addr[MAX_AI_DMA_RING_COUNT];
/*
@@ -1151,7 +1151,7 @@ struct pcidas64_private {
 */
unsigned int ai_dma_index;
/* dma buffers for analog output */
-   uint16_t *ao_buffer[AO_DMA_RING_COUNT];
+   u16 *ao_buffer[AO_DMA_RING_COUNT];
/* physical addresses of ao dma buffers */
dma_addr_t ao_buffer_bus_addr[AO_DMA_RING_COUNT];
struct plx_dma_desc *ao_dma_desc;
@@ -1162,12 +1162,12 @@ struct pcidas64_private {
/* last bits sent to INTR_ENABLE_REG register */
unsigned int intr_enable_bits;
/* last bits sent to ADC_CONTROL1_REG register */
-   uint16_t adc_control1_bits;
+   u16 adc_control1_bits;
/* last bits sent to FIFO_SIZE_REG register */
-   uint16_t fifo_size_bits;
+   u16 fifo_size_bits;
/* last bits sent to HW_CONFIG_REG register */
-   uint16_t hw_config_bits;
-   uint16_t dac_control1_bits;
+   u16 hw_config_bits;
+   u16 dac_control1_bits;
/* last bits written to plx9080 control register */
uint32_t plx_control_bits;
/* last bits written to plx interrupt control and status register */
@@ -1193,7 +1193,7 @@ static unsigned int ai_range_bits_6xxx(const struct 
comedi_device *dev,
 }
 
 static unsigned int hw_revision(const struct comedi_device *dev,
-   uint16_t hw_status_bits)
+   u16 hw_status_bits)
 {
const struct pcidas64_board *board = dev->board_ptr;
 
@@ -120

[PATCH 1/3] staging: comedi: cb_pcidas64: use preferred kernel type u8

2016-12-16 Thread Saber Rezvani
Fix the checkpatch.pl issue:
CHECK: Prefer kernel type 'u8' over 'uint8_t'

Signed-off-by: Saber Rezvani 
---
 drivers/staging/comedi/drivers/cb_pcidas64.c | 46 ++--
 1 file changed, 23 insertions(+), 23 deletions(-)

diff --git a/drivers/staging/comedi/drivers/cb_pcidas64.c 
b/drivers/staging/comedi/drivers/cb_pcidas64.c
index cb9c269..55e84d0 100644
--- a/drivers/staging/comedi/drivers/cb_pcidas64.c
+++ b/drivers/staging/comedi/drivers/cb_pcidas64.c
@@ -418,12 +418,12 @@ enum range_cal_i2c_contents {
BNC_TRIG_THRESHOLD_0V_BIT = 0x80,
 };
 
-static inline uint8_t adc_src_4020_bits(unsigned int source)
+static inline u8 adc_src_4020_bits(unsigned int source)
 {
return (source << 4) & ADC_SRC_4020_MASK;
 };
 
-static inline uint8_t attenuate_bit(unsigned int channel)
+static inline u8 attenuate_bit(unsigned int channel)
 {
/* attenuate channel (+-5V input range) */
return 1 << (channel & 0x3);
@@ -443,7 +443,7 @@ static const struct comedi_lrange ai_ranges_64xx = {
}
 };
 
-static const uint8_t ai_range_code_64xx[8] = {
+static const u8 ai_range_code_64xx[8] = {
0x0, 0x1, 0x2, 0x3, /* bipolar 10, 5, 2,5, 1.25 */
0x8, 0x9, 0xa, 0xb  /* unipolar 10, 5, 2.5, 1.25 */
 };
@@ -461,7 +461,7 @@ static const struct comedi_lrange ai_ranges_64_mx = {
}
 };
 
-static const uint8_t ai_range_code_64_mx[7] = {
+static const u8 ai_range_code_64_mx[7] = {
0x0, 0x1, 0x2, 0x3, /* bipolar 5, 2.5, 1.25, 0.625 */
0x9, 0xa, 0xb   /* unipolar 5, 2.5, 1.25 */
 };
@@ -476,7 +476,7 @@ static const struct comedi_lrange ai_ranges_60xx = {
}
 };
 
-static const uint8_t ai_range_code_60xx[4] = {
+static const u8 ai_range_code_60xx[4] = {
0x0, 0x1, 0x4, 0x7  /* bipolar 10, 5, 0.5, 0.05 */
 };
 
@@ -500,7 +500,7 @@ static const struct comedi_lrange ai_ranges_6030 = {
}
 };
 
-static const uint8_t ai_range_code_6030[14] = {
+static const u8 ai_range_code_6030[14] = {
0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, /* bip 10, 5, 2, 1, 0.5, 0.2, 0.1 */
0x9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf  /* uni 10, 5, 2, 1, 0.5, 0.2, 0.1 */
 };
@@ -526,7 +526,7 @@ static const struct comedi_lrange ai_ranges_6052 = {
}
 };
 
-static const uint8_t ai_range_code_6052[15] = {
+static const u8 ai_range_code_6052[15] = {
0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, /* bipolar 10 ... 0.05 */
0x9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf   /* unipolar 10 ... 0.1 */
 };
@@ -634,7 +634,7 @@ struct pcidas64_board {
int ai_bits;/* analog input resolution */
int ai_speed;   /* fastest conversion period in ns */
const struct comedi_lrange *ai_range_table;
-   const uint8_t *ai_range_code;
+   const u8 *ai_range_code;
int ao_nchan;   /* number of analog out channels */
int ao_bits;/* analog output resolution */
int ao_scan_speed;  /* analog output scan speed */
@@ -1175,7 +1175,7 @@ struct pcidas64_private {
/* index of calibration source readable through ai ch0 */
int calibration_source;
/* bits written to i2c calibration/range register */
-   uint8_t i2c_cal_range_bits;
+   u8 i2c_cal_range_bits;
/* configure digital triggers to trigger on falling edge */
unsigned int ext_trig_falling;
short ai_cmd_running;
@@ -1657,9 +1657,9 @@ static void i2c_set_scl(struct comedi_device *dev, int 
state)
}
 }
 
-static void i2c_write_byte(struct comedi_device *dev, uint8_t byte)
+static void i2c_write_byte(struct comedi_device *dev, u8 byte)
 {
-   uint8_t bit;
+   u8 bit;
unsigned int num_bits = 8;
 
for (bit = 1 << (num_bits - 1); bit; bit >>= 1) {
@@ -1700,11 +1700,11 @@ static void i2c_stop(struct comedi_device *dev)
 }
 
 static void i2c_write(struct comedi_device *dev, unsigned int address,
- const uint8_t *data, unsigned int length)
+ const u8 *data, unsigned int length)
 {
struct pcidas64_private *devpriv = dev->private;
unsigned int i;
-   uint8_t bitstream;
+   u8 bitstream;
static const int read_bit = 0x1;
 
/*
@@ -1831,7 +1831,7 @@ static int ai_rinsn(struct comedi_device *dev, struct 
comedi_subdevice *s,
/* set start channel, and rest of settings */
writew(bits, devpriv->main_iobase + ADC_QUEUE_LOAD_REG);
} else {
-   uint8_t old_cal_range_bits = devpriv->i2c_cal_range_bits;
+   u8 old_cal_range_bits = devpriv->i2c_cal_range_bits;
 
devpriv->i2c_cal_range_bits &= ~ADC_SRC_4020_MASK;
if (insn->chanspec & CR_ALT_SOURCE) {
@@ -1850,7 +1850,7 @@ static int ai_rinsn(struct comedi_device *dev, struct 
comedi_subdevice *s,
 * as it is very slow
 */
if (old_cal_range_bits != devpriv->i2c_cal_range_bits) {
-   

[PATCH 3/3] staging: comedi: cb_pcidas64: use preferred kernel type u32

2016-12-16 Thread Saber Rezvani
Fix the checkpatch.pl issue:
CHECK: Prefer kernel type 'u32' over 'uint32_t'

Signed-off-by: Saber Rezvani 
---
 drivers/staging/comedi/drivers/cb_pcidas64.c | 38 ++--
 1 file changed, 19 insertions(+), 19 deletions(-)

diff --git a/drivers/staging/comedi/drivers/cb_pcidas64.c 
b/drivers/staging/comedi/drivers/cb_pcidas64.c
index f60096d..efbf277 100644
--- a/drivers/staging/comedi/drivers/cb_pcidas64.c
+++ b/drivers/staging/comedi/drivers/cb_pcidas64.c
@@ -1132,8 +1132,8 @@ struct pcidas64_private {
void __iomem *plx9080_iobase;
void __iomem *main_iobase;
/* local address (used by dma controller) */
-   uint32_t local0_iobase;
-   uint32_t local1_iobase;
+   u32 local0_iobase;
+   u32 local1_iobase;
/* dma buffers for analog input */
u16 *ai_buffer[MAX_AI_DMA_RING_COUNT];
/* physical addresses of ai dma buffers */
@@ -1169,9 +1169,9 @@ struct pcidas64_private {
u16 hw_config_bits;
u16 dac_control1_bits;
/* last bits written to plx9080 control register */
-   uint32_t plx_control_bits;
+   u32 plx_control_bits;
/* last bits written to plx interrupt control and status register */
-   uint32_t plx_intcsr_bits;
+   u32 plx_intcsr_bits;
/* index of calibration source readable through ai ch0 */
int calibration_source;
/* bits written to i2c calibration/range register */
@@ -1266,7 +1266,7 @@ static void enable_ai_interrupts(struct comedi_device 
*dev,
 {
const struct pcidas64_board *board = dev->board_ptr;
struct pcidas64_private *devpriv = dev->private;
-   uint32_t bits;
+   u32 bits;
unsigned long flags;
 
bits = EN_ADC_OVERRUN_BIT | EN_ADC_DONE_INTR_BIT |
@@ -1292,7 +1292,7 @@ static void init_plx9080(struct comedi_device *dev)
 {
const struct pcidas64_board *board = dev->board_ptr;
struct pcidas64_private *devpriv = dev->private;
-   uint32_t bits;
+   u32 bits;
void __iomem *plx_iobase = devpriv->plx9080_iobase;
 
devpriv->plx_control_bits =
@@ -2279,17 +2279,17 @@ static inline unsigned int dma_transfer_size(struct 
comedi_device *dev)
return num_samples;
 }
 
-static uint32_t ai_convert_counter_6xxx(const struct comedi_device *dev,
+static u32 ai_convert_counter_6xxx(const struct comedi_device *dev,
const struct comedi_cmd *cmd)
 {
/* supposed to load counter with desired divisor minus 3 */
return cmd->convert_arg / TIMER_BASE - 3;
 }
 
-static uint32_t ai_scan_counter_6xxx(struct comedi_device *dev,
+static u32 ai_scan_counter_6xxx(struct comedi_device *dev,
 struct comedi_cmd *cmd)
 {
-   uint32_t count;
+   u32 count;
 
/* figure out how long we need to delay at end of scan */
switch (cmd->scan_begin_src) {
@@ -2307,7 +2307,7 @@ static uint32_t ai_scan_counter_6xxx(struct comedi_device 
*dev,
return count - 3;
 }
 
-static uint32_t ai_convert_counter_4020(struct comedi_device *dev,
+static u32 ai_convert_counter_4020(struct comedi_device *dev,
struct comedi_cmd *cmd)
 {
struct pcidas64_private *devpriv = dev->private;
@@ -2382,7 +2382,7 @@ static void set_ai_pacing(struct comedi_device *dev, 
struct comedi_cmd *cmd)
 {
const struct pcidas64_board *board = dev->board_ptr;
struct pcidas64_private *devpriv = dev->private;
-   uint32_t convert_counter = 0, scan_counter = 0;
+   u32 convert_counter = 0, scan_counter = 0;
 
check_adc_timing(dev, cmd);
 
@@ -2572,7 +2572,7 @@ static int ai_cmd(struct comedi_device *dev, struct 
comedi_subdevice *s)
struct pcidas64_private *devpriv = dev->private;
struct comedi_async *async = s->async;
struct comedi_cmd *cmd = &async->cmd;
-   uint32_t bits;
+   u32 bits;
unsigned int i;
unsigned long flags;
int retval;
@@ -2754,7 +2754,7 @@ static void pio_drain_ai_fifo_32(struct comedi_device 
*dev)
struct comedi_subdevice *s = dev->read_subdev;
unsigned int nsamples;
unsigned int i;
-   uint32_t fifo_data;
+   u32 fifo_data;
int write_code =
readw(devpriv->main_iobase + ADC_WRITE_PNTR_REG) & 0x7fff;
int read_code =
@@ -2794,7 +2794,7 @@ static void drain_dma_buffers(struct comedi_device *dev, 
unsigned int channel)
const struct pcidas64_board *board = dev->board_ptr;
struct pcidas64_private *devpriv = dev->private;
struct comedi_subdevice *s = dev->read_subdev;
-   uint32_t next_transfer_addr;
+   u32 next_transfer_addr;
int j;
int num_samples = 0;
void __iomem *pci_addr_reg;
@@ -3056,8 +3056,8 @@ static irqreturn_t handle_interrupt(int irq, void *d)
struct comedi_device *dev = d;
struct pcidas64_private *devpriv = dev->private;
uns

Re: [PATCH] staging : lustre : Remove braces from single-line body.

2016-12-16 Thread Joe Perches
On Fri, 2016-12-16 at 21:53 +0300, Dan Carpenter wrote:
> On Fri, Dec 16, 2016 at 10:43:24AM -0800, Joe Perches wrote:
> > On Fri, 2016-12-16 at 23:29 +0530, Tabrez khan wrote:
> > > Remove unnecessary braces {} from single line if statement.
> > > This warning is found using checkpatch.pl.
> > 
> > []
> > > diff --git a/drivers/staging/lustre/lustre/ptlrpc/import.c 
> > > b/drivers/staging/lustre/lustre/ptlrpc/import.c
> > 
> > []
> > > @@ -1134,9 +1134,9 @@ static int ptlrpc_connect_interpret(const struct 
> > > lu_env *env,
> > >   }
> > >  
> > >   /* Sanity checks for a reconnected import. */
> > > - if (!(imp->imp_replayable) != !(msg_flags & MSG_CONNECT_REPLAYABLE)) {
> > > + if (!(imp->imp_replayable) != !(msg_flags & MSG_CONNECT_REPLAYABLE))
> > >   CERROR("imp_replayable flag does not match server after 
> > > reconnect. We should LBUG right here.\n");
> > > - }
> > > +
> > 
> > There are one too many blank lines now.
> 
> I was expecting checkpatch.pl to catch the extra blank.  It was there in
> the last patch as well.  Apparently it doesn't.

checkpatch is imperfect and always will be.

checkpatch is a stupid little script.

It mostly works on added lines and generally
only looks for style defects on lines that
precede those added lines.

Here the now unnecessary blank line follows the
added blank line.

Oh well.

Anyway, here's an almost completely untested
possible patch to checkpatch.

(also attached because evolution is a terrible
 email client, but I seem to be stuck with it)

---
 scripts/checkpatch.pl | 13 +
 1 file changed, 13 insertions(+)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 1579230ebacc..97078f7629e2 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -3063,6 +3063,19 @@ sub process {
$last_blank_line = $linenr;
}
 
+# Another check for multiple consecutive blank lines where the following
+# line is part of the context and is also blank
+   if ($line =~ /^\+\s*$/ &&
+   defined $rawlines[$linenr] &&
+   $rawlines[$linenr] =~ /^ \s*$/) {
+   if (CHK("LINE_SPACING",
+   "Please don't use multiple blank lines\n" . 
$hereprev) &&
+   $fix) {
+   fix_delete_line($fixlinenr, $rawline);
+   }
+   $last_blank_line = $linenr;
+   }
+
 # check for missing blank lines after declarations
if ($sline =~ /^\+\s+\S/ && #Not at char 1
# actual declarations scripts/checkpatch.pl | 13 +
 1 file changed, 13 insertions(+)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 1579230ebacc..97078f7629e2 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -3063,6 +3063,19 @@ sub process {
 			$last_blank_line = $linenr;
 		}
 
+# Another check for multiple consecutive blank lines where the following
+# line is part of the context and is also blank
+		if ($line =~ /^\+\s*$/ &&
+		defined $rawlines[$linenr] &&
+		$rawlines[$linenr] =~ /^ \s*$/) {
+			if (CHK("LINE_SPACING",
+"Please don't use multiple blank lines\n" . $hereprev) &&
+			$fix) {
+fix_delete_line($fixlinenr, $rawline);
+			}
+			$last_blank_line = $linenr;
+		}
+
 # check for missing blank lines after declarations
 		if ($sline =~ /^\+\s+\S/ &&			#Not at char 1
 			# actual declarations
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 02/14 V2] rtlwifi: Remove RT_TRACE messages that use DBG_EMERG

2016-12-16 Thread Joe Perches
On Thu, 2016-12-15 at 12:22 -0600, Larry Finger wrote:
> These messages are always logged and represent error conditions, thus
> we can use pr_err().

OK and some trivialities:

> diff --git a/drivers/net/wireless/realtek/rtlwifi/base.c 
> b/drivers/net/wireless/realtek/rtlwifi/base.c
[]
> @@ -389,8 +388,8 @@ static void _rtl_init_mac80211(struct ieee80211_hw *hw)
>   /* <4> set mac->sband to wiphy->sband */
>   hw->wiphy->bands[NL80211_BAND_5GHZ] = sband;
>   } else {
> - RT_TRACE(rtlpriv, COMP_INIT, DBG_EMERG, "Err BAND %d\n",
> -  rtlhal->current_bandtype);
> + pr_err("Err BAND %d\n",
> +rtlhal->current_bandtype);

It's nice to rewrap lines to 80 columns where possible.

> @@ -1886,8 +1883,7 @@ void rtl_phy_scan_operation_backup(struct ieee80211_hw 
> *hw, u8 operation)
> (u8 *)&iotype);
>   break;
>   default:
> - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
> -  "Unknown Scan Backup operation.\n");
> + pr_err("Unknown Scan Backup operation.\n");

And it's also nice to remove unnecessary periods for
output message consistency.  Most don't use it.

> diff --git a/drivers/net/wireless/realtek/rtlwifi/cam.c 
> b/drivers/net/wireless/realtek/rtlwifi/cam.c
[]
> @@ -285,8 +285,7 @@ u8 rtl_cam_get_free_entry(struct ieee80211_hw *hw, u8 
> *sta_addr)
>   u8 i, *addr;
>  
>   if (NULL == sta_addr) {
> - RT_TRACE(rtlpriv, COMP_SEC, DBG_EMERG,
> -  "sta_addr is NULL.\n");
> + pr_err("sta_addr is NULL.\n");

etc...

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] staging: comedi: ni_at_ao: using the BIT(x) macro

2016-12-16 Thread Saber Rezvani
Fix the checkpatch.pl issue:
CHECK: Prefer using the BIT macro
replacing bit shifting on 1 with the BIT(x) macro.

Signed-off-by: Saber Rezvani 
---
 drivers/staging/comedi/drivers/ni_at_ao.c | 62 +++
 1 file changed, 31 insertions(+), 31 deletions(-)

diff --git a/drivers/staging/comedi/drivers/ni_at_ao.c 
b/drivers/staging/comedi/drivers/ni_at_ao.c
index f27aa0e..158fa29 100644
--- a/drivers/staging/comedi/drivers/ni_at_ao.c
+++ b/drivers/staging/comedi/drivers/ni_at_ao.c
@@ -49,43 +49,43 @@
 #define ATAO_CFG2_REG  0x02
 #define ATAO_CFG2_CALLD_NOP(0 << 14)
 #define ATAO_CFG2_CALLD(x) x) >> 3) + 1) << 14)
-#define ATAO_CFG2_FFRTEN   (1 << 13)
+#define ATAO_CFG2_FFRTEN   BIT(13)
 #define ATAO_CFG2_DACS(x)  (1 << (((x) / 2) + 8))
 #define ATAO_CFG2_LDAC(x)  (1 << (((x) / 2) + 3))
-#define ATAO_CFG2_PROMEN   (1 << 2)
-#define ATAO_CFG2_SCLK (1 << 1)
-#define ATAO_CFG2_SDATA(1 << 0)
+#define ATAO_CFG2_PROMEN   BIT(2)
+#define ATAO_CFG2_SCLK BIT(1)
+#define ATAO_CFG2_SDATABIT(0)
 #define ATAO_CFG3_REG  0x04
-#define ATAO_CFG3_DMAMODE  (1 << 6)
-#define ATAO_CFG3_CLKOUT   (1 << 5)
-#define ATAO_CFG3_RCLKEN   (1 << 4)
-#define ATAO_CFG3_DOUTEN2  (1 << 3)
-#define ATAO_CFG3_DOUTEN1  (1 << 2)
-#define ATAO_CFG3_EN2_5V   (1 << 1)
-#define ATAO_CFG3_SCANEN   (1 << 0)
+#define ATAO_CFG3_DMAMODE  BIT(6)
+#define ATAO_CFG3_CLKOUT   BIT(5)
+#define ATAO_CFG3_RCLKEN   BIT(4)
+#define ATAO_CFG3_DOUTEN2  BIT(3)
+#define ATAO_CFG3_DOUTEN1  BIT(2)
+#define ATAO_CFG3_EN2_5V   BIT(1)
+#define ATAO_CFG3_SCANEN   BIT(0)
 #define ATAO_82C53_BASE0x06
 #define ATAO_CFG1_REG  0x0a
-#define ATAO_CFG1_EXTINT2EN(1 << 15)
-#define ATAO_CFG1_EXTINT1EN(1 << 14)
-#define ATAO_CFG1_CNTINT2EN(1 << 13)
-#define ATAO_CFG1_CNTINT1EN(1 << 12)
-#define ATAO_CFG1_TCINTEN  (1 << 11)
-#define ATAO_CFG1_CNT1SRC  (1 << 10)
-#define ATAO_CFG1_CNT2SRC  (1 << 9)
-#define ATAO_CFG1_FIFOEN   (1 << 8)
-#define ATAO_CFG1_GRP2WR   (1 << 7)
-#define ATAO_CFG1_EXTUPDEN (1 << 6)
-#define ATAO_CFG1_DMARQ(1 << 5)
-#define ATAO_CFG1_DMAEN(1 << 4)
+#define ATAO_CFG1_EXTINT2ENBIT(15)
+#define ATAO_CFG1_EXTINT1ENBIT(14)
+#define ATAO_CFG1_CNTINT2ENBIT(13)
+#define ATAO_CFG1_CNTINT1ENBIT(12)
+#define ATAO_CFG1_TCINTEN  BIT(11)
+#define ATAO_CFG1_CNT1SRC  BIT(10)
+#define ATAO_CFG1_CNT2SRC  BIT(9)
+#define ATAO_CFG1_FIFOEN   BIT(8)
+#define ATAO_CFG1_GRP2WR   BIT(7)
+#define ATAO_CFG1_EXTUPDEN BIT(6)
+#define ATAO_CFG1_DMARQBIT(5)
+#define ATAO_CFG1_DMAENBIT(4)
 #define ATAO_CFG1_CH(x)(((x) & 0xf) << 0)
 #define ATAO_STATUS_REG0x0a
-#define ATAO_STATUS_FH (1 << 6)
-#define ATAO_STATUS_FE (1 << 5)
-#define ATAO_STATUS_FF (1 << 4)
-#define ATAO_STATUS_INT2   (1 << 3)
-#define ATAO_STATUS_INT1   (1 << 2)
-#define ATAO_STATUS_TCINT  (1 << 1)
-#define ATAO_STATUS_PROMOUT(1 << 0)
+#define ATAO_STATUS_FH BIT(6)
+#define ATAO_STATUS_FE BIT(5)
+#define ATAO_STATUS_FF BIT(4)
+#define ATAO_STATUS_INT2   BIT(3)
+#define ATAO_STATUS_INT1   BIT(2)
+#define ATAO_STATUS_TCINT  BIT(1)
+#define ATAO_STATUS_PROMOUTBIT(0)
 #define ATAO_FIFO_WRITE_REG0x0c
 #define ATAO_FIFO_CLEAR_REG0x0c
 #define ATAO_AO_REG(x) (0x0c + ((x) * 2))
@@ -95,7 +95,7 @@
 #define ATAO_2_INT1CLR_REG 0x02
 #define ATAO_2_INT2CLR_REG 0x04
 #define ATAO_2_RTSISHFT_REG0x06
-#define ATAO_2_RTSISHFT_RSI(1 << 0)
+#define ATAO_2_RTSISHFT_RSIBIT(0)
 #define ATAO_2_RTSISTRB_REG0x07
 
 struct atao_board {
-- 
2.7.4


___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] staging: comedi: ni_670x: using the BIT(x) macro

2016-12-16 Thread Saber Rezvani
Fix the checkpatch.pl issue:
CHECK: Prefer using the BIT macro
replacing bit shifting on 1 with the BIT(x) macro.

Signed-off-by: Saber Rezvani 
---
 drivers/staging/comedi/drivers/ni_670x.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/comedi/drivers/ni_670x.c 
b/drivers/staging/comedi/drivers/ni_670x.c
index 74911db..1d3ff60 100644
--- a/drivers/staging/comedi/drivers/ni_670x.c
+++ b/drivers/staging/comedi/drivers/ni_670x.c
@@ -141,7 +141,7 @@ static int ni_670x_dio_insn_config(struct comedi_device 
*dev,
 
 /* ripped from mite.h and mite_setup2() to avoid mite dependency */
 #define MITE_IODWBSR   0xc0 /* IO Device Window Base Size Register */
-#define WENAB  (1 << 7) /* window enable */
+#define WENAB  BIT(7) /* window enable */
 
 static int ni_670x_mite_init(struct pci_dev *pcidev)
 {
-- 
2.7.4


___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 03/14 V2] rtlwifi: rtl8821ae: Remove all instances of DBG_EMERG

2016-12-16 Thread Joe Perches
On Thu, 2016-12-15 at 12:22 -0600, Larry Finger wrote:
> This is a step toward eliminating the RT_TRACE macros. Those calls that
> have DBG_EMERG as the level are always logged, and they represent error
> conditions, thus they are replaced with pr_err().

OK,

> diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/fw.c 
> b/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/fw.c
[]
> @@ -162,8 +161,8 @@ static int _rtl8821ae_fw_free_to_go(struct ieee80211_hw 
> *hw)
>   goto exit;
>   }
>  
> - RT_TRACE(rtlpriv, COMP_FW, DBG_EMERG,
> -  "Checksum report OK ! REG_MCUFWDL:0x%08x .\n", value32);
> + pr_err("Checksum report OK! REG_MCUFWDL:0x%08x\n",
> +value32);
>  
>   value32 = rtl_read_dword(rtlpriv, REG_MCUFWDL);
>   value32 |= MCUFWDL_RDY;
> @@ -186,9 +184,8 @@ static int _rtl8821ae_fw_free_to_go(struct ieee80211_hw 
> *hw)
>   udelay(FW_8821AE_POLLING_DELAY);
>   } while (counter++ < FW_8821AE_POLLING_TIMEOUT_COUNT);
>  
> - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
> -  "Polling FW ready fail!! REG_MCUFWDL:0x%08x .\n",
> -  value32);
> + pr_err("Polling FW ready fail!! REG_MCUFWDL:0x%08x .\n",
> +value32);

It's odd to fix / remove " .\n" above but here and
the wrapping comment on the first patch applies too.

I didn't look at the rest and I won't comment on
other uses in any further patches in the series.

Thanks,  Joe

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 1/3] staging: android: remove ION_IOC_SYNC

2016-12-16 Thread Matthew Smith
Remove definition of ION_IOC_CUSTOM from ion.h.
Remove usage from compat_ion.c and ion-ioctl.c.
Remove item from TODO file.

Signed-off-by: Matthew Smith 
---
 drivers/staging/android/TODO |  3 ---
 drivers/staging/android/ion/compat_ion.c |  1 -
 drivers/staging/android/ion/ion-ioctl.c  |  6 --
 drivers/staging/android/uapi/ion.h   | 10 --
 4 files changed, 20 deletions(-)

diff --git a/drivers/staging/android/TODO b/drivers/staging/android/TODO
index 8f3ac37..bcf736c 100644
--- a/drivers/staging/android/TODO
+++ b/drivers/staging/android/TODO
@@ -7,9 +7,6 @@ TODO:
 
 
 ion/
- - Remove ION_IOC_SYNC: Flushing for devices should be purely a kernel internal
-   interface on top of dma-buf. flush_for_device needs to be added to dma-buf
-   first.
  - Remove ION_IOC_CUSTOM: Atm used for cache flushing for cpu access in some
vendor trees. Should be replaced with an ioctl on the dma-buf to expose the
begin/end_cpu_access hooks to userspace.
diff --git a/drivers/staging/android/ion/compat_ion.c 
b/drivers/staging/android/ion/compat_ion.c
index 9a978d2..b892d3a 100644
--- a/drivers/staging/android/ion/compat_ion.c
+++ b/drivers/staging/android/ion/compat_ion.c
@@ -186,7 +186,6 @@ long compat_ion_ioctl(struct file *filp, unsigned int cmd, 
unsigned long arg)
case ION_IOC_SHARE:
case ION_IOC_MAP:
case ION_IOC_IMPORT:
-   case ION_IOC_SYNC:
return filp->f_op->unlocked_ioctl(filp, cmd,
(unsigned long)compat_ptr(arg));
default:
diff --git a/drivers/staging/android/ion/ion-ioctl.c 
b/drivers/staging/android/ion/ion-ioctl.c
index 7e7431d..aab086c 100644
--- a/drivers/staging/android/ion/ion-ioctl.c
+++ b/drivers/staging/android/ion/ion-ioctl.c
@@ -51,7 +51,6 @@ static int validate_ioctl_arg(unsigned int cmd, union 
ion_ioctl_arg *arg)
 static unsigned int ion_ioctl_dir(unsigned int cmd)
 {
switch (cmd) {
-   case ION_IOC_SYNC:
case ION_IOC_FREE:
case ION_IOC_CUSTOM:
return _IOC_WRITE;
@@ -146,11 +145,6 @@ long ion_ioctl(struct file *filp, unsigned int cmd, 
unsigned long arg)
data.handle.handle = handle->id;
break;
}
-   case ION_IOC_SYNC:
-   {
-   ret = ion_sync_for_device(client, data.fd.fd);
-   break;
-   }
case ION_IOC_CUSTOM:
{
if (!dev->custom_ioctl)
diff --git a/drivers/staging/android/uapi/ion.h 
b/drivers/staging/android/uapi/ion.h
index 14cd873..c3a87a5 100644
--- a/drivers/staging/android/uapi/ion.h
+++ b/drivers/staging/android/uapi/ion.h
@@ -207,16 +207,6 @@ struct ion_heap_query {
 #define ION_IOC_IMPORT _IOWR(ION_IOC_MAGIC, 5, struct ion_fd_data)
 
 /**
- * DOC: ION_IOC_SYNC - syncs a shared file descriptors to memory
- *
- * Deprecated in favor of using the dma_buf api's correctly (syncing
- * will happen automatically when the buffer is mapped to a device).
- * If necessary should be used after touching a cached buffer from the cpu,
- * this will make the buffer in memory coherent.
- */
-#define ION_IOC_SYNC   _IOWR(ION_IOC_MAGIC, 7, struct ion_fd_data)
-
-/**
  * DOC: ION_IOC_CUSTOM - call architecture specific ion ioctl
  *
  * Takes the argument of the architecture specific ioctl to call and
-- 
2.9.3

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 3/3] staging: android: remove compat_get_ion_custom_data

2016-12-16 Thread Matthew Smith
After removing the ION_IOC_CUSTOM case, compat_get_ion_custom_data is no
longer required.

Signed-off-by: Matthew Smith 
---
 drivers/staging/android/ion/compat_ion.c | 16 
 1 file changed, 16 deletions(-)

diff --git a/drivers/staging/android/ion/compat_ion.c 
b/drivers/staging/android/ion/compat_ion.c
index 8e6377b..a177641 100644
--- a/drivers/staging/android/ion/compat_ion.c
+++ b/drivers/staging/android/ion/compat_ion.c
@@ -105,22 +105,6 @@ static int compat_put_ion_allocation_data(
return err;
 }
 
-static int compat_get_ion_custom_data(
-   struct compat_ion_custom_data __user *data32,
-   struct ion_custom_data __user *data)
-{
-   compat_uint_t cmd;
-   compat_ulong_t arg;
-   int err;
-
-   err = get_user(cmd, &data32->cmd);
-   err |= put_user(cmd, &data->cmd);
-   err |= get_user(arg, &data32->arg);
-   err |= put_user(arg, &data->arg);
-
-   return err;
-};
-
 long compat_ion_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
 {
long ret;
-- 
2.9.3

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 2/3] staging: android: remove ION_IOC_CUSTOM

2016-12-16 Thread Matthew Smith
Remove definition of ION_IOC_CUSTOM from ion.h.
Remove usage from compat_ion.c and ion-ioctl.c.
Remove item from TOOD file.

Signed-off-by: Matthew Smith 
---
 drivers/staging/android/TODO |  3 ---
 drivers/staging/android/ion/compat_ion.c | 17 -
 drivers/staging/android/ion/ion-ioctl.c  |  9 -
 drivers/staging/android/uapi/ion.h   |  8 
 4 files changed, 37 deletions(-)

diff --git a/drivers/staging/android/TODO b/drivers/staging/android/TODO
index bcf736c..10f5ef5 100644
--- a/drivers/staging/android/TODO
+++ b/drivers/staging/android/TODO
@@ -7,9 +7,6 @@ TODO:
 
 
 ion/
- - Remove ION_IOC_CUSTOM: Atm used for cache flushing for cpu access in some
-   vendor trees. Should be replaced with an ioctl on the dma-buf to expose the
-   begin/end_cpu_access hooks to userspace.
  - Clarify the tricks ion plays with explicitly managing coherency behind the
dma api's back (this is absolutely needed for high-perf gpu drivers): Add an
explicit coherency management mode to flush_for_device to be used by drivers
diff --git a/drivers/staging/android/ion/compat_ion.c 
b/drivers/staging/android/ion/compat_ion.c
index b892d3a..8e6377b 100644
--- a/drivers/staging/android/ion/compat_ion.c
+++ b/drivers/staging/android/ion/compat_ion.c
@@ -166,23 +166,6 @@ long compat_ion_ioctl(struct file *filp, unsigned int cmd, 
unsigned long arg)
return filp->f_op->unlocked_ioctl(filp, ION_IOC_FREE,
(unsigned long)data);
}
-   case COMPAT_ION_IOC_CUSTOM: {
-   struct compat_ion_custom_data __user *data32;
-   struct ion_custom_data __user *data;
-   int err;
-
-   data32 = compat_ptr(arg);
-   data = compat_alloc_user_space(sizeof(*data));
-   if (!data)
-   return -EFAULT;
-
-   err = compat_get_ion_custom_data(data32, data);
-   if (err)
-   return err;
-
-   return filp->f_op->unlocked_ioctl(filp, ION_IOC_CUSTOM,
-   (unsigned long)data);
-   }
case ION_IOC_SHARE:
case ION_IOC_MAP:
case ION_IOC_IMPORT:
diff --git a/drivers/staging/android/ion/ion-ioctl.c 
b/drivers/staging/android/ion/ion-ioctl.c
index aab086c..038e910 100644
--- a/drivers/staging/android/ion/ion-ioctl.c
+++ b/drivers/staging/android/ion/ion-ioctl.c
@@ -52,7 +52,6 @@ static unsigned int ion_ioctl_dir(unsigned int cmd)
 {
switch (cmd) {
case ION_IOC_FREE:
-   case ION_IOC_CUSTOM:
return _IOC_WRITE;
default:
return _IOC_DIR(cmd);
@@ -145,14 +144,6 @@ long ion_ioctl(struct file *filp, unsigned int cmd, 
unsigned long arg)
data.handle.handle = handle->id;
break;
}
-   case ION_IOC_CUSTOM:
-   {
-   if (!dev->custom_ioctl)
-   return -ENOTTY;
-   ret = dev->custom_ioctl(client, data.custom.cmd,
-   data.custom.arg);
-   break;
-   }
case ION_IOC_HEAP_QUERY:
ret = ion_query_heaps(client, &data.query);
break;
diff --git a/drivers/staging/android/uapi/ion.h 
b/drivers/staging/android/uapi/ion.h
index c3a87a5..c44406f 100644
--- a/drivers/staging/android/uapi/ion.h
+++ b/drivers/staging/android/uapi/ion.h
@@ -207,14 +207,6 @@ struct ion_heap_query {
 #define ION_IOC_IMPORT _IOWR(ION_IOC_MAGIC, 5, struct ion_fd_data)
 
 /**
- * DOC: ION_IOC_CUSTOM - call architecture specific ion ioctl
- *
- * Takes the argument of the architecture specific ioctl to call and
- * passes appropriate userdata for that ioctl
- */
-#define ION_IOC_CUSTOM _IOWR(ION_IOC_MAGIC, 6, struct ion_custom_data)
-
-/**
  * DOC: ION_IOC_HEAP_QUERY - information about available heaps
  *
  * Takes an ion_heap_query structure and populates information about
-- 
2.9.3

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] vmbus: expose numa_node via sysfs

2016-12-16 Thread Stephen Hemminger
From: Stephen Hemminger 

Provide numa node information via sysfs for devices on Hyper-V
(same as PCI).
This is for some NUMA aware applications (like DPDK).

Signed-off-by: Stephen Hemminger 
---
 drivers/hv/vmbus_drv.c | 16 
 1 file changed, 16 insertions(+)

diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c
index 230c62e..201bdd9 100644
--- a/drivers/hv/vmbus_drv.c
+++ b/drivers/hv/vmbus_drv.c
@@ -230,6 +230,19 @@ static ssize_t modalias_show(struct device *dev,
 }
 static DEVICE_ATTR_RO(modalias);
 
+#ifdef CONFIG_NUMA
+static ssize_t numa_node_show(struct device *dev,
+struct device_attribute *dev_attr, char *buf)
+{
+   struct hv_device *hv_dev = device_to_hv_device(dev);
+
+   if (!hv_dev->channel)
+   return -ENODEV;
+   return sprintf(buf, "%d\n", hv_dev->channel->numa_node);
+}
+static DEVICE_ATTR_RO(numa_node);
+#endif
+
 static ssize_t server_monitor_pending_show(struct device *dev,
   struct device_attribute *dev_attr,
   char *buf)
@@ -512,6 +525,9 @@ static struct attribute *vmbus_dev_attrs[] = {
&dev_attr_class_id.attr,
&dev_attr_device_id.attr,
&dev_attr_modalias.attr,
+#ifdef CONFIG_NUMA
+   &dev_attr_numa_node.attr,
+#endif
&dev_attr_server_monitor_pending.attr,
&dev_attr_client_monitor_pending.attr,
&dev_attr_server_monitor_latency.attr,
-- 
2.10.2

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 1/3] staging: android: remove ION_IOC_SYNC

2016-12-16 Thread Laura Abbott
On 12/16/2016 02:42 PM, Matthew Smith wrote:
> Remove definition of ION_IOC_CUSTOM from ion.h.
> Remove usage from compat_ion.c and ion-ioctl.c.
> Remove item from TODO file.

The 'remove' from that TODO is more than just removing the code.
There's also an implicit 'replace it with something else'. The
work to do this is still ongoing (see some of my latest patches).
NAK for all 3 of these patches right now.

The patches themselves looked structurally good. For your commit
message next time, explain why the code was being changed, not
just what was changed.

Thanks,
Laura

> 
> Signed-off-by: Matthew Smith 
> ---
>  drivers/staging/android/TODO |  3 ---
>  drivers/staging/android/ion/compat_ion.c |  1 -
>  drivers/staging/android/ion/ion-ioctl.c  |  6 --
>  drivers/staging/android/uapi/ion.h   | 10 --
>  4 files changed, 20 deletions(-)
> 
> diff --git a/drivers/staging/android/TODO b/drivers/staging/android/TODO
> index 8f3ac37..bcf736c 100644
> --- a/drivers/staging/android/TODO
> +++ b/drivers/staging/android/TODO
> @@ -7,9 +7,6 @@ TODO:
>  
>  
>  ion/
> - - Remove ION_IOC_SYNC: Flushing for devices should be purely a kernel 
> internal
> -   interface on top of dma-buf. flush_for_device needs to be added to dma-buf
> -   first.
>   - Remove ION_IOC_CUSTOM: Atm used for cache flushing for cpu access in some
> vendor trees. Should be replaced with an ioctl on the dma-buf to expose 
> the
> begin/end_cpu_access hooks to userspace.
> diff --git a/drivers/staging/android/ion/compat_ion.c 
> b/drivers/staging/android/ion/compat_ion.c
> index 9a978d2..b892d3a 100644
> --- a/drivers/staging/android/ion/compat_ion.c
> +++ b/drivers/staging/android/ion/compat_ion.c
> @@ -186,7 +186,6 @@ long compat_ion_ioctl(struct file *filp, unsigned int 
> cmd, unsigned long arg)
>   case ION_IOC_SHARE:
>   case ION_IOC_MAP:
>   case ION_IOC_IMPORT:
> - case ION_IOC_SYNC:
>   return filp->f_op->unlocked_ioctl(filp, cmd,
>   (unsigned long)compat_ptr(arg));
>   default:
> diff --git a/drivers/staging/android/ion/ion-ioctl.c 
> b/drivers/staging/android/ion/ion-ioctl.c
> index 7e7431d..aab086c 100644
> --- a/drivers/staging/android/ion/ion-ioctl.c
> +++ b/drivers/staging/android/ion/ion-ioctl.c
> @@ -51,7 +51,6 @@ static int validate_ioctl_arg(unsigned int cmd, union 
> ion_ioctl_arg *arg)
>  static unsigned int ion_ioctl_dir(unsigned int cmd)
>  {
>   switch (cmd) {
> - case ION_IOC_SYNC:
>   case ION_IOC_FREE:
>   case ION_IOC_CUSTOM:
>   return _IOC_WRITE;
> @@ -146,11 +145,6 @@ long ion_ioctl(struct file *filp, unsigned int cmd, 
> unsigned long arg)
>   data.handle.handle = handle->id;
>   break;
>   }
> - case ION_IOC_SYNC:
> - {
> - ret = ion_sync_for_device(client, data.fd.fd);
> - break;
> - }
>   case ION_IOC_CUSTOM:
>   {
>   if (!dev->custom_ioctl)
> diff --git a/drivers/staging/android/uapi/ion.h 
> b/drivers/staging/android/uapi/ion.h
> index 14cd873..c3a87a5 100644
> --- a/drivers/staging/android/uapi/ion.h
> +++ b/drivers/staging/android/uapi/ion.h
> @@ -207,16 +207,6 @@ struct ion_heap_query {
>  #define ION_IOC_IMPORT   _IOWR(ION_IOC_MAGIC, 5, struct 
> ion_fd_data)
>  
>  /**
> - * DOC: ION_IOC_SYNC - syncs a shared file descriptors to memory
> - *
> - * Deprecated in favor of using the dma_buf api's correctly (syncing
> - * will happen automatically when the buffer is mapped to a device).
> - * If necessary should be used after touching a cached buffer from the cpu,
> - * this will make the buffer in memory coherent.
> - */
> -#define ION_IOC_SYNC _IOWR(ION_IOC_MAGIC, 7, struct ion_fd_data)
> -
> -/**
>   * DOC: ION_IOC_CUSTOM - call architecture specific ion ioctl
>   *
>   * Takes the argument of the architecture specific ioctl to call and
> 

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 1/3] staging: android: remove ION_IOC_SYNC

2016-12-16 Thread Matthew Smith
On Fri, Dec 16, 2016 at 03:05:54PM -0800, Laura Abbott wrote:
> The 'remove' from that TODO is more than just removing the code.
> There's also an implicit 'replace it with something else'. The
> work to do this is still ongoing (see some of my latest patches).
> NAK for all 3 of these patches right now.

Ah that makes a bit more sense.

> The patches themselves looked structurally good. For your commit
> message next time, explain why the code was being changed, not
> just what was changed.

Thank you for the advice, I'll remember that for next time :)
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] staging: greybus: arche-apb-ctrl: fix unused warnings on resume/suspend

2016-12-16 Thread Jérémy Lefaure
When CONFIG_PM_SLEEP is disabled, SIMPLE_DEV_PM_OPS does not use
arche_apb_ctrl_resume and arche_apb_ctrl_suspend functions:

drivers/staging/greybus/arche-apb-ctrl.c:478:12: warning:
‘arche_apb_ctrl_resume’ defined but not used [-Wunused-function]
 static int arche_apb_ctrl_resume(struct device *dev)
^
drivers/staging/greybus/arche-apb-ctrl.c:464:12: warning:
‘arche_apb_ctrl_suspend’ defined but not used [-Wunused-function]
 static int arche_apb_ctrl_suspend(struct device *dev)
^~

Adding __maybe_unused to the declaration of these functions removes the
warnings.

Signed-off-by: Jérémy Lefaure 
---
 drivers/staging/greybus/arche-apb-ctrl.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/greybus/arche-apb-ctrl.c 
b/drivers/staging/greybus/arche-apb-ctrl.c
index 3fda0cd6bb42..17fa29061e5b 100644
--- a/drivers/staging/greybus/arche-apb-ctrl.c
+++ b/drivers/staging/greybus/arche-apb-ctrl.c
@@ -461,7 +461,7 @@ static int arche_apb_ctrl_remove(struct platform_device 
*pdev)
return 0;
 }
 
-static int arche_apb_ctrl_suspend(struct device *dev)
+static int __maybe_unused arche_apb_ctrl_suspend(struct device *dev)
 {
/*
 * If timing profile permits, we may shutdown bridge
@@ -475,7 +475,7 @@ static int arche_apb_ctrl_suspend(struct device *dev)
return 0;
 }
 
-static int arche_apb_ctrl_resume(struct device *dev)
+static int __maybe_unused arche_apb_ctrl_resume(struct device *dev)
 {
/*
 * Atleast for ES2 we have to meet the delay requirement between
-- 
2.11.0

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] staging: lustre: ldlm: use designated initializers

2016-12-16 Thread Kees Cook
Prepare to mark sensitive kernel structures for randomization by making
sure they're using designated initializers. These were identified during
allyesconfig builds of x86, arm, and arm64, with most initializer fixes
extracted from grsecurity.

Signed-off-by: Kees Cook 
---
 drivers/staging/lustre/lustre/ldlm/ldlm_flock.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_flock.c 
b/drivers/staging/lustre/lustre/ldlm/ldlm_flock.c
index 722160784f83..f815827532dc 100644
--- a/drivers/staging/lustre/lustre/ldlm/ldlm_flock.c
+++ b/drivers/staging/lustre/lustre/ldlm/ldlm_flock.c
@@ -143,7 +143,7 @@ static int ldlm_process_flock_lock(struct ldlm_lock *req, 
__u64 *flags,
int added = (mode == LCK_NL);
int overlaps = 0;
int splitted = 0;
-   const struct ldlm_callback_suite null_cbs = { NULL };
+   const struct ldlm_callback_suite null_cbs = { };
 
CDEBUG(D_DLMTRACE,
   "flags %#llx owner %llu pid %u mode %u start %llu end %llu\n",
-- 
2.7.4


-- 
Kees Cook
Nexus Security
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel