Re: [PATCH] Add new uio device for PCI with dynamic memory allocation

2017-10-04 Thread Stahl, Manuel
Hi Dan. Thanks for your comments. I can fix all of those.
Probably there is also some upgrade needed for the MSI stuff.
pci_disable_msi() is not there anymore, so I have to use
pci_alloc_irq_vectors(). Doing tests with my PCIe HW I had some
problems with masking the legacy IRQs. Probably uio_pci_generic
suffers from the same problems.

Can someone tell me how to properly handle legacy and MSI
interrupts in irqhandler()? Or should I implement a irqcontrol()
function?

Best regards,
Manuel Stahl

On Di, 2017-10-03 at 12:48 +0300, Dan Carpenter wrote:
> Looks good.  A couple minor comments below.
> 
> On Mon, Oct 02, 2017 at 03:02:09PM +, Stahl, Manuel wrote:
> > +static int open(struct uio_info *info, struct inode *inode)
> > +{
> > +   struct uio_pci_dmem_dev *priv = to_uio_pci_dmem_dev(info);
> > +   struct uio_mem *uiomem;
> > +   int ret = 0;
> > +   int dmem_region = 0;
> > +
> > +   uiomem = &priv->info.mem[dmem_region];
> > +
> > +   mutex_lock(&priv->alloc_lock);
> > +   while (!priv->refcnt && uiomem < &priv->info.mem[MAX_UIO_MAPS]) {
> > +   void *addr;
> > +
> > +   if (!uiomem->size)
> > +   break;
> > +
> > +   addr = dma_alloc_coherent(&priv->pdev->dev, uiomem->size,
> > +     (dma_addr_t *)&uiomem->addr,
> > +     GFP_KERNEL);
> > +   if (!addr)
> > +   uiomem->addr = DMEM_MAP_ERROR;
> > +
> > +   priv->dmem_region_vaddr[dmem_region++] = addr;
> > +   ++uiomem;
> > +   }
> > +   if (pci_check_and_mask_intx(priv->pdev))
> > +   dev_info(&priv->pdev->dev, "Found pending interrupt");
> > +
> > +   if (!priv->refcnt)
> > +   pci_set_master(priv->pdev);
> > +
> > +   priv->refcnt++;
> > +
> > +   mutex_unlock(&priv->alloc_lock);
> > +
> > +   return ret;
> 
> Just "return 0;" is more readable/explicit than "return ret;".
> 
> > +}
> > +
> > +static int release(struct uio_info *info, struct inode *inode)
> > +{
> > +   struct uio_pci_dmem_dev *priv = to_uio_pci_dmem_dev(info);
> > +   struct uio_mem *uiomem;
> > +   int dmem_region = 0;
> > +
> > +   uiomem = &priv->info.mem[dmem_region];
> > +
> > +   mutex_lock(&priv->alloc_lock);
> > +
> > +   priv->refcnt--;
> > +   while (!priv->refcnt && uiomem < &priv->info.mem[MAX_UIO_MAPS]) {
> > +   if (!uiomem->size)
> > +   break;
> 
> I think this needs to be a continue instead of a break to match
> parse_dmem_entries() since we don't break for size == 0 in that loop.
> 
> > +   if (priv->dmem_region_vaddr[dmem_region]) {
> > +   dma_free_coherent(&priv->pdev->dev, uiomem->size,
> > +     priv->dmem_region_vaddr[dmem_region],
> > +     uiomem->addr);
> > +   }
> > +   uiomem->addr = DMEM_MAP_ERROR;
> > +   ++dmem_region;
> > +   ++uiomem;
> > +   }
> > +   if (pci_check_and_mask_intx(priv->pdev))
> > +   dev_info(&priv->pdev->dev, "Found pending interrupt");
> > +
> > +   if (!priv->refcnt)
> > +   pci_clear_master(priv->pdev);
> > +
> > +   mutex_unlock(&priv->alloc_lock);
> > +   return 0;
> > +}
> > +
> > +static int dmem_mmap(struct uio_info *info, struct vm_area_struct *vma)
> > +{
> > +   struct uio_pci_dmem_dev *gdev = to_uio_pci_dmem_dev(info->priv);
> > +   struct uio_mem *uiomem;
> > +   int mi = vma->vm_pgoff;
> > +
> > +   if (mi >= MAX_UIO_MAPS)
> > +   return -EINVAL;
> > +
> > +   uiomem = &info->mem[mi];
> > +   if (uiomem->memtype != UIO_MEM_PHYS)
> > +   return -EINVAL;
> > +   if (!uiomem->size)
> > +   return -EINVAL;
> > +
> > +   /* DMA address */
> > +   vma->vm_pgoff = 0;
> > +   return dma_mmap_coherent(&gdev->pdev->dev, vma,
> > +    gdev->dmem_region_vaddr[mi],
> > +    uiomem->addr, uiomem->size);
> > +}
> > +
> > +/* Interrupt handler. Read/modify/write the command register to disable the
> > + * interrupt.
> > + */
> > +static irqreturn_t irqhandler(int irq, struct uio_info *info)
> > +{
> > +   struct uio_pci_dmem_dev *gdev = to_uio_pci_dmem_dev(info);
> > +
> > +   if (gdev->pdev->msi_enabled)
> > +   return IRQ_HANDLED;
> > +
> > +   if (pci_check_and_mask_intx(gdev->pdev))
> > +   return IRQ_HANDLED;
> > +
> > +   return IRQ_NONE;
> > +}
> > +
> > +static unsigned int uio_dmem_dma_bits = 32;
> > +static char uio_dmem_sizes[256];
> > +
> > +static int parse_dmem_entries(struct pci_dev *pdev,
> > +     const struct pci_device_id *id,
> > +     struct uio_pci_dmem_dev *gdev)
> > +{
> > +   int ret;
> > +   u32 regions = 0;
> > +   u32 vendor, device;
> > +   char *s, *tok, *sizes = NULL;
> > +   unsigned long long size;
> > +   struct uio_mem *uiomem;
> > +   char * const buf = kstrdup(uio_dmem_sizes, GFP_KERNEL);
> > +
> > +   if (!buf) {
> > +   ret = -ENOMEM;
> > +

[PATCH v3] staging: ccree: Convert to platform_{get,set}_drvdata()

2017-10-04 Thread sunil . m
From: Suniel Mahesh 

Platform devices are expected to use wrapper functions,
platform_{get,set}_drvdata() with platform_device as argument,
for getting and setting the driver data. dev_{get,set}_drvdata()
are using &plat_dev->dev.
For wrapper functions we can directly pass a struct platform_device.

dev_set_drvdata() is redundant and therefore removed. The driver core
clears the driver data to NULL after device_release or on probe failure.

Signed-off-by: Suniel Mahesh 
---
Changes for v3:
- Rebased on top of staging-testing as suggested by Greg KH.
- Patch was tested and built(ARCH=arm) on staging-testing.
---
Changes for v2:
- Rebased on top of staging-testing.
---
Note:
- No build issues reported, however it was not tested on
  real hardware.
---
 drivers/staging/ccree/ssi_driver.c | 6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/ccree/ssi_driver.c 
b/drivers/staging/ccree/ssi_driver.c
index 795a087..5f03c25 100644
--- a/drivers/staging/ccree/ssi_driver.c
+++ b/drivers/staging/ccree/ssi_driver.c
@@ -215,7 +215,7 @@ static int init_cc_resources(struct platform_device 
*plat_dev)
rc = -ENOMEM;
goto post_drvdata_err;
}
-   dev_set_drvdata(dev, new_drvdata);
+   platform_set_drvdata(plat_dev, new_drvdata);
new_drvdata->plat_dev = plat_dev;
 
new_drvdata->clk = of_clk_get(np, 0);
@@ -393,7 +393,6 @@ static int init_cc_resources(struct platform_device 
*plat_dev)
cc_clk_off(new_drvdata);
 post_drvdata_err:
dev_err(dev, "ccree init error occurred!\n");
-   dev_set_drvdata(dev, NULL);
return rc;
 }
 
@@ -407,7 +406,7 @@ void fini_cc_regs(struct ssi_drvdata *drvdata)
 static void cleanup_cc_resources(struct platform_device *plat_dev)
 {
struct ssi_drvdata *drvdata =
-   (struct ssi_drvdata *)dev_get_drvdata(&plat_dev->dev);
+   (struct ssi_drvdata *)platform_get_drvdata(plat_dev);
 
ssi_aead_free(drvdata);
ssi_hash_free(drvdata);
@@ -423,7 +422,6 @@ static void cleanup_cc_resources(struct platform_device 
*plat_dev)
 #endif
fini_cc_regs(drvdata);
cc_clk_off(drvdata);
-   dev_set_drvdata(&plat_dev->dev, NULL);
 }
 
 int cc_clk_on(struct ssi_drvdata *drvdata)
-- 
1.9.1

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


Re: [PATCH] Add new uio device for PCI with dynamic memory allocation

2017-10-04 Thread Dan Carpenter
On Wed, Oct 04, 2017 at 07:24:49AM +, Stahl, Manuel wrote:
> Hi Dan. Thanks for your comments. I can fix all of those.
> Probably there is also some upgrade needed for the MSI stuff.
> pci_disable_msi() is not there anymore, so I have to use
> pci_alloc_irq_vectors(). Doing tests with my PCIe HW I had some
> problems with masking the legacy IRQs. Probably uio_pci_generic
> suffers from the same problems.
> 
> Can someone tell me how to properly handle legacy and MSI
> interrupts in irqhandler()? Or should I implement a irqcontrol()
> function?
>

These questions about above my pay grade.  I've never used the code, I
just do mechanical reviews.  I'm not certain who to ask either...

regards,
dan carpenter

 
> Best regards,
> Manuel Stahl
> 
> On Di, 2017-10-03 at 12:48 +0300, Dan Carpenter wrote:
> > Looks good.  A couple minor comments below.
> > 
> > On Mon, Oct 02, 2017 at 03:02:09PM +, Stahl, Manuel wrote:
> > > +static int open(struct uio_info *info, struct inode *inode)
> > > +{
> > > + struct uio_pci_dmem_dev *priv = to_uio_pci_dmem_dev(info);
> > > + struct uio_mem *uiomem;
> > > + int ret = 0;
> > > + int dmem_region = 0;
> > > +
> > > + uiomem = &priv->info.mem[dmem_region];
> > > +
> > > + mutex_lock(&priv->alloc_lock);
> > > + while (!priv->refcnt && uiomem < &priv->info.mem[MAX_UIO_MAPS]) {
> > > + void *addr;
> > > +
> > > + if (!uiomem->size)
> > > + break;
> > > +
> > > + addr = dma_alloc_coherent(&priv->pdev->dev, uiomem->size,
> > > +   (dma_addr_t *)&uiomem->addr,
> > > +   GFP_KERNEL);
> > > + if (!addr)
> > > + uiomem->addr = DMEM_MAP_ERROR;
> > > +
> > > + priv->dmem_region_vaddr[dmem_region++] = addr;
> > > + ++uiomem;
> > > + }
> > > + if (pci_check_and_mask_intx(priv->pdev))
> > > + dev_info(&priv->pdev->dev, "Found pending interrupt");
> > > +
> > > + if (!priv->refcnt)
> > > + pci_set_master(priv->pdev);
> > > +
> > > + priv->refcnt++;
> > > +
> > > + mutex_unlock(&priv->alloc_lock);
> > > +
> > > + return ret;
> > 
> > Just "return 0;" is more readable/explicit than "return ret;".
> > 
> > > +}
> > > +
> > > +static int release(struct uio_info *info, struct inode *inode)
> > > +{
> > > + struct uio_pci_dmem_dev *priv = to_uio_pci_dmem_dev(info);
> > > + struct uio_mem *uiomem;
> > > + int dmem_region = 0;
> > > +
> > > + uiomem = &priv->info.mem[dmem_region];
> > > +
> > > + mutex_lock(&priv->alloc_lock);
> > > +
> > > + priv->refcnt--;
> > > + while (!priv->refcnt && uiomem < &priv->info.mem[MAX_UIO_MAPS]) {
> > > + if (!uiomem->size)
> > > + break;
> > 
> > I think this needs to be a continue instead of a break to match
> > parse_dmem_entries() since we don't break for size == 0 in that loop.
> > 
> > > + if (priv->dmem_region_vaddr[dmem_region]) {
> > > + dma_free_coherent(&priv->pdev->dev, uiomem->size,
> > > +   priv->dmem_region_vaddr[dmem_region],
> > > +   uiomem->addr);
> > > + }
> > > + uiomem->addr = DMEM_MAP_ERROR;
> > > + ++dmem_region;
> > > + ++uiomem;
> > > + }
> > > + if (pci_check_and_mask_intx(priv->pdev))
> > > + dev_info(&priv->pdev->dev, "Found pending interrupt");
> > > +
> > > + if (!priv->refcnt)
> > > + pci_clear_master(priv->pdev);
> > > +
> > > + mutex_unlock(&priv->alloc_lock);
> > > + return 0;
> > > +}
> > > +
> > > +static int dmem_mmap(struct uio_info *info, struct vm_area_struct *vma)
> > > +{
> > > + struct uio_pci_dmem_dev *gdev = to_uio_pci_dmem_dev(info->priv);
> > > + struct uio_mem *uiomem;
> > > + int mi = vma->vm_pgoff;
> > > +
> > > + if (mi >= MAX_UIO_MAPS)
> > > + return -EINVAL;
> > > +
> > > + uiomem = &info->mem[mi];
> > > + if (uiomem->memtype != UIO_MEM_PHYS)
> > > + return -EINVAL;
> > > + if (!uiomem->size)
> > > + return -EINVAL;
> > > +
> > > + /* DMA address */
> > > + vma->vm_pgoff = 0;
> > > + return dma_mmap_coherent(&gdev->pdev->dev, vma,
> > > +  gdev->dmem_region_vaddr[mi],
> > > +  uiomem->addr, uiomem->size);
> > > +}
> > > +
> > > +/* Interrupt handler. Read/modify/write the command register to disable 
> > > the
> > > + * interrupt.
> > > + */
> > > +static irqreturn_t irqhandler(int irq, struct uio_info *info)
> > > +{
> > > + struct uio_pci_dmem_dev *gdev = to_uio_pci_dmem_dev(info);
> > > +
> > > + if (gdev->pdev->msi_enabled)
> > > + return IRQ_HANDLED;
> > > +
> > > + if (pci_check_and_mask_intx(gdev->pdev))
> > > + return IRQ_HANDLED;
> > > +
> > > + return IRQ_NONE;
> > > +}
> > > +
> > > +static unsigned int uio_dmem_dma_bits = 32;
> > > +static char uio_dmem_sizes[256];
> > > +
> > > +static int parse_dmem_entries(struct pci_dev *pdev,
> > > +   const struct pci_device_id *id,
>

Re: [PATCH 2/2] Drivers: hv: vmbus: Expose per-channel interrupts and events counters

2017-10-04 Thread Greg KH
On Thu, Sep 21, 2017 at 08:58:50PM -0700, k...@exchange.microsoft.com wrote:
> From: Stephen Hemminger 
> 
> When investigating performance, it is useful to be able to look at
> the number of host and guest events per-channel. This is equivalent
> to per-device interrupt statistics.
> 
> Signed-off-by: Stephen Hemminger 
> Signed-off-by: K. Y. Srinivasan 
> ---
>  Documentation/ABI/stable/sysfs-bus-vmbus | 14 ++
>  drivers/hv/connection.c  |  2 ++
>  drivers/hv/vmbus_drv.c   | 18 ++
>  include/linux/hyperv.h   |  4 
>  4 files changed, 38 insertions(+)

This patch didn't apply to my tree, can you rebase and resend it?

thanks,

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


[PATCH] Staging: rtl8723bs: Externs should be avoided in .C file

2017-10-04 Thread Srinivasan Shanmugam
This patch fixes the following checkpatch.pl warning.
WARNING: externs should be avoided in .c files

Signed-off-by: Srinivasan Shanmugam 
---
 drivers/staging/rtl8723bs/core/rtw_ap.c | 6 --
 1 file changed, 6 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_ap.c 
b/drivers/staging/rtl8723bs/core/rtw_ap.c
index 0b530ea..c66fed1 100644
--- a/drivers/staging/rtl8723bs/core/rtw_ap.c
+++ b/drivers/staging/rtl8723bs/core/rtw_ap.c
@@ -17,12 +17,6 @@
 #include 
 #include 
 
-extern unsigned char RTW_WPA_OUI[];
-extern unsigned char WMM_OUI[];
-extern unsigned char WPS_OUI[];
-extern unsigned char P2P_OUI[];
-extern unsigned char WFD_OUI[];
-
 void init_mlme_ap_info(struct adapter *padapter)
 {
struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
-- 
1.9.1

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


Re: [PATCH] Add new uio device for PCI with dynamic memory allocation

2017-10-04 Thread Stahl, Manuel
On Mi, 2017-10-04 at 10:59 +0300, Dan Carpenter wrote:
> On Wed, Oct 04, 2017 at 07:24:49AM +, Stahl, Manuel wrote:
> > Hi Dan. Thanks for your comments. I can fix all of those.
> > Probably there is also some upgrade needed for the MSI stuff.
> > pci_disable_msi() is not there anymore, so I have to use
> > pci_alloc_irq_vectors(). Doing tests with my PCIe HW I had some
> > problems with masking the legacy IRQs. Probably uio_pci_generic
> > suffers from the same problems.
> > 
> > Can someone tell me how to properly handle legacy and MSI
> > interrupts in irqhandler()? Or should I implement a irqcontrol()
> > function?
> > 
> 
> These questions about above my pay grade.  I've never used the code, I
> just do mechanical reviews.  I'm not certain who to ask either...
> 

Alright. I checked again your comments. Some are copy&paste from the
other drivers, but I can improve this. Some cannot be changed:

1) continue instead of break:
Actually size=0 makes no sense for the maps, so open() and release()
take this as abort condition (see also uio_dmem_genirq.c). The parser
continues in that case, but we could break there as well.

2) char * const buf = kstrdup(uio_dmem_sizes, GFP_KERNEL);
Since buf is a const pointer, it has to be set during declaration.
Also I'd like to keep it const.

I will post another patch set without MSI (just the same functionality
as in uio_pci_generic) and then try to add MSI(X) support to both.

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


Re: [PATCH v2] Add new uio device for PCI with dynamic memory allocation

2017-10-04 Thread Stahl, Manuel
From 51081d316eb3078bf9ded4335fb6f5167e1ec93d Mon Sep 17 00:00:00 2001
From: Manuel Stahl 
Date: Mon, 2 Oct 2017 16:23:19 +0200
Subject: [PATCH] Add new uio device for PCI with dynamic memory allocation

This device combines the uio_pci_generic driver and the uio_dmem_genirq
driver since PCI uses a slightly different API for interrupts.
A fixed number of DMA capable memory regions can be defined using the
module parameter "dmem_sizes". The memory is not allocated until the uio
device file is opened for the first time. When the device file is closed,
the allocated memory block is freed. Physical (DMA) addresses for the
dynamic regions are provided to the userspace via
/sys/class/uio/uioX/maps/mapY/addr in the same way as static addresses are
when the uio device file is open, when no processes are holding the device
file open, the address returned to userspace is DMA_ERROR_CODE.

Signed-off-by: Manuel Stahl 
---
 MAINTAINERS   |   6 +
 drivers/uio/Kconfig   |   9 +
 drivers/uio/Makefile  |   1 +
 drivers/uio/uio_pci_dmem_genirq.c | 349 ++
 4 files changed, 365 insertions(+)
 create mode 100644 drivers/uio/uio_pci_dmem_genirq.c

diff --git a/MAINTAINERS b/MAINTAINERS
index 65b0c88d5ee0..e135c171f88b 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -5801,6 +5801,12 @@ L:   k...@vger.kernel.org
 S: Supported
 F: drivers/uio/uio_pci_generic.c
 
+GENERIC UIO DRIVER FOR PCI DEVICES WITH DMA
+M: "Manuel Stahl" 
+L: k...@vger.kernel.org
+S: Supported
+F: drivers/uio/uio_pci_dmem_genirq.c
+
 GENWQE (IBM Generic Workqueue Card)
 M: Frank Haverkamp 
 M: Guilherme G. Piccoli 
diff --git a/drivers/uio/Kconfig b/drivers/uio/Kconfig
index 7e8dc78a9796..30ca4d405378 100644
--- a/drivers/uio/Kconfig
+++ b/drivers/uio/Kconfig
@@ -93,6 +93,15 @@ config UIO_PCI_GENERIC
      primarily, for virtualization scenarios.
      If you compile this as a module, it will be called uio_pci_generic.
 
+config UIO_PCI_DMEM_GENIRQ
+   tristate "Generic driver for PCI 2.3 and PCI Express cards with DMA"
+   depends on PCI
+   help
+     Generic driver that you can bind, dynamically, to any
+     PCI 2.3 compliant and PCI Express card. It is useful
+  for FPGAs with DMA capability connected via PCI.
+     If you compile this as a module, it will be called 
uio_pci_dmem_genirq.
+
 config UIO_NETX
    tristate "Hilscher NetX Card driver"
    depends on PCI
diff --git a/drivers/uio/Makefile b/drivers/uio/Makefile
index e9663bb8a4c7..6c010c26695d 100644
--- a/drivers/uio/Makefile
+++ b/drivers/uio/Makefile
@@ -5,6 +5,7 @@ obj-$(CONFIG_UIO_DMEM_GENIRQ)   += uio_dmem_genirq.o
 obj-$(CONFIG_UIO_AEC)  += uio_aec.o
 obj-$(CONFIG_UIO_SERCOS3)  += uio_sercos3.o
 obj-$(CONFIG_UIO_PCI_GENERIC)  += uio_pci_generic.o
+obj-$(CONFIG_UIO_PCI_DMEM_GENIRQ)  += uio_pci_dmem_genirq.o
 obj-$(CONFIG_UIO_NETX) += uio_netx.o
 obj-$(CONFIG_UIO_PRUSS) += uio_pruss.o
 obj-$(CONFIG_UIO_MF624) += uio_mf624.o
