Re: [PATCH 4/4] video: Remove stack VLA usage

2018-03-08 Thread Gustavo A. R. Silva


I sent a patch for this six hours ago:

https://patchwork.kernel.org/patch/10268591/

--
Gustavo

On 03/09/2018 12:11 AM, Tycho Andersen wrote:

On Thu, Mar 08, 2018 at 10:01:07PM -0800, Joe Perches wrote:

On Fri, 2018-03-09 at 16:50 +1100, Tobin C. Harding wrote:

The kernel would like to have all stack VLA usage removed[1].  The
arrays are fixed here (declared with a const variable) but they appear
like VLAs to the compiler.  We can use a pre-processor define to fix the
warning.

[]

diff --git a/drivers/video/fbdev/via/via_aux_sii164.c 
b/drivers/video/fbdev/via/via_aux_sii164.c

[]

@@ -27,6 +27,9 @@
  
  static const char *name = "SiI 164 PanelLink Transmitter";
  
+/* check vendor id and device id */

+const u8 id[] = {0x01, 0x00, 0x06, 0x00};


It seems id is now global in multiple places.
Perhaps these should be static.


Does it even need to be global? Why not just get rid of the indirection and use
ARRAY_SIZE where we mean it? This seems to work for me,

diff --git a/drivers/video/fbdev/via/via_aux_sii164.c 
b/drivers/video/fbdev/via/via_aux_sii164.c
index ca1b35f033b1..87db6c98d680 100644
--- a/drivers/video/fbdev/via/via_aux_sii164.c
+++ b/drivers/video/fbdev/via/via_aux_sii164.c
@@ -35,10 +35,10 @@ static void probe(struct via_aux_bus *bus, u8 addr)
 .addr   =   addr,
 .name   =   name};
 /* check vendor id and device id */
-   const u8 id[] = {0x01, 0x00, 0x06, 0x00}, len = ARRAY_SIZE(id);
-   u8 tmp[len];
+   const u8 id[] = {0x01, 0x00, 0x06, 0x00};
+   u8 tmp[ARRAY_SIZE(id)];
  
-   if (!via_aux_read(, 0x00, tmp, len) || memcmp(id, tmp, len))

+   if (!via_aux_read(, 0x00, tmp, sizeof(tmp)) || memcmp(id, tmp, 
sizeof(tmp)))
 return;
  
 printk(KERN_INFO "viafb: Found %s at address 0x%x\n", name, addr);


Cheers,

Tycho




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


Re: [PATCH 4/4] video: Remove stack VLA usage

2018-03-08 Thread Tobin C. Harding
On Fri, Mar 09, 2018 at 12:16:21AM -0600, Gustavo A. R. Silva wrote:
> 
> I sent a patch for this six hours ago:
> 
> https://patchwork.kernel.org/patch/10268591/
> 
> --
> Gustavo

lol, I knew there would be a race on to fix these :)  And you got it
right, bonus points. Let's drop this one then.


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


[PATCH] staging: vchiq_arm: Clear VLA warning

2018-03-08 Thread Tobin C. Harding
The kernel would like to have all stack VLA usage removed[1].  The
array here is fixed (declared with a const variable) but it appears
like VLA to the compiler.  We can use a pre-processor define to quiet
the compiler.

[1]: https://lkml.org/lkml/2018/3/7/621

Signed-off-by: Tobin C. Harding 
---

The name of this constant may need changing, there is already a
pre-processor constant VCHIQ_MAX_SERVICES

 .../staging/vc04_services/interface/vchiq_arm/vchiq_arm.c  | 14 --
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c 
b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
index f5cefda49b22..c972869a0333 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
@@ -3434,13 +3434,15 @@ vchiq_release_service(VCHIQ_SERVICE_HANDLE_T handle)
return ret;
 }
 
+/* Only dump 64 services */
+#define VCHIQ_LOCAL_MAX_SERVICES 64
+
 void
 vchiq_dump_service_use_state(VCHIQ_STATE_T *state)
 {
VCHIQ_ARM_STATE_T *arm_state = vchiq_platform_get_arm_state(state);
int i, j = 0;
-   /* Only dump 64 services */
-   static const int local_max_services = 64;
+
/* If there's more than 64 services, only dump ones with
 * non-zero counts */
int only_nonzero = 0;
@@ -3455,7 +3457,7 @@ vchiq_dump_service_use_state(VCHIQ_STATE_T *state)
int fourcc;
int clientid;
int use_count;
-   } service_data[local_max_services];
+   } service_data[VCHIQ_LOCAL_MAX_SERVICES];
 
if (!arm_state)
return;
@@ -3466,10 +3468,10 @@ vchiq_dump_service_use_state(VCHIQ_STATE_T *state)
peer_count = arm_state->peer_use_count;
vc_use_count = arm_state->videocore_use_count;
active_services = state->unused_service;
-   if (active_services > local_max_services)
+   if (active_services > VCHIQ_LOCAL_MAX_SERVICES)
only_nonzero = 1;
 
-   for (i = 0; (i < active_services) && (j < local_max_services); i++) {
+   for (i = 0; (i < active_services) && (j < VCHIQ_LOCAL_MAX_SERVICES); 
i++) {
VCHIQ_SERVICE_T *service_ptr = state->services[i];
 
if (!service_ptr)
@@ -3499,7 +3501,7 @@ vchiq_dump_service_use_state(VCHIQ_STATE_T *state)
vchiq_log_warning(vchiq_susp_log_level, "Too many active "
"services (%d).  Only dumping up to first %d services "
"with non-zero use-count", active_services,
-   local_max_services);
+   VCHIQ_LOCAL_MAX_SERVICES);
 
for (i = 0; i < j; i++) {
vchiq_log_warning(vchiq_susp_log_level,
-- 
2.7.4

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


Re: [PATCH 4/4] video: Remove stack VLA usage

2018-03-08 Thread Tycho Andersen
On Thu, Mar 08, 2018 at 10:01:07PM -0800, Joe Perches wrote:
> On Fri, 2018-03-09 at 16:50 +1100, Tobin C. Harding wrote:
> > The kernel would like to have all stack VLA usage removed[1].  The
> > arrays are fixed here (declared with a const variable) but they appear
> > like VLAs to the compiler.  We can use a pre-processor define to fix the
> > warning.  
> []
> > diff --git a/drivers/video/fbdev/via/via_aux_sii164.c 
> > b/drivers/video/fbdev/via/via_aux_sii164.c
> []
> > @@ -27,6 +27,9 @@
> >  
> >  static const char *name = "SiI 164 PanelLink Transmitter";
> >  
> > +/* check vendor id and device id */
> > +const u8 id[] = {0x01, 0x00, 0x06, 0x00};
> 
> It seems id is now global in multiple places.
> Perhaps these should be static.

Does it even need to be global? Why not just get rid of the indirection and use
ARRAY_SIZE where we mean it? This seems to work for me,

diff --git a/drivers/video/fbdev/via/via_aux_sii164.c 
b/drivers/video/fbdev/via/via_aux_sii164.c
index ca1b35f033b1..87db6c98d680 100644
--- a/drivers/video/fbdev/via/via_aux_sii164.c
+++ b/drivers/video/fbdev/via/via_aux_sii164.c
@@ -35,10 +35,10 @@ static void probe(struct via_aux_bus *bus, u8 addr)
.addr   =   addr,
.name   =   name};
/* check vendor id and device id */
-   const u8 id[] = {0x01, 0x00, 0x06, 0x00}, len = ARRAY_SIZE(id);
-   u8 tmp[len];
+   const u8 id[] = {0x01, 0x00, 0x06, 0x00};
+   u8 tmp[ARRAY_SIZE(id)];
 
-   if (!via_aux_read(, 0x00, tmp, len) || memcmp(id, tmp, len))
+   if (!via_aux_read(, 0x00, tmp, sizeof(tmp)) || memcmp(id, tmp, 
sizeof(tmp)))
return;
 
printk(KERN_INFO "viafb: Found %s at address 0x%x\n", name, addr);

Cheers,

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


Re: [PATCH 4/4] video: Remove stack VLA usage

2018-03-08 Thread Tobin C. Harding
On Thu, Mar 08, 2018 at 10:01:07PM -0800, Joe Perches wrote:
> On Fri, 2018-03-09 at 16:50 +1100, Tobin C. Harding wrote:
> > The kernel would like to have all stack VLA usage removed[1].  The
> > arrays are fixed here (declared with a const variable) but they appear
> > like VLAs to the compiler.  We can use a pre-processor define to fix the
> > warning.  
> []
> > diff --git a/drivers/video/fbdev/via/via_aux_sii164.c 
> > b/drivers/video/fbdev/via/via_aux_sii164.c
> []
> > @@ -27,6 +27,9 @@
> >  
> >  static const char *name = "SiI 164 PanelLink Transmitter";
> >  
> > +/* check vendor id and device id */
> > +const u8 id[] = {0x01, 0x00, 0x06, 0x00};
> 
> It seems id is now global in multiple places.
> Perhaps these should be static.

woops, thanks Joe.  Will fix and re-spin.

> 
> > diff --git a/drivers/video/fbdev/via/via_aux_vt1631.c 
> > b/drivers/video/fbdev/via/via_aux_vt1631.c
> []
> > @@ -27,16 +27,19 @@
> >  
> >  static const char *name = "VT1631 LVDS Transmitter";
> >  
> > +/* check vendor id and device id */
> > +const u8 id[] = {0x06, 0x11, 0x91, 0x31}, len = ARRAY_SIZE(id);
> 
> etc...

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


Re: [PATCH 4/4] video: Remove stack VLA usage

2018-03-08 Thread Joe Perches
On Fri, 2018-03-09 at 16:50 +1100, Tobin C. Harding wrote:
> The kernel would like to have all stack VLA usage removed[1].  The
> arrays are fixed here (declared with a const variable) but they appear
> like VLAs to the compiler.  We can use a pre-processor define to fix the
> warning.  
[]
> diff --git a/drivers/video/fbdev/via/via_aux_sii164.c 
> b/drivers/video/fbdev/via/via_aux_sii164.c
[]
> @@ -27,6 +27,9 @@
>  
>  static const char *name = "SiI 164 PanelLink Transmitter";
>  
> +/* check vendor id and device id */
> +const u8 id[] = {0x01, 0x00, 0x06, 0x00};

It seems id is now global in multiple places.
Perhaps these should be static.

> diff --git a/drivers/video/fbdev/via/via_aux_vt1631.c 
> b/drivers/video/fbdev/via/via_aux_vt1631.c
[]
> @@ -27,16 +27,19 @@
>  
>  static const char *name = "VT1631 LVDS Transmitter";
>  
> +/* check vendor id and device id */
> +const u8 id[] = {0x06, 0x11, 0x91, 0x31}, len = ARRAY_SIZE(id);

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


[PATCH 4/4] video: Remove stack VLA usage

2018-03-08 Thread Tobin C. Harding
The kernel would like to have all stack VLA usage removed[1].  The
arrays are fixed here (declared with a const variable) but they appear
like VLAs to the compiler.  We can use a pre-processor define to fix the
warning.  

[1]: https://lkml.org/lkml/2018/3/7/621

Signed-off-by: Tobin C. Harding 
---
 drivers/video/fbdev/via/via_aux_sii164.c |  8 +---
 drivers/video/fbdev/via/via_aux_vt1631.c | 11 +++
 drivers/video/fbdev/via/via_aux_vt1632.c | 11 +++
 drivers/video/fbdev/via/via_aux_vt1636.c | 11 +++
 4 files changed, 26 insertions(+), 15 deletions(-)

diff --git a/drivers/video/fbdev/via/via_aux_sii164.c 
b/drivers/video/fbdev/via/via_aux_sii164.c
index ca1b35f033b1..f715ea4f466c 100644
--- a/drivers/video/fbdev/via/via_aux_sii164.c
+++ b/drivers/video/fbdev/via/via_aux_sii164.c
@@ -27,6 +27,9 @@
 
 static const char *name = "SiI 164 PanelLink Transmitter";
 
+/* check vendor id and device id */
+const u8 id[] = {0x01, 0x00, 0x06, 0x00};
+#define VIA_SII164_LEN ARRAY_SIZE(id)
 
 static void probe(struct via_aux_bus *bus, u8 addr)
 {
@@ -34,9 +37,8 @@ static void probe(struct via_aux_bus *bus, u8 addr)
.bus=   bus,
.addr   =   addr,
.name   =   name};
-   /* check vendor id and device id */
-   const u8 id[] = {0x01, 0x00, 0x06, 0x00}, len = ARRAY_SIZE(id);
-   u8 tmp[len];
+   u8 tmp[VIA_SII164_LEN];
+   int len = VIA_SII164_LEN;
 
if (!via_aux_read(, 0x00, tmp, len) || memcmp(id, tmp, len))
return;
diff --git a/drivers/video/fbdev/via/via_aux_vt1631.c 
b/drivers/video/fbdev/via/via_aux_vt1631.c
index 06e742f1f723..5bfaa20ec5a8 100644
--- a/drivers/video/fbdev/via/via_aux_vt1631.c
+++ b/drivers/video/fbdev/via/via_aux_vt1631.c
@@ -27,16 +27,19 @@
 
 static const char *name = "VT1631 LVDS Transmitter";
 
+/* check vendor id and device id */
+const u8 id[] = {0x06, 0x11, 0x91, 0x31}, len = ARRAY_SIZE(id);
+#define VIA_VT1631_LEN ARRAY_SIZE(id)
 
 void via_aux_vt1631_probe(struct via_aux_bus *bus)
 {
struct via_aux_drv drv = {
.bus=   bus,
.addr   =   0x38,
-   .name   =   name};
-   /* check vendor id and device id */
-   const u8 id[] = {0x06, 0x11, 0x91, 0x31}, len = ARRAY_SIZE(id);
-   u8 tmp[len];
+   .name   =   name
+   };
+   u8 tmp[VIA_VT1631_LEN];
+   int len = VIA_VT1631_LEN;
 
if (!via_aux_read(, 0x00, tmp, len) || memcmp(id, tmp, len))
return;
diff --git a/drivers/video/fbdev/via/via_aux_vt1632.c 
b/drivers/video/fbdev/via/via_aux_vt1632.c
index d24f4cd97401..fcddd761d4a4 100644
--- a/drivers/video/fbdev/via/via_aux_vt1632.c
+++ b/drivers/video/fbdev/via/via_aux_vt1632.c
@@ -27,16 +27,19 @@
 
 static const char *name = "VT1632 DVI Transmitter";
 
+/* check vendor id and device id */
+const u8 id[] = {0x06, 0x11, 0x92, 0x31};
+#define VIA_VT1632_LEN ARRAY_SIZE(id)
 
 static void probe(struct via_aux_bus *bus, u8 addr)
 {
struct via_aux_drv drv = {
.bus=   bus,
.addr   =   addr,
-   .name   =   name};
-   /* check vendor id and device id */
-   const u8 id[] = {0x06, 0x11, 0x92, 0x31}, len = ARRAY_SIZE(id);
-   u8 tmp[len];
+   .name   =   name
+   };
+   u8 tmp[VIA_VT1632_LEN];
+   int len = VIA_VT1632_LEN;
 
if (!via_aux_read(, 0x00, tmp, len) || memcmp(id, tmp, len))
return;
diff --git a/drivers/video/fbdev/via/via_aux_vt1636.c 
b/drivers/video/fbdev/via/via_aux_vt1636.c
index 9e015c101d4d..49c9269c7f81 100644
--- a/drivers/video/fbdev/via/via_aux_vt1636.c
+++ b/drivers/video/fbdev/via/via_aux_vt1636.c
@@ -27,16 +27,19 @@
 
 static const char *name = "VT1636 LVDS Transmitter";
 
+/* check vendor id and device id */
+const u8 id[] = {0x06, 0x11, 0x45, 0x33};
+#define VIA_VT1636_LEN ARRAY_SIZE(id)
 
 void via_aux_vt1636_probe(struct via_aux_bus *bus)
 {
struct via_aux_drv drv = {
.bus=   bus,
.addr   =   0x40,
-   .name   =   name};
-   /* check vendor id and device id */
-   const u8 id[] = {0x06, 0x11, 0x45, 0x33}, len = ARRAY_SIZE(id);
-   u8 tmp[len];
+   .name   =   name
+   };
+   u8 tmp[VIA_VT1636_LEN];
+   int len = VIA_VT1636_LEN;
 
if (!via_aux_read(, 0x00, tmp, len) || memcmp(id, tmp, len))
return;
-- 
2.7.4

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


[PATCH] PCI: hv: fix bus domain ID corruption

2018-03-08 Thread Sridhar Pitchai
When PCI BUS is added, PCI_BUS domain ID is set. When PCI_BUS and a device
added to the bus is racing against each other, the first device tends to
overwrite the domain ID. In order to avoid the race, this patch make sure
when a device is added to a bus, it never updated the bus domain ID. Since
we have the transparent SRIOV mode now, the short VF device name is no
longer needed.

Fixes: 4a9b0933bdfc("PCI:hv:Use device serial number as PCI domain")
Cc: sta...@vger.kernel.org
Signed-off-by: Sridhar Pitchai 
---
 drivers/pci/host/pci-hyperv.c | 11 ---
 1 file changed, 11 deletions(-)

diff --git a/drivers/pci/host/pci-hyperv.c b/drivers/pci/host/pci-hyperv.c
index 2faf38e..ac67e56 100644
--- a/drivers/pci/host/pci-hyperv.c
+++ b/drivers/pci/host/pci-hyperv.c
@@ -1518,17 +1518,6 @@ static struct hv_pci_dev *new_pcichild_device(struct 
hv_pcibus_device *hbus,
get_pcichild(hpdev, hv_pcidev_ref_childlist);
spin_lock_irqsave(>device_list_lock, flags);
 
-   /*
-* When a device is being added to the bus, we set the PCI domain
-* number to be the device serial number, which is non-zero and
-* unique on the same VM.  The serial numbers start with 1, and
-* increase by 1 for each device.  So device names including this
-* can have shorter names than based on the bus instance UUID.
-* Only the first device serial number is used for domain, so the
-* domain number will not change after the first device is added.
-*/
-   if (list_empty(>children))
-   hbus->sysdata.domain = desc->ser;
list_add_tail(>list_entry, >children);
spin_unlock_irqrestore(>device_list_lock, flags);
return hpdev;
-- 
2.7.4
 

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


[PATCH] PCI: hv: fix bus domain ID corruption

2018-03-08 Thread Sridhar Pitchai
 



0001-PCI-BUS-domain-ID-corruption.patch
Description: 0001-PCI-BUS-domain-ID-corruption.patch
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [RFC] android: ion: How to properly clean caches for uncached allocations

2018-03-08 Thread Laura Abbott

On 03/08/2018 04:45 PM, Liam Mark wrote:

On Wed, 7 Mar 2018, Laura Abbott wrote:


On 02/28/2018 09:18 PM, Liam Mark wrote:

The issue:

Currently in ION if you allocate uncached memory it is possible that there
are still dirty lines in the cache.  And often these dirty lines in the
cache are the zeros which were meant to clear out any sensitive kernel
data.

What this means is that if you allocate uncached memory from ION, and then
subsequently write to that buffer (using the uncached mapping you are
provided by ION) then the data you have written could be corrupted at some
point in the future if a dirty line is evicted from the cache.

Also this means there is a potential security issue.  If an un-privileged
userspace user allocated uncached memory (for example from the system heap)
and then if they were to read from that buffer (through the un-cached
mapping they are provided by ION), and if some of the zeros which were
written to that memory are still in the cache then this un-privileged
userspace user could read potentially sensitive kernel data.


For the use case you are describing we don't actually need the
memory to be non-cached until it comes time to do the dma mapping.
Here's a proposal to shoot holes in:

- Before any dma_buf attach happens, all mmap mappings are cached
- At the time attach happens, we shoot down any existing userspace
mappings, do the dma_map with appropriate flags to clean the pages
and then allow remapping to userspace as uncached. Really this
looks like a variation on the old Ion faulting code which I removed
except it's for uncached buffers instead of cached buffers.



Thanks Laura, I will take a look to see if I can think of any concerns.

Initial thoughts.
- What about any kernel mappings (kmap/vmap) the client has made?



We could either synchronize with dma_buf_{begin,end}_cpu_access
or just disallow the mapping to happen if there's an outstanding
kmap or vmap. Is this an actual problem or only theoretical?


- I guess it would be tempting to only do this behavior for memory that
came from buddy (as opposed to the pool since it should be clean), but we
would need to be careful that no pages sneak into the pool without being
cleaned (example: client allocs then frees without ever call
dma_buf_attach).



You're welcome to try that optimization but I think we should
focus on the basics first. Honestly it might make sense just to
have a single pool at this point since the cost of syncing
is not happening on the allocation path.


Potential problems:
- I'm not 100% about the behavior here if the attaching device
is already dma_coherent. I also consider uncached mappings
enough of a device specific optimization that you shouldn't
do them unless you know it's needed.


I don't believe we want to allow uncached memory to be dma mapped by an
io-coherent device and this is something I would like to eventually block.

Since there is always a kernel cached mapping for ION uncached memory then
speculative access could still be putting lines in the cache, so when an
io-coherent device tries to read this uncached memory its snoop into the
cache could find one of these 'stale' clean cache lines and end up using
stale data.
Agree?



Sounds right.


- The locking/sequencing with userspace could be tricky
since userspace may not like us ripping mappings out from
underneath if it's trying to access.


Perhaps delay this work to the dma_map_attachment call since when the data
is dma mapped the CPU shouldn't be accessing it?

Or worst case perhaps fail all map attempts to uncached memory until the
memory has been dma mapped (and cleaned) at least once?



My concern was mostly concurrent userspace access on a buffer
that's being dma_mapped but that sounds racy to begin with.

I suggested disallowing mmap until dma_mapping before and I thought
that was not possible?

Thanks,
Laura


Thanks,
Liam

Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project



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


Re: [RFC] android: ion: How to properly clean caches for uncached allocations

2018-03-08 Thread Liam Mark
On Wed, 7 Mar 2018, Laura Abbott wrote:

> On 02/28/2018 09:18 PM, Liam Mark wrote:
> > The issue:
> > 
> > Currently in ION if you allocate uncached memory it is possible that there
> > are still dirty lines in the cache.  And often these dirty lines in the
> > cache are the zeros which were meant to clear out any sensitive kernel
> > data.
> > 
> > What this means is that if you allocate uncached memory from ION, and then
> > subsequently write to that buffer (using the uncached mapping you are
> > provided by ION) then the data you have written could be corrupted at some
> > point in the future if a dirty line is evicted from the cache.
> > 
> > Also this means there is a potential security issue.  If an un-privileged
> > userspace user allocated uncached memory (for example from the system heap)
> > and then if they were to read from that buffer (through the un-cached
> > mapping they are provided by ION), and if some of the zeros which were
> > written to that memory are still in the cache then this un-privileged
> > userspace user could read potentially sensitive kernel data.
> 
> For the use case you are describing we don't actually need the
> memory to be non-cached until it comes time to do the dma mapping.
> Here's a proposal to shoot holes in:
> 
> - Before any dma_buf attach happens, all mmap mappings are cached
> - At the time attach happens, we shoot down any existing userspace
> mappings, do the dma_map with appropriate flags to clean the pages
> and then allow remapping to userspace as uncached. Really this
> looks like a variation on the old Ion faulting code which I removed
> except it's for uncached buffers instead of cached buffers.
> 

Thanks Laura, I will take a look to see if I can think of any concerns.

Initial thoughts.
- What about any kernel mappings (kmap/vmap) the client has made?

- I guess it would be tempting to only do this behavior for memory that 
came from buddy (as opposed to the pool since it should be clean), but we 
would need to be careful that no pages sneak into the pool without being 
cleaned (example: client allocs then frees without ever call 
dma_buf_attach).

> Potential problems:
> - I'm not 100% about the behavior here if the attaching device
> is already dma_coherent. I also consider uncached mappings
> enough of a device specific optimization that you shouldn't
> do them unless you know it's needed.

I don't believe we want to allow uncached memory to be dma mapped by an 
io-coherent device and this is something I would like to eventually block.

Since there is always a kernel cached mapping for ION uncached memory then 
speculative access could still be putting lines in the cache, so when an 
io-coherent device tries to read this uncached memory its snoop into the 
cache could find one of these 'stale' clean cache lines and end up using 
stale data. 
Agree?

> - The locking/sequencing with userspace could be tricky
> since userspace may not like us ripping mappings out from
> underneath if it's trying to access.

Perhaps delay this work to the dma_map_attachment call since when the data 
is dma mapped the CPU shouldn't be accessing it? 

Or worst case perhaps fail all map attempts to uncached memory until the 
memory has been dma mapped (and cleaned) at least once?

Thanks,
Liam

Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v2 1/3] staging:iio:meter: Replaces IIO_DEV_ATTR_CH_OFF by IIO_DEVICE_ATTR

2018-03-08 Thread Rodrigo Siqueira
On 03/07, Jonathan Cameron wrote:
> On Tue, 6 Mar 2018 21:43:47 -0300
> Rodrigo Siqueira  wrote:
> 
> > The macro IIO_DEV_ATTR_CH_OFF is a wrapper for IIO_DEVICE_ATTR, with a
> > tiny change in the name definition. This extra macro does not improve
> > the readability and also creates some checkpatch errors.
> > 
> > This patch fixes the checkpatch.pl errors:
> > 
> > staging/iio/meter/ade7753.c:391: ERROR: Use 4 digit octal (0777) not
> > decimal permissions
> > staging/iio/meter/ade7753.c:395: ERROR: Use 4 digit octal (0777) not
> > decimal permissions
> > staging/iio/meter/ade7759.c:331: ERROR: Use 4 digit octal (0777) not
> > decimal permissions
> > staging/iio/meter/ade7759.c:335: ERROR: Use 4 digit octal (0777) not
> > decimal permissions
> > 
> > Signed-off-by: Rodrigo Siqueira 
> 
> Hmm. I wondered a bit about this one. It's a correct patch in of
> itself but the interface in question doesn't even vaguely conform
> to any of defined IIO ABI.  Anyhow, it's still and improvement so
> I'll take it.

I am not sure if I understood the comment about the ABI. The meter
interface is wrong because it uses things like IIO_DEVICE_ATTR? It
should use iio_info together with *write_raw and *read_raw. Right? Is it
the ABI problem that you refer?

Thanks :)
 
> Applied to the togreg branch of iio.git and pushed out as testing
> for the autobuilders to play with it.
> 
> I also added the removal of the header define which is no
> longer used.
> 
> Please note, following discussions with Michael, I am going to send
> an email announcing an intent to drop these meter drivers next
> cycle unless someone can provide testing for any attempt to
> move them out of staging.  I'm still taking patches on the basis
> that 'might' happen - but I wouldn't focus on these until we
> have some certainty on whether they will be around long term!
> 
> Jonathan
> 
> > ---
> >  drivers/staging/iio/meter/ade7753.c | 18 ++
> >  drivers/staging/iio/meter/ade7759.c | 18 ++
> >  2 files changed, 20 insertions(+), 16 deletions(-)
> > 
> > diff --git a/drivers/staging/iio/meter/ade7753.c 
> > b/drivers/staging/iio/meter/ade7753.c
> > index c44eb577dc35..275e8dfff836 100644
> > --- a/drivers/staging/iio/meter/ade7753.c
> > +++ b/drivers/staging/iio/meter/ade7753.c
> > @@ -388,14 +388,16 @@ static IIO_DEV_ATTR_VPERIOD(0444,
> > ade7753_read_16bit,
> > NULL,
> > ADE7753_PERIOD);
> > -static IIO_DEV_ATTR_CH_OFF(1, 0644,
> > -   ade7753_read_8bit,
> > -   ade7753_write_8bit,
> > -   ADE7753_CH1OS);
> > -static IIO_DEV_ATTR_CH_OFF(2, 0644,
> > -   ade7753_read_8bit,
> > -   ade7753_write_8bit,
> > -   ADE7753_CH2OS);
> > +
> > +static IIO_DEVICE_ATTR(choff_1, 0644,
> > +   ade7753_read_8bit,
> > +   ade7753_write_8bit,
> > +   ADE7753_CH1OS);
> > +
> > +static IIO_DEVICE_ATTR(choff_2, 0644,
> > +   ade7753_read_8bit,
> > +   ade7753_write_8bit,
> > +   ADE7753_CH2OS);
> >  
> >  static int ade7753_set_irq(struct device *dev, bool enable)
> >  {
> > diff --git a/drivers/staging/iio/meter/ade7759.c 
> > b/drivers/staging/iio/meter/ade7759.c
> > index 1decb2b8afab..c078b770fa53 100644
> > --- a/drivers/staging/iio/meter/ade7759.c
> > +++ b/drivers/staging/iio/meter/ade7759.c
> > @@ -328,14 +328,16 @@ static IIO_DEV_ATTR_ACTIVE_POWER_GAIN(0644,
> > ade7759_read_16bit,
> > ade7759_write_16bit,
> > ADE7759_APGAIN);
> > -static IIO_DEV_ATTR_CH_OFF(1, 0644,
> > -   ade7759_read_8bit,
> > -   ade7759_write_8bit,
> > -   ADE7759_CH1OS);
> > -static IIO_DEV_ATTR_CH_OFF(2, 0644,
> > -   ade7759_read_8bit,
> > -   ade7759_write_8bit,
> > -   ADE7759_CH2OS);
> > +
> > +static IIO_DEVICE_ATTR(choff_1, 0644,
> > +   ade7759_read_8bit,
> > +   ade7759_write_8bit,
> > +   ADE7759_CH1OS);
> > +
> > +static IIO_DEVICE_ATTR(choff_2, 0644,
> > +   ade7759_read_8bit,
> > +   ade7759_write_8bit,
> > +   ADE7759_CH2OS);
> >  
> >  static int ade7759_set_irq(struct device *dev, bool enable)
> >  {
> 
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


RE: [PATCH] PCI BUS domain ID corruption

2018-03-08 Thread Sridhar Pitchai
Thanks Bjorn,
I will send another mail, with 
1: the patch applied to 4.16. 
2: I will send a text mail (instead of HTML). 
3: add Signed-off-by:

Thanks for your help.

Thanks,
Sridhar Pitchai

-Original Message-
From: Bjorn Helgaas  
Sent: Thursday, March 8, 2018 1:40 PM
To: Sridhar Pitchai 
Cc: Jake Oshins ; Haiyang Zhang ; 
Stephen Hemminger ; Dexuan Cui ; 
KY Srinivasan ; David Davis ; 
de...@linuxdriverproject.org; linux-...@vger.kernel.org; 
linux-ker...@vger.kernel.org; Lorenzo Pieralisi 
Subject: Re: [PATCH] PCI BUS domain ID corruption

[+cc Lorenzo]

On Thu, Mar 8, 2018 at 12:55 PM, Sridhar Pitchai 
 wrote:
> Hi,
>
> I would like to submit the following patch. This patch addresses the 
> issue when we try to add a VMBUS, the domain ID for the PCI bus is 
> overwritten.

Hi Sridhar,

Thanks for the patch!

This area is maintained by Lorenzo now (cc'd), so please copy him on the next 
round.

We can't apply it as-is because it contains no Signed-off-by (see 
https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgit.kernel.org%2Fpub%2Fscm%2Flinux%2Fkernel%2Fgit%2Ftorvalds%2Flinux.git%2Ftree%2FDocumentation%2Fprocess%2Fsubmitting-patches.rst=04%7C01%7CSridhar.Pitchai%40microsoft.com%7C99c90ec96a544d9dedd808d5853d33ff%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636561420271631010%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwifQ%3D%3D%7C-2=1zcgL6ZK7FwFka3x%2FAwJJnLMOQG5kQD0eQ1UguSjiCA%3D=0).

This email is also too fancy (HTML, etc) and I think will be rejected by the 
mailing lists (see 
https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fvger.kernel.org%2Fmajordomo-info.html%23taboo=04%7C01%7CSridhar.Pitchai%40microsoft.com%7C99c90ec96a544d9dedd808d5853d33ff%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636561420271631010%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwifQ%3D%3D%7C-2=icGYJhzoRJ%2Bw4xZPGrtrvDY%2BcNDys1HDllV4Agz11ro%3D=0).
  What you want is a plain-text email.

Please also run "git log drivers/pci/host/pci-hyperv.c" and make your subject 
and changelog match the format and style of previous patches.

It looks like this basically reverts 4a9b0933bdfc ("PCI: hv: Use device serial 
number as PCI domain"), so you should explain what was wrong with that commit.

Also, it doesn't look like this would apply cleanly to v4.16-rc1.
Your patch shows this:

 -   hbus->sysdata.domain = desc->ser & 0x;

but v4.16-rc1 has this:

hbus->sysdata.domain = desc->ser;

Bjorn

> srpitcha@ linux srpitcha/patch >cat 
> 0001-PCI-BUS-domain-ID-curruption.patch
>
> From a0c407f3e2d57c84ac349f064dcee1d2961e5ca3 Mon Sep 17 00:00:00 2001
>
> From: Sridhar Pitchai 
>
> Date: Thu, 8 Mar 2018 12:33:50 -0800
>
> Subject: [PATCH] PCI BUS domain ID corruption
>
>
>
> When PCI BUS is added, PCI_BUS domain ID is set. When PCI_BUS and 
> device to
>
> the bus is racing against each other, the first device tends to 
> overwrite
>
> the domain ID. In order to avoid the race, this patch make sure 
> when a
>
> device is added to a bus it never updates the bus domain ID. Since 
> we have
>
> the transparent SRIOV mode now, the short VF device name is no 
> longer
>
> needed.
>
>
>
> diff --git a/drivers/pci/host/pci-hyperv.c 
> b/drivers/pci/host/pci-hyperv.c
>
> index 1713bfc..6d43f81 100644
>
> --- a/drivers/pci/host/pci-hyperv.c
>
> +++ b/drivers/pci/host/pci-hyperv.c
>
> @@ -1321,19 +1321,6 @@ static struct hv_pci_dev 
> *new_pcichild_device(struct hv_pcibus_device *hbus,
>
> get_pcichild(hpdev, hv_pcidev_ref_childlist);
>
> spin_lock_irqsave(>device_list_lock, flags);
>
>
>
> -   /*
>
> -* When a device is being added to the bus, we set the PCI domain
>
> -* number to be the device serial number, which is non-zero and
>
> -* unique on the same VM.  The serial numbers start with 1, and
>
> -* increase by 1 for each device.  So device names including this
>
> -* can have shorter names than based on the bus instance UUID.
>
> -* Only the first device serial number is used for domain, so the
>
> -* domain number will not change after the first device is added.
>
> -* The lower 16 bits of the serial number is used, otherwise some
>
> -* drivers may not be able to handle it.
>
> -*/
>
> -   if (list_empty(>children))
>
> -   hbus->sysdata.domain = desc->ser & 0x;
>
> list_add_tail(>list_entry, >children);
>
> spin_unlock_irqrestore(>device_list_lock, flags);
>
> return hpdev;
>
> --
>
> 2.7.4
>
>
>
> srpitcha@ linux srpitcha/patch >

Re: [PATCH] PCI BUS domain ID corruption

2018-03-08 Thread Bjorn Helgaas
[+cc Lorenzo]

On Thu, Mar 8, 2018 at 12:55 PM, Sridhar Pitchai
 wrote:
> Hi,
>
> I would like to submit the following patch. This patch addresses the issue
> when we try to add a VMBUS, the domain ID for the PCI bus is overwritten.

Hi Sridhar,

Thanks for the patch!

This area is maintained by Lorenzo now (cc'd), so please copy him on
the next round.

We can't apply it as-is because it contains no Signed-off-by (see
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst).

This email is also too fancy (HTML, etc) and I think will be rejected
by the mailing lists (see
http://vger.kernel.org/majordomo-info.html#taboo).  What you want is a
plain-text email.

Please also run "git log drivers/pci/host/pci-hyperv.c" and make your
subject and changelog match the format and style of previous patches.

It looks like this basically reverts 4a9b0933bdfc ("PCI: hv: Use
device serial number as PCI domain"), so you should explain what was
wrong with that commit.

Also, it doesn't look like this would apply cleanly to v4.16-rc1.
Your patch shows this:

 -   hbus->sysdata.domain = desc->ser & 0x;

but v4.16-rc1 has this:

hbus->sysdata.domain = desc->ser;

Bjorn

> srpitcha@ linux srpitcha/patch >cat 0001-PCI-BUS-domain-ID-curruption.patch
>
> From a0c407f3e2d57c84ac349f064dcee1d2961e5ca3 Mon Sep 17 00:00:00 2001
>
> From: Sridhar Pitchai 
>
> Date: Thu, 8 Mar 2018 12:33:50 -0800
>
> Subject: [PATCH] PCI BUS domain ID corruption
>
>
>
> When PCI BUS is added, PCI_BUS domain ID is set. When PCI_BUS and device
> to
>
> the bus is racing against each other, the first device tends to
> overwrite
>
> the domain ID. In order to avoid the race, this patch make sure when a
>
> device is added to a bus it never updates the bus domain ID. Since we
> have
>
> the transparent SRIOV mode now, the short VF device name is no longer
>
> needed.
>
>
>
> diff --git a/drivers/pci/host/pci-hyperv.c b/drivers/pci/host/pci-hyperv.c
>
> index 1713bfc..6d43f81 100644
>
> --- a/drivers/pci/host/pci-hyperv.c
>
> +++ b/drivers/pci/host/pci-hyperv.c
>
> @@ -1321,19 +1321,6 @@ static struct hv_pci_dev *new_pcichild_device(struct
> hv_pcibus_device *hbus,
>
> get_pcichild(hpdev, hv_pcidev_ref_childlist);
>
> spin_lock_irqsave(>device_list_lock, flags);
>
>
>
> -   /*
>
> -* When a device is being added to the bus, we set the PCI domain
>
> -* number to be the device serial number, which is non-zero and
>
> -* unique on the same VM.  The serial numbers start with 1, and
>
> -* increase by 1 for each device.  So device names including this
>
> -* can have shorter names than based on the bus instance UUID.
>
> -* Only the first device serial number is used for domain, so the
>
> -* domain number will not change after the first device is added.
>
> -* The lower 16 bits of the serial number is used, otherwise some
>
> -* drivers may not be able to handle it.
>
> -*/
>
> -   if (list_empty(>children))
>
> -   hbus->sysdata.domain = desc->ser & 0x;
>
> list_add_tail(>list_entry, >children);
>
> spin_unlock_irqrestore(>device_list_lock, flags);
>
> return hpdev;
>
> --
>
> 2.7.4
>
>
>
> srpitcha@ linux srpitcha/patch >
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v4] Staging: iio: adis16209: Change some macro names

2018-03-08 Thread Shreeya Patel


On 9 March 2018 00:41:12 GMT+05:30, Himanshu Jha  
wrote:
>On Thu, Mar 08, 2018 at 11:46:17PM +0530, Shreeya Patel wrote:
>> Make some of the macro names according to the names
>> given in the datasheet of the adis16209 driver and
>> have slight indentation in field definitions to make
>> them clearly different from the register addresses.
>> 
>> Signed-off-by: Shreeya Patel 
>> ---
>> 
>> Changes in v4
>>   -Have slight indentation in field definitions.
>> 
>>  drivers/staging/iio/accel/adis16209.c | 48
>+--
>>  1 file changed, 24 insertions(+), 24 deletions(-)
>> 
>> diff --git a/drivers/staging/iio/accel/adis16209.c
>b/drivers/staging/iio/accel/adis16209.c
>> index eb5c878..19636e2 100644
>> --- a/drivers/staging/iio/accel/adis16209.c
>> +++ b/drivers/staging/iio/accel/adis16209.c
>> @@ -68,21 +68,21 @@
>>  #define  ADIS16209_MSC_CTRL_ACTIVE_HIGH BIT(1)
>>  #define  ADIS16209_MSC_CTRL_DATA_RDY_DIO2   BIT(0)
>>  
>> -#define ADIS16209_STAT_REG  0x3C
>> -#define  ADIS16209_STAT_ALARM2  BIT(9)
>> -#define  ADIS16209_STAT_ALARM1  BIT(8)
>> -#define ADIS16209_STAT_SELFTEST_FAIL_BIT5
>> -#define ADIS16209_STAT_SPI_FAIL_BIT 3
>> -#define ADIS16209_STAT_FLASH_UPT_FAIL_BIT   2
>> +#define ADIS16209_DIAG_STAT_REG 0x3C
>> +#define  ADIS16209_DIAG_STAT_ALARM2 BIT(9)
>> +#define  ADIS16209_DIAG_STAT_ALARM1 BIT(8)
>> +#define  ADIS16209_DIAG_STAT_SELFTEST_FAIL_BIT  5
>> +#define  ADIS16209_DIAG_STAT_SPI_FAIL_BIT   3
>> +#define  ADIS16209_DIAG_STAT_FLASH_UPT_BIT  2
>
>#define ADIS16209_STAT_FLASH_UPT_FAIL_BIT2
>?
>It represents flash update fail bit! 

I think so that I have sent the wrong patch :(

This is totally the reverse of the change that I wanted to have. 
Maybe I messed up with this patch. 

Jonathan, please avoid this patch. 
I'll send the corrected one soon. 

Thanks 

-- 
Sent from my Android device with K-9 Mail. Please excuse my brevity.
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v4] Staging: iio: adis16209: Change some macro names

2018-03-08 Thread Himanshu Jha
On Thu, Mar 08, 2018 at 11:46:17PM +0530, Shreeya Patel wrote:
> Make some of the macro names according to the names
> given in the datasheet of the adis16209 driver and
> have slight indentation in field definitions to make
> them clearly different from the register addresses.
> 
> Signed-off-by: Shreeya Patel 
> ---
> 
> Changes in v4
>   -Have slight indentation in field definitions.
> 
>  drivers/staging/iio/accel/adis16209.c | 48 
> +--
>  1 file changed, 24 insertions(+), 24 deletions(-)
> 
> diff --git a/drivers/staging/iio/accel/adis16209.c 
> b/drivers/staging/iio/accel/adis16209.c
> index eb5c878..19636e2 100644
> --- a/drivers/staging/iio/accel/adis16209.c
> +++ b/drivers/staging/iio/accel/adis16209.c
> @@ -68,21 +68,21 @@
>  #define  ADIS16209_MSC_CTRL_ACTIVE_HIGH  BIT(1)
>  #define  ADIS16209_MSC_CTRL_DATA_RDY_DIO2BIT(0)
>  
> -#define ADIS16209_STAT_REG   0x3C
> -#define  ADIS16209_STAT_ALARM2   BIT(9)
> -#define  ADIS16209_STAT_ALARM1   BIT(8)
> -#define ADIS16209_STAT_SELFTEST_FAIL_BIT 5
> -#define ADIS16209_STAT_SPI_FAIL_BIT  3
> -#define ADIS16209_STAT_FLASH_UPT_FAIL_BIT2
> +#define ADIS16209_DIAG_STAT_REG  0x3C
> +#define  ADIS16209_DIAG_STAT_ALARM2  BIT(9)
> +#define  ADIS16209_DIAG_STAT_ALARM1  BIT(8)
> +#define  ADIS16209_DIAG_STAT_SELFTEST_FAIL_BIT   5
> +#define  ADIS16209_DIAG_STAT_SPI_FAIL_BIT3
> +#define  ADIS16209_DIAG_STAT_FLASH_UPT_BIT   2

#define ADIS16209_STAT_FLASH_UPT_FAIL_BIT2
?
It represents flash update fail bit!

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


[PATCH] Staging: iio: adis16209: Move adis16209 driver out of staging

2018-03-08 Thread Shreeya Patel
Move the adis16209 driver out of staging directory and merge to the
mainline IIO subsystem.
---
 drivers/iio/accel/Kconfig |  12 ++
 drivers/iio/accel/Makefile|   1 +
 drivers/iio/accel/adis16209.c | 334 ++
 drivers/staging/iio/accel/Kconfig |  12 --
 drivers/staging/iio/accel/Makefile|   1 -
 drivers/staging/iio/accel/adis16209.c | 334 --
 6 files changed, 347 insertions(+), 347 deletions(-)
 create mode 100644 drivers/iio/accel/adis16209.c
 delete mode 100644 drivers/staging/iio/accel/adis16209.c

diff --git a/drivers/iio/accel/Kconfig b/drivers/iio/accel/Kconfig
index c6d9517..f95f43c 100644
--- a/drivers/iio/accel/Kconfig
+++ b/drivers/iio/accel/Kconfig
@@ -5,6 +5,18 @@
 
 menu "Accelerometers"
 
+config ADIS16209
+tristate "Analog Devices ADIS16209 Dual-Axis Digital Inclinometer and 
Accelerometer"
+depends on SPI
+select IIO_ADIS_LIB
+select IIO_ADIS_LIB_BUFFER if IIO_BUFFER
+help
+  Say Y here to build support for Analog Devices adis16209 dual-axis 
digital inclinometer
+  and accelerometer.
+
+  To compile this driver as a module, say M here: the module will be
+  called adis16209.
+
 config ADXL345
tristate
 
diff --git a/drivers/iio/accel/Makefile b/drivers/iio/accel/Makefile
index 368aedb..40861b9 100644
--- a/drivers/iio/accel/Makefile
+++ b/drivers/iio/accel/Makefile
@@ -4,6 +4,7 @@
 #
 
 # When adding new entries keep the list in alphabetical order
+obj-$(CONFIG_ADIS16209) += adis16209.o
 obj-$(CONFIG_ADXL345) += adxl345_core.o
 obj-$(CONFIG_ADXL345_I2C) += adxl345_i2c.o
 obj-$(CONFIG_ADXL345_SPI) += adxl345_spi.o
diff --git a/drivers/iio/accel/adis16209.c b/drivers/iio/accel/adis16209.c
new file mode 100644
index 000..4fe93ae
--- /dev/null
+++ b/drivers/iio/accel/adis16209.c
@@ -0,0 +1,334 @@
+/*
+ * ADIS16209 Dual-Axis Digital Inclinometer and Accelerometer
+ *
+ * Copyright 2010 Analog Devices Inc.
+ *
+ * Licensed under the GPL-2 or later.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+
+#define ADIS16209_STARTUP_DELAY_MS 220
+#define ADIS16209_FLASH_CNT_REG0x00
+
+/* Data Output Register Definitions */
+#define ADIS16209_SUPPLY_OUT_REG   0x02
+#define ADIS16209_XACCL_OUT_REG0x04
+#define ADIS16209_YACCL_OUT_REG0x06
+/* Output, auxiliary ADC input */
+#define ADIS16209_AUX_ADC_REG  0x08
+/* Output, temperature */
+#define ADIS16209_TEMP_OUT_REG 0x0A
+/* Output, +/- 90 degrees X-axis inclination */
+#define ADIS16209_XINCL_OUT_REG0x0C
+#define ADIS16209_YINCL_OUT_REG0x0E
+/* Output, +/-180 vertical rotational position */
+#define ADIS16209_ROT_OUT_REG  0x10
+
+/*
+ * Calibration Register Definitions.
+ * Acceleration, inclination or rotation offset null.
+ */
+#define ADIS16209_XACCL_NULL_REG   0x12
+#define ADIS16209_YACCL_NULL_REG   0x14
+#define ADIS16209_XINCL_NULL_REG   0x16
+#define ADIS16209_YINCL_NULL_REG   0x18
+#define ADIS16209_ROT_NULL_REG 0x1A
+
+/* Alarm Register Definitions */
+#define ADIS16209_ALM_MAG1_REG 0x20
+#define ADIS16209_ALM_MAG2_REG 0x22
+#define ADIS16209_ALM_SMPL1_REG0x24
+#define ADIS16209_ALM_SMPL2_REG0x26
+#define ADIS16209_ALM_CTRL_REG 0x28
+
+#define ADIS16209_AUX_DAC_REG  0x30
+#define ADIS16209_GPIO_CTRL_REG0x32
+#define ADIS16209_SMPL_PRD_REG 0x36
+#define ADIS16209_AVG_CNT_REG  0x38
+#define ADIS16209_SLP_CNT_REG  0x3A
+
+#define ADIS16209_MSC_CTRL_REG 0x34
+#define  ADIS16209_MSC_CTRL_PWRUP_SELF_TESTBIT(10)
+#define  ADIS16209_MSC_CTRL_SELF_TEST_EN   BIT(8)
+#define  ADIS16209_MSC_CTRL_DATA_RDY_ENBIT(2)
+/* Data-ready polarity: 1 = active high, 0 = active low */
+#define  ADIS16209_MSC_CTRL_ACTIVE_HIGHBIT(1)
+#define  ADIS16209_MSC_CTRL_DATA_RDY_DIO2  BIT(0)
+
+#define ADIS16209_DIAG_STAT_REG0x3C
+#define  ADIS16209_DIAG_STAT_ALARM2BIT(9)
+#define  ADIS16209_DIAG_STAT_ALARM1BIT(8)
+#define  ADIS16209_DIAG_STAT_SELFTEST_FAIL_BIT 5
+#define  ADIS16209_DIAG_STAT_SPI_FAIL_BIT  3
+#define  ADIS16209_DIAG_STAT_FLASH_UPT_BIT 2
+/* Power supply above 3.625 V */
+#define  ADIS16209_DIAG_STAT_POWER_HIGH_BIT1
+/* Power supply below 3.15 V */
+#define  ADIS16209_DIAG_STAT_POWER_LOW_BIT 0
+
+#define ADIS16209_GLOB_CMD_REG 0x3E
+#define  ADIS16209_GLOB_CMD_SW_RESET   BIT(7)
+#define  ADIS16209_GLOB_CMD_CLEAR_STAT BIT(4)
+#define  ADIS16209_GLOB_CMD_FACTORY_CALBIT(1)
+
+#define ADIS16209_ERROR_ACTIVE BIT(14)
+
+enum adis16209_scan {
+   ADIS16209_SCAN_SUPPLY,
+

[PATCH v4] Staging: iio: adis16209: Change some macro names

2018-03-08 Thread Shreeya Patel
Make some of the macro names according to the names
given in the datasheet of the adis16209 driver and
have slight indentation in field definitions to make
them clearly different from the register addresses.

Signed-off-by: Shreeya Patel 
---

Changes in v4
  -Have slight indentation in field definitions.

 drivers/staging/iio/accel/adis16209.c | 48 +--
 1 file changed, 24 insertions(+), 24 deletions(-)

diff --git a/drivers/staging/iio/accel/adis16209.c 
b/drivers/staging/iio/accel/adis16209.c
index eb5c878..19636e2 100644
--- a/drivers/staging/iio/accel/adis16209.c
+++ b/drivers/staging/iio/accel/adis16209.c
@@ -68,21 +68,21 @@
 #define  ADIS16209_MSC_CTRL_ACTIVE_HIGHBIT(1)
 #define  ADIS16209_MSC_CTRL_DATA_RDY_DIO2  BIT(0)
 
-#define ADIS16209_STAT_REG 0x3C
-#define  ADIS16209_STAT_ALARM2 BIT(9)
-#define  ADIS16209_STAT_ALARM1 BIT(8)
-#define ADIS16209_STAT_SELFTEST_FAIL_BIT   5
-#define ADIS16209_STAT_SPI_FAIL_BIT3
-#define ADIS16209_STAT_FLASH_UPT_FAIL_BIT  2
+#define ADIS16209_DIAG_STAT_REG0x3C
+#define  ADIS16209_DIAG_STAT_ALARM2BIT(9)
+#define  ADIS16209_DIAG_STAT_ALARM1BIT(8)
+#define  ADIS16209_DIAG_STAT_SELFTEST_FAIL_BIT 5
+#define  ADIS16209_DIAG_STAT_SPI_FAIL_BIT  3
+#define  ADIS16209_DIAG_STAT_FLASH_UPT_BIT 2
 /* Power supply above 3.625 V */
-#define ADIS16209_STAT_POWER_HIGH_BIT  1
+#define  ADIS16209_DIAG_STAT_POWER_HIGH_BIT1
 /* Power supply below 3.15 V */
-#define ADIS16209_STAT_POWER_LOW_BIT   0
+#define  ADIS16209_DIAG_STAT_POWER_LOW_BIT 0
 
-#define ADIS16209_CMD_REG  0x3E
-#define  ADIS16209_CMD_SW_RESETBIT(7)
-#define  ADIS16209_CMD_CLEAR_STAT  BIT(4)
-#define  ADIS16209_CMD_FACTORY_CAL BIT(1)
+#define ADIS16209_GLOB_CMD_REG 0x3E
+#define  ADIS16209_GLOB_CMD_SW_RESET   BIT(7)
+#define  ADIS16209_GLOB_CMD_CLEAR_STAT BIT(4)
+#define  ADIS16209_GLOB_CMD_FACTORY_CALBIT(1)
 
 #define ADIS16209_ERROR_ACTIVE BIT(14)
 
@@ -238,29 +238,29 @@ static const struct iio_info adis16209_info = {
 };
 
 static const char * const adis16209_status_error_msgs[] = {
-   [ADIS16209_STAT_SELFTEST_FAIL_BIT] = "Self test failure",
-   [ADIS16209_STAT_SPI_FAIL_BIT] = "SPI failure",
-   [ADIS16209_STAT_FLASH_UPT_FAIL_BIT] = "Flash update failed",
-   [ADIS16209_STAT_POWER_HIGH_BIT] = "Power supply above 3.625V",
-   [ADIS16209_STAT_POWER_LOW_BIT] = "Power supply below 3.15V",
+   [ADIS16209_DIAG_STAT_SELFTEST_FAIL_BIT] = "Self test failure",
+   [ADIS16209_DIAG_STAT_SPI_FAIL_BIT] = "SPI failure",
+   [ADIS16209_DIAG_STAT_FLASH_UPT_BIT] = "Flash update failed",
+   [ADIS16209_DIAG_STAT_POWER_HIGH_BIT] = "Power supply above 3.625V",
+   [ADIS16209_DIAG_STAT_POWER_LOW_BIT] = "Power supply below 3.15V",
 };
 
 static const struct adis_data adis16209_data = {
.read_delay = 30,
.msc_ctrl_reg = ADIS16209_MSC_CTRL_REG,
-   .glob_cmd_reg = ADIS16209_CMD_REG,
-   .diag_stat_reg = ADIS16209_STAT_REG,
+   .glob_cmd_reg = ADIS16209_GLOB_CMD_REG,
+   .diag_stat_reg = ADIS16209_DIAG_STAT_REG,
 
.self_test_mask = ADIS16209_MSC_CTRL_SELF_TEST_EN,
.self_test_no_autoclear = true,
.startup_delay = ADIS16209_STARTUP_DELAY_MS,
 
.status_error_msgs = adis16209_status_error_msgs,
-   .status_error_mask = BIT(ADIS16209_STAT_SELFTEST_FAIL_BIT) |
-   BIT(ADIS16209_STAT_SPI_FAIL_BIT) |
-   BIT(ADIS16209_STAT_FLASH_UPT_FAIL_BIT) |
-   BIT(ADIS16209_STAT_POWER_HIGH_BIT) |
-   BIT(ADIS16209_STAT_POWER_LOW_BIT),
+   .status_error_mask = BIT(ADIS16209_DIAG_STAT_SELFTEST_FAIL_BIT) |
+   BIT(ADIS16209_DIAG_STAT_SPI_FAIL_BIT) |
+   BIT(ADIS16209_DIAG_STAT_FLASH_UPT_BIT) |
+   BIT(ADIS16209_DIAG_STAT_POWER_HIGH_BIT) |
+   BIT(ADIS16209_DIAG_STAT_POWER_LOW_BIT),
 };
 
 static int adis16209_probe(struct spi_device *spi)
-- 
2.7.4

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


Re: [PATCH 5/5] staging: fsl-mc/dpio: Remove dead code

2018-03-08 Thread gre...@linuxfoundation.org
On Tue, Mar 06, 2018 at 06:32:00PM +, Ruxandra Ioana Ciocoi Radulescu wrote:
> > -Original Message-
> > From: Ruxandra Ioana Ciocoi Radulescu
> > Sent: Tuesday, March 6, 2018 7:44 PM
> > To: gre...@linuxfoundation.org
> > Cc: de...@driverdev.osuosl.org; linux-ker...@vger.kernel.org; Roy Pledge
> > ; Laurentiu Tudor 
> > Subject: [PATCH 5/5] staging: fsl-mc/dpio: Remove dead code
> > 
> > Function qbman_pull_desc_set_token() is not used at all, so remove it.
> > 
> > Signed-off-by: Ioana Radulescu 
> > ---
> >  drivers/staging/fsl-mc/bus/dpio/qbman-portal.c | 5 -
> >  1 file changed, 5 deletions(-)
>  
> Hi Greg,
> 
> Please ignore this patch, I've just noticed you already applied another
> patch with the same content a couple of hours ago.

Not a problem, now ignored :)

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


Re: [PATCH PATCH net v2 0/4] hv_netvsc: fix multicast flags and sync

2018-03-08 Thread David Miller
From: Stephen Hemminger 
Date: Wed,  7 Mar 2018 13:49:08 -0800

> This set of patches deals with the handling of multicast flags
> and addresses in transparent VF mode. The recent set of patches
> (in linux-net) had a couple of bugs.

Series applied, thanks Stephen.
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] staging: ccree: remove ccree staging copy

2018-03-08 Thread Greg Kroah-Hartman
On Thu, Mar 08, 2018 at 08:44:38AM +, Gilad Ben-Yossef wrote:
> Now when the ccree driver has been accepted into the cryptodev tree
> we can remove the staging tree copy.

Yeah!  Nice job.

> 
> Please note that this commit may cause a merge conflict with the
> cryptodev tree since we needed to disable the staging copy in order
> to get the new copy to compile but the resolution is trivial.
> 
> Signed-off-by: Gilad Ben-Yossef 
> ---
>  drivers/staging/Kconfig  |2 -
>  drivers/staging/Makefile |1 -
>  drivers/staging/ccree/Kconfig|   27 -
>  drivers/staging/ccree/Makefile   |7 -
>  drivers/staging/ccree/TODO   |   10 -
>  drivers/staging/ccree/cc_aead.c  | 2704 
> --
>  drivers/staging/ccree/cc_aead.h  |  109 --
>  drivers/staging/ccree/cc_buffer_mgr.c| 1651 --
>  drivers/staging/ccree/cc_buffer_mgr.h|   74 -
>  drivers/staging/ccree/cc_cipher.c| 1165 -
>  drivers/staging/ccree/cc_cipher.h|   74 -
>  drivers/staging/ccree/cc_crypto_ctx.h|  170 --
>  drivers/staging/ccree/cc_debugfs.c   |  101 --
>  drivers/staging/ccree/cc_debugfs.h   |   32 -
>  drivers/staging/ccree/cc_driver.c|  474 --
>  drivers/staging/ccree/cc_driver.h|  194 ---
>  drivers/staging/ccree/cc_fips.c  |  111 --
>  drivers/staging/ccree/cc_fips.h  |   37 -
>  drivers/staging/ccree/cc_hash.c  | 2296 -
>  drivers/staging/ccree/cc_hash.h  |  114 --
>  drivers/staging/ccree/cc_host_regs.h |  142 --
>  drivers/staging/ccree/cc_hw_queue_defs.h |  590 ---
>  drivers/staging/ccree/cc_ivgen.c |  280 
>  drivers/staging/ccree/cc_ivgen.h |   55 -
>  drivers/staging/ccree/cc_kernel_regs.h   |  167 --
>  drivers/staging/ccree/cc_lli_defs.h  |   59 -
>  drivers/staging/ccree/cc_pm.c|  122 --
>  drivers/staging/ccree/cc_pm.h|   57 -
>  drivers/staging/ccree/cc_request_mgr.c   |  713 
>  drivers/staging/ccree/cc_request_mgr.h   |   51 -
>  drivers/staging/ccree/cc_sram_mgr.c  |  107 --
>  drivers/staging/ccree/cc_sram_mgr.h  |   65 -
>  32 files changed, 11761 deletions(-)
>  delete mode 100644 drivers/staging/ccree/Kconfig
>  delete mode 100644 drivers/staging/ccree/Makefile
>  delete mode 100644 drivers/staging/ccree/TODO
>  delete mode 100644 drivers/staging/ccree/cc_aead.c
>  delete mode 100644 drivers/staging/ccree/cc_aead.h
>  delete mode 100644 drivers/staging/ccree/cc_buffer_mgr.c
>  delete mode 100644 drivers/staging/ccree/cc_buffer_mgr.h
>  delete mode 100644 drivers/staging/ccree/cc_cipher.c
>  delete mode 100644 drivers/staging/ccree/cc_cipher.h
>  delete mode 100644 drivers/staging/ccree/cc_crypto_ctx.h
>  delete mode 100644 drivers/staging/ccree/cc_debugfs.c
>  delete mode 100644 drivers/staging/ccree/cc_debugfs.h
>  delete mode 100644 drivers/staging/ccree/cc_driver.c
>  delete mode 100644 drivers/staging/ccree/cc_driver.h
>  delete mode 100644 drivers/staging/ccree/cc_fips.c
>  delete mode 100644 drivers/staging/ccree/cc_fips.h
>  delete mode 100644 drivers/staging/ccree/cc_hash.c
>  delete mode 100644 drivers/staging/ccree/cc_hash.h
>  delete mode 100644 drivers/staging/ccree/cc_host_regs.h
>  delete mode 100644 drivers/staging/ccree/cc_hw_queue_defs.h
>  delete mode 100644 drivers/staging/ccree/cc_ivgen.c
>  delete mode 100644 drivers/staging/ccree/cc_ivgen.h
>  delete mode 100644 drivers/staging/ccree/cc_kernel_regs.h
>  delete mode 100644 drivers/staging/ccree/cc_lli_defs.h
>  delete mode 100644 drivers/staging/ccree/cc_pm.c
>  delete mode 100644 drivers/staging/ccree/cc_pm.h
>  delete mode 100644 drivers/staging/ccree/cc_request_mgr.c
>  delete mode 100644 drivers/staging/ccree/cc_request_mgr.h
>  delete mode 100644 drivers/staging/ccree/cc_sram_mgr.c
>  delete mode 100644 drivers/staging/ccree/cc_sram_mgr.h
> 
> diff --git a/drivers/staging/Kconfig b/drivers/staging/Kconfig
> index e95ab68..7802c26 100644
> --- a/drivers/staging/Kconfig
> +++ b/drivers/staging/Kconfig
> @@ -114,8 +114,6 @@ source "drivers/staging/greybus/Kconfig"
>  
>  source "drivers/staging/vc04_services/Kconfig"
>  
> -source "drivers/staging/ccree/Kconfig"
> -
>  source "drivers/staging/typec/Kconfig"
>  
>  source "drivers/staging/vboxvideo/Kconfig"
> diff --git a/drivers/staging/Makefile b/drivers/staging/Makefile
> index af8cd6a..56afa21 100644
> --- a/drivers/staging/Makefile
> +++ b/drivers/staging/Makefile
> @@ -49,6 +49,5 @@ obj-$(CONFIG_MOST)  += most/
>  obj-$(CONFIG_KS7010) += ks7010/
>  obj-$(CONFIG_GREYBUS)+= greybus/
>  obj-$(CONFIG_BCM2835_VCHIQ)  += vc04_services/
> -obj-$(CONFIG_CRYPTO_DEV_CCREE)   += ccree/
>  obj-$(CONFIG_DRM_VBOXVIDEO)  += vboxvideo/
>  obj-$(CONFIG_PI433)  += pi433/
> diff --git a/drivers/staging/ccree/Kconfig 

[PATCH 05/10] staging: wilc1000: fix line over 80 char in handle_connect()

2018-03-08 Thread Ajay Singh
Fix 'line over 80 characters' issue reported by checkpatch.pl script.

Signed-off-by: Ajay Singh 
---
 drivers/staging/wilc1000/host_interface.c | 48 +--
 1 file changed, 27 insertions(+), 21 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index a218497..22d7bcc 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -948,7 +948,8 @@ static s32 handle_connect(struct wilc_vif *vif,
 
hif_drv->usr_conn_req.ssid_len = conn_attr->ssid_len;
if (conn_attr->ssid) {
-   hif_drv->usr_conn_req.ssid = kmalloc(conn_attr->ssid_len + 1, 
GFP_KERNEL);
+   hif_drv->usr_conn_req.ssid = kmalloc(conn_attr->ssid_len + 1,
+GFP_KERNEL);
memcpy(hif_drv->usr_conn_req.ssid,
   conn_attr->ssid,
   conn_attr->ssid_len);
@@ -957,7 +958,8 @@ static s32 handle_connect(struct wilc_vif *vif,
 
hif_drv->usr_conn_req.ies_len = conn_attr->ies_len;
if (conn_attr->ies) {
-   hif_drv->usr_conn_req.ies = kmalloc(conn_attr->ies_len, 
GFP_KERNEL);
+   hif_drv->usr_conn_req.ies = kmalloc(conn_attr->ies_len,
+   GFP_KERNEL);
memcpy(hif_drv->usr_conn_req.ies,
   conn_attr->ies,
   conn_attr->ies_len);
@@ -986,19 +988,17 @@ static s32 handle_connect(struct wilc_vif *vif,
wid_list[wid_cnt].val = (s8 *)(&(dummyval));
wid_cnt++;
 
-   {
-   wid_list[wid_cnt].id = WID_INFO_ELEMENT_ASSOCIATE;
-   wid_list[wid_cnt].type = WID_BIN_DATA;
-   wid_list[wid_cnt].val = hif_drv->usr_conn_req.ies;
-   wid_list[wid_cnt].size = hif_drv->usr_conn_req.ies_len;
-   wid_cnt++;
-
-   if (memcmp("DIRECT-", conn_attr->ssid, 7)) {
-   info_element_size = hif_drv->usr_conn_req.ies_len;
-   info_element = kmalloc(info_element_size, GFP_KERNEL);
-   memcpy(info_element, hif_drv->usr_conn_req.ies,
-  info_element_size);
-   }
+   wid_list[wid_cnt].id = WID_INFO_ELEMENT_ASSOCIATE;
+   wid_list[wid_cnt].type = WID_BIN_DATA;
+   wid_list[wid_cnt].val = hif_drv->usr_conn_req.ies;
+   wid_list[wid_cnt].size = hif_drv->usr_conn_req.ies_len;
+   wid_cnt++;
+
+   if (memcmp("DIRECT-", conn_attr->ssid, 7)) {
+   info_element_size = hif_drv->usr_conn_req.ies_len;
+   info_element = kmalloc(info_element_size, GFP_KERNEL);
+   memcpy(info_element, hif_drv->usr_conn_req.ies,
+  info_element_size);
}
wid_list[wid_cnt].id = (u16)WID_11I_MODE;
wid_list[wid_cnt].type = WID_CHAR;
@@ -1075,10 +1075,12 @@ static s32 handle_connect(struct wilc_vif *vif,
*(cur_byte++)  =  bss_param->rsn_grp_policy;
*(cur_byte++) =  bss_param->mode_802_11i;
 
-   memcpy(cur_byte, bss_param->rsn_pcip_policy, 
sizeof(bss_param->rsn_pcip_policy));
+   memcpy(cur_byte, bss_param->rsn_pcip_policy,
+  sizeof(bss_param->rsn_pcip_policy));
cur_byte += sizeof(bss_param->rsn_pcip_policy);
 
-   memcpy(cur_byte, bss_param->rsn_auth_policy, 
sizeof(bss_param->rsn_auth_policy));
+   memcpy(cur_byte, bss_param->rsn_auth_policy,
+  sizeof(bss_param->rsn_auth_policy));
cur_byte += sizeof(bss_param->rsn_auth_policy);
 
memcpy(cur_byte, bss_param->rsn_cap, sizeof(bss_param->rsn_cap));
@@ -1101,13 +1103,16 @@ static s32 handle_connect(struct wilc_vif *vif,
 
*(cur_byte++) = bss_param->cnt;
 
-   memcpy(cur_byte, bss_param->duration, 
sizeof(bss_param->duration));
+   memcpy(cur_byte, bss_param->duration,
+  sizeof(bss_param->duration));
cur_byte += sizeof(bss_param->duration);
 
-   memcpy(cur_byte, bss_param->interval, 
sizeof(bss_param->interval));
+   memcpy(cur_byte, bss_param->interval,
+  sizeof(bss_param->interval));
cur_byte += sizeof(bss_param->interval);
 
-   memcpy(cur_byte, bss_param->start_time, 
sizeof(bss_param->start_time));
+   memcpy(cur_byte, bss_param->start_time,
+  sizeof(bss_param->start_time));
cur_byte += sizeof(bss_param->start_time);
}
 
@@ -1148,7 +1153,8 @@ static s32 handle_connect(struct wilc_vif *vif,
 
if (conn_attr->ies) {
conn_info.req_ies_len = conn_attr->ies_len;
-   conn_info.req_ies = kmalloc(conn_attr->ies_len, 
GFP_KERNEL);
+   conn_info.req_ies = 

[PATCH 09/10] staging: wilc1000: rename variables using camelCase in handle_rcvd_gnrl_async_info()

2018-03-08 Thread Ajay Singh
Fix 'Avoid camelCase' issue found by checkpatch.pl script.

Signed-off-by: Ajay Singh 
---
 drivers/staging/wilc1000/host_interface.c | 86 +++
 1 file changed, 43 insertions(+), 43 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index b26ea85..d822b15 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -1343,17 +1343,17 @@ static s32 handle_rcvd_gnrl_async_info(struct wilc_vif 
*vif,
   struct rcvd_async_info *rcvd_info)
 {
s32 result = 0;
-   u8 u8MsgType = 0;
-   u8 u8MsgID = 0;
-   u16 u16MsgLen = 0;
-   u16 u16WidID = (u16)WID_NIL;
-   u8 u8WidLen  = 0;
-   u8 u8MacStatus;
-   u8 u8MacStatusReasonCode;
-   u8 u8MacStatusAdditionalInfo;
+   u8 msg_type = 0;
+   u8 msg_id = 0;
+   u16 msg_len = 0;
+   u16 wid_id = (u16)WID_NIL;
+   u8 wid_len  = 0;
+   u8 mac_status;
+   u8 mac_status_reason_code;
+   u8 mac_status_additional_info;
struct connect_info conn_info;
struct disconnect_info disconn_info;
-   s32 s32Err = 0;
+   s32 err = 0;
struct host_if_drv *hif_drv = vif->hif_drv;
 
if (!hif_drv) {
@@ -1370,62 +1370,62 @@ static s32 handle_rcvd_gnrl_async_info(struct wilc_vif 
*vif,
return -EINVAL;
}
 
-   u8MsgType = rcvd_info->buffer[0];
+   msg_type = rcvd_info->buffer[0];
 
-   if ('I' != u8MsgType) {
+   if ('I' != msg_type) {
netdev_err(vif->ndev, "Received Message incorrect.\n");
return -EFAULT;
}
 
-   u8MsgID = rcvd_info->buffer[1];
-   u16MsgLen = MAKE_WORD16(rcvd_info->buffer[2], 
rcvd_info->buffer[3]);
-   u16WidID = MAKE_WORD16(rcvd_info->buffer[4], 
rcvd_info->buffer[5]);
-   u8WidLen = rcvd_info->buffer[6];
-   u8MacStatus  = rcvd_info->buffer[7];
-   u8MacStatusReasonCode = rcvd_info->buffer[8];
-   u8MacStatusAdditionalInfo = rcvd_info->buffer[9];
+   msg_id = rcvd_info->buffer[1];
+   msg_len = MAKE_WORD16(rcvd_info->buffer[2], 
rcvd_info->buffer[3]);
+   wid_id = MAKE_WORD16(rcvd_info->buffer[4], 
rcvd_info->buffer[5]);
+   wid_len = rcvd_info->buffer[6];
+   mac_status  = rcvd_info->buffer[7];
+   mac_status_reason_code = rcvd_info->buffer[8];
+   mac_status_additional_info = rcvd_info->buffer[9];
if (hif_drv->hif_state == HOST_IF_WAITING_CONN_RESP) {
-   u32 u32RcvdAssocRespInfoLen = 0;
-   struct connect_resp_info *pstrConnectRespInfo = NULL;
+   u32 rcvd_assoc_resp_info_len = 0;
+   struct connect_resp_info *connect_resp_info = NULL;
 
memset(_info, 0, sizeof(struct connect_info));
 
-   if (u8MacStatus == MAC_CONNECTED) {
+   if (mac_status == MAC_CONNECTED) {
memset(rcv_assoc_resp, 0, 
MAX_ASSOC_RESP_FRAME_SIZE);
 
host_int_get_assoc_res_info(vif,
rcv_assoc_resp,

MAX_ASSOC_RESP_FRAME_SIZE,
-   
);
+   
_assoc_resp_info_len);
 
-   if (u32RcvdAssocRespInfoLen != 0) {
-   s32Err = 
wilc_parse_assoc_resp_info(rcv_assoc_resp, u32RcvdAssocRespInfoLen,
-   
);
-   if (s32Err) {
-   netdev_err(vif->ndev, 
"wilc_parse_assoc_resp_info() returned error %d\n", s32Err);
+   if (rcvd_assoc_resp_info_len != 0) {
+   err = 
wilc_parse_assoc_resp_info(rcv_assoc_resp, rcvd_assoc_resp_info_len,
+
_resp_info);
+   if (err) {
+   netdev_err(vif->ndev, 
"wilc_parse_assoc_resp_info() returned error %d\n", err);
} else {
-   conn_info.status = 
pstrConnectRespInfo->status;
+   conn_info.status = 
connect_resp_info->status;
 
-   if (conn_info.status == 
SUCCESSFUL_STATUSCODE && pstrConnectRespInfo->ies) {
-

[PATCH 07/10] staging: wilc1000: rename variables prefix using datatype 'u8'

2018-03-08 Thread Ajay Singh
Rename variables with datatype 'u8' in their name to follow the linux
coding style.

Renamed following variables:
u8abort_running_scan
pu8Buffer
pu8keybuf
pu8msa
u8remain_on_chan_flag

Signed-off-by: Ajay Singh 
---
 drivers/staging/wilc1000/coreconfigurator.c |  28 +++---
 drivers/staging/wilc1000/host_interface.c   | 135 ++--
 2 files changed, 81 insertions(+), 82 deletions(-)

diff --git a/drivers/staging/wilc1000/coreconfigurator.c 
b/drivers/staging/wilc1000/coreconfigurator.c
index 2e2187b..db66b1c 100644
--- a/drivers/staging/wilc1000/coreconfigurator.c
+++ b/drivers/staging/wilc1000/coreconfigurator.c
@@ -148,19 +148,19 @@ static inline u8 get_from_ds(u8 *header)
return ((header[1] & 0x02) >> 1);
 }
 
-static inline void get_address1(u8 *pu8msa, u8 *addr)
+static inline void get_address1(u8 *msa, u8 *addr)
 {
-   memcpy(addr, pu8msa + 4, 6);
+   memcpy(addr, msa + 4, 6);
 }
 
-static inline void get_address2(u8 *pu8msa, u8 *addr)
+static inline void get_address2(u8 *msa, u8 *addr)
 {
-   memcpy(addr, pu8msa + 10, 6);
+   memcpy(addr, msa + 10, 6);
 }
 
-static inline void get_address3(u8 *pu8msa, u8 *addr)
+static inline void get_address3(u8 *msa, u8 *addr)
 {
-   memcpy(addr, pu8msa + 16, 6);
+   memcpy(addr, msa + 16, 6);
 }
 
 static inline void get_BSSID(u8 *data, u8 *bssid)
@@ -238,30 +238,30 @@ static inline u16 get_asoc_id(u8 *data)
return asoc_id;
 }
 
-static u8 *get_tim_elm(u8 *pu8msa, u16 rx_len, u16 tag_param_offset)
+static u8 *get_tim_elm(u8 *msa, u16 rx_len, u16 tag_param_offset)
 {
u16 index;
 
index = tag_param_offset;
 
while (index < (rx_len - FCS_LEN)) {
-   if (pu8msa[index] == ITIM)
-   return [index];
-   index += (IE_HDR_LEN + pu8msa[index + 1]);
+   if (msa[index] == ITIM)
+   return [index];
+   index += (IE_HDR_LEN + msa[index + 1]);
}
 
return NULL;
 }
 
-static u8 get_current_channel_802_11n(u8 *pu8msa, u16 rx_len)
+static u8 get_current_channel_802_11n(u8 *msa, u16 rx_len)
 {
u16 index;
 
index = TAG_PARAM_OFFSET;
while (index < (rx_len - FCS_LEN)) {
-   if (pu8msa[index] == IDSPARMS)
-   return pu8msa[index + 2];
-   index += pu8msa[index + 1] + IE_HDR_LEN;
+   if (msa[index] == IDSPARMS)
+   return msa[index + 2];
+   index += msa[index + 1] + IE_HDR_LEN;
}
 
return 0;
diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 4050128..5bf3bcc 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -883,15 +883,15 @@ static s32 handle_scan(struct wilc_vif *vif, struct 
scan_attr *scan_info)
 static s32 handle_scan_done(struct wilc_vif *vif, enum scan_event evt)
 {
s32 result = 0;
-   u8 u8abort_running_scan;
+   u8 abort_running_scan;
struct wid wid;
struct host_if_drv *hif_drv = vif->hif_drv;
 
if (evt == SCAN_EVENT_ABORTED) {
-   u8abort_running_scan = 1;
+   abort_running_scan = 1;
wid.id = (u16)WID_ABORT_RUNNING_SCAN;
wid.type = WID_CHAR;
-   wid.val = (s8 *)_running_scan;
+   wid.val = (s8 *)_running_scan;
wid.size = sizeof(char);
 
result = wilc_send_config_pkt(vif, SET_CFG, , 1,
@@ -1552,7 +1552,7 @@ static int handle_key(struct wilc_vif *vif, struct 
key_attr *hif_key)
struct wid wid;
struct wid wid_list[5];
u8 i;
-   u8 *pu8keybuf;
+   u8 *key_buf;
s8 s8idxarray[1];
s8 ret = 0;
struct host_if_drv *hif_drv = vif->hif_drv;
@@ -1571,15 +1571,15 @@ static int handle_key(struct wilc_vif *vif, struct 
key_attr *hif_key)
wid_list[1].size = sizeof(char);
wid_list[1].val = (s8 *)_key->attr.wep.auth_type;
 
-   pu8keybuf = kmalloc(hif_key->attr.wep.key_len + 2,
-   GFP_KERNEL);
-   if (!pu8keybuf)
+   key_buf = kmalloc(hif_key->attr.wep.key_len + 2,
+ GFP_KERNEL);
+   if (!key_buf)
return -ENOMEM;
 
-   pu8keybuf[0] = hif_key->attr.wep.index;
-   pu8keybuf[1] = hif_key->attr.wep.key_len;
+   key_buf[0] = hif_key->attr.wep.index;
+   key_buf[1] = hif_key->attr.wep.key_len;
 
-   memcpy([2], hif_key->attr.wep.key,
+   memcpy(_buf[2], hif_key->attr.wep.key,
   hif_key->attr.wep.key_len);
 
kfree(hif_key->attr.wep.key);
@@ 

[PATCH 08/10] staging: wilc1000: rename WILC_HostIf_PackStaParam to avoid camelCase

2018-03-08 Thread Ajay Singh
Fix 'Avoid camelCase' issue found by checkpatch.pl script.

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

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 5bf3bcc..b26ea85 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -2081,7 +2081,7 @@ static void handle_del_beacon(struct wilc_vif *vif)
netdev_err(vif->ndev, "Failed to send delete beacon\n");
 }
 
-static u32 WILC_HostIf_PackStaParam(u8 *buff, struct add_sta_param *param)
+static u32 wilc_hif_pack_sta_param(u8 *buff, struct add_sta_param *param)
 {
u8 *cur_byte;
 
@@ -2127,7 +2127,7 @@ static void handle_add_station(struct wilc_vif *vif,
goto error;
 
cur_byte = wid.val;
-   cur_byte += WILC_HostIf_PackStaParam(cur_byte, param);
+   cur_byte += wilc_hif_pack_sta_param(cur_byte, param);
 
result = wilc_send_config_pkt(vif, SET_CFG, , 1,
  wilc_get_vif_idx(vif));
@@ -2223,7 +2223,7 @@ static void handle_edit_station(struct wilc_vif *vif,
goto error;
 
cur_byte = wid.val;
-   cur_byte += WILC_HostIf_PackStaParam(cur_byte, param);
+   cur_byte += wilc_hif_pack_sta_param(cur_byte, param);
 
result = wilc_send_config_pkt(vif, SET_CFG, , 1,
  wilc_get_vif_idx(vif));
-- 
2.7.4

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


[PATCH 04/10] staging: wilc1000: fix line over 80 char in handle_scan()

2018-03-08 Thread Ajay Singh
Fix 'line over 80 character' issue reported by checkpatch.pl script in
handle_scan().

Signed-off-by: Ajay Singh 
---
 drivers/staging/wilc1000/host_interface.c | 18 ++
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index d0c17cd..a218497 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -771,6 +771,7 @@ static s32 handle_scan(struct wilc_vif *vif, struct 
scan_attr *scan_info)
u8 valuesize = 0;
u8 *hdn_ntwk_wid_val = NULL;
struct host_if_drv *hif_drv = vif->hif_drv;
+   struct hidden_network *hidden_net = _info->hidden_network;
 
hif_drv->usr_scan_req.scan_result = scan_info->result;
hif_drv->usr_scan_req.arg = scan_info->arg;
@@ -793,19 +794,20 @@ static s32 handle_scan(struct wilc_vif *vif, struct 
scan_attr *scan_info)
wid_list[index].id = (u16)WID_SSID_PROBE_REQ;
wid_list[index].type = WID_STR;
 
-   for (i = 0; i < scan_info->hidden_network.n_ssids; i++)
-   valuesize += ((scan_info->hidden_network.net_info[i].ssid_len) 
+ 1);
+   for (i = 0; i < hidden_net->n_ssids; i++)
+   valuesize += ((hidden_net->net_info[i].ssid_len) + 1);
hdn_ntwk_wid_val = kmalloc(valuesize + 1, GFP_KERNEL);
wid_list[index].val = hdn_ntwk_wid_val;
if (wid_list[index].val) {
buffer = wid_list[index].val;
 
-   *buffer++ = scan_info->hidden_network.n_ssids;
+   *buffer++ = hidden_net->n_ssids;
 
-   for (i = 0; i < scan_info->hidden_network.n_ssids; i++) {
-   *buffer++ = 
scan_info->hidden_network.net_info[i].ssid_len;
-   memcpy(buffer, 
scan_info->hidden_network.net_info[i].ssid, 
scan_info->hidden_network.net_info[i].ssid_len);
-   buffer += 
scan_info->hidden_network.net_info[i].ssid_len;
+   for (i = 0; i < hidden_net->n_ssids; i++) {
+   *buffer++ = hidden_net->net_info[i].ssid_len;
+   memcpy(buffer, hidden_net->net_info[i].ssid,
+  hidden_net->net_info[i].ssid_len);
+   buffer += hidden_net->net_info[i].ssid_len;
}
 
wid_list[index].size = (s32)(valuesize + 1);
@@ -833,7 +835,7 @@ static s32 handle_scan(struct wilc_vif *vif, struct 
scan_attr *scan_info)
 
for (i = 0; i < scan_info->ch_list_len; i++){
if (scan_info->ch_freq_list[i] > 0)
-   scan_info->ch_freq_list[i] = 
scan_info->ch_freq_list[i] - 1;
+   scan_info->ch_freq_list[i] -= 1;
}
}
 
-- 
2.7.4

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


[PATCH 06/10] staging: wilc1000: fix line over 80 character in handle_disconnect()

2018-03-08 Thread Ajay Singh
Refactor handle_disconnect() to avoid line over 80 characters issue
reported by checkpatch.pl script.

Signed-off-by: Ajay Singh 
---
 drivers/staging/wilc1000/host_interface.c | 90 +++
 1 file changed, 45 insertions(+), 45 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 22d7bcc..4050128 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -1801,7 +1801,9 @@ static void handle_disconnect(struct wilc_vif *vif)
 {
struct wid wid;
struct host_if_drv *hif_drv = vif->hif_drv;
-
+   struct disconnect_info disconn_info;
+   struct user_scan_req *scan_req;
+   struct user_conn_req *conn_req;
s32 result = 0;
u16 dummy_reason_code = 0;
 
@@ -1820,63 +1822,61 @@ static void handle_disconnect(struct wilc_vif *vif)
 
if (result) {
netdev_err(vif->ndev, "Failed to send dissconect\n");
-   } else {
-   struct disconnect_info disconn_info;
+   goto out;
+   }
 
-   memset(_info, 0, sizeof(struct disconnect_info));
+   memset(_info, 0, sizeof(struct disconnect_info));
 
-   disconn_info.reason = 0;
-   disconn_info.ie = NULL;
-   disconn_info.ie_len = 0;
+   disconn_info.reason = 0;
+   disconn_info.ie = NULL;
+   disconn_info.ie_len = 0;
+   scan_req = _drv->usr_scan_req;
+   conn_req = _drv->usr_conn_req;
 
-   if (hif_drv->usr_scan_req.scan_result) {
-   del_timer(_drv->scan_timer);
-   hif_drv->usr_scan_req.scan_result(SCAN_EVENT_ABORTED,
- NULL,
- 
hif_drv->usr_scan_req.arg,
- NULL);
-   hif_drv->usr_scan_req.scan_result = NULL;
-   }
+   if (scan_req->scan_result) {
+   del_timer(_drv->scan_timer);
+   scan_req->scan_result(SCAN_EVENT_ABORTED, NULL, scan_req->arg,
+ NULL);
+   scan_req->scan_result = NULL;
+   }
 
-   if (hif_drv->usr_conn_req.conn_result) {
-   if (hif_drv->hif_state == HOST_IF_WAITING_CONN_RESP)
-   del_timer(_drv->connect_timer);
+   if (conn_req->conn_result) {
+   if (hif_drv->hif_state == HOST_IF_WAITING_CONN_RESP)
+   del_timer(_drv->connect_timer);
 
-   
hif_drv->usr_conn_req.conn_result(CONN_DISCONN_EVENT_DISCONN_NOTIF,
- NULL,
- 0,
- _info,
- 
hif_drv->usr_conn_req.arg);
-   } else {
-   netdev_err(vif->ndev, "conn_result = NULL\n");
-   }
+   conn_req->conn_result(CONN_DISCONN_EVENT_DISCONN_NOTIF, NULL,
+ 0, _info, conn_req->arg);
+   } else {
+   netdev_err(vif->ndev, "conn_result = NULL\n");
+   }
 
-   scan_while_connected = false;
+   scan_while_connected = false;
 
-   hif_drv->hif_state = HOST_IF_IDLE;
+   hif_drv->hif_state = HOST_IF_IDLE;
 
-   eth_zero_addr(hif_drv->assoc_bssid);
+   eth_zero_addr(hif_drv->assoc_bssid);
 
-   hif_drv->usr_conn_req.ssid_len = 0;
-   kfree(hif_drv->usr_conn_req.ssid);
-   hif_drv->usr_conn_req.ssid = NULL;
-   kfree(hif_drv->usr_conn_req.bssid);
-   hif_drv->usr_conn_req.bssid = NULL;
-   hif_drv->usr_conn_req.ies_len = 0;
-   kfree(hif_drv->usr_conn_req.ies);
-   hif_drv->usr_conn_req.ies = NULL;
+   conn_req->ssid_len = 0;
+   kfree(conn_req->ssid);
+   conn_req->ssid = NULL;
+   kfree(conn_req->bssid);
+   conn_req->bssid = NULL;
+   conn_req->ies_len = 0;
+   kfree(conn_req->ies);
+   conn_req->ies = NULL;
 
-   if (join_req && join_req_vif == vif) {
-   kfree(join_req);
-   join_req = NULL;
-   }
+   if (join_req && join_req_vif == vif) {
+   kfree(join_req);
+   join_req = NULL;
+   }
 
-   if (info_element && join_req_vif == vif) {
-   kfree(info_element);
-   info_element = NULL;
-   }
+   if (info_element && join_req_vif == vif) {
+   kfree(info_element);
+   info_element = NULL;
}
 
+out:
+
complete(_drv->comp_test_disconn_block);
 }
 
-- 
2.7.4


[PATCH 03/10] staging: wilc1000: rename label 'ERRORHANDLER' to avoid uppercase name

2018-03-08 Thread Ajay Singh
Cleanup patch to avoid use of uppercase for label names, to follow linux
coding style.

Signed-off-by: Ajay Singh 
---
 drivers/staging/wilc1000/host_interface.c | 54 +++
 1 file changed, 27 insertions(+), 27 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index e3ef7b8..d0c17cd 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -779,13 +779,13 @@ static s32 handle_scan(struct wilc_vif *vif, struct 
scan_attr *scan_info)
hif_drv->hif_state < HOST_IF_CONNECTED) {
netdev_err(vif->ndev, "Already scan\n");
result = -EBUSY;
-   goto ERRORHANDLER;
+   goto error;
}
 
if (wilc_optaining_ip || wilc_connecting) {
netdev_err(vif->ndev, "Don't do obss scan\n");
result = -EBUSY;
-   goto ERRORHANDLER;
+   goto error;
}
 
hif_drv->usr_scan_req.rcvd_ch_cnt = 0;
@@ -859,7 +859,7 @@ static s32 handle_scan(struct wilc_vif *vif, struct 
scan_attr *scan_info)
if (result)
netdev_err(vif->ndev, "Failed to send scan parameters\n");
 
-ERRORHANDLER:
+error:
if (result) {
del_timer(_drv->scan_timer);
handle_scan_done(vif, SCAN_EVENT_ABORTED);
@@ -936,7 +936,7 @@ static s32 handle_connect(struct wilc_vif *vif,
if (!bss_param) {
netdev_err(vif->ndev, "Required BSSID not found\n");
result = -ENOENT;
-   goto ERRORHANDLER;
+   goto error;
}
 
if (conn_attr->bssid) {
@@ -1027,7 +1027,7 @@ static s32 handle_connect(struct wilc_vif *vif,
}
if (!wid_list[wid_cnt].val) {
result = -EFAULT;
-   goto ERRORHANDLER;
+   goto error;
}
 
cur_byte = wid_list[wid_cnt].val;
@@ -1127,12 +1127,12 @@ static s32 handle_connect(struct wilc_vif *vif,
if (result) {
netdev_err(vif->ndev, "failed to send config packet\n");
result = -EFAULT;
-   goto ERRORHANDLER;
+   goto error;
} else {
hif_drv->hif_state = HOST_IF_WAITING_CONN_RESP;
}
 
-ERRORHANDLER:
+error:
if (result) {
struct connect_info conn_info;
 
@@ -2010,7 +2010,7 @@ static void handle_add_beacon(struct wilc_vif *vif, 
struct beacon_attr *param)
wid.size = param->head_len + param->tail_len + 16;
wid.val = kmalloc(wid.size, GFP_KERNEL);
if (!wid.val)
-   goto ERRORHANDLER;
+   goto error;
 
cur_byte = wid.val;
*cur_byte++ = (param->interval & 0xFF);
@@ -2045,7 +2045,7 @@ static void handle_add_beacon(struct wilc_vif *vif, 
struct beacon_attr *param)
if (result)
netdev_err(vif->ndev, "Failed to send add beacon\n");
 
-ERRORHANDLER:
+error:
kfree(wid.val);
kfree(param->head);
kfree(param->tail);
@@ -2117,7 +2117,7 @@ static void handle_add_station(struct wilc_vif *vif,
 
wid.val = kmalloc(wid.size, GFP_KERNEL);
if (!wid.val)
-   goto ERRORHANDLER;
+   goto error;
 
cur_byte = wid.val;
cur_byte += WILC_HostIf_PackStaParam(cur_byte, param);
@@ -2127,7 +2127,7 @@ static void handle_add_station(struct wilc_vif *vif,
if (result != 0)
netdev_err(vif->ndev, "Failed to send add station\n");
 
-ERRORHANDLER:
+error:
kfree(param->rates);
kfree(wid.val);
 }
@@ -2147,7 +2147,7 @@ static void handle_del_all_sta(struct wilc_vif *vif,
 
wid.val = kmalloc((param->assoc_sta * ETH_ALEN) + 1, GFP_KERNEL);
if (!wid.val)
-   goto ERRORHANDLER;
+   goto error;
 
curr_byte = wid.val;
 
@@ -2167,7 +2167,7 @@ static void handle_del_all_sta(struct wilc_vif *vif,
if (result)
netdev_err(vif->ndev, "Failed to send add station\n");
 
-ERRORHANDLER:
+error:
kfree(wid.val);
 
complete(_wait_response);
@@ -2185,7 +2185,7 @@ static void handle_del_station(struct wilc_vif *vif, 
struct del_sta *param)
 
wid.val = kmalloc(wid.size, GFP_KERNEL);
if (!wid.val)
-   goto ERRORHANDLER;
+   goto error;
 
cur_byte = wid.val;
 
@@ -2196,7 +2196,7 @@ static void handle_del_station(struct wilc_vif *vif, 
struct del_sta *param)
if (result)
netdev_err(vif->ndev, "Failed to send add station\n");
 
-ERRORHANDLER:
+error:
kfree(wid.val);
 }
 
@@ -2213,7 +2213,7 @@ static void handle_edit_station(struct wilc_vif *vif,
 
wid.val = kmalloc(wid.size, GFP_KERNEL);
if (!wid.val)
-   goto ERRORHANDLER;
+   goto error;
 
cur_byte = wid.val;
cur_byte += 

[PATCH 10/10] staging: wilc1000: fix line over 80 char issue in handle_scan_done()

2018-03-08 Thread Ajay Singh
Fix 'line over 80 characters' issue found by checkpatch.pl script in
handle_scan_done().

Signed-off-by: Ajay Singh 
---
 drivers/staging/wilc1000/host_interface.c | 9 +
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index d822b15..5082ede 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -886,6 +886,7 @@ static s32 handle_scan_done(struct wilc_vif *vif, enum 
scan_event evt)
u8 abort_running_scan;
struct wid wid;
struct host_if_drv *hif_drv = vif->hif_drv;
+   struct user_scan_req *scan_req;
 
if (evt == SCAN_EVENT_ABORTED) {
abort_running_scan = 1;
@@ -908,10 +909,10 @@ static s32 handle_scan_done(struct wilc_vif *vif, enum 
scan_event evt)
return result;
}
 
-   if (hif_drv->usr_scan_req.scan_result) {
-   hif_drv->usr_scan_req.scan_result(evt, NULL,
- hif_drv->usr_scan_req.arg, 
NULL);
-   hif_drv->usr_scan_req.scan_result = NULL;
+   scan_req = _drv->usr_scan_req;
+   if (scan_req->scan_result) {
+   scan_req->scan_result(evt, NULL, scan_req->arg, NULL);
+   scan_req->scan_result = NULL;
}
 
return result;
-- 
2.7.4

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


[PATCH 01/10] staging: wilc1000: rename pstrHostIFconnectAttr to avoid camelCase issue

2018-03-08 Thread Ajay Singh
Fix 'Avoid camelCase' issue found by checkpatch.pl script.

Signed-off-by: Ajay Singh 
---
 drivers/staging/wilc1000/host_interface.c | 104 +++---
 1 file changed, 52 insertions(+), 52 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index a4ee175..41fed8c 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -917,7 +917,7 @@ static s32 handle_scan_done(struct wilc_vif *vif, enum 
scan_event evt)
 
 u8 wilc_connected_ssid[6] = {0};
 static s32 handle_connect(struct wilc_vif *vif,
- struct connect_attr *pstrHostIFconnectAttr)
+ struct connect_attr *conn_attr)
 {
s32 result = 0;
struct wid wid_list[8];
@@ -926,45 +926,45 @@ static s32 handle_connect(struct wilc_vif *vif,
struct join_bss_param *bss_param;
struct host_if_drv *hif_drv = vif->hif_drv;
 
-   if (memcmp(pstrHostIFconnectAttr->bssid, wilc_connected_ssid, ETH_ALEN) 
== 0) {
+   if (memcmp(conn_attr->bssid, wilc_connected_ssid, ETH_ALEN) == 0) {
result = 0;
netdev_err(vif->ndev, "Discard connect request\n");
return result;
}
 
-   bss_param = pstrHostIFconnectAttr->params;
+   bss_param = conn_attr->params;
if (!bss_param) {
netdev_err(vif->ndev, "Required BSSID not found\n");
result = -ENOENT;
goto ERRORHANDLER;
}
 
-   if (pstrHostIFconnectAttr->bssid) {
+   if (conn_attr->bssid) {
hif_drv->usr_conn_req.bssid = kmalloc(6, GFP_KERNEL);
-   memcpy(hif_drv->usr_conn_req.bssid, 
pstrHostIFconnectAttr->bssid, 6);
+   memcpy(hif_drv->usr_conn_req.bssid, conn_attr->bssid, 6);
}
 
-   hif_drv->usr_conn_req.ssid_len = pstrHostIFconnectAttr->ssid_len;
-   if (pstrHostIFconnectAttr->ssid) {
-   hif_drv->usr_conn_req.ssid = 
kmalloc(pstrHostIFconnectAttr->ssid_len + 1, GFP_KERNEL);
+   hif_drv->usr_conn_req.ssid_len = conn_attr->ssid_len;
+   if (conn_attr->ssid) {
+   hif_drv->usr_conn_req.ssid = kmalloc(conn_attr->ssid_len + 1, 
GFP_KERNEL);
memcpy(hif_drv->usr_conn_req.ssid,
-  pstrHostIFconnectAttr->ssid,
-  pstrHostIFconnectAttr->ssid_len);
-   hif_drv->usr_conn_req.ssid[pstrHostIFconnectAttr->ssid_len] = 
'\0';
+  conn_attr->ssid,
+  conn_attr->ssid_len);
+   hif_drv->usr_conn_req.ssid[conn_attr->ssid_len] = '\0';
}
 
-   hif_drv->usr_conn_req.ies_len = pstrHostIFconnectAttr->ies_len;
-   if (pstrHostIFconnectAttr->ies) {
-   hif_drv->usr_conn_req.ies = 
kmalloc(pstrHostIFconnectAttr->ies_len, GFP_KERNEL);
+   hif_drv->usr_conn_req.ies_len = conn_attr->ies_len;
+   if (conn_attr->ies) {
+   hif_drv->usr_conn_req.ies = kmalloc(conn_attr->ies_len, 
GFP_KERNEL);
memcpy(hif_drv->usr_conn_req.ies,
-  pstrHostIFconnectAttr->ies,
-  pstrHostIFconnectAttr->ies_len);
+  conn_attr->ies,
+  conn_attr->ies_len);
}
 
-   hif_drv->usr_conn_req.security = pstrHostIFconnectAttr->security;
-   hif_drv->usr_conn_req.auth_type = pstrHostIFconnectAttr->auth_type;
-   hif_drv->usr_conn_req.conn_result = pstrHostIFconnectAttr->result;
-   hif_drv->usr_conn_req.arg = pstrHostIFconnectAttr->arg;
+   hif_drv->usr_conn_req.security = conn_attr->security;
+   hif_drv->usr_conn_req.auth_type = conn_attr->auth_type;
+   hif_drv->usr_conn_req.conn_result = conn_attr->result;
+   hif_drv->usr_conn_req.arg = conn_attr->arg;
 
wid_list[wid_cnt].id = WID_SUCCESS_FRAME_COUNT;
wid_list[wid_cnt].type = WID_INT;
@@ -991,7 +991,7 @@ static s32 handle_connect(struct wilc_vif *vif,
wid_list[wid_cnt].size = hif_drv->usr_conn_req.ies_len;
wid_cnt++;
 
-   if (memcmp("DIRECT-", pstrHostIFconnectAttr->ssid, 7)) {
+   if (memcmp("DIRECT-", conn_attr->ssid, 7)) {
info_element_size = hif_drv->usr_conn_req.ies_len;
info_element = kmalloc(info_element_size, GFP_KERNEL);
memcpy(info_element, hif_drv->usr_conn_req.ies,
@@ -1004,7 +1004,7 @@ static s32 handle_connect(struct wilc_vif *vif,
wid_list[wid_cnt].val = (s8 *)_drv->usr_conn_req.security;
wid_cnt++;
 
-   if (memcmp("DIRECT-", pstrHostIFconnectAttr->ssid, 7))
+   if (memcmp("DIRECT-", conn_attr->ssid, 7))
mode_11i = hif_drv->usr_conn_req.security;
 
wid_list[wid_cnt].id = (u16)WID_AUTH_TYPE;
@@ -1013,7 +1013,7 @@ static s32 handle_connect(struct wilc_vif *vif,
wid_list[wid_cnt].val 

[PATCH 02/10] staging: wilc1000: rename strConnectInfo to avoid camelCase

2018-03-08 Thread Ajay Singh
Fix 'Avoid camelCase' issue found by checkpatch.pl script.

Signed-off-by: Ajay Singh 
---
 drivers/staging/wilc1000/host_interface.c | 56 +++
 1 file changed, 28 insertions(+), 28 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 41fed8c..e3ef7b8 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -1134,32 +1134,32 @@ static s32 handle_connect(struct wilc_vif *vif,
 
 ERRORHANDLER:
if (result) {
-   struct connect_info strConnectInfo;
+   struct connect_info conn_info;
 
del_timer(_drv->connect_timer);
 
-   memset(, 0, sizeof(struct connect_info));
+   memset(_info, 0, sizeof(struct connect_info));
 
if (conn_attr->result) {
if (conn_attr->bssid)
-   memcpy(strConnectInfo.bssid, conn_attr->bssid, 
6);
+   memcpy(conn_info.bssid, conn_attr->bssid, 6);
 
if (conn_attr->ies) {
-   strConnectInfo.req_ies_len = conn_attr->ies_len;
-   strConnectInfo.req_ies = 
kmalloc(conn_attr->ies_len, GFP_KERNEL);
-   memcpy(strConnectInfo.req_ies,
+   conn_info.req_ies_len = conn_attr->ies_len;
+   conn_info.req_ies = kmalloc(conn_attr->ies_len, 
GFP_KERNEL);
+   memcpy(conn_info.req_ies,
   conn_attr->ies,
   conn_attr->ies_len);
}
 
conn_attr->result(CONN_DISCONN_EVENT_CONN_RESP,
-  ,
+  _info,
   MAC_DISCONNECTED,
   NULL,
   conn_attr->arg);
hif_drv->hif_state = HOST_IF_IDLE;
-   kfree(strConnectInfo.req_ies);
-   strConnectInfo.req_ies = NULL;
+   kfree(conn_info.req_ies);
+   conn_info.req_ies = NULL;
 
} else {
netdev_err(vif->ndev, "Connect callback is NULL\n");
@@ -1343,7 +1343,7 @@ static s32 handle_rcvd_gnrl_async_info(struct wilc_vif 
*vif,
u8 u8MacStatus;
u8 u8MacStatusReasonCode;
u8 u8MacStatusAdditionalInfo;
-   struct connect_info strConnectInfo;
+   struct connect_info conn_info;
struct disconnect_info disconn_info;
s32 s32Err = 0;
struct host_if_drv *hif_drv = vif->hif_drv;
@@ -1380,7 +1380,7 @@ static s32 handle_rcvd_gnrl_async_info(struct wilc_vif 
*vif,
u32 u32RcvdAssocRespInfoLen = 0;
struct connect_resp_info *pstrConnectRespInfo = NULL;
 
-   memset(, 0, sizeof(struct connect_info));
+   memset(_info, 0, sizeof(struct connect_info));
 
if (u8MacStatus == MAC_CONNECTED) {
memset(rcv_assoc_resp, 0, 
MAX_ASSOC_RESP_FRAME_SIZE);
@@ -1396,12 +1396,12 @@ static s32 handle_rcvd_gnrl_async_info(struct wilc_vif 
*vif,
if (s32Err) {
netdev_err(vif->ndev, 
"wilc_parse_assoc_resp_info() returned error %d\n", s32Err);
} else {
-   strConnectInfo.status = 
pstrConnectRespInfo->status;
+   conn_info.status = 
pstrConnectRespInfo->status;
 
-   if (strConnectInfo.status == 
SUCCESSFUL_STATUSCODE && pstrConnectRespInfo->ies) {
-   
strConnectInfo.resp_ies_len = pstrConnectRespInfo->ies_len;
-   strConnectInfo.resp_ies 
= kmalloc(pstrConnectRespInfo->ies_len, GFP_KERNEL);
-   
memcpy(strConnectInfo.resp_ies, pstrConnectRespInfo->ies,
+   if (conn_info.status == 
SUCCESSFUL_STATUSCODE && pstrConnectRespInfo->ies) {
+   conn_info.resp_ies_len 
= pstrConnectRespInfo->ies_len;
+   conn_info.resp_ies = 
kmalloc(pstrConnectRespInfo->ies_len, GFP_KERNEL);
+   
memcpy(conn_info.resp_ies, pstrConnectRespInfo->ies,
  

[PATCH 00/10] staging: wilc1000: fixes for checkpatch issues & coding style related

2018-03-08 Thread Ajay Singh
This patch series contains modification to remove the checkpatch warnings
and changes to follow linux coding style.

Ajay Singh (10):
  staging: wilc1000: rename pstrHostIFconnectAttr to avoid camelCase
issue
  staging: wilc1000: rename strConnectInfo to avoid camelCase
  staging: wilc1000: rename label 'ERRORHANDLER' to avoid uppercase name
  staging: wilc1000: fix line over 80 char in handle_scan()
  staging: wilc1000: fix line over 80 char in handle_connect()
  staging: wilc1000: fix line over 80 character in handle_disconnect()
  staging: wilc1000: rename variables prefix using datatype 'u8'
  staging: wilc1000: rename WILC_HostIf_PackStaParam to avoid camelCase
  staging: wilc1000: rename variables using camelCase in
handle_rcvd_gnrl_async_info()
  staging: wilc1000: fix line over 80 char issue in handle_scan_done()

 drivers/staging/wilc1000/coreconfigurator.c |  28 +-
 drivers/staging/wilc1000/host_interface.c   | 580 ++--
 2 files changed, 308 insertions(+), 300 deletions(-)

-- 
2.7.4

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


[PATCH 10/10] staging: wilc1000: fix line over 80 char in cfg_scan_result()

2018-03-08 Thread Ajay Singh
Refactor cfg_scan_result() API to avoid 'line over 80 chars' issue
reported by checkpatch.pl script.

Signed-off-by: Ajay Singh 
---
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 148 +++---
 1 file changed, 77 insertions(+), 71 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 9da686b..5395648 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -374,91 +374,97 @@ static void cfg_scan_result(enum scan_event scan_event,
struct cfg80211_bss *bss = NULL;
 
priv = user_void;
-   if (priv->cfg_scanning) {
-   if (scan_event == SCAN_EVENT_NETWORK_FOUND) {
-   wiphy = priv->dev->ieee80211_ptr->wiphy;
+   if (!priv->cfg_scanning)
+   return;
+
+   if (scan_event == SCAN_EVENT_NETWORK_FOUND) {
+   wiphy = priv->dev->ieee80211_ptr->wiphy;
+
+   if (!wiphy || !network_info)
+   return;
 
-   if (!wiphy)
+   if (wiphy->signal_type == CFG80211_SIGNAL_TYPE_UNSPEC &&
+   (((s32)network_info->rssi * 100) < 0 ||
+   ((s32)network_info->rssi * 100) > 100))
+   return;
+
+   s32Freq = ieee80211_channel_to_frequency((s32)network_info->ch,
+NL80211_BAND_2GHZ);
+   channel = ieee80211_get_channel(wiphy, s32Freq);
+
+   if (!channel)
+   return;
+
+   if (network_info->new_network) {
+   if (priv->rcvd_ch_cnt >= MAX_NUM_SCANNED_NETWORKS)
return;
 
-   if (wiphy->signal_type == CFG80211_SIGNAL_TYPE_UNSPEC &&
-   (((s32)network_info->rssi * 100) < 0 ||
-   ((s32)network_info->rssi * 100) > 100))
+   priv->rcvd_ch_cnt++;
+
+   add_network_to_shadow(network_info, priv, join_params);
+
+   if (memcmp("DIRECT-", network_info->ssid, 7))
return;
 
-   if (network_info) {
-   s32Freq = 
ieee80211_channel_to_frequency((s32)network_info->ch, NL80211_BAND_2GHZ);
-   channel = ieee80211_get_channel(wiphy, s32Freq);
-
-   if (!channel)
-   return;
-
-   if (network_info->new_network) {
-   if (priv->rcvd_ch_cnt < 
MAX_NUM_SCANNED_NETWORKS) {
-   priv->rcvd_ch_cnt++;
-
-   
add_network_to_shadow(network_info, priv, join_params);
-
-   if (!(memcmp("DIRECT-", 
network_info->ssid, 7))) {
-   bss = 
cfg80211_inform_bss(wiphy,
-   
  channel,
-   
  CFG80211_BSS_FTYPE_UNKNOWN,
-   
  network_info->bssid,
-   
  network_info->tsf_hi,
-   
  network_info->cap_info,
-   
  network_info->beacon_period,
-   
  (const u8 *)network_info->ies,
-   
  (size_t)network_info->ies_len,
-   
  (s32)network_info->rssi * 100,
-   
  GFP_KERNEL);
-   cfg80211_put_bss(wiphy, 
bss);
-   }
-   }
-   } else {
-   u32 i;
+   bss = cfg80211_inform_bss(wiphy,
+ channel,
+ CFG80211_BSS_FTYPE_UNKNOWN,
+ network_info->bssid,
+ network_info->tsf_hi,
+ network_info->cap_info,
+ network_info->beacon_period,
+  

[PATCH 03/10] staging: wilc1000: rename CfgScanResult to avoid camelCase

2018-03-08 Thread Ajay Singh
Fix 'Avoid camelCase' issue found by checkpatch.pl script.

Signed-off-by: Ajay Singh 
---
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 11 +--
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 2fda90d..051ba12 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -363,10 +363,9 @@ static void add_network_to_shadow(struct network_info 
*nw_info,
last_scanned_shadow[ap_index].join_params = pJoinParams;
 }
 
-static void CfgScanResult(enum scan_event scan_event,
- struct network_info *network_info,
- void *user_void,
- void *join_params)
+static void cfg_scan_result(enum scan_event scan_event,
+   struct network_info *network_info,
+   void *user_void, void *join_params)
 {
struct wilc_priv *priv;
struct wiphy *wiphy;
@@ -622,14 +621,14 @@ static int scan(struct wiphy *wiphy, struct 
cfg80211_scan_request *request)
au8ScanChanList,
request->n_channels,
(const u8 *)request->ie,
-   request->ie_len, CfgScanResult,
+   request->ie_len, cfg_scan_result,
(void *)priv, _ntwk);
} else {
ret = wilc_scan(vif, USER_SCAN, ACTIVE_SCAN,
au8ScanChanList,
request->n_channels,
(const u8 *)request->ie,
-   request->ie_len, CfgScanResult,
+   request->ie_len, cfg_scan_result,
(void *)priv, NULL);
}
} else {
-- 
2.7.4

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


[PATCH 09/10] staging: wilc1000: rename pJoinParams to avoid camelCase

2018-03-08 Thread Ajay Singh
Fix 'Avoid camelCase' issue found by checkpatch.pl script.

Signed-off-by: Ajay Singh 
---
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index a93c550..9da686b 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -315,7 +315,7 @@ static int is_network_in_shadow(struct network_info 
*nw_info, void *user_void)
 }
 
 static void add_network_to_shadow(struct network_info *nw_info,
- void *user_void, void *pJoinParams)
+ void *user_void, void *join_params)
 {
int ap_found = is_network_in_shadow(nw_info, user_void);
u32 ap_index = 0;
@@ -360,7 +360,7 @@ static void add_network_to_shadow(struct network_info 
*nw_info,
last_scanned_shadow[ap_index].found = 1;
if (ap_found != -1)
kfree(last_scanned_shadow[ap_index].join_params);
-   last_scanned_shadow[ap_index].join_params = pJoinParams;
+   last_scanned_shadow[ap_index].join_params = join_params;
 }
 
 static void cfg_scan_result(enum scan_event scan_event,
-- 
2.7.4

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


[PATCH 08/10] staging: wilc1000: fix line over 80 char in mgmt_tx_cancel_wait()

2018-03-08 Thread Ajay Singh
Fix 'line over 80 char' issue found in checkpatch.pl script.

Signed-off-by: Ajay Singh 
---
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 911af68..a93c550 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -1705,9 +1705,13 @@ static int mgmt_tx_cancel_wait(struct wiphy *wiphy,
wfi_drv->p2p_timeout = jiffies;
 
if (!priv->p2p_listen_state) {
+   struct wilc_wfi_p2p_listen_params *params;
+
+   params = >remain_on_ch_params;
+
cfg80211_remain_on_channel_expired(priv->wdev,
-  
priv->remain_on_ch_params.listen_cookie,
-  
priv->remain_on_ch_params.listen_ch,
+  params->listen_cookie,
+  params->listen_ch,
   GFP_KERNEL);
}
 
-- 
2.7.4

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


[PATCH 06/10] staging: wilc1000: fix line over 80 char in get_key() & set_default_key()

2018-03-08 Thread Ajay Singh
Fix 'line over 80 characters' issue found by checkpatch.pl script.

Signed-off-by: Ajay Singh 
---
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 3354bf2..92c3213 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -1118,8 +1118,8 @@ static int del_key(struct wiphy *wiphy, struct net_device 
*netdev,
 }
 
 static int get_key(struct wiphy *wiphy, struct net_device *netdev, u8 
key_index,
-  bool pairwise,
-  const u8 *mac_addr, void *cookie, void (*callback)(void 
*cookie, struct key_params *))
+  bool pairwise, const u8 *mac_addr, void *cookie,
+  void (*callback)(void *cookie, struct key_params *))
 {
struct wilc_priv *priv;
struct  key_params key_params;
@@ -1145,8 +1145,8 @@ static int get_key(struct wiphy *wiphy, struct net_device 
*netdev, u8 key_index,
return 0;
 }
 
-static int set_default_key(struct wiphy *wiphy, struct net_device *netdev, u8 
key_index,
-  bool unicast, bool multicast)
+static int set_default_key(struct wiphy *wiphy, struct net_device *netdev,
+  u8 key_index, bool unicast, bool multicast)
 {
struct wilc_priv *priv;
struct wilc_vif *vif;
-- 
2.7.4

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


[PATCH 04/10] staging: wilc1000: rename au8ScanChanList to avoid camelCase

2018-03-08 Thread Ajay Singh
Fix 'Avoid camelCase' issue found by checkpatch.pl script.

Signed-off-by: Ajay Singh 
---
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 051ba12..1f6c02a 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -581,7 +581,7 @@ static int scan(struct wiphy *wiphy, struct 
cfg80211_scan_request *request)
struct wilc_priv *priv;
u32 i;
s32 ret = 0;
-   u8 au8ScanChanList[MAX_NUM_SCANNED_NETWORKS];
+   u8 scan_ch_list[MAX_NUM_SCANNED_NETWORKS];
struct hidden_network hidden_ntwk;
struct wilc_vif *vif;
 
@@ -597,7 +597,7 @@ static int scan(struct wiphy *wiphy, struct 
cfg80211_scan_request *request)
priv->cfg_scanning = true;
if (request->n_channels <= MAX_NUM_SCANNED_NETWORKS) {
for (i = 0; i < request->n_channels; i++)
-   au8ScanChanList[i] = 
(u8)ieee80211_frequency_to_channel(request->channels[i]->center_freq);
+   scan_ch_list[i] = 
(u8)ieee80211_frequency_to_channel(request->channels[i]->center_freq);
 
if (request->n_ssids >= 1) {
hidden_ntwk.net_info =
@@ -618,14 +618,14 @@ static int scan(struct wiphy *wiphy, struct 
cfg80211_scan_request *request)
}
}
ret = wilc_scan(vif, USER_SCAN, ACTIVE_SCAN,
-   au8ScanChanList,
+   scan_ch_list,
request->n_channels,
(const u8 *)request->ie,
request->ie_len, cfg_scan_result,
(void *)priv, _ntwk);
} else {
ret = wilc_scan(vif, USER_SCAN, ACTIVE_SCAN,
-   au8ScanChanList,
+   scan_ch_list,
request->n_channels,
(const u8 *)request->ie,
request->ie_len, cfg_scan_result,
-- 
2.7.4

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


[PATCH 07/10] staging: wilc1000: fix line over 80 char for cfg parse RX and TX function

2018-03-08 Thread Ajay Singh
Fix 'line over 80 characters' issue found by checkpatch.pl script. Moved
the common code from wilc_wfi_cfg_parse_tx_action() &
wilc_wfi_cfg_parse_rx_action() to new function to avoid checkpatch issue.

Signed-off-by: Ajay Singh 
---
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 67 +++
 1 file changed, 32 insertions(+), 35 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 92c3213..911af68 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -1337,10 +1337,33 @@ static int flush_pmksa(struct wiphy *wiphy, struct 
net_device *netdev)
return 0;
 }
 
+static inline void wilc_wfi_cfg_parse_ch_attr(u8 *buf, u8 ch_list_attr_idx,
+ u8 op_ch_attr_idx)
+{
+   int i = 0;
+   int j = 0;
+
+   if (ch_list_attr_idx) {
+   u8 limit = ch_list_attr_idx + 3 + buf[ch_list_attr_idx + 1];
+
+   for (i = ch_list_attr_idx + 3; i < limit; i++) {
+   if (buf[i] == 0x51) {
+   for (j = i + 2; j < ((i + 2) + buf[i + 1]); j++)
+   buf[j] = wlan_channel;
+   break;
+   }
+   }
+   }
+
+   if (op_ch_attr_idx) {
+   buf[op_ch_attr_idx + 6] = 0x51;
+   buf[op_ch_attr_idx + 7] = wlan_channel;
+   }
+}
+
 static void wilc_wfi_cfg_parse_rx_action(u8 *buf, u32 len)
 {
u32 index = 0;
-   u32 i = 0, j = 0;
 
u8 op_channel_attr_index = 0;
u8 channel_list_attr_index = 0;
@@ -1355,28 +1378,15 @@ static void wilc_wfi_cfg_parse_rx_action(u8 *buf, u32 
len)
op_channel_attr_index = index;
index += buf[index + 1] + 3;
}
-   if (wlan_channel != INVALID_CHANNEL) {
-   if (channel_list_attr_index) {
-   for (i = channel_list_attr_index + 3; i < 
((channel_list_attr_index + 3) + buf[channel_list_attr_index + 1]); i++) {
-   if (buf[i] == 0x51) {
-   for (j = i + 2; j < ((i + 2) + buf[i + 
1]); j++)
-   buf[j] = wlan_channel;
-   break;
-   }
-   }
-   }
-
-   if (op_channel_attr_index) {
-   buf[op_channel_attr_index + 6] = 0x51;
-   buf[op_channel_attr_index + 7] = wlan_channel;
-   }
-   }
+   if (wlan_channel != INVALID_CHANNEL)
+   wilc_wfi_cfg_parse_ch_attr(buf, channel_list_attr_index,
+  op_channel_attr_index);
 }
 
-static void wilc_wfi_cfg_parse_tx_action(u8 *buf, u32 len, bool oper_ch, u8 
iftype)
+static void wilc_wfi_cfg_parse_tx_action(u8 *buf, u32 len, bool oper_ch,
+u8 iftype)
 {
u32 index = 0;
-   u32 i = 0, j = 0;
 
u8 op_channel_attr_index = 0;
u8 channel_list_attr_index = 0;
@@ -1394,22 +1404,9 @@ static void wilc_wfi_cfg_parse_tx_action(u8 *buf, u32 
len, bool oper_ch, u8 ifty
op_channel_attr_index = index;
index += buf[index + 1] + 3;
}
-   if (wlan_channel != INVALID_CHANNEL && oper_ch) {
-   if (channel_list_attr_index) {
-   for (i = channel_list_attr_index + 3; i < 
((channel_list_attr_index + 3) + buf[channel_list_attr_index + 1]); i++) {
-   if (buf[i] == 0x51) {
-   for (j = i + 2; j < ((i + 2) + buf[i + 
1]); j++)
-   buf[j] = wlan_channel;
-   break;
-   }
-   }
-   }
-
-   if (op_channel_attr_index) {
-   buf[op_channel_attr_index + 6] = 0x51;
-   buf[op_channel_attr_index + 7] = wlan_channel;
-   }
-   }
+   if (wlan_channel != INVALID_CHANNEL && oper_ch)
+   wilc_wfi_cfg_parse_ch_attr(buf, channel_list_attr_index,
+  op_channel_attr_index);
 }
 
 void WILC_WFI_p2p_rx(struct net_device *dev, u8 *buff, u32 size)
-- 
2.7.4

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


[PATCH 02/10] staging: wilc1000: rename pstrNetworkInfo to avoid camelCase

2018-03-08 Thread Ajay Singh
Fix 'Avoid camleCase' issue found by checkpatch.pl script.

Signed-off-by: Ajay Singh 
---
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 51 +++
 1 file changed, 25 insertions(+), 26 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index dd7ab51..2fda90d 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -294,8 +294,7 @@ static void clear_duringIP(struct timer_list *unused)
wilc_optaining_ip = false;
 }
 
-static int is_network_in_shadow(struct network_info *pstrNetworkInfo,
-   void *user_void)
+static int is_network_in_shadow(struct network_info *nw_info, void *user_void)
 {
int state = -1;
int i;
@@ -306,7 +305,7 @@ static int is_network_in_shadow(struct network_info 
*pstrNetworkInfo,
} else {
for (i = 0; i < last_scanned_cnt; i++) {
if (memcmp(last_scanned_shadow[i].bssid,
-  pstrNetworkInfo->bssid, 6) == 0) {
+  nw_info->bssid, 6) == 0) {
state = i;
break;
}
@@ -315,10 +314,10 @@ static int is_network_in_shadow(struct network_info 
*pstrNetworkInfo,
return state;
 }
 
-static void add_network_to_shadow(struct network_info *pstrNetworkInfo,
+static void add_network_to_shadow(struct network_info *nw_info,
  void *user_void, void *pJoinParams)
 {
-   int ap_found = is_network_in_shadow(pstrNetworkInfo, user_void);
+   int ap_found = is_network_in_shadow(nw_info, user_void);
u32 ap_index = 0;
u8 rssi_index = 0;
 
@@ -332,30 +331,30 @@ static void add_network_to_shadow(struct network_info 
*pstrNetworkInfo,
ap_index = ap_found;
}
rssi_index = last_scanned_shadow[ap_index].rssi_history.index;
-   last_scanned_shadow[ap_index].rssi_history.samples[rssi_index++] = 
pstrNetworkInfo->rssi;
+   last_scanned_shadow[ap_index].rssi_history.samples[rssi_index++] = 
nw_info->rssi;
if (rssi_index == NUM_RSSI) {
rssi_index = 0;
last_scanned_shadow[ap_index].rssi_history.full = true;
}
last_scanned_shadow[ap_index].rssi_history.index = rssi_index;
-   last_scanned_shadow[ap_index].rssi = pstrNetworkInfo->rssi;
-   last_scanned_shadow[ap_index].cap_info = pstrNetworkInfo->cap_info;
-   last_scanned_shadow[ap_index].ssid_len = pstrNetworkInfo->ssid_len;
+   last_scanned_shadow[ap_index].rssi = nw_info->rssi;
+   last_scanned_shadow[ap_index].cap_info = nw_info->cap_info;
+   last_scanned_shadow[ap_index].ssid_len = nw_info->ssid_len;
memcpy(last_scanned_shadow[ap_index].ssid,
-  pstrNetworkInfo->ssid, pstrNetworkInfo->ssid_len);
+  nw_info->ssid, nw_info->ssid_len);
memcpy(last_scanned_shadow[ap_index].bssid,
-  pstrNetworkInfo->bssid, ETH_ALEN);
-   last_scanned_shadow[ap_index].beacon_period = 
pstrNetworkInfo->beacon_period;
-   last_scanned_shadow[ap_index].dtim_period = 
pstrNetworkInfo->dtim_period;
-   last_scanned_shadow[ap_index].ch = pstrNetworkInfo->ch;
-   last_scanned_shadow[ap_index].ies_len = pstrNetworkInfo->ies_len;
-   last_scanned_shadow[ap_index].tsf_hi = pstrNetworkInfo->tsf_hi;
+  nw_info->bssid, ETH_ALEN);
+   last_scanned_shadow[ap_index].beacon_period = nw_info->beacon_period;
+   last_scanned_shadow[ap_index].dtim_period = nw_info->dtim_period;
+   last_scanned_shadow[ap_index].ch = nw_info->ch;
+   last_scanned_shadow[ap_index].ies_len = nw_info->ies_len;
+   last_scanned_shadow[ap_index].tsf_hi = nw_info->tsf_hi;
if (ap_found != -1)
kfree(last_scanned_shadow[ap_index].ies);
-   last_scanned_shadow[ap_index].ies = kmalloc(pstrNetworkInfo->ies_len,
+   last_scanned_shadow[ap_index].ies = kmalloc(nw_info->ies_len,
GFP_KERNEL);
memcpy(last_scanned_shadow[ap_index].ies,
-  pstrNetworkInfo->ies, pstrNetworkInfo->ies_len);
+  nw_info->ies, nw_info->ies_len);
last_scanned_shadow[ap_index].time_scan = jiffies;
last_scanned_shadow[ap_index].time_scan_cached = jiffies;
last_scanned_shadow[ap_index].found = 1;
@@ -654,7 +653,7 @@ static int connect(struct wiphy *wiphy, struct net_device 
*dev,
 
struct wilc_priv *priv;
struct host_if_drv *wfi_drv;
-   struct network_info *pstrNetworkInfo = NULL;
+   struct network_info *nw_info = NULL;
struct wilc_vif *vif;
 
wilc_connecting = 1;
@@ -689,7 +688,7 @@ static int connect(struct wiphy *wiphy, struct net_device 
*dev,
}
 
if 

[PATCH 05/10] staging: wilc1000: fix line over 80 char in change_virtual_intf()

2018-03-08 Thread Ajay Singh
Fix 'line over 80 char' issue found by checkpatch.pl script.

Signed-off-by: Ajay Singh 
---
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 1f6c02a..3354bf2 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -1804,7 +1804,8 @@ static int set_power_mgmt(struct wiphy *wiphy, struct 
net_device *dev,
 }
 
 static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev,
-  enum nl80211_iftype type, struct vif_params 
*params)
+  enum nl80211_iftype type,
+  struct vif_params *params)
 {
struct wilc_priv *priv;
struct wilc_vif *vif;
@@ -1828,7 +1829,8 @@ static int change_virtual_intf(struct wiphy *wiphy, 
struct net_device *dev,
vif->iftype = STATION_MODE;
wilc_set_operation_mode(vif, STATION_MODE);
 
-   memset(priv->assoc_stainfo.sta_associated_bss, 0, MAX_NUM_STA * 
ETH_ALEN);
+   memset(priv->assoc_stainfo.sta_associated_bss, 0,
+  MAX_NUM_STA * ETH_ALEN);
 
wilc_enable_ps = true;
wilc_set_power_mgmt(vif, 1, 0);
-- 
2.7.4

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


[PATCH 01/10] staging: wilc1000: rename strHiddenNetwork to avoid camelCase

2018-03-08 Thread Ajay Singh
Fix 'Avoid camelCase' issue found by checkpatch.pl script.

Signed-off-by: Ajay Singh 
---
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 18 +-
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 205304c..dd7ab51 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -584,7 +584,7 @@ static int scan(struct wiphy *wiphy, struct 
cfg80211_scan_request *request)
u32 i;
s32 ret = 0;
u8 au8ScanChanList[MAX_NUM_SCANNED_NETWORKS];
-   struct hidden_network strHiddenNetwork;
+   struct hidden_network hidden_ntwk;
struct wilc_vif *vif;
 
priv = wiphy_priv(wiphy);
@@ -602,21 +602,21 @@ static int scan(struct wiphy *wiphy, struct 
cfg80211_scan_request *request)
au8ScanChanList[i] = 
(u8)ieee80211_frequency_to_channel(request->channels[i]->center_freq);
 
if (request->n_ssids >= 1) {
-   strHiddenNetwork.net_info =
+   hidden_ntwk.net_info =
kmalloc_array(request->n_ssids,
  sizeof(struct hidden_network),
  GFP_KERNEL);
-   if (!strHiddenNetwork.net_info)
+   if (!hidden_ntwk.net_info)
return -ENOMEM;
-   strHiddenNetwork.n_ssids = request->n_ssids;
+   hidden_ntwk.n_ssids = request->n_ssids;
 
for (i = 0; i < request->n_ssids; i++) {
if (request->ssids[i].ssid_len != 0) {
-   strHiddenNetwork.net_info[i].ssid = 
kmalloc(request->ssids[i].ssid_len, GFP_KERNEL);
-   
memcpy(strHiddenNetwork.net_info[i].ssid, request->ssids[i].ssid, 
request->ssids[i].ssid_len);
-   strHiddenNetwork.net_info[i].ssid_len = 
request->ssids[i].ssid_len;
+   hidden_ntwk.net_info[i].ssid = 
kmalloc(request->ssids[i].ssid_len, GFP_KERNEL);
+   memcpy(hidden_ntwk.net_info[i].ssid, 
request->ssids[i].ssid, request->ssids[i].ssid_len);
+   hidden_ntwk.net_info[i].ssid_len = 
request->ssids[i].ssid_len;
} else {
-   strHiddenNetwork.n_ssids -= 1;
+   hidden_ntwk.n_ssids -= 1;
}
}
ret = wilc_scan(vif, USER_SCAN, ACTIVE_SCAN,
@@ -624,7 +624,7 @@ static int scan(struct wiphy *wiphy, struct 
cfg80211_scan_request *request)
request->n_channels,
(const u8 *)request->ie,
request->ie_len, CfgScanResult,
-   (void *)priv, );
+   (void *)priv, _ntwk);
} else {
ret = wilc_scan(vif, USER_SCAN, ACTIVE_SCAN,
au8ScanChanList,
-- 
2.7.4

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


[PATCH 00/10] staging: wilc1000: fixes related to camelCase & line over 80 chars

2018-03-08 Thread Ajay Singh
Patch series contains fixes to remove checkpatch reported warnings.

Ajay Singh (10):
  staging: wilc1000: rename strHiddenNetwork to avoid camelCase
  staging: wilc1000: rename pstrNetworkInfo to avoid camelCase
  staging: wilc1000: rename CfgScanResult to avoid camelCase
  staging: wilc1000: rename au8ScanChanList to avoid camelCase
  staging: wilc1000: fix line over 80 char in change_virtual_intf()
  staging: wilc1000: fix line over 80 char in get_key() &
set_default_key()
  staging: wilc1000: fix line over 80 char for cfg parse RX and TX
function
  staging: wilc1000: fix line over 80 char in mgmt_tx_cancel_wait()
  staging: wilc1000: rename pJoinParams to avoid camelCase
  staging: wilc1000: fix line over 80 char in cfg_scan_result()

 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 329 +++---
 1 file changed, 168 insertions(+), 161 deletions(-)

-- 
2.7.4

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


Re: [PATCH] staging: ccree: remove ccree staging copy

2018-03-08 Thread Gilad Ben-Yossef
On Thu, Mar 8, 2018 at 1:08 PM, Dan Carpenter  wrote:
> Congratulations.  :)

Thanks goes to you, Greg and all other contributors and reviewers that
help made this happen.

You have my eternal gratitude and a an open invitation to a free
beverage of your choice, adult or otherwise, when we next meet :-)


It's worth mentioning I'll be giving a presentation next week at
Embedded Linux Conference US about some of the surprising benefits we
got from the process -
https://elciotna18.sched.com/event/d47bcefac0cd7dd456ad35d0f6ec9159

Come say hi if you're there.

Gilad

-- 
Gilad Ben-Yossef
Chief Coffee Drinker

"If you take a class in large-scale robotics, can you end up in a
situation where the homework eats your dog?"
 -- Jean-Baptiste Queru
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] staging: ccree: remove ccree staging copy

2018-03-08 Thread Dan Carpenter
Congratulations.  :)

regards,
dan carpenter

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


Re: [PATCH] staging: android: ashmem: Remove deadlock

2018-03-08 Thread Dan Carpenter
Thanks!  Somebody already sent this.

On Wed, Mar 07, 2018 at 01:40:30PM -0800, Paul Lawrence wrote:
> Regression introduced in commit ce8a3a9e76d0193e2e8d74a06d275b3c324ca652
> ("staging: android: ashmem: Fix a race condition in pin ioctls")
> causing deadlock.

Use the Fixes tag for this.  The format is:

Fixes: ce8a3a9e76d0 ("staging: android: ashmem: Fix a race condition in pin 
ioctls")

Then you only need one stable CC line.  Just the oldest kernel which
needs to be patched.

Cc:  # 3.18.x

The extra git hash after the stable CC is for if a bug requires several
patches to fix it.  In this case it only requires just this patch so
there's no need to have the hash.

Basically you did extra work which isn't required.  Anyway, this fix was
already merged so no need to resend or anything.

regards,
dan carpenter

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


Re: [PATCH] staging: lustre: Remove VLA usage

2018-03-08 Thread Dan Carpenter
On Wed, Mar 07, 2018 at 02:10:41PM +0100, Rasmus Villemoes wrote:
> On 2018-03-07 06:46, Kees Cook wrote:
> > The kernel would like to remove all VLA usage. This switches to a
> > simple kasprintf() instead.
> > 
> > Signed-off-by: Kees Cook 
> > ---
> >  drivers/staging/lustre/lustre/llite/xattr.c | 19 +--
> >  1 file changed, 13 insertions(+), 6 deletions(-)
> > 
> > diff --git a/drivers/staging/lustre/lustre/llite/xattr.c 
> > b/drivers/staging/lustre/lustre/llite/xattr.c
> > index 532384c91447..aab4eab64289 100644
> > --- a/drivers/staging/lustre/lustre/llite/xattr.c
> > +++ b/drivers/staging/lustre/lustre/llite/xattr.c
> > @@ -87,7 +87,7 @@ ll_xattr_set_common(const struct xattr_handler *handler,
> > const char *name, const void *value, size_t size,
> > int flags)
> >  {
> > -   char fullname[strlen(handler->prefix) + strlen(name) + 1];
> > +   char *fullname;
> > struct ll_sb_info *sbi = ll_i2sbi(inode);
> > struct ptlrpc_request *req = NULL;
> > const char *pv = value;
> > @@ -141,10 +141,13 @@ ll_xattr_set_common(const struct xattr_handler 
> > *handler,
> > return -EPERM;
> > }
> >  
> > -   sprintf(fullname, "%s%s\n", handler->prefix, name);
> 
> It's probably worth pointing out that this actually fixes an
> unconditional buffer overflow: fullname only has room for the two
> strings and the '\n', but vsnprintf() is told that the buffer has
> infinite size (well, INT_MAX), so there should be plenty of room to
> append the '\0' after the '\n'.
> 
> > +   fullname = kasprintf(GFP_KERNEL, "%s%s\n", handler->prefix, name);
> > +   if (!fullname)
> > +   return -ENOMEM;
> > rc = md_setxattr(sbi->ll_md_exp, ll_inode2fid(inode),
> >  valid, fullname, pv, size, 0, flags,
> >  ll_i2suppgid(inode), );
> > +   kfree(fullname);
> > if (rc) {
> > if (rc == -EOPNOTSUPP && handler->flags == XATTR_USER_T) {
> > LCONSOLE_INFO("Disabling user_xattr feature because it 
> > is not supported on the server\n");
> > @@ -364,7 +367,7 @@ static int ll_xattr_get_common(const struct 
> > xattr_handler *handler,
> >struct dentry *dentry, struct inode *inode,
> >const char *name, void *buffer, size_t size)
> >  {
> > -   char fullname[strlen(handler->prefix) + strlen(name) + 1];
> > +   char *fullname;
> > struct ll_sb_info *sbi = ll_i2sbi(inode);
> >  #ifdef CONFIG_FS_POSIX_ACL
> > struct ll_inode_info *lli = ll_i2info(inode);
> > @@ -411,9 +414,13 @@ static int ll_xattr_get_common(const struct 
> > xattr_handler *handler,
> > if (handler->flags == XATTR_ACL_DEFAULT_T && !S_ISDIR(inode->i_mode))
> > return -ENODATA;
> >  #endif
> > -   sprintf(fullname, "%s%s\n", handler->prefix, name);
> 
> Same here.
> 
> I'm a little surprised this hasn't been caugt by static analysis, I
> thought gcc/coverity/smatch/whatnot had gotten pretty good at computing
> the size of the output generated by a given format string with "known"
> arguments and comparing to the size of the output buffer. Though of
> course it does require the tool to be able to do symbolic manipulations,
> in this case realizing that
> 
> outsize == strlen(x)+strlen(y)+1+1 > bufsize == strlen(x)+strlen(y)+1

That kind of symbolic manipulation is crazy hard to do.

regards,
dan carpenter

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


[PATCH] staging: ccree: remove ccree staging copy

2018-03-08 Thread Gilad Ben-Yossef
Now when the ccree driver has been accepted into the cryptodev tree
we can remove the staging tree copy.

Please note that this commit may cause a merge conflict with the
cryptodev tree since we needed to disable the staging copy in order
to get the new copy to compile but the resolution is trivial.

Signed-off-by: Gilad Ben-Yossef 
---
 drivers/staging/Kconfig  |2 -
 drivers/staging/Makefile |1 -
 drivers/staging/ccree/Kconfig|   27 -
 drivers/staging/ccree/Makefile   |7 -
 drivers/staging/ccree/TODO   |   10 -
 drivers/staging/ccree/cc_aead.c  | 2704 --
 drivers/staging/ccree/cc_aead.h  |  109 --
 drivers/staging/ccree/cc_buffer_mgr.c| 1651 --
 drivers/staging/ccree/cc_buffer_mgr.h|   74 -
 drivers/staging/ccree/cc_cipher.c| 1165 -
 drivers/staging/ccree/cc_cipher.h|   74 -
 drivers/staging/ccree/cc_crypto_ctx.h|  170 --
 drivers/staging/ccree/cc_debugfs.c   |  101 --
 drivers/staging/ccree/cc_debugfs.h   |   32 -
 drivers/staging/ccree/cc_driver.c|  474 --
 drivers/staging/ccree/cc_driver.h|  194 ---
 drivers/staging/ccree/cc_fips.c  |  111 --
 drivers/staging/ccree/cc_fips.h  |   37 -
 drivers/staging/ccree/cc_hash.c  | 2296 -
 drivers/staging/ccree/cc_hash.h  |  114 --
 drivers/staging/ccree/cc_host_regs.h |  142 --
 drivers/staging/ccree/cc_hw_queue_defs.h |  590 ---
 drivers/staging/ccree/cc_ivgen.c |  280 
 drivers/staging/ccree/cc_ivgen.h |   55 -
 drivers/staging/ccree/cc_kernel_regs.h   |  167 --
 drivers/staging/ccree/cc_lli_defs.h  |   59 -
 drivers/staging/ccree/cc_pm.c|  122 --
 drivers/staging/ccree/cc_pm.h|   57 -
 drivers/staging/ccree/cc_request_mgr.c   |  713 
 drivers/staging/ccree/cc_request_mgr.h   |   51 -
 drivers/staging/ccree/cc_sram_mgr.c  |  107 --
 drivers/staging/ccree/cc_sram_mgr.h  |   65 -
 32 files changed, 11761 deletions(-)
 delete mode 100644 drivers/staging/ccree/Kconfig
 delete mode 100644 drivers/staging/ccree/Makefile
 delete mode 100644 drivers/staging/ccree/TODO
 delete mode 100644 drivers/staging/ccree/cc_aead.c
 delete mode 100644 drivers/staging/ccree/cc_aead.h
 delete mode 100644 drivers/staging/ccree/cc_buffer_mgr.c
 delete mode 100644 drivers/staging/ccree/cc_buffer_mgr.h
 delete mode 100644 drivers/staging/ccree/cc_cipher.c
 delete mode 100644 drivers/staging/ccree/cc_cipher.h
 delete mode 100644 drivers/staging/ccree/cc_crypto_ctx.h
 delete mode 100644 drivers/staging/ccree/cc_debugfs.c
 delete mode 100644 drivers/staging/ccree/cc_debugfs.h
 delete mode 100644 drivers/staging/ccree/cc_driver.c
 delete mode 100644 drivers/staging/ccree/cc_driver.h
 delete mode 100644 drivers/staging/ccree/cc_fips.c
 delete mode 100644 drivers/staging/ccree/cc_fips.h
 delete mode 100644 drivers/staging/ccree/cc_hash.c
 delete mode 100644 drivers/staging/ccree/cc_hash.h
 delete mode 100644 drivers/staging/ccree/cc_host_regs.h
 delete mode 100644 drivers/staging/ccree/cc_hw_queue_defs.h
 delete mode 100644 drivers/staging/ccree/cc_ivgen.c
 delete mode 100644 drivers/staging/ccree/cc_ivgen.h
 delete mode 100644 drivers/staging/ccree/cc_kernel_regs.h
 delete mode 100644 drivers/staging/ccree/cc_lli_defs.h
 delete mode 100644 drivers/staging/ccree/cc_pm.c
 delete mode 100644 drivers/staging/ccree/cc_pm.h
 delete mode 100644 drivers/staging/ccree/cc_request_mgr.c
 delete mode 100644 drivers/staging/ccree/cc_request_mgr.h
 delete mode 100644 drivers/staging/ccree/cc_sram_mgr.c
 delete mode 100644 drivers/staging/ccree/cc_sram_mgr.h

diff --git a/drivers/staging/Kconfig b/drivers/staging/Kconfig
index e95ab68..7802c26 100644
--- a/drivers/staging/Kconfig
+++ b/drivers/staging/Kconfig
@@ -114,8 +114,6 @@ source "drivers/staging/greybus/Kconfig"
 
 source "drivers/staging/vc04_services/Kconfig"
 
-source "drivers/staging/ccree/Kconfig"
-
 source "drivers/staging/typec/Kconfig"
 
 source "drivers/staging/vboxvideo/Kconfig"
diff --git a/drivers/staging/Makefile b/drivers/staging/Makefile
index af8cd6a..56afa21 100644
--- a/drivers/staging/Makefile
+++ b/drivers/staging/Makefile
@@ -49,6 +49,5 @@ obj-$(CONFIG_MOST)+= most/
 obj-$(CONFIG_KS7010)   += ks7010/
 obj-$(CONFIG_GREYBUS)  += greybus/
 obj-$(CONFIG_BCM2835_VCHIQ)+= vc04_services/
-obj-$(CONFIG_CRYPTO_DEV_CCREE) += ccree/
 obj-$(CONFIG_DRM_VBOXVIDEO)+= vboxvideo/
 obj-$(CONFIG_PI433)+= pi433/
diff --git a/drivers/staging/ccree/Kconfig b/drivers/staging/ccree/Kconfig
deleted file mode 100644
index c94dfe8..000
diff --git a/drivers/staging/ccree/Makefile b/drivers/staging/ccree/Makefile
deleted file mode 100644
index bdc2797..000
diff --git a/drivers/staging/ccree/TODO b/drivers/staging/ccree/TODO
deleted file mode 100644
index