Re: [PATCH net-next 01/10] hv_netvsc: Resize some of the variables in hv_netvsc_packet

2015-11-24 Thread Vitaly Kuznetsov
"K. Y. Srinivasan"  writes:

> As part of reducing the size of the hv_netvsc_packet, resize some of the
> variables based on their usage.
>
> Signed-off-by: K. Y. Srinivasan 
> Reviewed-by: Haiyang Zhang 
> ---
>  drivers/net/hyperv/hyperv_net.h |   14 +++---
>  1 files changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/net/hyperv/hyperv_net.h b/drivers/net/hyperv/hyperv_net.h
> index 5fa98f5..972e562 100644
> --- a/drivers/net/hyperv/hyperv_net.h
> +++ b/drivers/net/hyperv/hyperv_net.h
> @@ -127,11 +127,11 @@ struct ndis_tcp_ip_checksum_info;
>   */
>  struct hv_netvsc_packet {
>   /* Bookkeeping stuff */
> - u32 status;
> + u8 status;
>
> - bool is_data_pkt;
> - bool xmit_more; /* from skb */
> - bool cp_partial; /* partial copy into send buffer */
> + u8 is_data_pkt;
> + u8 xmit_more; /* from skb */
> + u8 cp_partial; /* partial copy into send buffer */

These are flags so we can make them bitfields and save even more space.

>
>   u16 vlan_tci;
>
> @@ -147,13 +147,13 @@ struct hv_netvsc_packet {
>   /* This points to the memory after page_buf */
>   struct rndis_message *rndis_msg;
>
> - u32 rmsg_size; /* RNDIS header and PPI size */
> - u32 rmsg_pgcnt; /* page count of RNDIS header and PPI */
> + u8 rmsg_size; /* RNDIS header and PPI size */
> + u8 rmsg_pgcnt; /* page count of RNDIS header and PPI */
>
>   u32 total_data_buflen;
>   /* Points to the send/receive buffer where the ethernet frame is */
>   void *data;
> - u32 page_buf_cnt;
> + u8 page_buf_cnt;
>   struct hv_page_buffer *page_buf;
>  };

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


Re: [PATCH net-next 08/10] hv_netvsc: Don't ask for additional head room in the skb

2015-11-24 Thread Vitaly Kuznetsov
"K. Y. Srinivasan"  writes:

> The rndis header is 116 bytes big and can be placed in the default
> head room that will be available in the skb.

We have the following in include/linux/netdevice.h:

#if defined(CONFIG_WLAN) || IS_ENABLED(CONFIG_AX25)
# if defined(CONFIG_MAC80211_MESH)
#  define LL_MAX_HEADER 128
# else
#  define LL_MAX_HEADER 96
# endif
#else
# define LL_MAX_HEADER 32
#endif

In case someone disables MAC80211_MESH in his kernel config we're in
troubles again. I suggest we add additional patch here making sure it is
128 bytes for Hyper-V:

#if defined(CONFIG_HYPERV_NET)
# define LL_MAX_HEADER 128
#elseif defined(CONFIG_WLAN) || IS_ENABLED(CONFIG_AX25)
...

> Since the netvsc packet
> is less than 48 bytes, we can use the skb control buffer
> for the netvsc packet. With these changes we don't need to
> ask for additional head room.
>
> Signed-off-by: K. Y. Srinivasan 
> Reviewed-by: Haiyang Zhang 
> ---
>  drivers/net/hyperv/hyperv_net.h |3 +++
>  drivers/net/hyperv/netvsc_drv.c |   28 +---
>  2 files changed, 12 insertions(+), 19 deletions(-)
>
> diff --git a/drivers/net/hyperv/hyperv_net.h b/drivers/net/hyperv/hyperv_net.h
> index 9504ca9..e15dc2c 100644
> --- a/drivers/net/hyperv/hyperv_net.h
> +++ b/drivers/net/hyperv/hyperv_net.h
> @@ -124,6 +124,9 @@ struct ndis_tcp_ip_checksum_info;
>  /*
>   * Represent netvsc packet which contains 1 RNDIS and 1 ethernet frame
>   * within the RNDIS
> + *
> + * The size of this structure is less than 48 bytes and we can now
> + * place this structure in the skb->cb field.
>   */
>  struct hv_netvsc_packet {
>   /* Bookkeeping stuff */
> diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c
> index 947b778..9b6c507 100644
> --- a/drivers/net/hyperv/netvsc_drv.c
> +++ b/drivers/net/hyperv/netvsc_drv.c
> @@ -432,7 +432,6 @@ static int netvsc_start_xmit(struct sk_buff *skb, struct 
> net_device *net)
>   u32 net_trans_info;
>   u32 hash;
>   u32 skb_length;
> - u32 pkt_sz;
>   struct hv_page_buffer page_buf[MAX_PAGE_BUFFER_COUNT];
>   struct netvsc_stats *tx_stats = this_cpu_ptr(net_device_ctx->tx_stats);
>
> @@ -460,16 +459,19 @@ check_size:
>   goto check_size;
>   }
>
> - pkt_sz = sizeof(struct hv_netvsc_packet) + RNDIS_AND_PPI_SIZE;
> -
> - ret = skb_cow_head(skb, pkt_sz);
> + /*
> +  * Place the rndis header in the skb head room and
> +  * the skb->cb will be used for hv_netvsc_packet
> +  * structure.
> +  */
> + ret = skb_cow_head(skb, RNDIS_AND_PPI_SIZE);
>   if (ret) {
>   netdev_err(net, "unable to alloc hv_netvsc_packet\n");
>   ret = -ENOMEM;
>   goto drop;
>   }
> - /* Use the headroom for building up the packet */
> - packet = (struct hv_netvsc_packet *)skb->head;
> + /* Use the skb control buffer for building up the packet */
> + packet = (struct hv_netvsc_packet *)skb->cb;
>
>   packet->status = 0;
>   packet->xmit_more = skb->xmit_more;
> @@ -482,8 +484,7 @@ check_size:
>   packet->is_data_pkt = true;
>   packet->total_data_buflen = skb->len;
>
> - rndis_msg = (struct rndis_message *)((unsigned long)packet +
> - sizeof(struct hv_netvsc_packet));
> + rndis_msg = (struct rndis_message *)skb->head;
>
>   memset(rndis_msg, 0, RNDIS_AND_PPI_SIZE);
>
> @@ -1071,16 +1072,12 @@ static int netvsc_probe(struct hv_device *dev,
>   struct netvsc_device_info device_info;
>   struct netvsc_device *nvdev;
>   int ret;
> - u32 max_needed_headroom;
>
>   net = alloc_etherdev_mq(sizeof(struct net_device_context),
>   num_online_cpus());
>   if (!net)
>   return -ENOMEM;
>
> - max_needed_headroom = sizeof(struct hv_netvsc_packet) +
> -   RNDIS_AND_PPI_SIZE;
> -
>   netif_carrier_off(net);
>
>   net_device_ctx = netdev_priv(net);
> @@ -1116,13 +1113,6 @@ static int netvsc_probe(struct hv_device *dev,
>   net->ethtool_ops = ðtool_ops;
>   SET_NETDEV_DEV(net, &dev->device);
>
> - /*
> -  * Request additional head room in the skb.
> -  * We will use this space to build the rndis
> -  * heaser and other state we need to maintain.
> -  */
> - net->needed_headroom = max_needed_headroom;
> -
>   /* Notify the netvsc driver of the new device */
>   memset(&device_info, 0, sizeof(device_info));
>   device_info.ring_size = ring_size;

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


Re: [PATCH net-next 08/10] hv_netvsc: Don't ask for additional head room in the skb

2015-11-24 Thread Florian Westphal
K. Y. Srinivasan  wrote:
> The rndis header is 116 bytes big and can be placed in the default
> head room that will be available in the skb. Since the netvsc packet
> is less than 48 bytes, we can use the skb control buffer
> for the netvsc packet. With these changes we don't need to
> ask for additional head room.

Minor nit: could you add a BUILD_BUG_ON test for this?  Something like

BUILD_BUG_ON(sizeof(struct hv_netvsc_packet) > FIELD_SIZEOF(struct sk_buff, 
cb));
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] staging: comedi: comedilib.h: Coding style warning fix for block comments

2015-11-24 Thread Andy Shevchenko
On Tue, Nov 24, 2015 at 5:12 AM, Jitendra Kumar Khasdev
 wrote:
> This patch is to comedilib.h file that fixes up following warnings
> reported by checkpatch.pl :
> I) Block comments use * on subsequent lines
>
> Signed-off-by: Jitendra Kumar Khasdev 
> ---
>  drivers/staging/comedi/comedilib.h | 32 
>  1 file changed, 16 insertions(+), 16 deletions(-)
>
> diff --git a/drivers/staging/comedi/comedilib.h 
> b/drivers/staging/comedi/comedilib.h
> index 56baf85..e530028 100644
> --- a/drivers/staging/comedi/comedilib.h
> +++ b/drivers/staging/comedi/comedilib.h
> @@ -1,20 +1,20 @@
>  /*
> -linux/include/comedilib.h
> -header file for kcomedilib
> -
> -COMEDI - Linux Control and Measurement Device Interface
> -Copyright (C) 1998-2001 David A. Schleef 
> -
> -This program is free software; you can redistribute it and/or modify
> -it under the terms of the GNU General Public License as published by
> -the Free Software Foundation; either version 2 of the License, or
> -(at your option) any later version.
> -
> -This program is distributed in the hope that it will be useful,
> -but WITHOUT ANY WARRANTY; without even the implied warranty of
> -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> -GNU General Public License for more details.
> -*/
> + * linux/include/comedilib.h

Other way around. Remove this line, capitalize the next one.

-linux/include/comedilib.h
+Header file for kcomedilib.

> + *
> + * COMEDI - Linux Control and Measurement Device Interface
> + * Copyright (C) 1998-2001 David A. Schleef 
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License as published by
> + * the Free Software Foundation; either version 2 of the License, or
> + * (at your option) any later version.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU General Public License for more details.
> + *
> + */
>
>  #ifndef _LINUX_COMEDILIB_H
>  #define _LINUX_COMEDILIB_H
> --
> 1.9.1
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/



-- 
With Best Regards,
Andy Shevchenko
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 0/4] staging: rtl8712: Cleanups for rtl871x_ioctl_rtl

2015-11-24 Thread Mauro Dreissig
This applies some janitorial work.

Mauro Dreissig (4):
  staging: rtl8712: Remove casts between void * and type *
  staging: rtl8712: Rename local variable
  staging: rtl8712: Make error handling check for failure
  staging: rtl8712: Rename local variable

 drivers/staging/rtl8712/rtl871x_ioctl_rtl.c | 479 +---
 drivers/staging/rtl8712/rtl871x_ioctl_rtl.h | 123 +++
 2 files changed, 266 insertions(+), 336 deletions(-)

-- 
2.6.3

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


[PATCH 1/4] staging: rtl8712: Remove casts between void * and type *

2015-11-24 Thread Mauro Dreissig
Cleaning rtl871x_ioctl_rtl.c.

Signed-off-by: Mauro Dreissig 
---
 drivers/staging/rtl8712/rtl871x_ioctl_rtl.c | 45 ++---
 1 file changed, 15 insertions(+), 30 deletions(-)