diff --git a/drivers/uio/uio_pci_dmem_genirq.c 
b/drivers/uio/uio_pci_dmem_genirq.c
new file mode 100644
index ..4d5bf3a860ba
--- /dev/null
+++ b/drivers/uio/uio_pci_dmem_genirq.c
@@ -0,0 +1,349 @@
+/* uio_pci_generic - generic UIO driver for PCI 2.3 devices with DMA memory
+ *
+ * Copyright (C) 2016 Fraunhofer IIS
+ * Author: Manuel Stahl 
+ *
+ * Based on uio_pci_generic.c by Michael S. Tsirkin
+ * and uio_dmem_genirq.c by Damian Hobson-Garcia.
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2.
+ *
+ * Since the driver does not declare any device ids, you must allocate
+ * id and bind the device to the driver yourself.  For example:
+ *
+ * # echo "8086 10f5" > /sys/bus/pci/drivers/uio_pci_dmem_genirq/new_id
+ * # echo -n :00:19.0 > /sys/bus/pci/drivers/e1000e/unbind
+ * # echo -n :00:19.0 > /sys/bus/pci/drivers/uio_pci_dmem_genirq/bind
+ * # ls -l /sys/bus/pci/devices/:00:19.0/driver
+ * .../:00:19.0/driver -> ../../../bus/pci/drivers/uio_pci_dmem_genirq
+ *
+ * Or use a modprobe alias:
+ * # alias pci:v10EEd1000sv*sd*sc*i* uio_pci_dmem_genirq
+ *
+ * Driver won't bind to devices which do not support the Interrupt Disable Bit
+ * in the command register. All devices compliant to PCI 2.3 (circa 2002) and
+ * all compliant PCI Express devices should support this bit.
+ *
+ * The DMA mask bits and sizes of dynamic regions are derived from module
+ * parameters.
+ *
+ * The format for specifying dynamic region sizes in module parameters
+ * is as follows:
+ *
+ * uio_pci_dmem_genirq.dmem_sizes := 
[;]
+ *    := :[,]
+ *    := :
+ *  := standard linux memsize
+ *
+ * Examples:
+ *
+ * 1) UIO dmem device with 3 dynamic regions:
+ * uio_pci_dmem_genirq.dmem_sizes=8086:10f5:4K,16K,4M
+ *
+ * 2) Two UIO dmem devices with different number of dynamic regions:
+ * uio_pci_dmem_genirq.dmem_

Re: [PATCH] Add new uio device for PCI with dynamic memory allocation

2017-10-04 Thread Dan Carpenter
Sounds good.

regards,
dan carpenter

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


Re: [PATCH v5 2/2] staging: ion: create one device entry per heap

2017-10-04 Thread Mark Brown
On Tue, Oct 03, 2017 at 04:08:30PM -0700, Sandeep Patil wrote:

> It is entirely possible and easy in android/ueventd to create those nodes
> under "/dev/ion/".  (assuming the heap 'subsystem' for these new devices will
> point to 'ion').

The reason I didn't say /dev/ion/foo initially is that if people want to
keep the existing /dev/ion around for compatibility reasons then the
/dev/ion name isn't available which might cause issues.  Otherwise just
dumping everything under a directory (perhaps with a different name) was
my first thought as well.

> (Also FWIW, the SELinux permissions are also possible with the current ion
> implementation by adding rules to disallow specific ioctls instead of adding
> permissions to access device node as this change would do)

AIUI the request is to limit access to specific heaps, and obviously not
everyone wants to deal with SELinux at all.


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


Re: [PATCH] Staging: rtl8188eu: core: Use list_for_each_entry_safe

2017-10-04 Thread Dan Carpenter
On Wed, Oct 04, 2017 at 01:58:32AM +0530, Srishti Sharma wrote:
> Use list_for_each_entry_safe when the list elements may get deleted
> during traversal.

This patch is fine as a cleanup but none of these are actually buggy.

regards,
dan carpenter

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


Re: [PATCH] Staging: rtl8723bs: Externs should be avoided in .C file

2017-10-04 Thread Joe Perches
On Wed, 2017-10-04 at 11:00 +0200, Srinivasan Shanmugam wrote:
> This patch fixes the following checkpatch.pl warning.
> WARNING: externs should be avoided in .c files

Nope.

> diff --git a/drivers/staging/rtl8723bs/core/rtw_ap.c 
> b/drivers/staging/rtl8723bs/core/rtw_ap.c
[]
> @@ -17,12 +17,6 @@
>  #include 
>  #include 
>  
> -extern unsigned char RTW_WPA_OUI[];
> -extern unsigned char WMM_OUI[];
> -extern unsigned char WPS_OUI[];
> -extern unsigned char P2P_OUI[];
> -extern unsigned char WFD_OUT[];
> -
>  void init_mlme_ap_info(struct adapter *padapter)
>  {
>   struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);

Please compile any files modified by your proposed
changes _before_ you
submit them.

For instance:

$ git grep -w RTW_WPA_OUI drivers/staging/rtl8723bs/core/rtw_ap.c
drivers/staging/rtl8723bs/core/rtw_ap.c:extern unsigned char RTW_WPA_OUI[];
drivers/staging/rtl8723bs/core/rtw_ap.c:if (!memcmp(RTW_WPA_OUI, oui, 
4))
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] Staging: rtl8723bs: Externs should be avoided in .C file

2017-10-04 Thread Joe Perches
On Wed, 2017-10-04 at 13:53 +0200, srinivasan wrote:
> Hi Joe,
> 
> Thanks for your responses. I have already compiled and the below is the
> logs for the same
> 
> Please let me know if am I missing/doing wrong

Your commit message is incomplete.

checkpatch is a guide, but it's not what you should be
describing here.

What whould be in the commit message is that these externs
are unnecessary as they are done via #include of
drivers/staging/rtl8723bs/include/rtw_mlme_ext.h

Also, your patch is not comprehensive.
Please remove the unnecessary externs from all uses:

drivers/staging/rtl8723bs/core/rtw_wlan_util.c:extern unsigned char 
RTW_WPA_OUI[];

And that file has the odd and conflicting

static unsigned char WPA_TKIP_CIPHER[4] = {0x00, 0x50, 0xf2, 0x02};
[]
extern unsigned char WPA_TKIP_CIPHER[4];

Where the extern is also unnecessary.

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


[PATCH] Staging: rtl8188eu: core: Use list_entry instead of container_of

2017-10-04 Thread Srishti Sharma
For variables of the struct list_head* use list_entry to access
current list element instead of using container_of.
Done using the following semantic patch by coccinelle.

@r@
struct list_head* l;
@@

-container_of
+list_entry
   (l,...)

Signed-off-by: Srishti Sharma 
---
 drivers/staging/rtl8188eu/core/rtw_ap.c   | 4 ++--
 drivers/staging/rtl8188eu/core/rtw_mlme.c | 8 
 drivers/staging/rtl8188eu/core/rtw_mlme_ext.c | 2 +-
 drivers/staging/rtl8188eu/core/rtw_sta_mgt.c  | 8 
 drivers/staging/rtl8188eu/core/rtw_xmit.c | 8 
 5 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_ap.c 
b/drivers/staging/rtl8188eu/core/rtw_ap.c
index 551af9e..c968472 100644
--- a/drivers/staging/rtl8188eu/core/rtw_ap.c
+++ b/drivers/staging/rtl8188eu/core/rtw_ap.c
@@ -1143,7 +1143,7 @@ int rtw_acl_add_sta(struct adapter *padapter, u8 *addr)
plist = phead->next;
 
while (phead != plist) {
-   paclnode = container_of(plist, struct rtw_wlan_acl_node, list);
+   paclnode = list_entry(plist, struct rtw_wlan_acl_node, list);
plist = plist->next;
 
if (!memcmp(paclnode->addr, addr, ETH_ALEN)) {
@@ -1447,7 +1447,7 @@ void associated_clients_update(struct adapter *padapter, 
u8 updated)
 
/* check asoc_queue */
while (phead != plist) {
-   psta = container_of(plist, struct sta_info, asoc_list);
+   psta = list_entry(plist, struct sta_info, asoc_list);
 
plist = plist->next;
 
diff --git a/drivers/staging/rtl8188eu/core/rtw_mlme.c 
b/drivers/staging/rtl8188eu/core/rtw_mlme.c
index b15cf17..82f25b6 100644
--- a/drivers/staging/rtl8188eu/core/rtw_mlme.c
+++ b/drivers/staging/rtl8188eu/core/rtw_mlme.c
@@ -198,7 +198,7 @@ struct wlan_network *rtw_find_network(struct __queue 
*scanned_queue, u8 *addr)
plist = phead->next;
 
while (plist != phead) {
-   pnetwork = container_of(plist, struct wlan_network, list);
+   pnetwork = list_entry(plist, struct wlan_network, list);
if (!memcmp(addr, pnetwork->network.MacAddress, ETH_ALEN))
break;
plist = plist->next;
@@ -223,7 +223,7 @@ void rtw_free_network_queue(struct adapter *padapter, u8 
isfreeall)
plist = phead->next;
 
while (phead != plist) {
-   pnetwork = container_of(plist, struct wlan_network, list);
+   pnetwork = list_entry(plist, struct wlan_network, list);
 
plist = plist->next;
 
@@ -342,7 +342,7 @@ struct  wlan_network
*rtw_get_oldest_wlan_network(struct __queue *scanned_queue)
phead = get_list_head(scanned_queue);
 
for (plist = phead->next; plist != phead; plist = plist->next) {
-   pwlan = container_of(plist, struct wlan_network, list);
+   pwlan = list_entry(plist, struct wlan_network, list);
 
if (!pwlan->fixed) {
if (!oldest || time_after(oldest->last_scanned, 
pwlan->last_scanned))
@@ -421,7 +421,7 @@ void rtw_update_scanned_network(struct adapter *adapter, 
struct wlan_bssid_ex *t
plist = phead->next;
 
while (phead != plist) {
-   pnetwork= container_of(plist, struct wlan_network, 
list);
+   pnetwork= list_entry(plist, struct wlan_network, list);
 
if (is_same_network(&(pnetwork->network), target))
break;
diff --git a/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c 
b/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c
index 4e1d06c..6ecc871 100644
--- a/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c
+++ b/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c
@@ -1790,7 +1790,7 @@ static void issue_action_BSSCoexistPacket(struct adapter 
*padapter)
u8 *p;
struct wlan_bssid_ex *pbss_network;
 
-   pnetwork = container_of(plist, struct wlan_network, 
list);
+   pnetwork = list_entry(plist, struct wlan_network, list);
 
plist = plist->next;
 
diff --git a/drivers/staging/rtl8188eu/core/rtw_sta_mgt.c 
b/drivers/staging/rtl8188eu/core/rtw_sta_mgt.c
index 2fd2a9e..21c4d38 100644
--- a/drivers/staging/rtl8188eu/core/rtw_sta_mgt.c
+++ b/drivers/staging/rtl8188eu/core/rtw_sta_mgt.c
@@ -152,8 +152,8 @@ u32 _rtw_free_sta_priv(struct   sta_priv *pstapriv)
while (phead != plist) {
int i;
 
-   psta = container_of(plist, struct sta_info,
-   hash_list);
+   psta = list_entry(plist, struct sta_info,
+ hash_list);
plist = plist->next;
 
for (i = 0; i < 

[PATCH] Staging: rtl8188eu: core: Use list_for_each_entry_safe

2017-10-04 Thread Srishti Sharma
Use list_for_each_entry_safe to make the code more compact. Done 
by the following semantic patch by coccinelle.

@r@
struct list_head* l;
expression e;
identifier m,list_del_init,f;
type T1;
T1* pos;
iterator name list_for_each_entry_safe;
@@

f(...){

+T1* tmp;
<+...
-while(...)
+list_for_each_entry_safe(pos,tmp,l,m)
{
...
-pos = container_of(l,T1,m);
...
-l=e;
 <+...
 list_del_init(&pos->m)
 ...+>
}
...+>

}

Signed-off-by: Srishti Sharma 
---
 drivers/staging/rtl8188eu/core/rtw_ap.c | 12 +++-
 1 file changed, 3 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_ap.c 
b/drivers/staging/rtl8188eu/core/rtw_ap.c
index a2c599f..551af9e 100644
--- a/drivers/staging/rtl8188eu/core/rtw_ap.c
+++ b/drivers/staging/rtl8188eu/core/rtw_ap.c
@@ -280,7 +280,7 @@ voidexpire_timeout_chk(struct adapter *padapter)
 {
struct list_head *phead, *plist;
u8 updated = 0;
-   struct sta_info *psta = NULL;
+   struct sta_info *psta = NULL, *tmp;
struct sta_priv *pstapriv = &padapter->stapriv;
u8 chk_alive_num = 0;
char chk_alive_list[NUM_STA];
@@ -292,10 +292,7 @@ void   expire_timeout_chk(struct adapter *padapter)
plist = phead->next;
 
/* check auth_queue */
-   while (phead != plist) {
-   psta = container_of(plist, struct sta_info, auth_list);
-   plist = plist->next;
-
+   list_for_each_entry_safe(psta, tmp, plist, auth_list) {
if (psta->expire_to > 0) {
psta->expire_to--;
if (psta->expire_to == 0) {
@@ -326,10 +323,7 @@ void   expire_timeout_chk(struct adapter *padapter)
plist = phead->next;
 
/* check asoc_queue */
-   while (phead != plist) {
-   psta = container_of(plist, struct sta_info, asoc_list);
-   plist = plist->next;
-
+   list_for_each_entry_safe(psta, tmp, plist, asoc_list) {
if (chk_sta_is_alive(psta) || !psta->expire_to) {
psta->expire_to = pstapriv->expire_to;
psta->keep_alive_trycnt = 0;
-- 
2.7.4

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


[PATCH] Staging: rtl8188eu: core: Use list_for_each_entry_safe

2017-10-04 Thread Srishti Sharma
Use list_for_each_entry_safe to make code more compact. Done 
using the following semantic patch by coccinelle.

@r@
struct list_head* l;
expression e;
identifier m,list_del_init,f;
type T1;
T1* pos;
iterator name list_for_each_entry_safe;
@@

f(...){

+T1* tmp;

<+...

-while(...)
+list_for_each_entry_safe(pos,tmp,l,m)
{
...
-pos = container_of(l,T1,m);
...
-l=e;
 <+...
 list_del_init(&pos->m)
 ...+>
}

...+>

}

Signed-off-by: Srishti Sharma 
---
 drivers/staging/rtl8188eu/core/rtw_xmit.c | 23 ++-
 1 file changed, 6 insertions(+), 17 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_xmit.c 
b/drivers/staging/rtl8188eu/core/rtw_xmit.c
index e8d9858..6d8820b 100644
--- a/drivers/staging/rtl8188eu/core/rtw_xmit.c
+++ b/drivers/staging/rtl8188eu/core/rtw_xmit.c
@@ -1869,7 +1869,7 @@ void wakeup_sta_to_xmit(struct adapter *padapter, struct 
sta_info *psta)
u8 update_mask = 0, wmmps_ac = 0;
struct sta_info *psta_bmc;
struct list_head *xmitframe_plist, *xmitframe_phead;
-   struct xmit_frame *pxmitframe = NULL;
+   struct xmit_frame *pxmitframe = NULL, *tmp;
struct sta_priv *pstapriv = &padapter->stapriv;
 
spin_lock_bh(&psta->sleep_q.lock);
@@ -1877,11 +1877,7 @@ void wakeup_sta_to_xmit(struct adapter *padapter, struct 
sta_info *psta)
xmitframe_phead = get_list_head(&psta->sleep_q);
xmitframe_plist = xmitframe_phead->next;
 
-   while (xmitframe_phead != xmitframe_plist) {
-   pxmitframe = container_of(xmitframe_plist, struct xmit_frame, 
list);
-
-   xmitframe_plist = xmitframe_plist->next;
-
+   list_for_each_entry_safe(pxmitframe, tmp, xmitframe_plist, list) {
list_del_init(&pxmitframe->list);
 
switch (pxmitframe->attrib.priority) {
@@ -1958,11 +1954,8 @@ void wakeup_sta_to_xmit(struct adapter *padapter, struct 
sta_info *psta)
xmitframe_phead = get_list_head(&psta_bmc->sleep_q);
xmitframe_plist = xmitframe_phead->next;
 
-   while (xmitframe_phead != xmitframe_plist) {
-   pxmitframe = container_of(xmitframe_plist, struct 
xmit_frame, list);
-
-   xmitframe_plist = xmitframe_plist->next;
-
+   list_for_each_entry_safe(pxmitframe, tmp, xmitframe_plist,
+list) {
list_del_init(&pxmitframe->list);
 
psta_bmc->sleepq_len--;
@@ -1997,7 +1990,7 @@ void xmit_delivery_enabled_frames(struct adapter 
*padapter, struct sta_info *pst
 {
u8 wmmps_ac = 0;
struct list_head *xmitframe_plist, *xmitframe_phead;
-   struct xmit_frame *pxmitframe = NULL;
+   struct xmit_frame *pxmitframe = NULL, *tmp;
struct sta_priv *pstapriv = &padapter->stapriv;
 
spin_lock_bh(&psta->sleep_q.lock);
@@ -2005,11 +1998,7 @@ void xmit_delivery_enabled_frames(struct adapter 
*padapter, struct sta_info *pst
xmitframe_phead = get_list_head(&psta->sleep_q);
xmitframe_plist = xmitframe_phead->next;
 
-   while (xmitframe_phead != xmitframe_plist) {
-   pxmitframe = container_of(xmitframe_plist, struct xmit_frame, 
list);
-
-   xmitframe_plist = xmitframe_plist->next;
-
+   list_for_each_entry_safe(pxmitframe, tmp, xmitframe_plist, list) {
switch (pxmitframe->attrib.priority) {
case 1:
case 2:
-- 
2.7.4

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


[PATCH] Staging: rtl8188eu: core: Use list_for_each_entry_safe

2017-10-04 Thread Srishti Sharma
Use list_for_each_entry_safe to make the code more compact. 
Done using the following semantic patch by coccinelle.

@r@
struct list_head* l;
expression e;
identifier m, list_del_init, f;
type T1;
T1* pos;
iterator name list_for_each_entry_safe;
@@

f(...){

+T1* tmp;
<+...
-while(...)
+list_for_each_entry_safe(pos,tmp,l,m)
{
...
-pos = container_of(l,T1,m);
...
-l=e;
 <+...
  list_del_init(&pos->m)
 ...+>
}
...+>
}

Signed-off-by: Srishti Sharma 
---
 drivers/staging/rtl8188eu/core/rtw_mlme_ext.c | 8 +++-
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c 
b/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c
index 52f31c7..4e1d06c 100644
--- a/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c
+++ b/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c
@@ -5446,6 +5446,7 @@ u8 mlme_evt_hdl(struct adapter *padapter, unsigned char 
*pbuf)
 
 u8 tx_beacon_hdl(struct adapter *padapter, unsigned char *pbuf)
 {
+   struct xmit_frame *tmp;
if (send_beacon(padapter) == _FAIL) {
DBG_88E("issue_beacon, fail!\n");
return H2C_PARAMETERS_ERROR;
@@ -5469,11 +5470,8 @@ u8 tx_beacon_hdl(struct adapter *padapter, unsigned char 
*pbuf)
xmitframe_phead = get_list_head(&psta_bmc->sleep_q);
xmitframe_plist = xmitframe_phead->next;
 
-   while (xmitframe_phead != xmitframe_plist) {
-   pxmitframe = container_of(xmitframe_plist, 
struct xmit_frame, list);
-
-   xmitframe_plist = xmitframe_plist->next;
-
+   list_for_each_entry_safe(pxmitframe, tmp,
+xmitframe_plist, list) {
list_del_init(&pxmitframe->list);
 
psta_bmc->sleepq_len--;
-- 
2.7.4

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


Re: [Outreachy kernel] [PATCH] Staging: rtl8188eu: core: Use list_for_each_entry_safe

2017-10-04 Thread Julia Lawall
Again, you have three patches on different files with the same subject
line.  You could add the file name eg rtw_ap: to the subject line to make
them unique.

julia

On Wed, 4 Oct 2017, Srishti Sharma wrote:

> Use list_for_each_entry_safe to make the code more compact. Done
> by the following semantic patch by coccinelle.
>
> @r@
> struct list_head* l;
> expression e;
> identifier m,list_del_init,f;
> type T1;
> T1* pos;
> iterator name list_for_each_entry_safe;
> @@
>
> f(...){
>
> +T1* tmp;
> <+...
> -while(...)
> +list_for_each_entry_safe(pos,tmp,l,m)
> {
> ...
> -pos = container_of(l,T1,m);
> ...
> -l=e;
>  <+...
>  list_del_init(&pos->m)
>  ...+>
> }
> ...+>
>
> }
>
> Signed-off-by: Srishti Sharma 
> ---
>  drivers/staging/rtl8188eu/core/rtw_ap.c | 12 +++-
>  1 file changed, 3 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/staging/rtl8188eu/core/rtw_ap.c 
> b/drivers/staging/rtl8188eu/core/rtw_ap.c
> index a2c599f..551af9e 100644
> --- a/drivers/staging/rtl8188eu/core/rtw_ap.c
> +++ b/drivers/staging/rtl8188eu/core/rtw_ap.c
> @@ -280,7 +280,7 @@ void  expire_timeout_chk(struct adapter *padapter)
>  {
>   struct list_head *phead, *plist;
>   u8 updated = 0;
> - struct sta_info *psta = NULL;
> + struct sta_info *psta = NULL, *tmp;
>   struct sta_priv *pstapriv = &padapter->stapriv;
>   u8 chk_alive_num = 0;
>   char chk_alive_list[NUM_STA];
> @@ -292,10 +292,7 @@ void expire_timeout_chk(struct adapter *padapter)
>   plist = phead->next;
>
>   /* check auth_queue */
> - while (phead != plist) {
> - psta = container_of(plist, struct sta_info, auth_list);
> - plist = plist->next;
> -
> + list_for_each_entry_safe(psta, tmp, plist, auth_list) {
>   if (psta->expire_to > 0) {
>   psta->expire_to--;
>   if (psta->expire_to == 0) {
> @@ -326,10 +323,7 @@ void expire_timeout_chk(struct adapter *padapter)
>   plist = phead->next;
>
>   /* check asoc_queue */
> - while (phead != plist) {
> - psta = container_of(plist, struct sta_info, asoc_list);
> - plist = plist->next;
> -
> + list_for_each_entry_safe(psta, tmp, plist, asoc_list) {
>   if (chk_sta_is_alive(psta) || !psta->expire_to) {
>   psta->expire_to = pstapriv->expire_to;
>   psta->keep_alive_trycnt = 0;
> --
> 2.7.4
>
> --
> You received this message because you are subscribed to the Google Groups 
> "outreachy-kernel" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to outreachy-kernel+unsubscr...@googlegroups.com.
> To post to this group, send email to outreachy-ker...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/outreachy-kernel/1507122755-5489-1-git-send-email-srishtishar%40gmail.com.
> For more options, visit https://groups.google.com/d/optout.
>
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] [STABLE-4.13] [media] imx-media-of: avoid uninitialized variable warning

2017-10-04 Thread Arnd Bergmann
Replaces upstream commit 0b2e9e7947e7 ("media: staging/imx: remove
confusing IS_ERR_OR_NULL usage")

We get a harmless warning about a potential uninitialized variable
use in the driver:

drivers/staging/media/imx/imx-media-of.c: In function 'of_parse_subdev':
drivers/staging/media/imx/imx-media-of.c:216:4: warning: 'remote_np' may be 
used uninitialized in this function [-Wmaybe-uninitialized]

I reworked that code to be easier to understand by gcc in mainline,
but that commit is too large to backport. This is a much simpler
workaround, avoiding the warning by adding a fake initialization
to the variable. The driver was only introduced in linux-4.13,
so the workaround is not needed for earlier stable kernels.

Fixes: e130291212df ("[media] media: Add i.MX media core driver")
Cc: sta...@vger.kernel.org
Cc: Philipp Zabel 
Cc: Steve Longerbeam 
Cc: Hans Verkuil 
Cc: Mauro Carvalho Chehab 
Signed-off-by: Arnd Bergmann 
---
 drivers/staging/media/imx/imx-media-of.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/media/imx/imx-media-of.c 
b/drivers/staging/media/imx/imx-media-of.c
index b026fe66467c..90e7e702a411 100644
--- a/drivers/staging/media/imx/imx-media-of.c
+++ b/drivers/staging/media/imx/imx-media-of.c
@@ -167,7 +167,7 @@ of_parse_subdev(struct imx_media_dev *imxmd, struct 
device_node *sd_np,
of_parse_sensor(imxmd, imxsd, sd_np);
 
for (i = 0; i < num_pads; i++) {
-   struct device_node *epnode = NULL, *port, *remote_np;
+   struct device_node *epnode = NULL, *port, *remote_np = NULL;
struct imx_media_subdev *remote_imxsd;
struct imx_media_pad *pad;
int remote_pad;
-- 
2.9.0

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


Re: [Outreachy kernel] Re: [PATCH] Staging: rtl8188eu: core: Use list_for_each_entry_safe

2017-10-04 Thread Julia Lawall


On Wed, 4 Oct 2017, Dan Carpenter wrote:

> On Wed, Oct 04, 2017 at 01:58:32AM +0530, Srishti Sharma wrote:
> > Use list_for_each_entry_safe when the list elements may get deleted
> > during traversal.
>
> This patch is fine as a cleanup but none of these are actually buggy.

I'm not sure what you are getting at with the comment.  The commit doesn't
say that they were buggy.  Perhaps the commit message could have been more
verbose, like "Use list operators on list_head values.
List_for_each_entry_safe is needed because the list elements get deleted
during the traversal"?

thanks,
julia

>
> regards,
> dan carpenter
>
> --
> You received this message because you are subscribed to the Google Groups 
> "outreachy-kernel" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to outreachy-kernel+unsubscr...@googlegroups.com.
> To post to this group, send email to outreachy-ker...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/outreachy-kernel/20171004112103.cvu5ipkudfpz2adc%40mwanda.
> For more options, visit https://groups.google.com/d/optout.
>
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


RE: [PATCH 2/2] Drivers: hv: vmbus: Expose per-channel interrupts and events counters

2017-10-04 Thread KY Srinivasan


> -Original Message-
> From: Greg KH [mailto:gre...@linuxfoundation.org]
> Sent: Wednesday, October 4, 2017 1:49 AM
> To: KY Srinivasan 
> Cc: linux-ker...@vger.kernel.org; de...@linuxdriverproject.org;
> o...@aepfle.de; a...@canonical.com; vkuzn...@redhat.com;
> jasow...@redhat.com; leann.ogasaw...@canonical.com;
> marcelo.ce...@canonical.com; Stephen Hemminger
> 
> Subject: Re: [PATCH 2/2] Drivers: hv: vmbus: Expose per-channel interrupts
> and events counters
> 
> On Thu, Sep 21, 2017 at 08:58:50PM -0700, k...@exchange.microsoft.com
> wrote:
> > From: Stephen Hemminger 
> >
> > When investigating performance, it is useful to be able to look at
> > the number of host and guest events per-channel. This is equivalent
> > to per-device interrupt statistics.
> >
> > Signed-off-by: Stephen Hemminger 
> > Signed-off-by: K. Y. Srinivasan 
> > ---
> >  Documentation/ABI/stable/sysfs-bus-vmbus | 14 ++
> >  drivers/hv/connection.c  |  2 ++
> >  drivers/hv/vmbus_drv.c   | 18 ++
> >  include/linux/hyperv.h   |  4 
> >  4 files changed, 38 insertions(+)
> 
> This patch didn't apply to my tree, can you rebase and resend it?

Will do.

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


Re: [PATCH 02/16] hyper-v: trace vmbus_on_message()

2017-10-04 Thread Vitaly Kuznetsov
Stephen Hemminger  writes:

> On Thu, 21 Sep 2017 10:17:18 +0200
> Vitaly Kuznetsov  wrote:
>
>> Steven Rostedt  writes:
>> 
>> > On Wed, 20 Sep 2017 19:21:53 +0200
>> > Vitaly Kuznetsov  wrote:
>> >  
>> >> diff --git a/drivers/hv/hv_trace.h b/drivers/hv/hv_trace.h
>> >> index 9a29ef55477d..72911dfc9682 100644
>> >> --- a/drivers/hv/hv_trace.h
>> >> +++ b/drivers/hv/hv_trace.h
>> >> @@ -14,6 +14,14 @@ TRACE_EVENT(vmbus_on_msg_dpc,
>> >>   TP_printk("message %u received", __entry->msgtype)
>> >>   );
>> >>  
>> >> +TRACE_EVENT(vmbus_on_message,
>> >> + TP_PROTO(const struct vmbus_channel_message_header *hdr),
>> >> + TP_ARGS(hdr),
>> >> + TP_STRUCT__entry(__field(unsigned int, msgtype)),
>> >> + TP_fast_assign(__entry->msgtype = hdr->msgtype),
>> >> + TP_printk("processing message %u", __entry->msgtype)
>> >> + );  
>> >
>> > Whenever you have two trace events with everything the same but the
>> > TP_printk(), you can save a little space by using DEFINE_EVENT_PRINT()
>> >
>> > DECLARE_EVENT_CLASS(vmbus_hdr_msg,
>> >TP_PROTO(const struct vmbus_channel_message_header *hdr),
>> >TP_ARGS(hdr),
>> >TP_STRUCT__entry(__field(unsigned int, msgtype),
>> >TP_fast_assign(__entry->msg = hdr->msgtype;),
>> >TP_printk("msgtype=%d", __entry->msgtype)
>> > );
>> >
>> > DEFINE_EVENT_PRINT(vmbus_hdr_msg, vmbus_on_msg_dpc,
>> >TP_PROTO(const struct vmbus_channel_message_header *hdr),
>> >TP_ARGS(hdr),
>> >TP_printk("message %u received", __entry->msgtype));
>> >
>> > DEFINE_EVENT_PRINT(vmbus_hdr_msg, vmbus_on_message,
>> >TP_PROTO(const struct vmbus_channel_message_header *hdr),
>> >TP_ARGS(hdr),
>> >TP_printk("processing message %u", __entry->msgtype));
>> >
>> > This will use the same functions required to save and record the
>> > message but will use a different function to output it to the trace.  
>> 
>> Oh, thanks! This seems to be useful for
>> vmbus_on_msg_dpc/vmbus_on_message only as all the rest needs to parse
>> different structures. Will use it in v2.
>> 
>
> I just used this patch. Since function name is already in the trace message
> no need to have different print's for each one.
>

Sure, will incorporate this into v3.

> From ff85967810c216eb01d181789af4f56bd00dc9b9 Mon Sep 17 00:00:00 2001
> From: Stephen Hemminger 
> Date: Tue, 3 Oct 2017 09:24:11 -0700
> Subject: [PATCH 3/4] hyperv: fix warnings in trace print
>
> This gets rid of the build warnings from unused printf format.
> And uses common class for print.
> ---
>  drivers/hv/hv_trace.h | 14 +++---
>  1 file changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/hv/hv_trace.h b/drivers/hv/hv_trace.h
> index be7762955650..4755c4640e39 100644
> --- a/drivers/hv/hv_trace.h
> +++ b/drivers/hv/hv_trace.h
> @@ -11,18 +11,18 @@ DECLARE_EVENT_CLASS(vmbus_hdr_msg,
>   TP_ARGS(hdr),
>   TP_STRUCT__entry(__field(unsigned int, msgtype)),
>   TP_fast_assign(__entry->msgtype = hdr->msgtype;),
> - TP_printk("msgtype=%d", __entry->msgtype)
> + TP_printk("msgtype=%u", __entry->msgtype)
>  );
>
> -DEFINE_EVENT_PRINT(vmbus_hdr_msg, vmbus_on_msg_dpc,
> +DEFINE_EVENT(vmbus_hdr_msg, vmbus_on_msg_dpc,
>   TP_PROTO(const struct vmbus_channel_message_header *hdr),
> - TP_ARGS(hdr),
> - TP_printk("message %u received", __entry->msgtype));
> + TP_ARGS(hdr)
> +);
>
> -DEFINE_EVENT_PRINT(vmbus_hdr_msg, vmbus_on_message,
> +DEFINE_EVENT(vmbus_hdr_msg, vmbus_on_message,
>  TP_PROTO(const struct vmbus_channel_message_header *hdr),
> -TP_ARGS(hdr),
> -TP_printk("processing message %u", __entry->msgtype));
> +TP_ARGS(hdr)
> +);
>
>  TRACE_EVENT(vmbus_onoffer,
>   TP_PROTO(const struct vmbus_channel_offer_channel *offer),

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


Re: [PATCH v2 16/16] hyper-v: trace vmbus_send_tl_connect_request()

2017-10-04 Thread Vitaly Kuznetsov
Stephen Hemminger  writes:

> I added an additional set of trace points for when channel gets notified or 
> signals host.
>

Will add this in v3, thanks!

> diff -urNp linux-msft/drivers/hv/channel.c msft-4.14-rc3/drivers/hv/channel.c
> --- linux-msft/drivers/hv/channel.c   2017-10-03 10:06:54.893209237 -0700
> +++ msft-4.14-rc3/drivers/hv/channel.c2017-10-03 10:07:35.501665114 
> -0700
> @@ -55,6 +55,8 @@ void vmbus_setevent(struct vmbus_channel
>  {
>   struct hv_monitor_page *monitorpage;
>
> + trace_vmbus_setevent(channel);
> +
>   /*
>* For channels marked as in "low latency" mode
>* bypass the monitor page mechanism.
> diff -urNp linux-msft/drivers/hv/connection.c 
> msft-4.14-rc3/drivers/hv/connection.c
> --- linux-msft/drivers/hv/connection.c2017-10-03 10:06:54.893209237 
> -0700
> +++ msft-4.14-rc3/drivers/hv/connection.c 2017-10-03 10:07:35.501665114 
> -0700
> @@ -322,6 +322,8 @@ void vmbus_on_event(unsigned long data)
>   struct vmbus_channel *channel = (void *) data;
>   unsigned long time_limit = jiffies + 2;
>
> + trace_vmbus_on_event(channel);
> + 
>   do {
>   void (*callback_fn)(void *);
>
> diff -urNp linux-msft/drivers/hv/hv_trace.h 
> msft-4.14-rc3/drivers/hv/hv_trace.h
> --- linux-msft/drivers/hv/hv_trace.h  2017-10-03 10:08:06.514014019 -0700
> +++ msft-4.14-rc3/drivers/hv/hv_trace.h   2017-10-03 10:07:35.505665159 
> -0700
> @@ -294,6 +294,29 @@ TRACE_EVENT(vmbus_send_tl_connect_reques
>   )
>   );
>
> +DECLARE_EVENT_CLASS(vmbus_channel,
> + TP_PROTO(const struct vmbus_channel *channel),
> + TP_ARGS(channel),
> + TP_STRUCT__entry(__field(u32, relid)),
> + TP_fast_assign(__entry->relid = channel->offermsg.child_relid),
> + TP_printk("relid 0x%x", __entry->relid)
> +);
> +
> +DEFINE_EVENT(vmbus_channel, vmbus_chan_sched,
> + TP_PROTO(const struct vmbus_channel *channel),
> + TP_ARGS(channel)
> +);
> +
> +DEFINE_EVENT(vmbus_channel, vmbus_setevent,
> + TP_PROTO(const struct vmbus_channel *channel),
> + TP_ARGS(channel)
> +);
> +
> +DEFINE_EVENT(vmbus_channel, vmbus_on_event,
> + TP_PROTO(const struct vmbus_channel *channel),
> + TP_ARGS(channel)
> +);
> +
>  #undef TRACE_INCLUDE_PATH
>  #define TRACE_INCLUDE_PATH .
>  #undef TRACE_INCLUDE_FILE
> diff -urNp linux-msft/drivers/hv/vmbus_drv.c 
> msft-4.14-rc3/drivers/hv/vmbus_drv.c
> --- linux-msft/drivers/hv/vmbus_drv.c 2017-10-03 10:06:54.897209282 -0700
> +++ msft-4.14-rc3/drivers/hv/vmbus_drv.c  2017-10-03 10:07:35.505665159 
> -0700
> @@ -948,6 +948,7 @@ static void vmbus_chan_sched(struct hv_p
>   continue;
>
>   ++channel->interrupts_in;
> + trace_vmbus_chan_sched(channel);
>
>   switch (channel->callback_mode) {
>   case HV_CALL_ISR:

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


[PATCH] Staging: rtl8723bs: Externs should be avoided in .C file

2017-10-04 Thread Srinivasan Shanmugam
This patch fixes all the following checkpatch.pl warning in rtl8723bs
WARNING: externs should be avoided in .c files

Signed-off-by: Srinivasan Shanmugam 
---
 drivers/staging/rtl8723bs/core/rtw_ap.c | 6 --
 1 file changed, 6 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_ap.c 
b/drivers/staging/rtl8723bs/core/rtw_ap.c
index 0b530ea..c66fed1 100644
--- a/drivers/staging/rtl8723bs/core/rtw_ap.c
+++ b/drivers/staging/rtl8723bs/core/rtw_ap.c
@@ -17,12 +17,6 @@
 #include 
 #include 
 
-extern unsigned char RTW_WPA_OUI[];
-extern unsigned char WMM_OUI[];
-extern unsigned char WPS_OUI[];
-extern unsigned char P2P_OUI[];
-extern unsigned char WFD_OUI[];
-
 void init_mlme_ap_info(struct adapter *padapter)
 {
struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
-- 
1.9.1

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


Re: [Outreachy kernel] Re: [PATCH] Staging: rtl8188eu: core: Use list_for_each_entry_safe

2017-10-04 Thread Dan Carpenter
On Wed, Oct 04, 2017 at 03:39:30PM +0200, Julia Lawall wrote:
> 
> 
> On Wed, 4 Oct 2017, Dan Carpenter wrote:
> 
> > On Wed, Oct 04, 2017 at 01:58:32AM +0530, Srishti Sharma wrote:
> > > Use list_for_each_entry_safe when the list elements may get deleted
> > > during traversal.
> >
> > This patch is fine as a cleanup but none of these are actually buggy.
> 
> I'm not sure what you are getting at with the comment.  The commit doesn't
> say that they were buggy.  Perhaps the commit message could have been more
> verbose, like "Use list operators on list_head values.
> List_for_each_entry_safe is needed because the list elements get deleted
   ^

It is not *needed*, the original code works fine.  The problem with the
original code, is that it's ugly as sin.

> during the traversal"?

The changelog needs to say *why* we're applying the patch.  At first I
thought it was going to fix a use after free.  What I would prefer in
the changelog is something like:  "This patch is a cleanup and doesn't
change runtime behavior.  It changes an open coded list traversal to
use list_for_each_entry_safe."

regards,
dan carpenter


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


Re: [Outreachy kernel] Re: [PATCH] Staging: rtl8188eu: core: Use list_for_each_entry_safe

2017-10-04 Thread Julia Lawall


On Wed, 4 Oct 2017, Dan Carpenter wrote:

> On Wed, Oct 04, 2017 at 03:39:30PM +0200, Julia Lawall wrote:
> >
> >
> > On Wed, 4 Oct 2017, Dan Carpenter wrote:
> >
> > > On Wed, Oct 04, 2017 at 01:58:32AM +0530, Srishti Sharma wrote:
> > > > Use list_for_each_entry_safe when the list elements may get deleted
> > > > during traversal.
> > >
> > > This patch is fine as a cleanup but none of these are actually buggy.
> >
> > I'm not sure what you are getting at with the comment.  The commit doesn't
> > say that they were buggy.  Perhaps the commit message could have been more
> > verbose, like "Use list operators on list_head values.
> > List_for_each_entry_safe is needed because the list elements get deleted
>^
>
> It is not *needed*, the original code works fine.  The problem with the
> original code, is that it's ugly as sin.
>
> > during the traversal"?
>
> The changelog needs to say *why* we're applying the patch.  At first I
> thought it was going to fix a use after free.  What I would prefer in
> the changelog is something like:  "This patch is a cleanup and doesn't
> change runtime behavior.  It changes an open coded list traversal to
> use list_for_each_entry_safe."

OK, Srishti, you can put that.  But change the subject lines too.

julia

>
> regards,
> dan carpenter
>
>
> --
> You received this message because you are subscribed to the Google Groups 
> "outreachy-kernel" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to outreachy-kernel+unsubscr...@googlegroups.com.
> To post to this group, send email to outreachy-ker...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/outreachy-kernel/20171004144012.jciztelhwjdyzpwg%40mwanda.
> For more options, visit https://groups.google.com/d/optout.
>
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [Outreachy kernel] Re: [PATCH] Staging: rtl8188eu: core: Use list_for_each_entry_safe

2017-10-04 Thread Srishti Sharma
On Wed, Oct 4, 2017 at 8:11 PM, Julia Lawall  wrote:
>
>
> On Wed, 4 Oct 2017, Dan Carpenter wrote:
>
>> On Wed, Oct 04, 2017 at 03:39:30PM +0200, Julia Lawall wrote:
>> >
>> >
>> > On Wed, 4 Oct 2017, Dan Carpenter wrote:
>> >
>> > > On Wed, Oct 04, 2017 at 01:58:32AM +0530, Srishti Sharma wrote:
>> > > > Use list_for_each_entry_safe when the list elements may get deleted
>> > > > during traversal.
>> > >
>> > > This patch is fine as a cleanup but none of these are actually buggy.
>> >
>> > I'm not sure what you are getting at with the comment.  The commit doesn't
>> > say that they were buggy.  Perhaps the commit message could have been more
>> > verbose, like "Use list operators on list_head values.
>> > List_for_each_entry_safe is needed because the list elements get deleted
>>^
>>
>> It is not *needed*, the original code works fine.  The problem with the
>> original code, is that it's ugly as sin.
>>
>> > during the traversal"?
>>
>> The changelog needs to say *why* we're applying the patch.  At first I
>> thought it was going to fix a use after free.  What I would prefer in
>> the changelog is something like:  "This patch is a cleanup and doesn't
>> change runtime behavior.  It changes an open coded list traversal to
>> use list_for_each_entry_safe."
>
> OK, Srishti, you can put that.  But change the subject lines too.
Ok will do ! Thanks again.
Regards,
Srishti
>
> julia
>
>>
>> regards,
>> dan carpenter
>>
>>
>> --
>> You received this message because you are subscribed to the Google Groups 
>> "outreachy-kernel" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to outreachy-kernel+unsubscr...@googlegroups.com.
>> To post to this group, send email to outreachy-ker...@googlegroups.com.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/outreachy-kernel/20171004144012.jciztelhwjdyzpwg%40mwanda.
>> For more options, visit https://groups.google.com/d/optout.
>>
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [Outreachy kernel] [PATCH] Staging: rtl8188eu: core: Use list_for_each_entry_safe

2017-10-04 Thread Dan Carpenter
On Wed, Oct 04, 2017 at 03:34:05PM +0200, Julia Lawall wrote:
> Again, you have three patches on different files with the same subject
> line.  You could add the file name eg rtw_ap: to the subject line to make
> them unique.
> 

And the subject needs to start with [PATCH v3] and then after the
Signed off by line put:

---
v2 and v3: Changes to the subjects and changelogs.

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


Re: [Outreachy kernel] [PATCH] Staging: rtl8188eu: core: Use list_for_each_entry_safe

2017-10-04 Thread Srishti Sharma
On Wed, Oct 4, 2017 at 8:38 PM, Dan Carpenter  wrote:
> On Wed, Oct 04, 2017 at 03:34:05PM +0200, Julia Lawall wrote:
>> Again, you have three patches on different files with the same subject
>> line.  You could add the file name eg rtw_ap: to the subject line to make
>> them unique.
>>
>
> And the subject needs to start with [PATCH v3] and then after the
> Signed off by line put:
Shouldn't it be only v2 as I haven't sent a v2 for this before.

Regards,
Srishti
>
> ---
> v2 and v3: Changes to the subjects and changelogs.
>
> regards,
> dan carpenter
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [Outreachy kernel] [PATCH] Staging: rtl8188eu: core: Use list_for_each_entry_safe

2017-10-04 Thread Julia Lawall


On Wed, 4 Oct 2017, Srishti Sharma wrote:

> On Wed, Oct 4, 2017 at 8:38 PM, Dan Carpenter  
> wrote:
> > On Wed, Oct 04, 2017 at 03:34:05PM +0200, Julia Lawall wrote:
> >> Again, you have three patches on different files with the same subject
> >> line.  You could add the file name eg rtw_ap: to the subject line to make
> >> them unique.
> >>
> >
> > And the subject needs to start with [PATCH v3] and then after the
> > Signed off by line put:
> Shouldn't it be only v2 as I haven't sent a v2 for this before.

It should be ok.  There was a v1 that only did list_entry and where all
the patches had the same subject, but Greg already dropped that one.

julia

>
> Regards,
> Srishti
> >
> > ---
> > v2 and v3: Changes to the subjects and changelogs.
> >
> > regards,
> > dan carpenter
>
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [Outreachy kernel] [PATCH] Staging: rtl8188eu: core: Use list_for_each_entry_safe

2017-10-04 Thread Srishti Sharma
On Wed, Oct 4, 2017 at 10:37 PM, Julia Lawall  wrote:
>
>
> On Wed, 4 Oct 2017, Srishti Sharma wrote:
>
>> On Wed, Oct 4, 2017 at 8:38 PM, Dan Carpenter  
>> wrote:
>> > On Wed, Oct 04, 2017 at 03:34:05PM +0200, Julia Lawall wrote:
>> >> Again, you have three patches on different files with the same subject
>> >> line.  You could add the file name eg rtw_ap: to the subject line to make
>> >> them unique.
>> >>
>> >
>> > And the subject needs to start with [PATCH v3] and then after the
>> > Signed off by line put:
>> Shouldn't it be only v2 as I haven't sent a v2 for this before.
>
> It should be ok.  There was a v1 that only did list_entry and where all
> the patches had the same subject, but Greg already dropped that one.

Yes, I have sent another patch where we only need to convert
container_of to list_entry, that is where there is no while loop
,since we now have much less cases of this type , I have sent only one
patch for it.

Regards,
Srishti
> julia
>
>>
>> Regards,
>> Srishti
>> >
>> > ---
>> > v2 and v3: Changes to the subjects and changelogs.
>> >
>> > regards,
>> > dan carpenter
>>
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2] Staging: rtl8188eu: core: rtw_ap: Use list_for_each_entry_safe

2017-10-04 Thread Srishti Sharma
This is a cleanup patch and doesn't change runtime behaviour. It 
changes an open coded list traversal to use list_for_each_entry_safe.
Done using the following semantic patch by coccinelle.

@r@
struct list_head* l;
expression e;
identifier m,list_del_init,f;
type T1;
T1* pos;
iterator name list_for_each_entry_safe;
@@

f(...){

+T1* tmp;
<+...
-while(...)
+list_for_each_entry_safe(pos,tmp,l,m)
{
...
-pos = container_of(l,T1,m);
...
-l=e;
 <+...
 list_del_init(&pos->m)
 ...+>
}
...+>

}

Signed-off-by: Srishti Sharma 
---
Changes in v2
 -Make commit message more clear.
 -Add file name to the subject.

 drivers/staging/rtl8188eu/core/rtw_ap.c | 12 +++-
 1 file changed, 3 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_ap.c 
b/drivers/staging/rtl8188eu/core/rtw_ap.c
index a2c599f..551af9e 100644
--- a/drivers/staging/rtl8188eu/core/rtw_ap.c
+++ b/drivers/staging/rtl8188eu/core/rtw_ap.c
@@ -280,7 +280,7 @@ voidexpire_timeout_chk(struct adapter *padapter)
 {
struct list_head *phead, *plist;
u8 updated = 0;
-   struct sta_info *psta = NULL;
+   struct sta_info *psta = NULL, *tmp;
struct sta_priv *pstapriv = &padapter->stapriv;
u8 chk_alive_num = 0;
char chk_alive_list[NUM_STA];
@@ -292,10 +292,7 @@ void   expire_timeout_chk(struct adapter *padapter)
plist = phead->next;
 
/* check auth_queue */
-   while (phead != plist) {
-   psta = container_of(plist, struct sta_info, auth_list);
-   plist = plist->next;
-
+   list_for_each_entry_safe(psta, tmp, plist, auth_list) {
if (psta->expire_to > 0) {
psta->expire_to--;
if (psta->expire_to == 0) {
@@ -326,10 +323,7 @@ void   expire_timeout_chk(struct adapter *padapter)
plist = phead->next;
 
/* check asoc_queue */
-   while (phead != plist) {
-   psta = container_of(plist, struct sta_info, asoc_list);
-   plist = plist->next;
-
+   list_for_each_entry_safe(psta, tmp, plist, asoc_list) {
if (chk_sta_is_alive(psta) || !psta->expire_to) {
psta->expire_to = pstapriv->expire_to;
psta->keep_alive_trycnt = 0;
-- 
2.7.4

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


[PATCH v2] Staging: rtl8188eu: core: rtw_xmit: Use list_for_each_entry_safe

2017-10-04 Thread Srishti Sharma
This is a cleanup patch and doesn't change runtime behaviour. It
changes an open coded list traversal to use list_for_each_entry_safe.
Done using the following semantic patch by coccinelle.

@r@
struct list_head* l;
expression e;
identifier m,list_del_init,f;
type T1;
T1* pos;
iterator name list_for_each_entry_safe;
@@

f(...){

+T1* tmp;

<+...

-while(...)
+list_for_each_entry_safe(pos,tmp,l,m)
{
...
-pos = container_of(l,T1,m);
...
-l=e;
 <+...
 list_del_init(&pos->m)
 ...+>
}

...+>

}

Signed-off-by: Srishti Sharma 
---
Changes in v2
 -Make commit message more clear.
 -Add file name to the subject.

 drivers/staging/rtl8188eu/core/rtw_xmit.c | 23 ++-
 1 file changed, 6 insertions(+), 17 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_xmit.c 
b/drivers/staging/rtl8188eu/core/rtw_xmit.c
index e8d9858..6d8820b 100644
--- a/drivers/staging/rtl8188eu/core/rtw_xmit.c
+++ b/drivers/staging/rtl8188eu/core/rtw_xmit.c
@@ -1869,7 +1869,7 @@ void wakeup_sta_to_xmit(struct adapter *padapter, struct 
sta_info *psta)
u8 update_mask = 0, wmmps_ac = 0;
struct sta_info *psta_bmc;
struct list_head *xmitframe_plist, *xmitframe_phead;
-   struct xmit_frame *pxmitframe = NULL;
+   struct xmit_frame *pxmitframe = NULL, *tmp;
struct sta_priv *pstapriv = &padapter->stapriv;
 
spin_lock_bh(&psta->sleep_q.lock);
@@ -1877,11 +1877,7 @@ void wakeup_sta_to_xmit(struct adapter *padapter, struct 
sta_info *psta)
xmitframe_phead = get_list_head(&psta->sleep_q);
xmitframe_plist = xmitframe_phead->next;
 
-   while (xmitframe_phead != xmitframe_plist) {
-   pxmitframe = container_of(xmitframe_plist, struct xmit_frame, 
list);
-
-   xmitframe_plist = xmitframe_plist->next;
-
+   list_for_each_entry_safe(pxmitframe, tmp, xmitframe_plist, list) {
list_del_init(&pxmitframe->list);
 
switch (pxmitframe->attrib.priority) {
@@ -1958,11 +1954,8 @@ void wakeup_sta_to_xmit(struct adapter *padapter, struct 
sta_info *psta)
xmitframe_phead = get_list_head(&psta_bmc->sleep_q);
xmitframe_plist = xmitframe_phead->next;
 
-   while (xmitframe_phead != xmitframe_plist) {
-   pxmitframe = container_of(xmitframe_plist, struct 
xmit_frame, list);
-
-   xmitframe_plist = xmitframe_plist->next;
-
+   list_for_each_entry_safe(pxmitframe, tmp, xmitframe_plist,
+list) {
list_del_init(&pxmitframe->list);
 
psta_bmc->sleepq_len--;
@@ -1997,7 +1990,7 @@ void xmit_delivery_enabled_frames(struct adapter 
*padapter, struct sta_info *pst
 {
u8 wmmps_ac = 0;
struct list_head *xmitframe_plist, *xmitframe_phead;
-   struct xmit_frame *pxmitframe = NULL;
+   struct xmit_frame *pxmitframe = NULL, *tmp;
struct sta_priv *pstapriv = &padapter->stapriv;
 
spin_lock_bh(&psta->sleep_q.lock);
@@ -2005,11 +1998,7 @@ void xmit_delivery_enabled_frames(struct adapter 
*padapter, struct sta_info *pst
xmitframe_phead = get_list_head(&psta->sleep_q);
xmitframe_plist = xmitframe_phead->next;
 
-   while (xmitframe_phead != xmitframe_plist) {
-   pxmitframe = container_of(xmitframe_plist, struct xmit_frame, 
list);
-
-   xmitframe_plist = xmitframe_plist->next;
-
+   list_for_each_entry_safe(pxmitframe, tmp, xmitframe_plist, list) {
switch (pxmitframe->attrib.priority) {
case 1:
case 2:
-- 
2.7.4

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


[PATCH v2] Staging: rtl8188eu: core: rtw_mlme_ext: Use list_for_each_entry_safe

2017-10-04 Thread Srishti Sharma
This is a cleanup patch and doesn't change runtime behaviour. It
changes an open coded list traversal to use list_for_each_entry_safe.
Done using the following semantic patch by coccinelle.


@r@
struct list_head* l;
expression e;
identifier m, list_del_init, f;
type T1;
T1* pos;
iterator name list_for_each_entry_safe;
@@

f(...){

+T1* tmp;
<+...
-while(...)
+list_for_each_entry_safe(pos,tmp,l,m)
{
...
-pos = container_of(l,T1,m);
...
-l=e;
 <+...
  list_del_init(&pos->m)
 ...+>
}
...+>
}

Signed-off-by: Srishti Sharma 
---
Changes in v2
 -Make the commit message more clear.
 -Add file name to the subject.

 drivers/staging/rtl8188eu/core/rtw_mlme_ext.c | 8 +++-
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c 
b/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c
index 52f31c7..4e1d06c 100644
--- a/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c
+++ b/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c
@@ -5446,6 +5446,7 @@ u8 mlme_evt_hdl(struct adapter *padapter, unsigned char 
*pbuf)
 
 u8 tx_beacon_hdl(struct adapter *padapter, unsigned char *pbuf)
 {
+   struct xmit_frame *tmp;
if (send_beacon(padapter) == _FAIL) {
DBG_88E("issue_beacon, fail!\n");
return H2C_PARAMETERS_ERROR;
@@ -5469,11 +5470,8 @@ u8 tx_beacon_hdl(struct adapter *padapter, unsigned char 
*pbuf)
xmitframe_phead = get_list_head(&psta_bmc->sleep_q);
xmitframe_plist = xmitframe_phead->next;
 
-   while (xmitframe_phead != xmitframe_plist) {
-   pxmitframe = container_of(xmitframe_plist, 
struct xmit_frame, list);
-
-   xmitframe_plist = xmitframe_plist->next;
-
+   list_for_each_entry_safe(pxmitframe, tmp,
+xmitframe_plist, list) {
list_del_init(&pxmitframe->list);
 
psta_bmc->sleepq_len--;
-- 
2.7.4

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


[PATCH] Staging: rtl8723bs: Externs should be avoided in .C file

2017-10-04 Thread Srinivasan Shanmugam
Removed all the unnecessary extern from rtl8723bs

Signed-off-by: Srinivasan Shanmugam 
---
 drivers/staging/rtl8723bs/core/rtw_recv.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_recv.c 
b/drivers/staging/rtl8723bs/core/rtw_recv.c
index c0b501e..6b5e48c 100644
--- a/drivers/staging/rtl8723bs/core/rtw_recv.c
+++ b/drivers/staging/rtl8723bs/core/rtw_recv.c
@@ -1226,7 +1226,8 @@ sint validate_recv_ctrl_frame(struct adapter *padapter, 
union recv_frame *precv_
 
 union recv_frame *recvframe_chk_defrag(struct adapter *padapter, union 
recv_frame *precv_frame);
 
-static sint validate_recv_mgnt_frame(struct adapter *padapter, union 
recv_frame *precv_frame)
+static int validate_recv_mgnt_frame(struct adapter *padapter,
+   union recv_frame *precv_frame)
 {
/* struct mlme_priv *pmlmepriv = &adapter->mlmepriv; */
 
-- 
1.9.1

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


[PATCH] Staging: rtl8723bs: Externs should be avoided in .C file

2017-10-04 Thread Srinivasan Shanmugam
Removed warning from 
0001-Staging-rtl8723bs-Externs-should-be-avoided-in-.C-fi.patch file after 
running checkpatch.pl

Signed-off-by: Srinivasan Shanmugam 
---
 drivers/staging/rtl8723bs/core/rtw_recv.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_recv.c 
b/drivers/staging/rtl8723bs/core/rtw_recv.c
index c0b501e..6b5e48c 100644
--- a/drivers/staging/rtl8723bs/core/rtw_recv.c
+++ b/drivers/staging/rtl8723bs/core/rtw_recv.c
@@ -1226,7 +1226,8 @@ sint validate_recv_ctrl_frame(struct adapter *padapter, 
union recv_frame *precv_
 
 union recv_frame *recvframe_chk_defrag(struct adapter *padapter, union 
recv_frame *precv_frame);
 
-static sint validate_recv_mgnt_frame(struct adapter *padapter, union 
recv_frame *precv_frame)
+static int validate_recv_mgnt_frame(struct adapter *padapter,
+   union recv_frame *precv_frame)
 {
/* struct mlme_priv *pmlmepriv = &adapter->mlmepriv; */
 
-- 
1.9.1

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


[PATCH v2] staging: fbtft: differentiate between buffer and data types to fix sparse warning

2017-10-04 Thread Alfonso Lima Astor
sparse was complaning about an incorrect type cast:
drivers/staging/fbtft/fbtft-bus.c:60:1: warning: incorrect type in assignment 
(different base types)
drivers/staging/fbtft/fbtft-bus.c:60:1:expected unsigned short [unsigned] 
[short] [usertype] 
drivers/staging/fbtft/fbtft-bus.c:60:1:got restricted __be16 [usertype] 

drivers/staging/fbtft/fbtft-bus.c:60:1: warning: incorrect type in assignment 
(different base types)
drivers/staging/fbtft/fbtft-bus.c:60:1:expected unsigned short [unsigned] 
[short] [usertype] 
drivers/staging/fbtft/fbtft-bus.c:60:1:got restricted __be16 [usertype] 


The solution is to add an extra parameter to the macro to
differentiate between buffer type and data type.

Cc: Thomas Petazzoni 
Signed-off-by: Alfonso Lima Astor 

---
changes for v2:
Add maintainer to CC and add result of macro below '---'
to ease review of changes.

For "fbtft_write_reg8_bus8" and "fbtft_write_reg16_bus16 result"
is the same before and after patch. For "fbtft_write_reg16_bus8"
macro result after patch is:

void fbtft_write_reg16_bus8(struct fbtft_par *par, int len, ...)
{
va_list args;
int i, ret;
int offset = 0;
__be16 *buf = (__be16 *)par->buf;

if (unlikely(par->debug & DEBUG_WRITE_REGISTER)) {
va_start(args, len);
for (i = 0; i < len; i++) {
buf[i] = cpu_to_be16((u16)va_arg(args, unsigned int));
}
va_end(args);
fbtft_par_dbg_hex(DEBUG_WRITE_REGISTER, par, par->info->device, 
__be16, buf, len, "%s: ", __func__);
}

va_start(args, len);

if (par->startbyte) {
*(u8 *)par->buf = par->startbyte;
buf = (__be16 *)(par->buf + 1);
offset = 1;
}

*buf = cpu_to_be16((u16)va_arg(args, unsigned int));
ret = fbtft_write_buf_dc(par, par->buf, sizeof(u16) + offset, 0);
if (ret < 0)
goto out;
len--;

if (par->startbyte)
*(u8 *)par->buf = par->startbyte | 0x2;

if (len) {
i = len;
while (i--)
*buf++ = cpu_to_be16((u16)va_arg(args, unsigned int));
fbtft_write_buf_dc(par, par->buf,
   len * (sizeof(u16) + offset), 1);
}
out:
va_end(args);
}

 drivers/staging/fbtft/fbtft-bus.c | 24 
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/drivers/staging/fbtft/fbtft-bus.c 
b/drivers/staging/fbtft/fbtft-bus.c
index a80b5d1..81e8af7 100644
--- a/drivers/staging/fbtft/fbtft-bus.c
+++ b/drivers/staging/fbtft/fbtft-bus.c
@@ -10,33 +10,33 @@
  *
  */
 
-#define define_fbtft_write_reg(func, type, modifier)  \
+#define define_fbtft_write_reg(func, buffer_type, data_type, modifier)\
 void func(struct fbtft_par *par, int len, ...)\
 { \
va_list args; \
int i, ret;   \
int offset = 0;   \
-   type *buf = (type *)par->buf; \
+   buffer_type *buf = (buffer_type *)par->buf;   \
  \
if (unlikely(par->debug & DEBUG_WRITE_REGISTER)) {\
va_start(args, len);  \
for (i = 0; i < len; i++) {   \
-   buf[i] = (type)va_arg(args, unsigned int);\
+   buf[i] = modifier((data_type)va_arg(args, unsigned 
int)); \
} \
va_end(args); \
-   fbtft_par_dbg_hex(DEBUG_WRITE_REGISTER, par, par->info->device, 
type, buf, len, "%s: ", __func__);   \
+   fbtft_par_dbg_hex(DEBUG_WRITE_REGISTER, par, par->info->device, 
buffer_type, buf, len, "%s: ", __func__); \
} \
  \
va_start(args, len);  \
  \
if (par->startbyte) { \
*(u8 *)par->buf = par->startbyte; \
-   buf = (type *)(par->buf + 1);  

[PATCH] staging: ccree: local variable "dev" not required

2017-10-04 Thread sunil . m
From: Suniel Mahesh 

There is no need to create a local pointer variable "dev" and
pass it various API's, instead use plat_dev which is enumerated
by platform core on successful probe.

Signed-off-by: Suniel Mahesh 
---
Note:
- Patch was tested and built(ARCH=arm) on staging-testing.
- No build issues reported, however it was not tested on
  real hardware.
---
 drivers/staging/ccree/ssi_driver.c | 63 +++---
 1 file changed, 31 insertions(+), 32 deletions(-)

diff --git a/drivers/staging/ccree/ssi_driver.c 
b/drivers/staging/ccree/ssi_driver.c
index 5f03c25..eb907ce 100644
--- a/drivers/staging/ccree/ssi_driver.c
+++ b/drivers/staging/ccree/ssi_driver.c
@@ -205,12 +205,11 @@ static int init_cc_resources(struct platform_device 
*plat_dev)
struct resource *req_mem_cc_regs = NULL;
void __iomem *cc_base = NULL;
struct ssi_drvdata *new_drvdata;
-   struct device *dev = &plat_dev->dev;
-   struct device_node *np = dev->of_node;
+   struct device_node *np = plat_dev->dev.of_node;
u32 signature_val;
int rc = 0;
 
-   new_drvdata = devm_kzalloc(dev, sizeof(*new_drvdata), GFP_KERNEL);
+   new_drvdata = devm_kzalloc(&plat_dev->dev, sizeof(*new_drvdata), 
GFP_KERNEL);
if (!new_drvdata) {
rc = -ENOMEM;
goto post_drvdata_err;
@@ -225,16 +224,16 @@ static int init_cc_resources(struct platform_device 
*plat_dev)
/* First CC registers space */
req_mem_cc_regs = platform_get_resource(plat_dev, IORESOURCE_MEM, 0);
/* Map registers space */
-   new_drvdata->cc_base = devm_ioremap_resource(dev, req_mem_cc_regs);
+   new_drvdata->cc_base = devm_ioremap_resource(&plat_dev->dev, 
req_mem_cc_regs);
if (IS_ERR(new_drvdata->cc_base)) {
-   dev_err(dev, "Failed to ioremap registers");
+   dev_err(&plat_dev->dev, "Failed to ioremap registers");
rc = PTR_ERR(new_drvdata->cc_base);
goto post_drvdata_err;
}
 
-   dev_dbg(dev, "Got MEM resource (%s): %pR\n", req_mem_cc_regs->name,
+   dev_dbg(&plat_dev->dev, "Got MEM resource (%s): %pR\n", 
req_mem_cc_regs->name,
req_mem_cc_regs);
-   dev_dbg(dev, "CC registers mapped from %pa to 0x%p\n",
+   dev_dbg(&plat_dev->dev, "CC registers mapped from %pa to 0x%p\n",
&req_mem_cc_regs->start, new_drvdata->cc_base);
 
cc_base = new_drvdata->cc_base;
@@ -242,120 +241,120 @@ static int init_cc_resources(struct platform_device 
*plat_dev)
/* Then IRQ */
new_drvdata->irq = platform_get_irq(plat_dev, 0);
if (new_drvdata->irq < 0) {
-   dev_err(dev, "Failed getting IRQ resource\n");
+   dev_err(&plat_dev->dev, "Failed getting IRQ resource\n");
rc = new_drvdata->irq;
goto post_drvdata_err;
}
 
-   rc = devm_request_irq(dev, new_drvdata->irq, cc_isr,
+   rc = devm_request_irq(&plat_dev->dev, new_drvdata->irq, cc_isr,
  IRQF_SHARED, "arm_cc7x", new_drvdata);
if (rc) {
-   dev_err(dev, "Could not register to interrupt %d\n",
+   dev_err(&plat_dev->dev, "Could not register to interrupt %d\n",
new_drvdata->irq);
goto post_drvdata_err;
}
-   dev_dbg(dev, "Registered to IRQ: %d\n", new_drvdata->irq);
+   dev_dbg(&plat_dev->dev, "Registered to IRQ: %d\n", new_drvdata->irq);
 
rc = cc_clk_on(new_drvdata);
if (rc)
goto post_drvdata_err;
 
-   if (!dev->dma_mask)
-   dev->dma_mask = &dev->coherent_dma_mask;
+   if (!plat_dev->dev.dma_mask)
+   plat_dev->dev.dma_mask = &plat_dev->dev.coherent_dma_mask;
 
-   if (!dev->coherent_dma_mask)
-   dev->coherent_dma_mask = DMA_BIT_MASK(DMA_BIT_MASK_LEN);
+   if (!plat_dev->dev.coherent_dma_mask)
+  plat_dev->dev.coherent_dma_mask = DMA_BIT_MASK(DMA_BIT_MASK_LEN);
 
/* Verify correct mapping */
signature_val = CC_HAL_READ_REGISTER(CC_REG_OFFSET(HOST_RGF, 
HOST_SIGNATURE));
if (signature_val != DX_DEV_SIGNATURE) {
-   dev_err(dev, "Invalid CC signature: SIGNATURE=0x%08X != 
expected=0x%08X\n",
+   dev_err(&plat_dev->dev, "Invalid CC signature: SIGNATURE=0x%08X 
!= expected=0x%08X\n",
signature_val, (u32)DX_DEV_SIGNATURE);
rc = -EINVAL;
goto post_clk_err;
}
-   dev_dbg(dev, "CC SIGNATURE=0x%08X\n", signature_val);
+   dev_dbg(&plat_dev->dev, "CC SIGNATURE=0x%08X\n", signature_val);
 
/* Display HW versions */
-   dev_info(dev, "ARM CryptoCell %s Driver: HW version 0x%08X, Driver 
version %s\n",
+   dev_info(&plat_dev->dev, "ARM CryptoCell %s Driver: HW version 0x%08X, 
Driver version %s\n",
 SSI_DEV_NAME_STR,
 CC_HAL_READ_REGI

[PATCH 1/2] Staging: rtl8723bs: Externs should be avoided in .C file

2017-10-04 Thread Srinivasan Shanmugam
Removed all unnecessary externs warnings in rtl8723bs

Signed-off-by: Srinivasan Shanmugam 
---
 drivers/staging/rtl8723bs/core/rtw_efuse.c| 7 +--
 drivers/staging/rtl8723bs/core/rtw_ioctl_set.c| 1 -
 drivers/staging/rtl8723bs/core/rtw_mlme.c | 2 --
 drivers/staging/rtl8723bs/core/rtw_recv.c | 8 
 drivers/staging/rtl8723bs/core/rtw_wlan_util.c| 3 ---
 drivers/staging/rtl8723bs/include/rtw_ioctl_set.h | 2 ++
 6 files changed, 7 insertions(+), 16 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_efuse.c 
b/drivers/staging/rtl8723bs/core/rtw_efuse.c
index 44b92ef..0203202 100644
--- a/drivers/staging/rtl8723bs/core/rtw_efuse.c
+++ b/drivers/staging/rtl8723bs/core/rtw_efuse.c
@@ -43,12 +43,7 @@
 #define EFUSE_CTRL REG_EFUSE_CTRL  /*  E-Fuse 
Control. */
 /*  */
 
-bool
-Efuse_Read1ByteFromFakeContent(
-   struct adapter *padapter,
-   u16 Offset,
-   u8 *Value);
-bool
+static bool
 Efuse_Read1ByteFromFakeContent(
struct adapter *padapter,
u16 Offset,
diff --git a/drivers/staging/rtl8723bs/core/rtw_ioctl_set.c 
b/drivers/staging/rtl8723bs/core/rtw_ioctl_set.c
index d815a69..749101ef 100644
--- a/drivers/staging/rtl8723bs/core/rtw_ioctl_set.c
+++ b/drivers/staging/rtl8723bs/core/rtw_ioctl_set.c
@@ -63,7 +63,6 @@ u8 rtw_validate_ssid(struct ndis_802_11_ssid *ssid)
return ret;
 }
 
-u8 rtw_do_join(struct adapter *padapter);
 u8 rtw_do_join(struct adapter *padapter)
 {
struct list_head*plist, *phead;
diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme.c 
b/drivers/staging/rtl8723bs/core/rtw_mlme.c
index 008063a..0018763 100644
--- a/drivers/staging/rtl8723bs/core/rtw_mlme.c
+++ b/drivers/staging/rtl8723bs/core/rtw_mlme.c
@@ -18,8 +18,6 @@
 #include 
 #include 
 
-extern u8 rtw_do_join(struct adapter *padapter);
-
 sint   _rtw_init_mlme_priv(struct adapter *padapter)
 {
sinti;
diff --git a/drivers/staging/rtl8723bs/core/rtw_recv.c 
b/drivers/staging/rtl8723bs/core/rtw_recv.c
index 8817902..c0b501e 100644
--- a/drivers/staging/rtl8723bs/core/rtw_recv.c
+++ b/drivers/staging/rtl8723bs/core/rtw_recv.c
@@ -26,7 +26,7 @@
 /* Bridge-Tunnel header (for EtherTypes ETH_P_AARP and ETH_P_IPX) */
 u8 rtw_bridge_tunnel_header[] = { 0xaa, 0xaa, 0x03, 0x00, 0x00, 0xf8 };
 
-void rtw_signal_stat_timer_hdl(RTW_TIMER_HDL_ARGS);
+static void rtw_signal_stat_timer_hdl(RTW_TIMER_HDL_ARGS);
 
 void _rtw_init_sta_recv_priv(struct sta_recv_priv *psta_recvpriv)
 {
@@ -1225,8 +1225,8 @@ sint validate_recv_ctrl_frame(struct adapter *padapter, 
union recv_frame *precv_
 }
 
 union recv_frame *recvframe_chk_defrag(struct adapter *padapter, union 
recv_frame *precv_frame);
-sint validate_recv_mgnt_frame(struct adapter *padapter, union recv_frame 
*precv_frame);
-sint validate_recv_mgnt_frame(struct adapter *padapter, union recv_frame 
*precv_frame)
+
+static sint validate_recv_mgnt_frame(struct adapter *padapter, union 
recv_frame *precv_frame)
 {
/* struct mlme_priv *pmlmepriv = &adapter->mlmepriv; */
 
@@ -2597,7 +2597,7 @@ s32 rtw_recv_entry(union recv_frame *precvframe)
return ret;
 }
 
-void rtw_signal_stat_timer_hdl(RTW_TIMER_HDL_ARGS)
+static void rtw_signal_stat_timer_hdl(RTW_TIMER_HDL_ARGS)
 {
struct adapter *adapter = (struct adapter *)FunctionContext;
struct recv_priv *recvpriv = &adapter->recvpriv;
diff --git a/drivers/staging/rtl8723bs/core/rtw_wlan_util.c 
b/drivers/staging/rtl8723bs/core/rtw_wlan_util.c
index a169534..deac88e 100644
--- a/drivers/staging/rtl8723bs/core/rtw_wlan_util.c
+++ b/drivers/staging/rtl8723bs/core/rtw_wlan_util.c
@@ -37,9 +37,6 @@
 static unsigned char RSN_TKIP_CIPHER[4] = {0x00, 0x0f, 0xac, 0x02};
 static unsigned char WPA_TKIP_CIPHER[4] = {0x00, 0x50, 0xf2, 0x02};
 
-extern unsigned char RTW_WPA_OUI[];
-extern unsigned char WPA_TKIP_CIPHER[4];
-
 #define R2T_PHY_DELAY  (0)
 
 /* define WAIT_FOR_BCN_TO_MIN  (3000) */
diff --git a/drivers/staging/rtl8723bs/include/rtw_ioctl_set.h 
b/drivers/staging/rtl8723bs/include/rtw_ioctl_set.h
index ebf2335..a139992 100644
--- a/drivers/staging/rtl8723bs/include/rtw_ioctl_set.h
+++ b/drivers/staging/rtl8723bs/include/rtw_ioctl_set.h
@@ -37,5 +37,7 @@
 u8 rtw_validate_ssid(struct ndis_802_11_ssid *ssid);
 
 u16 rtw_get_cur_max_rate(struct adapter *adapter);
+u8 rtw_do_join(struct adapter *padapter);
+
 
 #endif
-- 
1.9.1

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


[PATCH 2/2] Staging: rtl8723bs: Externs should be avoided in .C file

2017-10-04 Thread Srinivasan Shanmugam
Removed all the unnecessary extern from rtl8723bs

Signed-off-by: Srinivasan Shanmugam 
---
 drivers/staging/rtl8723bs/core/rtw_recv.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_recv.c 
b/drivers/staging/rtl8723bs/core/rtw_recv.c
index c0b501e..6b5e48c 100644
--- a/drivers/staging/rtl8723bs/core/rtw_recv.c
+++ b/drivers/staging/rtl8723bs/core/rtw_recv.c
@@ -1226,7 +1226,8 @@ sint validate_recv_ctrl_frame(struct adapter *padapter, 
union recv_frame *precv_
 
 union recv_frame *recvframe_chk_defrag(struct adapter *padapter, union 
recv_frame *precv_frame);
 
-static sint validate_recv_mgnt_frame(struct adapter *padapter, union 
recv_frame *precv_frame)
+static int validate_recv_mgnt_frame(struct adapter *padapter,
+   union recv_frame *precv_frame)
 {
/* struct mlme_priv *pmlmepriv = &adapter->mlmepriv; */
 
-- 
1.9.1

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


[PATCH] vmbus: initialize reserved fields in messages

2017-10-04 Thread Stephen Hemminger
Make sure and initialize reserved fields in messages to host,
rather than passing stack junk.

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

diff --git a/drivers/hv/channel.c b/drivers/hv/channel.c
index efd5db743319..9f48f454bde0 100644
--- a/drivers/hv/channel.c
+++ b/drivers/hv/channel.c
@@ -745,6 +745,7 @@ int vmbus_sendpacket_pagebuffer(struct vmbus_channel 
*channel,
desc.dataoffset8 = descsize >> 3; /* in 8-bytes granularity */
desc.length8 = (u16)(packetlen_aligned >> 3);
desc.transactionid = requestid;
+   desc.reserved = 0;
desc.rangecount = pagecount;
 
for (i = 0; i < pagecount; i++) {
@@ -788,6 +789,7 @@ int vmbus_sendpacket_mpb_desc(struct vmbus_channel *channel,
desc->dataoffset8 = desc_size >> 3; /* in 8-bytes granularity */
desc->length8 = (u16)(packetlen_aligned >> 3);
desc->transactionid = requestid;
+   desc->reserved = 0;
desc->rangecount = 1;
 
bufferlist[0].iov_base = desc;
-- 
2.11.0

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


[PATCH] staging/wilc1000: Convert timers to use timer_setup()

2017-10-04 Thread Kees Cook
As part of removing the timer_list.data field, this converts the wilc1000
driver to using from_timer and an explicit per-timer data field, since
there doesn't appear to be a way to sanely resolve vif from hif_drv.

Cc: Aditya Shankar 
Cc: Ganesh Krishna 
Cc: Greg Kroah-Hartman 
Cc: linux-wirel...@vger.kernel.org
Cc: de...@driverdev.osuosl.org
Cc: Thomas Gleixner 
Signed-off-by: Kees Cook 
---
This requires commit 686fef928bba ("timer: Prepare to change timer
callback argument type") in v4.14-rc3, but should be otherwise
stand-alone.
---
 drivers/staging/wilc1000/host_interface.c | 39 +--
 drivers/staging/wilc1000/host_interface.h |  5 
 2 files changed, 27 insertions(+), 17 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 7b620658ec38..c16f96308a97 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -238,6 +238,7 @@ static struct completion hif_driver_comp;
 static struct completion hif_wait_response;
 static struct mutex hif_deinit_lock;
 static struct timer_list periodic_rssi;
+static struct wilc_vif *periodic_rssi_vif;
 
 u8 wilc_multicast_mac_addr_list[WILC_MULTICAST_TABLE_SIZE][ETH_ALEN];
 
@@ -2272,7 +2273,7 @@ static int Handle_RemainOnChan(struct wilc_vif *vif,
 ERRORHANDLER:
{
P2P_LISTEN_STATE = 1;
-   hif_drv->remain_on_ch_timer.data = (unsigned long)vif;
+   hif_drv->remain_on_ch_timer_vif = vif;
mod_timer(&hif_drv->remain_on_ch_timer,
  jiffies +
  msecs_to_jiffies(pstrHostIfRemainOnChan->duration));
@@ -2360,11 +2361,13 @@ static u32 Handle_ListenStateExpired(struct wilc_vif 
*vif,
return result;
 }
 
-static void ListenTimerCB(unsigned long arg)
+static void ListenTimerCB(struct timer_list *t)
 {
+   struct host_if_drv *hif_drv = from_timer(hif_drv, t,
+ remain_on_ch_timer);
+   struct wilc_vif *vif = hif_drv->remain_on_ch_timer_vif;
s32 result = 0;
struct host_if_msg msg;
-   struct wilc_vif *vif = (struct wilc_vif *)arg;
 
del_timer(&vif->hif_drv->remain_on_ch_timer);
 
@@ -2643,9 +2646,10 @@ static void host_if_work(struct work_struct *work)
complete(&hif_thread_comp);
 }
 
-static void TimerCB_Scan(unsigned long arg)
+static void TimerCB_Scan(struct timer_list *t)
 {
-   struct wilc_vif *vif = (struct wilc_vif *)arg;
+   struct host_if_drv *hif_drv = from_timer(hif_drv, t, scan_timer);
+   struct wilc_vif *vif = hif_drv->scan_timer_vif;
struct host_if_msg msg;
 
memset(&msg, 0, sizeof(struct host_if_msg));
@@ -2655,9 +2659,11 @@ static void TimerCB_Scan(unsigned long arg)
wilc_enqueue_cmd(&msg);
 }
 
-static void TimerCB_Connect(unsigned long arg)
+static void TimerCB_Connect(struct timer_list *t)
 {
-   struct wilc_vif *vif = (struct wilc_vif *)arg;
+   struct host_if_drv *hif_drv = from_timer(hif_drv, t,
+ connect_timer);
+   struct wilc_vif *vif = hif_drv->connect_timer_vif;
struct host_if_msg msg;
 
memset(&msg, 0, sizeof(struct host_if_msg));
@@ -3040,7 +3046,7 @@ int wilc_set_join_req(struct wilc_vif *vif, u8 *bssid, 
const u8 *ssid,
return -EFAULT;
}
 
-   hif_drv->connect_timer.data = (unsigned long)vif;
+   hif_drv->connect_timer_vif = vif;
mod_timer(&hif_drv->connect_timer,
  jiffies + msecs_to_jiffies(HOST_IF_CONNECT_TIMEOUT));
 
@@ -3283,7 +3289,7 @@ int wilc_scan(struct wilc_vif *vif, u8 scan_source, u8 
scan_type,
return -EINVAL;
}
 
-   hif_drv->scan_timer.data = (unsigned long)vif;
+   hif_drv->scan_timer_vif = vif;
mod_timer(&hif_drv->scan_timer,
  jiffies + msecs_to_jiffies(HOST_IF_SCAN_TIMEOUT));
 
@@ -3309,9 +3315,9 @@ int wilc_hif_set_cfg(struct wilc_vif *vif,
return wilc_enqueue_cmd(&msg);
 }
 
-static void GetPeriodicRSSI(unsigned long arg)
+static void GetPeriodicRSSI(struct timer_list *unused)
 {
-   struct wilc_vif *vif = (struct wilc_vif *)arg;
+   struct wilc_vif *vif = periodic_rssi_vif;
 
if (!vif->hif_drv) {
netdev_err(vif->ndev, "Driver handler is NULL\n");
@@ -3321,7 +3327,6 @@ static void GetPeriodicRSSI(unsigned long arg)
if (vif->hif_drv->hif_state == HOST_IF_CONNECTED)
wilc_get_statistics(vif, &vif->wilc->dummy_statistics);
 
-   periodic_rssi.data = (unsigned long)vif;
mod_timer(&periodic_rssi, jiffies + msecs_to_jiffies(5000));
 }
 
@@ -3374,14 +3379,14 @@ int wilc_init(struct net_device *dev, struct 
host_if_drv **hif_drv_handler)
goto _fail_;
}
 
-   setup_timer(&periodic_rssi, GetPeriodicRSSI,
-   (unsigned l

[PATCH] staging: rtl8712: Convert timers to use timer_setup()

2017-10-04 Thread Kees Cook
In preparation for unconditionally passing the struct timer_list pointer to
all timer callbacks, switch to using the new timer_setup() and from_timer()
to pass the timer pointer explicitly.

Cc: Larry Finger 
Cc: Florian Schilhabel 
Cc: Greg Kroah-Hartman 
Cc: Tejaswini Poluri 
Cc: Scott Matheina 
Cc: Varsha Rao 
Cc: Julia Lawall 
Cc: Aleksey Kurbatov 
Cc: Vijai Kumar K 
Cc: Wei Yongjun 
Cc: "Raphaël Beamonte" 
Cc: Jannik Becher 
Cc: Joseph Wright 
Cc: de...@driverdev.osuosl.org
Cc: Thomas Gleixner 
Signed-off-by: Kees Cook 
---
This requires commit 686fef928bba ("timer: Prepare to change timer
callback argument type") in v4.14-rc3, but should be otherwise
stand-alone.
---
 drivers/staging/rtl8712/mlme_linux.c   | 48 +++---
 drivers/staging/rtl8712/os_intfs.c |  4 +--
 drivers/staging/rtl8712/rtl871x_pwrctrl.c  |  8 ++---
 drivers/staging/rtl8712/rtl871x_security.c |  5 ++--
 drivers/staging/rtl8712/rtl871x_security.h |  2 +-
 5 files changed, 34 insertions(+), 33 deletions(-)

diff --git a/drivers/staging/rtl8712/mlme_linux.c 
b/drivers/staging/rtl8712/mlme_linux.c
index a077069d6227..3c7c4a4faeb2 100644
--- a/drivers/staging/rtl8712/mlme_linux.c
+++ b/drivers/staging/rtl8712/mlme_linux.c
@@ -32,39 +32,45 @@
 #include "drv_types.h"
 #include "mlme_osdep.h"
 
-static void sitesurvey_ctrl_handler(unsigned long data)
+static void sitesurvey_ctrl_handler(struct timer_list *t)
 {
-   struct _adapter *adapter = (struct _adapter *)data;
+   struct _adapter *adapter =
+   from_timer(adapter, t,
+   mlmepriv.sitesurveyctrl.sitesurvey_ctrl_timer);
 
_r8712_sitesurvey_ctrl_handler(adapter);
mod_timer(&adapter->mlmepriv.sitesurveyctrl.sitesurvey_ctrl_timer,
  jiffies + msecs_to_jiffies(3000));
 }
 
-static void join_timeout_handler (unsigned long data)
+static void join_timeout_handler (struct timer_list *t)
 {
-   struct _adapter *adapter = (struct _adapter *)data;
+   struct _adapter *adapter =
+   from_timer(adapter, t, mlmepriv.assoc_timer);
 
_r8712_join_timeout_handler(adapter);
 }
 
-static void _scan_timeout_handler (unsigned long data)
+static void _scan_timeout_handler (struct timer_list *t)
 {
-   struct _adapter *adapter = (struct _adapter *)data;
+   struct _adapter *adapter =
+   from_timer(adapter, t, mlmepriv.scan_to_timer);
 
r8712_scan_timeout_handler(adapter);
 }
 
-static void dhcp_timeout_handler (unsigned long data)
+static void dhcp_timeout_handler (struct timer_list *t)
 {
-   struct _adapter *adapter = (struct _adapter *)data;
+   struct _adapter *adapter =
+   from_timer(adapter, t, mlmepriv.dhcp_timer);
 
_r8712_dhcp_timeout_handler(adapter);
 }
 
-static void wdg_timeout_handler (unsigned long data)
+static void wdg_timeout_handler (struct timer_list *t)
 {
-   struct _adapter *adapter = (struct _adapter *)data;
+   struct _adapter *adapter =
+   from_timer(adapter, t, mlmepriv.wdg_timer);
 
_r8712_wdg_timeout_handler(adapter);
 
@@ -76,17 +82,12 @@ void r8712_init_mlme_timer(struct _adapter *padapter)
 {
struct  mlme_priv *pmlmepriv = &padapter->mlmepriv;
 
-   setup_timer(&pmlmepriv->assoc_timer, join_timeout_handler,
-   (unsigned long)padapter);
-   setup_timer(&pmlmepriv->sitesurveyctrl.sitesurvey_ctrl_timer,
-   sitesurvey_ctrl_handler,
-   (unsigned long)padapter);
-   setup_timer(&pmlmepriv->scan_to_timer, _scan_timeout_handler,
-   (unsigned long)padapter);
-   setup_timer(&pmlmepriv->dhcp_timer, dhcp_timeout_handler,
-   (unsigned long)padapter);
-   setup_timer(&pmlmepriv->wdg_timer, wdg_timeout_handler,
-   (unsigned long)padapter);
+   timer_setup(&pmlmepriv->assoc_timer, join_timeout_handler, 0);
+   timer_setup(&pmlmepriv->sitesurveyctrl.sitesurvey_ctrl_timer,
+   sitesurvey_ctrl_handler, 0);
+   timer_setup(&pmlmepriv->scan_to_timer, _scan_timeout_handler, 0);
+   timer_setup(&pmlmepriv->dhcp_timer, dhcp_timeout_handler, 0);
+   timer_setup(&pmlmepriv->wdg_timer, wdg_timeout_handler, 0);
 }
 
 void r8712_os_indicate_connect(struct _adapter *adapter)
@@ -118,9 +119,8 @@ void r8712_os_indicate_disconnect(struct _adapter *adapter)
adapter->securitypriv.btkip_countermeasure;
memset((unsigned char *)&adapter->securitypriv, 0,
   sizeof(struct security_priv));
-   setup_timer(&adapter->securitypriv.tkip_timer,
-   r8712_use_tkipkey_handler,
-   (unsigned long)adapter);
+   timer_setup(&adapter->securitypriv.tkip_timer,
+   r8712_use_tkipkey_handler, 0);
/* Restore the PMK information to securitypriv structure
 * for the fo

[PATCH] staging: rtl8192u: Convert timers to use timer_setup()

2017-10-04 Thread Kees Cook
In preparation for unconditionally passing the struct timer_list pointer to
all timer callbacks, switch to using the new timer_setup() and from_timer()
to pass the timer pointer explicitly.

Cc: Greg Kroah-Hartman 
Cc: Derek Robson 
Cc: simran singhal 
Cc: Riccardo Marotti 
Cc: Fabrizio Perria 
Cc: Arnd Bergmann 
Cc: Baoyou Xie 
Cc: Tuomo Rinne 
Cc: Colin Ian King 
Cc: de...@driverdev.osuosl.org
Cc: Greg Kroah-Hartman 
Cc: simran singhal 
Cc: Derek Robson 
Cc: Riccardo Marotti 
Cc: Arnd Bergmann 
Cc: Fabrizio Perria 
Cc: Baoyou Xie 
Cc: Tuomo Rinne 
Cc: Colin Ian King 
Cc: de...@driverdev.osuosl.org
Cc: Thomas Gleixner 
Signed-off-by: Kees Cook 
---
This requires commit 686fef928bba ("timer: Prepare to change timer
callback argument type") in v4.14-rc3, but should be otherwise
stand-alone.
---
 drivers/staging/rtl8192u/ieee80211/ieee80211.h |  6 +--
 .../staging/rtl8192u/ieee80211/ieee80211_crypt.c   |  4 +-
 .../staging/rtl8192u/ieee80211/ieee80211_crypt.h   |  2 +-
 .../staging/rtl8192u/ieee80211/ieee80211_module.c  |  4 +-
 .../staging/rtl8192u/ieee80211/rtl819x_BAProc.c| 12 +++---
 .../staging/rtl8192u/ieee80211/rtl819x_TSProc.c| 46 +++---
 drivers/staging/rtl8192u/r8192U_core.c | 11 +++---
 drivers/staging/rtl8192u/r8192U_dm.c   |  9 ++---
 drivers/staging/rtl8192u/r8192U_dm.h   |  2 +-
 9 files changed, 46 insertions(+), 50 deletions(-)

diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211.h 
b/drivers/staging/rtl8192u/ieee80211/ieee80211.h
index b062cad052b9..0a2198b97a93 100644
--- a/drivers/staging/rtl8192u/ieee80211/ieee80211.h
+++ b/drivers/staging/rtl8192u/ieee80211/ieee80211.h
@@ -2395,9 +2395,9 @@ void TsInitAddBA(struct ieee80211_device *ieee, 
PTX_TS_RECORD pTS,
 u8 Policy, u8 bOverwritePending);
 void TsInitDelBA(struct ieee80211_device *ieee,
 PTS_COMMON_INFO pTsCommonInfo, TR_SELECT TxRxSelect);
-void BaSetupTimeOut(unsigned long data);
-void TxBaInactTimeout(unsigned long data);
-void RxBaInactTimeout(unsigned long data);
+void BaSetupTimeOut(struct timer_list *t);
+void TxBaInactTimeout(struct timer_list *t);
+void RxBaInactTimeout(struct timer_list *t);
 void ResetBaEntry(PBA_RECORD pBA);
 //function in TS.c
 bool GetTs(
diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt.c 
b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt.c
index 48e80be90ba5..6f457812e5a3 100644
--- a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt.c
+++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt.c
@@ -57,9 +57,9 @@ void ieee80211_crypt_deinit_entries(struct ieee80211_device 
*ieee,
}
 }
 
-void ieee80211_crypt_deinit_handler(unsigned long data)
+void ieee80211_crypt_deinit_handler(struct timer_list *t)
 {
-   struct ieee80211_device *ieee = (struct ieee80211_device *)data;
+   struct ieee80211_device *ieee = from_timer(ieee, t, crypt_deinit_timer);
unsigned long flags;
 
spin_lock_irqsave(&ieee->lock, flags);
diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt.h 
b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt.h
index a0aa0f5be63a..1f2aea7e0e55 100644
--- a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt.h
+++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt.h
@@ -83,7 +83,7 @@ int ieee80211_register_crypto_ops(struct ieee80211_crypto_ops 
*ops);
 int ieee80211_unregister_crypto_ops(struct ieee80211_crypto_ops *ops);
 struct ieee80211_crypto_ops *ieee80211_get_crypto_ops(const char *name);
 void ieee80211_crypt_deinit_entries(struct ieee80211_device *ieee, int force);
-void ieee80211_crypt_deinit_handler(unsigned long data);
+void ieee80211_crypt_deinit_handler(struct timer_list *t);
 void ieee80211_crypt_delayed_deinit(struct ieee80211_device *ieee,
struct ieee80211_crypt_data **crypt);
 
diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_module.c 
b/drivers/staging/rtl8192u/ieee80211/ieee80211_module.c
index 8f236b332a47..90a097f2cd4e 100644
--- a/drivers/staging/rtl8192u/ieee80211/ieee80211_module.c
+++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_module.c
@@ -133,8 +133,8 @@ struct net_device *alloc_ieee80211(int sizeof_priv)
ieee->ieee802_1x = 1; /* Default to supporting 802.1x */
 
INIT_LIST_HEAD(&ieee->crypt_deinit_list);
-   setup_timer(&ieee->crypt_deinit_timer,
-   ieee80211_crypt_deinit_handler, (unsigned long)ieee);
+   timer_setup(&ieee->crypt_deinit_timer, ieee80211_crypt_deinit_handler,
+   0);
 
spin_lock_init(&ieee->lock);
spin_lock_init(&ieee->wpax_suitlist_lock);
diff --git a/drivers/staging/rtl8192u/ieee80211/rtl819x_BAProc.c 
b/drivers/staging/rtl8192u/ieee80211/rtl819x_BAProc.c
index 8aa38dcf0dfd..db01750bdfea 100644
--- a/drivers/staging/rtl8192u/ieee80211/rtl819x_BAProc.c
+++ b/drivers/staging/rtl8192u/ieee80211/rtl819x_BAProc.c
@@ -672,18 +672,18 @@ TsInitDelBA( struct ieee80211_device *ieee, 

[PATCH] staging/atomisp: Convert timers to use timer_setup()

2017-10-04 Thread Kees Cook
In preparation for unconditionally passing the struct timer_list pointer to
all timer callbacks, switch to using the new timer_setup() and from_timer()
to pass the timer pointer explicitly.

Cc: Mauro Carvalho Chehab 
Cc: Greg Kroah-Hartman 
Cc: Alan Cox 
Cc: Daeseok Youn 
Cc: Arnd Bergmann 
Cc: linux-me...@vger.kernel.org
Cc: de...@driverdev.osuosl.org
Cc: Thomas Gleixner 
Signed-off-by: Kees Cook 
---
This requires commit 686fef928bba ("timer: Prepare to change timer
callback argument type") in v4.14-rc3, but should be otherwise
stand-alone.
---
 drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.c  | 13 -
 drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.h  |  6 +-
 .../media/atomisp/pci/atomisp2/atomisp_compat_css20.c |  2 +-
 drivers/staging/media/atomisp/pci/atomisp2/atomisp_v4l2.c | 15 +--
 4 files changed, 11 insertions(+), 25 deletions(-)

diff --git a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.c 
b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.c
index f48bf451c1f5..6a38cd64b2a1 100644
--- a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.c
+++ b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.c
@@ -1660,20 +1660,15 @@ void atomisp_css_flush(struct atomisp_device *isp)
dev_dbg(isp->dev, "atomisp css flush done\n");
 }
 
-#ifndef ISP2401
-void atomisp_wdt(unsigned long isp_addr)
-#else
-void atomisp_wdt(unsigned long pipe_addr)
-#endif
+void atomisp_wdt(struct timer_list *t)
 {
 #ifndef ISP2401
-   struct atomisp_device *isp = (struct atomisp_device *)isp_addr;
+   struct atomisp_sub_device *asd = from_timer(asd, t, wdt);
 #else
-   struct atomisp_video_pipe *pipe =
-   (struct atomisp_video_pipe *)pipe_addr;
+   struct atomisp_video_pipe *pipe = from_timer(pipe, t, wdt);
struct atomisp_sub_device *asd = pipe->asd;
-   struct atomisp_device *isp = asd->isp;
 #endif
+   struct atomisp_device *isp = asd->isp;
 
 #ifdef ISP2401
atomic_inc(&pipe->wdt_count);
diff --git a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.h 
b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.h
index 31ba4e613d13..4bb83864da2e 100644
--- a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.h
+++ b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.h
@@ -85,11 +85,7 @@ static inline void __iomem 
*atomisp_get_io_virt_addr(unsigned int address)
 void atomisp_msi_irq_init(struct atomisp_device *isp, struct pci_dev *dev);
 void atomisp_msi_irq_uninit(struct atomisp_device *isp, struct pci_dev *dev);
 void atomisp_wdt_work(struct work_struct *work);
-#ifndef ISP2401
-void atomisp_wdt(unsigned long isp_addr);
-#else
-void atomisp_wdt(unsigned long pipe_addr);
-#endif
+void atomisp_wdt(struct timer_list *t);
 void atomisp_setup_flash(struct atomisp_sub_device *asd);
 irqreturn_t atomisp_isr(int irq, void *dev);
 irqreturn_t atomisp_isr_thread(int irq, void *isp_ptr);
diff --git a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_css20.c 
b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_css20.c
index 05897b747349..0b907474e024 100644
--- a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_css20.c
+++ b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_css20.c
@@ -4515,7 +4515,7 @@ int atomisp_css_isr_thread(struct atomisp_device *isp,
for (i = 0; i < isp->num_of_streams; i++)
atomisp_wdt_stop(&isp->asd[i], 0);
 #ifndef ISP2401
-   atomisp_wdt((unsigned long)isp);
+   atomisp_wdt(&isp->asd[0].wdt);
 #else
queue_work(isp->wdt_work_queue, &isp->wdt_work);
 #endif
diff --git a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_v4l2.c 
b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_v4l2.c
index 663aa916e3ca..76dc779f32c3 100644
--- a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_v4l2.c
+++ b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_v4l2.c
@@ -1155,17 +1155,12 @@ static int init_atomisp_wdts(struct atomisp_device *isp)
struct atomisp_sub_device *asd = &isp->asd[i];
asd = &isp->asd[i];
 #ifndef ISP2401
-   setup_timer(&asd->wdt, atomisp_wdt, (unsigned long)isp);
+   timer_setup(&asd->wdt, atomisp_wdt, 0);
 #else
-   setup_timer(&asd->video_out_capture.wdt,
-   atomisp_wdt, (unsigned long)&asd->video_out_capture);
-   setup_timer(&asd->video_out_preview.wdt,
-   atomisp_wdt, (unsigned long)&asd->video_out_preview);
-   setup_timer(&asd->video_out_vf.wdt,
-   atomisp_wdt, (unsigned long)&asd->video_out_vf);
-   setup_timer(&asd->video_out_video_capture.wdt,
-   atomisp_wdt,
-   (unsigned long)&asd->video_out_video_capture);
+   timer_setup(&asd->video_out_capture.wdt, atomisp_wdt, 0);
+   

[PATCH] staging: rtl8188eu: Convert timers to use timer_setup()

2017-10-04 Thread Kees Cook
In preparation for unconditionally passing the struct timer_list pointer to
all timer callbacks, switch to using the new timer_setup() and from_timer()
to pass the timer pointer explicitly.

Cc: Greg Kroah-Hartman 
Cc: Juliana Rodrigues 
Cc: Ivan Safonov 
Cc: Gargi Sharma 
Cc: sayli karnik 
Cc: Yamanappagouda Patil 
Cc: Luca Ceresoli 
Cc: Victor Carvajal 
Cc: Sebastian Haas 
Cc: de...@driverdev.osuosl.org
Cc: Thomas Gleixner 
Signed-off-by: Kees Cook 
---
This requires commit 686fef928bba ("timer: Prepare to change timer
callback argument type") in v4.14-rc3, but should be otherwise
stand-alone.
---
 drivers/staging/rtl8188eu/core/rtw_led.c |  7 +++
 drivers/staging/rtl8188eu/core/rtw_mlme.c| 15 +--
 drivers/staging/rtl8188eu/core/rtw_mlme_ext.c| 14 --
 drivers/staging/rtl8188eu/core/rtw_pwrctrl.c | 11 ++-
 drivers/staging/rtl8188eu/core/rtw_recv.c| 17 +
 drivers/staging/rtl8188eu/include/rtw_led.h  |  1 -
 drivers/staging/rtl8188eu/include/rtw_mlme.h |  6 +++---
 drivers/staging/rtl8188eu/include/rtw_mlme_ext.h |  6 +++---
 drivers/staging/rtl8188eu/include/rtw_recv.h |  2 +-
 drivers/staging/rtl8188eu/os_dep/mlme_linux.c| 19 +++
 drivers/staging/rtl8188eu/os_dep/recv_linux.c|  5 ++---
 11 files changed, 51 insertions(+), 52 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_led.c 
b/drivers/staging/rtl8188eu/core/rtw_led.c
index 1b9bc9817a57..c4335893d8f6 100644
--- a/drivers/staging/rtl8188eu/core/rtw_led.c
+++ b/drivers/staging/rtl8188eu/core/rtw_led.c
@@ -22,9 +22,9 @@
 /* Callback function of LED BlinkTimer, */
 /* it just schedules to corresponding BlinkWorkItem/led_blink_hdl 
*/
 /*  */
-void BlinkTimerCallback(unsigned long data)
+static void BlinkTimerCallback(struct timer_list *t)
 {
-   struct LED_871x *pLed = (struct LED_871x *)data;
+   struct LED_871x *pLed = from_timer(pLed, t, BlinkTimer);
struct adapter *padapter = pLed->padapter;
 
if ((padapter->bSurpriseRemoved) || (padapter->bDriverStopped))
@@ -73,8 +73,7 @@ void InitLed871x(struct adapter *padapter, struct LED_871x 
*pLed)
 
ResetLedStatus(pLed);
 
-   setup_timer(&pLed->BlinkTimer, BlinkTimerCallback,
-   (unsigned long)pLed);
+   timer_setup(&pLed->BlinkTimer, BlinkTimerCallback, 0);
 
INIT_WORK(&pLed->BlinkWorkItem, BlinkWorkItemCallback);
 }
diff --git a/drivers/staging/rtl8188eu/core/rtw_mlme.c 
b/drivers/staging/rtl8188eu/core/rtw_mlme.c
index f663e6c41f8a..390d5277954f 100644
--- a/drivers/staging/rtl8188eu/core/rtw_mlme.c
+++ b/drivers/staging/rtl8188eu/core/rtw_mlme.c
@@ -1332,9 +1332,10 @@ void rtw_cpwm_event_callback(struct adapter *padapter, 
u8 *pbuf)
  * _rtw_join_timeout_handler - Timeout/faliure handler for CMD JoinBss
  * @adapter: pointer to struct adapter structure
  */
-void _rtw_join_timeout_handler (unsigned long data)
+void _rtw_join_timeout_handler (struct timer_list *t)
 {
-   struct adapter *adapter = (struct adapter *)data;
+   struct adapter *adapter =
+   from_timer(adapter, t, mlmepriv.assoc_timer);
struct  mlme_priv *pmlmepriv = &adapter->mlmepriv;
int do_join_r;
 
@@ -1373,9 +1374,10 @@ void _rtw_join_timeout_handler (unsigned long data)
  * rtw_scan_timeout_handler - Timeout/Faliure handler for CMD SiteSurvey
  * @adapter: pointer to struct adapter structure
  */
-void rtw_scan_timeout_handler (unsigned long data)
+void rtw_scan_timeout_handler (struct timer_list *t)
 {
-   struct adapter *adapter = (struct adapter *)data;
+   struct adapter *adapter =
+   from_timer(adapter, t, mlmepriv.scan_to_timer);
struct  mlme_priv *pmlmepriv = &adapter->mlmepriv;
 
DBG_88E(FUNC_ADPT_FMT" fw_state=%x\n", FUNC_ADPT_ARG(adapter), 
get_fwstate(pmlmepriv));
@@ -1400,9 +1402,10 @@ static void rtw_auto_scan_handler(struct adapter 
*padapter)
}
 }
 
-void rtw_dynamic_check_timer_handlder(unsigned long data)
+void rtw_dynamic_check_timer_handlder(struct timer_list *t)
 {
-   struct adapter *adapter = (struct adapter *)data;
+   struct adapter *adapter =
+   from_timer(adapter, t, mlmepriv.dynamic_chk_timer);
struct registry_priv *pregistrypriv = &adapter->registrypriv;
 
if (!adapter)
diff --git a/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c 
b/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c
index 611c9409bb98..ab73f400f098 100644
--- a/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c
+++ b/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c
@@ -4788,9 +4788,10 @@ void linked_status_chk(struct adapter *padapter)
}
 }
 
-void survey_timer_hdl(unsigned long data)
+void survey_timer_hdl(struct timer_list *t)
 {
-   struct adapter *padapter = (struct adapter *)data;
+   struct adapter *padapter = from_timer(padapter, t,
+   mlmeextpriv.link_timer);

[PATCH] staging: rtl8192e: Convert timers to use timer_setup()

2017-10-04 Thread Kees Cook
In preparation for unconditionally passing the struct timer_list pointer to
all timer callbacks, switch to using the new timer_setup() and from_timer()
to pass the timer pointer explicitly.

Cc: Greg Kroah-Hartman 
Cc: Derek Robson 
Cc: Suniel Mahesh 
Cc: Malcolm Priestley 
Cc: Gargi Sharma 
Cc: Julia Lawall 
Cc: "David S. Miller" 
Cc: Johannes Berg 
Cc: Yamanappagouda Patil 
Cc: Georgiana Rodica Chelu 
Cc: Colin Ian King 
Cc: Baoyou Xie 
Cc: de...@driverdev.osuosl.org
Cc: Thomas Gleixner 
Signed-off-by: Kees Cook 
---
This requires commit 686fef928bba ("timer: Prepare to change timer
callback argument type") in v4.14-rc3, but should be otherwise
stand-alone.
---
 drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 25 ++---
 drivers/staging/rtl8192e/rtl8192e/rtl_core.h |  2 +-
 drivers/staging/rtl8192e/rtl8192e/rtl_dm.c   | 11 +++---
 drivers/staging/rtl8192e/rtl8192e/rtl_pm.c   |  2 +-
 drivers/staging/rtl8192e/rtl819x_BAProc.c| 15 +---
 drivers/staging/rtl8192e/rtl819x_TSProc.c| 56 
 drivers/staging/rtl8192e/rtllib.h|  6 +--
 drivers/staging/rtl8192e/rtllib_softmac.c| 18 -
 8 files changed, 61 insertions(+), 74 deletions(-)

diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c 
b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
index aca52654825b..d2605158546b 100644
--- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
+++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
@@ -85,7 +85,7 @@ static struct pci_driver rtl8192_pci_driver = {
 
 static short _rtl92e_is_tx_queue_empty(struct net_device *dev);
 static void _rtl92e_watchdog_wq_cb(void *data);
-static void _rtl92e_watchdog_timer_cb(unsigned long data);
+static void _rtl92e_watchdog_timer_cb(struct timer_list *t);
 static void _rtl92e_hard_data_xmit(struct sk_buff *skb, struct net_device *dev,
   int rate);
 static int _rtl92e_hard_start_xmit(struct sk_buff *skb, struct net_device 
*dev);
@@ -766,12 +766,12 @@ static int _rtl92e_sta_up(struct net_device *dev, bool 
is_silent_reset)
priv->bfirst_init = false;
 
if (priv->polling_timer_on == 0)
-   rtl92e_check_rfctrl_gpio_timer((unsigned long)dev);
+   rtl92e_check_rfctrl_gpio_timer(&priv->gpio_polling_timer);
 
if (priv->rtllib->state != RTLLIB_LINKED)
rtllib_softmac_start_protocol(priv->rtllib, 0);
rtllib_reset_queue(priv->rtllib);
-   _rtl92e_watchdog_timer_cb((unsigned long)dev);
+   _rtl92e_watchdog_timer_cb(&priv->watch_dog_timer);
 
if (!netif_queue_stopped(dev))
netif_start_queue(dev);
@@ -1075,13 +1075,10 @@ static short _rtl92e_init(struct net_device *dev)
 
rtl92e_dm_init(dev);
 
-   setup_timer(&priv->watch_dog_timer,
-   _rtl92e_watchdog_timer_cb,
-   (unsigned long)dev);
+   timer_setup(&priv->watch_dog_timer, _rtl92e_watchdog_timer_cb, 0);
 
-   setup_timer(&priv->gpio_polling_timer,
-   rtl92e_check_rfctrl_gpio_timer,
-   (unsigned long)dev);
+   timer_setup(&priv->gpio_polling_timer, rtl92e_check_rfctrl_gpio_timer,
+   0);
 
rtl92e_irq_disable(dev);
if (request_irq(dev->irq, _rtl92e_irq, IRQF_SHARED, dev->name, dev)) {
@@ -1531,9 +1528,9 @@ static void _rtl92e_watchdog_wq_cb(void *data)
RT_TRACE(COMP_TRACE, " <==RtUsbCheckForHangWorkItemCallback()\n");
 }
 
-static void _rtl92e_watchdog_timer_cb(unsigned long data)
+static void _rtl92e_watchdog_timer_cb(struct timer_list *t)
 {
-   struct r8192_priv *priv = rtllib_priv((struct net_device *)data);
+   struct r8192_priv *priv = from_timer(priv, t, watch_dog_timer);
 
schedule_delayed_work(&priv->watch_dog_wq, 0);
mod_timer(&priv->watch_dog_timer, jiffies +
@@ -2535,7 +2532,7 @@ static int _rtl92e_pci_probe(struct pci_dev *pdev,
RT_TRACE(COMP_INIT, "dev name: %s\n", dev->name);
 
if (priv->polling_timer_on == 0)
-   rtl92e_check_rfctrl_gpio_timer((unsigned long)dev);
+   rtl92e_check_rfctrl_gpio_timer(&priv->gpio_polling_timer);
 
RT_TRACE(COMP_INIT, "Driver probe completed\n");
return 0;
@@ -2648,9 +2645,9 @@ bool rtl92e_disable_nic(struct net_device *dev)
 
 module_pci_driver(rtl8192_pci_driver);
 
-void rtl92e_check_rfctrl_gpio_timer(unsigned long data)
+void rtl92e_check_rfctrl_gpio_timer(struct timer_list *t)
 {
-   struct r8192_priv *priv = rtllib_priv((struct net_device *)data);
+   struct r8192_priv *priv = from_timer(priv, t, gpio_polling_timer);
 
priv->polling_timer_on = 1;
 
diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.h 
b/drivers/staging/rtl8192e/rtl8192e/rtl_core.h
index 9d3089cb6a5a..866fe4d4cb28 100644
--- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.h
+++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.h
@@ -587,7 +587,7 @@ void rtl92e_tx_enable(struct net_device *);
 void rtl92e_hw_sleep_wq(voi

Re: [PATCH] Staging: rtl8723bs: Externs should be avoided in .C file

2017-10-04 Thread Joe Perches
On Wed, 2017-10-04 at 19:24 +0200, Srinivasan Shanmugam wrote:
> Removed warning from 
> 0001-Staging-rtl8723bs-Externs-should-be-avoided-in-.C-fi.patch file after 
> running checkpatch.pl
> 
> Signed-off-by: Srinivasan Shanmugam 
> ---
>  drivers/staging/rtl8723bs/core/rtw_recv.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/rtl8723bs/core/rtw_recv.c 
> b/drivers/staging/rtl8723bs/core/rtw_recv.c
> index c0b501e..6b5e48c 100644
> --- a/drivers/staging/rtl8723bs/core/rtw_recv.c
> +++ b/drivers/staging/rtl8723bs/core/rtw_recv.c
> @@ -1226,7 +1226,8 @@ sint validate_recv_ctrl_frame(struct adapter *padapter, 
> union recv_frame *precv_
>  
>  union recv_frame *recvframe_chk_defrag(struct adapter *padapter, union 
> recv_frame *precv_frame);
>  
> -static sint validate_recv_mgnt_frame(struct adapter *padapter, union 
> recv_frame *precv_frame)
> +static int validate_recv_mgnt_frame(struct adapter *padapter,
> + union recv_frame *precv_frame)
>  {
>   /* struct mlme_priv *pmlmepriv = &adapter->mlmepriv; */
>  

This patch does not match the commit message.

This patch changes the return from sint to int and does
some 80 column wrapping.

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