[patch] staging: ion: use two separate locks for heaps and clients in ion_device

2016-09-30 Thread Xu YiPing
ion_alloc may get into slow path to get free page,
the call stack:

__alloc_pages_slowpath
ion_page_pool_alloc_pages
alloc_buffer_page
ion_system_heap_allocate
ion_buffer_create  <-- hold ion_device->lock
ion_alloc

after that, kernel invokes low-memory killer to kill some apps in
order to free memory in android system. However, sometimes, the
killing is blocked,
the app's call stack:

rwsem_down_write_failed
down_write
ion_client_destroy
ion_release
fput
do_signal

the killing is blocked because ion_device->lock is held by ion_alloc.

ion_alloc hold the lock for accessing the heaps list,
ion_destroy_client hold the lock for accessing the clients list.

so, we can use two separate locks for heaps and clients, to avoid the
unnecessary race.

Signed-off-by: Xu YiPing 
---
 drivers/staging/android/ion/ion.c | 37 -
 1 file changed, 20 insertions(+), 17 deletions(-)

diff --git a/drivers/staging/android/ion/ion.c 
b/drivers/staging/android/ion/ion.c
index a2cf93b..331ad0f 100644
--- a/drivers/staging/android/ion/ion.c
+++ b/drivers/staging/android/ion/ion.c
@@ -46,7 +46,8 @@
  * @dev:   the actual misc device
  * @buffers:   an rb tree of all the existing buffers
  * @buffer_lock:   lock protecting the tree of buffers
- * @lock:  rwsem protecting the tree of heaps and clients
+ * @client_lock:   rwsem protecting the tree of clients
+ * @heap_lock: rwsem protecting the tree of heaps
  * @heaps: list of all the heaps in the system
  * @user_clients:  list of all the clients created from userspace
  */
@@ -54,7 +55,8 @@ struct ion_device {
struct miscdevice dev;
struct rb_root buffers;
struct mutex buffer_lock;
-   struct rw_semaphore lock;
+   struct rw_semaphore client_lock;
+   struct rw_semaphore heap_lock;
struct plist_head heaps;
long (*custom_ioctl)(struct ion_client *client, unsigned int cmd,
 unsigned long arg);
@@ -146,7 +148,7 @@ static inline void ion_buffer_page_clean(struct page **page)
*page = (struct page *)((unsigned long)(*page) & ~(1UL));
 }