diff --git a/drivers/staging/rtl8712/rtl871x_ioctl_rtl.c 
b/drivers/staging/rtl8712/rtl871x_ioctl_rtl.c
index 7c346a4..c7f2e51 100644
--- a/drivers/staging/rtl8712/rtl871x_ioctl_rtl.c
+++ b/drivers/staging/rtl8712/rtl871x_ioctl_rtl.c
@@ -49,8 +49,7 @@ uint oid_rt_get_signal_quality_hdl(struct oid_par_priv 
*poid_par_priv)
 
 uint oid_rt_get_small_packet_crc_hdl(struct oid_par_priv *poid_par_priv)
 {
-   struct _adapter *padapter = (struct _adapter *)
-   (poid_par_priv->adapter_context);
+   struct _adapter *padapter = poid_par_priv->adapter_context;
 
if (poid_par_priv->type_of_oid != QUERY_OID)
return RNDIS_STATUS_NOT_ACCEPTED;
@@ -66,8 +65,7 @@ uint oid_rt_get_small_packet_crc_hdl(struct oid_par_priv 
*poid_par_priv)
 
 uint oid_rt_get_middle_packet_crc_hdl(struct oid_par_priv *poid_par_priv)
 {
-   struct _adapter *padapter = (struct _adapter *)
-   (poid_par_priv->adapter_context);
+   struct _adapter *padapter = poid_par_priv->adapter_context;
 
if (poid_par_priv->type_of_oid != QUERY_OID)
return RNDIS_STATUS_NOT_ACCEPTED;
@@ -83,8 +81,7 @@ uint oid_rt_get_middle_packet_crc_hdl(struct oid_par_priv 
*poid_par_priv)
 
 uint oid_rt_get_large_packet_crc_hdl(struct oid_par_priv *poid_par_priv)
 {
-   struct _adapter *padapter = (struct _adapter *)
-   (poid_par_priv->adapter_context);
+   struct _adapter *padapter = poid_par_priv->adapter_context;
 
if (poid_par_priv->type_of_oid != QUERY_OID)
return RNDIS_STATUS_NOT_ACCEPTED;
@@ -115,8 +112,7 @@ uint oid_rt_get_rx_retry_hdl(struct oid_par_priv 
*poid_par_priv)
 
 uint oid_rt_get_rx_total_packet_hdl(struct oid_par_priv *poid_par_priv)
 {
-   struct _adapter *padapter = (struct _adapter *)
-   (poid_par_priv->adapter_context);
+   struct _adapter *padapter = poid_par_priv->adapter_context;
 
if (poid_par_priv->type_of_oid != QUERY_OID)
return RNDIS_STATUS_NOT_ACCEPTED;
@@ -147,8 +143,7 @@ uint oid_rt_get_tx_beacon_err_hdl(struct oid_par_priv 
*poid_par_priv)
 
 uint oid_rt_get_rx_icv_err_hdl(struct oid_par_priv *poid_par_priv)
 {
-   struct _adapter *padapter = (struct _adapter *)
-   (poid_par_priv->adapter_context);
+   struct _adapter *padapter = poid_par_priv->adapter_context;
 
if (poid_par_priv->type_of_oid != QUERY_OID)
return RNDIS_STATUS_NOT_ACCEPTED;
@@ -172,8 +167,7 @@ uint oid_rt_set_encryption_algorithm_hdl(struct oid_par_priv
 
 uint oid_rt_get_preamble_mode_hdl(struct oid_par_priv *poid_par_priv)
 {
-   struct _adapter *padapter = (struct _adapter *)
-   (poid_par_priv->adapter_context);
+   struct _adapter *padapter = poid_par_priv->adapter_context;
u32 preamblemode = 0;
 
if (poid_par_priv->type_of_oid != QUERY_OID)
@@ -202,8 +196,7 @@ uint oid_rt_get_ap_ip_hdl(struct oid_par_priv 
*poid_par_priv)
 
 uint oid_rt_get_channelplan_hdl(struct oid_par_priv *poid_par_priv)
 {
-   struct _adapter *padapter = (struct _adapter *)
-   (poid_par_priv->adapter_context);
+   struct _adapter *padapter = poid_par_priv->adapter_context;
struct eeprom_priv *peeprompriv = &padapter->eeprompriv;
 
if (poid_par_priv->type_of_oid != QUERY_OID)
@@ -216,8 +209,7 @@ uint oid_rt_get_channelplan_hdl(struct oid_par_priv 
*poid_par_priv)
 uint oid_rt_set_channelplan_hdl(struct oid_par_priv
   *poid_par_priv)
 {
-   struct _adapter *padapter = (struct _adapter *)
-   (poid_par_priv->adapter_context);
+   struct _adapter *padapter = poid_par_priv->adapter_context;
struct eeprom_priv *peeprompriv = &padapter->eeprompriv;
 
if (poid_par_priv->type_of_oid != SET_OID)
@@ -229,8 +221,7 @@ uint oid_rt_set_channelplan_hdl(struct oid_par_priv
 uint oid_rt_set_preamble_mode_hdl(struct oid_par_priv
 *poid_par_priv)
 {
-   struct _adapter *padapter = (struct _adapter *)
-   (poid_par_priv->adapter_context);
+   struct _adapter *padapter = poid_par_priv->adapter_context;
u32 preamblemode = 0;
 
if (poid_par_priv->type_of_oid != SET_OID)
@@ -267,8 +258,7 @@ uint oid_rt_dedicate_probe_hdl(struct oid_par_priv
 uint oid_rt_get_total_tx_bytes_hdl(struct oid_par_priv
  *poid_par_priv)
 {
-   struct _adapter *padapter = (struct _adapter *)
-   (poid_par_priv->adapter_context);
+   struct _adapter *padapter 

[PATCH 2/4] staging: rtl8712: Rename local variable

2015-11-24 Thread Mauro Dreissig
Make all instances of struct _adapter be called adapter in
rtl871x_ioctl_rtl.c.

Signed-off-by: Mauro Dreissig 
---
 drivers/staging/rtl8712/rtl871x_ioctl_rtl.c | 86 ++---
 1 file changed, 43 insertions(+), 43 deletions(-)

diff --git a/drivers/staging/rtl8712/rtl871x_ioctl_rtl.c 
b/drivers/staging/rtl8712/rtl871x_ioctl_rtl.c
index c7f2e51..97596aa 100644
--- a/drivers/staging/rtl8712/rtl871x_ioctl_rtl.c
+++ b/drivers/staging/rtl8712/rtl871x_ioctl_rtl.c
@@ -49,13 +49,13 @@ uint oid_rt_get_signal_quality_hdl(struct oid_par_priv 
*poid_par_priv)
 
 uint oid_rt_get_small_packet_crc_hdl(struct oid_par_priv *poid_par_priv)
 {
-   struct _adapter *padapter = poid_par_priv->adapter_context;
+   struct _adapter *adapter = poid_par_priv->adapter_context;
 
if (poid_par_priv->type_of_oid != QUERY_OID)
return RNDIS_STATUS_NOT_ACCEPTED;
if (poid_par_priv->information_buf_len >=  sizeof(u32)) {
*(u32 *)poid_par_priv->information_buf =
-   padapter->recvpriv.rx_smallpacket_crcerr;
+   adapter->recvpriv.rx_smallpacket_crcerr;
*poid_par_priv->bytes_rw = poid_par_priv->information_buf_len;
} else {
return RNDIS_STATUS_INVALID_LENGTH;
@@ -65,13 +65,13 @@ uint oid_rt_get_small_packet_crc_hdl(struct oid_par_priv 
*poid_par_priv)
 
 uint oid_rt_get_middle_packet_crc_hdl(struct oid_par_priv *poid_par_priv)
 {
-   struct _adapter *padapter = poid_par_priv->adapter_context;
+   struct _adapter *adapter = poid_par_priv->adapter_context;
 
if (poid_par_priv->type_of_oid != QUERY_OID)
return RNDIS_STATUS_NOT_ACCEPTED;
if (poid_par_priv->information_buf_len >=  sizeof(u32)) {
*(u32 *)poid_par_priv->information_buf =
-   padapter->recvpriv.rx_middlepacket_crcerr;
+   adapter->recvpriv.rx_middlepacket_crcerr;
*poid_par_priv->bytes_rw = poid_par_priv->information_buf_len;
} else {
return RNDIS_STATUS_INVALID_LENGTH;
@@ -81,13 +81,13 @@ uint oid_rt_get_middle_packet_crc_hdl(struct oid_par_priv 
*poid_par_priv)
 
 uint oid_rt_get_large_packet_crc_hdl(struct oid_par_priv *poid_par_priv)
 {
-   struct _adapter *padapter = poid_par_priv->adapter_context;
+   struct _adapter *adapter = poid_par_priv->adapter_context;
 
if (poid_par_priv->type_of_oid != QUERY_OID)
return RNDIS_STATUS_NOT_ACCEPTED;
if (poid_par_priv->information_buf_len >=  sizeof(u32)) {
*(u32 *)poid_par_priv->information_buf =
-padapter->recvpriv.rx_largepacket_crcerr;
+adapter->recvpriv.rx_largepacket_crcerr;
*poid_par_priv->bytes_rw = poid_par_priv->information_buf_len;
} else {
return RNDIS_STATUS_INVALID_LENGTH;
@@ -112,14 +112,14 @@ uint oid_rt_get_rx_retry_hdl(struct oid_par_priv 
*poid_par_priv)
 
 uint oid_rt_get_rx_total_packet_hdl(struct oid_par_priv *poid_par_priv)
 {
-   struct _adapter *padapter = poid_par_priv->adapter_context;
+   struct _adapter *adapter = poid_par_priv->adapter_context;
 
if (poid_par_priv->type_of_oid != QUERY_OID)
return RNDIS_STATUS_NOT_ACCEPTED;
if (poid_par_priv->information_buf_len >=  sizeof(u32)) {
*(u32 *)poid_par_priv->information_buf =
-padapter->recvpriv.rx_pkts +
-padapter->recvpriv.rx_drop;
+adapter->recvpriv.rx_pkts +
+adapter->recvpriv.rx_drop;
*poid_par_priv->bytes_rw = poid_par_priv->information_buf_len;
} else {
return RNDIS_STATUS_INVALID_LENGTH;
@@ -143,13 +143,13 @@ uint oid_rt_get_tx_beacon_err_hdl(struct oid_par_priv 
*poid_par_priv)
 
 uint oid_rt_get_rx_icv_err_hdl(struct oid_par_priv *poid_par_priv)
 {
-   struct _adapter *padapter = poid_par_priv->adapter_context;
+   struct _adapter *adapter = poid_par_priv->adapter_context;
 
if (poid_par_priv->type_of_oid != QUERY_OID)
return RNDIS_STATUS_NOT_ACCEPTED;
if (poid_par_priv->information_buf_len >= sizeof(u32)) {
*(uint *)poid_par_priv->information_buf =
-padapter->recvpriv.rx_icv_err;
+adapter->recvpriv.rx_icv_err;
*poid_par_priv->bytes_rw = poid_par_priv->information_buf_len;
} else {
return RNDIS_STATUS_INVALID_LENGTH;
@@ -167,17 +167,17 @@ uint oid_rt_set_encryption_algorithm_hdl(struct 
oid_par_priv
 
 uint oid_rt_get_preamble_mode_hdl(struct oid_par_priv *poid_par_priv)
 {
-   struct _adapter *padapter = poid_par_priv->adapter_context;
+   struct _ada

[PATCH 3/4] staging: rtl8712: Make error handling check for failure

2015-11-24 Thread Mauro Dreissig
Some error handling paths are checking for success
instead of error on rtl871x_ioctl_rtl.c.

Signed-off-by: Mauro Dreissig 
---
 drivers/staging/rtl8712/rtl871x_ioctl_rtl.c | 239 ++--
 1 file changed, 121 insertions(+), 118 deletions(-)

diff --git a/drivers/staging/rtl8712/rtl871x_ioctl_rtl.c 
b/drivers/staging/rtl8712/rtl871x_ioctl_rtl.c
index 97596aa..9317370 100644
--- a/drivers/staging/rtl8712/rtl871x_ioctl_rtl.c
+++ b/drivers/staging/rtl8712/rtl871x_ioctl_rtl.c
@@ -53,13 +53,13 @@ uint oid_rt_get_small_packet_crc_hdl(struct oid_par_priv 
*poid_par_priv)
 
if (poid_par_priv->type_of_oid != QUERY_OID)
return RNDIS_STATUS_NOT_ACCEPTED;
-   if (poid_par_priv->information_buf_len >=  sizeof(u32)) {
-   *(u32 *)poid_par_priv->information_buf =
-   adapter->recvpriv.rx_smallpacket_crcerr;
-   *poid_par_priv->bytes_rw = poid_par_priv->information_buf_len;
-   } else {
+
+   if (poid_par_priv->information_buf_len < sizeof(u32))
return RNDIS_STATUS_INVALID_LENGTH;
-   }
+
+   *(u32 *)poid_par_priv->information_buf = 
adapter->recvpriv.rx_smallpacket_crcerr;
+   *poid_par_priv->bytes_rw = poid_par_priv->information_buf_len;
+
return RNDIS_STATUS_SUCCESS;
 }
 
@@ -69,13 +69,13 @@ uint oid_rt_get_middle_packet_crc_hdl(struct oid_par_priv 
*poid_par_priv)
 
if (poid_par_priv->type_of_oid != QUERY_OID)
return RNDIS_STATUS_NOT_ACCEPTED;
-   if (poid_par_priv->information_buf_len >=  sizeof(u32)) {
-   *(u32 *)poid_par_priv->information_buf =
-   adapter->recvpriv.rx_middlepacket_crcerr;
-   *poid_par_priv->bytes_rw = poid_par_priv->information_buf_len;
-   } else {
+
+   if (poid_par_priv->information_buf_len < sizeof(u32))
return RNDIS_STATUS_INVALID_LENGTH;
-   }
+
+   *(u32 *)poid_par_priv->information_buf = 
adapter->recvpriv.rx_middlepacket_crcerr;
+   *poid_par_priv->bytes_rw = poid_par_priv->information_buf_len;
+
return RNDIS_STATUS_SUCCESS;
 }
 
@@ -85,13 +85,13 @@ uint oid_rt_get_large_packet_crc_hdl(struct oid_par_priv 
*poid_par_priv)
 
if (poid_par_priv->type_of_oid != QUERY_OID)
return RNDIS_STATUS_NOT_ACCEPTED;
-   if (poid_par_priv->information_buf_len >=  sizeof(u32)) {
-   *(u32 *)poid_par_priv->information_buf =
-adapter->recvpriv.rx_largepacket_crcerr;
-   *poid_par_priv->bytes_rw = poid_par_priv->information_buf_len;
-   } else {
+
+   if (poid_par_priv->information_buf_len < sizeof(u32))
return RNDIS_STATUS_INVALID_LENGTH;
-   }
+
+   *(u32 *)poid_par_priv->information_buf = 
adapter->recvpriv.rx_largepacket_crcerr;
+   *poid_par_priv->bytes_rw = poid_par_priv->information_buf_len;
+
return RNDIS_STATUS_SUCCESS;
 }
 
@@ -116,14 +116,14 @@ uint oid_rt_get_rx_total_packet_hdl(struct oid_par_priv 
*poid_par_priv)
 
if (poid_par_priv->type_of_oid != QUERY_OID)
return RNDIS_STATUS_NOT_ACCEPTED;
-   if (poid_par_priv->information_buf_len >=  sizeof(u32)) {
-   *(u32 *)poid_par_priv->information_buf =
-adapter->recvpriv.rx_pkts +
-adapter->recvpriv.rx_drop;
-   *poid_par_priv->bytes_rw = poid_par_priv->information_buf_len;
-   } else {
+
+   if (poid_par_priv->information_buf_len < sizeof(u32))
return RNDIS_STATUS_INVALID_LENGTH;
-   }
+
+   *(u32 *)poid_par_priv->information_buf =
+   adapter->recvpriv.rx_pkts + adapter->recvpriv.rx_drop;
+   *poid_par_priv->bytes_rw = poid_par_priv->information_buf_len;
+
return RNDIS_STATUS_SUCCESS;
 }
 
@@ -147,13 +147,13 @@ uint oid_rt_get_rx_icv_err_hdl(struct oid_par_priv 
*poid_par_priv)
 
if (poid_par_priv->type_of_oid != QUERY_OID)
return RNDIS_STATUS_NOT_ACCEPTED;
-   if (poid_par_priv->information_buf_len >= sizeof(u32)) {
-   *(uint *)poid_par_priv->information_buf =
-adapter->recvpriv.rx_icv_err;
-   *poid_par_priv->bytes_rw = poid_par_priv->information_buf_len;
-   } else {
+
+   if (poid_par_priv->information_buf_len < sizeof(u32)) 
return RNDIS_STATUS_INVALID_LENGTH;
-   }
+
+   *(uint *)poid_par_priv->information_buf = adapter->recvpriv.rx_icv_err;
+   *poid_par_priv->bytes_rw = poid_par_priv->information_buf_len;
+
return RNDIS_STATUS_SUCCESS;
 }
 
@@ -172,18 +172,20 @@ uint oid_rt_get_preamble_mode_hdl(struct oid_par_priv 
*poid_par_priv)
 
if (poid_par_priv->type_of_oid != QUERY_OID)
return RNDIS_STATUS_NOT_ACCEPTED;
-   if (poid_par_priv->information_buf_len >= sizeof(u32)) {
-   if (adapt

[PATCH 4/4] staging: rtl8712: Rename local variable

2015-11-24 Thread Mauro Dreissig
Make all instances of struct oid_par_priv be called oid
in rtl871x_ioctl_rtl.c and rtl871x_ioctl_rtl.h.

Signed-off-by: Mauro Dreissig 
---
 drivers/staging/rtl8712/rtl871x_ioctl_rtl.c | 287 +---
 drivers/staging/rtl8712/rtl871x_ioctl_rtl.h | 123 
 2 files changed, 176 insertions(+), 234 deletions(-)

diff --git a/drivers/staging/rtl8712/rtl871x_ioctl_rtl.c 
b/drivers/staging/rtl8712/rtl871x_ioctl_rtl.c
index 9317370..3bbca78 100644
--- a/drivers/staging/rtl8712/rtl871x_ioctl_rtl.c
+++ b/drivers/staging/rtl8712/rtl871x_ioctl_rtl.c
@@ -40,140 +40,139 @@
 #include "rtl871x_mp.h"
 #include "rtl871x_mp_ioctl.h"
 
-uint oid_rt_get_signal_quality_hdl(struct oid_par_priv *poid_par_priv)
+uint oid_rt_get_signal_quality_hdl(struct oid_par_priv *oid)
 {
-   if (poid_par_priv->type_of_oid != QUERY_OID)
+   if (oid->type_of_oid != QUERY_OID)
return RNDIS_STATUS_NOT_ACCEPTED;
return RNDIS_STATUS_SUCCESS;
 }
 
-uint oid_rt_get_small_packet_crc_hdl(struct oid_par_priv *poid_par_priv)
+uint oid_rt_get_small_packet_crc_hdl(struct oid_par_priv *oid)
 {
-   struct _adapter *adapter = poid_par_priv->adapter_context;
+   struct _adapter *adapter = oid->adapter_context;
 
-   if (poid_par_priv->type_of_oid != QUERY_OID)
+   if (oid->type_of_oid != QUERY_OID)
return RNDIS_STATUS_NOT_ACCEPTED;
 
-   if (poid_par_priv->information_buf_len < sizeof(u32))
+   if (oid->information_buf_len < sizeof(u32))
return RNDIS_STATUS_INVALID_LENGTH;
 
-   *(u32 *)poid_par_priv->information_buf = 
adapter->recvpriv.rx_smallpacket_crcerr;
-   *poid_par_priv->bytes_rw = poid_par_priv->information_buf_len;
+   *(u32 *)oid->information_buf = adapter->recvpriv.rx_smallpacket_crcerr;
+   *oid->bytes_rw = oid->information_buf_len;
 
return RNDIS_STATUS_SUCCESS;
 }
 
-uint oid_rt_get_middle_packet_crc_hdl(struct oid_par_priv *poid_par_priv)
+uint oid_rt_get_middle_packet_crc_hdl(struct oid_par_priv *oid)
 {
-   struct _adapter *adapter = poid_par_priv->adapter_context;
+   struct _adapter *adapter = oid->adapter_context;
 
-   if (poid_par_priv->type_of_oid != QUERY_OID)
+   if (oid->type_of_oid != QUERY_OID)
return RNDIS_STATUS_NOT_ACCEPTED;
 
-   if (poid_par_priv->information_buf_len < sizeof(u32))
+   if (oid->information_buf_len < sizeof(u32))
return RNDIS_STATUS_INVALID_LENGTH;
 
-   *(u32 *)poid_par_priv->information_buf = 
adapter->recvpriv.rx_middlepacket_crcerr;
-   *poid_par_priv->bytes_rw = poid_par_priv->information_buf_len;
+   *(u32 *)oid->information_buf = adapter->recvpriv.rx_middlepacket_crcerr;
+   *oid->bytes_rw = oid->information_buf_len;
 
return RNDIS_STATUS_SUCCESS;
 }
 
-uint oid_rt_get_large_packet_crc_hdl(struct oid_par_priv *poid_par_priv)
+uint oid_rt_get_large_packet_crc_hdl(struct oid_par_priv *oid)
 {
-   struct _adapter *adapter = poid_par_priv->adapter_context;
+   struct _adapter *adapter = oid->adapter_context;
 
-   if (poid_par_priv->type_of_oid != QUERY_OID)
+   if (oid->type_of_oid != QUERY_OID)
return RNDIS_STATUS_NOT_ACCEPTED;
 
-   if (poid_par_priv->information_buf_len < sizeof(u32))
+   if (oid->information_buf_len < sizeof(u32))
return RNDIS_STATUS_INVALID_LENGTH;
 
-   *(u32 *)poid_par_priv->information_buf = 
adapter->recvpriv.rx_largepacket_crcerr;
-   *poid_par_priv->bytes_rw = poid_par_priv->information_buf_len;
+   *(u32 *)oid->information_buf = adapter->recvpriv.rx_largepacket_crcerr;
+   *oid->bytes_rw = oid->information_buf_len;
 
return RNDIS_STATUS_SUCCESS;
 }
 
-uint oid_rt_get_tx_retry_hdl(struct oid_par_priv *poid_par_priv)
+uint oid_rt_get_tx_retry_hdl(struct oid_par_priv *oid)
 {
-   if (poid_par_priv->type_of_oid != QUERY_OID)
+   if (oid->type_of_oid != QUERY_OID)
return RNDIS_STATUS_NOT_ACCEPTED;
return RNDIS_STATUS_SUCCESS;
 }
 
-uint oid_rt_get_rx_retry_hdl(struct oid_par_priv *poid_par_priv)
+uint oid_rt_get_rx_retry_hdl(struct oid_par_priv *oid)
 {
-   if (poid_par_priv->type_of_oid != QUERY_OID)
+   if (oid->type_of_oid != QUERY_OID)
return RNDIS_STATUS_NOT_ACCEPTED;
-   *poid_par_priv->bytes_rw = poid_par_priv->information_buf_len;
+   *oid->bytes_rw = oid->information_buf_len;
return RNDIS_STATUS_SUCCESS;
 }
 
-uint oid_rt_get_rx_total_packet_hdl(struct oid_par_priv *poid_par_priv)
+uint oid_rt_get_rx_total_packet_hdl(struct oid_par_priv *oid)
 {
-   struct _adapter *adapter = poid_par_priv->adapter_context;
+   struct _adapter *adapter = oid->adapter_context;
 
-   if (poid_par_priv->type_of_oid != QUERY_OID)
+   if (oid->type_of_oid != QUERY_OID)
return RNDIS_STATUS_NOT_ACCEPTED;
 
-   if (poid_par_priv->information_buf_len < sizeof(u32))
+   if (oid->information_buf_l

[PATCH] staging: comedi: comedilib.h: Coding style warning fix for block comments

2015-11-24 Thread Jitendra Kumar Khasdev
This patch is to comedilib.h file that fixes up following warnings
reported by checkpatch.pl :
I) Block comments use * on subsequent lines.

Apart from it I have remove header file path by base file name as
suggested by community.

Signed-off-by: Jitendra Kumar Khasdev 
---
 drivers/staging/comedi/comedilib.h | 32 
 1 file changed, 16 insertions(+), 16 deletions(-)

diff --git a/drivers/staging/comedi/comedilib.h 
b/drivers/staging/comedi/comedilib.h
index 56baf85..f9b5639 100644
--- a/drivers/staging/comedi/comedilib.h
+++ b/drivers/staging/comedi/comedilib.h
@@ -1,20 +1,20 @@
 /*
-linux/include/comedilib.h
-header file for kcomedilib
-
-COMEDI - Linux Control and Measurement Device Interface
-Copyright (C) 1998-2001 David A. Schleef 
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
-*/
+ * comedilib.h
+ * Header file for kcomedilib
+ *
+ * COMEDI - Linux Control and Measurement Device Interface
+ * Copyright (C) 1998-2001 David A. Schleef 
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
 
 #ifndef _LINUX_COMEDILIB_H
 #define _LINUX_COMEDILIB_H
-- 
1.9.1

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


Re: [PATCH] staging: comedi: comedilib.h: Coding style warning fix for block comments

2015-11-24 Thread Ian Abbott

On 24/11/15 12:22, Jitendra Kumar Khasdev wrote:

This patch is to comedilib.h file that fixes up following warnings
reported by checkpatch.pl :
I) Block comments use * on subsequent lines.

Apart from it I have remove header file path by base file name as
suggested by community.

Signed-off-by: Jitendra Kumar Khasdev 
---
  drivers/staging/comedi/comedilib.h | 32 
  1 file changed, 16 insertions(+), 16 deletions(-)

diff --git a/drivers/staging/comedi/comedilib.h 
b/drivers/staging/comedi/comedilib.h
index 56baf85..f9b5639 100644
--- a/drivers/staging/comedi/comedilib.h
+++ b/drivers/staging/comedi/comedilib.h
@@ -1,20 +1,20 @@
  /*
-linux/include/comedilib.h
-header file for kcomedilib
-
-COMEDI - Linux Control and Measurement Device Interface
-Copyright (C) 1998-2001 David A. Schleef 
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
-*/
+ * comedilib.h
+ * Header file for kcomedilib
+ *
+ * COMEDI - Linux Control and Measurement Device Interface
+ * Copyright (C) 1998-2001 David A. Schleef 
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */

  #ifndef _LINUX_COMEDILIB_H
  #define _LINUX_COMEDILIB_H



Thanks!

Reviewed-by: Ian Abbott 

--
-=( Ian Abbott @ MEV Ltd.E-mail:  )=-
-=(  Web: http://www.mev.co.uk/  )=-
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 1/4] staging: rtl8712: Remove casts between void * and type *

2015-11-24 Thread Dan Carpenter
On Tue, Nov 24, 2015 at 10:19:39AM -0200, Mauro Dreissig wrote:
> Cleaning rtl871x_ioctl_rtl.c.
> 

It's better if you think about the header and the body as two different
things.  Just repeat the title but with more information.

regards,
dan carpenter

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


[PATCH] staging: unisys: better config switch comments

2015-11-24 Thread Benjamin Romer
We should provide more information in the Kconfig help for visorbus and
visorinput.

Signed-off-by: Benjamin Romer 
---
 drivers/staging/unisys/visorbus/Kconfig   | 7 ++-
 drivers/staging/unisys/visorinput/Kconfig | 7 ++-
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/unisys/visorbus/Kconfig 
b/drivers/staging/unisys/visorbus/Kconfig
index 9b299ac..5113880 100644
--- a/drivers/staging/unisys/visorbus/Kconfig
+++ b/drivers/staging/unisys/visorbus/Kconfig
@@ -6,4 +6,9 @@ config UNISYS_VISORBUS
tristate "Unisys visorbus driver"
depends on UNISYSSPAR
---help---
-   If you say Y here, you will enable the Unisys visorbus driver.
+   The visorbus driver is a virtualized bus for the Unisys s-Par firmware.
+   Virtualized devices allow Linux guests on a system to share disks and
+   network cards that do not have SR-IOV support, and to be accessed using
+   the partition desktop application. The visorbus driver is required to
+   discover devices on an s-Par guest, and must be present for any other
+   s-Par guest driver to function correctly.
diff --git a/drivers/staging/unisys/visorinput/Kconfig 
b/drivers/staging/unisys/visorinput/Kconfig
index d83deb4..3476d41 100644
--- a/drivers/staging/unisys/visorinput/Kconfig
+++ b/drivers/staging/unisys/visorinput/Kconfig
@@ -6,5 +6,10 @@ config UNISYS_VISORINPUT
tristate "Unisys visorinput driver"
depends on UNISYSSPAR && UNISYS_VISORBUS && FB
---help---
-   If you say Y here, you will enable the Unisys visorinput driver.
+   The Unisys s-Par visorinput driver provides a virtualized system
+   console (keyboard and mouse) that is accessible through the
+   s-Par firmware's user interface. s-Par provides video using the EFI
+   GOP protocol, so If this driver is not present, the Linux guest should
+   still boot with visible output in the partition desktop, but keyboard
+   and mouse interaction will not be available.
 
-- 
2.5.0

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


Re: [PATCH 1/4] staging: rtl8712: Remove casts between void * and type *

2015-11-24 Thread Mauro Dreissig
On 24-11-2015 11:07, Dan Carpenter wrote:
> On Tue, Nov 24, 2015 at 10:19:39AM -0200, Mauro Dreissig wrote:
>> Cleaning rtl871x_ioctl_rtl.c.
>>
> 
> It's better if you think about the header and the body as two different
> things.  Just repeat the title but with more information.
> 
> regards,
> dan carpenter
> 

Will fix that, thanks!
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


RE: [PATCH net-next 08/10] hv_netvsc: Don't ask for additional head room in the skb

2015-11-24 Thread KY Srinivasan


> -Original Message-
> From: Vitaly Kuznetsov [mailto:vkuzn...@redhat.com]
> Sent: Tuesday, November 24, 2015 12:56 AM
> To: KY Srinivasan 
> Cc: da...@davemloft.net; net...@vger.kernel.org; linux-
> ker...@vger.kernel.org; de...@linuxdriverproject.org; o...@aepfle.de;
> a...@canonical.com; jasow...@redhat.com
> Subject: Re: [PATCH net-next 08/10] hv_netvsc: Don't ask for additional head
> room in the skb
> 
> "K. Y. Srinivasan"  writes:
> 
> > The rndis header is 116 bytes big and can be placed in the default
> > head room that will be available in the skb.
> 
> We have the following in include/linux/netdevice.h:
> 
> #if defined(CONFIG_WLAN) || IS_ENABLED(CONFIG_AX25)
> # if defined(CONFIG_MAC80211_MESH)
> #  define LL_MAX_HEADER 128
> # else
> #  define LL_MAX_HEADER 96
> # endif
> #else
> # define LL_MAX_HEADER 32
> #endif
> 
> In case someone disables MAC80211_MESH in his kernel config we're in
> troubles again. I suggest we add additional patch here making sure it is
> 128 bytes for Hyper-V:
> 
> #if defined(CONFIG_HYPERV_NET)
> # define LL_MAX_HEADER 128
> #elseif defined(CONFIG_WLAN) || IS_ENABLED(CONFIG_AX25)
> ...

Thanks Vitaly; will do.

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


RE: [PATCH net-next 01/10] hv_netvsc: Resize some of the variables in hv_netvsc_packet

2015-11-24 Thread KY Srinivasan


> -Original Message-
> From: Vitaly Kuznetsov [mailto:vkuzn...@redhat.com]
> Sent: Tuesday, November 24, 2015 12:48 AM
> To: KY Srinivasan 
> Cc: da...@davemloft.net; net...@vger.kernel.org; linux-
> ker...@vger.kernel.org; de...@linuxdriverproject.org; o...@aepfle.de;
> a...@canonical.com; jasow...@redhat.com
> Subject: Re: [PATCH net-next 01/10] hv_netvsc: Resize some of the variables
> in hv_netvsc_packet
> 
> "K. Y. Srinivasan"  writes:
> 
> > As part of reducing the size of the hv_netvsc_packet, resize some of the
> > variables based on their usage.
> >
> > Signed-off-by: K. Y. Srinivasan 
> > Reviewed-by: Haiyang Zhang 
> > ---
> >  drivers/net/hyperv/hyperv_net.h |   14 +++---
> >  1 files changed, 7 insertions(+), 7 deletions(-)
> >
> > diff --git a/drivers/net/hyperv/hyperv_net.h
> b/drivers/net/hyperv/hyperv_net.h
> > index 5fa98f5..972e562 100644
> > --- a/drivers/net/hyperv/hyperv_net.h
> > +++ b/drivers/net/hyperv/hyperv_net.h
> > @@ -127,11 +127,11 @@ struct ndis_tcp_ip_checksum_info;
> >   */
> >  struct hv_netvsc_packet {
> > /* Bookkeeping stuff */
> > -   u32 status;
> > +   u8 status;
> >
> > -   bool is_data_pkt;
> > -   bool xmit_more; /* from skb */
> > -   bool cp_partial; /* partial copy into send buffer */
> > +   u8 is_data_pkt;
> > +   u8 xmit_more; /* from skb */
> > +   u8 cp_partial; /* partial copy into send buffer */
> 
> These are flags so we can make them bitfields and save even more space.

I am not done with restructuring this structure yet. Once I get this to the 
bare minimum
I will look at using bitfields. 

K. Y
> 
> >
> > u16 vlan_tci;
> >
> > @@ -147,13 +147,13 @@ struct hv_netvsc_packet {
> > /* This points to the memory after page_buf */
> > struct rndis_message *rndis_msg;
> >
> > -   u32 rmsg_size; /* RNDIS header and PPI size */
> > -   u32 rmsg_pgcnt; /* page count of RNDIS header and PPI */
> > +   u8 rmsg_size; /* RNDIS header and PPI size */
> > +   u8 rmsg_pgcnt; /* page count of RNDIS header and PPI */
> >
> > u32 total_data_buflen;
> > /* Points to the send/receive buffer where the ethernet frame is */
> > void *data;
> > -   u32 page_buf_cnt;
> > +   u8 page_buf_cnt;
> > struct hv_page_buffer *page_buf;
> >  };
> 
> --
>   Vitaly
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


RE: [PATCH net-next 08/10] hv_netvsc: Don't ask for additional head room in the skb

2015-11-24 Thread KY Srinivasan


> -Original Message-
> From: Florian Westphal [mailto:f...@strlen.de]
> Sent: Tuesday, November 24, 2015 12:56 AM
> To: KY Srinivasan 
> Cc: da...@davemloft.net; net...@vger.kernel.org; linux-
> ker...@vger.kernel.org; de...@linuxdriverproject.org; o...@aepfle.de;
> a...@canonical.com; jasow...@redhat.com
> Subject: Re: [PATCH net-next 08/10] hv_netvsc: Don't ask for additional head
> room in the skb
> 
> K. Y. Srinivasan  wrote:
> > The rndis header is 116 bytes big and can be placed in the default
> > head room that will be available in the skb. Since the netvsc packet
> > is less than 48 bytes, we can use the skb control buffer
> > for the netvsc packet. With these changes we don't need to
> > ask for additional head room.
> 
> Minor nit: could you add a BUILD_BUG_ON test for this?  Something like
> 
> BUILD_BUG_ON(sizeof(struct hv_netvsc_packet) > FIELD_SIZEOF(struct
> sk_buff, cb));

Good point; will add this check.

Thanks,

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


[PATCH] staging: olpc_dcon: Added a space

2015-11-24 Thread Anjali Menon
Added a space around '/' to remove the check detected by
the checkpatch.pl.

CHECK: spaces preferred around that '/' (ctx:VxV)

Signed-off-by: Anjali Menon 
---
 drivers/staging/olpc_dcon/olpc_dcon.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/olpc_dcon/olpc_dcon.c 
b/drivers/staging/olpc_dcon/olpc_dcon.c
index f45b2ef..28af9f6 100644
--- a/drivers/staging/olpc_dcon/olpc_dcon.c
+++ b/drivers/staging/olpc_dcon/olpc_dcon.c
@@ -336,7 +336,7 @@ static void dcon_source_switch(struct work_struct *work)
pdata->set_dconload(0);
dcon->load_time = ktime_get();
 
-   wait_event_timeout(dcon->waitq, dcon->switched, HZ/2);
+   wait_event_timeout(dcon->waitq, dcon->switched, HZ / 2);
 
if (!dcon->switched) {
pr_err("Timeout entering DCON mode; expect a screen 
glitch.\n");
-- 
1.9.1

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


[PATCH] staging: dgnc: dgnc_cls.c: Replaced udelay by usleep_range

2015-11-24 Thread Jitendra Kumar Khasdev
This patch is to file dgnc_cls.c that fixes up udelay function by
usleep_range.
It is safe to use according to the following documentation
Documentation/timers/timers-howto.txt. So that is why I have given
an appropriate time range.

Signed-off-by: Jitendra Kumar Khasdev 
---
 drivers/staging/dgnc/dgnc_cls.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/dgnc/dgnc_cls.c b/drivers/staging/dgnc/dgnc_cls.c
index 75040da..72f0aaa 100644
--- a/drivers/staging/dgnc/dgnc_cls.c
+++ b/drivers/staging/dgnc/dgnc_cls.c
@@ -934,7 +934,7 @@ static void cls_flush_uart_write(struct channel_t *ch)
 
writeb((UART_FCR_ENABLE_FIFO | UART_FCR_CLEAR_XMIT),
   &ch->ch_cls_uart->isr_fcr);
-   udelay(10);
+   usleep_range(10, 20);
 
ch->ch_flags |= (CH_TX_FIFO_EMPTY | CH_TX_FIFO_LWM);
 }
-- 
1.9.1

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


[PATCH RESEND v3 02/11] fsl-mc: msi: Added FSL-MC-specific member to the msi_desc's union

2015-11-24 Thread J. German Rivera
FSL-MC is a bus type different from PCI and platform, so it needs
its own member in the msi_desc's union.

Signed-off-by: J. German Rivera 
---
CHANGE HISTORY

Changes in v3: none

Changes in v2:
- Addressed comment from Jiang Liu
  * Added a dedicated structure for FSL-MC in struct msi_desc

 include/linux/msi.h | 9 +
 1 file changed, 9 insertions(+)

diff --git a/include/linux/msi.h b/include/linux/msi.h
index f71a25e..152e51a 100644
--- a/include/linux/msi.h
+++ b/include/linux/msi.h
@@ -33,6 +33,14 @@ struct platform_msi_desc {
 };

 /**
+ * fsl_mc_msi_desc - FSL-MC device specific msi descriptor data
+ * @msi_index: The index of the MSI descriptor
+ */
+struct fsl_mc_msi_desc {
+   u16 msi_index;
+};
+
+/**
  * struct msi_desc - Descriptor structure for MSI based interrupts
  * @list:  List head for management
  * @irq:   The base interrupt number
@@ -87,6 +95,7 @@ struct msi_desc {
 * tree wide cleanup.
 */
struct platform_msi_desc platform;
+   struct fsl_mc_msi_desc fsl_mc;
};
 };

--
2.3.3

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


[PATCH RESEND v3 05/11] staging: fsl-mc: Extended MC bus allocator to include IRQs

2015-11-24 Thread J. German Rivera
All the IRQs for DPAA2 objects in the same DPRC must use
the ICID of that DPRC, as their device Id in the GIC-ITS.
Thus, all these IRQs must share the same ITT table in the GIC.
As a result, a pool of IRQs with the same device Id must be
preallocated per DPRC (fsl-mc bus instance). So, the fsl-mc
bus object allocator is extended to also provide services
to allocate IRQs to DPAA2 devices, from their parent fsl-mc bus
IRQ pool.

Signed-off-by: J. German Rivera 
---
CHANGE HISTORY

Changes in v3: none

Changes in v2: none

 drivers/staging/fsl-mc/bus/mc-allocator.c   | 199 
 drivers/staging/fsl-mc/include/mc-private.h |  15 +++
 drivers/staging/fsl-mc/include/mc.h |   9 ++
 3 files changed, 223 insertions(+)

diff --git a/drivers/staging/fsl-mc/bus/mc-allocator.c 
b/drivers/staging/fsl-mc/bus/mc-allocator.c
index 88d1857..c5fa628 100644
--- a/drivers/staging/fsl-mc/bus/mc-allocator.c
+++ b/drivers/staging/fsl-mc/bus/mc-allocator.c
@@ -15,6 +15,7 @@
 #include "../include/dpcon-cmd.h"
 #include "dpmcp-cmd.h"
 #include "dpmcp.h"
+#include 

 /**
  * fsl_mc_resource_pool_add_device - add allocatable device to a resource
@@ -160,6 +161,7 @@ static const char *const fsl_mc_pool_type_strings[] = {
[FSL_MC_POOL_DPMCP] = "dpmcp",
[FSL_MC_POOL_DPBP] = "dpbp",
[FSL_MC_POOL_DPCON] = "dpcon",
+   [FSL_MC_POOL_IRQ] = "irq",
 };

 static int __must_check object_type_to_pool_type(const char *object_type,
@@ -465,6 +467,203 @@ void fsl_mc_object_free(struct fsl_mc_device *mc_adev)
 }
 EXPORT_SYMBOL_GPL(fsl_mc_object_free);

+/*
+ * Initialize the interrupt pool associated with a MC bus.
+ * It allocates a block of IRQs from the GIC-ITS
+ */
+int fsl_mc_populate_irq_pool(struct fsl_mc_bus *mc_bus,
+unsigned int irq_count)
+{
+   unsigned int i;
+   struct msi_desc *msi_desc;
+   struct fsl_mc_device_irq *irq_resources;
+   struct fsl_mc_device_irq *mc_dev_irq;
+   int error;
+   struct fsl_mc_device *mc_bus_dev = &mc_bus->mc_dev;
+   struct fsl_mc_resource_pool *res_pool =
+   &mc_bus->resource_pools[FSL_MC_POOL_IRQ];
+
+   if (WARN_ON(irq_count == 0 ||
+   irq_count > FSL_MC_IRQ_POOL_MAX_TOTAL_IRQS))
+   return -EINVAL;
+
+   error = fsl_mc_msi_domain_alloc_irqs(&mc_bus_dev->dev, irq_count);
+   if (error < 0)
+   return error;
+
+   irq_resources = devm_kzalloc(&mc_bus_dev->dev,
+sizeof(*irq_resources) * irq_count,
+GFP_KERNEL);
+   if (!irq_resources) {
+   error = -ENOMEM;
+   goto cleanup_msi_irqs;
+   }
+
+   for (i = 0; i < irq_count; i++) {
+   mc_dev_irq = &irq_resources[i];
+
+   /*
+* NOTE: This mc_dev_irq's MSI addr/value pair will be set
+* by the fsl_mc_msi_write_msg() callback
+*/
+   mc_dev_irq->resource.type = res_pool->type;
+   mc_dev_irq->resource.data = mc_dev_irq;
+   mc_dev_irq->resource.parent_pool = res_pool;
+   INIT_LIST_HEAD(&mc_dev_irq->resource.node);
+   list_add_tail(&mc_dev_irq->resource.node, &res_pool->free_list);
+   }
+
+   for_each_msi_entry(msi_desc, &mc_bus_dev->dev) {
+   mc_dev_irq = &irq_resources[msi_desc->fsl_mc.msi_index];
+   mc_dev_irq->msi_desc = msi_desc;
+   mc_dev_irq->resource.id = msi_desc->irq;
+   }
+
+   res_pool->max_count = irq_count;
+   res_pool->free_count = irq_count;
+   mc_bus->irq_resources = irq_resources;
+   return 0;
+
+cleanup_msi_irqs:
+   fsl_mc_msi_domain_free_irqs(&mc_bus_dev->dev);
+   return error;
+}
+EXPORT_SYMBOL_GPL(fsl_mc_populate_irq_pool);
+
+/**
+ * Teardown the interrupt pool associated with an MC bus.
+ * It frees the IRQs that were allocated to the pool, back to the GIC-ITS.
+ */
+void fsl_mc_cleanup_irq_pool(struct fsl_mc_bus *mc_bus)
+{
+   struct fsl_mc_device *mc_bus_dev = &mc_bus->mc_dev;
+   struct fsl_mc_resource_pool *res_pool =
+   &mc_bus->resource_pools[FSL_MC_POOL_IRQ];
+
+   if (WARN_ON(!mc_bus->irq_resources))
+   return;
+
+   if (WARN_ON(res_pool->max_count == 0))
+   return;
+
+   if (WARN_ON(res_pool->free_count != res_pool->max_count))
+   return;
+
+   INIT_LIST_HEAD(&res_pool->free_list);
+   res_pool->max_count = 0;
+   res_pool->free_count = 0;
+   mc_bus->irq_resources = NULL;
+   fsl_mc_msi_domain_free_irqs(&mc_bus_dev->dev);
+}
+EXPORT_SYMBOL_GPL(fsl_mc_cleanup_irq_pool);
+
+/**
+ * It allocates the IRQs required by a given MC object device. The
+ * IRQs are allocated from the interrupt pool associated with the
+ * MC bus that contains the device, if the device is not a DPRC device.
+ * Otherwise, the IRQs are allocated fr

[PATCH RESEND v3 09/11] staging: fsl-mc: Fixed bug in dprc_probe() error path

2015-11-24 Thread J. German Rivera
Destroy mc_io in error path in dprc_probe() only if the mc_io was
created in this function.

Signed-off-by: J. German Rivera 
---
CHANGE HISTORY

Changes in v3: none

Changes in v2:
- Addressed comment from Dan Carpenter:
  * Renamed goto error labels to indicate what the goto does

 drivers/staging/fsl-mc/bus/dprc-driver.c | 17 ++---
 1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/fsl-mc/bus/dprc-driver.c 
b/drivers/staging/fsl-mc/bus/dprc-driver.c
index 6d83035..cfbd779 100644
--- a/drivers/staging/fsl-mc/bus/dprc-driver.c
+++ b/drivers/staging/fsl-mc/bus/dprc-driver.c
@@ -401,6 +401,7 @@ static int dprc_probe(struct fsl_mc_device *mc_dev)
size_t region_size;
struct device *parent_dev = mc_dev->dev.parent;
struct fsl_mc_bus *mc_bus = to_fsl_mc_bus(mc_dev);
+   bool mc_io_created = false;
bool msi_domain_set = false;

if (WARN_ON(strcmp(mc_dev->obj_desc.type, "dprc") != 0))
@@ -413,6 +414,9 @@ static int dprc_probe(struct fsl_mc_device *mc_dev)
/*
 * This is a child DPRC:
 */
+   if (WARN_ON(parent_dev->bus != &fsl_mc_bus_type))
+   return -EINVAL;
+
if (WARN_ON(mc_dev->obj_desc.region_count == 0))
return -EINVAL;

@@ -427,6 +431,9 @@ static int dprc_probe(struct fsl_mc_device *mc_dev)
 &mc_dev->mc_io);
if (error < 0)
return error;
+
+   mc_io_created = true;
+
/*
 * Inherit parent MSI domain:
 */
@@ -457,7 +464,7 @@ static int dprc_probe(struct fsl_mc_device *mc_dev)
  &mc_dev->mc_handle);
if (error < 0) {
dev_err(&mc_dev->dev, "dprc_open() failed: %d\n", error);
-   goto error_cleanup_mc_io;
+   goto error_cleanup_msi_domain;
}

mutex_init(&mc_bus->scan_mutex);
@@ -475,11 +482,15 @@ static int dprc_probe(struct fsl_mc_device *mc_dev)
 error_cleanup_open:
(void)dprc_close(mc_dev->mc_io, 0, mc_dev->mc_handle);

-error_cleanup_mc_io:
+error_cleanup_msi_domain:
if (msi_domain_set)
dev_set_msi_domain(&mc_dev->dev, NULL);

-   fsl_destroy_mc_io(mc_dev->mc_io);
+   if (mc_io_created) {
+   fsl_destroy_mc_io(mc_dev->mc_io);
+   mc_dev->mc_io = NULL;
+   }
+
return error;
 }

--
2.3.3

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


[PATCH RESEND v3 03/11] staging: fsl-mc: Added generic MSI support for FSL-MC devices

2015-11-24 Thread J. German Rivera
Created an MSI domain for the fsl-mc bus-- including functions
to create a domain, find a domain, alloc/free domain irqs, and
bus specific overrides for domain and irq_chip ops.

Signed-off-by: J. German Rivera 
---
CHANGE HISTORY

Changes in v3:
- Addressed comments from Marc Zyngier:
  * Added WARN_ON in fsl_mc_msi_set_desc to check that caller does
not set set_desc
  * Changed type of paddr in irq_cfg to be phys_addr_t
  * Added WARN_ON in fsl_mc_msi_update_chip_op() to check that caller
does not set irq_write_msi_msg

Changes in v2: none

 drivers/staging/fsl-mc/bus/Kconfig  |   1 +
 drivers/staging/fsl-mc/bus/Makefile |   1 +
 drivers/staging/fsl-mc/bus/mc-msi.c | 285 
 drivers/staging/fsl-mc/include/dprc.h   |   2 +-
 drivers/staging/fsl-mc/include/mc-private.h |  17 ++
 drivers/staging/fsl-mc/include/mc.h |  17 ++
 6 files changed, 322 insertions(+), 1 deletion(-)
 create mode 100644 drivers/staging/fsl-mc/bus/mc-msi.c

diff --git a/drivers/staging/fsl-mc/bus/Kconfig 
b/drivers/staging/fsl-mc/bus/Kconfig
index 0d779d9..c498ac6 100644
--- a/drivers/staging/fsl-mc/bus/Kconfig
+++ b/drivers/staging/fsl-mc/bus/Kconfig
@@ -9,6 +9,7 @@
 config FSL_MC_BUS
tristate "Freescale Management Complex (MC) bus driver"
depends on OF && ARM64
+   select GENERIC_MSI_IRQ_DOMAIN
help
  Driver to enable the bus infrastructure for the Freescale
   QorIQ Management Complex (fsl-mc). The fsl-mc is a hardware
diff --git a/drivers/staging/fsl-mc/bus/Makefile 
b/drivers/staging/fsl-mc/bus/Makefile
index 25433a9..a5f2ba4 100644
--- a/drivers/staging/fsl-mc/bus/Makefile
+++ b/drivers/staging/fsl-mc/bus/Makefile
@@ -13,5 +13,6 @@ mc-bus-driver-objs := mc-bus.o \
  dpmng.o \
  dprc-driver.o \
  mc-allocator.o \
+ mc-msi.o \
  dpmcp.o \
  dpbp.o
diff --git a/drivers/staging/fsl-mc/bus/mc-msi.c 
b/drivers/staging/fsl-mc/bus/mc-msi.c
new file mode 100644
index 000..d6ac465
--- /dev/null
+++ b/drivers/staging/fsl-mc/bus/mc-msi.c
@@ -0,0 +1,285 @@
+/*
+ * Freescale Management Complex (MC) bus driver MSI support
+ *
+ * Copyright (C) 2015 Freescale Semiconductor, Inc.
+ * Author: German Rivera 
+ *
+ * This file is licensed under the terms of the GNU General Public
+ * License version 2. This program is licensed "as is" without any
+ * warranty of any kind, whether express or implied.
+ */
+
+#include "../include/mc-private.h"
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include "../include/mc-sys.h"
+#include "dprc-cmd.h"
+
+static void fsl_mc_msi_set_desc(msi_alloc_info_t *arg,
+   struct msi_desc *desc)
+{
+   arg->desc = desc;
+   arg->hwirq = (irq_hw_number_t)desc->fsl_mc.msi_index;
+}
+
+static void fsl_mc_msi_update_dom_ops(struct msi_domain_info *info)
+{
+   struct msi_domain_ops *ops = info->ops;
+
+   if (WARN_ON(!ops))
+   return;
+
+   /*
+* set_desc should not be set by the caller
+*/
+   if (WARN_ON(ops->set_desc))
+   return;
+
+   ops->set_desc = fsl_mc_msi_set_desc;
+}
+
+static void __fsl_mc_msi_write_msg(struct fsl_mc_device *mc_bus_dev,
+  struct fsl_mc_device_irq *mc_dev_irq)
+{
+   int error;
+   struct fsl_mc_device *owner_mc_dev = mc_dev_irq->mc_dev;
+   struct msi_desc *msi_desc = mc_dev_irq->msi_desc;
+   struct dprc_irq_cfg irq_cfg;
+
+   /*
+* msi_desc->msg.address is 0x0 when this function is invoked in
+* the free_irq() code path. In this case, for the MC, we don't
+* really need to "unprogram" the MSI, so we just return.
+*/
+   if (msi_desc->msg.address_lo == 0x0 && msi_desc->msg.address_hi == 0x0)
+   return;
+
+   if (WARN_ON(!owner_mc_dev))
+   return;
+
+   irq_cfg.paddr = ((u64)msi_desc->msg.address_hi << 32) |
+   msi_desc->msg.address_lo;
+   irq_cfg.val = msi_desc->msg.data;
+   irq_cfg.user_irq_id = msi_desc->irq;
+
+   if (owner_mc_dev == mc_bus_dev) {
+   /*
+* IRQ is for the mc_bus_dev's DPRC itself
+*/
+   error = dprc_set_irq(mc_bus_dev->mc_io,
+MC_CMD_FLAG_INTR_DIS | MC_CMD_FLAG_PRI,
+mc_bus_dev->mc_handle,
+mc_dev_irq->dev_irq_index,
+&irq_cfg);
+   if (error < 0) {
+   dev_err(&owner_mc_dev->dev,
+   "dprc_set_irq() failed: %d\n", error);
+   }
+   } else {
+   /*
+* IRQ is for for a child device of mc_bus_dev
+*/
+   error = dprc_set_obj_irq(mc_bus_dev->mc_io

[PATCH RESEND v3 06/11] staging: fsl-mc: Changed DPRC built-in portal's mc_io to be atomic

2015-11-24 Thread J. German Rivera
The DPRC built-in portal's mc_io is used to send commands to the MC
to program MSIs for MC objects. This is done by the
fsl_mc_msi_write_msg() callback, which is invoked by the generic MSI
layer with interrupts disabled. As a result, the mc_io used in
fsl_mc_msi_write_msg needs to be an atomic mc_io.

Signed-off-by: J. German Rivera 
---
CHANGE HISTORY

Changes in v3: none

Changes in v2: none

 drivers/staging/fsl-mc/bus/dprc-driver.c | 4 +++-
 drivers/staging/fsl-mc/bus/mc-bus.c  | 3 ++-
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/fsl-mc/bus/dprc-driver.c 
b/drivers/staging/fsl-mc/bus/dprc-driver.c
index 2c4cd70..767d437 100644
--- a/drivers/staging/fsl-mc/bus/dprc-driver.c
+++ b/drivers/staging/fsl-mc/bus/dprc-driver.c
@@ -396,7 +396,9 @@ static int dprc_probe(struct fsl_mc_device *mc_dev)
error = fsl_create_mc_io(&mc_dev->dev,
 mc_dev->regions[0].start,
 region_size,
-NULL, 0, &mc_dev->mc_io);
+NULL,
+FSL_MC_IO_ATOMIC_CONTEXT_PORTAL,
+&mc_dev->mc_io);
if (error < 0)
return error;
}
diff --git a/drivers/staging/fsl-mc/bus/mc-bus.c 
b/drivers/staging/fsl-mc/bus/mc-bus.c
index 84db55b..d34f1af 100644
--- a/drivers/staging/fsl-mc/bus/mc-bus.c
+++ b/drivers/staging/fsl-mc/bus/mc-bus.c
@@ -702,7 +702,8 @@ static int fsl_mc_bus_probe(struct platform_device *pdev)
mc_portal_phys_addr = res.start;
mc_portal_size = resource_size(&res);
error = fsl_create_mc_io(&pdev->dev, mc_portal_phys_addr,
-mc_portal_size, NULL, 0, &mc_io);
+mc_portal_size, NULL,
+FSL_MC_IO_ATOMIC_CONTEXT_PORTAL, &mc_io);
if (error < 0)
return error;

--
2.3.3

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


[PATCH RESEND v3 00/11] staging: fsl-mc: MC bus MSI support

2015-11-24 Thread J. German Rivera
*** This is a resend of the last iteration of this patch series ***

This patch series addresses the following item from the TODO list
for the MC bus driver to exit staging:

* Interrupt support. For meaningful driver support we need
  interrupts, and thus need message interrupt support by the bus
  driver.

MC Bus MSI Support Architecture
===
A new IRQ domain bus token is added for the FSL-MC bus.
An MSI IRQ domain is created for each top-level (root) data-path
resource container (DPRC), based on its msi-parent in the device
tree (which is the GIC-ITS). Child DPRCs inherit the MSI IRQ
domain form their parent DPRC.

MC Bus MSI Allocation
-
Given the way in which the GIC-ITS works, we need to pre-allocate
a block of MSIs in the GIC-ITS for the IRQs of all the DPAA2 objects
in the same data-path resource container (DPRC) and for the IRQ of
the DPRC iself.

This is due to the fact that all the IRQs for DPAA2 objects in the
same DPRC (and the DPRC's own IRQ) must use the same "device Id" in
the GIC-ITS. Thus, all these IRQs must share the same ITT table in
the GIC-ITS, and therefore must be allocated in the GIC-ITS as
a block of MSIs for the same "device Id".

This is because all the DPAA2 objects in the same DPRC (and the
DPRC itself) use the DPRC's SMMU stream ID as their device Id for
the GIC-ITS.
The DPAA2 Management Complex (MC) firmware does not assign a separate
SMMU stream ID to each DPAA2 object. The MC only assigns SMMU stream
IDs to DPRCs. In MC terms, the stream ID assigned to a DPRC is known
as the DPRC's Isolation Context ID (ICID).

As a consequence of having to pre-allocate a block of MSIs in
the GIC-ITS, the object allocator of the MC bus driver needs to be
extended to provide IRQ allocation services to DPAA2 device drivers
and to the DPRC driver. For a given DPAA2 object, MSIs are allocated
from the corresponding DPRC's pool of pre-allocated MSIs. The MSI
for the DPRC itself is also allocated from this pool.

The following are the patches in this series:

Patch 1: Added domain bus token DOMAIN_BUS_FSL_MC_MSI
Patch 2: Added Added FSL-MC-specific member to the msi_desc's union
Patch 3: Added generic MSI support for FSL-MC devices
Patch 4: Added GICv3-ITS support for FSL-MC MSIs
Patch 5: Extended MC bus allocator to include IRQs
Patch 6: Changed DPRC built-in portal's mc_io to be atomic
Patch 7: Populate the IRQ pool for an MC bus instance
Patch 8: Set MSI domain for DPRC objects
Patch 9: Fixed bug in dprc_probe() error path
Patch 10: Added DPRC interrupt handler
Patch 11: Added MSI support to the MC bus driver

CHANGE HISTORY

Changes in v3:
- Addressed comments from Marc Zyngier for patch 3.
  See details in patch 3.

Changes in v2:
- Addressed comment from Jiang Liu in patch 2
  See details in patch 2.
- Addressed comment from Dan Carpenter in patch 9
  See details in patch 9.

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


[PATCH RESEND v3 08/11] staging: fsl-mc: set MSI domain for DPRC objects

2015-11-24 Thread J. German Rivera
THE MSI domain associated with a root DPRC object is
obtained form the device tree. Child DPRCs inherit
the parent DPRC MSI domain.

Signed-off-by: J. German Rivera 
---
CHANGE HISTORY

Changes in v3: none

Changes in v2: none

 drivers/staging/fsl-mc/bus/dprc-driver.c | 39 
 1 file changed, 39 insertions(+)

diff --git a/drivers/staging/fsl-mc/bus/dprc-driver.c 
b/drivers/staging/fsl-mc/bus/dprc-driver.c
index ef1bb93..6d83035 100644
--- a/drivers/staging/fsl-mc/bus/dprc-driver.c
+++ b/drivers/staging/fsl-mc/bus/dprc-driver.c
@@ -13,6 +13,7 @@
 #include "../include/mc-sys.h"
 #include 
 #include 
+#include 
 #include "dprc-cmd.h"

 struct dprc_child_objs {
@@ -398,11 +399,16 @@ static int dprc_probe(struct fsl_mc_device *mc_dev)
 {
int error;
size_t region_size;
+   struct device *parent_dev = mc_dev->dev.parent;
struct fsl_mc_bus *mc_bus = to_fsl_mc_bus(mc_dev);
+   bool msi_domain_set = false;

if (WARN_ON(strcmp(mc_dev->obj_desc.type, "dprc") != 0))
return -EINVAL;

+   if (WARN_ON(dev_get_msi_domain(&mc_dev->dev)))
+   return -EINVAL;
+
if (!mc_dev->mc_io) {
/*
 * This is a child DPRC:
@@ -421,6 +427,30 @@ static int dprc_probe(struct fsl_mc_device *mc_dev)
 &mc_dev->mc_io);
if (error < 0)
return error;
+   /*
+* Inherit parent MSI domain:
+*/
+   dev_set_msi_domain(&mc_dev->dev,
+  dev_get_msi_domain(parent_dev));
+   msi_domain_set = true;
+   } else {
+   /*
+* This is a root DPRC
+*/
+   struct irq_domain *mc_msi_domain;
+
+   if (WARN_ON(parent_dev->bus == &fsl_mc_bus_type))
+   return -EINVAL;
+
+   error = fsl_mc_find_msi_domain(parent_dev->of_node,
+  &mc_msi_domain);
+   if (error < 0) {
+   dev_warn(&mc_dev->dev,
+"WARNING: MC bus without interrupt support\n");
+   } else {
+   dev_set_msi_domain(&mc_dev->dev, mc_msi_domain);
+   msi_domain_set = true;
+   }
}

error = dprc_open(mc_dev->mc_io, 0, mc_dev->obj_desc.id,
@@ -446,6 +476,9 @@ error_cleanup_open:
(void)dprc_close(mc_dev->mc_io, 0, mc_dev->mc_handle);

 error_cleanup_mc_io:
+   if (msi_domain_set)
+   dev_set_msi_domain(&mc_dev->dev, NULL);
+
fsl_destroy_mc_io(mc_dev->mc_io);
return error;
 }
@@ -463,6 +496,7 @@ error_cleanup_mc_io:
 static int dprc_remove(struct fsl_mc_device *mc_dev)
 {
int error;
+   struct fsl_mc_bus *mc_bus = to_fsl_mc_bus(mc_dev);

if (WARN_ON(strcmp(mc_dev->obj_desc.type, "dprc") != 0))
return -EINVAL;
@@ -475,6 +509,11 @@ static int dprc_remove(struct fsl_mc_device *mc_dev)
if (error < 0)
dev_err(&mc_dev->dev, "dprc_close() failed: %d\n", error);

+   if (dev_get_msi_domain(&mc_dev->dev)) {
+   fsl_mc_cleanup_irq_pool(mc_bus);
+   dev_set_msi_domain(&mc_dev->dev, NULL);
+   }
+
dev_info(&mc_dev->dev, "DPRC device unbound from driver");
return 0;
 }
--
2.3.3

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


[PATCH RESEND v3 01/11] irqdomain: Added domain bus token DOMAIN_BUS_FSL_MC_MSI

2015-11-24 Thread J. German Rivera
Since an FSL-MC bus is a new bus type that is neither PCI nor
PLATFORM, we need a new domain bus token to disambiguate the
IRQ domain for FSL-MC MSIs.

Signed-off-by: J. German Rivera 
---
CHANGE HISTORY

Changes in v3: none

Changes in v2: none

 include/linux/irqdomain.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/linux/irqdomain.h b/include/linux/irqdomain.h
index d5e5c5b..c0cb5d1 100644
--- a/include/linux/irqdomain.h
+++ b/include/linux/irqdomain.h
@@ -73,6 +73,7 @@ enum irq_domain_bus_token {
DOMAIN_BUS_PCI_MSI,
DOMAIN_BUS_PLATFORM_MSI,
DOMAIN_BUS_NEXUS,
+   DOMAIN_BUS_FSL_MC_MSI,
 };

 /**
--
2.3.3

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


[PATCH RESEND v3 04/11] staging: fsl-mc: Added GICv3-ITS support for FSL-MC MSIs

2015-11-24 Thread J. German Rivera
Added platform-specific MSI support layer for FSL-MC devices.

Signed-off-by: J. German Rivera 
---
CHANGE HISTORY

Changes in v3: none

Changes in v2: none

 drivers/staging/fsl-mc/bus/Makefile|   1 +
 .../staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c | 127 +
 drivers/staging/fsl-mc/include/mc-private.h|   4 +
 3 files changed, 132 insertions(+)
 create mode 100644 drivers/staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c

diff --git a/drivers/staging/fsl-mc/bus/Makefile 
b/drivers/staging/fsl-mc/bus/Makefile
index a5f2ba4..e731517 100644
--- a/drivers/staging/fsl-mc/bus/Makefile
+++ b/drivers/staging/fsl-mc/bus/Makefile
@@ -14,5 +14,6 @@ mc-bus-driver-objs := mc-bus.o \
  dprc-driver.o \
  mc-allocator.o \
  mc-msi.o \
+ irq-gic-v3-its-fsl-mc-msi.o \
  dpmcp.o \
  dpbp.o
diff --git a/drivers/staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c 
b/drivers/staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c
new file mode 100644
index 000..5319afa
--- /dev/null
+++ b/drivers/staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c
@@ -0,0 +1,127 @@
+/*
+ * Freescale Management Complex (MC) bus driver MSI support
+ *
+ * Copyright (C) 2015 Freescale Semiconductor, Inc.
+ * Author: German Rivera 
+ *
+ * This file is licensed under the terms of the GNU General Public
+ * License version 2. This program is licensed "as is" without any
+ * warranty of any kind, whether express or implied.
+ */
+
+#include "../include/mc-private.h"
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include "../include/mc-sys.h"
+#include "dprc-cmd.h"
+
+static struct irq_chip its_msi_irq_chip = {
+   .name = "fsl-mc-bus-msi",
+   .irq_mask = irq_chip_mask_parent,
+   .irq_unmask = irq_chip_unmask_parent,
+   .irq_eoi = irq_chip_eoi_parent,
+   .irq_set_affinity = msi_domain_set_affinity
+};
+
+static int its_fsl_mc_msi_prepare(struct irq_domain *msi_domain,
+ struct device *dev,
+ int nvec, msi_alloc_info_t *info)
+{
+   u32 its_dev_id;
+   struct fsl_mc_device *mc_bus_dev = to_fsl_mc_device(dev);
+   struct msi_domain_info *msi_info;
+
+   if (WARN_ON(dev->bus != &fsl_mc_bus_type))
+   return -EINVAL;
+
+   if (WARN_ON(!(mc_bus_dev->flags & FSL_MC_IS_DPRC)))
+   return -EINVAL;
+
+   /*
+* Set the device Id to be passed to the GIC-ITS:
+*
+* NOTE: This device id corresponds to the IOMMU stream ID
+* associated with the DPRC object (ICID).
+*/
+   its_dev_id = mc_bus_dev->icid;
+   info->scratchpad[0].ul = its_dev_id;
+   msi_info = msi_get_domain_info(msi_domain->parent);
+   return msi_info->ops->msi_prepare(msi_domain->parent, dev, nvec, info);
+}
+
+static struct msi_domain_ops its_fsl_mc_msi_ops = {
+   .msi_prepare = its_fsl_mc_msi_prepare,
+};
+
+static struct msi_domain_info its_fsl_mc_msi_domain_info = {
+   .flags  = (MSI_FLAG_USE_DEF_DOM_OPS | MSI_FLAG_USE_DEF_CHIP_OPS),
+   .ops= &its_fsl_mc_msi_ops,
+   .chip   = &its_msi_irq_chip,
+};
+
+static const struct of_device_id its_device_id[] = {
+   {   .compatible = "arm,gic-v3-its", },
+   {},
+};
+
+int __init its_fsl_mc_msi_init(void)
+{
+   struct device_node *np;
+   struct irq_domain *parent;
+   struct irq_domain *mc_msi_domain;
+
+   for (np = of_find_matching_node(NULL, its_device_id); np;
+np = of_find_matching_node(np, its_device_id)) {
+   if (!of_property_read_bool(np, "msi-controller"))
+   continue;
+
+   parent = irq_find_matching_host(np, DOMAIN_BUS_NEXUS);
+   if (!parent || !msi_get_domain_info(parent)) {
+   pr_err("%s: unable to locate ITS domain\n",
+  np->full_name);
+   continue;
+   }
+
+   mc_msi_domain =
+   fsl_mc_msi_create_irq_domain(of_node_to_fwnode(np),
+&its_fsl_mc_msi_domain_info,
+parent);
+   if (!mc_msi_domain) {
+   pr_err("%s: unable to create fsl-mc domain\n",
+  np->full_name);
+   continue;
+   }
+
+   WARN_ON(mc_msi_domain->host_data !=
+   &its_fsl_mc_msi_domain_info);
+
+   pr_info("fsl-mc MSI: %s domain created\n", np->full_name);
+   }
+
+   return 0;
+}
+
+void its_fsl_mc_msi_cleanup(void)
+{
+   struct device_node *np;
+
+   for (np = of_find_matching_node(NULL, its_device_id); np;
+np = of_find_matching_node(np, its_device_id)) {
+   struct irq_domain *mc_msi_doma

[PATCH RESEND v3 07/11] staging: fsl-mc: Populate the IRQ pool for an MC bus instance

2015-11-24 Thread J. German Rivera
Scan the corresponding DPRC container to get total count
of IRQs needed by all its child DPAA2 objects. Then,
preallocate a set of MSI IRQs with the DPRC's ICID
(GIT-ITS device Id) to populate the the DPRC's IRQ pool.
Each child DPAA2 object in the DPRC and the DPRC object itself
will allocate their necessary MSI IRQs from the DPRC's IRQ pool,
in their driver probe function.

Signed-off-by: J. German Rivera 
---
CHANGE HISTORY

Changes in v3: none

Changes in v2: none

 drivers/staging/fsl-mc/bus/dprc-driver.c| 24 ++--
 drivers/staging/fsl-mc/include/mc-private.h |  3 ++-
 2 files changed, 24 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/fsl-mc/bus/dprc-driver.c 
b/drivers/staging/fsl-mc/bus/dprc-driver.c
index 767d437..ef1bb93 100644
--- a/drivers/staging/fsl-mc/bus/dprc-driver.c
+++ b/drivers/staging/fsl-mc/bus/dprc-driver.c
@@ -241,6 +241,7 @@ static void dprc_cleanup_all_resource_pools(struct 
fsl_mc_device *mc_bus_dev)
  * dprc_scan_objects - Discover objects in a DPRC
  *
  * @mc_bus_dev: pointer to the fsl-mc device that represents a DPRC object
+ * @total_irq_count: total number of IRQs needed by objects in the DPRC.
  *
  * Detects objects added and removed from a DPRC and synchronizes the
  * state of the Linux bus driver, MC by adding and removing
@@ -254,11 +255,13 @@ static void dprc_cleanup_all_resource_pools(struct 
fsl_mc_device *mc_bus_dev)
  * populated before they can get allocation requests from probe callbacks
  * of the device drivers for the non-allocatable devices.
  */
-int dprc_scan_objects(struct fsl_mc_device *mc_bus_dev)
+int dprc_scan_objects(struct fsl_mc_device *mc_bus_dev,
+ unsigned int *total_irq_count)
 {
int num_child_objects;
int dprc_get_obj_failures;
int error;
+   unsigned int irq_count = mc_bus_dev->obj_desc.irq_count;
struct dprc_obj_desc *child_obj_desc_array = NULL;

error = dprc_get_obj_count(mc_bus_dev->mc_io,
@@ -307,6 +310,7 @@ int dprc_scan_objects(struct fsl_mc_device *mc_bus_dev)
continue;
}

+   irq_count += obj_desc->irq_count;
dev_dbg(&mc_bus_dev->dev,
"Discovered object: type %s, id %d\n",
obj_desc->type, obj_desc->id);
@@ -319,6 +323,7 @@ int dprc_scan_objects(struct fsl_mc_device *mc_bus_dev)
}
}

+   *total_irq_count = irq_count;
dprc_remove_devices(mc_bus_dev, child_obj_desc_array,
num_child_objects);

@@ -344,6 +349,7 @@ EXPORT_SYMBOL_GPL(dprc_scan_objects);
 int dprc_scan_container(struct fsl_mc_device *mc_bus_dev)
 {
int error;
+   unsigned int irq_count;
struct fsl_mc_bus *mc_bus = to_fsl_mc_bus(mc_bus_dev);

dprc_init_all_resource_pools(mc_bus_dev);
@@ -352,11 +358,25 @@ int dprc_scan_container(struct fsl_mc_device *mc_bus_dev)
 * Discover objects in the DPRC:
 */
mutex_lock(&mc_bus->scan_mutex);
-   error = dprc_scan_objects(mc_bus_dev);
+   error = dprc_scan_objects(mc_bus_dev, &irq_count);
mutex_unlock(&mc_bus->scan_mutex);
if (error < 0)
goto error;

+   if (dev_get_msi_domain(&mc_bus_dev->dev) && !mc_bus->irq_resources) {
+   if (irq_count > FSL_MC_IRQ_POOL_MAX_TOTAL_IRQS) {
+   dev_warn(&mc_bus_dev->dev,
+"IRQs needed (%u) exceed IRQs preallocated 
(%u)\n",
+irq_count, FSL_MC_IRQ_POOL_MAX_TOTAL_IRQS);
+   }
+
+   error = fsl_mc_populate_irq_pool(
+   mc_bus,
+   FSL_MC_IRQ_POOL_MAX_TOTAL_IRQS);
+   if (error < 0)
+   goto error;
+   }
+
return 0;
 error:
dprc_cleanup_all_resource_pools(mc_bus_dev);
diff --git a/drivers/staging/fsl-mc/include/mc-private.h 
b/drivers/staging/fsl-mc/include/mc-private.h
index e685934..bd514ee 100644
--- a/drivers/staging/fsl-mc/include/mc-private.h
+++ b/drivers/staging/fsl-mc/include/mc-private.h
@@ -114,7 +114,8 @@ void fsl_mc_device_remove(struct fsl_mc_device *mc_dev);

 int dprc_scan_container(struct fsl_mc_device *mc_bus_dev);

-int dprc_scan_objects(struct fsl_mc_device *mc_bus_dev);
+int dprc_scan_objects(struct fsl_mc_device *mc_bus_dev,
+ unsigned int *total_irq_count);

 int __init dprc_driver_init(void);

--
2.3.3

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


[PATCH RESEND v3 11/11] staging: fsl-mc: Added MSI support to the MC bus driver

2015-11-24 Thread J. German Rivera
Initialize/Cleanup ITS-MSI support for the MC bus driver at driver
init/exit time. Associate an MSI domain with each DPAA2 child device.

Signed-off-by: J. German Rivera 
---
CHANGE HISTORY

Changes in v3: none

Changes in v2: none

 drivers/staging/fsl-mc/bus/mc-bus.c | 12 
 1 file changed, 12 insertions(+)

diff --git a/drivers/staging/fsl-mc/bus/mc-bus.c 
b/drivers/staging/fsl-mc/bus/mc-bus.c
index d34f1af..9317561 100644
--- a/drivers/staging/fsl-mc/bus/mc-bus.c
+++ b/drivers/staging/fsl-mc/bus/mc-bus.c
@@ -16,6 +16,8 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 #include "../include/dpmng.h"
 #include "../include/mc-sys.h"
 #include "dprc-cmd.h"
@@ -472,6 +474,8 @@ int fsl_mc_device_add(struct dprc_obj_desc *obj_desc,
mc_dev->icid = parent_mc_dev->icid;
mc_dev->dma_mask = FSL_MC_DEFAULT_DMA_MASK;
mc_dev->dev.dma_mask = &mc_dev->dma_mask;
+   dev_set_msi_domain(&mc_dev->dev,
+  dev_get_msi_domain(&parent_mc_dev->dev));
}

/*
@@ -833,8 +837,15 @@ static int __init fsl_mc_bus_driver_init(void)
if (error < 0)
goto error_cleanup_dprc_driver;

+   error = its_fsl_mc_msi_init();
+   if (error < 0)
+   goto error_cleanup_mc_allocator;
+
return 0;

+error_cleanup_mc_allocator:
+   fsl_mc_allocator_driver_exit();
+
 error_cleanup_dprc_driver:
dprc_driver_exit();

@@ -856,6 +867,7 @@ static void __exit fsl_mc_bus_driver_exit(void)
if (WARN_ON(!mc_dev_cache))
return;

+   its_fsl_mc_msi_cleanup();
fsl_mc_allocator_driver_exit();
dprc_driver_exit();
platform_driver_unregister(&fsl_mc_bus_driver);
--
2.3.3

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


[PATCH RESEND v3 10/11] staging: fsl-mc: Added DPRC interrupt handler

2015-11-24 Thread J. German Rivera
The interrupt handler for DPRC IRQs is added. DPRC IRQs are
generated for hot plug events related to DPAA2 objects in a given
DPRC. These events include, creating/destroying DPAA2 objects in
the DPRC, changing the "plugged" state of DPAA2 objects and moving
objects between DPRCs.

Signed-off-by: J. German Rivera 
---
CHANGE HISTORY

Changes in v3: none

Changes in v2: none

 drivers/staging/fsl-mc/bus/dprc-driver.c | 247 +++
 1 file changed, 247 insertions(+)

diff --git a/drivers/staging/fsl-mc/bus/dprc-driver.c 
b/drivers/staging/fsl-mc/bus/dprc-driver.c
index cfbd779..a9fd1e4 100644
--- a/drivers/staging/fsl-mc/bus/dprc-driver.c
+++ b/drivers/staging/fsl-mc/bus/dprc-driver.c
@@ -14,6 +14,7 @@
 #include 
 #include 
 #include 
+#include 
 #include "dprc-cmd.h"

 struct dprc_child_objs {
@@ -386,6 +387,230 @@ error:
 EXPORT_SYMBOL_GPL(dprc_scan_container);

 /**
+ * dprc_irq0_handler - Regular ISR for DPRC interrupt 0
+ *
+ * @irq: IRQ number of the interrupt being handled
+ * @arg: Pointer to device structure
+ */
+static irqreturn_t dprc_irq0_handler(int irq_num, void *arg)
+{
+   return IRQ_WAKE_THREAD;
+}
+
+/**
+ * dprc_irq0_handler_thread - Handler thread function for DPRC interrupt 0
+ *
+ * @irq: IRQ number of the interrupt being handled
+ * @arg: Pointer to device structure
+ */
+static irqreturn_t dprc_irq0_handler_thread(int irq_num, void *arg)
+{
+   int error;
+   u32 status;
+   struct device *dev = (struct device *)arg;
+   struct fsl_mc_device *mc_dev = to_fsl_mc_device(dev);
+   struct fsl_mc_bus *mc_bus = to_fsl_mc_bus(mc_dev);
+   struct fsl_mc_io *mc_io = mc_dev->mc_io;
+   struct msi_desc *msi_desc = mc_dev->irqs[0]->msi_desc;
+
+   dev_dbg(dev, "DPRC IRQ %d triggered on CPU %u\n",
+   irq_num, smp_processor_id());
+
+   if (WARN_ON(!(mc_dev->flags & FSL_MC_IS_DPRC)))
+   return IRQ_HANDLED;
+
+   mutex_lock(&mc_bus->scan_mutex);
+   if (WARN_ON(!msi_desc || msi_desc->irq != (u32)irq_num))
+   goto out;
+
+   error = dprc_get_irq_status(mc_io, 0, mc_dev->mc_handle, 0,
+   &status);
+   if (error < 0) {
+   dev_err(dev,
+   "dprc_get_irq_status() failed: %d\n", error);
+   goto out;
+   }
+
+   error = dprc_clear_irq_status(mc_io, 0, mc_dev->mc_handle, 0,
+ status);
+   if (error < 0) {
+   dev_err(dev,
+   "dprc_clear_irq_status() failed: %d\n", error);
+   goto out;
+   }
+
+   if (status & (DPRC_IRQ_EVENT_OBJ_ADDED |
+ DPRC_IRQ_EVENT_OBJ_REMOVED |
+ DPRC_IRQ_EVENT_CONTAINER_DESTROYED |
+ DPRC_IRQ_EVENT_OBJ_DESTROYED |
+ DPRC_IRQ_EVENT_OBJ_CREATED)) {
+   unsigned int irq_count;
+
+   error = dprc_scan_objects(mc_dev, &irq_count);
+   if (error < 0) {
+   /*
+* If the error is -ENXIO, we ignore it, as it indicates
+* that the object scan was aborted, as we detected that
+* an object was removed from the DPRC in the MC, while
+* we were scanning the DPRC.
+*/
+   if (error != -ENXIO) {
+   dev_err(dev, "dprc_scan_objects() failed: %d\n",
+   error);
+   }
+
+   goto out;
+   }
+
+   if (irq_count > FSL_MC_IRQ_POOL_MAX_TOTAL_IRQS) {
+   dev_warn(dev,
+"IRQs needed (%u) exceed IRQs preallocated 
(%u)\n",
+irq_count, FSL_MC_IRQ_POOL_MAX_TOTAL_IRQS);
+   }
+   }
+
+out:
+   mutex_unlock(&mc_bus->scan_mutex);
+   return IRQ_HANDLED;
+}
+
+/*
+ * Disable and clear interrupt for a given DPRC object
+ */
+static int disable_dprc_irq(struct fsl_mc_device *mc_dev)
+{
+   int error;
+   struct fsl_mc_io *mc_io = mc_dev->mc_io;
+
+   WARN_ON(mc_dev->obj_desc.irq_count != 1);
+
+   /*
+* Disable generation of interrupt, while we configure it:
+*/
+   error = dprc_set_irq_enable(mc_io, 0, mc_dev->mc_handle, 0, 0);
+   if (error < 0) {
+   dev_err(&mc_dev->dev,
+   "Disabling DPRC IRQ failed: dprc_set_irq_enable() 
failed: %d\n",
+   error);
+   return error;
+   }
+
+   /*
+* Disable all interrupt causes for the interrupt:
+*/
+   error = dprc_set_irq_mask(mc_io, 0, mc_dev->mc_handle, 0, 0x0);
+   if (error < 0) {
+   dev_err(&mc_dev->dev,
+   "Disabling DPRC IRQ failed: dprc_set_irq_mask() failed: 
%d\n",
+   error);
+   

[PATCH 01/10] staging: wilc1000: fix rmmod failure

2015-11-24 Thread Glen Lee
This patch fixes rmmod failure. wilc->firmware needs to be set to NULL because
it is used again to check firmware is released when module exit.

Fixes: 8b8ad7bc90bc ("staging: wilc1000: rename wilc_firmware in the struct 
wilc")
Signed-off-by: Glen Lee 
---
 drivers/staging/wilc1000/linux_wlan.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index 7ccc9b0..92ca072 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -506,6 +506,7 @@ static int wilc1000_firmware_download(struct net_device 
*dev)
PRINT_D(INIT_DBG, "Freeing FW buffer ...\n");
PRINT_D(INIT_DBG, "Releasing firmware\n");
release_firmware(wilc->firmware);
+   wilc->firmware = NULL;
 
PRINT_D(INIT_DBG, "Download Succeeded\n");
 
-- 
1.9.1

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


[PATCH 02/10] staging: wilc1000: wilc_wfi_cfgoperations.c: remove over-commenting

2015-11-24 Thread Glen Lee
From: Leo Kim 

There are over-commenting in the wilc_wfi_cfgoperations.c file and most of them
are not helpful to explain what the code does and generate 80 ending
line over warnings. So, all of comments are removed in this patch and the
comments will later be added if necessary with the preferred Linux style.

Signed-off-by: Leo Kim 
Signed-off-by: Glen Lee 
---
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 681 +-
 1 file changed, 23 insertions(+), 658 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index bcfddbf..bfef022 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -1,20 +1,7 @@
-/*!
- *  @file  wilc_wfi_cfgopertaions.c
- *  @brief CFG80211 Function Implementation functionality
- *  @authoraabouzaeid
- *  mabubakr
- *  mdaftedar
- *  zsalah
- *  @sawilc_wfi_cfgopertaions.h top level OS wrapper file
- *  @date  31 Aug 2010
- *  @version   1.0
- */
-
 #include "wilc_wfi_cfgoperations.h"
 #include "host_interface.h"
 #include 
 
-/* The following macros describe the bitfield map used by the firmware to 
determine its 11i mode */
 #define NO_ENCRYPT 0
 #define ENCRYPT_ENABLEDBIT(0)
 #define WEPBIT(1)
@@ -24,13 +11,11 @@
 #define AESBIT(5)
 #define TKIP   BIT(6)
 
-/*Public action frame index IDs*/
 #define FRAME_TYPE_ID  0
 #define ACTION_CAT_ID  24
 #define ACTION_SUBTYPE_ID  25
 #define P2P_PUB_ACTION_SUBTYPE 30
 
-/*Public action frame Attribute IDs*/
 #define ACTION_FRAME   0xd0
 #define GO_INTENT_ATTR_ID  0x04
 #define CHANLIST_ATTR_ID   0x0b
@@ -38,7 +23,6 @@
 #define PUB_ACTION_ATTR_ID 0x04
 #define P2PELEM_ATTR_ID0xdd
 
-/*Public action subtype values*/
 #define GO_NEG_REQ 0x00
 #define GO_NEG_RSP 0x01
 #define GO_NEG_CONF0x02
@@ -90,7 +74,6 @@ static const struct ieee80211_txrx_stypes
}
 };
 
-/* Time to stay on the channel */
 #define WILC_WFI_DWELL_PASSIVE 100
 #define WILC_WFI_DWELL_ACTIVE  40
 
@@ -123,7 +106,6 @@ u8 wilc_initialized = 1;
.max_power= 30,  \
 }
 
-/*Frequency range for channels*/
 static struct ieee80211_channel ieee80211_2ghz_channels[] = {
CHAN2G(1,  2412, 0),
CHAN2G(2,  2417, 0),
@@ -147,8 +129,6 @@ static struct ieee80211_channel ieee80211_2ghz_channels[] = 
{
.flags= (_flags),   \
 }
 
-
-/* Table 6 in section 3.2.1.1 */
 static struct ieee80211_rate ieee80211_bitrates[] = {
RATETAB_ENT(10,  0,  0),
RATETAB_ENT(20,  1,  0),
@@ -342,7 +322,6 @@ static int is_network_in_shadow(tstrNetworkInfo 
*pstrNetworkInfo,
mod_timer(&hAgingTimer, jiffies + msecs_to_jiffies(AGING_TIME));
state = -1;
} else {
-   /* Linear search for now */
for (i = 0; i < last_scanned_cnt; i++) {
if (memcmp(last_scanned_shadow[i].au8bssid,
   pstrNetworkInfo->au8bssid, 6) == 0) {
@@ -394,7 +373,7 @@ static void add_network_to_shadow(tstrNetworkInfo 
*pstrNetworkInfo,
if (ap_found != -1)
kfree(last_scanned_shadow[ap_index].pu8IEs);
last_scanned_shadow[ap_index].pu8IEs =
-   kmalloc(pstrNetworkInfo->u16IEsLen, GFP_KERNEL);/* will 
be deallocated by the WILC_WFI_CfgScan() function */
+   kmalloc(pstrNetworkInfo->u16IEsLen, GFP_KERNEL);
memcpy(last_scanned_shadow[ap_index].pu8IEs,
   pstrNetworkInfo->pu8IEs, pstrNetworkInfo->u16IEsLen);
last_scanned_shadow[ap_index].u32TimeRcvdInScan = jiffies;
@@ -405,20 +384,6 @@ static void add_network_to_shadow(tstrNetworkInfo 
*pstrNetworkInfo,
last_scanned_shadow[ap_index].pJoinParams = pJoinParams;
 }
 
-
-/**
- *  @brief  CfgScanResult
- *  @details  Callback function which returns the scan results found
- *
- *  @param[in] tenuScanEvent enuScanEvent: enum, indicating the scan event 
triggered, whether that is
- *SCAN_EVENT_NETWORK_FOUND or SCAN_EVENT_DONE
- *tstrNetworkInfo* pstrNetworkInfo: structure holding 
the scan results information
- *void* pUserVoid: Private structure associated with 
the wireless interface
- *  @return NONE
- *  @authormabubakr
- *  @date
- *  @version   1.0
- */
 static void CfgScanResult(enum scan_event scan_event,
  tstrNetworkInfo *network_info,
  void *user_void,
@@ -457,7 +422,7 @@ static void CfgScanResult(enum scan_event scan_event

[PATCH 06/10] staging: wilc1000: wilc_init(): fixes inconsistent returns

2015-11-24 Thread Glen Lee
From: Leo Kim 

This patch fixes the warning reported by smatch.
 - wilc_init() warn: inconsistent returns 'sem:&hif_drv->sem_cfg_values'

No need to up the sema here since down was not called before get here.

Signed-off-by: Leo Kim 
Signed-off-by: Glen Lee 
---
 drivers/staging/wilc1000/host_interface.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index da4f4c6..3aea6ec 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -3940,7 +3940,6 @@ s32 wilc_init(struct net_device *dev, struct host_if_drv 
**hif_drv_handler)
return result;
 
 _fail_timer_2:
-   up(&hif_drv->sem_cfg_values);
del_timer_sync(&hif_drv->connect_timer);
del_timer_sync(&hif_drv->scan_timer);
kthread_stop(hif_thread_handler);
-- 
1.9.1

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


[PATCH 03/10] staging: wilc1000: fixes blank lines aren't necessary brace

2015-11-24 Thread Glen Lee
From: Leo Kim 

This patch fixes the checks reported by checkpatch.pl
for Blank lines aren't necessary after an open brace '{' and
Blank lines aren't necessary before a close brace '}'.

Signed-off-by: Leo Kim 
Signed-off-by: Glen Lee 
---
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 50 ---
 1 file changed, 50 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index bfef022..71038b1 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -201,7 +201,6 @@ static void clear_shadow_scan(void)
}
last_scanned_cnt = 0;
}
-
 }
 
 static u32 get_rssi_avg(tstrNetworkInfo *network_info)
@@ -250,10 +249,8 @@ static void refresh_scan(void *user_void, u8 all, bool 
direct_scan)
cfg80211_put_bss(wiphy, bss);
}
}
-
}
}
-
 }
 
 static void reset_shadow_found(void)
@@ -347,7 +344,6 @@ static void add_network_to_shadow(tstrNetworkInfo 
*pstrNetworkInfo,
if (ap_found == -1) {
ap_index = last_scanned_cnt;
last_scanned_cnt++;
-
} else {
ap_index = ap_found;
}
@@ -590,9 +586,7 @@ static void CfgConnectResult(enum conn_event 
enuConnDisconnEvent,
cfg80211_disconnected(dev, pstrDisconnectNotifInfo->u16reason, 
pstrDisconnectNotifInfo->ie,
  pstrDisconnectNotifInfo->ie_len, false,
  GFP_KERNEL);
-
}
-
 }
 
 static int set_channel(struct wiphy *wiphy,
@@ -646,14 +640,11 @@ static int scan(struct wiphy *wiphy, struct 
cfg80211_scan_request *request)
PRINT_D(CFG80211_DBG, "Number of SSIDs %d\n", request->n_ssids);
 
if (request->n_ssids >= 1) {
-
-
strHiddenNetwork.pstrHiddenNetworkInfo = 
kmalloc(request->n_ssids * sizeof(struct hidden_network), GFP_KERNEL);
strHiddenNetwork.u8ssidnum = request->n_ssids;
 
 
for (i = 0; i < request->n_ssids; i++) {
-
if (request->ssids[i].ssid != NULL && 
request->ssids[i].ssid_len != 0) {

strHiddenNetwork.pstrHiddenNetworkInfo[i].pu8ssid = 
kmalloc(request->ssids[i].ssid_len, GFP_KERNEL);

memcpy(strHiddenNetwork.pstrHiddenNetworkInfo[i].pu8ssid, 
request->ssids[i].ssid, request->ssids[i].ssid_len);
@@ -675,7 +666,6 @@ static int scan(struct wiphy *wiphy, struct 
cfg80211_scan_request *request)
 (const u8 *)request->ie, 
request->ie_len,
 CfgScanResult, (void *)priv, 
NULL);
}
-
} else {
PRINT_ER("Requested num of scanned channels is greater than the 
max, supported"
 " channels\n");
@@ -835,7 +825,6 @@ static int connect(struct wiphy *wiphy, struct net_device 
*dev,
u8security = ENCRYPT_ENABLED | WPA | AES;
pcgroup_encrypt_val = "WPA_AES";
pccipher_group = "AES";
-
}
pcwpa_version = "WPA_VERSION_1";
 
@@ -845,7 +834,6 @@ static int connect(struct wiphy *wiphy, struct net_device 
*dev,
 
goto done;
}
-
}
 
if ((sme->crypto.wpa_versions & NL80211_WPA_VERSION_1)
@@ -982,7 +970,6 @@ static int add_key(struct wiphy *wiphy, struct net_device 
*netdev, u8 key_index,
case WLAN_CIPHER_SUITE_WEP40:
case WLAN_CIPHER_SUITE_WEP104:
if (priv->wdev->iftype == NL80211_IFTYPE_AP) {
-
priv->WILC_WFI_wep_default = key_index;
priv->WILC_WFI_wep_key_len[key_index] = params->key_len;
memcpy(priv->WILC_WFI_wep_key[key_index], params->key, 
params->key_len);
@@ -1022,12 +1009,10 @@ static int add_key(struct wiphy *wiphy, struct 
net_device *netdev, u8 key_index,
case WLAN_CIPHER_SUITE_TKIP:
case WLAN_CIPHER_SUITE_CCMP:
if (priv->wdev->iftype == NL80211_IFTYPE_AP || 
priv->wdev->iftype == NL80211_IFTYPE_P2P_GO) {
-
if (priv->wilc_gtk[key_index] == NULL) {
priv->wilc_gtk[key_index] = 
kmalloc(sizeof(struct wilc_wfi_key), GFP_KERNEL);
priv->wilc_gtk[key_index]->key = NULL;
priv->wilc_gtk[key_index]->seq = NULL;
-
}
if (priv->wilc_ptk[key_index] == NULL) {
priv->wilc_ptk[key_index] = 
kmalloc(sizeof(struct wilc_wfi_key), GFP_KERNEL);
@@ -

[PATCH 04/10] staging: wilc1000: replace explicit NULL comparisons with !

2015-11-24 Thread Glen Lee
From: Leo Kim 

This patch replace explicit NULL comparison with ! operator to simplify code.
Reported by checkpatch.pl for Comparison to NULL could be written !XXX" or 
"XXX".

Signed-off-by: Leo Kim 
Signed-off-by: Glen Lee 
---
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 31 ---
 1 file changed, 16 insertions(+), 15 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 71038b1..bdc4537 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -463,7 +463,7 @@ static void CfgScanResult(enum scan_event scan_event,
 
down(&(priv->hSemScanReq));
 
-   if (priv->pstrScanReq != NULL) {
+   if (priv->pstrScanReq) {
cfg80211_scan_done(priv->pstrScanReq, false);
priv->u32RcvdChCount = 0;
priv->bCfgScanning = false;
@@ -474,7 +474,7 @@ static void CfgScanResult(enum scan_event scan_event,
down(&(priv->hSemScanReq));
 
PRINT_D(CFG80211_DBG, "Scan Aborted\n");
-   if (priv->pstrScanReq != NULL) {
+   if (priv->pstrScanReq) {
update_scan_time();
refresh_scan(priv, 1, false);
 
@@ -645,7 +645,8 @@ static int scan(struct wiphy *wiphy, struct 
cfg80211_scan_request *request)
 
 
for (i = 0; i < request->n_ssids; i++) {
-   if (request->ssids[i].ssid != NULL && 
request->ssids[i].ssid_len != 0) {
+   if (request->ssids[i].ssid &&
+   request->ssids[i].ssid_len != 0) {

strHiddenNetwork.pstrHiddenNetworkInfo[i].pu8ssid = 
kmalloc(request->ssids[i].ssid_len, GFP_KERNEL);

memcpy(strHiddenNetwork.pstrHiddenNetworkInfo[i].pu8ssid, 
request->ssids[i].ssid, request->ssids[i].ssid_len);

strHiddenNetwork.pstrHiddenNetworkInfo[i].u8ssidlen = 
request->ssids[i].ssid_len;
@@ -716,7 +717,7 @@ static int connect(struct wiphy *wiphy, struct net_device 
*dev,
   sme->ssid,
   sme->ssid_len) == 0) {
PRINT_INFO(CFG80211_DBG, "Network with required SSID is 
found %s\n", sme->ssid);
-   if (sme->bssid == NULL) {
+   if (!sme->bssid) {
PRINT_INFO(CFG80211_DBG, "BSSID is not passed 
from the user\n");
break;
} else {
@@ -1009,12 +1010,12 @@ static int add_key(struct wiphy *wiphy, struct 
net_device *netdev, u8 key_index,
case WLAN_CIPHER_SUITE_TKIP:
case WLAN_CIPHER_SUITE_CCMP:
if (priv->wdev->iftype == NL80211_IFTYPE_AP || 
priv->wdev->iftype == NL80211_IFTYPE_P2P_GO) {
-   if (priv->wilc_gtk[key_index] == NULL) {
+   if (!priv->wilc_gtk[key_index]) {
priv->wilc_gtk[key_index] = 
kmalloc(sizeof(struct wilc_wfi_key), GFP_KERNEL);
priv->wilc_gtk[key_index]->key = NULL;
priv->wilc_gtk[key_index]->seq = NULL;
}
-   if (priv->wilc_ptk[key_index] == NULL) {
+   if (!priv->wilc_ptk[key_index]) {
priv->wilc_ptk[key_index] = 
kmalloc(sizeof(struct wilc_wfi_key), GFP_KERNEL);
priv->wilc_ptk[key_index]->key = NULL;
priv->wilc_ptk[key_index]->seq = NULL;
@@ -1828,12 +1829,12 @@ static int mgmt_tx(struct wiphy *wiphy,
 
if (ieee80211_is_mgmt(mgmt->frame_control)) {
mgmt_tx = kmalloc(sizeof(struct p2p_mgmt_data), GFP_KERNEL);
-   if (mgmt_tx == NULL) {
+   if (!mgmt_tx) {
PRINT_ER("Failed to allocate memory for mgmt_tx 
structure\n");
return -EFAULT;
}
mgmt_tx->buff = kmalloc(buf_len, GFP_KERNEL);
-   if (mgmt_tx->buff == NULL) {
+   if (!mgmt_tx->buff) {
PRINT_ER("Failed to allocate memory for mgmt_tx 
buff\n");
kfree(mgmt_tx);
return -EFAULT;
@@ -2037,11 +2038,11 @@ static int set_power_mgmt(struct wiphy *wiphy, struct 
net_device *dev,
 
PRINT_D(CFG80211_DBG, " Power save Enabled= %d , TimeOut = %d\n", 
enabled, timeout);
 
-   if (wiphy == NULL)
+   if (!wiphy)
return -ENOENT;
 
priv = wiphy_priv(wiphy);
-   if (priv->hWILCWFIDrv == NULL) {
+   if (!priv->hWIL

[PATCH 05/10] staging: wilc1000: fixes potential null dereference 'wid.val'

2015-11-24 Thread Glen Lee
From: Leo Kim 

This patch fixes the error reported by smatch.
 - Handle_ListenStateExpired() error: potential null dereference 'wid.val'
If kmalloc failed, referenced to a NULL pointer.

Signed-off-by: Leo Kim 
Signed-off-by: Glen Lee 
---
 drivers/staging/wilc1000/host_interface.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index aae5a03..da4f4c6 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -2629,8 +2629,10 @@ static u32 Handle_ListenStateExpired(struct host_if_drv 
*hif_drv,
wid.size = 2;
wid.val = kmalloc(wid.size, GFP_KERNEL);
 
-   if (!wid.val)
+   if (!wid.val) {
PRINT_ER("Failed to allocate memory\n");
+   return -ENOMEM;
+   }
 
wid.val[0] = u8remain_on_chan_flag;
wid.val[1] = FALSE_FRMWR_CHANNEL;
-- 
1.9.1

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


[PATCH 08/10] staging: wilc1000: Handle_AddBASession: remove unused function

2015-11-24 Thread Glen Lee
From: Leo Kim 

This patch removes unused a function Handle_AddBASession.
And, removes the relation define.

Signed-off-by: Leo Kim 
Signed-off-by: Glen Lee 
---
 drivers/staging/wilc1000/host_interface.c | 69 ---
 1 file changed, 69 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 8f27227..0b85640 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -43,7 +43,6 @@
 #define HOST_IF_MSG_FLUSH_CONNECT   30
 #define HOST_IF_MSG_GET_STATISTICS  31
 #define HOST_IF_MSG_SET_MULTICAST_FILTER32
-#define HOST_IF_MSG_ADD_BA_SESSION  33
 #define HOST_IF_MSG_DEL_BA_SESSION  34
 #define HOST_IF_MSG_Q_IDLE  35
 #define HOST_IF_MSG_DEL_ALL_STA 36
@@ -2741,70 +2740,6 @@ ERRORHANDLER:
kfree(wid.val);
 }
 
-static s32 Handle_AddBASession(struct host_if_drv *hif_drv,
-  struct ba_session_info *strHostIfBASessionInfo)
-{
-   s32 result = 0;
-   struct wid wid;
-   int AddbaTimeout = 100;
-   char *ptr = NULL;
-
-   PRINT_D(HOSTINF_DBG, "Opening Block Ack session with\nBSSID = 
%.2x:%.2x:%.2x\nTID=%d\nBufferSize == %d\nSessionTimeOut = %d\n",
-   strHostIfBASessionInfo->bssid[0],
-   strHostIfBASessionInfo->bssid[1],
-   strHostIfBASessionInfo->bssid[2],
-   strHostIfBASessionInfo->buf_size,
-   strHostIfBASessionInfo->time_out,
-   strHostIfBASessionInfo->tid);
-
-   wid.id = (u16)WID_11E_P_ACTION_REQ;
-   wid.type = WID_STR;
-   wid.val = kmalloc(BLOCK_ACK_REQ_SIZE, GFP_KERNEL);
-   wid.size = BLOCK_ACK_REQ_SIZE;
-   ptr = wid.val;
-   *ptr++ = 0x14;
-   *ptr++ = 0x3;
-   *ptr++ = 0x0;
-   memcpy(ptr, strHostIfBASessionInfo->bssid, ETH_ALEN);
-   ptr += ETH_ALEN;
-   *ptr++ = strHostIfBASessionInfo->tid;
-   *ptr++ = 1;
-   *ptr++ = (strHostIfBASessionInfo->buf_size & 0xFF);
-   *ptr++ = ((strHostIfBASessionInfo->buf_size >> 16) & 0xFF);
-   *ptr++ = (strHostIfBASessionInfo->time_out & 0xFF);
-   *ptr++ = ((strHostIfBASessionInfo->time_out >> 16) & 0xFF);
-   *ptr++ = (AddbaTimeout & 0xFF);
-   *ptr++ = ((AddbaTimeout >> 16) & 0xFF);
-   *ptr++ = 8;
-   *ptr++ = 0;
-
-   result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, &wid, 1,
-get_id_from_handler(hif_drv));
-   if (result)
-   PRINT_D(HOSTINF_DBG, "Couldn't open BA Session\n");
-
-   wid.id = (u16)WID_11E_P_ACTION_REQ;
-   wid.type = WID_STR;
-   wid.size = 15;
-   ptr = wid.val;
-   *ptr++ = 15;
-   *ptr++ = 7;
-   *ptr++ = 0x2;
-   memcpy(ptr, strHostIfBASessionInfo->bssid, ETH_ALEN);
-   ptr += ETH_ALEN;
-   *ptr++ = strHostIfBASessionInfo->tid;
-   *ptr++ = 8;
-   *ptr++ = (strHostIfBASessionInfo->buf_size & 0xFF);
-   *ptr++ = ((strHostIfBASessionInfo->time_out >> 16) & 0xFF);
-   *ptr++ = 3;
-   result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, &wid, 1,
-get_id_from_handler(hif_drv));
-
-   kfree(wid.val);
-
-   return result;
-}
-
 static s32 Handle_DelAllRxBASessions(struct host_if_drv *hif_drv,
 struct ba_session_info 
*strHostIfBASessionInfo)
 {
@@ -3035,10 +2970,6 @@ static int hostIFthread(void *pvArg)
Handle_SetMulticastFilter(msg.drv, 
&msg.body.multicast_info);
break;
 
-   case HOST_IF_MSG_ADD_BA_SESSION:
-   Handle_AddBASession(msg.drv, &msg.body.session_info);
-   break;
-
case HOST_IF_MSG_DEL_ALL_RX_BA_SESSIONS:
Handle_DelAllRxBASessions(msg.drv, 
&msg.body.session_info);
break;
-- 
1.9.1

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


[PATCH 09/10] staging: wilc1000: change if with else if

2015-11-24 Thread Glen Lee
From: Leo Kim 

The if statement should be else if since it is part of whole if condition.

Signed-off-by: Leo Kim 
Signed-off-by: Glen Lee 
---
 drivers/staging/wilc1000/host_interface.c | 11 +++
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 0b85640..c309deb 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -1764,9 +1764,7 @@ static int Handle_Key(struct host_if_drv *hif_drv,
strWIDList, 4,
get_id_from_handler(hif_drv));
kfree(pu8keybuf);
-   }
-
-   if (pstrHostIFkeyAttr->action & ADDKEY) {
+   } else if (pstrHostIFkeyAttr->action & ADDKEY) {
PRINT_D(HOSTINF_DBG, "Handling WEP key\n");
pu8keybuf = kmalloc(pstrHostIFkeyAttr->attr.wep.key_len 
+ 2, GFP_KERNEL);
if (!pu8keybuf) {
@@ -1848,9 +1846,7 @@ static int Handle_Key(struct host_if_drv *hif_drv,
 
kfree(pu8keybuf);
up(&hif_drv->sem_test_key_block);
-   }
-
-   if (pstrHostIFkeyAttr->action & ADDKEY) {
+   } else if (pstrHostIFkeyAttr->action & ADDKEY) {
PRINT_D(HOSTINF_DBG, "Handling group key(Rx) 
function\n");
 
pu8keybuf = kzalloc(RX_MIC_KEY_MSG_LEN, GFP_KERNEL);
@@ -1921,8 +1917,7 @@ _WPARxGtk_end_case_:
get_id_from_handler(hif_drv));
kfree(pu8keybuf);
up(&hif_drv->sem_test_key_block);
-   }
-   if (pstrHostIFkeyAttr->action & ADDKEY) {
+   } else if (pstrHostIFkeyAttr->action & ADDKEY) {
pu8keybuf = kmalloc(PTK_KEY_MSG_LEN, GFP_KERNEL);
if (!pu8keybuf) {
PRINT_ER("No buffer to send PTK Key\n");
-- 
1.9.1

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


[PATCH 07/10] staging: wilc1000: wilc_deinit(): fixes inconsistent returns

2015-11-24 Thread Glen Lee
From: Leo Kim 

This patch fixes the warning reported by smatch.
 - wilc_deinit() warn: inconsistent returns 'sem:&hif_drv->sem_cfg_values'

This semaphore protect a cfg_values variable but cfg_values variables was not
used here. So, just remove this line.

Signed-off-by: Leo Kim 
Signed-off-by: Glen Lee 
---
 drivers/staging/wilc1000/host_interface.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 3aea6ec..8f27227 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -4007,8 +4007,6 @@ s32 wilc_deinit(struct host_if_drv *hif_drv)
wilc_mq_destroy(&hif_msg_q);
}
 
-   down(&hif_drv->sem_cfg_values);
-
ret = remove_handler_in_list(hif_drv);
if (ret)
result = -ENOENT;
-- 
1.9.1

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


[PATCH 10/10] staging: wilc1000: Handle_SetMulticastFilter(): fixes right shifting more than type allows

2015-11-24 Thread Glen Lee
From: Leo Kim 

This patch fixes the warning reported by smatch.
 - Handle_SetMulticastFilter() warn: right shifting more than type allows

That is unnecessary action of boolean type. just assign 0.

Signed-off-by: Leo Kim 
Signed-off-by: Glen Lee 
---
 drivers/staging/wilc1000/host_interface.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index c309deb..3b986cb 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -2713,9 +2713,9 @@ static void Handle_SetMulticastFilter(struct host_if_drv 
*hif_drv,
 
pu8CurrByte = wid.val;
*pu8CurrByte++ = (strHostIfSetMulti->enabled & 0xFF);
-   *pu8CurrByte++ = ((strHostIfSetMulti->enabled >> 8) & 0xFF);
-   *pu8CurrByte++ = ((strHostIfSetMulti->enabled >> 16) & 0xFF);
-   *pu8CurrByte++ = ((strHostIfSetMulti->enabled >> 24) & 0xFF);
+   *pu8CurrByte++ = 0;
+   *pu8CurrByte++ = 0;
+   *pu8CurrByte++ = 0;
 
*pu8CurrByte++ = (strHostIfSetMulti->cnt & 0xFF);
*pu8CurrByte++ = ((strHostIfSetMulti->cnt >> 8) & 0xFF);
-- 
1.9.1

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


ATTENTION

2015-11-24 Thread Dr. Godwin Emefiele
FROM THE DESK OF
Dr GODWIN EMEFIELE
CENTRAL BANK GOVERNOR (CBN)
Federal Republic of Nigeria

 
ATTN:SIR/MADAM
 
 
I am Dr GODWIN EMEFIELE, the CENTRAL BANK GOVERNOR (CBN) I decided to contact 
you because of the prevailing security report reaching my office and the 
intense nature of polity in Nigeria. This is to inform you about our plan to 
send your fund to you via cash Delivery, Or BY ATM CARD this system will be 
easier for you and for us. We are going to send your contract part 
payment/inheritance of US$27.5 Million Dollars to you via Diplomatic courier 
service,I have secured every needed document to cover the money.Note: The Money 
is coming on 2 security proof boxes, the boxes are sealed with Synthetic nylon 
seal and padded with machine. I will use my position as The Director 
international Telex Department C.B.N to release this fund to You.The boxes are 
coming with a Diplomatic agent who will accompany the Boxes to your house 
address. All you need to do now is to send to me:
 
1. Your full name and house address
2. Your identity such as, international passport
or a copy of your driver's license
3. Your contact phone numbers,
 
The Diplomatic attached will travel with this required information's For the 
delivery of your fund. He will call you immediately he arrives Your country's 
airport. I hope you understand me. I will let you know when these consignments 
will be lifted, and Note: The diplomat does not know the original contents of 
the boxes. What I declared to him as the contents is Sensitive Photographic 
Film Material. I did not declare money to him please. If they call you and Ask 
you the contents please tell them the same thing ok. Call me immediately and I 
will let you know how far I have gone with The arrangement. I will secure the 
Diplomatic immunity clearance Certificate that will be tagged on the boxes to 
make it stand as a diplomatic consignment, which I will dispatch along with the 
security inner Keys of the consignments to enable you access these consignments 
as soon as it is delivered to you. This clearance will make it pass every 
custom checkpoint all over the world without hitch.
 
Confirm the receipt of this message and send the requirements to me Immediately 
you receive this message.Please I need your urgent reply because the boxes are 
schedule to be airlifted as soon as we hear from you.Call me immediately you 
receive this message.
 
 
Best Regards,
 
Dr GODWIN EMEFIELE
The CENTRAL BANK GOVERNOR (CBN)
Federal Republic of Nigeria
Email: c.b.n-ng1...@outlook.com
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


ATTENTION

2015-11-24 Thread Dr. Godwin Emefiele
FROM THE DESK OF
Dr GODWIN EMEFIELE
CENTRAL BANK GOVERNOR (CBN)
Federal Republic of Nigeria

 
ATTN:SIR/MADAM
 
 
I am Dr GODWIN EMEFIELE, the CENTRAL BANK GOVERNOR (CBN) I decided to contact 
you because of the prevailing security report reaching my office and the 
intense nature of polity in Nigeria. This is to inform you about our plan to 
send your fund to you via cash Delivery, Or BY ATM CARD this system will be 
easier for you and for us. We are going to send your contract part 
payment/inheritance of US$27.5 Million Dollars to you via Diplomatic courier 
service,I have secured every needed document to cover the money.Note: The Money 
is coming on 2 security proof boxes, the boxes are sealed with Synthetic nylon 
seal and padded with machine. I will use my position as The Director 
international Telex Department C.B.N to release this fund to You.The boxes are 
coming with a Diplomatic agent who will accompany the Boxes to your house 
address. All you need to do now is to send to me:
 
1. Your full name and house address
2. Your identity such as, international passport
or a copy of your driver's license
3. Your contact phone numbers,
 
The Diplomatic attached will travel with this required information's For the 
delivery of your fund. He will call you immediately he arrives Your country's 
airport. I hope you understand me. I will let you know when these consignments 
will be lifted, and Note: The diplomat does not know the original contents of 
the boxes. What I declared to him as the contents is Sensitive Photographic 
Film Material. I did not declare money to him please. If they call you and Ask 
you the contents please tell them the same thing ok. Call me immediately and I 
will let you know how far I have gone with The arrangement. I will secure the 
Diplomatic immunity clearance Certificate that will be tagged on the boxes to 
make it stand as a diplomatic consignment, which I will dispatch along with the 
security inner Keys of the consignments to enable you access these consignments 
as soon as it is delivered to you. This clearance will make it pass every 
custom checkpoint all over the world without hitch.
 
Confirm the receipt of this message and send the requirements to me Immediately 
you receive this message.Please I need your urgent reply because the boxes are 
schedule to be airlifted as soon as we hear from you.Call me immediately you 
receive this message.
 
 
Best Regards,
 
Dr GODWIN EMEFIELE
The CENTRAL BANK GOVERNOR (CBN)
Federal Republic of Nigeria
Email: c.b.n-ng1...@outlook.com
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel