[PATCH] staging/pi433: Solved some coding style issues in pi433_if.c

2017-07-31 Thread Rishabh Hardas
From: Rishabh Hardas 

Solved a few coding style issues, used BIT macro to set MINORBITS.

Signed-off-by: Rishabh Hardas 
---
 drivers/staging/pi433/pi433_if.c | 24 ++--
 1 file changed, 14 insertions(+), 10 deletions(-)

diff --git a/drivers/staging/pi433/pi433_if.c b/drivers/staging/pi433/pi433_if.c
index d9328ce..f10ffc3 100644
--- a/drivers/staging/pi433/pi433_if.c
+++ b/drivers/staging/pi433/pi433_if.c
@@ -47,18 +47,18 @@
 #include 
 #include 
 #include 
+#include 
 #ifdef CONFIG_COMPAT
-#include 
+#include 
 #endif

 #include "pi433_if.h"
 #include "rf69.h"

-
-#define N_PI433_MINORS (1U << MINORBITS) /*32*//* ... 
up to 256 */
-#define MAX_MSG_SIZE   900 /* min: FIFO_SIZE! */
-#define MSG_FIFO_SIZE  65536   /* 65536 = 2^16  */
-#define NUM_DIO2
+#define N_PI433_MINORS BIT(MINORBITS) /*32*/ /* ... up to 256 */
+#define MAX_MSG_SIZE   900 /* min: FIFO_SIZE! */
+#define MSG_FIFO_SIZE  65536   /* 65536 = 2^16  */
+#define NUM_DIO2

 static dev_t pi433_dev;
 static DEFINE_IDR(pi433_idr);
@@ -66,10 +66,14 @@

 static struct class *pi433_class; /* mainly for udev to create /dev/pi433 */

-/* tx config is instance specific
-   so with each open a new tx config struct is needed */
-/* rx config is device specific
-   so we have just one rx config, ebedded in device struct */
+/*
+ * tx config is instance specific
+ * so with each open a new tx config struct is needed
+ */
+/*
+ * rx config is device specific
+ * so we have just one rx config, ebedded in device struct
+ */
 struct pi433_device {
/* device handling related values */
dev_t   devt;
--
1.9.1
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] staging: ks7010: fix styling WARNINGs

2017-07-31 Thread kbuild test robot
Hi Ashish,

[auto build test ERROR on staging/staging-testing]
[also build test ERROR on v4.13-rc3 next-20170731]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]

url:
https://github.com/0day-ci/linux/commits/Ashish-Kalra/staging-ks7010-fix-styling-WARNINGs/20170801-121331
config: tile-allmodconfig (attached as .config)
compiler: tilegx-linux-gcc (GCC) 4.6.2
reproduce:
wget 
https://raw.githubusercontent.com/01org/lkp-tests/master/sbin/make.cross -O 
~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=tile 

All errors (new ones prefixed by >>):

   drivers/staging//ks7010/ks7010_sdio.c: In function 'ks7010_sdio_readb':
   drivers/staging//ks7010/ks7010_sdio.c:77:12: error: invalid storage class 
for function 'ks7010_sdio_readb'
   drivers/staging//ks7010/ks7010_sdio.c:77:1: warning: ISO C90 forbids mixed 
declarations and code [-Wdeclaration-after-statement]
   drivers/staging//ks7010/ks7010_sdio.c:89:12: error: invalid storage class 
for function 'ks7010_sdio_read'
   drivers/staging//ks7010/ks7010_sdio.c:98:12: error: invalid storage class 
for function 'ks7010_sdio_writeb'
   drivers/staging//ks7010/ks7010_sdio.c:110:12: error: invalid storage class 
for function 'ks7010_sdio_write'
   drivers/staging//ks7010/ks7010_sdio.c:118:13: error: invalid storage class 
for function 'ks_wlan_hw_sleep_doze_request'
   drivers/staging//ks7010/ks7010_sdio.c:144:13: error: invalid storage class 
for function 'ks_wlan_hw_sleep_wakeup_request'
   drivers/staging//ks7010/ks7010_sdio.c:191:13: error: invalid storage class 
for function '_ks_wlan_hw_power_save'
   drivers/staging//ks7010/ks7010_sdio.c:252:12: error: invalid storage class 
for function 'enqueue_txdev'
   drivers/staging//ks7010/ks7010_sdio.c:290:12: error: invalid storage class 
for function 'write_to_device'
   drivers/staging//ks7010/ks7010_sdio.c:320:13: error: invalid storage class 
for function 'tx_device_task'
   drivers/staging//ks7010/ks7010_sdio.c:379:13: error: invalid storage class 
for function 'rx_event_task'
   drivers/staging//ks7010/ks7010_sdio.c:396:13: error: invalid storage class 
for function 'ks_wlan_hw_rx'
   drivers/staging//ks7010/ks7010_sdio.c:452:13: error: invalid storage class 
for function 'ks7010_rw_function'
   drivers/staging//ks7010/ks7010_sdio.c:522:13: error: invalid storage class 
for function 'ks_sdio_interrupt'
   drivers/staging//ks7010/ks7010_sdio.c:593:12: error: invalid storage class 
for function 'trx_device_init'
   drivers/staging//ks7010/ks7010_sdio.c:609:13: error: invalid storage class 
for function 'trx_device_exit'
   drivers/staging//ks7010/ks7010_sdio.c:625:12: error: invalid storage class 
for function 'ks7010_sdio_update_index'
   drivers/staging//ks7010/ks7010_sdio.c:652:12: error: invalid storage class 
for function 'ks7010_sdio_data_compare'
   drivers/staging//ks7010/ks7010_sdio.c:680:12: error: invalid storage class 
for function 'ks7010_upload_firmware'
   drivers/staging//ks7010/ks7010_sdio.c:775:13: error: invalid storage class 
for function 'ks7010_card_init'
   drivers/staging//ks7010/ks7010_sdio.c:828:13: error: invalid storage class 
for function 'ks7010_init_defaults'
   drivers/staging//ks7010/ks7010_sdio.c:855:12: error: invalid storage class 
for function 'ks7010_sdio_probe'
   drivers/staging//ks7010/ks7010_sdio.c:1005:12: error: invalid storage class 
for function 'send_stop_request'
   drivers/staging//ks7010/ks7010_sdio.c:1032:13: error: invalid storage class 
for function 'ks7010_sdio_remove'
   drivers/staging//ks7010/ks7010_sdio.c:1100:2: error: initializer element is 
not constant
   drivers/staging//ks7010/ks7010_sdio.c:1100:2: error: (near initialization 
for 'ks7010_sdio_driver.probe')
   drivers/staging//ks7010/ks7010_sdio.c:1101:2: error: initializer element is 
not constant
   drivers/staging//ks7010/ks7010_sdio.c:1101:2: error: (near initialization 
for 'ks7010_sdio_driver.remove')
   drivers/staging//ks7010/ks7010_sdio.c:1104:1: error: invalid storage class 
for function 'ks7010_sdio_driver_init'
>> drivers/staging//ks7010/ks7010_sdio.c:1104:1: error: invalid storage class 
>> for function '__inittest'
   drivers/staging//ks7010/ks7010_sdio.c:1104:1: warning: 'alias' attribute 
ignored [-Wattributes]
   drivers/staging//ks7010/ks7010_sdio.c:1104:1: error: invalid storage class 
for function 'ks7010_sdio_driver_exit'
   drivers/staging//ks7010/ks7010_sdio.c:1104:1: warning: ISO C90 forbids mixed 
declarations and code [-Wdeclaration-after-statement]
>> drivers/staging//ks7010/ks7010_sdio.c:1104:1: error

Re: [PATCH] staging: ks7010: fix styling WARNINGs

2017-07-31 Thread kbuild test robot
Hi Ashish,

[auto build test ERROR on staging/staging-testing]
[also build test ERROR on v4.13-rc3 next-20170731]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]