-/* this function should only be called while dev->lock is held */
+/* this function should only be called while dev->heap_lock is held */
 static void ion_buffer_add(struct ion_device *dev,
   struct ion_buffer *buffer)
 {
@@ -172,7 +174,7 @@ static void ion_buffer_add(struct ion_device *dev,
rb_insert_color(&buffer->node, &dev->buffers);
 }

-/* this function should only be called while dev->lock is held */
+/* this function should only be called while dev->heap_lock is held */
 static struct ion_buffer *ion_buffer_create(struct ion_heap *heap,
 struct ion_device *dev,
 unsigned long len,
@@ -511,7 +513,7 @@ struct ion_handle *ion_alloc(struct ion_client *client, 
size_t len,
if (!len)
return ERR_PTR(-EINVAL);

-   down_read(&dev->lock);
+   down_read(&dev->heap_lock);
plist_for_each_entry(heap, &dev->heaps, node) {
/* if the caller didn't specify this heap id */
if (!((1 << heap->id) & heap_id_mask))
@@ -520,7 +522,7 @@ struct ion_handle *ion_alloc(struct ion_client *client, 
size_t len,
if (!IS_ERR(buffer))
break;
}
-   up_read(&dev->lock);
+   up_read(&dev->heap_lock);

if (buffer == NULL)
return ERR_PTR(-ENODEV);
@@ -713,7 +715,7 @@ static int is_client_alive(struct ion_client *client)
node = ion_root_client->rb_node;
dev = container_of(ion_root_client, struct ion_device, clients);

-   down_read(&dev->lock);
+   down_read(&dev->client_lock);
while (node) {
tmp = rb_entry(node, struct ion_client, node);
if (client < tmp) {
@@ -721,12 +723,12 @@ static int is_client_alive(struct ion_client *client)
} else if (client > tmp) {
node = node->rb_right;
} else {
-   up_read(&dev->lock);
+   up_read(&dev->client_lock);
return 1;
}
}

-   up_read(&dev->lock);
+   up_read(&dev->client_lock);
return 0;
 }

@@ -841,12 +843,12 @@ struct ion_client *ion_client_create(struct ion_device 
*dev,
if (!client->name)
goto err_free_client;

-   down_write(&dev->lock);
+   down_write(&dev->client_lock);
client->display_serial = ion_get_client_serial(&dev->clients, name);
client->display_name = kasprintf(
GFP_KERNEL, "%s-%d", name, client->display_serial);
if (!client->display_name) {
-   up_write(&dev->lock);
+   up_write(&dev->client_lock);
goto err_free_client_name;
}
p = &dev->clients.rb_no

[bug report] greybus: sdio: extend sdio implementation

2016-09-30 Thread Dan Carpenter
Hello Rui Miguel Silva,

The patch 3b6ecd6de6b4: "greybus: sdio: extend sdio implementation"
from Jun 22, 2015, leads to the following static checker warning:

drivers/staging/greybus/sdio.c:481 gb_sdio_command()
warn: bitwise AND condition is false here

drivers/staging/greybus/sdio.c
   474  ret = gb_operation_sync(host->connection, GB_SDIO_TYPE_COMMAND,
   475  &request, sizeof(request), &response,
   476  sizeof(response));
   477  if (ret < 0)
   478  goto out;
   479  
   480  /* no response expected */
   481  if (cmd_flags & GB_SDIO_RSP_NONE)

This is zero.

   482  goto out;
   483  

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


Re: [bug report] greybus: sdio: extend sdio implementation

2016-09-30 Thread Viresh Kumar
On Fri, Sep 30, 2016 at 3:25 PM, Dan Carpenter  wrote:
> Hello Rui Miguel Silva,
>
> The patch 3b6ecd6de6b4: "greybus: sdio: extend sdio implementation"
> from Jun 22, 2015, leads to the following static checker warning:
>
> drivers/staging/greybus/sdio.c:481 gb_sdio_command()
> warn: bitwise AND condition is false here
>
> drivers/staging/greybus/sdio.c
>474  ret = gb_operation_sync(host->connection, 
> GB_SDIO_TYPE_COMMAND,
>475  &request, sizeof(request), &response,
>476  sizeof(response));
>477  if (ret < 0)
>478  goto out;
>479
>480  /* no response expected */
>481  if (cmd_flags & GB_SDIO_RSP_NONE)
> 
> This is zero.

Oh yes.. The macro is set to 0 and this is obviously wrong :(
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] Staging: comedi: Align the * in block comments

2016-09-30 Thread Ramiro Oliveira
Align the * on each line of block comments as reported by checkpatch

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

diff --git a/drivers/staging/comedi/drivers.c b/drivers/staging/comedi/drivers.c
index 44511d7..a5bf2cc 100644
--- a/drivers/staging/comedi/drivers.c
+++ b/drivers/staging/comedi/drivers.c
@@ -15,7 +15,7 @@
  *  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.
-*/
+ */
 
 #include 
 #include 
-- 
2.9.3


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


Re: [bug report] greybus: sdio: extend sdio implementation

2016-09-30 Thread Rui Miguel Silva

Hi Dan,
On Fri, Sep 30, 2016 at 12:55:59PM +0300, Dan Carpenter wrote:

Hello Rui Miguel Silva,

The patch 3b6ecd6de6b4: "greybus: sdio: extend sdio implementation"
from Jun 22, 2015, leads to the following static checker warning:

drivers/staging/greybus/sdio.c:481 gb_sdio_command()
warn: bitwise AND condition is false here

drivers/staging/greybus/sdio.c
  474  ret = gb_operation_sync(host->connection, GB_SDIO_TYPE_COMMAND,
  475  &request, sizeof(request), &response,
  476  sizeof(response));
  477  if (ret < 0)
  478  goto out;
  479
  480  /* no response expected */
  481  if (cmd_flags & GB_SDIO_RSP_NONE)
   
This is zero.


Thanks for the report, I will send a patch to fix this.
Cheers,
Rui
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] Staging: fsl-mc: Correct errors reported by checkpatch

2016-09-30 Thread Ramiro Oliveira
This patch corrects some errors reported using checkpatch such as
unaligned * in some block comments and multiple blank lines

Signed-off-by: Ramiro Oliveira 
---
 drivers/staging/fsl-mc/bus/dpbp.c | 60 ++---
 drivers/staging/fsl-mc/bus/dpmng.c| 60 ++---
 drivers/staging/fsl-mc/bus/dprc.c | 88 +++
 drivers/staging/fsl-mc/bus/fsl-mc-bus.c   |  5 +-
 drivers/staging/fsl-mc/include/dpbp-cmd.h | 60 ++---
 5 files changed, 136 insertions(+), 137 deletions(-)

diff --git a/drivers/staging/fsl-mc/bus/dpbp.c 
b/drivers/staging/fsl-mc/bus/dpbp.c
index fe271fb..5d4cd81 100644
--- a/drivers/staging/fsl-mc/bus/dpbp.c
+++ b/drivers/staging/fsl-mc/bus/dpbp.c
@@ -1,34 +1,34 @@
 /* Copyright 2013-2016 Freescale Semiconductor Inc.
-*
-* Redistribution and use in source and binary forms, with or without
-* modification, are permitted provided that the following conditions are met:
-* * Redistributions of source code must retain the above copyright
-* notice, this list of conditions and the following disclaimer.
-* * Redistributions in binary form must reproduce the above copyright
-* notice, this list of conditions and the following disclaimer in the
-* documentation and/or other materials provided with the distribution.
-* * Neither the name of the above-listed copyright holders nor the
-* names of any contributors may be used to endorse or promote products
-* derived from this software without specific prior written permission.
-*
-*
-* ALTERNATIVELY, this software may be distributed under the terms of the
-* GNU General Public License ("GPL") as published by the Free Software
-* Foundation, either version 2 of that License or (at your option) any
-* later version.
-*
-* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
-* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-* POSSIBILITY OF SUCH DAMAGE.
-*/
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of the above-listed copyright holders nor the
+ * names of any contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ *
+ * ALTERNATIVELY, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") as published by the Free Software
+ * Foundation, either version 2 of that License or (at your option) any
+ * later version.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
 #include "../include/mc-sys.h"
 #include "../include/mc-cmd.h"
 #include "../include/dpbp.h"
diff --git a/drivers/staging/fsl-mc/bus/dpmng.c 
b/drivers/staging/fsl-mc/bus/dpmng.c
index 669f604..96b1d67 100644
--- a/drivers/staging/fsl-mc/bus/dpmng.c
+++ b/drivers/staging/fsl-mc/bus/dpmng.c
@@ -1,34 +1,34 @@
 /* Copyright 2013-2016 Freescale Semiconductor Inc.
-*
-* Redistribution and use in source and binary forms, with or without
-* modification, are permitted provided that the following conditions are met:
-* * Redistributions of source code must retain the above copyright
-* notice, this list of conditions and the following disclai

[bug report] staging: rtl8188eu: fix missing unlock on error in rtw_resume_process()

2016-09-30 Thread Dan Carpenter
Hello Wei Yongjun,

The patch eaf47b713b60: "staging: rtl8188eu: fix missing unlock on
error in rtw_resume_process()" from Aug 26, 2016, leads to the
following static checker warning:

drivers/staging/rtl8188eu/os_dep/usb_intf.c:311 rtw_resume_process()
error: double unlock 'mutex:&pwrpriv->mutex_lock'

drivers/staging/rtl8188eu/os_dep/usb_intf.c
   295  
   296  pr_debug("bkeepfwalive(%x)\n", pwrpriv->bkeepfwalive);
   297  if (pm_netdev_open(pnetdev, true) != 0)
   298  goto exit;
   299  
   300  netif_device_attach(pnetdev);
   301  netif_carrier_on(pnetdev);
   302  
   303  mutex_unlock(&pwrpriv->mutex_lock);
^^
unlock.

   304  
   305  rtw_roaming(padapter, NULL);
   306  
   307  ret = 0;
   308  exit:
   309  if (pwrpriv) {
   310  pwrpriv->bInSuspend = false;
   311  mutex_unlock(&pwrpriv->mutex_lock);
^
unlock again.

   312  }
   313  pr_debug("<===  %s return %d.. in %dms\n", __func__,
   314  ret, jiffies_to_msecs(jiffies - start_time));
   315  
   316  return ret;
   317  }


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


[bug report] vme: Adding Fake VME driver

2016-09-30 Thread Dan Carpenter
Hello Martyn Welch,

The patch 658bcdae9c67: "vme: Adding Fake VME driver" from Jul 7,
2016, leads to the following static checker warning:

drivers/vme/bridges/vme_fake.c:338 fake_master_set()
warn: 'spin_lock:&image->lock' is sometimes locked here and sometimes 
unlocked.

drivers/vme/bridges/vme_fake.c
   255  static int fake_master_set(struct vme_master_resource *image, int 
enabled,
   256  unsigned long long vme_base, unsigned long long size,
   257  u32 aspace, u32 cycle, u32 dwidth)
   258  {
   259  int retval = 0;
   260  unsigned int i;
   261  struct vme_bridge *fake_bridge;
   262  struct fake_driver *bridge;
   263  
   264  fake_bridge = image->parent;
   265  
   266  bridge = fake_bridge->driver_priv;
   267  
   268  /* Verify input data */
   269  if (vme_base & 0x) {

Unlock?

   270  pr_err("Invalid VME Window alignment\n");
   271  retval = -EINVAL;
   272  goto err_window;
   273  }
   274  
   275  if (size & 0x) {
   276  spin_unlock(&image->lock);
   277  pr_err("Invalid size alignment\n");
   278  retval = -EINVAL;
   279  goto err_window;
   280  }
   281  
   282  if ((size == 0) && (enabled != 0)) {

Unlock?

   283  pr_err("Size must be non-zero for enabled windows\n");
   284  retval = -EINVAL;
   285  goto err_window;
   286  }
   287  
   288  /* Setup data width */
   289  switch (dwidth) {
   290  case VME_D8:
   291  case VME_D16:
   292  case VME_D32:
   293  break;
   294  default:
   295  spin_unlock(&image->lock);
   296  pr_err("Invalid data width\n");
   297  retval = -EINVAL;
   298  goto err_dwidth;
   299  }
   300  
   301  /* Setup address space */
   302  switch (aspace) {
   303  case VME_A16:
   304  case VME_A24:
   305  case VME_A32:
   306  case VME_A64:
   307  case VME_CRCSR:
   308  case VME_USER1:
   309  case VME_USER2:
   310  case VME_USER3:
   311  case VME_USER4:
   312  break;
   313  default:
   314  spin_unlock(&image->lock);
   315  pr_err("Invalid address space\n");
   316  retval = -EINVAL;
   317  goto err_aspace;
   318  }
   319  
   320  spin_lock(&image->lock);
   321  
   322  i = image->number;
   323  
   324  bridge->masters[i].enabled = enabled;
   325  bridge->masters[i].vme_base = vme_base;
   326  bridge->masters[i].size = size;
   327  bridge->masters[i].aspace = aspace;
   328  bridge->masters[i].cycle = cycle;
   329  bridge->masters[i].dwidth = dwidth;
   330  
   331  spin_unlock(&image->lock);
   332  
   333  return 0;
   334  
   335  err_aspace:
   336  err_dwidth:
   337  err_window:
   338  return retval;
   339  
   340  }

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


Re: [PATCH 1/2 v2] pci-hyperv: properly handle pci bus remove

2016-09-30 Thread Cathy Avery

I have not been able to try out your second patch.

So once that happens you can add my name.

Cathy



On 09/27/2016 07:54 PM, Long Li wrote:

Thanks for pointing that out.

If you don't mind, I will also add "Tested-by: Cathy Avery ".


-Original Message-
From: devel [mailto:driverdev-devel-boun...@linuxdriverproject.org] On
Behalf Of Cathy Avery
Sent: Friday, September 23, 2016 4:59 AM
To: driverdev-devel@linuxdriverproject.org
Subject: Re: [PATCH 1/2 v2] pci-hyperv: properly handle pci bus remove

Hi,

You seem to be missing the Reported-by tag.

That's xiaof...@redhat.com.

Cathy

On 09/14/2016 10:10 PM, Long Li wrote:

From: Long Li 

hv_pci_devices_present is called in hv_pci_remove when we remove a PCI

device from host (e.g. by disabling SRIOV on a device). In hv_pci_remove,
the bus is already removed before the call, so we don't need to rescan the
bus in the workqueue scheduled from hv_pci_devices_present. By
introducing status hv_pcibus_removed, we can avoid this situation.

The patch fixes the following kernel panic.

[  383.853124] Workqueue: events pci_devices_present_work [pci_hyperv]
[  383.853124] task: 88007f5f8000 ti: 88007f60 task.ti:
88007f60
[  383.853124] RIP: 0010:[]  []
pci_is_pcie+0x6/0x20
[  383.853124] RSP: 0018:88007f603d38  EFLAGS: 00010206 [
383.853124] RAX: 88007f5f8000 RBX: 642f3d4854415056 RCX:
88007f603fd8
[  383.853124] RDX:  RSI:  RDI:
642f3d4854415056
[  383.853124] RBP: 88007f603d68 R08: 0246 R09:
a045eb9e
[  383.853124] R10: 88007b419a80 R11: ea0001c0ef40 R12:
880003ee1c00
[  383.853124] R13: 63702f30303a3137 R14:  R15:
0246
[  383.853124] FS:  () GS:88007b40()
knlGS:
[  383.853124] CS:  0010 DS:  ES:  CR0: 80050033 [
383.853124] CR2: 7f68b3f52350 CR3: 03546000 CR4:
000406f0
[  383.853124] DR0:  DR1:  DR2:

[  383.853124] DR3:  DR6: 0ff0 DR7:
0400
[  383.853124] Stack:
[  383.853124]  88007f603d68 8134db17 0008
880003ee1c00
[  383.853124]  63702f30303a3137 880003d8edb8 88007f603da0
8134ee2d [  383.853124]  880003d8ed00 88007f603dd8
880075fec320
880003d8edb8
[  383.853124] Call Trace:
[  383.853124]  [] ? pci_scan_slot+0x27/0x140 [
383.853124]  [] pci_scan_child_bus+0x3d/0x150 [
383.853124]  []
pci_devices_present_work+0x3ea/0x400 [pci_hyperv] [  383.853124]
[] process_one_work+0x17b/0x470 [  383.853124]
[] worker_thread+0x126/0x410 [  383.853124]
[] ? rescuer_thread+0x460/0x460 [  383.853124]
[] kthread+0xcf/0xe0 [  383.853124]
[] ?
kthread_create_on_node+0x140/0x140
[  383.853124]  [] ret_from_fork+0x58/0x90 [
383.853124]  [] ?
kthread_create_on_node+0x140/0x140
[  383.853124] Code: 89 e5 5d 25 f0 00 00 00 c1 f8 04 c3 66 0f 1f 84
00
00 00 00 00 66 66 66 66 90 55 0f b6 47 4a 48 89 e5 5d c3 90 66 66 66
66
90 55 <80> 7f 4a 00 48 89 e5 5d 0f 95 c0 c3 0f 1f 40 00 66 2e 0f 1f 84
[  383.853124] RIP  [] pci_is_pcie+0x6/0x20 [
383.853124]  RSP 

Signed-off-by: Long Li 
---
   drivers/pci/host/pci-hyperv.c | 20 +---
   1 file changed, 17 insertions(+), 3 deletions(-)

diff --git a/drivers/pci/host/pci-hyperv.c
b/drivers/pci/host/pci-hyperv.c index a8deeca..4a37598 100644
--- a/drivers/pci/host/pci-hyperv.c
+++ b/drivers/pci/host/pci-hyperv.c
@@ -348,6 +348,7 @@ enum hv_pcibus_state {
hv_pcibus_init = 0,
hv_pcibus_probed,
hv_pcibus_installed,
+   hv_pcibus_removed,
hv_pcibus_maximum
   };

@@ -1481,13 +1482,24 @@ static void pci_devices_present_work(struct

work_struct *work)

put_pcichild(hpdev, hv_pcidev_ref_initial);
}

-   /* Tell the core to rescan bus because there may have been changes.

*/

-   if (hbus->state == hv_pcibus_installed) {
+   switch (hbus->state) {
+   case hv_pcibus_installed:
+   /*
+* Tell the core to rescan bus
+* because there may have been changes.
+*/
pci_lock_rescan_remove();
pci_scan_child_bus(hbus->pci_bus);
pci_unlock_rescan_remove();
-   } else {
+   break;
+
+   case hv_pcibus_init:
+   case hv_pcibus_probed:
survey_child_resources(hbus);
+   break;
+
+   default:
+   break;
}

up(&hbus->enum_sem);
@@ -2163,6 +2175,7 @@ static int hv_pci_probe(struct hv_device *hdev,
hbus = kzalloc(sizeof(*hbus), GFP_KERNEL);
if (!hbus)
return -ENOMEM;
+   hbus->state = hv_pcibus_init;

/*
 * The PCI bus "domain" is what is called "segment" in ACPI and @@
-2305,6 +2318,7 @@ static int hv_pci_remove(struct hv_device *hdev)
pci_stop_root_bus(hbus->pci_bu

Re: [PATCH] Staging: fsl-mc: Correct errors reported by checkpatch

2016-09-30 Thread Greg Kroah-Hartman
On Fri, Sep 30, 2016 at 12:13:02PM +0100, Ramiro Oliveira wrote:
> This patch corrects some errors reported using checkpatch such as
> unaligned * in some block comments and multiple blank lines

Please only do one type of thing at a time, so break this up into
multiple patches.

thanks,

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


Re: [PATCH 2/2] Revert "staging: wilc1000: Replace kthread with workqueue for host interface"

2016-09-30 Thread Greg KH
On Fri, Sep 30, 2016 at 03:43:18PM +0530, Aditya Shankar wrote:
> This reverts commit 2518ac59eb27 ("staging: wilc1000: Replace kthread
> with workqueue for host interface")
> 
> This commit breaks wilc1000 driver init. A crash was seen
> everytime the wlan interface was brought up and wilc device
> open was attempted. This change is being reverted until we
> figure out the problem in this change. The driver is
> usable now with this change reverted.
> 
> Signed-off-by: Aditya Shankar 
> 
> Conflicts:
>   drivers/staging/wilc1000/host_interface.c

What is this line doing here?

And shouldn't we add a cc: stable tag as well?  Or at the least, put a
"fixes:" tag to let people know exactly what commit it is fixing (the
id that it is reverting.)

thanks,

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


[PATCH v2 0/2] Staging: fsl-mc: Correct errors reported by checkpatch

2016-09-30 Thread Ramiro Oliveira
This set of patches corrects some errors reported by checkpatch in
drivers/staging/fsl-mc

v2: Split the patch in 2 parts, one for unaligned * in block comments,
other for multiple blank lines.

Ramiro Oliveira (2):
  Staging: fsl-mc: Fix unaligned * in block comments
  Staging: fsl-mc: Remove blank lines

 drivers/staging/fsl-mc/bus/dpbp.c | 60 ++---
 drivers/staging/fsl-mc/bus/dpmcp.c|  1 -
 drivers/staging/fsl-mc/bus/dpmng.c| 60 ++---
 drivers/staging/fsl-mc/bus/dprc.c | 88 +++
 drivers/staging/fsl-mc/bus/fsl-mc-bus.c   |  5 +-
 drivers/staging/fsl-mc/include/dpbp-cmd.h | 60 ++---
 6 files changed, 136 insertions(+), 138 deletions(-)

-- 
2.9.3


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


[PATCH v2 1/2] Staging: fsl-mc: Fix unaligned * in block comments

2016-09-30 Thread Ramiro Oliveira
Align the * in some block comments as reported by checkpatch.

Signed-off-by: Ramiro Oliveira 
---
 drivers/staging/fsl-mc/bus/dpbp.c | 60 ++---
 drivers/staging/fsl-mc/bus/dpmng.c| 60 ++---
 drivers/staging/fsl-mc/bus/dprc.c | 88 +++
 drivers/staging/fsl-mc/bus/fsl-mc-bus.c   |  4 +-
 drivers/staging/fsl-mc/include/dpbp-cmd.h | 60 ++---
 5 files changed, 136 insertions(+), 136 deletions(-)

diff --git a/drivers/staging/fsl-mc/bus/dpbp.c 
b/drivers/staging/fsl-mc/bus/dpbp.c
index fe271fb..5d4cd81 100644
--- a/drivers/staging/fsl-mc/bus/dpbp.c
+++ b/drivers/staging/fsl-mc/bus/dpbp.c
@@ -1,34 +1,34 @@
 /* Copyright 2013-2016 Freescale Semiconductor Inc.
-*
-* Redistribution and use in source and binary forms, with or without
-* modification, are permitted provided that the following conditions are met:
-* * Redistributions of source code must retain the above copyright
-* notice, this list of conditions and the following disclaimer.
-* * Redistributions in binary form must reproduce the above copyright
-* notice, this list of conditions and the following disclaimer in the
-* documentation and/or other materials provided with the distribution.
-* * Neither the name of the above-listed copyright holders nor the
-* names of any contributors may be used to endorse or promote products
-* derived from this software without specific prior written permission.
-*
-*
-* ALTERNATIVELY, this software may be distributed under the terms of the
-* GNU General Public License ("GPL") as published by the Free Software
-* Foundation, either version 2 of that License or (at your option) any
-* later version.
-*
-* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
-* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-* POSSIBILITY OF SUCH DAMAGE.
-*/
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of the above-listed copyright holders nor the
+ * names of any contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ *
+ * ALTERNATIVELY, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") as published by the Free Software
+ * Foundation, either version 2 of that License or (at your option) any
+ * later version.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
 #include "../include/mc-sys.h"
 #include "../include/mc-cmd.h"
 #include "../include/dpbp.h"
diff --git a/drivers/staging/fsl-mc/bus/dpmng.c 
b/drivers/staging/fsl-mc/bus/dpmng.c
index 669f604..96b1d67 100644
--- a/drivers/staging/fsl-mc/bus/dpmng.c
+++ b/drivers/staging/fsl-mc/bus/dpmng.c
@@ -1,34 +1,34 @@
 /* Copyright 2013-2016 Freescale Semiconductor Inc.
-*
-* Redistribution and use in source and binary forms, with or without
-* modification, are permitted provided that the following conditions are met:
-* * Redistributions of source code must retain the above copyright
-* notice, this list of conditions and the following disclaimer.
-* * Redistributions in binary form must reproduce the abov

[PATCH v2 2/2] Staging: fsl-mc: Remove blank lines

2016-09-30 Thread Ramiro Oliveira
Remove multiple blank lines as reported by checkpatch

Signed-off-by: Ramiro Oliveira 
---
 drivers/staging/fsl-mc/bus/dpmcp.c  | 1 -
 drivers/staging/fsl-mc/bus/fsl-mc-bus.c | 1 -
 2 files changed, 2 deletions(-)

diff --git a/drivers/staging/fsl-mc/bus/dpmcp.c 
b/drivers/staging/fsl-mc/bus/dpmcp.c
index bd63baa..55766f7 100644
--- a/drivers/staging/fsl-mc/bus/dpmcp.c
+++ b/drivers/staging/fsl-mc/bus/dpmcp.c
@@ -369,7 +369,6 @@ int dpmcp_set_irq_mask(struct fsl_mc_io *mc_io,
struct mc_command cmd = { 0 };
struct dpmcp_cmd_set_irq_mask *cmd_params;
 
-
/* prepare command */
cmd.header = mc_encode_cmd_header(DPMCP_CMDID_SET_IRQ_MASK,
  cmd_flags, token);
diff --git a/drivers/staging/fsl-mc/bus/fsl-mc-bus.c 
b/drivers/staging/fsl-mc/bus/fsl-mc-bus.c
index 4ebc72f..44f64b6 100644
--- a/drivers/staging/fsl-mc/bus/fsl-mc-bus.c
+++ b/drivers/staging/fsl-mc/bus/fsl-mc-bus.c
@@ -139,7 +139,6 @@ static struct attribute *fsl_mc_dev_attrs[] = {
 
 ATTRIBUTE_GROUPS(fsl_mc_dev);
 
-
 struct bus_type fsl_mc_bus_type = {
.name = "fsl-mc",
.match = fsl_mc_bus_match,
-- 
2.9.3


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


[PATCH 8/8] staging:r8188eu: remove GEN_MLME_EXT_HANDLER macro

2016-09-30 Thread Ivan Safonov
GEN_MLME_EXT_HANDLER is redundant macro.

Signed-off-by: Ivan Safonov 
---
 drivers/staging/rtl8188eu/include/rtw_mlme_ext.h | 32 +++-
 1 file changed, 15 insertions(+), 17 deletions(-)

diff --git a/drivers/staging/rtl8188eu/include/rtw_mlme_ext.h 
b/drivers/staging/rtl8188eu/include/rtw_mlme_ext.h
index 872a531..1b1caaf 100644
--- a/drivers/staging/rtl8188eu/include/rtw_mlme_ext.h
+++ b/drivers/staging/rtl8188eu/include/rtw_mlme_ext.h
@@ -625,26 +625,24 @@ u8 led_blink_hdl(struct adapter *padapter, unsigned char 
*pbuf);
 u8 set_csa_hdl(struct adapter *padapter, unsigned char *pbuf);
 u8 tdls_hdl(struct adapter *padapter, unsigned char *pbuf);
 
-#define GEN_MLME_EXT_HANDLER(size, cmd){size, cmd},
-
 #ifdef _RTW_CMD_C_
 
 static struct cmd_hdl wlancmds[] = {
-   GEN_MLME_EXT_HANDLER(sizeof(struct wlan_bssid_ex), join_cmd_hdl)
-   GEN_MLME_EXT_HANDLER(sizeof(struct disconnect_parm), disconnect_hdl)
-   GEN_MLME_EXT_HANDLER(sizeof(struct wlan_bssid_ex), createbss_hdl)
-   GEN_MLME_EXT_HANDLER(sizeof(struct setopmode_parm), setopmode_hdl)
-   GEN_MLME_EXT_HANDLER(sizeof(struct sitesurvey_parm), sitesurvey_cmd_hdl)
-   GEN_MLME_EXT_HANDLER(sizeof(struct setauth_parm), setauth_hdl)
-   GEN_MLME_EXT_HANDLER(sizeof(struct setkey_parm), setkey_hdl)
-   GEN_MLME_EXT_HANDLER(sizeof(struct set_stakey_parm), set_stakey_hdl)
-   GEN_MLME_EXT_HANDLER(sizeof(struct set_assocsta_parm), NULL)
-   GEN_MLME_EXT_HANDLER(sizeof(struct addBaReq_parm), add_ba_hdl)
-   GEN_MLME_EXT_HANDLER(sizeof(struct set_ch_parm), set_ch_hdl)
-   GEN_MLME_EXT_HANDLER(sizeof(struct wlan_bssid_ex), tx_beacon_hdl)
-   GEN_MLME_EXT_HANDLER(0, mlme_evt_hdl)
-   GEN_MLME_EXT_HANDLER(0, rtw_drvextra_cmd_hdl)
-   GEN_MLME_EXT_HANDLER(sizeof(struct SetChannelPlan_param), 
set_chplan_hdl)
+   {sizeof(struct wlan_bssid_ex), join_cmd_hdl},
+   {sizeof(struct disconnect_parm), disconnect_hdl},
+   {sizeof(struct wlan_bssid_ex), createbss_hdl},
+   {sizeof(struct setopmode_parm), setopmode_hdl},
+   {sizeof(struct sitesurvey_parm), sitesurvey_cmd_hdl},
+   {sizeof(struct setauth_parm), setauth_hdl},
+   {sizeof(struct setkey_parm), setkey_hdl},
+   {sizeof(struct set_stakey_parm), set_stakey_hdl},
+   {sizeof(struct set_assocsta_parm), NULL},
+   {sizeof(struct addBaReq_parm), add_ba_hdl},
+   {sizeof(struct set_ch_parm), set_ch_hdl},
+   {sizeof(struct wlan_bssid_ex), tx_beacon_hdl},
+   {0, mlme_evt_hdl},
+   {0, rtw_drvextra_cmd_hdl},
+   {sizeof(struct SetChannelPlan_param), set_chplan_hdl}
 };
 
 #endif
-- 
2.7.3

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


[PATCH 2/8] staging:r8188eu: remove (RGTRY|BSSID)_(OFT|SZ) macros

2016-09-30 Thread Ivan Safonov
These macros does not used.

Signed-off-by: Ivan Safonov 
---
 drivers/staging/rtl8188eu/include/drv_types.h | 6 --
 1 file changed, 6 deletions(-)

diff --git a/drivers/staging/rtl8188eu/include/drv_types.h 
b/drivers/staging/rtl8188eu/include/drv_types.h
index 5c275fb..c966c8e 100644
--- a/drivers/staging/rtl8188eu/include/drv_types.h
+++ b/drivers/staging/rtl8188eu/include/drv_types.h
@@ -104,12 +104,6 @@ struct registry_priv {
boolmonitor_enable;
 };
 
-/* For registry parameters */
-#define RGTRY_OFT(field) ((u32)offsetof(struct registry_priv, field))
-#define RGTRY_SZ(field)   sizeof(((struct registry_priv *)0)->field)
-#define BSSID_OFT(field) ((u32)offsetofT(struct wlan_bssid_ex, field))
-#define BSSID_SZ(field)   sizeof(((struct wlan_bssid_ex *)0)->field)
-
 #define MAX_CONTINUAL_URB_ERR  4
 
 struct dvobj_priv {
-- 
2.7.3

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


[PATCH 5/8] staging:r8188eu: remove GEN_CMD_CODE macro

2016-09-30 Thread Ivan Safonov
GEN_CMD_CODE is redundant macro.

Signed-off-by: Ivan Safonov 
---
 drivers/staging/rtl8188eu/core/rtw_cmd.c  | 24 +--
 drivers/staging/rtl8188eu/core/rtw_mlme_ext.c | 14 +++---
 drivers/staging/rtl8188eu/include/rtw_cmd.h   | 62 +--
 3 files changed, 49 insertions(+), 51 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_cmd.c 
b/drivers/staging/rtl8188eu/core/rtw_cmd.c
index e87ab11..f1f4788 100644
--- a/drivers/staging/rtl8188eu/core/rtw_cmd.c
+++ b/drivers/staging/rtl8188eu/core/rtw_cmd.c
@@ -85,7 +85,7 @@ static int rtw_cmd_filter(struct cmd_priv *pcmdpriv, struct 
cmd_obj *cmd_obj)
/* To decide allow or not */
if ((pcmdpriv->padapter->pwrctrlpriv.bHWPwrPindetect) &&
(!pcmdpriv->padapter->registrypriv.usbss_enable)) {
-   if (cmd_obj->cmdcode == GEN_CMD_CODE(_Set_Drv_Extra)) {
+   if (cmd_obj->cmdcode == _Set_Drv_Extra_CMD_) {
struct drvextra_cmd_parm*pdrvextra_cmd_parm = 
(struct drvextra_cmd_parm *)cmd_obj->parmbuf;
 
if (pdrvextra_cmd_parm->ec_id == 
POWER_SAVING_CTRL_WK_CID)
@@ -93,7 +93,7 @@ static int rtw_cmd_filter(struct cmd_priv *pcmdpriv, struct 
cmd_obj *cmd_obj)
}
}
 
-   if (cmd_obj->cmdcode == GEN_CMD_CODE(_SetChannelPlan))
+   if (cmd_obj->cmdcode == _SetChannelPlan_CMD_)
bAllow = true;
 
if ((!pcmdpriv->padapter->hw_init_completed && !bAllow) ||
@@ -271,7 +271,7 @@ u8 rtw_sitesurvey_cmd(struct adapter  *padapter, struct 
ndis_802_11_ssid *ssid,
 
RT_TRACE(_module_rtl871x_cmd_c_, _drv_info_, ("%s: flush network 
queue\n", __func__));
 
-   init_h2fwcmd_w_parm_no_rsp(ph2c, psurveyPara, 
GEN_CMD_CODE(_SiteSurvey));
+   init_h2fwcmd_w_parm_no_rsp(ph2c, psurveyPara, _SiteSurvey_CMD_);
 
/* psurveyPara->bsslimit = 48; */
psurveyPara->scan_mode = pmlmepriv->scan_mode;
@@ -489,7 +489,7 @@ u8 rtw_joinbss_cmd(struct adapter  *padapter, struct 
wlan_network *pnetwork)
pcmd->cmdsz = get_wlan_bssid_ex_sz(psecnetwork);/* get cmdsz before 
endian conversion */
 
INIT_LIST_HEAD(&pcmd->list);
-   pcmd->cmdcode = _JoinBss_CMD_;/* GEN_CMD_CODE(_JoinBss) */
+   pcmd->cmdcode = _JoinBss_CMD_;
pcmd->parmbuf = (unsigned char *)psecnetwork;
pcmd->rsp = NULL;
pcmd->rspsz = 0;
@@ -684,7 +684,7 @@ u8 rtw_addbareq_cmd(struct adapter *padapter, u8 tid, u8 
*addr)
paddbareq_parm->tid = tid;
memcpy(paddbareq_parm->addr, addr, ETH_ALEN);
 
-   init_h2fwcmd_w_parm_no_rsp(ph2c, paddbareq_parm, 
GEN_CMD_CODE(_AddBAReq));
+   init_h2fwcmd_w_parm_no_rsp(ph2c, paddbareq_parm, _AddBAReq_CMD_);
 
/* DBG_88E("rtw_addbareq_cmd, tid =%d\n", tid); */
 
@@ -722,7 +722,7 @@ u8 rtw_dynamic_chk_wk_cmd(struct adapter *padapter)
pdrvextra_cmd_parm->type_size = 0;
pdrvextra_cmd_parm->pbuf = (u8 *)padapter;
 
-   init_h2fwcmd_w_parm_no_rsp(ph2c, pdrvextra_cmd_parm, 
GEN_CMD_CODE(_Set_Drv_Extra));
+   init_h2fwcmd_w_parm_no_rsp(ph2c, pdrvextra_cmd_parm, 
_Set_Drv_Extra_CMD_);
 
 
/* rtw_enqueue_cmd(pcmdpriv, ph2c); */
@@ -765,7 +765,7 @@ u8 rtw_set_chplan_cmd(struct adapter *padapter, u8 chplan, 
u8 enqueue)
goto exit;
}
 
-   init_h2fwcmd_w_parm_no_rsp(pcmdobj, setChannelPlan_param, 
GEN_CMD_CODE(_SetChannelPlan));
+   init_h2fwcmd_w_parm_no_rsp(pcmdobj, setChannelPlan_param, 
_SetChannelPlan_CMD_);
res = rtw_enqueue_cmd(pcmdpriv, pcmdobj);
} else {
/* no need to enqueue, do the cmd hdl directly and free cmd 
parameter */
@@ -934,7 +934,7 @@ u8 rtw_lps_ctrl_wk_cmd(struct adapter *padapter, u8 
lps_ctrl_type, u8 enqueue)
pdrvextra_cmd_parm->type_size = lps_ctrl_type;
pdrvextra_cmd_parm->pbuf = NULL;
 
-   init_h2fwcmd_w_parm_no_rsp(ph2c, pdrvextra_cmd_parm, 
GEN_CMD_CODE(_Set_Drv_Extra));
+   init_h2fwcmd_w_parm_no_rsp(ph2c, pdrvextra_cmd_parm, 
_Set_Drv_Extra_CMD_);
 
res = rtw_enqueue_cmd(pcmdpriv, ph2c);
} else {
@@ -976,7 +976,7 @@ u8 rtw_rpt_timer_cfg_cmd(struct adapter *padapter, u16 
min_time)
pdrvextra_cmd_parm->ec_id = RTP_TIMER_CFG_WK_CID;
pdrvextra_cmd_parm->type_size = min_time;
pdrvextra_cmd_parm->pbuf = NULL;
-   init_h2fwcmd_w_parm_no_rsp(ph2c, pdrvextra_cmd_parm, 
GEN_CMD_CODE(_Set_Drv_Extra));
+   init_h2fwcmd_w_parm_no_rsp(ph2c, pdrvextra_cmd_parm, 
_Set_Drv_Extra_CMD_);
res = rtw_enqueue_cmd(pcmdpriv, ph2c);
 exit:
 
@@ -1018,7 +1018,7 @@ u8 rtw_antenna_select_cmd(struct adapter *padapter, u8 
antenna, u8 enqueue)
pdrvextra_cmd_parm->ec_id = ANT_SELECT_WK_CID;
pdrvextra_cmd_parm->type_size = antenna;
pdrvextra_cmd_parm->pbuf = NULL;
-   init_h2fwcmd_w_parm_no_rsp(ph2c, pdrvextra_cmd_parm, 
GE

[PATCH 6/8] staging:r8188eu: remove GEN_EVT_CODE macro

2016-09-30 Thread Ivan Safonov
GEN_EVT_CODE is redundant macro.

Signed-off-by: Ivan Safonov 
---
 drivers/staging/rtl8188eu/core/rtw_mlme_ext.c| 10 ++---
 drivers/staging/rtl8188eu/include/rtw_event.h|  2 -
 drivers/staging/rtl8188eu/include/rtw_mlme_ext.h | 52 
 3 files changed, 31 insertions(+), 33 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c 
b/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c
index baf8606..fb13df5 100644
--- a/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c
+++ b/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c
@@ -4249,7 +4249,7 @@ void report_survey_event(struct adapter *padapter,
 
pc2h_evt_hdr = (struct C2HEvent_Header *)(pevtcmd);
pc2h_evt_hdr->len = sizeof(struct survey_event);
-   pc2h_evt_hdr->ID = GEN_EVT_CODE(_Survey);
+   pc2h_evt_hdr->ID = _Survey_EVT_;
pc2h_evt_hdr->seq = atomic_inc_return(&pmlmeext->event_seq);
 
psurvey_evt = (struct survey_event *)(pevtcmd + sizeof(struct 
C2HEvent_Header));
@@ -4299,7 +4299,7 @@ void report_surveydone_event(struct adapter *padapter)
 
pc2h_evt_hdr = (struct C2HEvent_Header *)(pevtcmd);
pc2h_evt_hdr->len = sizeof(struct surveydone_event);
-   pc2h_evt_hdr->ID = GEN_EVT_CODE(_SurveyDone);
+   pc2h_evt_hdr->ID = _SurveyDone_EVT_;
pc2h_evt_hdr->seq = atomic_inc_return(&pmlmeext->event_seq);
 
psurveydone_evt = (struct surveydone_event *)(pevtcmd + sizeof(struct 
C2HEvent_Header));
@@ -4343,7 +4343,7 @@ void report_join_res(struct adapter *padapter, int res)
 
pc2h_evt_hdr = (struct C2HEvent_Header *)(pevtcmd);
pc2h_evt_hdr->len = sizeof(struct joinbss_event);
-   pc2h_evt_hdr->ID = GEN_EVT_CODE(_JoinBss);
+   pc2h_evt_hdr->ID = _JoinBss_EVT_;
pc2h_evt_hdr->seq = atomic_inc_return(&pmlmeext->event_seq);
 
pjoinbss_evt = (struct joinbss_event *)(pevtcmd + sizeof(struct 
C2HEvent_Header));
@@ -4394,7 +4394,7 @@ void report_del_sta_event(struct adapter *padapter, 
unsigned char *MacAddr, unsi
 
pc2h_evt_hdr = (struct C2HEvent_Header *)(pevtcmd);
pc2h_evt_hdr->len = sizeof(struct stadel_event);
-   pc2h_evt_hdr->ID = GEN_EVT_CODE(_DelSTA);
+   pc2h_evt_hdr->ID = _DelSTA_EVT_;
pc2h_evt_hdr->seq = atomic_inc_return(&pmlmeext->event_seq);
 
pdel_sta_evt = (struct stadel_event *)(pevtcmd + sizeof(struct 
C2HEvent_Header));
@@ -4447,7 +4447,7 @@ void report_add_sta_event(struct adapter *padapter, 
unsigned char *MacAddr, int
 
pc2h_evt_hdr = (struct C2HEvent_Header *)(pevtcmd);
pc2h_evt_hdr->len = sizeof(struct stassoc_event);
-   pc2h_evt_hdr->ID = GEN_EVT_CODE(_AddSTA);
+   pc2h_evt_hdr->ID = _AddSTA_EVT_;
pc2h_evt_hdr->seq = atomic_inc_return(&pmlmeext->event_seq);
 
padd_sta_evt = (struct stassoc_event *)(pevtcmd + sizeof(struct 
C2HEvent_Header));
diff --git a/drivers/staging/rtl8188eu/include/rtw_event.h 
b/drivers/staging/rtl8188eu/include/rtw_event.h
index df68948..1c5ebde 100644
--- a/drivers/staging/rtl8188eu/include/rtw_event.h
+++ b/drivers/staging/rtl8188eu/include/rtw_event.h
@@ -71,8 +71,6 @@ struct stadel_event {
int mac_id;
 };
 
-#define GEN_EVT_CODE(event)event ## _EVT_
-
 struct fwevent {
u32 parmsize;
void (*event_callback)(struct adapter *dev, u8 *pbuf);
diff --git a/drivers/staging/rtl8188eu/include/rtw_mlme_ext.h 
b/drivers/staging/rtl8188eu/include/rtw_mlme_ext.h
index 5ee6366..80758e1 100644
--- a/drivers/staging/rtl8188eu/include/rtw_mlme_ext.h
+++ b/drivers/staging/rtl8188eu/include/rtw_mlme_ext.h
@@ -667,32 +667,32 @@ void rtw_dummy_event_callback(struct adapter *adapter, u8 
*pbuf);
 void rtw_fwdbg_event_callback(struct adapter *adapter, u8 *pbuf);
 
 enum rtw_c2h_event {
-   GEN_EVT_CODE(_Read_MACREG) = 0, /*0*/
-   GEN_EVT_CODE(_Read_BBREG),
-   GEN_EVT_CODE(_Read_RFREG),
-   GEN_EVT_CODE(_Read_EEPROM),
-   GEN_EVT_CODE(_Read_EFUSE),
-   GEN_EVT_CODE(_Read_CAM),/*5*/
-   GEN_EVT_CODE(_Get_BasicRate),
-   GEN_EVT_CODE(_Get_DataRate),
-   GEN_EVT_CODE(_Survey),   /*8*/
-   GEN_EVT_CODE(_SurveyDone),   /*9*/
-
-   GEN_EVT_CODE(_JoinBss), /*10*/
-   GEN_EVT_CODE(_AddSTA),
-   GEN_EVT_CODE(_DelSTA),
-   GEN_EVT_CODE(_AtimDone),
-   GEN_EVT_CODE(_TX_Report),
-   GEN_EVT_CODE(_CCX_Report),  /*15*/
-   GEN_EVT_CODE(_DTM_Report),
-   GEN_EVT_CODE(_TX_Rate_Statistics),
-   GEN_EVT_CODE(_C2HLBK),
-   GEN_EVT_CODE(_FWDBG),
-   GEN_EVT_CODE(_C2HFEEDBACK), /*20*/
-   GEN_EVT_CODE(_ADDBA),
-   GEN_EVT_CODE(_C2HBCN),
-   GEN_EVT_CODE(_ReportPwrState),  /* filen: only for PCIE, USB */
-   GEN_EVT_CODE(_CloseRF), /* filen: only for PCIE,
+   _Read_MACREG_EVT_ = 0, /*0*/
+   _Read_BBREG_EVT_,
+   _Read_RFREG_EVT_,
+   _Read_EEPROM_EVT_,
+   _Read_EFUSE_EVT_,
+   _Read_CAM_EVT_, /*5*/
+   _Get_BasicRate_EVT_,
+   _G

[PATCH 7/8] staging:r8188eu: remove GEN_DRV_CMD_HANDLER macro

2016-09-30 Thread Ivan Safonov
This macro does not used.

Signed-off-by: Ivan Safonov 
---
 drivers/staging/rtl8188eu/include/rtw_mlme_ext.h | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/staging/rtl8188eu/include/rtw_mlme_ext.h 
b/drivers/staging/rtl8188eu/include/rtw_mlme_ext.h
index 80758e1..872a531 100644
--- a/drivers/staging/rtl8188eu/include/rtw_mlme_ext.h
+++ b/drivers/staging/rtl8188eu/include/rtw_mlme_ext.h
@@ -625,7 +625,6 @@ u8 led_blink_hdl(struct adapter *padapter, unsigned char 
*pbuf);
 u8 set_csa_hdl(struct adapter *padapter, unsigned char *pbuf);
 u8 tdls_hdl(struct adapter *padapter, unsigned char *pbuf);
 
-#define GEN_DRV_CMD_HANDLER(size, cmd) {size, &cmd ## _hdl},
 #define GEN_MLME_EXT_HANDLER(size, cmd){size, cmd},
 
 #ifdef _RTW_CMD_C_
-- 
2.7.3

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


[PATCH 1/8] staging:r8188eu: change rtl8188e_process_phy_info function argument type

2016-09-30 Thread Ivan Safonov
prframe is (void *), but function used only with (struct recv_frame *).

Signed-off-by: Ivan Safonov 
---
 drivers/staging/rtl8188eu/hal/rtl8188e_rxdesc.c   | 5 ++---
 drivers/staging/rtl8188eu/include/rtl8188e_recv.h | 3 ++-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/rtl8188eu/hal/rtl8188e_rxdesc.c 
b/drivers/staging/rtl8188eu/hal/rtl8188e_rxdesc.c
index 8aea710..fa2cfd5 100644
--- a/drivers/staging/rtl8188eu/hal/rtl8188e_rxdesc.c
+++ b/drivers/staging/rtl8188eu/hal/rtl8188e_rxdesc.c
@@ -57,10 +57,9 @@ static void process_link_qual(struct adapter *padapter,
signal_stat->avg_val = signal_stat->total_val / signal_stat->total_num;
 }
 
-void rtl8188e_process_phy_info(struct adapter *padapter, void *prframe)
+void rtl8188e_process_phy_info(struct adapter *padapter,
+  struct recv_frame *precvframe)
 {
-   struct recv_frame *precvframe = prframe;
-
/*  Check RSSI */
process_rssi(padapter, precvframe);
/*  Check EVM */
diff --git a/drivers/staging/rtl8188eu/include/rtl8188e_recv.h 
b/drivers/staging/rtl8188eu/include/rtl8188e_recv.h
index 516c6d7..80832a5 100644
--- a/drivers/staging/rtl8188eu/include/rtl8188e_recv.h
+++ b/drivers/staging/rtl8188eu/include/rtl8188e_recv.h
@@ -54,7 +54,8 @@ enum rx_packet_type {
 void rtl8188eu_recv_hdl(struct adapter *padapter, struct recv_buf *precvbuf);
 void rtl8188eu_recv_tasklet(void *priv);
 void rtl8188e_query_rx_phy_status(struct recv_frame *fr, struct phy_stat *phy);
-void rtl8188e_process_phy_info(struct adapter *padapter, void *prframe);
+void rtl8188e_process_phy_info(struct adapter *padapter,
+  struct recv_frame *prframe);
 void update_recvframe_phyinfo_88e(struct recv_frame *fra, struct phy_stat 
*phy);
 void update_recvframe_attrib_88e(struct recv_frame *fra,
 struct recv_stat *stat);
-- 
2.7.3

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


[PATCH 4/8] staging:r8188eu: remove pkt_newalloc member of the recv_buf structure

2016-09-30 Thread Ivan Safonov
This member does not used.

Signed-off-by: Ivan Safonov 
---
 drivers/staging/rtl8188eu/include/rtw_recv.h  | 1 -
 drivers/staging/rtl8188eu/os_dep/recv_linux.c | 1 -
 2 files changed, 2 deletions(-)

diff --git a/drivers/staging/rtl8188eu/include/rtw_recv.h 
b/drivers/staging/rtl8188eu/include/rtw_recv.h
index 758cd16..49d9738 100644
--- a/drivers/staging/rtl8188eu/include/rtw_recv.h
+++ b/drivers/staging/rtl8188eu/include/rtw_recv.h
@@ -239,7 +239,6 @@ struct recv_buf {
 struct recv_frame {
struct list_head list;
struct sk_buff   *pkt;
-   struct sk_buff   *pkt_newalloc;
struct adapter  *adapter;
struct rx_pkt_attrib attrib;
uint  len;
diff --git a/drivers/staging/rtl8188eu/os_dep/recv_linux.c 
b/drivers/staging/rtl8188eu/os_dep/recv_linux.c
index 0c44914..103cdb4 100644
--- a/drivers/staging/rtl8188eu/os_dep/recv_linux.c
+++ b/drivers/staging/rtl8188eu/os_dep/recv_linux.c
@@ -24,7 +24,6 @@
 /* alloc os related resource in struct recv_frame */
 void rtw_os_recv_resource_alloc(struct recv_frame *precvframe)
 {
-   precvframe->pkt_newalloc = NULL;
precvframe->pkt = NULL;
 }
 
-- 
2.7.3

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


[PATCH 3/8] staging:r8188eu: remove rtw_handle_dualmac declaration

2016-09-30 Thread Ivan Safonov
It is a declaration of the non-existent function.

Signed-off-by: Ivan Safonov 
---
 drivers/staging/rtl8188eu/include/drv_types.h | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/staging/rtl8188eu/include/drv_types.h 
b/drivers/staging/rtl8188eu/include/drv_types.h
index c966c8e..32326fd 100644
--- a/drivers/staging/rtl8188eu/include/drv_types.h
+++ b/drivers/staging/rtl8188eu/include/drv_types.h
@@ -177,8 +177,6 @@ struct adapter {
 
 #define adapter_to_dvobj(adapter) (adapter->dvobj)
 
-int rtw_handle_dualmac(struct adapter *adapter, bool init);
-
 static inline u8 *myid(struct eeprom_priv *peepriv)
 {
return peepriv->mac_addr;
-- 
2.7.3

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


[PATCH] staging: rtl8188eu: fix double unlock error in rtw_resume_process()

2016-09-30 Thread Wei Yongjun
Fix following static checker warning:
drivers/staging/rtl8188eu/os_dep/usb_intf.c:311 rtw_resume_process()
error: double unlock 'mutex:&pwrpriv->mutex_lock'

Fixes: eaf47b713b60 ("staging: rtl8188eu: fix missing unlock on
error in rtw_resume_process()")
Reported-By: Dan Carpenter 
Signed-off-by: Wei Yongjun 

diff --git a/drivers/staging/rtl8188eu/os_dep/usb_intf.c 
b/drivers/staging/rtl8188eu/os_dep/usb_intf.c
index b2bc09e..68e1e6b 100644
--- a/drivers/staging/rtl8188eu/os_dep/usb_intf.c
+++ b/drivers/staging/rtl8188eu/os_dep/usb_intf.c
@@ -294,8 +294,10 @@ static int rtw_resume_process(struct adapter *padapter)
pwrpriv->bkeepfwalive = false;
 
pr_debug("bkeepfwalive(%x)\n", pwrpriv->bkeepfwalive);
-   if (pm_netdev_open(pnetdev, true) != 0)
+   if (pm_netdev_open(pnetdev, true) != 0) {
+   mutex_unlock(&pwrpriv->mutex_lock);
goto exit;
+   }
 
netif_device_attach(pnetdev);
netif_carrier_on(pnetdev);
@@ -306,10 +308,8 @@ static int rtw_resume_process(struct adapter *padapter)
 
ret = 0;
 exit:
-   if (pwrpriv) {
+   if (pwrpriv)
pwrpriv->bInSuspend = false;
-   mutex_unlock(&pwrpriv->mutex_lock);
-   }
pr_debug("<===  %s return %d.. in %dms\n", __func__,
ret, jiffies_to_msecs(jiffies - start_time));
 
-- 
2.7.4

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


[PATCH 1/3] staging: greybus: sdio: fix cmd_flags check for none response

2016-09-30 Thread Rui Miguel Silva
When checking for command flags field if response is not available we
really need to compare it with the right define and not bitwise AND it.

smatch warn:
drivers/staging/greybus/sdio.c:481 gb_sdio_command()
warn: bitwise AND condition is false here

Reported-by: Dan Carpenter 
Signed-off-by: Rui Miguel Silva 
---
 drivers/staging/greybus/sdio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/greybus/sdio.c b/drivers/staging/greybus/sdio.c
index c7133b1..5649ef1 100644
--- a/drivers/staging/greybus/sdio.c
+++ b/drivers/staging/greybus/sdio.c
@@ -478,7 +478,7 @@ static int gb_sdio_command(struct gb_sdio_host *host, 
struct mmc_command *cmd)
goto out;
 
/* no response expected */
-   if (cmd_flags & GB_SDIO_RSP_NONE)
+   if (cmd_flags == GB_SDIO_RSP_NONE)
goto out;
 
/* long response expected */
-- 
2.10.0

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


[PATCH 0/3] staging: greybus: smatch warning fixes

2016-09-30 Thread Rui Miguel Silva
Fix several warnings reported by the good tool smatch (another tool to add to
the git pre-commit hook).

They are related to the greybus sdio and light protocol drivers.

Cheers,
   Rui

Rui Miguel Silva (3):
  staging: greybus: sdio: fix cmd_flags check for none response
  staging: greybus: light: fix attributes allocation
  staging: greybus: light: check delay_{on|off} before use

 drivers/staging/greybus/light.c | 5 -
 drivers/staging/greybus/sdio.c  | 2 +-
 2 files changed, 5 insertions(+), 2 deletions(-)

-- 
2.10.0

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


[PATCH 2/3] staging: greybus: light: fix attributes allocation

2016-09-30 Thread Rui Miguel Silva
Fix allocation of attributes with the correct size, this also fix smatch
warning:

drivers/staging/greybus/light.c:293 channel_attr_groups_set()
warn: double check that we're allocating correct size: 8 vs 16

Signed-off-by: Rui Miguel Silva 
---
 drivers/staging/greybus/light.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/greybus/light.c b/drivers/staging/greybus/light.c
index b2847fe..c610d55 100644
--- a/drivers/staging/greybus/light.c
+++ b/drivers/staging/greybus/light.c
@@ -290,7 +290,7 @@ static int channel_attr_groups_set(struct gb_channel 
*channel,
return 0;
 
/* Set attributes based in the channel flags */
-   channel->attrs = kcalloc(size + 1, sizeof(**channel->attrs),
+   channel->attrs = kcalloc(size + 1, sizeof(struct attribute *),
 GFP_KERNEL);
if (!channel->attrs)
return -ENOMEM;
-- 
2.10.0

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


[PATCH 3/3] staging: greybus: light: check delay_{on|off} before use

2016-09-30 Thread Rui Miguel Silva
Even though we trust leds core that the pointers should be valid, we are
safer to check delay_{on|off} before use.

Also, this avoid a smatch warning:
drivers/staging/greybus/light.c:484 gb_blink_set()
warn: variable dereferenced before check 'delay_on' (see line 476)

Signed-off-by: Rui Miguel Silva 
---
 drivers/staging/greybus/light.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/staging/greybus/light.c b/drivers/staging/greybus/light.c
index c610d55..2de9fc3 100644
--- a/drivers/staging/greybus/light.c
+++ b/drivers/staging/greybus/light.c
@@ -464,6 +464,9 @@ static int gb_blink_set(struct led_classdev *cdev, unsigned 
long *delay_on,
if (channel->releasing)
return -ESHUTDOWN;
 
+   if (!delay_on || !delay_off)
+   return -EINVAL;
+
mutex_lock(&channel->lock);
ret = gb_pm_runtime_get_sync(bundle);
if (ret < 0)
-- 
2.10.0

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


[PATCH] staging: greybus: light: check the correct value of delay_on

2016-09-30 Thread Rui Miguel Silva
When checking the value of delay_on to set the channel as active, it was
checked the pointer and not the value, as it should be.

Fixes: cc43368a3c ("greybus: lights: Control runtime pm suspend/resume on AP 
side")

Signed-off-by: Rui Miguel Silva 
---
 drivers/staging/greybus/light.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/greybus/light.c b/drivers/staging/greybus/light.c
index 2de9fc3..a631338 100644
--- a/drivers/staging/greybus/light.c
+++ b/drivers/staging/greybus/light.c
@@ -484,7 +484,7 @@ static int gb_blink_set(struct led_classdev *cdev, unsigned 
long *delay_on,
if (ret < 0)
goto out_pm_put;
 
-   if (delay_on)
+   if (*delay_on)
channel->active = true;
else
channel->active = false;
-- 
2.10.0

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


Re: [PATCH 2/3] staging: greybus: light: fix attributes allocation

2016-09-30 Thread Dan Carpenter
On Fri, Sep 30, 2016 at 06:24:06PM +0100, Rui Miguel Silva wrote:
> Fix allocation of attributes with the correct size, this also fix smatch
> warning:
> 
> drivers/staging/greybus/light.c:293 channel_attr_groups_set()
> warn: double check that we're allocating correct size: 8 vs 16
> 
> Signed-off-by: Rui Miguel Silva 
> ---
>  drivers/staging/greybus/light.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/greybus/light.c b/drivers/staging/greybus/light.c
> index b2847fe..c610d55 100644
> --- a/drivers/staging/greybus/light.c
> +++ b/drivers/staging/greybus/light.c
> @@ -290,7 +290,7 @@ static int channel_attr_groups_set(struct gb_channel 
> *channel,
>   return 0;
>  
>   /* Set attributes based in the channel flags */
> - channel->attrs = kcalloc(size + 1, sizeof(**channel->attrs),
> + channel->attrs = kcalloc(size + 1, sizeof(struct attribute *),

sizeof(*channel->attrs) would also work, no?

regards,
dan carpenter

>GFP_KERNEL);
>   if (!channel->attrs)
>   return -ENOMEM;
> -- 
> 2.10.0
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 2/3] staging: greybus: light: fix attributes allocation

2016-09-30 Thread Rui Miguel Silva

HiDan,
On Fri, Sep 30, 2016 at 09:04:30PM +0300, Dan Carpenter wrote:

On Fri, Sep 30, 2016 at 06:24:06PM +0100, Rui Miguel Silva wrote:

Fix allocation of attributes with the correct size, this also fix smatch
warning:

drivers/staging/greybus/light.c:293 channel_attr_groups_set()
warn: double check that we're allocating correct size: 8 vs 16

Signed-off-by: Rui Miguel Silva 
---
 drivers/staging/greybus/light.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/greybus/light.c b/drivers/staging/greybus/light.c
index b2847fe..c610d55 100644
--- a/drivers/staging/greybus/light.c
+++ b/drivers/staging/greybus/light.c
@@ -290,7 +290,7 @@ static int channel_attr_groups_set(struct gb_channel 
*channel,
return 0;

/* Set attributes based in the channel flags */
-   channel->attrs = kcalloc(size + 1, sizeof(**channel->attrs),
+   channel->attrs = kcalloc(size + 1, sizeof(struct attribute *),


sizeof(*channel->attrs) would also work, no?


Yeah, I had that first, but thought this way would be more explicit.
Looking again to it, the channel one is more correct, will send
v2 with the change.

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


[PATCH v2 0/3] staging: greybus: smatch warning fixes

2016-09-30 Thread Rui Miguel Silva
Fix several warnings reported by the good tool smatch (another tool to add to
the git pre-commit hook).

They are related to the greybus sdio and light protocol drivers.

Cheers,
   Rui

v1 -> v2:
Dan Carpenter:
  . use sizeof channel::attrs pointer instead of struct attribute itself.

Rui Miguel Silva (3):
  staging: greybus: sdio: fix cmd_flags check for none response
  staging: greybus: light: fix attributes allocation
  staging: greybus: light: check delay_{on|off} before use

 drivers/staging/greybus/light.c | 6 --
 drivers/staging/greybus/sdio.c  | 2 +-
 2 files changed, 5 insertions(+), 3 deletions(-)

-- 
2.10.0

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


[PATCH v2 2/3] staging: greybus: light: fix attributes allocation

2016-09-30 Thread Rui Miguel Silva
Fix allocation of attributes with the correct size, this also fix smatch
warning:

drivers/staging/greybus/light.c:293 channel_attr_groups_set()
warn: double check that we're allocating correct size: 8 vs 16

Signed-off-by: Rui Miguel Silva 
---
 drivers/staging/greybus/light.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/staging/greybus/light.c b/drivers/staging/greybus/light.c
index b2847fe..f3cd485 100644
--- a/drivers/staging/greybus/light.c
+++ b/drivers/staging/greybus/light.c
@@ -290,8 +290,7 @@ static int channel_attr_groups_set(struct gb_channel 
*channel,
return 0;
 
/* Set attributes based in the channel flags */
-   channel->attrs = kcalloc(size + 1, sizeof(**channel->attrs),
-GFP_KERNEL);
+   channel->attrs = kcalloc(size + 1, sizeof(*channel->attrs), GFP_KERNEL);
if (!channel->attrs)
return -ENOMEM;
channel->attr_group = kcalloc(1, sizeof(*channel->attr_group),
-- 
2.10.0

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


[PATCH v2 3/3] staging: greybus: light: check delay_{on|off} before use

2016-09-30 Thread Rui Miguel Silva
Even though we trust leds core that the pointers should be valid, we are
safer to check delay_{on|off} before use.

Also, this avoid a smatch warning:
drivers/staging/greybus/light.c:484 gb_blink_set()
warn: variable dereferenced before check 'delay_on' (see line 476)

Signed-off-by: Rui Miguel Silva 
---
 drivers/staging/greybus/light.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/staging/greybus/light.c b/drivers/staging/greybus/light.c
index f3cd485..80dc4a9 100644
--- a/drivers/staging/greybus/light.c
+++ b/drivers/staging/greybus/light.c
@@ -463,6 +463,9 @@ static int gb_blink_set(struct led_classdev *cdev, unsigned 
long *delay_on,
if (channel->releasing)
return -ESHUTDOWN;
 
+   if (!delay_on || !delay_off)
+   return -EINVAL;
+
mutex_lock(&channel->lock);
ret = gb_pm_runtime_get_sync(bundle);
if (ret < 0)
-- 
2.10.0

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


[PATCH v2 1/3] staging: greybus: sdio: fix cmd_flags check for none response

2016-09-30 Thread Rui Miguel Silva
When checking for command flags field if response is not available we
really need to compare it with the right define and not bitwise AND it.

smatch warn:
drivers/staging/greybus/sdio.c:481 gb_sdio_command()
warn: bitwise AND condition is false here

Reported-by: Dan Carpenter 
Signed-off-by: Rui Miguel Silva 
---
 drivers/staging/greybus/sdio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/greybus/sdio.c b/drivers/staging/greybus/sdio.c
index c7133b1..5649ef1 100644
--- a/drivers/staging/greybus/sdio.c
+++ b/drivers/staging/greybus/sdio.c
@@ -478,7 +478,7 @@ static int gb_sdio_command(struct gb_sdio_host *host, 
struct mmc_command *cmd)
goto out;
 
/* no response expected */
-   if (cmd_flags & GB_SDIO_RSP_NONE)
+   if (cmd_flags == GB_SDIO_RSP_NONE)
goto out;
 
/* long response expected */
-- 
2.10.0

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


RE: [PATCH] hv: do not lose pending heartbeat vmbus packets

2016-09-30 Thread Long Li


> -Original Message-
> From: Vitaly Kuznetsov [mailto:vkuzn...@redhat.com]
> Sent: Thursday, September 29, 2016 2:22 AM
> To: KY Srinivasan ; Long Li 
> Cc: Haiyang Zhang ;
> de...@linuxdriverproject.org; linux-ker...@vger.kernel.org
> Subject: Re: [PATCH] hv: do not lose pending heartbeat vmbus packets
> 
> Long Li  writes:
> 
> > From: Long Li 
> >
> > The host keeps sending heartbeat packets independent of guest
> responding to them. In some situations, there might be multiple heartbeat
> packets pending in the ring buffer. Don't lose them, read them all.
> >
> > Signed-off-by: Long Li 
> 
> Long, K. Y.,
> 
> it seems this patch didn't make it to char-misc tree and it looks like an
> important fix. A couple of nitpicks below,
> 
> > ---
> >  drivers/hv/hv_util.c | 10 +++---
> >  1 file changed, 7 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/hv/hv_util.c b/drivers/hv/hv_util.c index
> > d5acaa2..9dc6372 100644
> > --- a/drivers/hv/hv_util.c
> > +++ b/drivers/hv/hv_util.c
> > @@ -283,10 +283,14 @@ static void heartbeat_onchannelcallback(void
> *context)
> > u8 *hbeat_txf_buf = util_heartbeat.recv_buffer;
> > struct icmsg_negotiate *negop = NULL;
> >
> > -   vmbus_recvpacket(channel, hbeat_txf_buf,
> > -PAGE_SIZE, &recvlen, &requestid);
> > +   while (1) {
> > +
> > +   vmbus_recvpacket(channel, hbeat_txf_buf,
> > +PAGE_SIZE, &recvlen, &requestid);
> 
> We should check vmbus_recvpacket() return value as well. E.g.
> hv_ringbuffer_read() may return -EAGAIN in case we didn't receive the
> whole packet (and we do this check in other drivers, see
> storvsc_on_channel_callback() for example).

I agree with you,  we should check for -EAGAIN. This should also be done in 
storvsc_on_channel_callback.

I think the chance of  hv_ringbuffer_read() returning -EAGAIN is almost zero. 
Because read_index and write_index are updated after the whole packet is 
written to the ring buffer, and protected by memory barriers. So getting a 
partial read is impossible, unless the host is doing something wrong.

Checking for recvlen is safe, because it's always set to 0 at the beginning of 
hv_ringbuffer_read().

Anyway, we should check for -EAGAIN for all hyperv drivers on read. I think 
this is a separate issue on how we deal with a buggy host. Will send another 
set of patches .

> 
> > +
> > +   if (!recvlen)
> 
> so this should be 'if (ret || !recvlen)'
> 
> > +   break;
> >
> > -   if (recvlen > 0) {
> > icmsghdrp = (struct icmsg_hdr *)&hbeat_txf_buf[
> > sizeof(struct vmbuspipe_hdr)];
> 
> --
>   Vitaly
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 2/2] staging: vt6656: Make 'rx_rate' u8 instead of u8 *

2016-09-30 Thread Malcolm Priestley

On 28/09/16 08:40, Dan Carpenter wrote:

On Tue, Sep 27, 2016 at 02:52:49PM -0300, Martin Alonso wrote:

Change the type and uses of rx_rate.

Signed-off-by: Martin Alonso 
---
 drivers/staging/vt6656/dpc.c | 9 +
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/vt6656/dpc.c b/drivers/staging/vt6656/dpc.c
index 655f000..782b7d7 100644
--- a/drivers/staging/vt6656/dpc.c
+++ b/drivers/staging/vt6656/dpc.c
@@ -46,7 +46,8 @@ int vnt_rx_data(struct vnt_private *priv, struct vnt_rcb 
*ptr_rcb,
__le64 *tsf_time;
u32 frame_size;
int ii, r;
-   u8 *rx_rate, *sq, *sq_3;
+   u8 rx_rate;
+   u8 *sq, *sq_3;
u32 wbk_status;
u8 *skb_data;
u16 *pay_load_len;
@@ -75,7 +76,7 @@ int vnt_rx_data(struct vnt_private *priv, struct vnt_rcb 
*ptr_rcb,

skb_data = (u8 *)skb->data;

-   rx_rate = skb_data + 5;
+   rx_rate = *(skb_data + 5);


It occurs to me that we don't check that skb->len is large enough here.
We just assume it has at least 5 bytes.

TODO: vt6656: verify skb->len before using it.


skb->len is always set to the tail room then trimmed by this function.

Regards

Malcolm
































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


[PATCH] Staging: rts5208: Fix indentation warnings

2016-09-30 Thread Wayne Porter
Fix code indentation warnings detected by checkpatch.pl

Signed-off-by: Wayne Porter 
---
 drivers/staging/rts5208/ms.c | 26 +-
 1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/drivers/staging/rts5208/ms.c b/drivers/staging/rts5208/ms.c
index 9fc64da..f27df0b 100644
--- a/drivers/staging/rts5208/ms.c
+++ b/drivers/staging/rts5208/ms.c
@@ -63,12 +63,12 @@ static int ms_transfer_tpc(struct rtsx_chip *chip, u8 
trans_mode,
rtsx_add_cmd(chip, WRITE_REG_CMD, MS_BYTE_CNT, 0xFF, cnt);
rtsx_add_cmd(chip, WRITE_REG_CMD, MS_TRANS_CFG, 0xFF, cfg);
rtsx_add_cmd(chip, WRITE_REG_CMD, CARD_DATA_SOURCE,
-   0x01, PINGPONG_BUFFER);
+0x01, PINGPONG_BUFFER);
 
rtsx_add_cmd(chip, WRITE_REG_CMD, MS_TRANSFER,
-   0xFF, MS_TRANSFER_START | trans_mode);
+0xFF, MS_TRANSFER_START | trans_mode);
rtsx_add_cmd(chip, CHECK_REG_CMD, MS_TRANSFER,
-   MS_TRANSFER_END, MS_TRANSFER_END);
+MS_TRANSFER_END, MS_TRANSFER_END);
 
rtsx_add_cmd(chip, READ_REG_CMD, MS_TRANS_CFG, 0, 0);
 
@@ -109,8 +109,8 @@ static int ms_transfer_tpc(struct rtsx_chip *chip, u8 
trans_mode,
 }
 
 static int ms_transfer_data(struct rtsx_chip *chip, u8 trans_mode,
-   u8 tpc, u16 sec_cnt, u8 cfg, bool mode_2k,
-   int use_sg, void *buf, int buf_len)
+   u8 tpc, u16 sec_cnt, u8 cfg, bool mode_2k,
+   int use_sg, void *buf, int buf_len)
 {
int retval;
u8 val, err_code = 0;
@@ -206,7 +206,7 @@ static int ms_write_bytes(struct rtsx_chip *chip,
rtsx_add_cmd(chip, WRITE_REG_CMD, MS_BYTE_CNT, 0xFF, cnt);
rtsx_add_cmd(chip, WRITE_REG_CMD, MS_TRANS_CFG, 0xFF, cfg);
rtsx_add_cmd(chip, WRITE_REG_CMD, CARD_DATA_SOURCE,
-   0x01, PINGPONG_BUFFER);
+0x01, PINGPONG_BUFFER);
 
rtsx_add_cmd(chip, WRITE_REG_CMD,
 MS_TRANSFER, 0xFF, MS_TRANSFER_START | MS_TM_WRITE_BYTES);
@@ -253,7 +253,7 @@ static int ms_write_bytes(struct rtsx_chip *chip,
 }
 
 static int ms_read_bytes(struct rtsx_chip *chip,
-   u8 tpc, u8 cnt, u8 cfg, u8 *data, int data_len)
+u8 tpc, u8 cnt, u8 cfg, u8 *data, int data_len)
 {
struct ms_info *ms_card = &chip->ms_card;
int retval, i;
@@ -270,12 +270,12 @@ static int ms_read_bytes(struct rtsx_chip *chip,
rtsx_add_cmd(chip, WRITE_REG_CMD, MS_BYTE_CNT, 0xFF, cnt);
rtsx_add_cmd(chip, WRITE_REG_CMD, MS_TRANS_CFG, 0xFF, cfg);
rtsx_add_cmd(chip, WRITE_REG_CMD, CARD_DATA_SOURCE,
-   0x01, PINGPONG_BUFFER);
+0x01, PINGPONG_BUFFER);
 
rtsx_add_cmd(chip, WRITE_REG_CMD, MS_TRANSFER, 0xFF,
-   MS_TRANSFER_START | MS_TM_READ_BYTES);
+MS_TRANSFER_START | MS_TM_READ_BYTES);
rtsx_add_cmd(chip, CHECK_REG_CMD, MS_TRANSFER,
-   MS_TRANSFER_END, MS_TRANSFER_END);
+MS_TRANSFER_END, MS_TRANSFER_END);
 
for (i = 0; i < data_len - 1; i++)
rtsx_add_cmd(chip, READ_REG_CMD, PPBUF_BASE2 + i, 0, 0);
@@ -284,7 +284,7 @@ static int ms_read_bytes(struct rtsx_chip *chip,
rtsx_add_cmd(chip, READ_REG_CMD, PPBUF_BASE2 + data_len, 0, 0);
else
rtsx_add_cmd(chip, READ_REG_CMD, PPBUF_BASE2 + data_len - 1,
-   0, 0);
+0, 0);
 
retval = rtsx_send_cmd(chip, MS_CARD, 5000);
if (retval < 0) {
@@ -334,8 +334,8 @@ static int ms_read_bytes(struct rtsx_chip *chip,
return STATUS_SUCCESS;
 }
 
-static int ms_set_rw_reg_addr(struct rtsx_chip *chip,
-   u8 read_start, u8 read_cnt, u8 write_start, u8 write_cnt)
+static int ms_set_rw_reg_addr(struct rtsx_chip *chip, u8 read_start,
+ u8 read_cnt, u8 write_start, u8 write_cnt)
 {
int retval, i;
u8 data[4];
-- 
2.1.4



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


Re: [PATCH 2/2] staging: vt6656: Make 'rx_rate' u8 instead of u8 *

2016-09-30 Thread Dan Carpenter
On Fri, Sep 30, 2016 at 07:53:00PM +0100, Malcolm Priestley wrote:
> On 28/09/16 08:40, Dan Carpenter wrote:
> >On Tue, Sep 27, 2016 at 02:52:49PM -0300, Martin Alonso wrote:
> >>Change the type and uses of rx_rate.
> >>
> >>Signed-off-by: Martin Alonso 
> >>---
> >> drivers/staging/vt6656/dpc.c | 9 +
> >> 1 file changed, 5 insertions(+), 4 deletions(-)
> >>
> >>diff --git a/drivers/staging/vt6656/dpc.c b/drivers/staging/vt6656/dpc.c
> >>index 655f000..782b7d7 100644
> >>--- a/drivers/staging/vt6656/dpc.c
> >>+++ b/drivers/staging/vt6656/dpc.c
> >>@@ -46,7 +46,8 @@ int vnt_rx_data(struct vnt_private *priv, struct vnt_rcb 
> >>*ptr_rcb,
> >>__le64 *tsf_time;
> >>u32 frame_size;
> >>int ii, r;
> >>-   u8 *rx_rate, *sq, *sq_3;
> >>+   u8 rx_rate;
> >>+   u8 *sq, *sq_3;
> >>u32 wbk_status;
> >>u8 *skb_data;
> >>u16 *pay_load_len;
> >>@@ -75,7 +76,7 @@ int vnt_rx_data(struct vnt_private *priv, struct vnt_rcb 
> >>*ptr_rcb,
> >>
> >>skb_data = (u8 *)skb->data;
> >>
> >>-   rx_rate = skb_data + 5;
> >>+   rx_rate = *(skb_data + 5);
> >
> >It occurs to me that we don't check that skb->len is large enough here.
> >We just assume it has at least 5 bytes.
> >
> >TODO: vt6656: verify skb->len before using it.
> 
> skb->len is always set to the tail room then trimmed by this function.
> 

We call skb_trim() after assuming it's at least 5 bytes so that doesn't
matter for this discussion?

regards,
dan carpenter

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


[PATCH] Staging:dgnc:dgnc_neo: fixed 80 character line limit coding style issue

2016-09-30 Thread Nadim Almas
Fixed coding style issue.

Signed-off-by: Nadim Almas 
---
 drivers/staging/dgnc/dgnc_neo.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/dgnc/dgnc_neo.c b/drivers/staging/dgnc/dgnc_neo.c
index e794056..bc15584 100644
--- a/drivers/staging/dgnc/dgnc_neo.c
+++ b/drivers/staging/dgnc/dgnc_neo.c
@@ -554,7 +554,8 @@ static inline void neo_parse_lsr(struct dgnc_board *brd, 
uint port)
 * Rx Oruns. Exar says that an orun will NOT corrupt
 * the FIFO. It will just replace the holding register
 * with this new data byte. So basically just ignore this.
-* Probably we should eventually have an orun stat in our 
driver...
+* Probably we should eventually have an orun stat in our
+* driver...
 */
ch->ch_err_overrun++;
}
-- 
2.7.4

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


[PATCH] ion_test: remove extra line per checkpatch.pl

2016-09-30 Thread Wayne Porter
Cleanup extra line found by checkpatch.pl

Signed-off-by: Wayne Porter 
---
 drivers/staging/android/uapi/ion_test.h | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/staging/android/uapi/ion_test.h 
b/drivers/staging/android/uapi/ion_test.h
index ffef06f..480242e 100644
--- a/drivers/staging/android/uapi/ion_test.h
+++ b/drivers/staging/android/uapi/ion_test.h
@@ -66,5 +66,4 @@ struct ion_test_rw_data {
 #define ION_IOC_TEST_KERNEL_MAPPING \
_IOW(ION_IOC_MAGIC, 0xf2, struct ion_test_rw_data)
 
-
 #endif /* _UAPI_LINUX_ION_H */
-- 
2.1.4



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


[PATCH] staging: android: ion: fix checks found by checkpatch.pl

2016-09-30 Thread Wayne Porter
Alignment fixes

Signed-off-by: Wayne Porter 
---
 drivers/staging/android/ion/hisilicon/hi6220_ion.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/android/ion/hisilicon/hi6220_ion.c 
b/drivers/staging/android/ion/hisilicon/hi6220_ion.c
index 659aa71..a2f2611 100644
--- a/drivers/staging/android/ion/hisilicon/hi6220_ion.c
+++ b/drivers/staging/android/ion/hisilicon/hi6220_ion.c
@@ -29,11 +29,11 @@ struct hisi_ion_dev {
 
 static struct ion_of_heap hisi_heaps[] = {
PLATFORM_HEAP("hisilicon,sys_user", 0,
-   ION_HEAP_TYPE_SYSTEM, "sys_user"),
+ ION_HEAP_TYPE_SYSTEM, "sys_user"),
PLATFORM_HEAP("hisilicon,sys_contig", 1,
-   ION_HEAP_TYPE_SYSTEM_CONTIG, "sys_contig"),
+ ION_HEAP_TYPE_SYSTEM_CONTIG, "sys_contig"),
PLATFORM_HEAP("hisilicon,cma", ION_HEAP_TYPE_DMA, ION_HEAP_TYPE_DMA,
-   "cma"),
+ "cma"),
{}
 };
 
@@ -57,7 +57,7 @@ static int hi6220_ion_probe(struct platform_device *pdev)
return PTR_ERR(ipdev->data);
 
ipdev->heaps = devm_kzalloc(&pdev->dev,
-   sizeof(struct ion_heap)*ipdev->data->nr,
+   sizeof(struct ion_heap) * ipdev->data->nr,
GFP_KERNEL);
if (!ipdev->heaps) {
ion_destroy_platform_data(ipdev->data);
-- 
2.1.4



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


[PATCH] staging: android: ion: fix warning found by checkpatch.pl

2016-09-30 Thread Wayne Porter
Fix checkpatch.pl warning:
WARNING: braces {} are not necessary for single statement blocks

Signed-off-by: Wayne Porter 
---
 drivers/staging/android/ion/hisilicon/hi6220_ion.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/android/ion/hisilicon/hi6220_ion.c 
b/drivers/staging/android/ion/hisilicon/hi6220_ion.c
index a2f2611..0de7897 100644
--- a/drivers/staging/android/ion/hisilicon/hi6220_ion.c
+++ b/drivers/staging/android/ion/hisilicon/hi6220_ion.c
@@ -82,9 +82,9 @@ static int hi6220_ion_remove(struct platform_device *pdev)
 
ipdev = platform_get_drvdata(pdev);
 
-   for (i = 0; i < ipdev->data->nr; i++) {
+   for (i = 0; i < ipdev->data->nr; i++)
ion_heap_destroy(ipdev->heaps[i]);
-   }
+
ion_destroy_platform_data(ipdev->data);
ion_device_destroy(ipdev->idev);
 
-- 
2.1.4



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