url:
https://github.com/0day-ci/linux/commits/Ashish-Kalra/staging-ks7010-fix-styling-WARNINGs/20170801-121331
config: i386-randconfig-x008-201731 (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
reproduce:
# save the attached .config to linux build tree
make ARCH=i386 

All error/warnings (new ones prefixed by >>):

   drivers/staging/ks7010/ks7010_sdio.c: In function 'ks7010_sdio_readb':
>> drivers/staging/ks7010/ks7010_sdio.c:77:12: error: invalid storage class for 
>> function 'ks7010_sdio_readb'
static int ks7010_sdio_readb(struct ks_wlan_private *priv, unsigned int 
address,
   ^
>> drivers/staging/ks7010/ks7010_sdio.c:77:1: warning: ISO C90 forbids mixed 
>> declarations and code [-Wdeclaration-after-statement]
static int ks7010_sdio_readb(struct ks_wlan_private *priv, unsigned int 
address,
^~
>> drivers/staging/ks7010/ks7010_sdio.c:89:12: error: invalid storage class for 
>> function 'ks7010_sdio_read'
static int ks7010_sdio_read(struct ks_wlan_private *priv, unsigned int 
address,
   ^~~~
>> drivers/staging/ks7010/ks7010_sdio.c:98:12: error: invalid storage class for 
>> function 'ks7010_sdio_writeb'
static int ks7010_sdio_writeb(struct ks_wlan_private *priv,
   ^~
>> drivers/staging/ks7010/ks7010_sdio.c:110:12: error: invalid storage class 
>> for function 'ks7010_sdio_write'
static int ks7010_sdio_write(struct ks_wlan_private *priv, unsigned int 
address,
   ^
>> drivers/staging/ks7010/ks7010_sdio.c:118:13: error: invalid storage class 
>> for function 'ks_wlan_hw_sleep_doze_request'
static void ks_wlan_hw_sleep_doze_request(struct ks_wlan_private *priv)
^
>> drivers/staging/ks7010/ks7010_sdio.c:144:13: error: invalid storage class 
>> for function 'ks_wlan_hw_sleep_wakeup_request'
static void ks_wlan_hw_sleep_wakeup_request(struct ks_wlan_private *priv)
^~~
>> drivers/staging/ks7010/ks7010_sdio.c:191:13: error: invalid storage class 
>> for function '_ks_wlan_hw_power_save'
static void _ks_wlan_hw_power_save(struct ks_wlan_private *priv)
^~
>> drivers/staging/ks7010/ks7010_sdio.c:252:12: error: invalid storage class 
>> for function 'enqueue_txdev'
static int enqueue_txdev(struct ks_wlan_private *priv, unsigned char *p,
   ^
>> drivers/staging/ks7010/ks7010_sdio.c:290:12: error: invalid storage class 
>> for function 'write_to_device'
static int write_to_device(struct ks_wlan_private *priv, unsigned char 
*buffer,
   ^~~
>> drivers/staging/ks7010/ks7010_sdio.c:320:13: error: invalid storage class 
>> for function 'tx_device_task'
static void tx_device_task(struct ks_wlan_private *priv)
^~
>> drivers/staging/ks7010/ks7010_sdio.c:379:13: error: invalid storage class 
>> for function 'rx_event_task'
static void rx_event_task(unsigned long dev)
^
>> drivers/staging/ks7010/ks7010_sdio.c:396:13: error: invalid storage class 
>> for function 'ks_wlan_hw_rx'
static void ks_wlan_hw_rx(struct ks_wlan_private *priv, uint16_t size)
^
>> drivers/staging/ks7010/ks7010_sdio.c:452:13: error: invalid storage class 
>> for function 'ks7010_rw_function'
static void ks7010_rw_function(struct work_struct *work)
^~
>> drivers/staging/ks7010/ks7010_sdio.c:522:13: error: invalid storage class 
>> for function 'ks_sdio_interrupt'
static void ks_sdio_interrupt(struct sdio_func *func)
^
>> drivers/staging/ks7010/ks7010_sdio.c:593:12: error: invalid storage class 
>> for function 'trx_device_init'
static int trx_device_init(struct ks_wlan_private *priv)
   ^~~
>> drivers/staging/ks7010/ks7010_sdio.c:609:13: error: invalid storage class 
>> for function 'trx_device_exit'
static void trx_device_exit(struct ks_wlan_private *priv)
^~~
>> drivers/staging/ks7010/ks7010_sdio.c:625:12: error: invalid storage class 
>> for function 'ks7010_sdio_update_index'
static int ks7010_sdio_update_index(struct ks_wlan_private *priv, u32 index)

Re: [PATCH] staging: ks7010: fix styling WARNINGs

2017-07-31 Thread Greg KH
On Mon, Jul 31, 2017 at 04:15:21AM +0100, Ashish Kalra wrote:
> Signed-off-by: Ashish Kalra 
> ---

I can't accept patches without any changelog comments at all, sorry
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] staging: ks7010: fix styling WARNINGs

2017-07-31 Thread Ashish Kalra
Signed-off-by: Ashish Kalra 
---
Trivial style changes. There are still "line over 80 characters"
checkpatch.pl warnings, but I think they are best left alone as
breaking these could hurt readability

 drivers/staging/ks7010/ks7010_sdio.c | 53 +++-
 1 file changed, 40 insertions(+), 13 deletions(-)

diff --git a/drivers/staging/ks7010/ks7010_sdio.c 
b/drivers/staging/ks7010/ks7010_sdio.c
index 9b28ee1..72bf966 100644
--- a/drivers/staging/ks7010/ks7010_sdio.c
+++ b/drivers/staging/ks7010/ks7010_sdio.c
@@ -9,7 +9,6 @@
  *   it under the terms of the GNU General Public License version 2 as
  *   published by the Free Software Foundation.
  */
-
 #include 
 #include 
 #include 
@@ -32,20 +31,48 @@
 };
 MODULE_DEVICE_TABLE(sdio, ks7010_sdio_ids);
 
-#define inc_txqhead(priv) \
-   (priv->tx_dev.qhead = (priv->tx_dev.qhead + 1) % TX_DEVICE_BUFF_SIZE)
-#define inc_txqtail(priv) \
-   (priv->tx_dev.qtail = (priv->tx_dev.qtail + 1) % TX_DEVICE_BUFF_SIZE)
-#define cnt_txqbody(priv) \
-   (((priv->tx_dev.qtail + TX_DEVICE_BUFF_SIZE) - (priv->tx_dev.qhead)) % 
TX_DEVICE_BUFF_SIZE)
+static int inc_txqhead(struct ks_wlan_private *priv)
+{
+   priv->tx_dev.qhead = (priv->tx_dev.qhead + 1) % TX_DEVICE_BUFF_SIZE;
+   return 0;
+}
+
+static int inc_txqtail(struct ks_wlan_private *priv)
+{
+priv->tx_dev.qtail = (priv->tx_dev.qtail + 1) % TX_DEVICE_BUFF_SIZE;
+return 0;
+}
+
+static int inc_rxqtail(struct ks_wlan_private *priv)
+{
+   priv->rx_dev.qtail = (priv->rx_dev.qtail + 1) % RX_DEVICE_BUFF_SIZE;
+   return 0;
+}
+
+static int inc_rxqhead(struct ks_wlan_private *priv)
+{
+   priv->rx_dev.qhead = (priv->rx_dev.qhead + 1) % RX_DEVICE_BUFF_SIZE;
+   return 0;
+}
+
+static int cnt_rxqbody(struct ks_wlan_private *priv)
+{
+   return  (((priv->rx_dev.qtail + RX_DEVICE_BUFF_SIZE) - 
(priv->rx_dev.qhead)) % RX_DEVICE_BUFF_SIZE);
+}
+
+static int cnt_txqbody(struct ks_wlan_private *priv)
+{
+   return (((priv->tx_dev.qtail + TX_DEVICE_BUFF_SIZE) - 
(priv->tx_dev.qhead)) % TX_DEVICE_BUFF_SIZE);
+}
 
-#define inc_rxqhead(priv) \
-   (priv->rx_dev.qhead = (priv->rx_dev.qhead + 1) % RX_DEVICE_BUFF_SIZE)
-#define inc_rxqtail(priv) \
-   (priv->rx_dev.qtail = (priv->rx_dev.qtail + 1) % RX_DEVICE_BUFF_SIZE)
-#define cnt_rxqbody(priv) \
-   (((priv->rx_dev.qtail + RX_DEVICE_BUFF_SIZE) - (priv->rx_dev.qhead)) % 
RX_DEVICE_BUFF_SIZE)
+/* Read single byte from device address into byte (CMD52) */
+static int ks7010_sdio_readb(struct ks_wlan_private *priv, unsigned int 
address,
+unsigned char *byte)
+{
+   struct sdio_func *func = priv->ks_sdio_card->func;
+   int ret;
 
+   *byte = sdio_readb(func, address, &ret);
 /* Read single byte from device address into byte (CMD52) */
 static int ks7010_sdio_readb(struct ks_wlan_private *priv, unsigned int 
address,
 unsigned char *byte)
-- 
1.9.1

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


Re: [PATCH] Removing Check Errors with checkpatch.pl, Converting from macro to function call

2017-07-31 Thread Joe Perches
On Mon, 2017-07-31 at 03:20 +0100, Ashish Kalra wrote:

You should not use checkpatch in the commit subject and
should use a commit message.

You also need a "Signed-off-by:" line with your legal
name and email address.

> diff --git a/drivers/staging/ks7010/ks7010_sdio.c 
> b/drivers/staging/ks7010/ks7010_sdio.c
[]
> @@ -32,19 +31,39 @@
>  };
>  MODULE_DEVICE_TABLE(sdio, ks7010_sdio_ids);
>  
> -#define inc_txqhead(priv) \
> - (priv->tx_dev.qhead = (priv->tx_dev.qhead + 1) % TX_DEVICE_BUFF_SIZE)
> -#define inc_txqtail(priv) \
> - (priv->tx_dev.qtail = (priv->tx_dev.qtail + 1) % TX_DEVICE_BUFF_SIZE)
> -#define cnt_txqbody(priv) \
> - (((priv->tx_dev.qtail + TX_DEVICE_BUFF_SIZE) - (priv->tx_dev.qhead)) % 
> TX_DEVICE_BUFF_SIZE)
> -
> -#define inc_rxqhead(priv) \
> - (priv->rx_dev.qhead = (priv->rx_dev.qhead + 1) % RX_DEVICE_BUFF_SIZE)
> -#define inc_rxqtail(priv) \
> - (priv->rx_dev.qtail = (priv->rx_dev.qtail + 1) % RX_DEVICE_BUFF_SIZE)
> -#define cnt_rxqbody(priv) \
> - (((priv->rx_dev.qtail + RX_DEVICE_BUFF_SIZE) - (priv->rx_dev.qhead)) % 
> RX_DEVICE_BUFF_SIZE)
> +static int inc_txqhead(struct ks_wlan_private *priv)
> +{
> + priv->tx_dev.qhead = (priv->tx_dev.qhead + 1) % TX_DEVICE_BUFF_SIZE;
> + return 0;
> +}

These functions should return void

> +
> +static int inc_txqtail(struct ks_wlan_private *priv)
> +{
> + priv->tx_dev.qtail = (priv->tx_dev.qtail + 1) % TX_DEVICE_BUFF_SIZE;
> + return 0;
> +}
> +
> +static int inc_rxqtail(struct ks_wlan_private *priv)
> +{
> + priv->rx_dev.qtail = (priv->rx_dev.qtail + 1) % RX_DEVICE_BUFF_SIZE;
> + return 0;
> +}
> +
> +static int inc_rxqhead(struct ks_wlan_private *priv)
> +{
> + priv->rx_dev.qhead = (priv->rx_dev.qhead + 1) % RX_DEVICE_BUFF_SIZE;
> + return 0;
> +}
> +
> +static int cnt_rxqbody(struct ks_wlan_private *priv)
> +{
> + return  (((priv->rx_dev.qtail + RX_DEVICE_BUFF_SIZE) - 
> (priv->rx_dev.qhead)) % RX_DEVICE_BUFF_SIZE);
> +}

And these should return unsigned int

> +
> +static int cnt_txqbody(struct ks_wlan_private *priv)
> +{
> + return (((priv->tx_dev.qtail + TX_DEVICE_BUFF_SIZE) - 
> (priv->tx_dev.qhead)) % TX_DEVICE_BUFF_SIZE);
> +}

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


[PATCH] Removing Check Errors with checkpatch.pl, Converting from macro to function call

2017-07-31 Thread Ashish Kalra
---
 drivers/staging/ks7010/ks7010_sdio.c | 47 +---
 1 file changed, 33 insertions(+), 14 deletions(-)

diff --git a/drivers/staging/ks7010/ks7010_sdio.c 
b/drivers/staging/ks7010/ks7010_sdio.c
index 9b28ee1..274fed8 100644
--- a/drivers/staging/ks7010/ks7010_sdio.c
+++ b/drivers/staging/ks7010/ks7010_sdio.c
@@ -9,7 +9,6 @@
  *   it under the terms of the GNU General Public License version 2 as
  *   published by the Free Software Foundation.
  */
-
 #include 
 #include 
 #include 
@@ -32,19 +31,39 @@
 };
 MODULE_DEVICE_TABLE(sdio, ks7010_sdio_ids);
 
-#define inc_txqhead(priv) \
-   (priv->tx_dev.qhead = (priv->tx_dev.qhead + 1) % TX_DEVICE_BUFF_SIZE)
-#define inc_txqtail(priv) \
-   (priv->tx_dev.qtail = (priv->tx_dev.qtail + 1) % TX_DEVICE_BUFF_SIZE)
-#define cnt_txqbody(priv) \
-   (((priv->tx_dev.qtail + TX_DEVICE_BUFF_SIZE) - (priv->tx_dev.qhead)) % 
TX_DEVICE_BUFF_SIZE)
-
-#define inc_rxqhead(priv) \
-   (priv->rx_dev.qhead = (priv->rx_dev.qhead + 1) % RX_DEVICE_BUFF_SIZE)
-#define inc_rxqtail(priv) \
-   (priv->rx_dev.qtail = (priv->rx_dev.qtail + 1) % RX_DEVICE_BUFF_SIZE)
-#define cnt_rxqbody(priv) \
-   (((priv->rx_dev.qtail + RX_DEVICE_BUFF_SIZE) - (priv->rx_dev.qhead)) % 
RX_DEVICE_BUFF_SIZE)
+static int inc_txqhead(struct ks_wlan_private *priv)
+{
+   priv->tx_dev.qhead = (priv->tx_dev.qhead + 1) % TX_DEVICE_BUFF_SIZE;
+   return 0;
+}
+
+static int inc_txqtail(struct ks_wlan_private *priv)
+{
+   priv->tx_dev.qtail = (priv->tx_dev.qtail + 1) % TX_DEVICE_BUFF_SIZE;
+   return 0;
+}
+
+static int inc_rxqtail(struct ks_wlan_private *priv)
+{
+   priv->rx_dev.qtail = (priv->rx_dev.qtail + 1) % RX_DEVICE_BUFF_SIZE;
+   return 0;
+}
+
+static int inc_rxqhead(struct ks_wlan_private *priv)
+{
+   priv->rx_dev.qhead = (priv->rx_dev.qhead + 1) % RX_DEVICE_BUFF_SIZE;
+   return 0;
+}
+
+static int cnt_rxqbody(struct ks_wlan_private *priv)
+{
+   return  (((priv->rx_dev.qtail + RX_DEVICE_BUFF_SIZE) - 
(priv->rx_dev.qhead)) % RX_DEVICE_BUFF_SIZE);
+}
+
+static int cnt_txqbody(struct ks_wlan_private *priv)
+{
+   return (((priv->tx_dev.qtail + TX_DEVICE_BUFF_SIZE) - 
(priv->tx_dev.qhead)) % TX_DEVICE_BUFF_SIZE);
+}
 
 /* Read single byte from device address into byte (CMD52) */
 static int ks7010_sdio_readb(struct ks_wlan_private *priv, unsigned int 
address,
-- 
1.9.1

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


[PATCH] staging: ks7010: fix styling WARNINGs

2017-07-31 Thread osboxes.org

>From df9062e12930837d5961f2e34ae7eb612820822b Mon Sep 17 00:00:00 2001
From: Ashish Kalra 
Date: Mon, 31 Jul 2017 02:28:28 +0100
Subject: [PATCH] Removing Check Errors with checkpatch.pl, Converting from
 macro to function call

---
 drivers/staging/ks7010/ks7010_sdio.c | 47 +---
 1 file changed, 33 insertions(+), 14 deletions(-)

diff --git a/drivers/staging/ks7010/ks7010_sdio.c b/drivers/staging/ks7010/ks7010_sdio.c
index 9b28ee1..274fed8 100644
--- a/drivers/staging/ks7010/ks7010_sdio.c
+++ b/drivers/staging/ks7010/ks7010_sdio.c
@@ -9,7 +9,6 @@
  *   it under the terms of the GNU General Public License version 2 as
  *   published by the Free Software Foundation.
  */
-
 #include 
 #include 
 #include 
@@ -32,19 +31,39 @@
 };
 MODULE_DEVICE_TABLE(sdio, ks7010_sdio_ids);
 
-#define inc_txqhead(priv) \
-	(priv->tx_dev.qhead = (priv->tx_dev.qhead + 1) % TX_DEVICE_BUFF_SIZE)
-#define inc_txqtail(priv) \
-	(priv->tx_dev.qtail = (priv->tx_dev.qtail + 1) % TX_DEVICE_BUFF_SIZE)
-#define cnt_txqbody(priv) \
-	(((priv->tx_dev.qtail + TX_DEVICE_BUFF_SIZE) - (priv->tx_dev.qhead)) % TX_DEVICE_BUFF_SIZE)
-
-#define inc_rxqhead(priv) \
-	(priv->rx_dev.qhead = (priv->rx_dev.qhead + 1) % RX_DEVICE_BUFF_SIZE)
-#define inc_rxqtail(priv) \
-	(priv->rx_dev.qtail = (priv->rx_dev.qtail + 1) % RX_DEVICE_BUFF_SIZE)
-#define cnt_rxqbody(priv) \
-	(((priv->rx_dev.qtail + RX_DEVICE_BUFF_SIZE) - (priv->rx_dev.qhead)) % RX_DEVICE_BUFF_SIZE)
+static int inc_txqhead(struct ks_wlan_private *priv)
+{
+	priv->tx_dev.qhead = (priv->tx_dev.qhead + 1) % TX_DEVICE_BUFF_SIZE;
+	return 0;
+}
+
+static int inc_txqtail(struct ks_wlan_private *priv)
+{
+	priv->tx_dev.qtail = (priv->tx_dev.qtail + 1) % TX_DEVICE_BUFF_SIZE;
+	return 0;
+}
+
+static int inc_rxqtail(struct ks_wlan_private *priv)
+{
+	priv->rx_dev.qtail = (priv->rx_dev.qtail + 1) % RX_DEVICE_BUFF_SIZE;
+	return 0;
+}
+
+static int inc_rxqhead(struct ks_wlan_private *priv)
+{
+	priv->rx_dev.qhead = (priv->rx_dev.qhead + 1) % RX_DEVICE_BUFF_SIZE;
+	return 0;
+}
+
+static int cnt_rxqbody(struct ks_wlan_private *priv)
+{
+	return  (((priv->rx_dev.qtail + RX_DEVICE_BUFF_SIZE) - (priv->rx_dev.qhead)) % RX_DEVICE_BUFF_SIZE);
+}
+
+static int cnt_txqbody(struct ks_wlan_private *priv)
+{
+	return (((priv->tx_dev.qtail + TX_DEVICE_BUFF_SIZE) - (priv->tx_dev.qhead)) % TX_DEVICE_BUFF_SIZE);
+}
 
 /* Read single byte from device address into byte (CMD52) */
 static int ks7010_sdio_readb(struct ks_wlan_private *priv, unsigned int address,
-- 
1.9.1

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


[PATCH net-next v2 1/3] netvsc: transparent VF management

2017-07-31 Thread Stephen Hemminger
This patch implements transparent fail over from synthetic NIC to
SR-IOV virtual function NIC in Hyper-V environment. It is a better
alternative to using bonding as is done now. Instead, the receive and
transmit fail over is done internally inside the driver.

Using bonding driver has lots of issues because it depends on the
script being run early enough in the boot process and with sufficient
information to make the association. This patch moves all that
functionality into the kernel.

Signed-off-by: Stephen Hemminger 
---
 drivers/net/hyperv/hyperv_net.h |  12 ++
 drivers/net/hyperv/netvsc_drv.c | 419 +++-
 2 files changed, 342 insertions(+), 89 deletions(-)

diff --git a/drivers/net/hyperv/hyperv_net.h b/drivers/net/hyperv/hyperv_net.h
index f2cef5aaed1f..c701b059c5ac 100644
--- a/drivers/net/hyperv/hyperv_net.h
+++ b/drivers/net/hyperv/hyperv_net.h
@@ -680,6 +680,15 @@ struct netvsc_ethtool_stats {
unsigned long tx_busy;
 };
 
+struct netvsc_vf_pcpu_stats {
+   u64 rx_packets;
+   u64 rx_bytes;
+   u64 tx_packets;
+   u64 tx_bytes;
+   struct u64_stats_sync   syncp;
+   u32 tx_dropped;
+};
+
 struct netvsc_reconfig {
struct list_head list;
u32 event;
@@ -713,6 +722,9 @@ struct net_device_context {
 
/* State to manage the associated VF interface. */
struct net_device __rcu *vf_netdev;
+   struct netvsc_vf_pcpu_stats __percpu *vf_stats;
+   struct work_struct vf_takeover;
+   struct work_struct vf_notify;
 
/* 1: allocated, serial number is valid. 0: not allocated */
u32 vf_alloc;
diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c
index 8ff4cbf582cc..fef80dcbd71b 100644
--- a/drivers/net/hyperv/netvsc_drv.c
+++ b/drivers/net/hyperv/netvsc_drv.c
@@ -34,6 +34,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -71,6 +72,7 @@ static void netvsc_set_multicast_list(struct net_device *net)
 static int netvsc_open(struct net_device *net)
 {
struct net_device_context *ndev_ctx = netdev_priv(net);
+   struct net_device *vf_netdev = rtnl_dereference(ndev_ctx->vf_netdev);
struct netvsc_device *nvdev = rtnl_dereference(ndev_ctx->nvdev);
struct rndis_device *rdev;
int ret = 0;
@@ -87,15 +89,29 @@ static int netvsc_open(struct net_device *net)
netif_tx_wake_all_queues(net);
 
rdev = nvdev->extension;
-   if (!rdev->link_state && !ndev_ctx->datapath)
+
+   if (!rdev->link_state)
netif_carrier_on(net);
 
-   return ret;
+   if (vf_netdev) {
+   /* Setting synthetic device up transparently sets
+* slave as up. If open fails, then slave will be
+* still be offline (and not used).
+*/
+   ret = dev_open(vf_netdev);
+   if (ret)
+   netdev_warn(net,
+   "unable to open slave: %s: %d\n",
+   vf_netdev->name, ret);
+   }
+   return 0;
 }
 
 static int netvsc_close(struct net_device *net)
 {
struct net_device_context *net_device_ctx = netdev_priv(net);
+   struct net_device *vf_netdev
+   = rtnl_dereference(net_device_ctx->vf_netdev);
struct netvsc_device *nvdev = rtnl_dereference(net_device_ctx->nvdev);
int ret;
u32 aread, i, msec = 10, retry = 0, retry_max = 20;
@@ -141,6 +157,9 @@ static int netvsc_close(struct net_device *net)
ret = -ETIMEDOUT;
}
 
+   if (vf_netdev)
+   dev_close(vf_netdev);
+
return ret;
 }
 
@@ -224,13 +243,11 @@ static inline int netvsc_get_tx_queue(struct net_device 
*ndev,
  *
  * TODO support XPS - but get_xps_queue not exported
  */
-static u16 netvsc_select_queue(struct net_device *ndev, struct sk_buff *skb,
-   void *accel_priv, select_queue_fallback_t fallback)
+static u16 netvsc_pick_tx(struct net_device *ndev, struct sk_buff *skb)
 {
-   unsigned int num_tx_queues = ndev->real_num_tx_queues;
int q_idx = sk_tx_queue_get(skb->sk);
 
-   if (q_idx < 0 || skb->ooo_okay) {
+   if (q_idx < 0 || skb->ooo_okay || q_idx >= ndev->real_num_tx_queues) {
/* If forwarding a packet, we use the recorded queue when
 * available for better cache locality.
 */
@@ -240,12 +257,33 @@ static u16 netvsc_select_queue(struct net_device *ndev, 
struct sk_buff *skb,
q_idx = netvsc_get_tx_queue(ndev, skb, q_idx);
}
 
-   while (unlikely(q_idx >= num_tx_queues))
-   q_idx -= num_tx_queues;
-
return q_idx;
 }
 
+static u16 netvsc_select_queue(struct net_device *ndev, struct sk_buff *skb,
+  void *accel_priv,
+  select_queue_fallback_t fallback)
+{
+   struct net_device_context

[PATCH net-next v2 0/3] netvsc: transparent SR-IOV VF support

2017-07-31 Thread Stephen Hemminger
This patch set changes how SR-IOV Virtual Function devices are managed
in the Hyper-V network driver. It was part of earlier bundle, but
is now updated.

Background

In Hyper-V SR-IOV can be enabled (and disabled) by changing guest settings
on host. When SR-IOV is enabled a matching PCI device is hot plugged and
visible on guest. The VF device is an add-on to an existing netvsc
device, and has the same MAC address.

How is this different?

The original support of VF relied on using bonding driver in active
standby mode to handle the VF device.

With the new netvsc VF logic, the Linux hyper-V network
virtual driver will directly manage the link to SR-IOV VF device.
When VF device is detected (hot plug) it is automatically made a
slave device of the netvsc device. The VF device state reflects
the state of the netvsc device; i.e. if netvsc is set down, then
VF is set down. If netvsc is set up, then VF is brought up.
 
Packet flow is independent of VF status; all packets are sent and
received as if they were associated with the netvsc device. If VF is
removed or link is down then the synthetic VMBUS path is used.
 
What was wrong with using bonding script?

A lot of work went into getting the bonding script to work on all
distributions, but it was a major struggle. Linux network devices
can be configured many, many ways and there is no one solution from
userspace to make it all work. What is really hard is when
configuration is attached to synthetic device during boot (eth0) and
then the same addresses and firewall rules needs to also work later if
doing bonding. The new code gets around all of this.
 
How does VF work during initialization?

Since all packets are sent and received through the logical netvsc
device, initialization is much easier. Just configure the regular
netvsc Ethernet device; when/if SR-IOV is enabled it just
works. Provisioning and cloud init only need to worry about setting up
netvsc device (eth0). If SR-IOV is enabled (even as a later step), the
address and rules stay the same.
 
What devices show up?

Both netvsc and PCI devices are visible in the system. The netvsc
device is active and named in usual manner (eth0). The PCI device is
visible to Linux and gets renamed by udev to a persistent name
(enP2p3s0). The PCI device name is now irrelevant now.

The logic also sets the PCI VF device SLAVE flag on the network
device so network tools can see the relationship if they are smart
enough to understand how layered devices work.
 
This is a lot like how I see Windows working.
The VF device is visible in Device Manager, but is not configured.
 
Is there any performance impact?
There is no visible change in performance. The bonding
and netvsc driver both have equivalent steps.
 
Is it compatible with old bonding script?

It turns out that if you use the old bonding script, then everything
still works but in a sub-optimum manner. What happens is that bonding
is unable to steal the VF from the netvsc device so it creates a one
legged bond.  Packet flow then is:
bond0 <--> eth0 <- -> VF (enP2p3s0).
In other words, if you get it wrong it still works, just
awkward and slower.
 
What if I add address or firewall rule onto the VF?

Same problems occur with now as already occur with bonding, bridging,
teaming on Linux if user incorrectly does configuration onto
an underlying slave device. It will sort of work, packets will come in
and out but the Linux kernel gets confused and things like ARP don’t
work right.  There is no way to block manipulation of the slave
device, and I am sure someone will find some special use case where
they want it.


Stephen Hemminger (3):
  netvsc: transparent VF management
  netvsc: add documentation
  netvsc: remove bonding setup script

 Documentation/networking/netvsc.txt |  63 ++
 MAINTAINERS |   1 +
 drivers/net/hyperv/hyperv_net.h |  12 ++
 drivers/net/hyperv/netvsc_drv.c | 419 
 tools/hv/bondvf.sh  | 255 --
 5 files changed, 406 insertions(+), 344 deletions(-)
 create mode 100644 Documentation/networking/netvsc.txt
 delete mode 100755 tools/hv/bondvf.sh

-- 
2.11.0

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


[PATCH net-next v2 2/3] netvsc: add documentation

2017-07-31 Thread Stephen Hemminger
Add some background documentation on netvsc device options
and limitations.

Signed-off-by: Stephen Hemminger 
---
 Documentation/networking/netvsc.txt | 63 +
 MAINTAINERS |  1 +
 2 files changed, 64 insertions(+)
 create mode 100644 Documentation/networking/netvsc.txt

diff --git a/Documentation/networking/netvsc.txt 
b/Documentation/networking/netvsc.txt
new file mode 100644
index ..4ddb4e4b0426
--- /dev/null
+++ b/Documentation/networking/netvsc.txt
@@ -0,0 +1,63 @@
+Hyper-V network driver
+==
+
+Compatibility
+=
+
+This driver is compatible with Windows Server 2012 R2, 2016 and
+Windows 10.
+
+Features
+
+
+  Checksum offload
+  
+  The netvsc driver supports checksum offload as long as the
+  Hyper-V host version does. Windows Server 2016 and Azure
+  support checksum offload for TCP and UDP for both IPv4 and
+  IPv6. Windows Server 2012 only supports checksum offload for TCP.
+
+  Receive Side Scaling
+  
+  Hyper-V supports receive side scaling. For TCP, packets are
+  distributed among available queues based on IP address and port
+  number. Current versions of Hyper-V host, only distribute UDP
+  packets based on the IP source and destination address.
+  The port number is not used as part of the hash value for UDP.
+  Fragmented IP packets are not distributed between queues;
+  all fragmented packets arrive on the first channel.
+
+  Generic Receive Offload, aka GRO
+  
+  The driver supports GRO and it is enabled by default. GRO coalesces
+  like packets and significantly reduces CPU usage under heavy Rx
+  load.
+
+  SR-IOV support
+  --
+  Hyper-V supports SR-IOV as a hardware acceleration option. If SR-IOV
+  is enabled in both the vSwitch and the guest configuration, then the
+  Virtual Function (VF) device is passed to the guest as a PCI
+  device. In this case, both a synthetic (netvsc) and VF device are
+  visible in the guest OS and both NIC's have the same MAC address.
+
+  The VF is enslaved by netvsc device.  The netvsc driver will transparently
+  switch the data path to the VF when it is available and up.
+  Network state (addresses, firewall, etc) should be applied only to the
+  netvsc device; the slave device should not be accessed directly in
+  most cases.  The exceptions are if some special queue discipline or
+  flow direction is desired, these should be applied directly to the
+  VF slave device.
+
+  Receive Buffer
+  --
+  Packets are received into a receive area which is created when device
+  is probed. The receive area is broken into MTU sized chunks and each may
+  contain one or more packets. The number of receive sections may be changed
+  via ethtool Rx ring parameters.
+
+  There is a similar send buffer which is used to aggregate packets for 
sending.
+  The send area is broken into chunks of 6144 bytes, each of section may
+  contain one or more packets. The send buffer is an optimization, the driver
+  will use slower method to handle very large packets or if the send buffer
+  area is exhausted.
diff --git a/MAINTAINERS b/MAINTAINERS
index 297e610c9163..d30c17df1deb 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -6294,6 +6294,7 @@ M:Haiyang Zhang 
 M: Stephen Hemminger 
 L: de...@linuxdriverproject.org
 S: Maintained
+F: Documentation/networking/netvsc.txt
 F: arch/x86/include/asm/mshyperv.h
 F: arch/x86/include/uapi/asm/hyperv.h
 F: arch/x86/kernel/cpu/mshyperv.c
-- 
2.11.0

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


[PATCH net-next v2 3/3] netvsc: remove bonding setup script

2017-07-31 Thread Stephen Hemminger
No longer needed, now all managed by transparent VF logic.

Signed-off-by: Stephen Hemminger 
---
 tools/hv/bondvf.sh | 255 -
 1 file changed, 255 deletions(-)
 delete mode 100755 tools/hv/bondvf.sh

diff --git a/tools/hv/bondvf.sh b/tools/hv/bondvf.sh
deleted file mode 100755
index 80f102860cf8..
--- a/tools/hv/bondvf.sh
+++ /dev/null
@@ -1,255 +0,0 @@
-#!/bin/bash
-
-# This example script creates bonding network devices based on synthetic NIC
-# (the virtual network adapter usually provided by Hyper-V) and the matching
-# VF NIC (SRIOV virtual function). So the synthetic NIC and VF NIC can
-# function as one network device, and fail over to the synthetic NIC if VF is
-# down.
-#
-# Usage:
-# - After configured vSwitch and vNIC with SRIOV, start Linux virtual
-#   machine (VM)
-# - Run this scripts on the VM. It will create configuration files in
-#   distro specific directory.
-# - Reboot the VM, so that the bonding config are enabled.
-#
-# The config files are DHCP by default. You may edit them if you need to change
-# to Static IP or change other settings.
-#
-
-sysdir=/sys/class/net
-netvsc_cls={f8615163-df3e-46c5-913f-f2d2f965ed0e}
-bondcnt=0
-
-# Detect Distro
-if [ -f /etc/redhat-release ];
-then
-   cfgdir=/etc/sysconfig/network-scripts
-   distro=redhat
-elif grep -q 'Ubuntu' /etc/issue
-then
-   cfgdir=/etc/network
-   distro=ubuntu
-elif grep -q 'SUSE' /etc/issue
-then
-   cfgdir=/etc/sysconfig/network
-   distro=suse
-else
-   echo "Unsupported Distro"
-   exit 1
-fi
-
-echo Detected Distro: $distro, or compatible
-
-# Get a list of ethernet names
-list_eth=(`cd $sysdir && ls -d */ | cut -d/ -f1 | grep -v bond`)
-eth_cnt=${#list_eth[@]}
-
-echo List of net devices:
-
-# Get the MAC addresses
-for (( i=0; i < $eth_cnt; i++ ))
-do
-   list_mac[$i]=`cat $sysdir/${list_eth[$i]}/address`
-   echo ${list_eth[$i]}, ${list_mac[$i]}
-done
-
-# Find NIC with matching MAC
-for (( i=0; i < $eth_cnt-1; i++ ))
-do
-   for (( j=i+1; j < $eth_cnt; j++ ))
-   do
-   if [ "${list_mac[$i]}" = "${list_mac[$j]}" ]
-   then
-   list_match[$i]=${list_eth[$j]}
-   break
-   fi
-   done
-done
-
-function create_eth_cfg_redhat {
-   local fn=$cfgdir/ifcfg-$1
-
-   rm -f $fn
-   echo DEVICE=$1 >>$fn
-   echo TYPE=Ethernet >>$fn
-   echo BOOTPROTO=none >>$fn
-   echo UUID=`uuidgen` >>$fn
-   echo ONBOOT=yes >>$fn
-   echo PEERDNS=yes >>$fn
-   echo IPV6INIT=yes >>$fn
-   echo MASTER=$2 >>$fn
-   echo SLAVE=yes >>$fn
-}
-
-function create_eth_cfg_pri_redhat {
-   create_eth_cfg_redhat $1 $2
-}
-
-function create_bond_cfg_redhat {
-   local fn=$cfgdir/ifcfg-$1
-
-   rm -f $fn
-   echo DEVICE=$1 >>$fn
-   echo TYPE=Bond >>$fn
-   echo BOOTPROTO=dhcp >>$fn
-   echo UUID=`uuidgen` >>$fn
-   echo ONBOOT=yes >>$fn
-   echo PEERDNS=yes >>$fn
-   echo IPV6INIT=yes >>$fn
-   echo BONDING_MASTER=yes >>$fn
-   echo BONDING_OPTS=\"mode=active-backup miimon=100 primary=$2\" >>$fn
-}
-
-function del_eth_cfg_ubuntu {
-   local mainfn=$cfgdir/interfaces
-   local fnlist=( $mainfn )
-
-   local dirlist=(`awk '/^[ \t]*source/{print $2}' $mainfn`)
-
-   local i
-   for i in "${dirlist[@]}"
-   do
-   fnlist+=(`ls $i 2>/dev/null`)
-   done
-
-   local tmpfl=$(mktemp)
-
-   local nic_start='^[ \t]*(auto|iface|mapping|allow-.*)[ \t]+'$1
-   local nic_end='^[ \t]*(auto|iface|mapping|allow-.*|source)'
-
-   local fn
-   for fn in "${fnlist[@]}"
-   do
-   awk "/$nic_end/{x=0} x{next} /$nic_start/{x=1;next} 1" \
-   $fn >$tmpfl
-
-   cp $tmpfl $fn
-   done
-
-   rm $tmpfl
-}
-
-function create_eth_cfg_ubuntu {
-   local fn=$cfgdir/interfaces
-
-   del_eth_cfg_ubuntu $1
-   echo $'\n'auto $1 >>$fn
-   echo iface $1 inet manual >>$fn
-   echo bond-master $2 >>$fn
-}
-
-function create_eth_cfg_pri_ubuntu {
-   local fn=$cfgdir/interfaces
-
-   del_eth_cfg_ubuntu $1
-   echo $'\n'allow-hotplug $1 >>$fn
-   echo iface $1 inet manual >>$fn
-   echo bond-master $2 >>$fn
-   echo bond-primary $1 >>$fn
-}
-
-function create_bond_cfg_ubuntu {
-   local fn=$cfgdir/interfaces
-
-   del_eth_cfg_ubuntu $1
-
-   echo $'\n'auto $1 >>$fn
-   echo iface $1 inet dhcp >>$fn
-   echo bond-mode active-backup >>$fn
-   echo bond-miimon 100 >>$fn
-   echo bond-slaves none >>$fn
-}
-
-function create_eth_cfg_suse {
-local fn=$cfgdir/ifcfg-$1
-
-rm -f $fn
-   echo BOOTPROTO=none >>$fn
-   echo STARTMODE=auto >>$fn
-}
-
-function create_eth_cfg_pri_suse {
-   local fn=$cfgdir/ifcfg-$1
-
-   rm -f $fn
-   echo BOOTPROTO=none >>$fn
-   echo STARTMODE=hotplug >>$fn
-}
-
-f

Re: [PATCH net-next 4/4] pci-hyperv: do not sleep in compose_msi_msg

2017-07-31 Thread Stephen Hemminger
On Mon, 31 Jul 2017 16:37:12 -0700
Stephen Hemminger  wrote:

> The setup of MSI with Hyper-V host was sleeping with locks held.
> This error is reported when doing SR-IOV hotplug with kernel built with 
> lockdep.
> 
> BUG: sleeping function called from invalid context at 
> kernel/sched/completion.c:93
> in_atomic(): 1, irqs_disabled(): 1, pid: 1405, name: ip
> 3 locks held by ip/1405:
>#0:  (rtnl_mutex){+.+.+.}, at: [] rtnetlink_rcv+0x1b/0x40
>#1:  (&desc->request_mutex){+.+...}, at: [] 
> __setup_irq+0xb3/0x720
>#2:  (&irq_desc_lock_class){-.-...}, at: [] 
> __setup_irq+0xe5/0x720
>irq event stamp: 3476
>hardirqs last  enabled at (3475): [] 
> get_page_from_freelist+0x225/0xc90
>hardirqs last disabled at (3476): [] 
> _raw_spin_lock_irqsave+0x27/0x90
>softirqs last  enabled at (2446): [] 
> ixgbevf_configure+0x380/0x7c0 [ixgbevf]
>softirqs last disabled at (2444): [] 
> ixgbevf_configure+0x35d/0x7c0 [ixgbevf]
> 
> The workaround is to poll for host response instead of blocking on
> completion.
> 
> Signed-off-by: Stephen Hemminger 

This patch is not directly network related. It needs to go through PCI.

I will resend the series.
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH net-next 2/4] netvsc: add documentation

2017-07-31 Thread Stephen Hemminger
Add some background documentation on netvsc device options
and limitations.

Signed-off-by: Stephen Hemminger 
---
 Documentation/networking/netvsc.txt | 63 +
 MAINTAINERS |  1 +
 2 files changed, 64 insertions(+)
 create mode 100644 Documentation/networking/netvsc.txt

diff --git a/Documentation/networking/netvsc.txt 
b/Documentation/networking/netvsc.txt
new file mode 100644
index ..4ddb4e4b0426
--- /dev/null
+++ b/Documentation/networking/netvsc.txt
@@ -0,0 +1,63 @@
+Hyper-V network driver
+==
+
+Compatibility
+=
+
+This driver is compatible with Windows Server 2012 R2, 2016 and
+Windows 10.
+
+Features
+
+
+  Checksum offload
+  
+  The netvsc driver supports checksum offload as long as the
+  Hyper-V host version does. Windows Server 2016 and Azure
+  support checksum offload for TCP and UDP for both IPv4 and
+  IPv6. Windows Server 2012 only supports checksum offload for TCP.
+
+  Receive Side Scaling
+  
+  Hyper-V supports receive side scaling. For TCP, packets are
+  distributed among available queues based on IP address and port
+  number. Current versions of Hyper-V host, only distribute UDP
+  packets based on the IP source and destination address.
+  The port number is not used as part of the hash value for UDP.
+  Fragmented IP packets are not distributed between queues;
+  all fragmented packets arrive on the first channel.
+
+  Generic Receive Offload, aka GRO
+  
+  The driver supports GRO and it is enabled by default. GRO coalesces
+  like packets and significantly reduces CPU usage under heavy Rx
+  load.
+
+  SR-IOV support
+  --
+  Hyper-V supports SR-IOV as a hardware acceleration option. If SR-IOV
+  is enabled in both the vSwitch and the guest configuration, then the
+  Virtual Function (VF) device is passed to the guest as a PCI
+  device. In this case, both a synthetic (netvsc) and VF device are
+  visible in the guest OS and both NIC's have the same MAC address.
+
+  The VF is enslaved by netvsc device.  The netvsc driver will transparently
+  switch the data path to the VF when it is available and up.
+  Network state (addresses, firewall, etc) should be applied only to the
+  netvsc device; the slave device should not be accessed directly in
+  most cases.  The exceptions are if some special queue discipline or
+  flow direction is desired, these should be applied directly to the
+  VF slave device.
+
+  Receive Buffer
+  --
+  Packets are received into a receive area which is created when device
+  is probed. The receive area is broken into MTU sized chunks and each may
+  contain one or more packets. The number of receive sections may be changed
+  via ethtool Rx ring parameters.
+
+  There is a similar send buffer which is used to aggregate packets for 
sending.
+  The send area is broken into chunks of 6144 bytes, each of section may
+  contain one or more packets. The send buffer is an optimization, the driver
+  will use slower method to handle very large packets or if the send buffer
+  area is exhausted.
diff --git a/MAINTAINERS b/MAINTAINERS
index 297e610c9163..d30c17df1deb 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -6294,6 +6294,7 @@ M:Haiyang Zhang 
 M: Stephen Hemminger 
 L: de...@linuxdriverproject.org
 S: Maintained
+F: Documentation/networking/netvsc.txt
 F: arch/x86/include/asm/mshyperv.h
 F: arch/x86/include/uapi/asm/hyperv.h
 F: arch/x86/kernel/cpu/mshyperv.c
-- 
2.11.0

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


[PATCH net-next 3/4] netvsc: remove bonding setup script

2017-07-31 Thread Stephen Hemminger
No longer needed, now all managed by transparent VF logic.

Signed-off-by: Stephen Hemminger 
---
 tools/hv/bondvf.sh | 255 -
 1 file changed, 255 deletions(-)
 delete mode 100755 tools/hv/bondvf.sh

diff --git a/tools/hv/bondvf.sh b/tools/hv/bondvf.sh
deleted file mode 100755
index 80f102860cf8..
--- a/tools/hv/bondvf.sh
+++ /dev/null
@@ -1,255 +0,0 @@
-#!/bin/bash
-
-# This example script creates bonding network devices based on synthetic NIC
-# (the virtual network adapter usually provided by Hyper-V) and the matching
-# VF NIC (SRIOV virtual function). So the synthetic NIC and VF NIC can
-# function as one network device, and fail over to the synthetic NIC if VF is
-# down.
-#
-# Usage:
-# - After configured vSwitch and vNIC with SRIOV, start Linux virtual
-#   machine (VM)
-# - Run this scripts on the VM. It will create configuration files in
-#   distro specific directory.
-# - Reboot the VM, so that the bonding config are enabled.
-#
-# The config files are DHCP by default. You may edit them if you need to change
-# to Static IP or change other settings.
-#
-
-sysdir=/sys/class/net
-netvsc_cls={f8615163-df3e-46c5-913f-f2d2f965ed0e}
-bondcnt=0
-
-# Detect Distro
-if [ -f /etc/redhat-release ];
-then
-   cfgdir=/etc/sysconfig/network-scripts
-   distro=redhat
-elif grep -q 'Ubuntu' /etc/issue
-then
-   cfgdir=/etc/network
-   distro=ubuntu
-elif grep -q 'SUSE' /etc/issue
-then
-   cfgdir=/etc/sysconfig/network
-   distro=suse
-else
-   echo "Unsupported Distro"
-   exit 1
-fi
-
-echo Detected Distro: $distro, or compatible
-
-# Get a list of ethernet names
-list_eth=(`cd $sysdir && ls -d */ | cut -d/ -f1 | grep -v bond`)
-eth_cnt=${#list_eth[@]}
-
-echo List of net devices:
-
-# Get the MAC addresses
-for (( i=0; i < $eth_cnt; i++ ))
-do
-   list_mac[$i]=`cat $sysdir/${list_eth[$i]}/address`
-   echo ${list_eth[$i]}, ${list_mac[$i]}
-done
-
-# Find NIC with matching MAC
-for (( i=0; i < $eth_cnt-1; i++ ))
-do
-   for (( j=i+1; j < $eth_cnt; j++ ))
-   do
-   if [ "${list_mac[$i]}" = "${list_mac[$j]}" ]
-   then
-   list_match[$i]=${list_eth[$j]}
-   break
-   fi
-   done
-done
-
-function create_eth_cfg_redhat {
-   local fn=$cfgdir/ifcfg-$1
-
-   rm -f $fn
-   echo DEVICE=$1 >>$fn
-   echo TYPE=Ethernet >>$fn
-   echo BOOTPROTO=none >>$fn
-   echo UUID=`uuidgen` >>$fn
-   echo ONBOOT=yes >>$fn
-   echo PEERDNS=yes >>$fn
-   echo IPV6INIT=yes >>$fn
-   echo MASTER=$2 >>$fn
-   echo SLAVE=yes >>$fn
-}
-
-function create_eth_cfg_pri_redhat {
-   create_eth_cfg_redhat $1 $2
-}
-
-function create_bond_cfg_redhat {
-   local fn=$cfgdir/ifcfg-$1
-
-   rm -f $fn
-   echo DEVICE=$1 >>$fn
-   echo TYPE=Bond >>$fn
-   echo BOOTPROTO=dhcp >>$fn
-   echo UUID=`uuidgen` >>$fn
-   echo ONBOOT=yes >>$fn
-   echo PEERDNS=yes >>$fn
-   echo IPV6INIT=yes >>$fn
-   echo BONDING_MASTER=yes >>$fn
-   echo BONDING_OPTS=\"mode=active-backup miimon=100 primary=$2\" >>$fn
-}
-
-function del_eth_cfg_ubuntu {
-   local mainfn=$cfgdir/interfaces
-   local fnlist=( $mainfn )
-
-   local dirlist=(`awk '/^[ \t]*source/{print $2}' $mainfn`)
-
-   local i
-   for i in "${dirlist[@]}"
-   do
-   fnlist+=(`ls $i 2>/dev/null`)
-   done
-
-   local tmpfl=$(mktemp)
-
-   local nic_start='^[ \t]*(auto|iface|mapping|allow-.*)[ \t]+'$1
-   local nic_end='^[ \t]*(auto|iface|mapping|allow-.*|source)'
-
-   local fn
-   for fn in "${fnlist[@]}"
-   do
-   awk "/$nic_end/{x=0} x{next} /$nic_start/{x=1;next} 1" \
-   $fn >$tmpfl
-
-   cp $tmpfl $fn
-   done
-
-   rm $tmpfl
-}
-
-function create_eth_cfg_ubuntu {
-   local fn=$cfgdir/interfaces
-
-   del_eth_cfg_ubuntu $1
-   echo $'\n'auto $1 >>$fn
-   echo iface $1 inet manual >>$fn
-   echo bond-master $2 >>$fn
-}
-
-function create_eth_cfg_pri_ubuntu {
-   local fn=$cfgdir/interfaces
-
-   del_eth_cfg_ubuntu $1
-   echo $'\n'allow-hotplug $1 >>$fn
-   echo iface $1 inet manual >>$fn
-   echo bond-master $2 >>$fn
-   echo bond-primary $1 >>$fn
-}
-
-function create_bond_cfg_ubuntu {
-   local fn=$cfgdir/interfaces
-
-   del_eth_cfg_ubuntu $1
-
-   echo $'\n'auto $1 >>$fn
-   echo iface $1 inet dhcp >>$fn
-   echo bond-mode active-backup >>$fn
-   echo bond-miimon 100 >>$fn
-   echo bond-slaves none >>$fn
-}
-
-function create_eth_cfg_suse {
-local fn=$cfgdir/ifcfg-$1
-
-rm -f $fn
-   echo BOOTPROTO=none >>$fn
-   echo STARTMODE=auto >>$fn
-}
-
-function create_eth_cfg_pri_suse {
-   local fn=$cfgdir/ifcfg-$1
-
-   rm -f $fn
-   echo BOOTPROTO=none >>$fn
-   echo STARTMODE=hotplug >>$fn
-}
-
-f

[PATCH net-next 4/4] pci-hyperv: do not sleep in compose_msi_msg

2017-07-31 Thread Stephen Hemminger
The setup of MSI with Hyper-V host was sleeping with locks held.
This error is reported when doing SR-IOV hotplug with kernel built with lockdep.

BUG: sleeping function called from invalid context at 
kernel/sched/completion.c:93
in_atomic(): 1, irqs_disabled(): 1, pid: 1405, name: ip
3 locks held by ip/1405:
   #0:  (rtnl_mutex){+.+.+.}, at: [] rtnetlink_rcv+0x1b/0x40
   #1:  (&desc->request_mutex){+.+...}, at: [] 
__setup_irq+0xb3/0x720
   #2:  (&irq_desc_lock_class){-.-...}, at: [] 
__setup_irq+0xe5/0x720
   irq event stamp: 3476
   hardirqs last  enabled at (3475): [] 
get_page_from_freelist+0x225/0xc90
   hardirqs last disabled at (3476): [] 
_raw_spin_lock_irqsave+0x27/0x90
   softirqs last  enabled at (2446): [] 
ixgbevf_configure+0x380/0x7c0 [ixgbevf]
   softirqs last disabled at (2444): [] 
ixgbevf_configure+0x35d/0x7c0 [ixgbevf]

The workaround is to poll for host response instead of blocking on
completion.

Signed-off-by: Stephen Hemminger 
---
 drivers/pci/host/pci-hyperv.c | 8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/pci/host/pci-hyperv.c b/drivers/pci/host/pci-hyperv.c
index 415dcc69a502..334c9a7b8991 100644
--- a/drivers/pci/host/pci-hyperv.c
+++ b/drivers/pci/host/pci-hyperv.c
@@ -50,6 +50,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -1159,7 +1160,12 @@ static void hv_compose_msi_msg(struct irq_data *data, 
struct msi_msg *msg)
goto free_int_desc;
}
 
-   wait_for_completion(&comp.comp_pkt.host_event);
+   /*
+* Since this function is called with IRQ locks held, can't
+* do normal wait for completion; instead poll.
+*/
+   while (!try_wait_for_completion(&comp.comp_pkt.host_event))
+   udelay(100);
 
if (comp.comp_pkt.completion_status < 0) {
dev_err(&hbus->hdev->device,
-- 
2.11.0

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


[PATCH net-next 1/4] netvsc: transparent VF management

2017-07-31 Thread Stephen Hemminger
This patch implements transparent fail over from synthetic NIC to
SR-IOV virtual function NIC in Hyper-V environment. It is a better
alternative to using bonding as is done now. Instead, the receive and
transmit fail over is done internally inside the driver.

Using bonding driver has lots of issues because it depends on the
script being run early enough in the boot process and with sufficient
information to make the association. This patch moves all that
functionality into the kernel.

Signed-off-by: Stephen Hemminger 
---
 drivers/net/hyperv/hyperv_net.h |  12 ++
 drivers/net/hyperv/netvsc_drv.c | 419 +++-
 2 files changed, 342 insertions(+), 89 deletions(-)

diff --git a/drivers/net/hyperv/hyperv_net.h b/drivers/net/hyperv/hyperv_net.h
index f2cef5aaed1f..c701b059c5ac 100644
--- a/drivers/net/hyperv/hyperv_net.h
+++ b/drivers/net/hyperv/hyperv_net.h
@@ -680,6 +680,15 @@ struct netvsc_ethtool_stats {
unsigned long tx_busy;
 };
 
+struct netvsc_vf_pcpu_stats {
+   u64 rx_packets;
+   u64 rx_bytes;
+   u64 tx_packets;
+   u64 tx_bytes;
+   struct u64_stats_sync   syncp;
+   u32 tx_dropped;
+};
+
 struct netvsc_reconfig {
struct list_head list;
u32 event;
@@ -713,6 +722,9 @@ struct net_device_context {
 
/* State to manage the associated VF interface. */
struct net_device __rcu *vf_netdev;
+   struct netvsc_vf_pcpu_stats __percpu *vf_stats;
+   struct work_struct vf_takeover;
+   struct work_struct vf_notify;
 
/* 1: allocated, serial number is valid. 0: not allocated */
u32 vf_alloc;
diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c
index 8ff4cbf582cc..fef80dcbd71b 100644
--- a/drivers/net/hyperv/netvsc_drv.c
+++ b/drivers/net/hyperv/netvsc_drv.c
@@ -34,6 +34,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -71,6 +72,7 @@ static void netvsc_set_multicast_list(struct net_device *net)
 static int netvsc_open(struct net_device *net)
 {
struct net_device_context *ndev_ctx = netdev_priv(net);
+   struct net_device *vf_netdev = rtnl_dereference(ndev_ctx->vf_netdev);
struct netvsc_device *nvdev = rtnl_dereference(ndev_ctx->nvdev);
struct rndis_device *rdev;
int ret = 0;
@@ -87,15 +89,29 @@ static int netvsc_open(struct net_device *net)
netif_tx_wake_all_queues(net);
 
rdev = nvdev->extension;
-   if (!rdev->link_state && !ndev_ctx->datapath)
+
+   if (!rdev->link_state)
netif_carrier_on(net);
 
-   return ret;
+   if (vf_netdev) {
+   /* Setting synthetic device up transparently sets
+* slave as up. If open fails, then slave will be
+* still be offline (and not used).
+*/
+   ret = dev_open(vf_netdev);
+   if (ret)
+   netdev_warn(net,
+   "unable to open slave: %s: %d\n",
+   vf_netdev->name, ret);
+   }
+   return 0;
 }
 
 static int netvsc_close(struct net_device *net)
 {
struct net_device_context *net_device_ctx = netdev_priv(net);
+   struct net_device *vf_netdev
+   = rtnl_dereference(net_device_ctx->vf_netdev);
struct netvsc_device *nvdev = rtnl_dereference(net_device_ctx->nvdev);
int ret;
u32 aread, i, msec = 10, retry = 0, retry_max = 20;
@@ -141,6 +157,9 @@ static int netvsc_close(struct net_device *net)
ret = -ETIMEDOUT;
}
 
+   if (vf_netdev)
+   dev_close(vf_netdev);
+
return ret;
 }
 
@@ -224,13 +243,11 @@ static inline int netvsc_get_tx_queue(struct net_device 
*ndev,
  *
  * TODO support XPS - but get_xps_queue not exported
  */
-static u16 netvsc_select_queue(struct net_device *ndev, struct sk_buff *skb,
-   void *accel_priv, select_queue_fallback_t fallback)
+static u16 netvsc_pick_tx(struct net_device *ndev, struct sk_buff *skb)
 {
-   unsigned int num_tx_queues = ndev->real_num_tx_queues;
int q_idx = sk_tx_queue_get(skb->sk);
 
-   if (q_idx < 0 || skb->ooo_okay) {
+   if (q_idx < 0 || skb->ooo_okay || q_idx >= ndev->real_num_tx_queues) {
/* If forwarding a packet, we use the recorded queue when
 * available for better cache locality.
 */
@@ -240,12 +257,33 @@ static u16 netvsc_select_queue(struct net_device *ndev, 
struct sk_buff *skb,
q_idx = netvsc_get_tx_queue(ndev, skb, q_idx);
}
 
-   while (unlikely(q_idx >= num_tx_queues))
-   q_idx -= num_tx_queues;
-
return q_idx;
 }
 
+static u16 netvsc_select_queue(struct net_device *ndev, struct sk_buff *skb,
+  void *accel_priv,
+  select_queue_fallback_t fallback)
+{
+   struct net_device_context

[PATCH net-next 0/4] netvsc: transparent SR-IOV VF support

2017-07-31 Thread Stephen Hemminger
This patch set changes how SR-IOV Virtual Function devices are managed
in the Hyper-V network driver. It was part of earlier bundle, but
is now updated.

Background
In Hyper-V SR-IOV can be enabled (and disabled) by changing guest settings
on host. When SR-IOV is enabled a matching PCI device is hot plugged and
visible on guest. The VF device is an add-on to an existing netvsc
device, and has the same MAC address.

How is this different?

The original support of VF relied on using bonding driver in active
standby mode to handle the VF device.

With the new netvsc VF logic, the Linux hyper-V network
virtual driver will directly manage the link to SR-IOV VF device.
When VF device is detected (hot plug) it is automatically made a
slave device of the netvsc device. The VF device state reflects
the state of the netvsc device; i.e. if netvsc is set down, then
VF is set down. If netvsc is set up, then VF is brought up.
 
Packet flow is independent of VF status; all packets are sent and
received as if they were associated with the netvsc device. If VF is
removed or link is down then the synthetic VMBUS path is used.
 
What was wrong with using bonding script?

A lot of work went into getting the bonding script to work on all
distributions, but it was a major struggle. Linux network devices
can be configured many, many ways and there is no one solution from
userspace to make it all work. What is really hard is when
configuration is attached to synthetic device during boot (eth0) and
then the same addresses and firewall rules needs to also work later if
doing bonding. The new code gets around all of this.
 
How does VF work during initialization?

Since all packets are sent and received through the logical netvsc
device, initialization is much easier. Just configure the regular
netvsc Ethernet device; when/if SR-IOV is enabled it just
works. Provisioning and cloud init only need to worry about setting up
netvsc device (eth0). If SR-IOV is enabled (even as a later step), the
address and rules stay the same.
 
What devices show up?

Both netvsc and PCI devices are visible in the system. The netvsc
device is active and named in usual manner (eth0). The PCI device is
visible to Linux and gets renamed by udev to a persistent name
(enP2p3s0). The PCI device name is now irrelevant now.

The logic also sets the PCI VF device SLAVE flag on the network
device so network tools can see the relationship if they are smart
enough to understand how layered devices work.
 
This is a lot like how I see Windows working.
The VF device is visible in Device Manager, but is not configured.
 
Is there any performance impact?
There is no visible change in performance. The bonding
and netvsc driver both have equivalent steps.
 
Is it compatible with old bonding script?

It turns out that if you use the old bonding script, then everything
still works but in a sub-optimum manner. What happens is that bonding
is unable to steal the VF from the netvsc device so it creates a one
legged bond.  Packet flow then is:
bond0 <--> eth0 <- -> VF (enP2p3s0).
In other words, if you get it wrong it still works, just
awkward and slower.
 
What if I add address or firewall rule onto the VF?

Same problems occur with now as already occur with bonding, bridging,
teaming on Linux if user incorrectly does configuration onto
an underlying slave device. It will sort of work, packets will come in
and out but the Linux kernel gets confused and things like ARP don’t
work right.  There is no way to block manipulation of the slave
device, and I am sure someone will find some special use case where
they want it.


Stephen Hemminger (4):
  netvsc: transparent VF management
  netvsc: add documentation
  netvsc: remove bonding setup script
  pci-hyperv: do not sleep in compose_msi_msg

 Documentation/networking/netvsc.txt |  63 ++
 MAINTAINERS |   1 +
 drivers/net/hyperv/hyperv_net.h |  12 ++
 drivers/net/hyperv/netvsc_drv.c | 419 
 drivers/pci/host/pci-hyperv.c   |   8 +-
 tools/hv/bondvf.sh  | 255 --
 6 files changed, 413 insertions(+), 345 deletions(-)
 create mode 100644 Documentation/networking/netvsc.txt
 delete mode 100755 tools/hv/bondvf.sh

-- 
2.11.0

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


[PATCH] Staging: rtl8723bs: fix multiple missing spaces coding style problem

2017-07-31 Thread Christoffer Kjoelbaek
According to the coding-style documentation, spaces are required
around most binary and ternary operators. Spaces were added to
fix mulitple coding-style errors.

Signed-off-by: Christoffer Kjoelbaek 
---
 drivers/staging/rtl8723bs/os_dep/xmit_linux.c | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/rtl8723bs/os_dep/xmit_linux.c 
b/drivers/staging/rtl8723bs/os_dep/xmit_linux.c
index 76968161f936..f29e110f9bdb 100644
--- a/drivers/staging/rtl8723bs/os_dep/xmit_linux.c
+++ b/drivers/staging/rtl8723bs/os_dep/xmit_linux.c
@@ -37,7 +37,7 @@ uint _rtw_pktfile_read (struct pkt_file *pfile, u8 *rmem, 
uint rlen)
uintlen = 0;
 
len =  rtw_remainder_len(pfile);
-   len = (rlen > len)? len: rlen;
+   len = (rlen > len) ? len : rlen;
 
if (rmem)
skb_copy_bits(pfile->pkt, pfile->buf_len-pfile->pkt_len, rmem, 
len);
@@ -134,7 +134,7 @@ static void rtw_check_xmit_resource(struct adapter 
*padapter, _pkt *pkt)
netif_stop_subqueue(padapter->pnetdev, queue);
}
} else {
-   if (pxmitpriv->free_xmitframe_cnt<=4) {
+   if (pxmitpriv->free_xmitframe_cnt <= 4) {
if 
(!netif_tx_queue_stopped(netdev_get_tx_queue(padapter->pnetdev, queue)))
netif_stop_subqueue(padapter->pnetdev, queue);
}
@@ -150,8 +150,8 @@ static int rtw_mlcst2unicst(struct adapter *padapter, 
struct sk_buff *skb)
struct sta_info *psta = NULL;
u8 chk_alive_num = 0;
char chk_alive_list[NUM_STA];
-   u8 bc_addr[6]={0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
-   u8 null_addr[6]={0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
+   u8 bc_addr[6] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
+   u8 null_addr[6] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
 
int i;
s32 res;
@@ -177,7 +177,7 @@ static int rtw_mlcst2unicst(struct adapter *padapter, 
struct sk_buff *skb)
 
for (i = 0; i < chk_alive_num; i++) {
psta = rtw_get_stainfo_by_offset(pstapriv, chk_alive_list[i]);
-   if (!(psta->state &_FW_LINKED))
+   if (!(psta->state & _FW_LINKED))
{

DBG_COUNTER(padapter->tx_logs.os_tx_m2u_ignore_fw_linked);
continue;
-- 
2.11.0

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


[PATCH V2] hyperv: netvsc: Neaten netvsc_send_pkt by using a temporary

2017-07-31 Thread Joe Perches
Repeated dereference of nvmsg.msg.v1_msg.send_rndis_pkt can be
shortened by using a temporary.  Do so.

No change in object code.

Miscellanea:

o Use * const for rpkt and nvchan

Signed-off-by: Joe Perches 
---

v2: Use * const for rpkt and nvchan
  This is a fairly unusual style, but is technically correct
  requested by: Stephen Hemminger 
Removed style change that doesn't apply any longer

 drivers/net/hyperv/netvsc.c | 25 +++--
 1 file changed, 11 insertions(+), 14 deletions(-)

diff --git a/drivers/net/hyperv/netvsc.c b/drivers/net/hyperv/netvsc.c
index c64934c64dca..9598220b3bcc 100644
--- a/drivers/net/hyperv/netvsc.c
+++ b/drivers/net/hyperv/netvsc.c
@@ -747,8 +747,10 @@ static inline int netvsc_send_pkt(
struct sk_buff *skb)
 {
struct nvsp_message nvmsg;
-   struct netvsc_channel *nvchan
-   = &net_device->chan_table[packet->q_idx];
+   struct nvsp_1_message_send_rndis_packet * const rpkt =
+   &nvmsg.msg.v1_msg.send_rndis_pkt;
+   struct netvsc_channel * const nvchan =
+   &net_device->chan_table[packet->q_idx];
struct vmbus_channel *out_channel = nvchan->channel;
struct net_device *ndev = hv_get_drvdata(device);
struct netdev_queue *txq = netdev_get_tx_queue(ndev, packet->q_idx);
@@ -757,21 +759,16 @@ static inline int netvsc_send_pkt(
u32 ring_avail = hv_ringbuf_avail_percent(&out_channel->outbound);
 
nvmsg.hdr.msg_type = NVSP_MSG1_TYPE_SEND_RNDIS_PKT;
-   if (skb != NULL) {
-   /* 0 is RMC_DATA; */
-   nvmsg.msg.v1_msg.send_rndis_pkt.channel_type = 0;
-   } else {
-   /* 1 is RMC_CONTROL; */
-   nvmsg.msg.v1_msg.send_rndis_pkt.channel_type = 1;
-   }
+   if (skb)
+   rpkt->channel_type = 0; /* 0 is RMC_DATA */
+   else
+   rpkt->channel_type = 1; /* 1 is RMC_CONTROL */
 
-   nvmsg.msg.v1_msg.send_rndis_pkt.send_buf_section_index =
-   packet->send_buf_index;
+   rpkt->send_buf_section_index = packet->send_buf_index;
if (packet->send_buf_index == NETVSC_INVALID_INDEX)
-   nvmsg.msg.v1_msg.send_rndis_pkt.send_buf_section_size = 0;
+   rpkt->send_buf_section_size = 0;
else
-   nvmsg.msg.v1_msg.send_rndis_pkt.send_buf_section_size =
-   packet->total_data_buflen;
+   rpkt->send_buf_section_size = packet->total_data_buflen;
 
req_id = (ulong)skb;
 
-- 
2.10.0.rc2.1.g053435c

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


Re: [Jfs-discussion] [PATCH] fs: convert a pile of fsync routines to errseq_t based reporting

2017-07-31 Thread Dave Kleikamp
On 07/28/2017 09:23 AM, Jeff Layton wrote:
> From: Jeff Layton 
> 
> This patch converts most of the in-kernel filesystems that do writeback
> out of the pagecache to report errors using the errseq_t-based
> infrastructure that was recently added. This allows them to report
> errors once for each open file description.
> 
> Most filesystems have a fairly straightforward fsync operation. They
> call filemap_write_and_wait_range to write back all of the data and
> wait on it, and then (sometimes) sync out the metadata.
> 
> For those filesystems this is a straightforward conversion from calling
> filemap_write_and_wait_range in their fsync operation to calling
> file_write_and_wait_range.
> 
> Signed-off-by: Jeff Layton 

Acked-by: Dave Kleikamp 
(for jfs)

> ---
>  arch/powerpc/platforms/cell/spufs/file.c   | 2 +-
>  drivers/staging/lustre/lustre/llite/file.c | 2 +-
>  drivers/video/fbdev/core/fb_defio.c| 2 +-
>  fs/9p/vfs_file.c   | 4 ++--
>  fs/affs/file.c | 2 +-
>  fs/afs/write.c | 2 +-
>  fs/cifs/file.c | 4 ++--
>  fs/exofs/file.c| 2 +-
>  fs/f2fs/file.c | 2 +-
>  fs/hfs/inode.c | 2 +-
>  fs/hfsplus/inode.c | 2 +-
>  fs/hostfs/hostfs_kern.c| 2 +-
>  fs/hpfs/file.c | 2 +-
>  fs/jffs2/file.c| 2 +-
>  fs/jfs/file.c  | 2 +-
>  fs/ncpfs/file.c| 2 +-
>  fs/ntfs/dir.c  | 2 +-
>  fs/ntfs/file.c | 2 +-
>  fs/ocfs2/file.c| 2 +-
>  fs/reiserfs/dir.c  | 2 +-
>  fs/reiserfs/file.c | 2 +-
>  fs/ubifs/file.c| 2 +-
>  22 files changed, 24 insertions(+), 24 deletions(-)
> 
> Rolling up all of these conversions into a single patch, as Christoph
> Hellwig suggested. Most of these are not tested, but the conversion
> here is fairly straightforward.
> 
> Any maintainers who object, please let me know and I'll yank that
> part out of this patch.
> 
> diff --git a/arch/powerpc/platforms/cell/spufs/file.c 
> b/arch/powerpc/platforms/cell/spufs/file.c
> index ae2f740a82f1..5ffcdeb1eb17 100644
> --- a/arch/powerpc/platforms/cell/spufs/file.c
> +++ b/arch/powerpc/platforms/cell/spufs/file.c
> @@ -1749,7 +1749,7 @@ static int spufs_mfc_flush(struct file *file, 
> fl_owner_t id)
>  static int spufs_mfc_fsync(struct file *file, loff_t start, loff_t end, int 
> datasync)
>  {
>   struct inode *inode = file_inode(file);
> - int err = filemap_write_and_wait_range(inode->i_mapping, start, end);
> + int err = file_write_and_wait_range(file, start, end);
>   if (!err) {
>   inode_lock(inode);
>   err = spufs_mfc_flush(file, NULL);
> diff --git a/drivers/staging/lustre/lustre/llite/file.c 
> b/drivers/staging/lustre/lustre/llite/file.c
> index ab1c85c1ed38..f7d07735ac66 100644
> --- a/drivers/staging/lustre/lustre/llite/file.c
> +++ b/drivers/staging/lustre/lustre/llite/file.c
> @@ -2364,7 +2364,7 @@ int ll_fsync(struct file *file, loff_t start, loff_t 
> end, int datasync)
>  PFID(ll_inode2fid(inode)), inode);
>   ll_stats_ops_tally(ll_i2sbi(inode), LPROC_LL_FSYNC, 1);
>  
> - rc = filemap_write_and_wait_range(inode->i_mapping, start, end);
> + rc = file_write_and_wait_range(file, start, end);
>   inode_lock(inode);
>  
>   /* catch async errors that were recorded back when async writeback
> diff --git a/drivers/video/fbdev/core/fb_defio.c 
> b/drivers/video/fbdev/core/fb_defio.c
> index 37f69c061210..487d5e336e1b 100644
> --- a/drivers/video/fbdev/core/fb_defio.c
> +++ b/drivers/video/fbdev/core/fb_defio.c
> @@ -69,7 +69,7 @@ int fb_deferred_io_fsync(struct file *file, loff_t start, 
> loff_t end, int datasy
>  {
>   struct fb_info *info = file->private_data;
>   struct inode *inode = file_inode(file);
> - int err = filemap_write_and_wait_range(inode->i_mapping, start, end);
> + int err = file_write_and_wait_range(file, start, end);
>   if (err)
>   return err;
>  
> diff --git a/fs/9p/vfs_file.c b/fs/9p/vfs_file.c
> index 3de3b4a89d89..4802d75b3cf7 100644
> --- a/fs/9p/vfs_file.c
> +++ b/fs/9p/vfs_file.c
> @@ -445,7 +445,7 @@ static int v9fs_file_fsync(struct file *filp, loff_t 
> start, loff_t end,
>   struct p9_wstat wstat;
>   int retval;
>  
> - retval = filemap_write_and_wait_range(inode->i_mapping, start, end);
> + retval = file_write_and_wait_range(filp, start, end);
>   if (retval)
>   return retval;
>  
> @@ -468,7 +468,7 @@ int v9fs_file_fsync_dotl(struct file *filp, loff_t start, 
> loff_t end,
>   struct inode *inode = filp->f_mapping->host;
>   int retval;
>  
> - retval =

Re: [PATCH] hyperv: netvsc: Neaten netvsc_send_pkt by using a temporary

2017-07-31 Thread Joe Perches
On Mon, 2017-07-31 at 10:05 -0700, Stephen Hemminger wrote:
> On Sun, 30 Jul 2017 14:19:30 -0700 Joe Perches  wrote:
> > Repeated dereference of nvmsg.msg.v1_msg.send_rndis_pkt can be
> > shortened by using a temporary.  Do so.
[]
> Looks good, several other places also suffer from to 
> long.variable.name.wordiness.

My suggestion is to identify and fix those when you've time.

> > diff --git a/drivers/net/hyperv/netvsc.c b/drivers/net/hyperv/netvsc.c
[]
> > @@ -743,6 +743,7 @@ static inline int netvsc_send_pkt(
> > struct sk_buff *skb)
> >  {
> > struct nvsp_message nvmsg;
> > +   struct nvsp_1_message_send_rndis_packet *rpkt;
> 
> const?

I suppose.  It's an unusual style in the kernel though.

> This part just changed (got rid of indirection) in net-next.

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


Re: [PATCH v1 3/6] staging: unisys: Switch to use new generic UUID API

2017-07-31 Thread Andy Shevchenko
On Sun, 2017-07-30 at 10:37 -0700, Greg Kroah-Hartman wrote:
> On Sun, Jul 30, 2017 at 08:26:48PM +0300, Andy Shevchenko wrote:
> > On Sun, Jul 30, 2017 at 6:32 PM, Greg Kroah-Hartman
> >  wrote:

> > > Doesn't apply to the staging tree at all :(
> > 
> > No surprises, it was cooked against uuid tree in the first place.
> > If you agree to take it through staging tree I will prepare a
> > rebased version.
> > Does it sound good?
> 
> You can take it through the uuid tree if it's easier for you, but then
> someone will have to deal with the merge issues...
> 
> If it's easier, I can take it to prevent the merge problems.

Yep! There are so many conflicts that would be better just to push
through your tree.

I have just sent a v2 of this patch separately.

-- 
Andy Shevchenko 
Intel Finland Oy
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2] staging: unisys: Switch to use new generic UUID API

2017-07-31 Thread Andy Shevchenko
There are new types and helpers that are supposed to be used in new code.

As a preparation to get rid of legacy types and API functions do
the conversion here.

While here, re-indent couple of lines to increase readability.

Cc: David Kershner 
Cc: Greg Kroah-Hartman 
Cc: sparmaintai...@unisys.com
Cc: de...@driverdev.osuosl.org
Signed-off-by: Andy Shevchenko 
---
 drivers/staging/unisys/Documentation/overview.txt  | 14 +++
 drivers/staging/unisys/include/channel.h   | 29 ++
 drivers/staging/unisys/include/iochannel.h |  2 +-
 drivers/staging/unisys/include/visorbus.h  | 14 +++
 drivers/staging/unisys/visorbus/controlvmchannel.h | 16 
 drivers/staging/unisys/visorbus/vbuschannel.h  |  8 ++--
 drivers/staging/unisys/visorbus/visorbus_main.c| 44 ++---
 drivers/staging/unisys/visorbus/visorbus_private.h |  6 +--
 drivers/staging/unisys/visorbus/visorchannel.c | 46 +++---
 drivers/staging/unisys/visorbus/visorchipset.c | 33 +---
 drivers/staging/unisys/visorhba/visorhba_main.c|  6 +--
 drivers/staging/unisys/visorinput/visorinput.c | 38 +-
 drivers/staging/unisys/visornic/visornic_main.c|  6 +--
 13 files changed, 130 insertions(+), 132 deletions(-)

diff --git a/drivers/staging/unisys/Documentation/overview.txt 
b/drivers/staging/unisys/Documentation/overview.txt
index e0466bfada2f..9ab30af265a5 100644
--- a/drivers/staging/unisys/Documentation/overview.txt
+++ b/drivers/staging/unisys/Documentation/overview.txt
@@ -221,7 +221,7 @@ The following files exist under 
/sys/devices/visorbus/vbus:dev:
 
 The visorhba driver registers with visorbus as the function driver to
 handle virtual scsi disk devices, specified using the
-VISOR_VHBA_CHANNEL_UUID type in the visorbus_register_visor_driver()
+VISOR_VHBA_CHANNEL_GUID type in the visorbus_register_visor_driver()
 call. visorhba uses scsi_add_host() to expose a Linux block device
 (e.g., /sys/block/) in the guest environment for each s-Par virtual device.
 
@@ -240,7 +240,7 @@ When compiled as a module, visorhba can be autoloaded by 
visorbus in
 standard udev/systemd environments, as it includes the modules.alias
 definition:
 
-"visorbus:"+VISOR_VHBA_CHANNEL_UUID_STR
+"visorbus:"+VISOR_VHBA_CHANNEL_GUID_STR
 
 i.e.:
 
@@ -252,7 +252,7 @@ i.e.:
 
 The visornic driver registers with visorbus as the function driver to
 handle virtual network devices, specified using the
-VISOR_VNIC_CHANNEL_UUID type in the visorbus_register_visor_driver()
+VISOR_VNIC_CHANNEL_GUID type in the visorbus_register_visor_driver()
 call. visornic uses register_netdev() to expose a Linux device of class net
 (e.g., /sys/class/net/) in the guest environment for each s-Par virtual
 device.
@@ -270,7 +270,7 @@ When compiled as a module, visornic can be autoloaded by 
visorbus in
 standard udev/systemd environments, as it includes the modules.alias
 definition:
 
-"visorbus:"+VISOR_VNIC_CHANNEL_UUID_STR
+"visorbus:"+VISOR_VNIC_CHANNEL_GUID_STR
 
 i.e.:
 
@@ -282,7 +282,7 @@ i.e.:
 
 The visorinput driver registers with visorbus as the function driver to
 handle human input devices, specified using the
-VISOR_KEYBOARD_CHANNEL_UUID and VISOR_MOUSE_CHANNEL_UUID
+VISOR_KEYBOARD_CHANNEL_GUID and VISOR_MOUSE_CHANNEL_GUID
 types in the visorbus_register_visor_driver() call. visorinput uses
 input_register_device() to expose devices of class input
 (e.g., /sys/class/input/) for virtual keyboard and virtual mouse devices.
@@ -307,8 +307,8 @@ When compiled as a module, visorinput can be autoloaded by 
visorbus in
 standard udev/systemd environments, as it includes the modules.alias
 definition:
 
-"visorbus:"+VISOR_MOUSE_CHANNEL_UUID_STR
-"visorbus:"+VISOR_KEYBOARD_CHANNEL_UUID_STR
+"visorbus:"+VISOR_MOUSE_CHANNEL_GUID_STR
+"visorbus:"+VISOR_KEYBOARD_CHANNEL_GUID_STR
 
 i.e.:
 
diff --git a/drivers/staging/unisys/include/channel.h 
b/drivers/staging/unisys/include/channel.h
index d6d99cc33a33..2dac0e51d107 100644
--- a/drivers/staging/unisys/include/channel.h
+++ b/drivers/staging/unisys/include/channel.h
@@ -128,13 +128,13 @@ struct channel_header {
u32 header_size;
u64 size;
u64 features;
-   uuid_le chtype;
+   guid_t chtype;
u64 partition_handle;
u64 handle;
u64 ch_space_offset;
u32 version_id;
u32 partition_index;
-   uuid_le zone_uuid;
+   guid_t zone_guid;
u32 cli_str_offset;
u32 cli_state_boot;
u32 cmd_state_cli;
@@ -204,23 +204,20 @@ struct signal_queue_header {
 
 /* CHANNEL Guids */
 /* {414815ed-c58c-11da-95a9-00e08161165f} */
-#define VISOR_VHBA_CHANNEL_UUID \
-   UUID_LE(0x414815ed, 0xc58c, 0x11da, \
-   0x95, 0xa9, 0x0, 0xe0, 0x81, 0x61, 0x16, 0x5f)
-static const uuid_le visor_vhba_channel_uuid = VISOR_VHBA_CHANNEL_UUID;
-#define VISOR_VHBA_CHANNEL_UUID_STR \
+#define VISOR_VHBA_CHANNEL_GUID \
+   

Re: [PATCH] hyperv: netvsc: Neaten netvsc_send_pkt by using a temporary

2017-07-31 Thread Stephen Hemminger
On Sun, 30 Jul 2017 14:19:30 -0700
Joe Perches  wrote:

> Repeated dereference of nvmsg.msg.v1_msg.send_rndis_pkt can be
> shortened by using a temporary.  Do so.
> 
> No change in object code.
> 
> Signed-off-by: Joe Perches 

Looks good, several other places also suffer from to 
long.variable.name.wordiness.

Please rebase this on net-next.

> ---
>  drivers/net/hyperv/netvsc.c | 24 ++--
>  1 file changed, 10 insertions(+), 14 deletions(-)
> 
> diff --git a/drivers/net/hyperv/netvsc.c b/drivers/net/hyperv/netvsc.c
> index 06f39a99da7c..fede1546cdc6 100644
> --- a/drivers/net/hyperv/netvsc.c
> +++ b/drivers/net/hyperv/netvsc.c
> @@ -743,6 +743,7 @@ static inline int netvsc_send_pkt(
>   struct sk_buff *skb)
>  {
>   struct nvsp_message nvmsg;
> + struct nvsp_1_message_send_rndis_packet *rpkt;

const?

>   struct netvsc_channel *nvchan
>   = &net_device->chan_table[packet->q_idx];
>   struct vmbus_channel *out_channel = nvchan->channel;
> @@ -754,21 +755,17 @@ static inline int netvsc_send_pkt(
>   u32 ring_avail = hv_ringbuf_avail_percent(&out_channel->outbound);
>  
>   nvmsg.hdr.msg_type = NVSP_MSG1_TYPE_SEND_RNDIS_PKT;
> - if (skb != NULL) {
> - /* 0 is RMC_DATA; */
> - nvmsg.msg.v1_msg.send_rndis_pkt.channel_type = 0;
> - } else {
> - /* 1 is RMC_CONTROL; */
> - nvmsg.msg.v1_msg.send_rndis_pkt.channel_type = 1;
> - }
> + rpkt = &nvmsg.msg.v1_msg.send_rndis_pkt;
> + if (skb != NULL)
> + rpkt->channel_type = 0; /* 0 is RMC_DATA */
> + else
> + rpkt->channel_type = 1; /* 1 is RMC_CONTROL */
>  
> - nvmsg.msg.v1_msg.send_rndis_pkt.send_buf_section_index =
> - packet->send_buf_index;
> + rpkt->send_buf_section_index = packet->send_buf_index;
>   if (packet->send_buf_index == NETVSC_INVALID_INDEX)
> - nvmsg.msg.v1_msg.send_rndis_pkt.send_buf_section_size = 0;
> + rpkt->send_buf_section_size = 0;
>   else
> - nvmsg.msg.v1_msg.send_rndis_pkt.send_buf_section_size =
> - packet->total_data_buflen;
> + rpkt->send_buf_section_size = packet->total_data_buflen;
>  
>   req_id = (ulong)skb;
>  
> @@ -776,8 +773,7 @@ static inline int netvsc_send_pkt(
>   return -ENODEV;
>  
>   if (packet->page_buf_cnt) {
> - pgbuf = packet->cp_partial ? (*pb) +
> - packet->rmsg_pgcnt : (*pb);
> + pgbuf = packet->cp_partial ? *pb + packet->rmsg_pgcnt : *pb;
>   ret = vmbus_sendpacket_pagebuffer_ctl(out_channel,
> pgbuf,
> packet->page_buf_cnt,

This part just changed (got rid of indirection) in net-next.



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


Re: [PATCH] staging/pi433: Solved some coding style issues in pi433_if.c

2017-07-31 Thread Greg KH
On Mon, Jul 31, 2017 at 03:51:13PM +0530, RishabhHardas wrote:
> From: RishabhHardas 
> 
> Solved a few coding style issues, used BIT macro to set MINORBITS.
> 
> Signed-off-by: RishabhHardas 

For some reason I do not think your legal name has no space in it :(

Please fix and resend.

thanks,

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


[PATCH] staging: fsl-mc: add explicit dependencies for compile-tested arches

2017-07-31 Thread laurentiu.tudor
From: Laurentiu Tudor 

The driver makes use of GENERIC_MSI_IRQ_DOMAIN which requires arch
support so, on architectures that don't have it, the kernel will fail
to build. Add explicit dependency on architectures that were
compile-tested, thus fixing compilation for the ones that don't
implement GENERIC_MSI_IRQ_DOMAIN.

Fixes: 03274850279c ("staging: fsl-mc: allow the driver compile multi-arch")

Signed-off-by: Laurentiu Tudor 
---
 - This should take care of the compilation issue that Stephen Rothwell
   reported here: https://lkml.org/lkml/2017/7/31/200
 - Note that ppc will compile after merge with the powerpc tree because
   this patch is required: https://patchwork.ozlabs.org/patch/789474/

 drivers/staging/fsl-mc/bus/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/fsl-mc/bus/Kconfig 
b/drivers/staging/fsl-mc/bus/Kconfig
index 1af8d1d..504c987 100644
--- a/drivers/staging/fsl-mc/bus/Kconfig
+++ b/drivers/staging/fsl-mc/bus/Kconfig
@@ -8,7 +8,7 @@
 
 config FSL_MC_BUS
bool "QorIQ DPAA2 fsl-mc bus driver"
-   depends on OF && (ARCH_LAYERSCAPE || COMPILE_TEST)
+   depends on OF && (ARCH_LAYERSCAPE || (COMPILE_TEST && (ARM || ARM64 || 
X86 || PPC)))
select GENERIC_MSI_IRQ_DOMAIN
help
  Driver to enable the bus infrastructure for the QorIQ DPAA2
-- 
2.9.4

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


Re: [PATCH] staging/pi433: Solved some coding style issues in pi433_if.c

2017-07-31 Thread Wolf Entwicklungen
Reviewed-by: Marcus Wolf 

Thank you Rishabh!

Marcus

Am Mo, 31.07.2017, 12:21 schrieb RishabhHardas:
> From: RishabhHardas 
>
> Solved a few coding style issues, used BIT macro to set MINORBITS.
>
> Signed-off-by: RishabhHardas 
> ---
>  drivers/staging/pi433/pi433_if.c | 24 ++--
>  1 file changed, 14 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/staging/pi433/pi433_if.c 
> b/drivers/staging/pi433/pi433_if.c
> index d9328ce..f10ffc3 100644
> --- a/drivers/staging/pi433/pi433_if.c
> +++ b/drivers/staging/pi433/pi433_if.c
> @@ -47,18 +47,18 @@
>  #include 
>  #include 
>  #include 
> +#include 
>  #ifdef CONFIG_COMPAT
> -#include 
> +#include 
>  #endif
>
>  #include "pi433_if.h"
>  #include "rf69.h"
>
> -
> -#define N_PI433_MINORS   (1U << MINORBITS) /*32*/
> /* ... up to 256 */
> -#define MAX_MSG_SIZE 900 /* min: FIFO_SIZE! */
> -#define MSG_FIFO_SIZE65536   /* 65536 = 2^16  */
> -#define NUM_DIO  2
> +#define N_PI433_MINORS   BIT(MINORBITS) /*32*/ /* ... up to 256 
> */
> +#define MAX_MSG_SIZE 900 /* min: FIFO_SIZE! */
> +#define MSG_FIFO_SIZE65536   /* 65536 = 2^16  */
> +#define NUM_DIO  2
>
>  static dev_t pi433_dev;
>  static DEFINE_IDR(pi433_idr);
> @@ -66,10 +66,14 @@
>
>  static struct class *pi433_class; /* mainly for udev to create /dev/pi433 */
>
> -/* tx config is instance specific
> - so with each open a new tx config struct is needed */
> -/* rx config is device specific
> - so we have just one rx config, ebedded in device struct */
> +/*
> + * tx config is instance specific
> + * so with each open a new tx config struct is needed
> + */
> +/*
> + * rx config is device specific
> + * so we have just one rx config, ebedded in device struct
> + */
>  struct pi433_device {
>   /* device handling related values */
>   dev_t   devt;
> --
> 1.9.1
>
>
>

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


[PATCH] Staging: media: atomisp: i2c: gc0310: fixed brace coding style issue

2017-07-31 Thread Rene Hickersberger
Fixed a brace coding style issue.

Signed-off-by: Rene Hickersberger 
---
 drivers/staging/media/atomisp/i2c/gc0310.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/staging/media/atomisp/i2c/gc0310.c 
b/drivers/staging/media/atomisp/i2c/gc0310.c
index 1ec616a..bec0c46 100644
--- a/drivers/staging/media/atomisp/i2c/gc0310.c
+++ b/drivers/staging/media/atomisp/i2c/gc0310.c
@@ -118,9 +118,8 @@ static int gc0310_write_reg(struct i2c_client *client, u16 
data_length,
/* high byte goes out first */
*wreg = (u8)(reg & 0xff);
 
-   if (data_length == GC0310_8BIT) {
+   if (data_length == GC0310_8BIT)
data[1] = (u8)(val);
-   }
 
ret = gc0310_i2c_write(client, len, data);
if (ret)
-- 
2.9.3

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


Re: [Intel-gfx] [PATCH 0/3] Kconfig dependencies: acpi-video, backlight and thermal

2017-07-31 Thread Jani Nikula
On Wed, 26 Jul 2017, Daniel Vetter  wrote:
> On Wed, Jul 26, 2017 at 03:53:09PM +0200, Arnd Bergmann wrote:
>> Hi everyone,
>> 
>> It took me a while to figure this out properly, as I kept getting
>> circular or missing dependencies with video drivers.
>> 
>> This set of three patches should simplify the situation a bit,
>> mostly by cleaning up the dependencies around CONFIG_ACPI_VIDEO.
>> With all three patches applied, I no longer run into those related
>> warnings. If everyone agrees on the general direction, I hope
>> we can merge all three through the DRM tree.
>> 
>> I originally had another larger patch in the series to replace all
>> of the 'select BACKLIGHT_LCD_SUPPORT; select BACKLIGHT_CLASS_DEVICE'
>> statements with 'depends on LCD_CLASS_DEVICE', that would clean
>> it up some more, but it is also a more invasive change that we
>> can do separately at some point.
>
> Looks reasonable, but I think it'd be good to get Jani Nikula's explicit
> ack on this, since he dugg around a lot in this area. And he's on vacation
> this week.

I didn't dig through all the details, but looks good to me and
definitely an improvement in drm Kconfigs.

Acked-by: Jani Nikula 



> -Daniel
>
>> 
>>Arnd
>> 
>> Arnd Bergmann (3):
>>   backlight: always select BACKLIGHT_LCD_SUPPORT for
>> BACKLIGHT_CLASS_DEVICE
>>   ACPI/DRM: rework ACPI_VIDEO Kconfig dependencies
>>   drm/etnaviv: add thermal dependency
>> 
>>  drivers/acpi/Kconfig  |  7 +--
>>  drivers/gpu/drm/etnaviv/Kconfig   |  1 +
>>  drivers/gpu/drm/gma500/Kconfig|  5 +
>>  drivers/gpu/drm/i915/Kconfig  |  7 +--
>>  drivers/gpu/drm/nouveau/Kconfig   | 10 ++
>>  drivers/platform/x86/Kconfig  |  9 -
>>  drivers/staging/olpc_dcon/Kconfig |  1 +
>>  7 files changed, 15 insertions(+), 25 deletions(-)
>> 
>> To: dri-de...@lists.freedesktop.org
>> Cc: "Rafael J. Wysocki" 
>> Cc: Len Brown 
>> Cc: Lucas Stach 
>> Cc: Russell King 
>> Cc: Christian Gmeiner 
>> Cc: David Airlie 
>> Cc: Patrik Jakobsson 
>> Cc: Daniel Vetter 
>> Cc: Jani Nikula 
>> Cc: Ben Skeggs 
>> Cc: Darren Hart 
>> Cc: Andy Shevchenko 
>> Cc: Jens Frederich 
>> Cc: Daniel Drake 
>> Cc: Jon Nettleton 
>> Cc: Greg Kroah-Hartman 
>> Cc: linux-a...@vger.kernel.org
>> Cc: linux-ker...@vger.kernel.org
>> Cc: etna...@lists.freedesktop.org
>> Cc: intel-...@lists.freedesktop.org
>> Cc: nouv...@lists.freedesktop.org
>> Cc: platform-driver-...@vger.kernel.org
>> Cc: de...@driverdev.osuosl.org
>> 
>> -- 
>> 2.9.0
>> 
>> ___
>> Intel-gfx mailing list
>> intel-...@lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Jani Nikula, Intel Open Source Technology Center
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH V2] staging: ccree: Fix format/argument mismatches

2017-07-31 Thread Joe Perches
By default, debug logging is disabled by CC_DEBUG not being defined.

Convert SSI_LOG_DEBUG to use no_printk instead of an empty define
to validate formats and arguments.

Fix fallout.

Miscellanea:

o One of the conversions now uses %pR instead of multiple uses of %pad

Signed-off-by: Joe Perches 
---

On top of next-20170731

 drivers/staging/ccree/ssi_aead.c|  8 
 drivers/staging/ccree/ssi_buffer_mgr.c  | 29 +---
 drivers/staging/ccree/ssi_cipher.c  | 10 +-
 drivers/staging/ccree/ssi_driver.c  |  5 ++---
 drivers/staging/ccree/ssi_driver.h  |  2 +-
 drivers/staging/ccree/ssi_hash.c| 34 -
 drivers/staging/ccree/ssi_request_mgr.c |  6 +++---
 7 files changed, 45 insertions(+), 49 deletions(-)

diff --git a/drivers/staging/ccree/ssi_aead.c b/drivers/staging/ccree/ssi_aead.c
index f5ca0e35c5d3..6664ade43b70 100644
--- a/drivers/staging/ccree/ssi_aead.c
+++ b/drivers/staging/ccree/ssi_aead.c
@@ -103,7 +103,7 @@ static void ssi_aead_exit(struct crypto_aead *tfm)
if (ctx->enckey) {
dma_free_coherent(dev, AES_MAX_KEY_SIZE, ctx->enckey, 
ctx->enckey_dma_addr);
SSI_LOG_DEBUG("Freed enckey DMA buffer enckey_dma_addr=%pad\n",
- ctx->enckey_dma_addr);
+ &ctx->enckey_dma_addr);
ctx->enckey_dma_addr = 0;
ctx->enckey = NULL;
}
@@ -117,7 +117,7 @@ static void ssi_aead_exit(struct crypto_aead *tfm)
  xcbc->xcbc_keys_dma_addr);
}
SSI_LOG_DEBUG("Freed xcbc_keys DMA buffer 
xcbc_keys_dma_addr=%pad\n",
- xcbc->xcbc_keys_dma_addr);
+ &xcbc->xcbc_keys_dma_addr);
xcbc->xcbc_keys_dma_addr = 0;
xcbc->xcbc_keys = NULL;
} else if (ctx->auth_mode != DRV_HASH_NULL) { /* HMAC auth. */
@@ -128,7 +128,7 @@ static void ssi_aead_exit(struct crypto_aead *tfm)
  hmac->ipad_opad,
  hmac->ipad_opad_dma_addr);
SSI_LOG_DEBUG("Freed ipad_opad DMA buffer 
ipad_opad_dma_addr=%pad\n",
- hmac->ipad_opad_dma_addr);
+ &hmac->ipad_opad_dma_addr);
hmac->ipad_opad_dma_addr = 0;
hmac->ipad_opad = NULL;
}
@@ -137,7 +137,7 @@ static void ssi_aead_exit(struct crypto_aead *tfm)
  hmac->padded_authkey,
  hmac->padded_authkey_dma_addr);
SSI_LOG_DEBUG("Freed padded_authkey DMA buffer 
padded_authkey_dma_addr=%pad\n",
- hmac->padded_authkey_dma_addr);
+ &hmac->padded_authkey_dma_addr);
hmac->padded_authkey_dma_addr = 0;
hmac->padded_authkey = NULL;
}
diff --git a/drivers/staging/ccree/ssi_buffer_mgr.c 
b/drivers/staging/ccree/ssi_buffer_mgr.c
index 63936091d524..88b36477ce6d 100644
--- a/drivers/staging/ccree/ssi_buffer_mgr.c
+++ b/drivers/staging/ccree/ssi_buffer_mgr.c
@@ -14,6 +14,7 @@
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
+#include 
 #include 
 #include 
 #include 
@@ -33,14 +34,10 @@
 #include "ssi_hash.h"
 #include "ssi_aead.h"
 
-#ifdef CC_DEBUG
 #define GET_DMA_BUFFER_TYPE(buff_type) ( \
((buff_type) == SSI_DMA_BUF_NULL) ? "BUF_NULL" : \
((buff_type) == SSI_DMA_BUF_DLLI) ? "BUF_DLLI" : \
((buff_type) == SSI_DMA_BUF_MLLI) ? "BUF_MLLI" : "BUF_INVALID")
-#else
-#define GET_DMA_BUFFER_TYPE(buff_type)
-#endif
 
 enum dma_buffer_type {
DMA_NULL_TYPE = -1,
@@ -262,7 +259,7 @@ static int ssi_buffer_mgr_generate_mlli(
SSI_LOG_DEBUG("MLLI params: "
 "virt_addr=%pK dma_addr=%pad mlli_len=0x%X\n",
   mlli_params->mlli_virt_addr,
-  mlli_params->mlli_dma_addr,
+  &mlli_params->mlli_dma_addr,
   mlli_params->mlli_len);
 
 build_mlli_exit:
@@ -278,7 +275,7 @@ static inline void ssi_buffer_mgr_add_buffer_entry(
 
SSI_LOG_DEBUG("index=%u single_buff=%pad "
 "buffer_len=0x%08X is_last=%d\n",
-index, buffer_dma, buffer_len, is_last_entry);
+index, &buffer_dma, buffer_len, is_last_entry);
sgl_data->nents[index] = 1;
sgl_data->entry[index].buffer_dma = buffer_dma

[PATCH] staging/pi433: Solved some coding style issues in pi433_if.c

2017-07-31 Thread RishabhHardas
From: RishabhHardas 

Solved a few coding style issues, used BIT macro to set MINORBITS.

Signed-off-by: RishabhHardas 
---
 drivers/staging/pi433/pi433_if.c | 24 ++--
 1 file changed, 14 insertions(+), 10 deletions(-)

diff --git a/drivers/staging/pi433/pi433_if.c b/drivers/staging/pi433/pi433_if.c
index d9328ce..f10ffc3 100644
--- a/drivers/staging/pi433/pi433_if.c
+++ b/drivers/staging/pi433/pi433_if.c
@@ -47,18 +47,18 @@
 #include 
 #include 
 #include 
+#include 
 #ifdef CONFIG_COMPAT
-#include 
+#include 
 #endif

 #include "pi433_if.h"
 #include "rf69.h"

-
-#define N_PI433_MINORS (1U << MINORBITS) /*32*//* ... 
up to 256 */
-#define MAX_MSG_SIZE   900 /* min: FIFO_SIZE! */
-#define MSG_FIFO_SIZE  65536   /* 65536 = 2^16  */
-#define NUM_DIO2
+#define N_PI433_MINORS BIT(MINORBITS) /*32*/ /* ... up to 256 */
+#define MAX_MSG_SIZE   900 /* min: FIFO_SIZE! */
+#define MSG_FIFO_SIZE  65536   /* 65536 = 2^16  */
+#define NUM_DIO2

 static dev_t pi433_dev;
 static DEFINE_IDR(pi433_idr);
@@ -66,10 +66,14 @@

 static struct class *pi433_class; /* mainly for udev to create /dev/pi433 */

-/* tx config is instance specific
-   so with each open a new tx config struct is needed */
-/* rx config is device specific
-   so we have just one rx config, ebedded in device struct */
+/*
+ * tx config is instance specific
+ * so with each open a new tx config struct is needed
+ */
+/*
+ * rx config is device specific
+ * so we have just one rx config, ebedded in device struct
+ */
 struct pi433_device {
/* device handling related values */
dev_t   devt;
--
1.9.1

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


Re: [PATCH] staging: ccree: Fix format/argument mismatches

2017-07-31 Thread Joe Perches
On Mon, 2017-07-31 at 09:39 +0300, Gilad Ben-Yossef wrote:
> On Sun, Jul 30, 2017 at 7:45 PM, Joe Perches  wrote:
> > By default, debug logging is disabled by CC_DEBUG not being defined.
> > 
> > Convert SSI_LOG_DEBUG to use no_printk instead of an empty define
> > to validate formats and arguments.
> > 
> > Fix fallout.
> > 
> > Miscellanea:
> > 
> > o One of the conversions now uses %pR instead of multiple uses of %pad
> 
> This looks great (I didn't know about no_printk) but does not seem to
> apply on top of
> staging-next.

Applies to next-20170728

b2cf822e075f7a7e7ced8c50af600f9edf5ccc31

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


[PATCH] staging/ccree: Declare compiled out fuctions static inline

2017-07-31 Thread RishabhHardas
From: RishabhHardas 

Sparse was giving out a warning for symbols 'cc_set_ree_fips_status' and 
'fips_handler'
that they were not declared and need to be made static. This patch makes both 
the symbols
static inline, to remove the warnings.

Signed-off-by: RishabhHardas 
---
 drivers/staging/ccree/ssi_fips.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/ccree/ssi_fips.h b/drivers/staging/ccree/ssi_fips.h
index 369ddf9..63bcca7 100644
--- a/drivers/staging/ccree/ssi_fips.h
+++ b/drivers/staging/ccree/ssi_fips.h
@@ -40,1 +40,1 @@ static inline int ssi_fips_init(struct ssi_drvdata *p_drvdata)
 }

 static inline void ssi_fips_fini(struct ssi_drvdata *drvdata) {}
-void cc_set_ree_fips_status(struct ssi_drvdata *drvdata, bool ok) {}
-void fips_handler(struct ssi_drvdata *drvdata) {}
+static inline void cc_set_ree_fips_status(struct ssi_drvdata *drvdata, bool 
ok) {}
+static inline void fips_handler(struct ssi_drvdata *drvdata) {}

 #endif /* CONFIG_CRYPTO_FIPS */

--
1.9.1

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


[PATCH] staging: pi433: reduce stack size in tx thread

2017-07-31 Thread Arnd Bergmann
Putting a 900 byte array on the stack is a clearly too much in the
kernel, and sometimes results in warnings like:

drivers/staging/pi433/pi433_if.c: In function 'pi433_tx_thread':
drivers/staging/pi433/pi433_if.c:645:1: error: the frame size of 1028 bytes is 
larger than 1024 bytes [-Werror=frame-larger-than=]

This moves the buffer into the dynamically allocated per-device
structure.

Signed-off-by: Arnd Bergmann 
---
 drivers/staging/pi433/pi433_if.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/pi433/pi433_if.c b/drivers/staging/pi433/pi433_if.c
index ed737f4b1e77..ec9811ae4735 100644
--- a/drivers/staging/pi433/pi433_if.c
+++ b/drivers/staging/pi433/pi433_if.c
@@ -92,6 +92,7 @@ struct pi433_device {
struct task_struct  *tx_task_struct;
wait_queue_head_t   tx_wait_queue;
u8  free_in_fifo;
+   charbuffer[MAX_MSG_SIZE];
 
/* rx related values */
struct pi433_rx_cfg rx_cfg;
@@ -471,7 +472,7 @@ pi433_tx_thread(void *data)
struct pi433_device *device = data;
struct spi_device *spi = device->spi; /* needed for SET_CHECKED */
struct pi433_tx_cfg tx_cfg;
-   u8 buffer[MAX_MSG_SIZE];
+   u8 *buffer = device->buffer;
size_t size;
bool   rx_interrupted = false;
intposition, repetitions;
-- 
2.9.0

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


Re: [PATCH] Staging: vc04_services: Fix WARN_ON instead of BUG_ON

2017-07-31 Thread Dan Carpenter
On Mon, Jul 31, 2017 at 12:44:03PM +0530, janani-sankarababu wrote:
> This patch is to replace the use of BUG_ON macro with WARN_ON
> inorder to prevent the crashing of the kernel.
> 
> Signed-off-by: Janani Sankara Babu 
> ---
>  drivers/staging/vc04_services/bcm2835-audio/bcm2835-ctl.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/vc04_services/bcm2835-audio/bcm2835-ctl.c 
> b/drivers/staging/vc04_services/bcm2835-audio/bcm2835-ctl.c
> index f484bb0..30bc246 100644
> --- a/drivers/staging/vc04_services/bcm2835-audio/bcm2835-ctl.c
> +++ b/drivers/staging/vc04_services/bcm2835-audio/bcm2835-ctl.c
> @@ -91,7 +91,7 @@ static int snd_bcm2835_ctl_get(struct snd_kcontrol 
> *kcontrol,
>   if (mutex_lock_interruptible(&chip->audio_mutex))
  ^^
We dereference chip here.

>   return -EINTR;
>  
> - BUG_ON(!chip && !(chip->avail_substreams & AVAIL_SUBSTREAMS_MASK));
> + WARN_ON(!chip && !(chip->avail_substreams & AVAIL_SUBSTREAMS_MASK));
^
Too late.

regards,
dan carpenter

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


Re: [PATCH] Staging: vc04_services: Fix WARN_ON instead of BUG_ON

2017-07-31 Thread Stefan Wahren
Am 31.07.2017 um 09:14 schrieb janani-sankarababu:
> This patch is to replace the use of BUG_ON macro with WARN_ON
> inorder to prevent the crashing of the kernel.

Unfortunately it isn't always that simple. checkpatch isn't smart. It's
preferred to handle error cases instead of flooding the kernel log.

>
> Signed-off-by: Janani Sankara Babu 
> ---
>  drivers/staging/vc04_services/bcm2835-audio/bcm2835-ctl.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/staging/vc04_services/bcm2835-audio/bcm2835-ctl.c 
> b/drivers/staging/vc04_services/bcm2835-audio/bcm2835-ctl.c
> index f484bb0..30bc246 100644
> --- a/drivers/staging/vc04_services/bcm2835-audio/bcm2835-ctl.c
> +++ b/drivers/staging/vc04_services/bcm2835-audio/bcm2835-ctl.c
> @@ -91,7 +91,7 @@ static int snd_bcm2835_ctl_get(struct snd_kcontrol 
> *kcontrol,
>   if (mutex_lock_interruptible(&chip->audio_mutex))
>   return -EINTR;
>  
> - BUG_ON(!chip && !(chip->avail_substreams & AVAIL_SUBSTREAMS_MASK));
> + WARN_ON(!chip && !(chip->avail_substreams & AVAIL_SUBSTREAMS_MASK));

The complete logic seems strange to me and the statement before didn't
even check for chip.

Regards
Stefan

>  
>   if (kcontrol->private_value == PCM_PLAYBACK_VOLUME)
>   ucontrol->value.integer.value[0] = chip2alsa(chip->volume);
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2] staging: pi433: Use matching enum types calling rf69_set_packet_format

2017-07-31 Thread Elia Geretto
This patch fixes the following four warnings found using sparse:

drivers/staging/pi433/pi433_if.c:211:9: warning: mixing different enum types
drivers/staging/pi433/pi433_if.c:211:9: int enum optionOnOff  versus
drivers/staging/pi433/pi433_if.c:211:9: int enum packetFormat
drivers/staging/pi433/pi433_if.c:211:9: warning: mixing different enum types
drivers/staging/pi433/pi433_if.c:211:9: int enum optionOnOff  versus
drivers/staging/pi433/pi433_if.c:211:9: int enum packetFormat
drivers/staging/pi433/pi433_if.c:268:9: warning: mixing different enum types
drivers/staging/pi433/pi433_if.c:268:9: int enum optionOnOff  versus
drivers/staging/pi433/pi433_if.c:268:9: int enum packetFormat
drivers/staging/pi433/pi433_if.c:268:9: warning: mixing different enum types
drivers/staging/pi433/pi433_if.c:268:9: int enum optionOnOff  versus
drivers/staging/pi433/pi433_if.c:268:9: int enum packetFormat

This is done calling the rf69_set_packet_format function using the
appropriate enum for the packetFormat argument.

Signed-off-by: Elia Geretto 
---
Changes in v2:
  - Declare ret at the top of the function.
  - Avoid moving the location of the check in rf69_set_tx_cfg.

 drivers/staging/pi433/pi433_if.c | 23 +--
 1 file changed, 21 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/pi433/pi433_if.c b/drivers/staging/pi433/pi433_if.c
index d9328ce5ec1d..712d2efef195 100644
--- a/drivers/staging/pi433/pi433_if.c
+++ b/drivers/staging/pi433/pi433_if.c
@@ -182,6 +182,7 @@ static void *DIO_irq_handler[NUM_DIO] = {
 static int
 rf69_set_rx_cfg(struct pi433_device *dev, struct pi433_rx_cfg *rx_cfg)
 {
+   int ret;
int payload_length;
 
/* receiver config */
@@ -208,7 +209,15 @@ rf69_set_rx_cfg(struct pi433_device *dev, struct 
pi433_rx_cfg *rx_cfg)
{
SET_CHECKED(rf69_set_fifo_fill_condition(dev->spi, always));
}
-   SET_CHECKED(rf69_set_packet_format  (dev->spi, 
rx_cfg->enable_length_byte));
+   if (rx_cfg->enable_length_byte == optionOn) {
+   ret = rf69_set_packet_format(dev->spi, packetLengthVar);
+   if (ret < 0)
+   return ret;
+   } else {
+   ret = rf69_set_packet_format(dev->spi, packetLengthFix);
+   if (ret < 0)
+   return ret;
+   }
SET_CHECKED(rf69_set_adressFiltering(dev->spi, 
rx_cfg->enable_address_filtering));
SET_CHECKED(rf69_set_crc_enable (dev->spi, rx_cfg->enable_crc));
 
@@ -247,6 +256,8 @@ rf69_set_rx_cfg(struct pi433_device *dev, struct 
pi433_rx_cfg *rx_cfg)
 static int
 rf69_set_tx_cfg(struct pi433_device *dev, struct pi433_tx_cfg *tx_cfg)
 {
+   int ret;
+
SET_CHECKED(rf69_set_frequency  (dev->spi, tx_cfg->frequency));
SET_CHECKED(rf69_set_bit_rate   (dev->spi, tx_cfg->bit_rate));
SET_CHECKED(rf69_set_modulation (dev->spi, tx_cfg->modulation));
@@ -265,7 +276,15 @@ rf69_set_tx_cfg(struct pi433_device *dev, struct 
pi433_tx_cfg *tx_cfg)
SET_CHECKED(rf69_set_preamble_length(dev->spi, 0));
}
SET_CHECKED(rf69_set_sync_enable  (dev->spi, tx_cfg->enable_sync));
-   SET_CHECKED(rf69_set_packet_format(dev->spi, 
tx_cfg->enable_length_byte));
+   if (tx_cfg->enable_length_byte == optionOn) {
+   ret = rf69_set_packet_format(dev->spi, packetLengthVar);
+   if (ret < 0)
+   return ret;
+   } else {
+   ret = rf69_set_packet_format(dev->spi, packetLengthFix);
+   if (ret < 0)
+   return ret;
+   }
SET_CHECKED(rf69_set_crc_enable   (dev->spi, tx_cfg->enable_crc));
 
/* configure sync, if enabled */
-- 
2.13.3

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


Re: [PATCH] fs: convert a pile of fsync routines to errseq_t based reporting

2017-07-31 Thread Jan Kara
On Fri 28-07-17 10:23:21, Jeff Layton wrote:
> From: Jeff Layton 
> 
> This patch converts most of the in-kernel filesystems that do writeback
> out of the pagecache to report errors using the errseq_t-based
> infrastructure that was recently added. This allows them to report
> errors once for each open file description.
> 
> Most filesystems have a fairly straightforward fsync operation. They
> call filemap_write_and_wait_range to write back all of the data and
> wait on it, and then (sometimes) sync out the metadata.
> 
> For those filesystems this is a straightforward conversion from calling
> filemap_write_and_wait_range in their fsync operation to calling
> file_write_and_wait_range.
> 
> Signed-off-by: Jeff Layton 

This all looks rather obvious. Feel free to add:

Acked-by: Jan Kara 

Honza


> ---
>  arch/powerpc/platforms/cell/spufs/file.c   | 2 +-
>  drivers/staging/lustre/lustre/llite/file.c | 2 +-
>  drivers/video/fbdev/core/fb_defio.c| 2 +-
>  fs/9p/vfs_file.c   | 4 ++--
>  fs/affs/file.c | 2 +-
>  fs/afs/write.c | 2 +-
>  fs/cifs/file.c | 4 ++--
>  fs/exofs/file.c| 2 +-
>  fs/f2fs/file.c | 2 +-
>  fs/hfs/inode.c | 2 +-
>  fs/hfsplus/inode.c | 2 +-
>  fs/hostfs/hostfs_kern.c| 2 +-
>  fs/hpfs/file.c | 2 +-
>  fs/jffs2/file.c| 2 +-
>  fs/jfs/file.c  | 2 +-
>  fs/ncpfs/file.c| 2 +-
>  fs/ntfs/dir.c  | 2 +-
>  fs/ntfs/file.c | 2 +-
>  fs/ocfs2/file.c| 2 +-
>  fs/reiserfs/dir.c  | 2 +-
>  fs/reiserfs/file.c | 2 +-
>  fs/ubifs/file.c| 2 +-
>  22 files changed, 24 insertions(+), 24 deletions(-)
> 
> Rolling up all of these conversions into a single patch, as Christoph
> Hellwig suggested. Most of these are not tested, but the conversion
> here is fairly straightforward.
> 
> Any maintainers who object, please let me know and I'll yank that
> part out of this patch.
> 
> diff --git a/arch/powerpc/platforms/cell/spufs/file.c 
> b/arch/powerpc/platforms/cell/spufs/file.c
> index ae2f740a82f1..5ffcdeb1eb17 100644
> --- a/arch/powerpc/platforms/cell/spufs/file.c
> +++ b/arch/powerpc/platforms/cell/spufs/file.c
> @@ -1749,7 +1749,7 @@ static int spufs_mfc_flush(struct file *file, 
> fl_owner_t id)
>  static int spufs_mfc_fsync(struct file *file, loff_t start, loff_t end, int 
> datasync)
>  {
>   struct inode *inode = file_inode(file);
> - int err = filemap_write_and_wait_range(inode->i_mapping, start, end);
> + int err = file_write_and_wait_range(file, start, end);
>   if (!err) {
>   inode_lock(inode);
>   err = spufs_mfc_flush(file, NULL);
> diff --git a/drivers/staging/lustre/lustre/llite/file.c 
> b/drivers/staging/lustre/lustre/llite/file.c
> index ab1c85c1ed38..f7d07735ac66 100644
> --- a/drivers/staging/lustre/lustre/llite/file.c
> +++ b/drivers/staging/lustre/lustre/llite/file.c
> @@ -2364,7 +2364,7 @@ int ll_fsync(struct file *file, loff_t start, loff_t 
> end, int datasync)
>  PFID(ll_inode2fid(inode)), inode);
>   ll_stats_ops_tally(ll_i2sbi(inode), LPROC_LL_FSYNC, 1);
>  
> - rc = filemap_write_and_wait_range(inode->i_mapping, start, end);
> + rc = file_write_and_wait_range(file, start, end);
>   inode_lock(inode);
>  
>   /* catch async errors that were recorded back when async writeback
> diff --git a/drivers/video/fbdev/core/fb_defio.c 
> b/drivers/video/fbdev/core/fb_defio.c
> index 37f69c061210..487d5e336e1b 100644
> --- a/drivers/video/fbdev/core/fb_defio.c
> +++ b/drivers/video/fbdev/core/fb_defio.c
> @@ -69,7 +69,7 @@ int fb_deferred_io_fsync(struct file *file, loff_t start, 
> loff_t end, int datasy
>  {
>   struct fb_info *info = file->private_data;
>   struct inode *inode = file_inode(file);
> - int err = filemap_write_and_wait_range(inode->i_mapping, start, end);
> + int err = file_write_and_wait_range(file, start, end);
>   if (err)
>   return err;
>  
> diff --git a/fs/9p/vfs_file.c b/fs/9p/vfs_file.c
> index 3de3b4a89d89..4802d75b3cf7 100644
> --- a/fs/9p/vfs_file.c
> +++ b/fs/9p/vfs_file.c
> @@ -445,7 +445,7 @@ static int v9fs_file_fsync(struct file *filp, loff_t 
> start, loff_t end,
>   struct p9_wstat wstat;
>   int retval;
>  
> - retval = filemap_write_and_wait_range(inode->i_mapping, start, end);
> + retval = file_write_and_wait_range(filp, start, end);
>   if (retval)
>   return retval;
>  
> @@ -468,7 +468,7 @@ int v9fs_file_fsync_dotl(struct file *filp, loff_t start,

[PATCH] Staging: vc04_services: Fix WARN_ON instead of BUG_ON

2017-07-31 Thread janani-sankarababu
This patch is to replace the use of BUG_ON macro with WARN_ON
inorder to prevent the crashing of the kernel.

Signed-off-by: Janani Sankara Babu 
---
 drivers/staging/vc04_services/bcm2835-audio/bcm2835-ctl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/vc04_services/bcm2835-audio/bcm2835-ctl.c 
b/drivers/staging/vc04_services/bcm2835-audio/bcm2835-ctl.c
index f484bb0..30bc246 100644
--- a/drivers/staging/vc04_services/bcm2835-audio/bcm2835-ctl.c
+++ b/drivers/staging/vc04_services/bcm2835-audio/bcm2835-ctl.c
@@ -91,7 +91,7 @@ static int snd_bcm2835_ctl_get(struct snd_kcontrol *kcontrol,
if (mutex_lock_interruptible(&chip->audio_mutex))
return -EINTR;
 
-   BUG_ON(!chip && !(chip->avail_substreams & AVAIL_SUBSTREAMS_MASK));
+   WARN_ON(!chip && !(chip->avail_substreams & AVAIL_SUBSTREAMS_MASK));
 
if (kcontrol->private_value == PCM_PLAYBACK_VOLUME)
ucontrol->value.integer.value[0] = chip2alsa(chip->volume);
-- 
1.9.1

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


Re: [PATCH 10/11] greybus: usb: constify hc_driver structures

2017-07-31 Thread Johan Hovold
On Fri, Jul 28, 2017 at 10:41:57PM +0200, Julia Lawall wrote:
> The hc_driver structure is only passed as the first argument to
> usb_create_hcd, which is declared as const.  Thus the hc_driver structure
> itself can be const.
> 
> Done with the help of Coccinelle.
> 
> Signed-off-by: Julia Lawall 

Acked-by: Johan Hovold 

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


Re: [PATCH 0/3] ANDROID: binder: reconcile with android common tree

2017-07-31 Thread Martijn Coenen
On Sat, Jul 29, 2017 at 1:22 AM, Greg KH  wrote:
> Ok, do some of these need to go to Linus now for 4.13-final and to the
> stable trees to match up with the 3 that are already proposed for the
> stable trees?  If so, which ones?

"fix proc->tsk check" is a fix for "c4ea41ba195d ("binder: use group
leader instead of open thread") which Todd sent to LKML just two weeks
ago; it should definitely go to 4.13-final if it still can, and
basically all the -stable kernels that patch ended up in (I think Todd
proposed back to 4.4).

The other two commits are related to the multiple domains /
scatter-gather patches that were upstreamed about 6 months ago (eg
7980240b6d63e); I saw those landed in 4.11-rc1 first.

Thanks,
Martijn

>
> thanks,
>
> greg k-h
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel