re

2023-07-22 Thread Veronica Lee
שלום יקירי, אני פונה אליך למידע שברצוני לחלוק איתך אל תהסס להשיב לפרטים
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


re

2023-07-11 Thread Veronica Lee
שלום יקירתי שמחה להגיע אליך שוב יש לי מייל בעבר ללא תגובה אני מזכיר
לגבי חוזה שאני רוצה לשתף אותך חזור אליי לפרטים נוספים אני מחכה
אנא
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


AN OFFER FOR LOAN IF YOU ARE INTERESTED

2022-02-23 Thread Hyung Lee
-- 
Dear Sir/ Ma

I have a client with Assets in excess of $20B.

He is ready to provide up to $2B plus or minus for project funding on loan
basis to any interested Party whose project must not be sited in prohibited
Countries and prohibited businesses. Only willing and able to provide the
facility for anyone on a loan basis.

Interested parties will be provided with the details upon a favorable
response.

Please contact me for further details.

N.B We do not sponsor projects or enter into partnership, we only fund
projects solemnly through loan system operatives. Therefore contact me if
you need loan from us, we are capable of giving you a loan up to $500M for
your project.

With best regards,
Hyung Lee
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v3 1/1] staging: ion: Prevent incorrect reference counting behavour

2021-11-26 Thread Lee Jones
Supply additional checks in order to prevent unexpected results.

Fixes: b892bf75b2034 ("ion: Switch ion to use dma-buf")
Suggested-by: Dan Carpenter 
Signed-off-by: Lee Jones 
---
Destined for v4.4.y and v4.9.y

 drivers/staging/android/ion/ion.c | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/drivers/staging/android/ion/ion.c 
b/drivers/staging/android/ion/ion.c
index 806e9b30b9dc8..aac9b38b8c25c 100644
--- a/drivers/staging/android/ion/ion.c
+++ b/drivers/staging/android/ion/ion.c
@@ -489,6 +489,9 @@ static void *ion_buffer_kmap_get(struct ion_buffer *buffer)
void *vaddr;
 
if (buffer->kmap_cnt) {
+   if (buffer->kmap_cnt == INT_MAX)
+   return ERR_PTR(-EOVERFLOW);
+
buffer->kmap_cnt++;
return buffer->vaddr;
}
@@ -509,6 +512,9 @@ static void *ion_handle_kmap_get(struct ion_handle *handle)
void *vaddr;
 
if (handle->kmap_cnt) {
+   if (handle->kmap_cnt == INT_MAX)
+   return ERR_PTR(-EOVERFLOW);
+
handle->kmap_cnt++;
return buffer->vaddr;
}
-- 
2.34.0.rc2.393.gf8c9666880-goog

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


Re: [PATCH 1/1] staging: ion: Prevent incorrect reference counting behavour

2021-11-26 Thread Lee Jones
On Fri, 26 Nov 2021, Greg KH wrote:

> On Fri, Nov 26, 2021 at 08:56:27AM +0000, Lee Jones wrote:
> > On Fri, 26 Nov 2021, Dan Carpenter wrote:
> > 
> > > On Thu, Nov 25, 2021 at 06:18:22PM +0300, Dan Carpenter wrote:
> > > > I had thought that ->kmap_cnt was a regular int and not an unsigned
> > > > int, but I would have to pull a stable tree to see where I misread the
> > > > code.
> > > 
> > > I was looking at (struct ion_buffer)->kmap_cnt but this is
> > > (struct ion_handle)->kmap_cnt.  I'm not sure how those are related but
> > > it makes me nervous that one can go higher than the other.  Also both
> > > probably need overflow protection.
> > > 
> > > So I guess I would just do something like:
> > > 
> > > diff --git a/drivers/staging/android/ion/ion.c 
> > > b/drivers/staging/android/ion/ion.c
> > > index 806e9b30b9dc8..e8846279b33b5 100644
> > > --- a/drivers/staging/android/ion/ion.c
> > > +++ b/drivers/staging/android/ion/ion.c
> > > @@ -489,6 +489,8 @@ static void *ion_buffer_kmap_get(struct ion_buffer 
> > > *buffer)
> > >   void *vaddr;
> > >  
> > >   if (buffer->kmap_cnt) {
> > > + if (buffer->kmap_cnt == INT_MAX)
> > > + return ERR_PTR(-EOVERFLOW);
> > >   buffer->kmap_cnt++;
> > >   return buffer->vaddr;
> > >   }
> > > @@ -509,6 +511,8 @@ static void *ion_handle_kmap_get(struct ion_handle 
> > > *handle)
> > >   void *vaddr;
> > >  
> > >   if (handle->kmap_cnt) {
> > > + if (handle->kmap_cnt == INT_MAX)
> > > + return ERR_PTR(-EOVERFLOW);
> > >   handle->kmap_cnt++;
> > >   return buffer->vaddr;
> > >   }
> > 
> > Which is all well and good until somebody changes the type.
> 
> That's hard to do on code that is removed from the kernel tree :)

That's a difficult stance to take when reviewing a patch which changes
the very code you base your argument on. :D

I'll do with Dan's PoV though - no sympathy given. :)

v3 to follow.

-- 
Lee Jones [李琼斯]
Senior Technical Lead - Developer Services
Linaro.org │ Open source software for Arm SoCs
Follow Linaro: Facebook | Twitter | Blog
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 1/1] staging: ion: Prevent incorrect reference counting behavour

2021-11-26 Thread Lee Jones
On Fri, 26 Nov 2021, Dan Carpenter wrote:

> On Thu, Nov 25, 2021 at 06:18:22PM +0300, Dan Carpenter wrote:
> > I had thought that ->kmap_cnt was a regular int and not an unsigned
> > int, but I would have to pull a stable tree to see where I misread the
> > code.
> 
> I was looking at (struct ion_buffer)->kmap_cnt but this is
> (struct ion_handle)->kmap_cnt.  I'm not sure how those are related but
> it makes me nervous that one can go higher than the other.  Also both
> probably need overflow protection.
> 
> So I guess I would just do something like:
> 
> diff --git a/drivers/staging/android/ion/ion.c 
> b/drivers/staging/android/ion/ion.c
> index 806e9b30b9dc8..e8846279b33b5 100644
> --- a/drivers/staging/android/ion/ion.c
> +++ b/drivers/staging/android/ion/ion.c
> @@ -489,6 +489,8 @@ static void *ion_buffer_kmap_get(struct ion_buffer 
> *buffer)
>   void *vaddr;
>  
>   if (buffer->kmap_cnt) {
> + if (buffer->kmap_cnt == INT_MAX)
> + return ERR_PTR(-EOVERFLOW);
>   buffer->kmap_cnt++;
>   return buffer->vaddr;
>   }
> @@ -509,6 +511,8 @@ static void *ion_handle_kmap_get(struct ion_handle 
> *handle)
>   void *vaddr;
>  
>   if (handle->kmap_cnt) {
> + if (handle->kmap_cnt == INT_MAX)
> + return ERR_PTR(-EOVERFLOW);
>   handle->kmap_cnt++;
>   return buffer->vaddr;
>   }

Which is all well and good until somebody changes the type.

-- 
Lee Jones [李琼斯]
Senior Technical Lead - Developer Services
Linaro.org │ Open source software for Arm SoCs
Follow Linaro: Facebook | Twitter | Blog
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 1/1] staging: ion: Prevent incorrect reference counting behavour

2021-11-25 Thread Lee Jones
On Thu, 25 Nov 2021, Dan Carpenter wrote:

> On Thu, Nov 25, 2021 at 03:07:37PM +0000, Lee Jones wrote:
> > On Thu, 25 Nov 2021, Dan Carpenter wrote:
> > 
> > > On Thu, Nov 25, 2021 at 02:20:04PM +, Lee Jones wrote:
> > > > Supply additional checks in order to prevent unexpected results.
> > > > 
> > > > Fixes: b892bf75b2034 ("ion: Switch ion to use dma-buf")
> > > > Signed-off-by: Lee Jones 
> > > > ---
> > > > Should be back-ported from v4.9 and earlier.
> > > > 
> > > >  drivers/staging/android/ion/ion.c | 5 +
> > > >  1 file changed, 5 insertions(+)
> > > > 
> > > > diff --git a/drivers/staging/android/ion/ion.c 
> > > > b/drivers/staging/android/ion/ion.c
> > > > index 806e9b30b9dc8..402b74f5d7e69 100644
> > > > --- a/drivers/staging/android/ion/ion.c
> > > > +++ b/drivers/staging/android/ion/ion.c
> > > > @@ -29,6 +29,7 @@
> > > >  #include 
> > > >  #include 
> > > >  #include 
> > > > +#include 
> > > >  #include 
> > > >  #include 
> > > >  #include 
> > > > @@ -509,6 +510,10 @@ static void *ion_handle_kmap_get(struct ion_handle 
> > > > *handle)
> > > > void *vaddr;
> > > >  
> > > > if (handle->kmap_cnt) {
> > > > +   if (check_add_overflow(handle->kmap_cnt,
> > > > +  (unsigned int) 1, 
> > > > >kmap_cnt))
> > >  ^
> > > 
> > > > +   return ERR_PTR(-EOVERFLOW);
> > > > +
> > > > handle->kmap_cnt++;
> > > ^^^
> > > This will not do what you want at all.  It's a double increment on the
> > > success path and it leave handle->kmap_cnt overflowed on failure path.
> > 
> > I read the helper to take copies of the original variables.
> > 
> > #define __unsigned_add_overflow(a, b, d) ({ \
> > typeof(a) __a = (a);\
> > typeof(b) __b = (b);\
> > typeof(d) __d = (d);\
> > (void) (&__a == &__b);  \
> > (void) (&__a == __d);   \
> > *__d = __a + __b;   \
>   
> This assignment sets handle->kmap_cnt to the overflowed value.
> 
> > *__d < __a; \
> > })
> > 
> > Maybe I misread it.
> > 
> > So the original patch [0] was better?
> > 
> > [0] 
> > https://lore.kernel.org/stable/20211125120234.67987-1-lee.jo...@linaro.org/ 
> 
> The original at least worked.  :P
> 
> You're catching me right as I'm knocking off for the day so I'm not
> sure how to write this code.  I had thought that ->kmap_cnt was a
> regular int and not an unsigned int, but I would have to pull a stable
> tree to see where I misread the code.
> 
> I'll look at this tomorrow Nairobi time, but I expect by then you'll
> already have it all figured out.

There's no rush.  This has been broken for a long time.

-- 
Lee Jones [李琼斯]
Senior Technical Lead - Developer Services
Linaro.org │ Open source software for Arm SoCs
Follow Linaro: Facebook | Twitter | Blog
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 1/1] staging: ion: Prevent incorrect reference counting behavour

2021-11-25 Thread Lee Jones
On Thu, 25 Nov 2021, Lee Jones wrote:

> On Thu, 25 Nov 2021, Dan Carpenter wrote:
> 
> > On Thu, Nov 25, 2021 at 02:20:04PM +, Lee Jones wrote:
> > > Supply additional checks in order to prevent unexpected results.
> > > 
> > > Fixes: b892bf75b2034 ("ion: Switch ion to use dma-buf")
> > > Signed-off-by: Lee Jones 
> > > ---
> > > Should be back-ported from v4.9 and earlier.
> > > 
> > >  drivers/staging/android/ion/ion.c | 5 +
> > >  1 file changed, 5 insertions(+)
> > > 
> > > diff --git a/drivers/staging/android/ion/ion.c 
> > > b/drivers/staging/android/ion/ion.c
> > > index 806e9b30b9dc8..402b74f5d7e69 100644
> > > --- a/drivers/staging/android/ion/ion.c
> > > +++ b/drivers/staging/android/ion/ion.c
> > > @@ -29,6 +29,7 @@
> > >  #include 
> > >  #include 
> > >  #include 
> > > +#include 
> > >  #include 
> > >  #include 
> > >  #include 
> > > @@ -509,6 +510,10 @@ static void *ion_handle_kmap_get(struct ion_handle 
> > > *handle)
> > >   void *vaddr;
> > >  
> > >   if (handle->kmap_cnt) {
> > > + if (check_add_overflow(handle->kmap_cnt,
> > > +(unsigned int) 1, >kmap_cnt))
> >  ^
> > 
> > > + return ERR_PTR(-EOVERFLOW);
> > > +
> > >   handle->kmap_cnt++;
> > ^^^
> > This will not do what you want at all.  It's a double increment on the
> > success path and it leave handle->kmap_cnt overflowed on failure path.
> 
> I read the helper to take copies of the original variables.
> 
> #define __unsigned_add_overflow(a, b, d) ({ \
> typeof(a) __a = (a);\
> typeof(b) __b = (b);\
> typeof(d) __d = (d);\
> (void) (&__a == &__b);  \
> (void) (&__a == __d);   \
> *__d = __a + __b;   \
> *__d < __a; \
> })
> 
> Maybe I misread it.

I think I see now.

Copies are taken, but because 'd' is a pointer, dereferencing the copy
is just like dereferencing the original, thus the memory address
provided by 'd' is written to, updating the variable.

In this case, you're right, this is not what I was trying to achieve.

> So the original patch [0] was better?
> 
> [0] 
> https://lore.kernel.org/stable/20211125120234.67987-1-lee.jo...@linaro.org/

Greg, are you able to take the original patch for v4.4 and v4.9 please?

-- 
Lee Jones [李琼斯]
Senior Technical Lead - Developer Services
Linaro.org │ Open source software for Arm SoCs
Follow Linaro: Facebook | Twitter | Blog
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 1/1] staging: ion: Prevent incorrect reference counting behavour

2021-11-25 Thread Lee Jones
On Thu, 25 Nov 2021, Dan Carpenter wrote:

> On Thu, Nov 25, 2021 at 02:20:04PM +0000, Lee Jones wrote:
> > Supply additional checks in order to prevent unexpected results.
> > 
> > Fixes: b892bf75b2034 ("ion: Switch ion to use dma-buf")
> > Signed-off-by: Lee Jones 
> > ---
> > Should be back-ported from v4.9 and earlier.
> > 
> >  drivers/staging/android/ion/ion.c | 5 +
> >  1 file changed, 5 insertions(+)
> > 
> > diff --git a/drivers/staging/android/ion/ion.c 
> > b/drivers/staging/android/ion/ion.c
> > index 806e9b30b9dc8..402b74f5d7e69 100644
> > --- a/drivers/staging/android/ion/ion.c
> > +++ b/drivers/staging/android/ion/ion.c
> > @@ -29,6 +29,7 @@
> >  #include 
> >  #include 
> >  #include 
> > +#include 
> >  #include 
> >  #include 
> >  #include 
> > @@ -509,6 +510,10 @@ static void *ion_handle_kmap_get(struct ion_handle 
> > *handle)
> > void *vaddr;
> >  
> > if (handle->kmap_cnt) {
> > +   if (check_add_overflow(handle->kmap_cnt,
> > +  (unsigned int) 1, >kmap_cnt))
>  ^
> 
> > +   return ERR_PTR(-EOVERFLOW);
> > +
> > handle->kmap_cnt++;
> ^^^
> This will not do what you want at all.  It's a double increment on the
> success path and it leave handle->kmap_cnt overflowed on failure path.

I read the helper to take copies of the original variables.

#define __unsigned_add_overflow(a, b, d) ({ \
typeof(a) __a = (a);\
typeof(b) __b = (b);\
typeof(d) __d = (d);\
(void) (&__a == &__b);  \
(void) (&__a == __d);   \
*__d = __a + __b;   \
*__d < __a; \
})

Maybe I misread it.

So the original patch [0] was better?

[0] https://lore.kernel.org/stable/20211125120234.67987-1-lee.jo...@linaro.org/

-- 
Lee Jones [李琼斯]
Senior Technical Lead - Developer Services
Linaro.org │ Open source software for Arm SoCs
Follow Linaro: Facebook | Twitter | Blog
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 1/1] staging: ion: Prevent incorrect reference counting behavour

2021-11-25 Thread Lee Jones
Supply additional checks in order to prevent unexpected results.

Fixes: b892bf75b2034 ("ion: Switch ion to use dma-buf")
Signed-off-by: Lee Jones 
---
Should be back-ported from v4.9 and earlier.

 drivers/staging/android/ion/ion.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/drivers/staging/android/ion/ion.c 
b/drivers/staging/android/ion/ion.c
index 806e9b30b9dc8..402b74f5d7e69 100644
--- a/drivers/staging/android/ion/ion.c
+++ b/drivers/staging/android/ion/ion.c
@@ -29,6 +29,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -509,6 +510,10 @@ static void *ion_handle_kmap_get(struct ion_handle *handle)
void *vaddr;
 
if (handle->kmap_cnt) {
+   if (check_add_overflow(handle->kmap_cnt,
+  (unsigned int) 1, >kmap_cnt))
+   return ERR_PTR(-EOVERFLOW);
+
handle->kmap_cnt++;
return buffer->vaddr;
}
-- 
2.34.0.rc2.393.gf8c9666880-goog

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


Re: [PATCH 1/1] staging: ion: Prevent incorrect reference counting behavour

2021-11-25 Thread Lee Jones
On Thu, 25 Nov 2021, Greg KH wrote:

> On Thu, Nov 25, 2021 at 01:03:46PM +0000, Lee Jones wrote:
> > On Thu, 25 Nov 2021, Greg KH wrote:
> > 
> > > On Thu, Nov 25, 2021 at 12:46:23PM +, Lee Jones wrote:
> > > > On Thu, 25 Nov 2021, Greg KH wrote:
> > > > 
> > > > > On Thu, Nov 25, 2021 at 12:02:34PM +, Lee Jones wrote:
> > > > > > Supply additional checks in order to prevent unexpected results.
> > > > > > 
> > > > > > Fixes: b892bf75b2034 ("ion: Switch ion to use dma-buf")
> > > > > > Signed-off-by: Lee Jones 
> > > > > > ---
> > > > > >  drivers/staging/android/ion/ion.c | 3 +++
> > > > > >  1 file changed, 3 insertions(+)
> > > > > > 
> > > > > > diff --git a/drivers/staging/android/ion/ion.c 
> > > > > > b/drivers/staging/android/ion/ion.c
> > > > > > index 806e9b30b9dc8..30f359faba575 100644
> > > > > > --- a/drivers/staging/android/ion/ion.c
> > > > > > +++ b/drivers/staging/android/ion/ion.c
> > > > > > @@ -509,6 +509,9 @@ static void *ion_handle_kmap_get(struct 
> > > > > > ion_handle *handle)
> > > > > > void *vaddr;
> > > > > >  
> > > > > > if (handle->kmap_cnt) {
> > > > > > +   if (handle->kmap_cnt + 1 < handle->kmap_cnt)
> > > > > 
> > > > > What about using the nice helpers in overflow.h for this?
> > > > 
> > > > I haven't heard of these before.
> > > > 
> > > > Looks like they're not widely used.
> > > > 
> > > > I'll try them out and see how they go.
> > > > 
> > > > > > +   return ERR_PTR(-EOVERFLOW);
> > > > > > +
> > > > > > handle->kmap_cnt++;
> > > > > > return buffer->vaddr;
> > > > > > }
> > > > > 
> > > > > What stable kernel branch(es) is this for?
> > > > 
> > > > I assumed your magic scripts could determine this from the Fixes:
> > > > tag.  I'll be more explicit in v2.
> > > 
> > > The fixes tag says how far back for it to go, but not where to start
> > > that process from :)
> > 
> > What's your preferred method for identifying a start-point?
> > 
> > In the [PATCH] tag or appended on to Cc: stable ... # ?
> > 
> > I know both work, but what makes your life easier?
> 
> Easiest is below the --- line say:
> ---
>  This is for kernel versions X.X and older.

Understood, thanks.

-- 
Lee Jones [李琼斯]
Senior Technical Lead - Developer Services
Linaro.org │ Open source software for Arm SoCs
Follow Linaro: Facebook | Twitter | Blog
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 1/1] staging: ion: Prevent incorrect reference counting behavour

2021-11-25 Thread Lee Jones
On Thu, 25 Nov 2021, Greg KH wrote:

> On Thu, Nov 25, 2021 at 12:46:23PM +0000, Lee Jones wrote:
> > On Thu, 25 Nov 2021, Greg KH wrote:
> > 
> > > On Thu, Nov 25, 2021 at 12:02:34PM +, Lee Jones wrote:
> > > > Supply additional checks in order to prevent unexpected results.
> > > > 
> > > > Fixes: b892bf75b2034 ("ion: Switch ion to use dma-buf")
> > > > Signed-off-by: Lee Jones 
> > > > ---
> > > >  drivers/staging/android/ion/ion.c | 3 +++
> > > >  1 file changed, 3 insertions(+)
> > > > 
> > > > diff --git a/drivers/staging/android/ion/ion.c 
> > > > b/drivers/staging/android/ion/ion.c
> > > > index 806e9b30b9dc8..30f359faba575 100644
> > > > --- a/drivers/staging/android/ion/ion.c
> > > > +++ b/drivers/staging/android/ion/ion.c
> > > > @@ -509,6 +509,9 @@ static void *ion_handle_kmap_get(struct ion_handle 
> > > > *handle)
> > > > void *vaddr;
> > > >  
> > > > if (handle->kmap_cnt) {
> > > > +   if (handle->kmap_cnt + 1 < handle->kmap_cnt)
> > > 
> > > What about using the nice helpers in overflow.h for this?
> > 
> > I haven't heard of these before.
> > 
> > Looks like they're not widely used.
> > 
> > I'll try them out and see how they go.
> > 
> > > > +   return ERR_PTR(-EOVERFLOW);
> > > > +
> > > > handle->kmap_cnt++;
> > > > return buffer->vaddr;
> > > > }
> > > 
> > > What stable kernel branch(es) is this for?
> > 
> > I assumed your magic scripts could determine this from the Fixes:
> > tag.  I'll be more explicit in v2.
> 
> The fixes tag says how far back for it to go, but not where to start
> that process from :)

What's your preferred method for identifying a start-point?

In the [PATCH] tag or appended on to Cc: stable ... # ?

I know both work, but what makes your life easier?

-- 
Lee Jones [李琼斯]
Senior Technical Lead - Developer Services
Linaro.org │ Open source software for Arm SoCs
Follow Linaro: Facebook | Twitter | Blog
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 1/1] staging: ion: Prevent incorrect reference counting behavour

2021-11-25 Thread Lee Jones
On Thu, 25 Nov 2021, Greg KH wrote:

> On Thu, Nov 25, 2021 at 12:02:34PM +0000, Lee Jones wrote:
> > Supply additional checks in order to prevent unexpected results.
> > 
> > Fixes: b892bf75b2034 ("ion: Switch ion to use dma-buf")
> > Signed-off-by: Lee Jones 
> > ---
> >  drivers/staging/android/ion/ion.c | 3 +++
> >  1 file changed, 3 insertions(+)
> > 
> > diff --git a/drivers/staging/android/ion/ion.c 
> > b/drivers/staging/android/ion/ion.c
> > index 806e9b30b9dc8..30f359faba575 100644
> > --- a/drivers/staging/android/ion/ion.c
> > +++ b/drivers/staging/android/ion/ion.c
> > @@ -509,6 +509,9 @@ static void *ion_handle_kmap_get(struct ion_handle 
> > *handle)
> > void *vaddr;
> >  
> > if (handle->kmap_cnt) {
> > +   if (handle->kmap_cnt + 1 < handle->kmap_cnt)
> 
> What about using the nice helpers in overflow.h for this?

I haven't heard of these before.

Looks like they're not widely used.

I'll try them out and see how they go.

> > +   return ERR_PTR(-EOVERFLOW);
> > +
> > handle->kmap_cnt++;
> > return buffer->vaddr;
> > }
> 
> What stable kernel branch(es) is this for?

I assumed your magic scripts could determine this from the Fixes:
tag.  I'll be more explicit in v2.

-- 
Lee Jones [李琼斯]
Senior Technical Lead - Developer Services
Linaro.org │ Open source software for Arm SoCs
Follow Linaro: Facebook | Twitter | Blog
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 1/1] staging: ion: Prevent incorrect reference counting behavour

2021-11-25 Thread Lee Jones
Supply additional checks in order to prevent unexpected results.

Fixes: b892bf75b2034 ("ion: Switch ion to use dma-buf")
Signed-off-by: Lee Jones 
---
 drivers/staging/android/ion/ion.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/staging/android/ion/ion.c 
b/drivers/staging/android/ion/ion.c
index 806e9b30b9dc8..30f359faba575 100644
--- a/drivers/staging/android/ion/ion.c
+++ b/drivers/staging/android/ion/ion.c
@@ -509,6 +509,9 @@ static void *ion_handle_kmap_get(struct ion_handle *handle)
void *vaddr;
 
if (handle->kmap_cnt) {
+   if (handle->kmap_cnt + 1 < handle->kmap_cnt)
+   return ERR_PTR(-EOVERFLOW);
+
handle->kmap_cnt++;
return buffer->vaddr;
}
-- 
2.34.0.rc2.393.gf8c9666880-goog

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


Re: [PATCH v7 01/13] dt-bindings: mfd: Add 'nxp,imx8mq-vpu-ctrl' to syscon list

2021-03-29 Thread Lee Jones
On Mon, 29 Mar 2021, Benjamin Gaignard wrote:

> Add 'nxp,imx8mq-vpu-ctrl' in the list of possible syscon.
> It will used to access to the VPU control registers.
> 
> Signed-off-by: Benjamin Gaignard 
> Acked-by: Rob Herring 
> ---
> version 7:
>  - Add Rob ack
>  Documentation/devicetree/bindings/mfd/syscon.yaml | 1 +
>  1 file changed, 1 insertion(+)

Acked-by: Lee Jones 

-- 
Lee Jones [李琼斯]
Senior Technical Lead - Developer Services
Linaro.org │ Open source software for Arm SoCs
Follow Linaro: Facebook | Twitter | Blog
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] staging: rtl8192e: Fix possible buffer overflow in _rtl92e_wx_set_scan

2021-03-05 Thread Lee


Hi Dan,

Do you think any of these could be potential issues:

driver/staging/

rtl8192e/rtllib_rx.c:2442
wlan-ng/cfg80211.c:316
rtl8723bs/os_dep/ioctl_cfg80211.c:1591
rtl8723bs/os_dep/ioctl_cfg80211.c:2738

and if so, findable via Smatch?

Regards,
Lee


On Fri, Mar 05, 2021 at 11:22:28AM +0300, Dan Carpenter wrote:
> Actually, I looked through a bunch of these and they're mostly false
> positives outside of staging.  I guess there are a few ways the ->ssid
> can be changed.  Via netlink, from the network or from the an ioctl.
> 
> I still have a couple questions, but so far as I can see it's mostly the
> ioctl which has problems.
> 
> I really want Smatch to be able to figure the netlink stuff...  That
> should be doable.
> 
> regards,
> dan carpenter
> 
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] staging: rtl8192e: Fix possible buffer overflow in _rtl92e_wx_set_scan

2021-03-01 Thread Lee




> This check worked out pretty well.  It's probably 50% bugs?  Unfiltered
> results below.  The trick of warning for "if (ststr(member, "->ssid")) "
> and the memcpy length couldn't be verified turned out to be the best.

That list looks great. I checked out 2 of those listed at random and 
they look like valid bugs to me.

> But there are quite a few real bugs as well.  If anyone wants to fix any
> of these just claim a bug, and I won't send a patch for that warning.
> :)  Lee, I think you mentioned that you had found a related buffer
> overflow fix?  Did the check find it?


I think I found 2 in these files:

drivers/staging/rtl8712/rtl871x_cmd.c    
drivers/staging/wfx/hif_tx.c

Regards,
Lee

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


[PATCH] staging: rtl8712: Fix possible buffer overflow in r8712_sitesurvey_cmd

2021-03-01 Thread Lee Gibson
Function r8712_sitesurvey_cmd calls memcpy without checking the length.
A user could control that length and trigger a buffer overflow.
Fix by checking the length is within the maximum allowed size.

Signed-off-by: Lee Gibson 
---
 drivers/staging/rtl8712/rtl871x_cmd.c | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/rtl8712/rtl871x_cmd.c 
b/drivers/staging/rtl8712/rtl871x_cmd.c
index 18116469bd31..75716f59044d 100644
--- a/drivers/staging/rtl8712/rtl871x_cmd.c
+++ b/drivers/staging/rtl8712/rtl871x_cmd.c
@@ -192,8 +192,10 @@ u8 r8712_sitesurvey_cmd(struct _adapter *padapter,
psurveyPara->ss_ssidlen = 0;
memset(psurveyPara->ss_ssid, 0, IW_ESSID_MAX_SIZE + 1);
if (pssid && pssid->SsidLength) {
-   memcpy(psurveyPara->ss_ssid, pssid->Ssid, pssid->SsidLength);
-   psurveyPara->ss_ssidlen = cpu_to_le32(pssid->SsidLength);
+   int len = min_t(int, pssid->SsidLength, IW_ESSID_MAX_SIZE);
+
+   memcpy(psurveyPara->ss_ssid, pssid->Ssid, len);
+   psurveyPara->ss_ssidlen = cpu_to_le32(len);
}
set_fwstate(pmlmepriv, _FW_UNDER_SURVEY);
r8712_enqueue_cmd(pcmdpriv, ph2c);
-- 
2.25.1

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


[PATCH v3] staging: rtl8192e: Fix possible buffer overflow in _rtl92e_wx_set_scan

2021-02-26 Thread Lee Gibson
Function _rtl92e_wx_set_scan calls memcpy without checking the length.
A user could control that length and trigger a buffer overflow.
Fix by checking the length is within the maximum allowed size.

Reviewed-by: Dan Carpenter 
Signed-off-by: Lee Gibson 
---
 drivers/staging/rtl8192e/rtl8192e/rtl_wx.c | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c 
b/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c
index 16bcee13f64b..407effde5e71 100644
--- a/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c
+++ b/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c
@@ -406,9 +406,10 @@ static int _rtl92e_wx_set_scan(struct net_device *dev,
struct iw_scan_req *req = (struct iw_scan_req *)b;
 
if (req->essid_len) {
-   ieee->current_network.ssid_len = req->essid_len;
-   memcpy(ieee->current_network.ssid, req->essid,
-  req->essid_len);
+   int len = min_t(int, req->essid_len, IW_ESSID_MAX_SIZE);
+
+   ieee->current_network.ssid_len = len;
+   memcpy(ieee->current_network.ssid, req->essid, len);
}
}
 
-- 
2.25.1

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


[PATCH v2] staging: rtl8192e: Fix possible buffer overflow in _rtl92e_wx_set_scan

2021-02-26 Thread Lee Gibson
Function _rtl92e_wx_set_scan calls memcpy without checking the length.
A user could control that length and trigger a buffer overflow.
Fix by checking the length is within the maximum allowed size.

Changes in v2: 
Changed to use min_t as per useful suggestions

Signed-off-by: Lee Gibson 
---
 drivers/staging/rtl8192e/rtl8192e/rtl_wx.c | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c 
b/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c
index 16bcee13f64b..407effde5e71 100644
--- a/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c
+++ b/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c
@@ -406,9 +406,10 @@ static int _rtl92e_wx_set_scan(struct net_device *dev,
struct iw_scan_req *req = (struct iw_scan_req *)b;
 
if (req->essid_len) {
-   ieee->current_network.ssid_len = req->essid_len;
-   memcpy(ieee->current_network.ssid, req->essid,
-  req->essid_len);
+   int len = min_t(int, req->essid_len, IW_ESSID_MAX_SIZE);
+
+   ieee->current_network.ssid_len = len;
+   memcpy(ieee->current_network.ssid, req->essid, len);
}
}
 
-- 
2.25.1

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


[PATCH] staging: rtl8192e: Fix possible buffer overflow in _rtl92e_wx_set_scan

2021-02-26 Thread Lee Gibson
Function _rtl92e_wx_set_scan calls memcpy without checking the length.
A user could control that length and trigger a buffer overflow.
Fix by checking the length is within the maximum allowed size.

Signed-off-by: Lee Gibson 
---
 drivers/staging/rtl8192e/rtl8192e/rtl_wx.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c 
b/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c
index 16bcee13f64b..2acc4f314732 100644
--- a/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c
+++ b/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c
@@ -406,6 +406,9 @@ static int _rtl92e_wx_set_scan(struct net_device *dev,
struct iw_scan_req *req = (struct iw_scan_req *)b;
 
if (req->essid_len) {
+   if (req->essid_len > IW_ESSID_MAX_SIZE)
+   req->essid_len = IW_ESSID_MAX_SIZE;
+
ieee->current_network.ssid_len = req->essid_len;
memcpy(ieee->current_network.ssid, req->essid,
   req->essid_len);
-- 
2.25.1

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


[PATCH] staging: fwserial: minor coding style fix

2021-02-26 Thread Lee Gibson
Fixes this checkpatch warning
WARNING: Integer promotion: Using 'h' in '%04hx' is unnecessary

Signed-off-by: Lee Gibson 
---
 drivers/staging/fwserial/fwserial.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/fwserial/fwserial.c 
b/drivers/staging/fwserial/fwserial.c
index c368082aae1a..a020f533c982 100644
--- a/drivers/staging/fwserial/fwserial.c
+++ b/drivers/staging/fwserial/fwserial.c
@@ -2632,7 +2632,7 @@ static int fwserial_parse_mgmt_write(struct fwtty_peer 
*peer,
 
rcode = RCODE_COMPLETE;
 
-   fwtty_dbg(>unit, "mgmt: hdr.code: %04hx\n", pkt->hdr.code);
+   fwtty_dbg(>unit, "mgmt: hdr.code: %04x\n", pkt->hdr.code);
 
switch (be16_to_cpu(pkt->hdr.code) & FWSC_CODE_MASK) {
case FWSC_VIRT_CABLE_PLUG:
-- 
2.25.1

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


[PATCH] staging: rtl8192u: minor coding style fix

2021-02-25 Thread Lee Gibson
Fixes this checkpatch warning
WARNING: Comparisons should place the constant on the right side of the test

Signed-off-by: Lee Gibson 
---
 drivers/staging/rtl8192u/r8192U_wx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/rtl8192u/r8192U_wx.c 
b/drivers/staging/rtl8192u/r8192U_wx.c
index d853586705fc..175bb8b15389 100644
--- a/drivers/staging/rtl8192u/r8192U_wx.c
+++ b/drivers/staging/rtl8192u/r8192U_wx.c
@@ -726,7 +726,7 @@ static int r8192_wx_set_enc_ext(struct net_device *dev,
idx--;
group = ext->ext_flags & IW_ENCODE_EXT_GROUP_KEY;
 
-   if ((!group) || (IW_MODE_ADHOC == ieee->iw_mode) || (alg ==  
KEY_TYPE_WEP40)) {
+   if ((!group) || (ieee->iw_mode == IW_MODE_ADHOC) || (alg ==  
KEY_TYPE_WEP40)) {
if ((ext->key_len == 13) && (alg == KEY_TYPE_WEP40))
alg = KEY_TYPE_WEP104;
ieee->pairwise_key_type = alg;
-- 
2.25.1

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


[PATCH] staging: hikey9xx: Fix space tab style warnings

2021-02-19 Thread Lee Gibson
This patch fixes the checkpatch warnings such as:

hi6421-spmi-pmic.c:51: WARNING: please, no space before tabs

Signed-off-by: Lee Gibson 
---
 drivers/staging/hikey9xx/hi6421-spmi-pmic.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/hikey9xx/hi6421-spmi-pmic.c 
b/drivers/staging/hikey9xx/hi6421-spmi-pmic.c
index 4ebcfea9f3bf..626140cb96f2 100644
--- a/drivers/staging/hikey9xx/hi6421-spmi-pmic.c
+++ b/drivers/staging/hikey9xx/hi6421-spmi-pmic.c
@@ -48,9 +48,9 @@ enum hi6421_spmi_pmic_irq_list {
 /*
  * The IRQs are mapped as:
  *
- * ==  =   =
- * IRQ MASK REGISTER   IRQ REGISTERBIT
- * ==  =   =
+ * ==  =   =
+ * IRQ MASK REGISTER   IRQ REGISTERBIT
+ * ==  =   =
  * OTMP0x0202  0x212   bit 0
  * VBUS_CONNECT0x0202  0x212   bit 1
  * VBUS_DISCONNECT 0x0202  0x212   bit 2
@@ -66,7 +66,7 @@ enum hi6421_spmi_pmic_irq_list {
  * SIM0_HPD_F  0x0203  0x213   bit 3
  * SIM1_HPD_R  0x0203  0x213   bit 4
  * SIM1_HPD_F  0x0203  0x213   bit 5
- * ==  =   =
+ * ==  =   =
  */
 #define SOC_PMIC_IRQ_MASK_0_ADDR   0x0202
 #define SOC_PMIC_IRQ0_ADDR 0x0212
-- 
2.25.1

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


Re: [PATCH v4 18/21] mfd: hi6421-spmi-pmic: move driver from staging

2021-01-29 Thread Lee Jones
On Fri, 29 Jan 2021, Mauro Carvalho Chehab wrote:

> Hi Lee,
> 
> Em Wed, 27 Jan 2021 11:05:37 +0000
> Lee Jones  escreveu:
> 
> > On Tue, 19 Jan 2021, Mauro Carvalho Chehab wrote:
> > 
> > > This driver is ready for mainstream. So, move it out of staging.
> > > 
> 
> > Replied to an earlier submission where I was able to reply in-line.
> 
> Sorry! Infradead seemed to have some problem between Jan 26-27: emails
> got late-delivered.

No problem.

> > > +static const struct mfd_cell hi6421v600_devs[] = {
> > > + { .name = "hi6421v600-regulator", },
> > > +};  
> > 
> > Where are the reset of the devices?
> 
> Not sure what you mean here. 
> 
> This MFD device provides:
> 
>   - an IRQ handler;
>   - several LDO lines used by a regulator driver.
> 
> The IRQ handler is properly initialized here, while the
> regulators are initialized by the regulator driver. The initial
> state of this device is set up by u-boot.
> 
> So, AFAIKT, there's no need to have any reset line
> attached here.

Oh wow!  Sorry about that.  It's a misspelling.

"Where are the *rest* of the devices?"

Registering one device does not qualify this as an MFD.

> Yet, I'm still figuring out how the PCIe chips at Hikey 970
> should be properly initialized. So, I may need to add something
> somewhere in order to properly reset and power up the Ethernet,
> M.2 and PCIe 1x slot.
> 
> Those are linked to the LDO 33.
> 
> > > +static void hi6421_spmi_irq_mask(struct irq_data *d)
> > > +{
> > > + struct hi6421_spmi_pmic *pmic = irq_data_get_irq_chip_data(d);
> > > + unsigned long flags;
> > > + unsigned int data;
> > > + u32 offset;
> > > +
> > > + offset = (irqd_to_hwirq(d) >> 3);  
> > 
> > Why 3? 
> 
> No idea. I don't have any datasheets from this device.
>
> > Probably better to define these shifts/masks rather than use
> > magic numbers with no comments.
> 
> I'll change the above to:
> 
>   #define HISI_IRQ_MASK   GENMASK(1, 0)
> 
>   offset = (irqd_to_hwirq(d) >> HISI_IRQ_MASK);

This is a shift surely?  Marks are usually &'ed.

> > > + regmap_read(pmic->map, offset, );
> > > + data |= (1 << (irqd_to_hwirq(d) & 0x07));  
> > 
> > What are you doing here?
> > 
> > Maybe improved defines will be enough.  If not, please supply a
> > suitable comment.
> 
> Again, no idea. The only documentation I had access to this chip is
> at:
> 
>   https://www.96boards.org/documentation/consumer/hikey/hikey970/
> 
> With doesn't mention any register details.
> 
> The driver itself came from the Linaro's 96boards git tree, with also
> doesn't contain any register mapping.

Well that's awkward.

I'm not keen on merging code that no one knows what it does.

Maybe I can do some digging.

> > > + pr_debug("PMU IRQ address value:irq[0x%x] = 0x%x\n",
> > > +  SOC_PMIC_IRQ0_ADDR + i, pending);  
> > 
> > Again, is this actually useful to anyone now that the driver is nearly
> > 10 years old.  Particularly anyone who can't add a quick printk()
> > during a debug session?
> 
> With regards to the debug stuff, I'm dropping everything.

Great.

> On a side comment, I doubt that the driver has 10 years old ;-)
> 
> See, Hikey 970 uses Kirin 970 SoC, which it was launched in Sept, 2017. 

The header has a copyright from 2011.

 // Copyright (c) 2013 Linaro Ltd.
 // Copyright (c) 2011 Hisilicon.

> The original version of this driver publicly debuted on this tree:
> 
>   
> https://github.com/96boards-hikey/linux/blob/hikey970-v4.9/drivers/mfd/hisi_pmic_spmi.c
> 
> On a commit made on Feb, 2018.
> 
> Ok, Hi6421v600 is a separate silicon, probably derivative from
> Hi6421 (used on Hikey 960). Its copyright mentions 2011, but 
> that's probably because the code itself came from older generations
> of the regulator chipset.

So we've inherited a copyright from another driver?

Sounds suspect.

> Please see the enclosed patch for the new code after fixing the issues
> you pointed. I'll re-submit it as a series once you're ok with the
> code.

Would you mind just resubmitting please?  We can go from there.

-- 
Lee Jones [李琼斯]
Senior Technical Lead - Developer Services
Linaro.org │ Open source software for Arm SoCs
Follow Linaro: Facebook | Twitter | Blog
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v6 5/7] mfd: hi6421-spmi-pmic: move driver from staging

2021-01-28 Thread Lee Jones
On Wed, 27 Jan 2021, Mauro Carvalho Chehab wrote:

> This driver is ready for mainstream. So, move it out of staging.
> 
> Signed-off-by: Mauro Carvalho Chehab 
> ---
>  .../mfd}/hisilicon,hi6421-spmi-pmic.yaml|  0
>  MAINTAINERS |  7 +++
>  drivers/mfd/Kconfig | 15 +++
>  drivers/mfd/Makefile|  1 +
>  .../hikey9xx => mfd}/hi6421-spmi-pmic.c |  0
>  drivers/staging/hikey9xx/Kconfig| 17 -
>  drivers/staging/hikey9xx/Makefile   |  1 -
>  7 files changed, 23 insertions(+), 18 deletions(-)
>  rename {drivers/staging/hikey9xx => 
> Documentation/devicetree/bindings/mfd}/hisilicon,hi6421-spmi-pmic.yaml (100%)
>  rename drivers/{staging/hikey9xx => mfd}/hi6421-spmi-pmic.c (100%)

I've already reviewed this:

  https://lore.kernel.org/driverdev-devel/20210127110537.GI4903@dell/

-- 
Lee Jones [李琼斯]
Senior Technical Lead - Developer Services
Linaro.org │ Open source software for Arm SoCs
Follow Linaro: Facebook | Twitter | Blog
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v5 19/21] mfd: hi6421-spmi-pmic: move driver from staging

2021-01-27 Thread Lee Jones
On Thu, 21 Jan 2021, Mauro Carvalho Chehab wrote:

> This driver is ready for mainstream. So, move it out of staging.
> 
> Signed-off-by: Mauro Carvalho Chehab 
> ---
>  .../mfd}/hisilicon,hi6421-spmi-pmic.yaml |  0
>  MAINTAINERS  |  7 +++
>  drivers/mfd/Kconfig  | 15 +++
>  drivers/mfd/Makefile |  1 +
>  .../{staging/hikey9xx => mfd}/hi6421-spmi-pmic.c |  0
>  drivers/staging/hikey9xx/Kconfig | 16 
>  drivers/staging/hikey9xx/Makefile|  1 -
>  7 files changed, 23 insertions(+), 17 deletions(-)
>  rename {drivers/staging/hikey9xx => 
> Documentation/devicetree/bindings/mfd}/hisilicon,hi6421-spmi-pmic.yaml (100%)
>  rename drivers/{staging/hikey9xx => mfd}/hi6421-spmi-pmic.c (100%)

Replied to an earlier submission where I was able to reply in-line.

-- 
Lee Jones [李琼斯]
Senior Technical Lead - Developer Services
Linaro.org │ Open source software for Arm SoCs
Follow Linaro: Facebook | Twitter | Blog
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v4 18/21] mfd: hi6421-spmi-pmic: move driver from staging

2021-01-27 Thread Lee Jones
one who can't add a quick printk()
during a debug session?

> + regmap_write(pmic->map, SOC_PMIC_IRQ0_ADDR + i,
> +  HISI_MASK_STATE);
> + }
> +}
> +
> +static const struct regmap_config spmi_regmap_config = {
> + .reg_bits   = 16,
> + .val_bits   = 8,
> + .max_register   = 0x,
> + .fast_io= true
> +};
> +
> +static int hi6421_spmi_pmic_probe(struct spmi_device *pdev)
> +{
> + struct device *dev = >dev;
> + struct device_node *np = dev->of_node;
> + struct hi6421_spmi_pmic *pmic;
> + struct regmap *map;
> + unsigned int virq;
> + int ret, i;
> +
> + pmic = devm_kzalloc(dev, sizeof(*pmic), GFP_KERNEL);

Nit: My personal preference for local driver data is 'ddata'.

> + if (!pmic)
> + return -ENOMEM;
> +
> + map = devm_regmap_init_spmi_ext(pdev, _regmap_config);

We talk about IRQ maps above.  'regmap' would be better here.

> + if (IS_ERR(map))
> + return PTR_ERR(map);
> +
> + spin_lock_init(>lock);
> +
> + pmic->dev = dev;
> + pmic->map = map;
> +
> + pmic->gpio = of_get_gpio(np, 0);

Why do you use local variable 'map' above and just assign the ddata
value directly here?  I think the latter would be better throughout.

> + if (pmic->gpio < 0)
> + return pmic->gpio;
> +
> + if (!gpio_is_valid(pmic->gpio))
> + return -EINVAL;
> +
> + ret = devm_gpio_request_one(dev, pmic->gpio, GPIOF_IN, "pmic");
> + if (ret < 0) {
> + dev_err(dev, "failed to request gpio%d\n", pmic->gpio);
> + return ret;
> + }
> +
> + pmic->irq = gpio_to_irq(pmic->gpio);
> +
> + hi6421_spmi_pmic_irq_prc(pmic);

What does prc mean?

> + pmic->irqs = devm_kzalloc(dev, HISI_IRQ_NUM * sizeof(int), GFP_KERNEL);
> + if (!pmic->irqs)
> + goto irq_malloc;

malloc?

> + pmic->domain = irq_domain_add_simple(np, HISI_IRQ_NUM, 0,
> +  _spmi_domain_ops, pmic);
> + if (!pmic->domain) {
> + dev_err(dev, "failed irq domain add simple!\n");

Too specific in my opinion.  No need to mention the call.

"Failed to create IRQ domain" would be better IMHO.

> + ret = -ENODEV;
> + goto irq_malloc;
> + }
> +
> + for (i = 0; i < HISI_IRQ_NUM; i++) {
> + virq = irq_create_mapping(pmic->domain, i);
> + if (!virq) {
> + dev_err(dev, "Failed mapping hwirq\n");

"Failed to map H/W IRQ"

> + ret = -ENOSPC;
> + goto irq_malloc;
> + }
> + pmic->irqs[i] = virq;
> + dev_dbg(dev, "%s: pmic->irqs[%d] = %d\n",
> + __func__, i, pmic->irqs[i]);

This is ugly.  Please remove it.

> + }
> +
> + ret = request_threaded_irq(pmic->irq, hi6421_spmi_irq_handler, NULL,
> +IRQF_TRIGGER_LOW | IRQF_SHARED | 
> IRQF_NO_SUSPEND,
> +"pmic", pmic);
> + if (ret < 0) {
> + dev_err(dev, "could not claim pmic IRQ: error %d\n", ret);

This is inconsistent with other prints.  Better to start with a
capital I think.  Also, it should be "PMIC", as it's an abbreviation.

> + goto irq_malloc;
> + }
> +
> + dev_set_drvdata(>dev, pmic);
> +
> + /*
> +  * The logic below will rely that the pmic is already stored at
> +  * drvdata.
> +  */

Which logic?

> + dev_dbg(>dev, "SPMI-PMIC: adding children for %pOF\n",
> + pdev->dev.of_node);

Please remove this.

> + ret = devm_mfd_add_devices(>dev, PLATFORM_DEVID_NONE,
> +hi6421v600_devs, ARRAY_SIZE(hi6421v600_devs),
> +NULL, 0, NULL);
> + if (!ret)
> + return 0;
> +
> + dev_err(dev, "Failed to add child devices: %d\n", ret);
> +
> +irq_malloc:
> + free_irq(pmic->irq, pmic);

Does gpio_to_irq() need freeing?

> + return ret;
> +}
> +
> +static void hi6421_spmi_pmic_remove(struct spmi_device *pdev)
> +{
> + struct hi6421_spmi_pmic *pmic = dev_get_drvdata(>dev);
> +
> + free_irq(pmic->irq, pmic);
> +}
> +
> +static const struct of_device_id pmic_spmi_id_table[] = {
> + { .compatible = "hisilicon,hi6421-spmi" },
> + { }
> +};
> +MODULE_DEVICE_TABLE(of, pmic_spmi_id_table);
> +
> +static struct spmi_driver hi6421_spmi_pmic_driver = {
> + .driver = {
> + .name   = "hi6421-spmi-pmic",

Odd spacing.  Just use one ' ' please.

> + .of_match_table = pmic_spmi_id_table,
> + },
> + .probe  = hi6421_spmi_pmic_probe,
> + .remove = hi6421_spmi_pmic_remove,
> +};
> +module_spmi_driver(hi6421_spmi_pmic_driver);
> +
> +MODULE_DESCRIPTION("HiSilicon Hi6421v600 SPMI PMIC driver");
> +MODULE_LICENSE("GPL v2");

-- 
Lee Jones [李琼斯]
Senior Technical Lead - Developer Services
Linaro.org │ Open source software for Arm SoCs
Follow Linaro: Facebook | Twitter | Blog
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v5 00/21] Move Hisilicon 6421v600 SPMI driver set out of staging

2021-01-27 Thread Lee Jones
On Wed, 27 Jan 2021, Greg Kroah-Hartman wrote:

> On Tue, Jan 26, 2021 at 06:11:24PM +, Mark Brown wrote:
> > On Tue, Jan 26, 2021 at 07:02:39PM +0100, Greg Kroah-Hartman wrote:
> > > On Tue, Jan 26, 2021 at 05:57:52PM +, Mark Brown wrote:
> > 
> > > > Is there a branch we can pull from?
> > 
> > > Once 0-day passes, you can pull from my staging-testing branch from
> > > staging.git on git.kernel.org if you want.  Give it 24 hours to pass
> > > before it hits that location.
> > 
> > Thanks.
> 
> Should be out there now if you want to pull.
> 
> > > Do you need a tag to pull from?
> > 
> > It'd be nice but not essential.
> 
> Why do you want/need this?  Having these changes in your tree is good,
> but what about other coding style cleanups that I will end up applying
> over time before the 5.12-rc1 merge window opens?  Are you wanting to
> take the moved driver in your tree, or something else?
> 
> Traditionally moving drivers out of staging can be done 2 ways:
>   - all happens in the staging tree, I take an ack from the
> subsystem maintainer that this is ok to do.
>   - A new driver enters the "real" subsystem tree, and then I
> delete the driver in the staging tree.  This doesn't preserve
> history as well (not at all), but can be easier for trees that
> move quickly (like networking.)
> 
> Which ever works for you is fine with me, but relying on the code to
> stay "not touched" in my tree after you pull it almost never happens due
> to the number of drive-by coding style cleanups that end up in the
> staging tree every week.

I would have expected the whole set to be merged as a set into a
single tree, placed on an immutable branch and a pull-request to be
sent out for the other maintainers to pull from (if they so wished).

This would ensure development could continue on any/all of the
affected drivers/files.

If it's not too late, I'd be more than happy to facilitate.

-- 
Lee Jones [李琼斯]
Senior Technical Lead - Developer Services
Linaro.org │ Open source software for Arm SoCs
Follow Linaro: Facebook | Twitter | Blog
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v2 10/13] mfd: hi6421-spmi-pmic: move driver from staging

2021-01-18 Thread Lee Jones
On Mon, 18 Jan 2021, Mauro Carvalho Chehab wrote:

> Em Mon, 18 Jan 2021 15:12:27 +
> Lee Jones  escreveu:
> 
> > On Mon, 18 Jan 2021, Mauro Carvalho Chehab wrote:
> > 
> > > This driver is ready for mainstream. So, move it out of staging.
> > > 
> > > Signed-off-by: Mauro Carvalho Chehab 
> > > ---
> > >  .../mfd/hisilicon,hi6421-spmi-pmic.yaml   | 133 +++
> > >  MAINTAINERS   |   7 +
> > >  drivers/mfd/Kconfig   |  15 +
> > >  drivers/mfd/Makefile  |   1 +
> > >  drivers/mfd/hi6421-spmi-pmic.c| 342 ++
> > >  drivers/staging/hikey9xx/Kconfig  |  16 -
> > >  drivers/staging/hikey9xx/Makefile |   1 -
> > >  drivers/staging/hikey9xx/hi6421-spmi-pmic.c   | 342 --
> > >  .../hikey9xx/hisilicon,hi6421-spmi-pmic.yaml  | 133 ---
> > >  9 files changed, 498 insertions(+), 492 deletions(-)  
> > 
> > Could you please resubmit this will the correct flags.
> > 
> > I believe it's the `git format-patch` -M flag that you want.
> 
> As explained at patch 00/13, this was intentionally generated with
> --no-merges, in order to allow reviewers to view the entire source
> code at the patch. 

That's a fair point.  Please leave it as it is for now then.

I'll get around to the review soon I hope.

> Anyway, I'll re-send the series with -M, as it makes easier to merge,
> if everything is ok.

-- 
Lee Jones [李琼斯]
Senior Technical Lead - Developer Services
Linaro.org │ Open source software for Arm SoCs
Follow Linaro: Facebook | Twitter | Blog
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v2 10/13] mfd: hi6421-spmi-pmic: move driver from staging

2021-01-18 Thread Lee Jones
On Mon, 18 Jan 2021, Mauro Carvalho Chehab wrote:

> This driver is ready for mainstream. So, move it out of staging.
> 
> Signed-off-by: Mauro Carvalho Chehab 
> ---
>  .../mfd/hisilicon,hi6421-spmi-pmic.yaml   | 133 +++
>  MAINTAINERS   |   7 +
>  drivers/mfd/Kconfig   |  15 +
>  drivers/mfd/Makefile  |   1 +
>  drivers/mfd/hi6421-spmi-pmic.c| 342 ++
>  drivers/staging/hikey9xx/Kconfig  |  16 -
>  drivers/staging/hikey9xx/Makefile |   1 -
>  drivers/staging/hikey9xx/hi6421-spmi-pmic.c   | 342 --
>  .../hikey9xx/hisilicon,hi6421-spmi-pmic.yaml  | 133 ---
>  9 files changed, 498 insertions(+), 492 deletions(-)

Could you please resubmit this will the correct flags.

I believe it's the `git format-patch` -M flag that you want.

-- 
Lee Jones [李琼斯]
Senior Technical Lead - Developer Services
Linaro.org │ Open source software for Arm SoCs
Follow Linaro: Facebook | Twitter | Blog
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 5/6] staging: net: wimax: i2400m: tx: Fix a few kernel-doc misdemeanours

2020-11-12 Thread Lee Jones
Fixes the following W=1 kernel build warning(s):

 drivers/net/wimax/i2400m/tx.c:715: warning: Function parameter or member 
'i2400m' not described in 'i2400m_tx'
 drivers/net/wimax/i2400m/tx.c:964: warning: Function parameter or member 
'i2400m' not described in 'i2400m_tx_setup'
 drivers/net/wimax/i2400m/tx.c:1005: warning: Function parameter or member 
'i2400m' not described in 'i2400m_tx_release'

Cc: Greg Kroah-Hartman 
Cc: Inaky Perez-Gonzalez 
Cc: linux-wi...@intel.com
Cc: "David S. Miller" 
Cc: Jakub Kicinski 
Cc: Yanir Lubetkin 
Cc: net...@vger.kernel.org
Cc: de...@driverdev.osuosl.org
Signed-off-by: Lee Jones 
---
 drivers/staging/wimax/i2400m/tx.c | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/wimax/i2400m/tx.c 
b/drivers/staging/wimax/i2400m/tx.c
index 1255302e251e4..e9436212fe54d 100644
--- a/drivers/staging/wimax/i2400m/tx.c
+++ b/drivers/staging/wimax/i2400m/tx.c
@@ -681,6 +681,8 @@ void i2400m_tx_close(struct i2400m *i2400m)
 /**
  * i2400m_tx - send the data in a buffer to the device
  *
+ * @i2400m: device descriptor
+ *
  * @buf: pointer to the buffer to transmit
  *
  * @buf_len: buffer size
@@ -955,6 +957,8 @@ EXPORT_SYMBOL_GPL(i2400m_tx_msg_sent);
 /**
  * i2400m_tx_setup - Initialize the TX queue and infrastructure
  *
+ * @i2400m: device descriptor
+ *
  * Make sure we reset the TX sequence to zero, as when this function
  * is called, the firmware has been just restarted. Same rational
  * for tx_in, tx_out, tx_msg_size and tx_msg. We reset them since
@@ -998,7 +1002,7 @@ int i2400m_tx_setup(struct i2400m *i2400m)
 }
 
 
-/**
+/*
  * i2400m_tx_release - Tear down the TX queue and infrastructure
  */
 void i2400m_tx_release(struct i2400m *i2400m)
-- 
2.25.1

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


[PATCH 3/6] staging: net: wimax: i2400m: fw: Fix some function header misdemeanours

2020-11-12 Thread Lee Jones
Fixes the following W=1 kernel build warning(s):

 drivers/net/wimax/i2400m/fw.c:584: warning: Function parameter or member 
'i2400m' not described in 'i2400m_bm_cmd'
 drivers/net/wimax/i2400m/fw.c:584: warning: Excess function parameter 
'returns' description in 'i2400m_bm_cmd'
 drivers/net/wimax/i2400m/fw.c:646: warning: Function parameter or member 
'chunk' not described in 'i2400m_download_chunk'
 drivers/net/wimax/i2400m/fw.c:646: warning: Function parameter or member 
'__chunk_len' not described in 'i2400m_download_chunk'
 drivers/net/wimax/i2400m/fw.c:646: warning: Excess function parameter 'buf' 
description in 'i2400m_download_chunk'
 drivers/net/wimax/i2400m/fw.c:646: warning: Excess function parameter 
'buf_len' description in 'i2400m_download_chunk'
 drivers/net/wimax/i2400m/fw.c:1548: warning: Function parameter or member 
'flags' not described in 'i2400m_dev_bootstrap'

Cc: Greg Kroah-Hartman 
Cc: Inaky Perez-Gonzalez 
Cc: linux-wi...@intel.com
Cc: "David S. Miller" 
Cc: Jakub Kicinski 
Cc: Yanir Lubetkin 
Cc: net...@vger.kernel.org
Cc: de...@driverdev.osuosl.org
Signed-off-by: Lee Jones 
---
 drivers/staging/wimax/i2400m/fw.c | 14 +++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/wimax/i2400m/fw.c 
b/drivers/staging/wimax/i2400m/fw.c
index 6c9a41bff2e0a..9970857063374 100644
--- a/drivers/staging/wimax/i2400m/fw.c
+++ b/drivers/staging/wimax/i2400m/fw.c
@@ -534,6 +534,7 @@ ssize_t __i2400m_bm_ack_verify(struct i2400m *i2400m, int 
opcode,
 /**
  * i2400m_bm_cmd - Execute a boot mode command
  *
+ * @i2400m: device descriptor
  * @cmd: buffer containing the command data (pointing at the header).
  * This data can be ANYWHERE (for USB, we will copy it to an
  * specific buffer). Make sure everything is in proper little
@@ -566,7 +567,7 @@ ssize_t __i2400m_bm_ack_verify(struct i2400m *i2400m, int 
opcode,
  *
  * @flags: see I2400M_BM_CMD_* above.
  *
- * @returns: bytes received by the notification; if < 0, an errno code
+ * Returns: bytes received by the notification; if < 0, an errno code
  * denoting an error or:
  *
  * -ERESTARTSYS  The device has rebooted
@@ -634,8 +635,8 @@ ssize_t i2400m_bm_cmd(struct i2400m *i2400m,
  * i2400m_download_chunk - write a single chunk of data to the device's memory
  *
  * @i2400m: device descriptor
- * @buf: the buffer to write
- * @buf_len: length of the buffer to write
+ * @chunk: the buffer to write
+ * @chunk_len: length of the buffer to write
  * @addr: address in the device memory space
  * @direct: bootrom write mode
  * @do_csum: should a checksum validation be performed
@@ -1533,6 +1534,13 @@ void i2400m_fw_put(struct i2400m_fw *i2400m_fw)
  * i2400m_dev_bootstrap - Bring the device to a known state and upload firmware
  *
  * @i2400m: device descriptor
+ * @flags:
+ *  I2400M_BRI_SOFT: a reboot barker has been seen
+ *  already, so don't wait for it.
+ *
+ *  I2400M_BRI_NO_REBOOT: Don't send a reboot command, but wait
+ *  for a reboot barker notification. This is a one shot; if
+ *  the state machine needs to send a reboot command it will.
  *
  * Returns: >= 0 if ok, < 0 errno code on error.
  *
-- 
2.25.1

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


[PATCH 1/6] staging: net: wimax: i2400m: control: Fix some misspellings in i2400m_set_init_config()'s docs

2020-11-12 Thread Lee Jones
Fixes the following W=1 kernel build warning(s):

 drivers/net/wimax/i2400m/control.c:1195: warning: Function parameter or member 
'arg' not described in 'i2400m_set_init_config'
 drivers/net/wimax/i2400m/control.c:1195: warning: Excess function parameter 
'arg_size' description in 'i2400m_set_init_config'

Cc: Greg Kroah-Hartman 
Cc: Inaky Perez-Gonzalez 
Cc: linux-wi...@intel.com
Cc: "David S. Miller" 
Cc: Jakub Kicinski 
Cc: net...@vger.kernel.org
Cc: de...@driverdev.osuosl.org
Signed-off-by: Lee Jones 
---
 drivers/staging/wimax/i2400m/control.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/wimax/i2400m/control.c 
b/drivers/staging/wimax/i2400m/control.c
index fe885aa56cf37..1e270b2101e86 100644
--- a/drivers/staging/wimax/i2400m/control.c
+++ b/drivers/staging/wimax/i2400m/control.c
@@ -1183,11 +1183,11 @@ static int i2400m_cmd_get_state(struct i2400m *i2400m)
  * Set basic configuration settings
  *
  * @i2400m: device descriptor
- * @args: array of pointers to the TLV headers to send for
+ * @arg: array of pointers to the TLV headers to send for
  * configuration (each followed by its payload).
  * TLV headers and payloads must be properly initialized, with the
  * right endianess (LE).
- * @arg_size: number of pointers in the @args array
+ * @args: number of pointers in the @arg array
  */
 static int i2400m_set_init_config(struct i2400m *i2400m,
  const struct i2400m_tlv_hdr **arg,
-- 
2.25.1

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


[PATCH 4/6] staging: net: wimax: i2400m: netdev: Demote non-conformant function header

2020-11-12 Thread Lee Jones
Fixes the following W=1 kernel build warning(s):

 drivers/net/wimax/i2400m/netdev.c:583: warning: Function parameter or member 
'net_dev' not described in 'i2400m_netdev_setup'

Cc: Greg Kroah-Hartman 
Cc: Inaky Perez-Gonzalez 
Cc: linux-wi...@intel.com
Cc: "David S. Miller" 
Cc: Jakub Kicinski 
Cc: Yanir Lubetkin 
Cc: net...@vger.kernel.org
Cc: de...@driverdev.osuosl.org
Signed-off-by: Lee Jones 
---
 drivers/staging/wimax/i2400m/netdev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/wimax/i2400m/netdev.c 
b/drivers/staging/wimax/i2400m/netdev.c
index a7fcbceb6e6be..8339d600e77b5 100644
--- a/drivers/staging/wimax/i2400m/netdev.c
+++ b/drivers/staging/wimax/i2400m/netdev.c
@@ -574,7 +574,7 @@ static const struct ethtool_ops i2400m_ethtool_ops = {
.get_link = ethtool_op_get_link,
 };
 
-/**
+/*
  * i2400m_netdev_setup - Setup setup @net_dev's i2400m private data
  *
  * Called by alloc_netdev()
-- 
2.25.1

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


[PATCH 6/6] staging: net: wimax: i2400m: fw: Fix incorrectly spelt function parameter in documentation

2020-11-12 Thread Lee Jones
Fixes the following W=1 kernel build warning(s):

 drivers/net/wimax/i2400m/fw.c:647: warning: Function parameter or member 
'__chunk_len' not described in 'i2400m_download_chunk'
 drivers/net/wimax/i2400m/fw.c:647: warning: Excess function parameter 
'chunk_len' description in 'i2400m_download_chunk'

Cc: Greg Kroah-Hartman 
Cc: Inaky Perez-Gonzalez 
Cc: linux-wi...@intel.com
Cc: "David S. Miller" 
Cc: Jakub Kicinski 
Cc: Yanir Lubetkin 
Cc: net...@vger.kernel.org
Cc: de...@driverdev.osuosl.org
Signed-off-by: Lee Jones 
---
 drivers/staging/wimax/i2400m/fw.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/wimax/i2400m/fw.c 
b/drivers/staging/wimax/i2400m/fw.c
index 9970857063374..edb5eba0898b0 100644
--- a/drivers/staging/wimax/i2400m/fw.c
+++ b/drivers/staging/wimax/i2400m/fw.c
@@ -636,7 +636,7 @@ ssize_t i2400m_bm_cmd(struct i2400m *i2400m,
  *
  * @i2400m: device descriptor
  * @chunk: the buffer to write
- * @chunk_len: length of the buffer to write
+ * @__chunk_len: length of the buffer to write
  * @addr: address in the device memory space
  * @direct: bootrom write mode
  * @do_csum: should a checksum validation be performed
-- 
2.25.1

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


[PATCH 2/6] staging: net: wimax: i2400m: driver: Demote some non-conformant kernel-docs, fix others

2020-11-12 Thread Lee Jones
Fixes the following W=1 kernel build warning(s):

 drivers/net/wimax/i2400m/driver.c:681: warning: Function parameter or member 
'i2400m' not described in 'i2400m_dev_reset_handle'
 drivers/net/wimax/i2400m/driver.c:681: warning: Function parameter or member 
'reason' not described in 'i2400m_dev_reset_handle'
 drivers/net/wimax/i2400m/driver.c:775: warning: Function parameter or member 
'i2400m' not described in 'i2400m_init'
 drivers/net/wimax/i2400m/driver.c:842: warning: Function parameter or member 
'bm_flags' not described in 'i2400m_setup'
 drivers/net/wimax/i2400m/driver.c:942: warning: Function parameter or member 
'i2400m' not described in 'i2400m_release'

Cc: Greg Kroah-Hartman 
Cc: Inaky Perez-Gonzalez 
Cc: linux-wi...@intel.com
Cc: "David S. Miller" 
Cc: Jakub Kicinski 
Cc: net...@vger.kernel.org
Cc: de...@driverdev.osuosl.org
Signed-off-by: Lee Jones 
---
 drivers/staging/wimax/i2400m/driver.c | 9 +
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/wimax/i2400m/driver.c 
b/drivers/staging/wimax/i2400m/driver.c
index dc8939ff78c0e..f5186458bb3d4 100644
--- a/drivers/staging/wimax/i2400m/driver.c
+++ b/drivers/staging/wimax/i2400m/driver.c
@@ -665,7 +665,7 @@ void __i2400m_dev_reset_handle(struct work_struct *ws)
 }
 
 
-/**
+/*
  * i2400m_dev_reset_handle - Handle a device's reset in a thread context
  *
  * Schedule a device reset handling out on a thread context, so it
@@ -685,7 +685,7 @@ int i2400m_dev_reset_handle(struct i2400m *i2400m, const 
char *reason)
 EXPORT_SYMBOL_GPL(i2400m_dev_reset_handle);
 
 
- /*
+/*
  * The actual work of error recovery.
  *
  * The current implementation of error recovery is to trigger a bus reset.
@@ -766,7 +766,7 @@ void i2400m_bm_buf_free(struct i2400m *i2400m)
 }
 
 
-/**
+/*
  * i2400m_init - Initialize a 'struct i2400m' from all zeroes
  *
  * This is a bus-generic API call.
@@ -831,6 +831,7 @@ EXPORT_SYMBOL_GPL(i2400m_reset);
  * i2400m_setup - bus-generic setup function for the i2400m device
  *
  * @i2400m: device descriptor (bus-specific parts have been initialized)
+ * @bm_flags: boot mode flags
  *
  * Returns: 0 if ok, < 0 errno code on error.
  *
@@ -933,7 +934,7 @@ int i2400m_setup(struct i2400m *i2400m, enum i2400m_bri 
bm_flags)
 EXPORT_SYMBOL_GPL(i2400m_setup);
 
 
-/**
+/*
  * i2400m_release - release the bus-generic driver resources
  *
  * Sends a disconnect message and undoes any setup done by i2400m_setup()
-- 
2.25.1

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


[PATCH 0/6] Rid i2400m driver set of W=1 issues

2020-11-12 Thread Lee Jones
This set is part of a larger effort attempting to clean-up W=1
kernel builds, which are currently overwhelmingly riddled with
niggly little warnings.

This is a rebased set that went to Net before the move to Staging.

Lee Jones (6):
  staging: net: wimax: i2400m: control: Fix some misspellings in
i2400m_set_init_config()'s docs
  staging: net: wimax: i2400m: driver: Demote some non-conformant
kernel-docs, fix others
  staging: net: wimax: i2400m: fw: Fix some function header
misdemeanours
  staging: net: wimax: i2400m: netdev: Demote non-conformant function
header
  staging: net: wimax: i2400m: tx: Fix a few kernel-doc misdemeanours
  staging: net: wimax: i2400m: fw: Fix incorrectly spelt function
parameter in documentation

 drivers/staging/wimax/i2400m/control.c |  4 ++--
 drivers/staging/wimax/i2400m/driver.c  |  9 +
 drivers/staging/wimax/i2400m/fw.c  | 14 +++---
 drivers/staging/wimax/i2400m/netdev.c  |  2 +-
 drivers/staging/wimax/i2400m/tx.c  |  6 +-
 5 files changed, 24 insertions(+), 11 deletions(-)

Cc: "David S. Miller" 
Cc: de...@driverdev.osuosl.org
Cc: Greg Kroah-Hartman 
Cc: Inaky Perez-Gonzalez 
Cc: Jakub Kicinski 
Cc: linux-wi...@intel.com
Cc: net...@vger.kernel.org
Cc: Yanir Lubetkin 
-- 
2.25.1

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


Re: [PATCH v1 17/30] mmc: sdhci-tegra: Support OPP and core voltage scaling

2020-11-09 Thread Frank Lee
On Mon, Nov 9, 2020 at 1:53 PM Viresh Kumar  wrote:
>
> On 09-11-20, 08:44, Dmitry Osipenko wrote:
> > 09.11.2020 08:35, Viresh Kumar пишет:
> > > On 09-11-20, 08:19, Dmitry Osipenko wrote:
> > >> Thanks, I made it in a different way by simply adding helpers to the
> > >> pm_opp.h which use devm_add_action_or_reset(). This doesn't require to
> > >> add new kernel symbols.
> > >
> > > I will prefer to add it in core.c itself, and yes
> > > devm_add_action_or_reset() looks better. But I am still not sure for
> > > which helpers do we need the devm_*() variants, as this is only useful
> > > for non-CPU devices. But if we have users that we can add right now,
> > > why not.
> >
> > All current non-CPU drivers (devfreq, mmc, memory, etc) can benefit from it.
> >
> > For Tegra drivers we need these variants:
> >
> > devm_pm_opp_set_supported_hw()
> > devm_pm_opp_set_regulators() [if we won't use GENPD]
> > devm_pm_opp_set_clkname()
> > devm_pm_opp_of_add_table()
>
> I tried to look earlier for the stuff already merged in and didn't
> find a lot of stuff where the devm_* could be used, maybe I missed
> some of it.
>
> Frank, would you like to refresh your series based on suggestions from
> Dmitry and make other drivers adapt to the new APIs ?

I am glad to do this.:)

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


Re: [PATCH v1 17/30] mmc: sdhci-tegra: Support OPP and core voltage scaling

2020-11-06 Thread Frank Lee
On Fri, Nov 6, 2020 at 9:18 PM Dmitry Osipenko  wrote:
>
> 06.11.2020 09:15, Viresh Kumar пишет:
> > Setting regulators for count as 0 doesn't sound good to me.
> >
> > But, I understand that you don't want to have that if (have_regulator)
> > check, and it is a fair request. What I will instead do is, allow all
> > dev_pm_opp_put*() API to start accepting a NULL pointer for the OPP
> > table and fail silently. And so you won't be required to have this
> > unwanted check. But you will be required to save the pointer returned
> > back by dev_pm_opp_set_regulators(), which is the right thing to do
> > anyways.
>
> Perhaps even a better variant could be to add a devm versions of the OPP
> API functions, then drivers won't need to care about storing the
> opp_table pointer if it's unused by drivers.

I think so. The consumer may not be so concerned about the status of
these OPP tables.
If the driver needs to manage the release, it needs to add a pointer
to their driver global structure.

Maybe it's worth having these devm interfaces for opp.

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


Re: [PATCH 00/44] SPMI patches needed by Hikey 970

2020-08-13 Thread Lee Jones
>   staging: regulator: hi6421v600-regulator: cleanup debug messages
>   staging: regulator: hi6421v600-regulator: use shorter names for OF
> properties
>   staging: regulator: hi6421v600-regulator: better handle modes
>   staging: regulator: hi6421v600-regulator: change namespace
>   staging: regulator: hi6421v600-regulator: convert to use get/set
> voltage_sel
>   staging: regulator: hi6421v600-regulator: don't use usleep_range for
> off_on_delay
>   staging: regulator: hi6421v600-regulator: add a driver-specific debug
> macro
>   staging: regulator: hi6421v600-regulator: initialize ramp_delay
>   staging: regulator: hi6421v600-regulator: cleanup DT settings
>   staging: regulator: hi6421v600-regulator: fix some coding style issues
>   staging: regulator: hi6421v600-regulator: add it to the building
> system
>   staging: regulator: hi6421v600-regulator: code cleanup
>   staging: hikey9xx: add a TODO list
>   MAINTAINERS: add an entry for HiSilicon 6421v600 drivers
>   dt: document HiSilicon SPMI controller and mfd/regulator properties
>   dt: hisilicon: add support for the PMIC found on Hikey 970
> 
> Mayulong (3):
>   staging: spmi: add Hikey 970 SPMI controller driver
>   staging: mfd: add a PMIC driver for HiSilicon 6421 SPMI version
>   staging: regulator: add a regulator driver for HiSilicon 6421v600 SPMI
> PMIC
> 
>  .../mfd/hisilicon,hi6421-spmi-pmic.yaml   | 182 +++
>  .../spmi/hisilicon,hisi-spmi-controller.yaml  |  54 ++
>  MAINTAINERS   |   6 +
>  .../boot/dts/hisilicon/hi3670-hikey970.dts|  16 +-
>  .../boot/dts/hisilicon/hikey970-pmic.dtsi | 200 
>  drivers/staging/Kconfig   |   2 +
>  drivers/staging/Makefile  |   1 +
>  drivers/staging/hikey9xx/Kconfig  |  35 ++
>  drivers/staging/hikey9xx/Makefile |   5 +
>  drivers/staging/hikey9xx/TODO |   5 +
>  drivers/staging/hikey9xx/hi6421-spmi-pmic.c   | 381 ++
>  .../staging/hikey9xx/hi6421v600-regulator.c   | 479 ++
>  .../staging/hikey9xx/hisi-spmi-controller.c   | 351 +
>  include/linux/mfd/hi6421-spmi-pmic.h  |  68 +++
>  14 files changed, 1773 insertions(+), 12 deletions(-)
>  create mode 100644 
> Documentation/devicetree/bindings/mfd/hisilicon,hi6421-spmi-pmic.yaml
>  create mode 100644 
> Documentation/devicetree/bindings/spmi/hisilicon,hisi-spmi-controller.yaml
>  create mode 100644 arch/arm64/boot/dts/hisilicon/hikey970-pmic.dtsi
>  create mode 100644 drivers/staging/hikey9xx/Kconfig
>  create mode 100644 drivers/staging/hikey9xx/Makefile
>  create mode 100644 drivers/staging/hikey9xx/TODO
>  create mode 100644 drivers/staging/hikey9xx/hi6421-spmi-pmic.c
>  create mode 100644 drivers/staging/hikey9xx/hi6421v600-regulator.c
>  create mode 100644 drivers/staging/hikey9xx/hisi-spmi-controller.c
>  create mode 100644 include/linux/mfd/hi6421-spmi-pmic.h
> 

-- 
Lee Jones [李琼斯]
Senior Technical Lead - Developer Services
Linaro.org │ Open source software for Arm SoCs
Follow Linaro: Facebook | Twitter | Blog
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v2] staging: rtlwifi: convert to DEFINE_SHOW_ATTRIBUTE

2018-12-21 Thread Frank Lee
Sorry!!!Please ignore this.
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: Direct io failed with ion

2018-10-11 Thread Rock Lee
On Thu, Oct 11, 2018 at 4:12 PM Dan Carpenter  wrote:
>
> On Thu, Oct 11, 2018 at 11:24:49AM +0800, Rock Lee wrote:
> > Hi
> > I tested direct io with a ion allocated buffer, got a -EFAULT
> > error. It turned out that ion_mmap() set VM_IO & VM_PFNMAP, but
> > check_vma_flags() (do_direct_IO() calls it) doesn't allow that VMA has
> > these flags set. Could you give me any hit that could solve this
> > issue?
> >
>
> You must be using an old kernel because ion_mmap() was changed in April.

Yes, I am using linux-4.4 which is a little old. Even in linux-4.18,
ion_mmap() still callls remap_pfn_range() if the heap is
carvout/system/cma/chunk. But remap_pfn_range() set VM_IO & IO_PFNMAP
as well.

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


Direct io failed with ion

2018-10-10 Thread Rock Lee
Hi
I tested direct io with a ion allocated buffer, got a -EFAULT
error. It turned out that ion_mmap() set VM_IO & VM_PFNMAP, but
check_vma_flags() (do_direct_IO() calls it) doesn't allow that VMA has
these flags set. Could you give me any hit that could solve this
issue?

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


Re: staging: rtsx: Add support for RTS5260

2017-10-23 Thread Lee Jones
On Mon, 16 Oct 2017, mario.limoncie...@dell.com wrote:

> > -Original Message-
> > From: Lee Jones [mailto:lee.jo...@linaro.org]
> > Sent: Friday, October 13, 2017 4:15 PM
> > To: Limonciello, Mario <mario_limoncie...@dell.com>
> > Cc: rui_f...@realsil.com.cn; gre...@linuxfoundation.org; linux-
> > ker...@vger.kernel.org; de...@driverdev.osuosl.org; ricky...@realtek.com;
> > wei_w...@realsil.com.cn
> > Subject: Re: staging: rtsx: Add support for RTS5260
> > 
> > On Fri, 13 Oct 2017, Mario Limonciello wrote:
> > > On 10/13/2017 03:50 AM, rui_f...@realsil.com.cn wrote:
> > > > From: rui_feng <rui_f...@realsil.com.cn>
> > > >
> > > > Add support for new chip rts5260.
> > > > In order to support rts5260,the definitions of some internal
> > > > registers and workflow have to be modified and are different from its
> > > > predecessors and OCP function is added for RTS5260.
> > > > So we need this patch to ensure RTS5260 can work.
> > > >
> > > > Signed-off-by: Rui Feng <rui_f...@realsil.com.cn>
> > > > ---
> > > >   drivers/mfd/Makefile  |   4 +
> > > >   drivers/mfd/rtsx_pcr.c| 127 ++-
> > > >   drivers/mfd/rtsx_pcr.h|  12 +
> > > >   drivers/staging/Kconfig   |   2 +
> > > >   drivers/staging/rts5260/Kconfig   |   6 +
> > > >   drivers/staging/rts5260/rts5260.c | 748
> > ++
> > > >   drivers/staging/rts5260/rts5260.h |  45 +++
> > > >   include/linux/mfd/rtsx_pci.h  | 234 +++-
> > > >   8 files changed, 1173 insertions(+), 5 deletions(-)
> > > >   create mode 100644 drivers/staging/rts5260/Kconfig
> > > >   create mode 100644 drivers/staging/rts5260/rts5260.c
> > > >   create mode 100644 drivers/staging/rts5260/rts5260.h
> > 
> > [nearly 1000 lines snipped]
> > 
> > Wow, that's a lot of scrolling to get to your reply!
> > 
> > It would be helpful if you'd please snip your replies in the future.
> 
> Yes, sorry about that.
> 
> > 
> > > > There are a number of drivers in this family which currently reside in
> > > > MFD.  These were accepted before my time.  After a recent review I've
> > > > made the decision that these aren't MFD drivers at all.
> > >
> > > If all these other similar drivers don't belong in MFD, why are they
> > > still there?  Have they been moved in -next?
> > 
> > No effort has been made to move them yet.  We still don't have a
> > suitable home for them.  That's what we're discussing.
> 
> I see that on a part of this thread I wasn't on CC that drivers/misc
> was decided.
> 
> > 
> > > As recently as last month I still see patches being accepted into
> > > MFD regarding Realtek card readers.
> > >
> > > https://patchwork.kernel.org/patch/9941753/
> > 
> > Changes to existing drivers, yes.
> > 
> > I only noticed what was going on when this new driver was submitted.
> > 
> > I'm now not accepting new ones.
> > 
> > > I miss how it's reasonable to expect the submitter who is adding support
> > > for new HW that is similar to other hardware in the past to be able to
> > > know where to put it if this change hasn't already happened.
> > 
> > It's perfectly reasonable to reject a new driver which doesn't
> > belong.
> > 
> > > What's actually wrong with accepting it in MFD like the other drivers
> > > similar to it and then moving them all at once when the right place
> > > is figured out?
> > 
> > Because it removes the incentive for someone to take the initiative and
> > move them.  I can't work with promises.  Too many times I've heard "if
> > you just accept this patch, I'll do XYZ as a subsequent piece of
> > work", then move on.  They are either never seen again, or we have the
> > same conversation when they attempt to submit something else.  Things
> > don't get done that way.
> > 
> > > Then its much clearer for future drivers similar to this one that they
> > > live in the new place (misc, or wherever makes sense).
> > 
> > I've I would have accepted the original patch into MFD, we would not
> > be having this conversation, people like yourself and Greg would not
> > be aware and (the chances are - just going by previous experience
> > here) nothing would have changed/improved.
> > 
> > > It seems like it would

Re: staging: rtsx: Add support for RTS5260

2017-10-13 Thread Lee Jones
On Fri, 13 Oct 2017, Mario Limonciello wrote:
> On 10/13/2017 03:50 AM, rui_f...@realsil.com.cn wrote:
> > From: rui_feng <rui_f...@realsil.com.cn>
> > 
> > Add support for new chip rts5260.
> > In order to support rts5260,the definitions of some internal
> > registers and workflow have to be modified and are different from its
> > predecessors and OCP function is added for RTS5260.
> > So we need this patch to ensure RTS5260 can work.
> > 
> > Signed-off-by: Rui Feng <rui_f...@realsil.com.cn>
> > ---
> >   drivers/mfd/Makefile  |   4 +
> >   drivers/mfd/rtsx_pcr.c| 127 ++-
> >   drivers/mfd/rtsx_pcr.h|  12 +
> >   drivers/staging/Kconfig   |   2 +
> >   drivers/staging/rts5260/Kconfig   |   6 +
> >   drivers/staging/rts5260/rts5260.c | 748 
> > ++
> >   drivers/staging/rts5260/rts5260.h |  45 +++
> >   include/linux/mfd/rtsx_pci.h  | 234 +++-
> >   8 files changed, 1173 insertions(+), 5 deletions(-)
> >   create mode 100644 drivers/staging/rts5260/Kconfig
> >   create mode 100644 drivers/staging/rts5260/rts5260.c
> >   create mode 100644 drivers/staging/rts5260/rts5260.h

[nearly 1000 lines snipped]

Wow, that's a lot of scrolling to get to your reply!

It would be helpful if you'd please snip your replies in the future.

> > There are a number of drivers in this family which currently reside in
> > MFD.  These were accepted before my time.  After a recent review I've
> > made the decision that these aren't MFD drivers at all.
> 
> If all these other similar drivers don't belong in MFD, why are they
> still there?  Have they been moved in -next?

No effort has been made to move them yet.  We still don't have a
suitable home for them.  That's what we're discussing.

> As recently as last month I still see patches being accepted into
> MFD regarding Realtek card readers.
> 
> https://patchwork.kernel.org/patch/9941753/

Changes to existing drivers, yes.

I only noticed what was going on when this new driver was submitted.

I'm now not accepting new ones.

> I miss how it's reasonable to expect the submitter who is adding support
> for new HW that is similar to other hardware in the past to be able to
> know where to put it if this change hasn't already happened.

It's perfectly reasonable to reject a new driver which doesn't
belong.

> What's actually wrong with accepting it in MFD like the other drivers
> similar to it and then moving them all at once when the right place
> is figured out?

Because it removes the incentive for someone to take the initiative and
move them.  I can't work with promises.  Too many times I've heard "if
you just accept this patch, I'll do XYZ as a subsequent piece of
work", then move on.  They are either never seen again, or we have the
same conversation when they attempt to submit something else.  Things
don't get done that way.

> Then its much clearer for future drivers similar to this one that they
> live in the new place (misc, or wherever makes sense).

I've I would have accepted the original patch into MFD, we would not
be having this conversation, people like yourself and Greg would not
be aware and (the chances are - just going by previous experience
here) nothing would have changed/improved.

> It seems like it would be the same result but with less pain.

That cannot be guaranteed.

If people's words would have been their bond in the past, I would have
more trust and the world would be a nicer place. :)

> > Ok, how does it hook up to the hardware to talk to the reader?
> 
> This particular case its PCIe.  I don't know if their chip is
> used in any other packages, but I wouldn't be surprised if so.

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] staging: rtsx: Add support for RTS5260

2017-10-13 Thread Lee Jones
On Fri, 13 Oct 2017, Greg KH wrote:

> On Fri, Oct 13, 2017 at 10:54:22AM +0100, Lee Jones wrote:
> > On Fri, 13 Oct 2017, Greg KH wrote:
> > 
> > > On Fri, Oct 13, 2017 at 04:50:35PM +0800, rui_f...@realsil.com.cn wrote:
> > > > From: rui_feng <rui_f...@realsil.com.cn>
> > > > 
> > > > Add support for new chip rts5260.
> > > > In order to support rts5260,the definitions of some internal
> > > > registers and workflow have to be modified and are different from its
> > > > predecessors and OCP function is added for RTS5260.
> > > > So we need this patch to ensure RTS5260 can work.
> > > > 
> > > > Signed-off-by: Rui Feng <rui_f...@realsil.com.cn>
> > > 
> > > Your from and signed-off-by name does not match :(
> > > 
> > > > ---
> > > >  drivers/mfd/Makefile  |   4 +
> > > >  drivers/mfd/rtsx_pcr.c| 127 ++-
> > > >  drivers/mfd/rtsx_pcr.h|  12 +
> > > >  drivers/staging/Kconfig   |   2 +
> > > >  drivers/staging/rts5260/Kconfig   |   6 +
> > > >  drivers/staging/rts5260/rts5260.c | 748 
> > > > ++
> > > >  drivers/staging/rts5260/rts5260.h |  45 +++
> > > >  include/linux/mfd/rtsx_pci.h  | 234 +++-
> > > 
> > > I do not see a reason why this is a staging driver.  Where is the TODO
> > > file listing what needs to be done to get it out of staging?  Why can it
> > > not just go into the "real" part of the kernel?
> > 
> > It's not a staging driver.  Rui's focus appears to be to have this
> > driver accepted into Mainline by hook or by crock.  He's tried MFD,
> > Misc and now Staging!
> 
> Yeah, I've watched it too :)
> 
> > Background:
> > 
> > There are a number of drivers in this family which currently reside in
> > MFD.  These were accepted before my time.  After a recent review I've
> > made the decision that these aren't MFD drivers at all.
> > 
> > MFD drivers are ones which aid in registering and setting up shared
> > resources for sub-devices which reside on the same piece of silicon.
> > This driver does basically none of that.  Instead it *is* the (what we
> > describe above as) sub-device.  It does everything.
> 
> I agree with your assessment.
> 
> > In the absence of a subsystem which covers this type of device, I
> > suggested Misk as a good location to place these drivers.

Sorry, that should have been "Misc"

> What type of device is this thing?  I can't seem to figure that out.  If
> we can determine that, then we can find the proper place for it in the
> kernel.

It's a card (MMC, (u)SD, etc) reader.

> Rui, what does this hardware do?  What is the interface between the
> hardware and userspace that this driver is creating?

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] staging: rtsx: Add support for RTS5260

2017-10-13 Thread Lee Jones
On Fri, 13 Oct 2017, Greg KH wrote:

> On Fri, Oct 13, 2017 at 04:50:35PM +0800, rui_f...@realsil.com.cn wrote:
> > From: rui_feng <rui_f...@realsil.com.cn>
> > 
> > Add support for new chip rts5260.
> > In order to support rts5260,the definitions of some internal
> > registers and workflow have to be modified and are different from its
> > predecessors and OCP function is added for RTS5260.
> > So we need this patch to ensure RTS5260 can work.
> > 
> > Signed-off-by: Rui Feng <rui_f...@realsil.com.cn>
> 
> Your from and signed-off-by name does not match :(
> 
> > ---
> >  drivers/mfd/Makefile  |   4 +
> >  drivers/mfd/rtsx_pcr.c| 127 ++-
> >  drivers/mfd/rtsx_pcr.h|  12 +
> >  drivers/staging/Kconfig   |   2 +
> >  drivers/staging/rts5260/Kconfig   |   6 +
> >  drivers/staging/rts5260/rts5260.c | 748 
> > ++
> >  drivers/staging/rts5260/rts5260.h |  45 +++
> >  include/linux/mfd/rtsx_pci.h  | 234 +++-
> 
> I do not see a reason why this is a staging driver.  Where is the TODO
> file listing what needs to be done to get it out of staging?  Why can it
> not just go into the "real" part of the kernel?

It's not a staging driver.  Rui's focus appears to be to have this
driver accepted into Mainline by hook or by crock.  He's tried MFD,
Misc and now Staging!

Background:

There are a number of drivers in this family which currently reside in
MFD.  These were accepted before my time.  After a recent review I've
made the decision that these aren't MFD drivers at all.

MFD drivers are ones which aid in registering and setting up shared
resources for sub-devices which reside on the same piece of silicon.
This driver does basically none of that.  Instead it *is* the (what we
describe above as) sub-device.  It does everything.

In the absence of a subsystem which covers this type of device, I
suggested Misk as a good location to place these drivers.

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] staging: android: ion: reduce lock contention latency

2017-03-14 Thread Junil Lee
Replace list into lock-less list of ion page pool.

Measure how mutex lock contention latency on android.

1. the test is done under android 7.0
2. startup many applications circularly
3. find sample in trace log as below

cameraserver-625   [004] ...1  1891.952958: mutex_lock_enter: id=0
Binder:384_2-417   [005] ...1  1891.952958: mutex_lock_enter: id=0
Binder:384_2-417   [005] ...1  1891.952966: mutex_lock_enter: id=1
Binder:384_2-417   [005] ...1  1891.952970: mutex_lock_enter: id=0
Binder:384_2-417   [005] ...1  1891.952971: mutex_lock_enter: id=1
Binder:384_2-417   [005] ...1  1891.952982: mutex_lock_enter: id=0
Binder:384_2-417   [005] ...1  1891.952983: mutex_lock_enter: id=1
Binder:384_2-417   [005] ...1  1891.952989: mutex_lock_enter: id=0
Binder:384_2-417   [005] ...1  1891.952989: mutex_lock_enter: id=1
Binder:384_2-417   [005] ...1  1891.952995: mutex_lock_enter: id=0
cameraserver-625   [004] ...1  1891.952995: mutex_lock_enter: id=1

 - id 0 is try to lock, id 1 is locked

Figure out how many latency reduction by this patch as below.

The test is startup 60 applications circularly (repeat 10cycles)
 - lock contention count : 3717 -> 93

Signed-off-by: Bongkyu Kim <bongkyu@lge.com>
Signed-off-by: Junil Lee <junil0814@lge.com>
---
 drivers/staging/android/ion/ion_page_pool.c   | 52 ++-
 drivers/staging/android/ion/ion_priv.h|  8 ++---
 drivers/staging/android/ion/ion_system_heap.c | 16 -
 3 files changed, 40 insertions(+), 36 deletions(-)

diff --git a/drivers/staging/android/ion/ion_page_pool.c 
b/drivers/staging/android/ion/ion_page_pool.c
index aea89c1..1beb2c8 100644
--- a/drivers/staging/android/ion/ion_page_pool.c
+++ b/drivers/staging/android/ion/ion_page_pool.c
@@ -22,6 +22,7 @@
 #include 
 #include 
 #include 
+#include 
 #include "ion_priv.h"
 
 static void *ion_page_pool_alloc_pages(struct ion_page_pool *pool)
@@ -44,33 +45,36 @@ static void ion_page_pool_free_pages(struct ion_page_pool 
*pool,
 
 static int ion_page_pool_add(struct ion_page_pool *pool, struct page *page)
 {
-   mutex_lock(>mutex);
if (PageHighMem(page)) {
-   list_add_tail(>lru, >high_items);
-   pool->high_count++;
+   llist_add((struct llist_node *)>lru, >high_items);
+   atomic_inc(>high_count);
} else {
-   list_add_tail(>lru, >low_items);
-   pool->low_count++;
+   llist_add((struct llist_node *)>lru, >low_items);
+   atomic_inc(>low_count);
}
-   mutex_unlock(>mutex);
+
return 0;
 }
 
 static struct page *ion_page_pool_remove(struct ion_page_pool *pool, bool high)
 {
-   struct page *page;
+   struct page *page = NULL;
+   struct llist_node *node;
 
if (high) {
-   BUG_ON(!pool->high_count);
-   page = list_first_entry(>high_items, struct page, lru);
-   pool->high_count--;
+   BUG_ON(!atomic_read(>high_count));
+   node = llist_del_first(>high_items);
+   if (node)
+   node = llist_entry((struct list_head *)node, struct 
page, lru);
+   atomic_dec(>high_count);
} else {
-   BUG_ON(!pool->low_count);
-   page = list_first_entry(>low_items, struct page, lru);
-   pool->low_count--;
+   BUG_ON(!atomic_read(>low_count));
+   node = llist_del_first(>low_items);
+   if (node)
+   node = llist_entry((struct list_head *)node, struct 
page, lru);
+   atomic_dec(>low_count);
}
 
-   list_del(>lru);
return page;
 }
 
@@ -81,9 +85,9 @@ struct page *ion_page_pool_alloc(struct ion_page_pool *pool)
BUG_ON(!pool);
 
mutex_lock(>mutex);
-   if (pool->high_count)
+   if (atomic_read(>high_count))
page = ion_page_pool_remove(pool, true);
-   else if (pool->low_count)
+   else if (atomic_read(>low_count))
page = ion_page_pool_remove(pool, false);
mutex_unlock(>mutex);
 
@@ -106,10 +110,10 @@ void ion_page_pool_free(struct ion_page_pool *pool, 
struct page *page)
 
 static int ion_page_pool_total(struct ion_page_pool *pool, bool high)
 {
-   int count = pool->low_count;
+   int count = atomic_read(>low_count);
 
if (high)
-   count += pool->high_count;
+   count += atomic_read(>high_count);
 
return count << pool->order;
 }
@@ -132,9 +136,9 @@ int ion_page_pool_shrink(struct ion_page_pool *pool, gfp_t 
gfp_mask,
struct page *page;
 
mutex_lock(>mutex);
-   if (pool->low_count) {
+   if (atomic_read(>low_count)) {
 

[PATCH] staging: android: ion: fix coding style issue

2017-02-10 Thread Youngdo, Lee
Replaced sizeof(struct foo) into sizeof(*ptr), found by checkpatch.pl.

Signed-off-by: Youngdo, Lee <oss.yd...@gmail.com>
---
 drivers/staging/android/ion/ion_cma_heap.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/android/ion/ion_cma_heap.c 
b/drivers/staging/android/ion/ion_cma_heap.c
index 22b9582..6c40685 100644
--- a/drivers/staging/android/ion/ion_cma_heap.c
+++ b/drivers/staging/android/ion/ion_cma_heap.c
@@ -55,7 +55,7 @@ static int ion_cma_allocate(struct ion_heap *heap, struct 
ion_buffer *buffer,
if (align > PAGE_SIZE)
return -EINVAL;
 
-   info = kzalloc(sizeof(struct ion_cma_buffer_info), GFP_KERNEL);
+   info = kzalloc(sizeof(*info), GFP_KERNEL);
if (!info)
return -ENOMEM;
 
@@ -67,7 +67,7 @@ static int ion_cma_allocate(struct ion_heap *heap, struct 
ion_buffer *buffer,
goto err;
}
 
-   info->table = kmalloc(sizeof(struct sg_table), GFP_KERNEL);
+   info->table = kmalloc(sizeof(*info->table), GFP_KERNEL);
if (!info->table)
goto free_mem;
 
@@ -140,7 +140,7 @@ struct ion_heap *ion_cma_heap_create(struct 
ion_platform_heap *data)
 {
struct ion_cma_heap *cma_heap;
 
-   cma_heap = kzalloc(sizeof(struct ion_cma_heap), GFP_KERNEL);
+   cma_heap = kzalloc(sizeof(*cma_heap), GFP_KERNEL);
 
if (!cma_heap)
return ERR_PTR(-ENOMEM);
-- 
1.9.1

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


[PATCH] staging: nvec: Fix coding style

2017-02-09 Thread Youngdo, Lee
Removed unnecessary white spaces found via checkpatch.pl:
WARNING: Statements should start on a tabstop

Signed-off-by: Youngdo, Lee <oss.yd...@gmail.com>
---
 drivers/staging/nvec/nvec_power.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/nvec/nvec_power.c 
b/drivers/staging/nvec/nvec_power.c
index fcbb0fa..688b805 100644
--- a/drivers/staging/nvec/nvec_power.c
+++ b/drivers/staging/nvec/nvec_power.c
@@ -441,8 +441,8 @@ static int nvec_power_remove(struct platform_device *pdev)
.probe = nvec_power_probe,
.remove = nvec_power_remove,
.driver = {
-  .name = "nvec-power",
-  }
+   .name = "nvec-power",
+   }
 };
 
 module_platform_driver(nvec_power_driver);
-- 
1.9.1

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


[PATCH] staging: fbtft: fbtft-bus.c: Fix checkpatch error

2017-02-03 Thread Youngdo Lee
Fix checkpatch error:
ERROR: space prohibited before that close parenthesis ')'

Signed-off-by: Youngdo Lee <paul.yd...@gmail.com>
---
 drivers/staging/fbtft/fbtft-bus.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/fbtft/fbtft-bus.c 
b/drivers/staging/fbtft/fbtft-bus.c
index ec45043..3ce265d 100644
--- a/drivers/staging/fbtft/fbtft-bus.c
+++ b/drivers/staging/fbtft/fbtft-bus.c
@@ -10,6 +10,7 @@
  *
  */
 
+#definenop_modifier(expr)  (expr)
 #define define_fbtft_write_reg(func, type, modifier)  \
 void func(struct fbtft_par *par, int len, ...)\
 { \
@@ -68,9 +69,9 @@ void func(struct fbtft_par *par, int len, ...)
\
 } \
 EXPORT_SYMBOL(func);
 
-define_fbtft_write_reg(fbtft_write_reg8_bus8, u8, )
+define_fbtft_write_reg(fbtft_write_reg8_bus8, u8, nop_modifier)
 define_fbtft_write_reg(fbtft_write_reg16_bus8, u16, cpu_to_be16)
-define_fbtft_write_reg(fbtft_write_reg16_bus16, u16, )
+define_fbtft_write_reg(fbtft_write_reg16_bus16, u16, nop_modifier)
 
 void fbtft_write_reg8_bus9(struct fbtft_par *par, int len, ...)
 {
-- 
1.9.1

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


[RESEND PATCH v3] staging/android/ion : fix a race condition in the ion driver

2016-03-09 Thread EunTaik Lee
There is a use-after-free problem in the ion driver.
This is caused by a race condition in the ion_ioctl() function.

A handle has ref count of 1 and two tasks on different cpus calls ION_IOC_FREE 
simultaneously.

cpu 0   cpu 1
---
ion_handle_get_by_id()
(ref == 2)
ion_handle_get_by_id()
(ref == 3)

ion_free()
(ref == 2)

ion_handle_put()
(ref == 1)

ion_free()
(ref == 0 so ion_handle_destroy() is
called
and the handle is freed.)

ion_handle_put() is called and it
decreases the slub's next free pointer

The problem is detected as an unaligned access in the spin lock functions since 
it uses load exclusive  instruction. 
In some cases it corrupts the slub's free pointer which causes a mis-aligned 
access to the next free pointer.(kmalloc returns a pointer like 
c0745b4580aa). 
And it causes lots of other hard-to-debug problems.

This symptom is caused since the first member in the ion_handle structure is 
the reference count and the ion driver decrements the reference after it has 
been freed.

To fix this problem client->lock mutex is extended to protect all the codes 
that uses the handle.

Signed-off-by: Eun Taik Lee 
Reviewed-by: Laura Abbott 
---
changes in v3:
1. remove ion_handle_put in ion_free
2. remove unnecessary protection in IOC_ION_SHARE/IOC_ION_MAP
changes in v2 :
1. add problem description in the comment  
2. fix un-matching mutex_lock/unlock pair in ion_share_dma_buf()

drivers/staging/android/ion/ion.c | 55 ++-
1 file changed, 42 insertions(+), 13 deletions(-)  mode change 100644 => 100755 
drivers/staging/android/ion/ion.c

diff --git a/drivers/staging/android/ion/ion.c 
b/drivers/staging/android/ion/ion.c
old mode 100644
new mode 100755
index e237e9f..1958d58
--- a/drivers/staging/android/ion/ion.c
+++ b/drivers/staging/android/ion/ion.c
@@ -385,13 +385,22 @@ static void ion_handle_get(struct ion_handle *handle)
kref_get(>ref);
}

-static int ion_handle_put(struct ion_handle *handle)
+static int ion_handle_put_nolock(struct ion_handle *handle) {
+ int ret;
+
+ ret = kref_put(>ref, ion_handle_destroy);
+
+ return ret;
+}
+
+int ion_handle_put(struct ion_handle *handle)
{
struct ion_client *client = handle->client;
int ret;

mutex_lock(>lock);
- ret = kref_put(>ref, ion_handle_destroy);
+ ret = ion_handle_put_nolock(handle);
mutex_unlock(>lock);

return ret;
@@ -415,20 +424,30 @@ static struct ion_handle *ion_handle_lookup(struct 
ion_client *client,
return ERR_PTR(-EINVAL);
}

-static struct ion_handle *ion_handle_get_by_id(struct ion_client *client,
+static struct ion_handle *ion_handle_get_by_id_nolock(struct ion_client 
+*client,
int id)
{
struct ion_handle *handle;

- mutex_lock(>lock);
handle = idr_find(>idr, id);
if (handle)
ion_handle_get(handle);
- mutex_unlock(>lock);

return handle ? handle : ERR_PTR(-EINVAL);  }

+struct ion_handle *ion_handle_get_by_id(struct ion_client *client,
+ int id)
+{
+ struct ion_handle *handle;
+
+ mutex_lock(>lock);
+ handle = ion_handle_get_by_id_nolock(client, id);
+ mutex_unlock(>lock);
+
+ return handle;
+}
+
static bool ion_handle_validate(struct ion_client *client,
struct ion_handle *handle)
{
@@ -530,22 +549,28 @@ struct ion_handle *ion_alloc(struct ion_client *client, 
size_t len,  }  EXPORT_SYMBOL(ion_alloc);

-void ion_free(struct ion_client *client, struct ion_handle *handle)
+static void ion_free_nolock(struct ion_client *client, struct 
+ion_handle *handle)
{
bool valid_handle;

BUG_ON(client != handle->client);

- mutex_lock(>lock);
valid_handle = ion_handle_validate(client, handle);

if (!valid_handle) {
WARN(1, "%s: invalid handle passed to free.\n", __func__);
- mutex_unlock(>lock);
return;
}
+ ion_handle_put_nolock(handle);
+}
+
+void ion_free(struct ion_client *client, struct ion_handle *handle) {
+ BUG_ON(client != handle->client);
+
+ mutex_lock(>lock);
+ ion_free_nolock(client, handle);
mutex_unlock(>lock);
- ion_handle_put(handle);
}
EXPORT_SYMBOL(ion_free);

@@ -1281,11 +1306,15 @@ static long ion_ioctl(struct file *filp, unsigned int 
cmd, unsigned long arg)
{
struct ion_handle *handle;

- handle = ion_handle_get_by_id(client, data.handle.handle);
- if (IS_ERR(handle))
+ mutex_lock(>lock);
+ handle = ion_handle_get_by_id_nolock(client, data.handle.handle);
+ if (IS_ERR(handle)) {
+ mutex_unlock(>lock);
return PTR_ERR(handle);
- ion_free(client, handle);
- ion_handle_put(handle);
+ }
+ ion_free_nolock(client, handle);
+ ion_handle_put_nolock(handle);
+ mutex_unlock(>lock);
break;
}
case ION_IOC_SHARE:
--
1.9.1
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: Re: [PATCH v3] staging/android/ion : fix a race condition in the ion driver

2016-03-01 Thread EunTaik Lee
> From: Laura Abbott [mailto:labb...@redhat.com]
> Sent: Friday, February 26, 2016 7:12 AM
> To: eun.taik@samsung.com; gre...@linuxfoundation.org; a...@android.com;
> riandr...@android.com; sumit.sem...@linaro.org; dan.carpen...@oracle.com;
> Rohit Kumar <rohit...@samsung.com>; sri...@marirs.net.in; shawn.lin@rock-
> chips.com; de...@driverdev.osuosl.org; linux-ker...@vger.kernel.org;
> eunt...@gmail.com
> Subject: Re: [PATCH v3] staging/android/ion : fix a race condition in the
> ion driver
> 
> On 02/23/2016 08:38 PM, EunTaik Lee wrote:
> > There is a use-after-free problem in the ion driver.
> > This is caused by a race condition in the ion_ioctl() function.
> >
> > A handle has ref count of 1 and two tasks on different cpus calls
> > ION_IOC_FREE simultaneously.
> >
> > cpu 0   cpu 1
> > ---
> > ion_handle_get_by_id()
> > (ref == 2)
> >  ion_handle_get_by_id()
> >  (ref == 3)
> >
> > ion_free()
> > (ref == 2)
> >
> > ion_handle_put()
> > (ref == 1)
> >
> >  ion_free()
> >  (ref == 0 so ion_handle_destroy() is
> >  called
> >  and the handle is freed.)
> >
> >  ion_handle_put() is called and it
> >  decreases the slub's next free pointer
> >
> > The problem is detected as an unaligned access in the spin lock
> > functions since it uses load exclusive
> >   instruction. In some cases it corrupts the slub's free pointer which
> > causes a mis-aligned access to the next free pointer.(kmalloc returns
> > a pointer like c0745b4580aa). And it causes lots of other
> > hard-to-debug problems.
> >
> > This symptom is caused since the first member in the ion_handle
> > structure is the reference count and the ion driver decrements the
> > reference after it has been freed.
> >
> > To fix this problem client->lock mutex is extended to protect all the
> > codes that uses the handle.
> >
> > Signed-off-by: Eun Taik Lee <eun.taik@samsung.com>
> 
> Reviewed-by: Laura Abbott <labb...@redhat.com>
> 
> > ---
> > changes in v3:
> >   1. remove ion_handle_put in ion_free
> >   2. remove unnecessary protection in IOC_ION_SHARE/IOC_ION_MAP
> > changes in v2 :
> >   1. add problem description in the comment
> >   2. fix un-matching mutex_lock/unlock pair in ion_share_dma_buf()
> >
> >   drivers/staging/android/ion/ion.c | 55 ++-
> 
> >   1 file changed, 42 insertions(+), 13 deletions(-)
> >   mode change 100644 => 100755 drivers/staging/android/ion/ion.c
> >
> > diff --git a/drivers/staging/android/ion/ion.c
> > b/drivers/staging/android/ion/ion.c
> > old mode 100644
> > new mode 100755
> > index e237e9f..1958d58
> > --- a/drivers/staging/android/ion/ion.c
> > +++ b/drivers/staging/android/ion/ion.c
> > @@ -385,13 +385,22 @@ static void ion_handle_get(struct ion_handle
> *handle)
> > kref_get(>ref);
> >   }
> >
> > -static int ion_handle_put(struct ion_handle *handle)
> > +static int ion_handle_put_nolock(struct ion_handle *handle) {
> > +   int ret;
> > +
> > +   ret = kref_put(>ref, ion_handle_destroy);
> > +
> > +   return ret;
> > +}
> > +
> > +int ion_handle_put(struct ion_handle *handle)
> >   {
> > struct ion_client *client = handle->client;
> > int ret;
> >
> > mutex_lock(>lock);
> > -   ret = kref_put(>ref, ion_handle_destroy);
> > +   ret = ion_handle_put_nolock(handle);
> > mutex_unlock(>lock);
> >
> > return ret;
> > @@ -415,20 +424,30 @@ static struct ion_handle *ion_handle_lookup(struct
> ion_client *client,
> > return ERR_PTR(-EINVAL);
> >   }
> >
> > -static struct ion_handle *ion_handle_get_by_id(struct ion_client
> > *client,
> > +static struct ion_handle *ion_handle_get_by_id_nolock(struct
> > +ion_client *client,
> > int id)
> >   {
> > struct ion_handle *handle;
> >
> > -   mutex_lock(>lock);
> > handle = idr_find(>idr, id);
> > if (handle)
> > ion_handle_get(handle);
> > -   mutex_unlock(>lock);
> >
> > return handle ? handle : ERR_PTR(-EINV

[PATCH v3] staging/android/ion : fix a race condition in the ion driver

2016-02-23 Thread EunTaik Lee
There is a use-after-free problem in the ion driver.
This is caused by a race condition in the ion_ioctl()
function.

A handle has ref count of 1 and two tasks on different
cpus calls ION_IOC_FREE simultaneously.

cpu 0   cpu 1
---
ion_handle_get_by_id()
(ref == 2)
ion_handle_get_by_id()
(ref == 3)

ion_free()
(ref == 2)

ion_handle_put()
(ref == 1)

ion_free()
(ref == 0 so ion_handle_destroy() is
called
and the handle is freed.)

ion_handle_put() is called and it
decreases the slub's next free pointer

The problem is detected as an unaligned access in the
spin lock functions since it uses load exclusive
 instruction. In some cases it corrupts the slub's
free pointer which causes a mis-aligned access to the
next free pointer.(kmalloc returns a pointer like
c0745b4580aa). And it causes lots of other
hard-to-debug problems.

This symptom is caused since the first member in the
ion_handle structure is the reference count and the
ion driver decrements the reference after it has been
freed.

To fix this problem client->lock mutex is extended
to protect all the codes that uses the handle.

Signed-off-by: Eun Taik Lee <eun.taik@samsung.com>
---
changes in v3:
 1. remove ion_handle_put in ion_free
 2. remove unnecessary protection in IOC_ION_SHARE/IOC_ION_MAP
changes in v2 :
 1. add problem description in the comment
 2. fix un-matching mutex_lock/unlock pair in ion_share_dma_buf()

 drivers/staging/android/ion/ion.c | 55 ++-
 1 file changed, 42 insertions(+), 13 deletions(-)
 mode change 100644 => 100755 drivers/staging/android/ion/ion.c

diff --git a/drivers/staging/android/ion/ion.c 
b/drivers/staging/android/ion/ion.c
old mode 100644
new mode 100755
index e237e9f..1958d58
--- a/drivers/staging/android/ion/ion.c
+++ b/drivers/staging/android/ion/ion.c
@@ -385,13 +385,22 @@ static void ion_handle_get(struct ion_handle *handle)
kref_get(>ref);
 }
 
-static int ion_handle_put(struct ion_handle *handle)
+static int ion_handle_put_nolock(struct ion_handle *handle)
+{
+   int ret;
+
+   ret = kref_put(>ref, ion_handle_destroy);
+
+   return ret;
+}
+
+int ion_handle_put(struct ion_handle *handle)
 {
struct ion_client *client = handle->client;
int ret;
 
mutex_lock(>lock);
-   ret = kref_put(>ref, ion_handle_destroy);
+   ret = ion_handle_put_nolock(handle);
mutex_unlock(>lock);
 
return ret;
@@ -415,20 +424,30 @@ static struct ion_handle *ion_handle_lookup(struct 
ion_client *client,
return ERR_PTR(-EINVAL);
 }
 
-static struct ion_handle *ion_handle_get_by_id(struct ion_client *client,
+static struct ion_handle *ion_handle_get_by_id_nolock(struct ion_client 
*client,
int id)
 {
struct ion_handle *handle;
 
-   mutex_lock(>lock);
handle = idr_find(>idr, id);
if (handle)
ion_handle_get(handle);
-   mutex_unlock(>lock);
 
return handle ? handle : ERR_PTR(-EINVAL);
 }
 
+struct ion_handle *ion_handle_get_by_id(struct ion_client *client,
+   int id)
+{
+   struct ion_handle *handle;
+
+   mutex_lock(>lock);
+   handle = ion_handle_get_by_id_nolock(client, id);
+   mutex_unlock(>lock);
+
+   return handle;
+}
+
 static bool ion_handle_validate(struct ion_client *client,
struct ion_handle *handle)
 {
@@ -530,22 +549,28 @@ struct ion_handle *ion_alloc(struct ion_client *client, 
size_t len,
 }
 EXPORT_SYMBOL(ion_alloc);
 
-void ion_free(struct ion_client *client, struct ion_handle *handle)
+static void ion_free_nolock(struct ion_client *client, struct ion_handle 
*handle)
 {
bool valid_handle;
 
BUG_ON(client != handle->client);
 
-   mutex_lock(>lock);
valid_handle = ion_handle_validate(client, handle);
 
if (!valid_handle) {
WARN(1, "%s: invalid handle passed to free.\n", __func__);
-   mutex_unlock(>lock);
return;
}
+   ion_handle_put_nolock(handle);
+}
+
+void ion_free(struct ion_client *client, struct ion_handle *handle)
+{
+   BUG_ON(client != handle->client);
+
+   mutex_lock(>lock);
+   ion_free_nolock(client, handle);
mutex_unlock(>lock);
-   ion_handle_put(handle);
 }
 EXPORT_SYMBOL(ion_free);
 
@@ -1281,11 +1306,15 @@ static long ion_ioctl(struct file *filp, unsigned int 
cmd, unsigned long arg)
{
struct ion_handle *handle;
 
-   handle = ion_handle

Re: Re: [PATCH v2] staging/android/ion : fix a race condition in the ion driver

2016-02-23 Thread EunTaik Lee

> From: Laura Abbott [mailto:labb...@redhat.com]
> Sent: Saturday, February 20, 2016 5:09 AM
> To: eun.taik@samsung.com; gre...@linuxfoundation.org; a...@android.com;
> riandr...@android.com; sumit.sem...@linaro.org; dan.carpen...@oracle.com;
> Rohit Kumar <rohit...@samsung.com>; sri...@marirs.net.in; shawn.lin@rock-
> chips.com; de...@driverdev.osuosl.org; linux-ker...@vger.kernel.org;
> eunt...@gmail.com
> Subject: Re: [PATCH v2] staging/android/ion : fix a race condition in the
> ion driver
> 
> On 02/19/2016 04:03 AM, EunTaik Lee wrote:
> > There is a use-after-free problem in the ion driver.
> > This is caused by a race condition in the ion_ioctl() function.
> >
> > A handle has ref count of 1 and two tasks on different cpus calls
> > ION_IOC_FREE simultaneously.
> >
> > cpu 0   cpu 1
> > ---
> > ion_handle_get_by_id()
> > (ref == 2)
> >  ion_handle_get_by_id()
> >  (ref == 3)
> >
> > ion_free()
> > (ref == 2)
> >
> > ion_handle_put()
> > (ref == 1)
> >
> >  ion_free()
> >  (ref == 0 so ion_handle_destroy() is
> >  called
> >  and the handle is freed.)
> >
> >  ion_handle_put() is called and it
> >  decreases the slub's next free pointer
> >
> > The problem is detected as an unaligned access in the spin lock
> > functions since it uses load exclusive
> >   instruction. In some cases it corrupts the slub's free pointer which
> > causes a mis-aligned access to the next free pointer.(kmalloc returns
> > a pointer like c0745b4580aa). And it causes lots of other
> > hard-to-debug problems.
> >
> > This symptom is caused since the first member in the ion_handle
> > structure is the reference count and the ion driver decrements the
> > reference after it has been freed.
> >
> > To fix this problem client->lock mutex is extended to protect all the
> > codes that uses the handle.
> >
> > Signed-off-by: Eun Taik Lee <eun.taik@samsung.com>
> > ---
> > changes in v2 :
> >   1. add problem description in the comment
> >   2. fix un-matching mutex_lock/unlock pair in ion_share_dma_buf()
> >
> >   drivers/staging/android/ion/ion.c | 102
> ++
> >   1 file changed, 82 insertions(+), 20 deletions(-)
> >
> > diff --git a/drivers/staging/android/ion/ion.c
> > b/drivers/staging/android/ion/ion.c
> > index e237e9f..c6fbe48 100644
> > --- a/drivers/staging/android/ion/ion.c
> > +++ b/drivers/staging/android/ion/ion.c
> > @@ -385,13 +385,22 @@ static void ion_handle_get(struct ion_handle
> *handle)
> > kref_get(>ref);
> >   }
> >
> > +static int ion_handle_put_nolock(struct ion_handle *handle) {
> > +   int ret;
> > +
> > +   ret = kref_put(>ref, ion_handle_destroy);
> > +
> > +   return ret;
> > +}
> > +
> 
> the
> 
> >   static int ion_handle_put(struct ion_handle *handle)
> >   {
> > struct ion_client *client = handle->client;
> > int ret;
> >
> > mutex_lock(>lock);
> > -   ret = kref_put(>ref, ion_handle_destroy);
> > +   ret = ion_handle_put_nolock(handle);
> > mutex_unlock(>lock);
> >
> > return ret;
> > @@ -415,20 +424,30 @@ static struct ion_handle *ion_handle_lookup(struct
> ion_client *client,
> > return ERR_PTR(-EINVAL);
> >   }
> >
> > -static struct ion_handle *ion_handle_get_by_id(struct ion_client
> *client,
> > -   int id)
> > +static struct ion_handle *ion_handle_get_by_id_nolock(struct ion_client
> *client,
> > + int id)
> >   {
> > struct ion_handle *handle;
> >
> > -   mutex_lock(>lock);
> > handle = idr_find(>idr, id);
> > if (handle)
> > ion_handle_get(handle);
> > -   mutex_unlock(>lock);
> >
> > return handle ? handle : ERR_PTR(-EINVAL);
> >   }
> >
> > +struct ion_handle *ion_handle_get_by_id(struct ion_client *client,
> > +   int id)
> > +{
> > +   struct ion_handle *handle;
> > +
> > +   mutex_lock(>lock);
> > +   handle = ion_handle_get_by_id_noloc

[PATCH v2] staging/android/ion : fix a race condition in the ion driver

2016-02-19 Thread EunTaik Lee
There is a use-after-free problem in the ion driver.
This is caused by a race condition in the ion_ioctl()
function.

A handle has ref count of 1 and two tasks on different
cpus calls ION_IOC_FREE simultaneously.

cpu 0   cpu 1
---
ion_handle_get_by_id()
(ref == 2)
ion_handle_get_by_id()
(ref == 3)

ion_free()
(ref == 2)

ion_handle_put()
(ref == 1)

ion_free()
(ref == 0 so ion_handle_destroy() is
called
and the handle is freed.)

ion_handle_put() is called and it
decreases the slub's next free pointer

The problem is detected as an unaligned access in the
spin lock functions since it uses load exclusive
 instruction. In some cases it corrupts the slub's
free pointer which causes a mis-aligned access to the
next free pointer.(kmalloc returns a pointer like
c0745b4580aa). And it causes lots of other
hard-to-debug problems.

This symptom is caused since the first member in the
ion_handle structure is the reference count and the
ion driver decrements the reference after it has been
freed.

To fix this problem client->lock mutex is extended
to protect all the codes that uses the handle.

Signed-off-by: Eun Taik Lee <eun.taik@samsung.com>
---
changes in v2 : 
 1. add problem description in the comment
 2. fix un-matching mutex_lock/unlock pair in ion_share_dma_buf()

 drivers/staging/android/ion/ion.c | 102 ++
 1 file changed, 82 insertions(+), 20 deletions(-)

diff --git a/drivers/staging/android/ion/ion.c 
b/drivers/staging/android/ion/ion.c
index e237e9f..c6fbe48 100644
--- a/drivers/staging/android/ion/ion.c
+++ b/drivers/staging/android/ion/ion.c
@@ -385,13 +385,22 @@ static void ion_handle_get(struct ion_handle *handle)
kref_get(>ref);
 }
 
+static int ion_handle_put_nolock(struct ion_handle *handle)
+{
+   int ret;
+
+   ret = kref_put(>ref, ion_handle_destroy);
+
+   return ret;
+}
+
 static int ion_handle_put(struct ion_handle *handle)
 {
struct ion_client *client = handle->client;
int ret;
 
mutex_lock(>lock);
-   ret = kref_put(>ref, ion_handle_destroy);
+   ret = ion_handle_put_nolock(handle);
mutex_unlock(>lock);
 
return ret;
@@ -415,20 +424,30 @@ static struct ion_handle *ion_handle_lookup(struct 
ion_client *client,
return ERR_PTR(-EINVAL);
 }
 
-static struct ion_handle *ion_handle_get_by_id(struct ion_client *client,
-   int id)
+static struct ion_handle *ion_handle_get_by_id_nolock(struct ion_client 
*client,
+ int id)
 {
struct ion_handle *handle;
 
-   mutex_lock(>lock);
handle = idr_find(>idr, id);
if (handle)
ion_handle_get(handle);
-   mutex_unlock(>lock);
 
return handle ? handle : ERR_PTR(-EINVAL);
 }
 
+struct ion_handle *ion_handle_get_by_id(struct ion_client *client,
+   int id)
+{
+   struct ion_handle *handle;
+
+   mutex_lock(>lock);
+   handle = ion_handle_get_by_id_nolock(client, id);
+   mutex_unlock(>lock);
+
+   return handle;
+}
+
 static bool ion_handle_validate(struct ion_client *client,
struct ion_handle *handle)
 {
@@ -530,7 +549,8 @@ struct ion_handle *ion_alloc(struct ion_client *client, 
size_t len,
 }
 EXPORT_SYMBOL(ion_alloc);
 
-void ion_free(struct ion_client *client, struct ion_handle *handle)
+static void ion_free_nolock(struct ion_client *client,
+   struct ion_handle *handle)
 {
bool valid_handle;
 
@@ -538,15 +558,24 @@ void ion_free(struct ion_client *client, struct 
ion_handle *handle)
 
mutex_lock(>lock);
valid_handle = ion_handle_validate(client, handle);
-
if (!valid_handle) {
WARN(1, "%s: invalid handle passed to free.\n", __func__);
mutex_unlock(>lock);
return;
}
+   ion_handle_put_nolock(handle);
+}
+
+void ion_free(struct ion_client *client, struct ion_handle *handle)
+{
+   BUG_ON(client != handle->client);
+
+   mutex_lock(>lock);
+   ion_free_nolock(client, handle);
mutex_unlock(>lock);
ion_handle_put(handle);
 }
+
 EXPORT_SYMBOL(ion_free);
 
 int ion_phys(struct ion_client *client, struct ion_handle *handle,
@@ -830,6 +859,7 @@ void ion_client_destroy(struct ion_client *client)
struct rb_node *n;
 
pr_debug("%s: %d\n", __func__, __LINE__);
+   mutex_lock(>lock);
while ((n = rb_first(>han

[PATCH v2] staging/android/ion : fix a race condition in the ion driver

2016-02-19 Thread EunTaik Lee
There is a use-after-free problem in the ion driver.
This is caused by a race condition in the ion_ioctl()
function.

A handle has ref count of 1 and two tasks on different
cpus calls ION_IOC_FREE simultaneously.

cpu 0   cpu 1
---
ion_handle_get_by_id()
(ref == 2)
ion_handle_get_by_id()
(ref == 3)

ion_free()
(ref == 2)

ion_handle_put()
(ref == 1)

ion_free()
(ref == 0 so ion_handle_destroy() is
called
and the handle is freed.)

ion_handle_put() is called and it
decreases the slub's next free pointer

The problem is detected as an unaligned access in the
spin lock functions since it uses load exclusive
 instruction. In some cases it corrupts the slub's
free pointer which causes a mis-aligned access to the
next free pointer.(kmalloc returns a pointer like
c0745b4580aa). And it causes lots of other
hard-to-debug problems.

This symptom is caused since the first member in the
ion_handle structure is the reference count and the
ion driver decrements the reference after it has been
freed.

To fix this problem client->lock mutex is extended
to protect all the codes that uses the handle.

Signed-off-by: Eun Taik Lee <eun.taik@samsung.com>
---
 drivers/staging/android/ion/ion.c | 102 ++
 1 file changed, 82 insertions(+), 20 deletions(-)

diff --git a/drivers/staging/android/ion/ion.c 
b/drivers/staging/android/ion/ion.c
index e237e9f..c6fbe48 100644
--- a/drivers/staging/android/ion/ion.c
+++ b/drivers/staging/android/ion/ion.c
@@ -385,13 +385,22 @@ static void ion_handle_get(struct ion_handle *handle)
kref_get(>ref);
 }
 
+static int ion_handle_put_nolock(struct ion_handle *handle)
+{
+   int ret;
+
+   ret = kref_put(>ref, ion_handle_destroy);
+
+   return ret;
+}
+
 static int ion_handle_put(struct ion_handle *handle)
 {
struct ion_client *client = handle->client;
int ret;
 
mutex_lock(>lock);
-   ret = kref_put(>ref, ion_handle_destroy);
+   ret = ion_handle_put_nolock(handle);
mutex_unlock(>lock);
 
return ret;
@@ -415,20 +424,30 @@ static struct ion_handle *ion_handle_lookup(struct 
ion_client *client,
return ERR_PTR(-EINVAL);
 }
 
-static struct ion_handle *ion_handle_get_by_id(struct ion_client *client,
-   int id)
+static struct ion_handle *ion_handle_get_by_id_nolock(struct ion_client 
*client,
+ int id)
 {
struct ion_handle *handle;
 
-   mutex_lock(>lock);
handle = idr_find(>idr, id);
if (handle)
ion_handle_get(handle);
-   mutex_unlock(>lock);
 
return handle ? handle : ERR_PTR(-EINVAL);
 }
 
+struct ion_handle *ion_handle_get_by_id(struct ion_client *client,
+   int id)
+{
+   struct ion_handle *handle;
+
+   mutex_lock(>lock);
+   handle = ion_handle_get_by_id_nolock(client, id);
+   mutex_unlock(>lock);
+
+   return handle;
+}
+
 static bool ion_handle_validate(struct ion_client *client,
struct ion_handle *handle)
 {
@@ -530,7 +549,8 @@ struct ion_handle *ion_alloc(struct ion_client *client, 
size_t len,
 }
 EXPORT_SYMBOL(ion_alloc);
 
-void ion_free(struct ion_client *client, struct ion_handle *handle)
+static void ion_free_nolock(struct ion_client *client,
+   struct ion_handle *handle)
 {
bool valid_handle;
 
@@ -538,15 +558,24 @@ void ion_free(struct ion_client *client, struct 
ion_handle *handle)
 
mutex_lock(>lock);
valid_handle = ion_handle_validate(client, handle);
-
if (!valid_handle) {
WARN(1, "%s: invalid handle passed to free.\n", __func__);
mutex_unlock(>lock);
return;
}
+   ion_handle_put_nolock(handle);
+}
+
+void ion_free(struct ion_client *client, struct ion_handle *handle)
+{
+   BUG_ON(client != handle->client);
+
+   mutex_lock(>lock);
+   ion_free_nolock(client, handle);
mutex_unlock(>lock);
ion_handle_put(handle);
 }
+
 EXPORT_SYMBOL(ion_free);
 
 int ion_phys(struct ion_client *client, struct ion_handle *handle,
@@ -830,6 +859,7 @@ void ion_client_destroy(struct ion_client *client)
struct rb_node *n;
 
pr_debug("%s: %d\n", __func__, __LINE__);
+   mutex_lock(>lock);
while ((n = rb_first(>handles))) {
struct ion_handle *handle = rb_entry(n, struct ion_handle,
 node);
@@ -837,6 +867,7 @@ void

Re: Re: [RFC PATCH] staging/android/ion : fix a race condition in the ion driver

2016-02-18 Thread EunTaik Lee
2016-02-18 3:54 GMT+09:00 Laura Abbott <labb...@redhat.com>:
> On 02/16/2016 10:32 PM, EunTaik Lee wrote:
>> There was a use-after-free problem in the ion driver.
>>
>> The problem is detected as an unaligned access in the
>> spin lock functions since it uses load exclusive
>>   instruction. In some cases it corrupts the slub's
>> free pointer which causes a unaligned access to the
>> next free pointer.(thus the kmalloc function returns
>> a pointer like c0745b4580aa). And it causes lots of other
>> hard-to-debug problems.
>>
>> This symptom is caused since the first member in the
>> ion_handle structure is the reference count and the
>> ion driver decrements the reference after it has been
>> freed.
>>
>> To fix this problem client->lock mutex is extended
>> to protect all the codes that uses the handle.
>>
>
> This describes the symptoms very well but what's the actual
> race condition?

The actual race condition was in case ION_IOC_FREE of ion_ioctl()
function.

A handle has ref count of 1 and two tasks on different
cpus calls ION_IOC_FREE simultaneously.

cpu 0   cpu 1
---
ion_handle_get_by_id()
(ref == 2)
ion_handle_get_by_id()
(ref == 3)

ion_free()
(ref == 2)

ion_handle_put()
(ref == 1)

ion_free()
(ref == 0 so ion_handle_destroy() is called
 and the handle is freed.)

ion_handle_put() is called and it
decreases the slub's next free pointer

So it's basically a double free on the userspace.
But I made this patch since I don't think we should 
take a risk of such a malicious code to mess up
the kernel.

> Also what tree did you generate this against? It doesn't
> seem to apply.

The patch was generated against the stable-kernel.
I will resend the patch using the latest stable-kernel
along with a silly mistake that I've made when merging the
patch(made against 3.18.20) to the stable-kernel.
(Thank you Julia <julia.law...@lip6.fr> for pointing out
 my mistake)

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


[RFC PATCH] staging/android/ion : fix a race condition in the ion driver

2016-02-16 Thread EunTaik Lee
There was a use-after-free problem in the ion driver.

The problem is detected as an unaligned access in the
spin lock functions since it uses load exclusive
 instruction. In some cases it corrupts the slub's
free pointer which causes a unaligned access to the
next free pointer.(thus the kmalloc function returns 
a pointer like c0745b4580aa). And it causes lots of other
hard-to-debug problems.

This symptom is caused since the first member in the
ion_handle structure is the reference count and the
ion driver decrements the reference after it has been
freed.

To fix this problem client->lock mutex is extended
to protect all the codes that uses the handle.

Signed-off-by: Eun Taik Lee <eun.taik@samsung.com>
---
 drivers/staging/android/ion/ion.c | 102 ++
 1 file changed, 82 insertions(+), 20 deletions(-)

diff --git a/drivers/staging/android/ion/ion.c 
b/drivers/staging/android/ion/ion.c
index e237e9f..cb03b59 100644
--- a/drivers/staging/android/ion/ion.c
+++ b/drivers/staging/android/ion/ion.c
@@ -385,13 +385,22 @@ static void ion_handle_get(struct ion_handle *handle)
kref_get(>ref);
 }
 
+static int ion_handle_put_nolock(struct ion_handle *handle)
+{
+   int ret;
+
+   ret = kref_put(>ref, ion_handle_destroy);
+
+   return ret;
+}
+
 static int ion_handle_put(struct ion_handle *handle)
 {
struct ion_client *client = handle->client;
int ret;
 
mutex_lock(>lock);
-   ret = kref_put(>ref, ion_handle_destroy);
+   ret = ion_handle_put_nolock(handle);
mutex_unlock(>lock);
 
return ret;
@@ -415,20 +424,30 @@ static struct ion_handle *ion_handle_lookup(struct 
ion_client *client,
return ERR_PTR(-EINVAL);
 }
 
-static struct ion_handle *ion_handle_get_by_id(struct ion_client *client,
-   int id)
+static struct ion_handle *ion_handle_get_by_id_nolock(struct ion_client 
*client,
+ int id)
 {
struct ion_handle *handle;
 
-   mutex_lock(>lock);
handle = idr_find(>idr, id);
if (handle)
ion_handle_get(handle);
-   mutex_unlock(>lock);
 
return handle ? handle : ERR_PTR(-EINVAL);
 }
 
+struct ion_handle *ion_handle_get_by_id(struct ion_client *client,
+   int id)
+{
+   struct ion_handle *handle;
+
+   mutex_lock(>lock);
+   handle = ion_handle_get_by_id_nolock(client, id);
+   mutex_unlock(>lock);
+
+   return handle;
+}
+
 static bool ion_handle_validate(struct ion_client *client,
struct ion_handle *handle)
 {
@@ -530,7 +549,8 @@ struct ion_handle *ion_alloc(struct ion_client *client, 
size_t len,
 }
 EXPORT_SYMBOL(ion_alloc);
 
-void ion_free(struct ion_client *client, struct ion_handle *handle)
+static void ion_free_nolock(struct ion_client *client,
+   struct ion_handle *handle)
 {
bool valid_handle;
 
@@ -538,15 +558,24 @@ void ion_free(struct ion_client *client, struct 
ion_handle *handle)
 
mutex_lock(>lock);
valid_handle = ion_handle_validate(client, handle);
-
if (!valid_handle) {
WARN(1, "%s: invalid handle passed to free.\n", __func__);
mutex_unlock(>lock);
return;
}
+   ion_handle_put_nolock(handle);
+}
+
+void ion_free(struct ion_client *client, struct ion_handle *handle)
+{
+   BUG_ON(client != handle->client);
+
+   mutex_lock(>lock);
+   ion_free_nolock(client, handle);
mutex_unlock(>lock);
ion_handle_put(handle);
 }
+
 EXPORT_SYMBOL(ion_free);
 
 int ion_phys(struct ion_client *client, struct ion_handle *handle,
@@ -830,6 +859,7 @@ void ion_client_destroy(struct ion_client *client)
struct rb_node *n;
 
pr_debug("%s: %d\n", __func__, __LINE__);
+   mutex_lock(>lock);
while ((n = rb_first(>handles))) {
struct ion_handle *handle = rb_entry(n, struct ion_handle,
 node);
@@ -837,6 +867,7 @@ void ion_client_destroy(struct ion_client *client)
}
 
idr_destroy(>idr);
+   mutex_unlock(>lock);
 
down_write(>lock);
if (client->task)
@@ -1100,7 +1131,7 @@ static struct dma_buf_ops dma_buf_ops = {
.kunmap = ion_dma_buf_kunmap,
 };
 
-struct dma_buf *ion_share_dma_buf(struct ion_client *client,
+static struct dma_buf *ion_share_dma_buf_nolock(struct ion_client *client,
struct ion_handle *handle)
 {
DEFINE_DMA_BUF_EXPORT_INFO(exp_info);
@@ -1108,7 +1139,6 @@ struct dma_buf *ion_share_dma_buf(struct ion_client 
*client,
struct dma_buf *dmabuf;
bool valid_handle;
 
-   mutex_lock(>lock);
valid_handle = ion_

[PATCH] staging: wilc1000: Fix compilation error when CONFIG_PM disabled

2016-02-04 Thread Glen Lee
Commit 73584a40d748 ("staging: wilc1000: add ops resuem/suspend/wakeup in
cfg80211") causes following compilation error. This patch fixes this by
using suspend/resume under CONFIG_PM.

drivers/staging/wilc1000/wilc_wfi_cfgoperations.c: In function
'wilc_create_wiphy':
>> drivers/staging/wilc1000/wilc_wfi_cfgoperations.c:2833:13: error:
'struct wiphy' has no member named 'wowlan'
 wdev->wiphy->wowlan = _support;

Fixes: 73584a40d748 ("staging: wilc1000: add ops resuem/suspend/wakeup in 
cfg80211")
Reported-by: kbuild test robot <fengguang...@intel.com>
Signed-off-by: Glen Lee <glen@atmel.com>
---
 drivers/staging/wilc1000/wilc_sdio.c  | 4 
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 9 -
 drivers/staging/wilc1000/wilc_wfi_netdevice.h | 2 ++
 3 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/wilc1000/wilc_sdio.c 
b/drivers/staging/wilc1000/wilc_sdio.c
index 7c20c8c..26cc9c3 100644
--- a/drivers/staging/wilc1000/wilc_sdio.c
+++ b/drivers/staging/wilc1000/wilc_sdio.c
@@ -162,6 +162,7 @@ static int sdio_reset(struct wilc *wilc)
return 0;
 }
 
+#ifdef CONFIG_PM
 static int wilc_sdio_suspend(struct device *dev)
 {
struct sdio_func *func = dev_to_sdio_func(dev);
@@ -210,15 +211,18 @@ static const struct dev_pm_ops wilc_sdio_pm_ops = {
.suspend = wilc_sdio_suspend,
.resume = wilc_sdio_resume,
 };
+#endif
 
 static struct sdio_driver wilc1000_sdio_driver = {
.name   = SDIO_MODALIAS,
.id_table   = wilc_sdio_ids,
.probe  = linux_sdio_probe,
.remove = linux_sdio_remove,
+#ifdef CONFIG_PM
.drv = {
.pm = _sdio_pm_ops,
}
+#endif
 };
 module_driver(wilc1000_sdio_driver,
  sdio_register_driver,
diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index a899b37..a4a6bb8 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -74,9 +74,11 @@ static const struct ieee80211_txrx_stypes
}
 };
 
+#ifdef CONFIG_PM
 static const struct wiphy_wowlan_support wowlan_support = {
.flags = WIPHY_WOWLAN_ANY
 };
+#endif
 
 #define WILC_WFI_DWELL_PASSIVE 100
 #define WILC_WFI_DWELL_ACTIVE  40
@@ -2407,6 +2409,7 @@ static int del_virtual_intf(struct wiphy *wiphy, struct 
wireless_dev *wdev)
return 0;
 }
 
+#ifdef CONFIG_PM
 static int wilc_suspend(struct wiphy *wiphy, struct cfg80211_wowlan *wow)
 {
struct wilc_priv *priv = wiphy_priv(wiphy);
@@ -2436,6 +2439,7 @@ static void wilc_set_wakeup(struct wiphy *wiphy, bool 
enabled)
 
netdev_info(vif->ndev, "cfg set wake up = %d\n", enabled);
 }
+#endif
 
 static int set_tx_power(struct wiphy *wiphy, struct wireless_dev *wdev,
enum nl80211_tx_power_setting type, int mbm)
@@ -2504,10 +2508,11 @@ static struct cfg80211_ops wilc_cfg80211_ops = {
.mgmt_frame_register = wilc_mgmt_frame_register,
.set_power_mgmt = set_power_mgmt,
.set_cqm_rssi_config = set_cqm_rssi_config,
-
+#ifdef CONFIG_PM
.suspend = wilc_suspend,
.resume = wilc_resume,
.set_wakeup = wilc_set_wakeup,
+#endif
.set_tx_power = set_tx_power,
.get_tx_power = get_tx_power,
 
@@ -2591,7 +2596,9 @@ struct wireless_dev *wilc_create_wiphy(struct net_device 
*net, struct device *de
sema_init(&(priv->SemHandleUpdateStats), 1);
priv->wdev = wdev;
wdev->wiphy->max_scan_ssids = MAX_NUM_PROBED_SSID;
+#ifdef CONFIG_PM
wdev->wiphy->wowlan = _support;
+#endif
wdev->wiphy->max_num_pmkids = WILC_MAX_NUM_PMKIDS;
PRINT_INFO(CFG80211_DBG, "Max number of PMKIDs = %d\n", 
wdev->wiphy->max_num_pmkids);
 
diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h 
b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
index 3077f5d4..39b72cd 100644
--- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h
+++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
@@ -215,7 +215,9 @@ struct wilc {
const struct firmware *firmware;
 
struct device *dev;
+#ifdef CONFIG_PM
bool suspend_event;
+#endif
 
struct rf_info dummy_statistics;
 };
-- 
1.9.1

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


[PATCH RESEND 02/70] staging: wilc1000: remove unused functions

2016-02-04 Thread Glen Lee
This patch removes unused following functions.
wilc_del_all_rx_ba_session
wilc_flush_join_req
wilc_wait_msg_queue_idle
wilc_set_mac_address

Signed-off-by: Glen Lee <glen@atmel.com>
---
 drivers/staging/wilc1000/host_interface.c | 92 ---
 drivers/staging/wilc1000/host_interface.h |  4 --
 2 files changed, 96 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 7c75d0e..1dc6af0 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -3342,25 +3342,6 @@ int wilc_get_mac_address(struct wilc_vif *vif, u8 
*mac_addr)
return result;
 }
 
-int wilc_set_mac_address(struct wilc_vif *vif, u8 *mac_addr)
-{
-   int result = 0;
-   struct host_if_msg msg;
-
-   PRINT_D(GENERIC_DBG, "mac addr = %x:%x:%x\n", mac_addr[0], mac_addr[1], 
mac_addr[2]);
-
-   memset(, 0, sizeof(struct host_if_msg));
-   msg.id = HOST_IF_MSG_SET_MAC_ADDRESS;
-   memcpy(msg.body.set_mac_info.mac_addr, mac_addr, ETH_ALEN);
-   msg.vif = vif;
-
-   result = wilc_mq_send(_msg_q, , sizeof(struct host_if_msg));
-   if (result)
-   PRINT_ER("Failed to send message queue: Set mac address\n");
-
-   return result;
-}
-
 int wilc_set_join_req(struct wilc_vif *vif, u8 *bssid, const u8 *ssid,
  size_t ssid_len, const u8 *ies, size_t ies_len,
  wilc_connect_result connect_result, void *user_arg,
@@ -3431,32 +3412,6 @@ int wilc_set_join_req(struct wilc_vif *vif, u8 *bssid, 
const u8 *ssid,
return result;
 }
 
-int wilc_flush_join_req(struct wilc_vif *vif)
-{
-   int result = 0;
-   struct host_if_msg msg;
-   struct host_if_drv *hif_drv = vif->hif_drv;
-
-   if (!join_req)
-   return -EFAULT;
-
-   if (!hif_drv) {
-   PRINT_ER("Driver is null\n");
-   return -EFAULT;
-   }
-
-   msg.id = HOST_IF_MSG_FLUSH_CONNECT;
-   msg.vif = vif;
-
-   result = wilc_mq_send(_msg_q, , sizeof(struct host_if_msg));
-   if (result) {
-   PRINT_ER("Failed to send message queue: Flush join request\n");
-   return -EFAULT;
-   }
-
-   return result;
-}
-
 int wilc_disconnect(struct wilc_vif *vif, u16 reason_code)
 {
int result = 0;
@@ -3539,24 +3494,6 @@ int wilc_set_mac_chnl_num(struct wilc_vif *vif, u8 
channel)
return 0;
 }
 
-int wilc_wait_msg_queue_idle(void)
-{
-   int result = 0;
-   struct host_if_msg msg;
-
-   memset(, 0, sizeof(struct host_if_msg));
-   msg.id = HOST_IF_MSG_Q_IDLE;
-   result = wilc_mq_send(_msg_q, , sizeof(struct host_if_msg));
-   if (result) {
-   PRINT_ER("wilc mq send fail\n");
-   result = -EINVAL;
-   }
-
-   down(_sema_wait_response);
-
-   return result;
-}
-
 int wilc_set_wfi_drv_handler(struct wilc_vif *vif, int index, u8 mac_idx)
 {
int result = 0;
@@ -4606,35 +4543,6 @@ static void *host_int_ParseJoinBssParam(tstrNetworkInfo 
*ptstrNetworkInfo)
return (void *)pNewJoinBssParam;
 }
 
-int wilc_del_all_rx_ba_session(struct wilc_vif *vif, char *bssid, char tid)
-{
-   int result = 0;
-   struct host_if_msg msg;
-   struct ba_session_info *ba_session_info = _info;
-   struct host_if_drv *hif_drv = vif->hif_drv;
-
-   if (!hif_drv) {
-   PRINT_ER("driver is null\n");
-   return -EFAULT;
-   }
-
-   memset(, 0, sizeof(struct host_if_msg));
-
-   msg.id = HOST_IF_MSG_DEL_ALL_RX_BA_SESSIONS;
-
-   memcpy(ba_session_info->bssid, bssid, ETH_ALEN);
-   ba_session_info->tid = tid;
-   msg.vif = vif;
-
-   result = wilc_mq_send(_msg_q, , sizeof(struct host_if_msg));
-   if (result)
-   PRINT_ER("wilc_mq_send fail\n");
-
-   down(_sema_wait_response);
-
-   return result;
-}
-
 int wilc_setup_ipaddress(struct wilc_vif *vif, u8 *ip_addr, u8 idx)
 {
int result = 0;
diff --git a/drivers/staging/wilc1000/host_interface.h 
b/drivers/staging/wilc1000/host_interface.h
index b828791..3302a5b 100644
--- a/drivers/staging/wilc1000/host_interface.h
+++ b/drivers/staging/wilc1000/host_interface.h
@@ -325,14 +325,11 @@ int wilc_add_rx_gtk(struct wilc_vif *vif, const u8 
*rx_gtk, u8 gtk_key_len,
 int wilc_set_pmkid_info(struct wilc_vif *vif,
struct host_if_pmkid_attr *pmkid);
 int wilc_get_mac_address(struct wilc_vif *vif, u8 *mac_addr);
-int wilc_set_mac_address(struct wilc_vif *vif, u8 *mac_addr);
-int wilc_wait_msg_queue_idle(void);
 int wilc_set_join_req(struct wilc_vif *vif, u8 *bssid, const u8 *ssid,
  size_t ssid_len, const u8 *ies, size_t ies_len,
  wilc_connect_result connect_result, void *user_arg,
  u8 security, enum AUTHTYPE auth_typ

[PATCH RESEND 01/70] staging: wilc1000: wilc_set_wfi_drv_handler: add mac index

2016-02-04 Thread Glen Lee
Firmware supports sta/ap concurrency so mac index will be passed to wilc.
Remove wilc_set_wfi_drv_handler in scan and connect functions, and call
the function in ndo_open which is wilc_mac_open.
WID_SET_DRV_HANDLER value has been changed as well.

Signed-off-by: Glen Lee <glen@atmel.com>
---
 drivers/staging/wilc1000/host_interface.c | 11 ++-
 drivers/staging/wilc1000/host_interface.h |  3 ++-
 drivers/staging/wilc1000/linux_wlan.c | 19 +++
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c |  6 ++
 drivers/staging/wilc1000/wilc_wlan_if.h   |  2 +-
 5 files changed, 30 insertions(+), 11 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index d77e2b2..7c75d0e 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -320,9 +320,9 @@ static s32 handle_set_wfi_drv_handler(struct wilc_vif *vif,
struct wid wid;
 
wid.id = (u16)WID_SET_DRV_HANDLER;
-   wid.type = WID_INT;
-   wid.val = (s8 *)_drv_handler->handler;
-   wid.size = sizeof(u32);
+   wid.type = WID_STR;
+   wid.val = (s8 *)hif_drv_handler;
+   wid.size = sizeof(*hif_drv_handler);
 
result = wilc_send_config_pkt(vif->wilc, SET_CFG, , 1,
  hif_drv_handler->handler);
@@ -3557,7 +3557,7 @@ int wilc_wait_msg_queue_idle(void)
return result;
 }
 
-int wilc_set_wfi_drv_handler(struct wilc_vif *vif, int index)
+int wilc_set_wfi_drv_handler(struct wilc_vif *vif, int index, u8 mac_idx)
 {
int result = 0;
struct host_if_msg msg;
@@ -3565,6 +3565,7 @@ int wilc_set_wfi_drv_handler(struct wilc_vif *vif, int 
index)
memset(, 0, sizeof(struct host_if_msg));
msg.id = HOST_IF_MSG_SET_WFIDRV_HANDLER;
msg.body.drv.handler = index;
+   msg.body.drv.mac_idx = mac_idx;
msg.vif = vif;
 
result = wilc_mq_send(_msg_q, , sizeof(struct host_if_msg));
@@ -3909,7 +3910,7 @@ s32 wilc_deinit(struct wilc_vif *vif)
 
del_timer_sync(_drv->remain_on_ch_timer);
 
-   wilc_set_wfi_drv_handler(vif, 0);
+   wilc_set_wfi_drv_handler(vif, 0, 0);
down(_sema_driver);
 
if (hif_drv->usr_scan_req.scan_result) {
diff --git a/drivers/staging/wilc1000/host_interface.h 
b/drivers/staging/wilc1000/host_interface.h
index 4c02e6b..b828791 100644
--- a/drivers/staging/wilc1000/host_interface.h
+++ b/drivers/staging/wilc1000/host_interface.h
@@ -217,6 +217,7 @@ struct user_conn_req {
 
 struct drv_handler {
u32 handler;
+   u8 mac_idx;
 };
 
 struct op_mode {
@@ -363,7 +364,7 @@ int wilc_remain_on_channel(struct wilc_vif *vif, u32 
session_id,
   void *user_arg);
 int wilc_listen_state_expired(struct wilc_vif *vif, u32 session_id);
 int wilc_frame_register(struct wilc_vif *vif, u16 frame_type, bool reg);
-int wilc_set_wfi_drv_handler(struct wilc_vif *vif, int index);
+int wilc_set_wfi_drv_handler(struct wilc_vif *vif, int index, u8 mac_idx);
 int wilc_set_operation_mode(struct wilc_vif *vif, u32 mode);
 int wilc_get_statistics(struct wilc_vif *vif, struct rf_info *stats);
 void wilc_resolve_disconnect_aberration(struct wilc_vif *vif);
diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index b368c2d..2fafcc4 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -1024,6 +1024,25 @@ int wilc_mac_open(struct net_device *ndev)
for (i = 0; i < wl->vif_num; i++) {
if (ndev == wl->vif[i]->ndev) {
memcpy(wl->vif[i]->src_addr, mac_add, ETH_ALEN);
+   if (vif->iftype == AP_MODE) {
+   wilc_set_wfi_drv_handler(vif,
+wilc_get_vif_idx(vif),
+0);
+   } else if (!wilc_wlan_get_num_conn_ifcs(wilc)) {
+   wilc_set_wfi_drv_handler(vif,
+wilc_get_vif_idx(vif),
+wilc->open_ifcs);
+   } else {
+   if (memcmp(wilc->vif[i ^ 1]->bssid,
+  wilc->vif[i ^ 1]->src_addr, 6))
+   wilc_set_wfi_drv_handler(vif,
+wilc_get_vif_idx(vif),
+0);
+   else
+   wilc_set_wfi_drv_handler(vif,
+wilc_get_vif_idx(vif),
+1);
+   }

[PATCH RESEND 00/70] staging: wilc1000: rebase and resend

2016-02-04 Thread Glen Lee
I rebased all the pending patches which are not accepted yet and resend them.

Chris Park (13):
  staging: wilc1000: fix warnings for line over 80 characters
  staging: wilc1000: remove useless log message
  staging: wilc1000: remove useless function
  staging: wilc1000: remove unnecessary braces
  staging: wilc1000: remove warnings missing a blank line after
declarations
  staging: wilc1000: Optimize code of wilc_get_chipid function
  staging: wilc1000: remove unused log message using the CORECONFIG_DBG
tag
  staging: wilc1000: remove unused log message using the HOSTINF_DBG tag
  staging: wilc1000: remove unused log message using the TX_DBG tag
  staging: wilc1000: remove unnecessary wilc_rx_complete function
  staging: wilc1000: remove unused log message using the RX_DBG tag
  staging: wilc1000: remove unused debug tag
  staging: wilc1000: remove unnecessary log message using GENERIC_DBG
tag

Glen Lee (14):
  staging: wilc1000: wilc_set_wfi_drv_handler: add mac index
  staging: wilc1000: remove unused functions
  staging: wilc1000: ignore power save
  staging: wilc1000: handle connecting error
  staging: wilc1000: tcp_process: fix a build warning
  staging: wilc1000: remove define TCP_ACK_FILTER
  staging: wilc1000: increase link speed
  staging: wilc1000: disable power save when AP mode
  staging: wilc1000: fix bug on p2p connection
  staging: wilc1000: add ops tx power in cfg80211
  staging: wilc1000: fix WEP security bug
  staging: wilc1000: get mac address after setting drv handler
  staging: wilc1000: move wilc_send_config_pkt to wilc_wlan.c
  staging: wilc1000: pass vif to wilc_send_config_pkt

Leo Kim (43):
  staging: wilc1000: rename hWILCWFIDrv of wilc_priv structure
  staging: wilc1000: fixes missing a blank line after declarations
  staging: wilc1000: rename pBssid of tx_complete_data structure
  staging: wilc1000: remove warnings line over 80 characters
  staging: wilc1000: removes unnecessary debug logs
  staging: wilc1000: replaces PRINT_XXX with netdev_xxx
  staging: wilc1000: removes void function return
  staging: wilc1000: renames u8IfIdx of wilc_vif structure
  staging: wilc1000: fixes variable dereferenced before check
  staging: wilc1000: wilc_parse_network_info(): renames function
variables
  staging: wilc1000: wilc_parse_network_info(): renames local variables
  staging: wilc1000: wilc_parse_network_info(): renames local inner
variables
  staging: wilc1000: rename variable s32Error
  staging: wilc1000: wilc_parse_assoc_resp_info(): renames function
variables
  staging: wilc1000: wilc_parse_assoc_resp_info(): renames local
variables
  staging: wilc1000: wilc_dealloc_assoc_resp_info(): renames function
variables
  staging: wilc1000: wilc_dealloc_network_info(): renames function
variables
  staging: wilc1000: wilc_wfi_cfgoperations.c: replaces PRINT_ER with
netdev_err
  staging: wilc1000: wilc_msgqueue.c: removes debug print log
  staging: wilc1000: wilc_wlan.c: replaces PRINT_ER with netdev_err
  staging: wilc1000: linux_mon.c: replaces PRINT_ER with netdev_err
  staging: wilc1000: removes function 'wilc_dealloc_network_info()'
  staging: wilc1000: removes function 'wilc_dealloc_assoc_resp_info()'
  staging: wilc1000: remove typedef from tstrConnectRespInfo
  staging: wilc1000: renames struct connect_resp_info variables
  staging: wilc1000: remove typedef from pstrNetworkInfo
  staging: wilc1000: renames s8rssi of connect_resp_info structure
  staging: wilc1000: renames u16CapInfo of connect_resp_info structure
  staging: wilc1000: renames au8ssid of connect_resp_info structure
  staging: wilc1000: renames u8SsidLen of connect_resp_info structure
  staging: wilc1000: renames au8bssid of connect_resp_info structure
  staging: wilc1000: renames u16BeaconPeriod of connect_resp_info
structure
  staging: wilc1000: renames u8DtimPeriod of connect_resp_info structure
  staging: wilc1000: renames u8channel of connect_resp_info structure
  staging: wilc1000: renames struct connect_resp_info variables
  staging: wilc1000: renames bNewNetwork of connect_resp_info structure
  staging: wilc1000: renames u8Found of connect_resp_info structure
  staging: wilc1000: renames u32Tsf of connect_resp_info structure
  staging: wilc1000: renames struct connect_resp_info variables
  staging: wilc1000: renames pJoinParams of connect_resp_info structure
  staging: wilc1000: renames strRssi of connect_resp_info structure
  staging: wilc1000: renames u64Tsf of connect_resp_info structure
  staging: wilc1000: remove warnings line over 80 characters

 drivers/staging/wilc1000/Makefile |   1 -
 drivers/staging/wilc1000/coreconfigurator.c   | 251 +++--
 drivers/staging/wilc1000/coreconfigurator.h   |  73 ++-
 drivers/staging/wilc1000/host_interface.c | 633 +++---
 drivers/staging/wilc1000/host_interface.h |  13 +-
 drivers/staging/wilc1000/linux_mon.c  |  30 +-
 drivers/staging/wilc1000/linux_wlan.c

[PATCH RESEND 03/70] staging: wilc1000: ignore power save

2016-02-04 Thread Glen Lee
If two interfaces are connected and it is required to enable power save then
ignore the request.

Signed-off-by: Glen Lee <glen@atmel.com>
---
 drivers/staging/wilc1000/host_interface.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 1dc6af0..7e1b5a0 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -4341,6 +4341,9 @@ int wilc_set_power_mgmt(struct wilc_vif *vif, bool 
enabled, u32 timeout)
return -EFAULT;
}
 
+   if (wilc_wlan_get_num_conn_ifcs(vif->wilc) == 2 && enabled)
+   return 0;
+
PRINT_D(HOSTINF_DBG, "Setting Power management message queue params\n");
 
memset(, 0, sizeof(struct host_if_msg));
-- 
1.9.1

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


[PATCH RESEND 06/70] staging: wilc1000: remove define TCP_ACK_FILTER

2016-02-04 Thread Glen Lee
This patch removes define TCP_ACK_FILTER and use it's feature codes.
Add argument wilc to wilc_wlan_txq_remove because compile error happens.

Signed-off-by: Glen Lee <glen@atmel.com>
---
 drivers/staging/wilc1000/Makefile|  1 -
 drivers/staging/wilc1000/wilc_wlan.c | 22 ++
 2 files changed, 2 insertions(+), 21 deletions(-)

diff --git a/drivers/staging/wilc1000/Makefile 
b/drivers/staging/wilc1000/Makefile
index 90c3760..acc3f3e 100644
--- a/drivers/staging/wilc1000/Makefile
+++ b/drivers/staging/wilc1000/Makefile
@@ -4,7 +4,6 @@ ccflags-y += -DFIRMWARE_1002=\"atmel/wilc1002_firmware.bin\" \
-DFIRMWARE_1003=\"atmel/wilc1003_firmware.bin\"
 
 ccflags-y += -I$(src)/ -DWILC_ASIC_A0 -DWILC_DEBUGFS
-#ccflags-y += -DTCP_ACK_FILTER
 
 wilc1000-objs := wilc_wfi_cfgoperations.o linux_wlan.o linux_mon.o \
wilc_msgqueue.o \
diff --git a/drivers/staging/wilc1000/wilc_wlan.c 
b/drivers/staging/wilc1000/wilc_wlan.c
index 25cf325..9442016 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -36,8 +36,7 @@ static inline void release_bus(struct wilc *wilc, 
BUS_RELEASE_T release)
mutex_unlock(>hif_cs);
 }
 
-#ifdef TCP_ACK_FILTER
-static void wilc_wlan_txq_remove(struct txq_entry_t *tqe)
+static void wilc_wlan_txq_remove(struct wilc *wilc, struct txq_entry_t *tqe)
 {
 
if (tqe == wilc->txq_head) {
@@ -54,7 +53,6 @@ static void wilc_wlan_txq_remove(struct txq_entry_t *tqe)
}
wilc->txq_entries -= 1;
 }
-#endif
 
 static struct txq_entry_t *
 wilc_wlan_txq_remove_from_head(struct net_device *dev)
@@ -146,7 +144,6 @@ static int wilc_wlan_txq_add_to_head(struct wilc *wilc, 
struct txq_entry_t *tqe)
return 0;
 }
 
-#ifdef TCP_ACK_FILTER
 struct ack_session_info;
 struct ack_session_info {
u32 seq_num;
@@ -308,7 +305,7 @@ static int wilc_wlan_txq_filter_dup_tcp_ack(struct 
net_device *dev)
pending_acks_info[i].ack_num);
tqe = pending_acks_info[i].txqe;
if (tqe) {
-   wilc_wlan_txq_remove(tqe);
+   wilc_wlan_txq_remove(wilc, tqe);
tqe->status = 1;
if (tqe->tx_complete_func)
tqe->tx_complete_func(tqe->priv,
@@ -335,7 +332,6 @@ static int wilc_wlan_txq_filter_dup_tcp_ack(struct 
net_device *dev)
 
return 1;
 }
-#endif
 
 static bool enabled = false;
 
@@ -344,12 +340,10 @@ void wilc_enable_tcp_ack_filter(bool value)
enabled = value;
 }
 
-#ifdef TCP_ACK_FILTER
 static bool is_tcp_ack_filter_enabled(void)
 {
return enabled;
 }
-#endif
 
 static int wilc_wlan_txq_add_cfg_pkt(struct wilc *wilc, u8 *buffer, u32 
buffer_size)
 {
@@ -373,9 +367,7 @@ static int wilc_wlan_txq_add_cfg_pkt(struct wilc *wilc, u8 
*buffer, u32 buffer_s
tqe->buffer_size = buffer_size;
tqe->tx_complete_func = NULL;
tqe->priv = NULL;
-#ifdef TCP_ACK_FILTER
tqe->tcp_pending_ack_idx = NOT_TCP_ACK;
-#endif
PRINT_D(TX_DBG, "Adding the config packet at the Queue tail\n");
 
if (wilc_wlan_txq_add_to_head(wilc, tqe))
@@ -406,11 +398,9 @@ int wilc_wlan_txq_add_net_pkt(struct net_device *dev, void 
*priv, u8 *buffer,
tqe->priv = priv;
 
PRINT_D(TX_DBG, "Adding mgmt packet at the Queue tail\n");
-#ifdef TCP_ACK_FILTER
tqe->tcp_pending_ack_idx = NOT_TCP_ACK;
if (is_tcp_ack_filter_enabled())
tcp_process(dev, tqe);
-#endif
wilc_wlan_txq_add_to_tail(dev, tqe);
return wilc->txq_entries;
 }
@@ -436,9 +426,7 @@ int wilc_wlan_txq_add_mgmt_pkt(struct net_device *dev, void 
*priv, u8 *buffer,
tqe->buffer_size = buffer_size;
tqe->tx_complete_func = func;
tqe->priv = priv;
-#ifdef TCP_ACK_FILTER
tqe->tcp_pending_ack_idx = NOT_TCP_ACK;
-#endif
PRINT_D(TX_DBG, "Adding Network packet at the Queue tail\n");
wilc_wlan_txq_add_to_tail(dev, tqe);
return 1;
@@ -643,9 +631,7 @@ int wilc_wlan_handle_txq(struct net_device *dev, u32 
*txq_count)
 
wilc_lock_timeout(wilc, >txq_add_to_head_cs,
CFG_PKTS_TIMEOUT);
-#ifdef TCP_ACK_FILTER
wilc_wlan_txq_filter_dup_tcp_ack(dev);
-#endif
PRINT_D(TX_DBG, "Getting the head of the TxQ\n");
tqe = wilc_wlan_txq_get_first(wilc);
i = 0;
@@ -829,10 +815,8 @@ int wilc_wlan_handle_txq(struct net_device *dev, u32 
*txq_count)
if (tqe->tx_complete_func)
tqe->tx_complete_func(tqe->priv,
  tqe->sta

[PATCH RESEND 09/70] staging: wilc1000: fix bug on p2p connection

2016-02-04 Thread Glen Lee
In case of action frame, size -7 is correct, but in this case, size should be
used as it is.

Signed-off-by: Glen Lee <glen@atmel.com>
---
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index adca14c..e178b1b 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -1728,7 +1728,7 @@ void WILC_WFI_p2p_rx (struct net_device *dev, u8 *buff, 
u32 size)
}
}
 
-   cfg80211_rx_mgmt(priv->wdev, s32Freq, 0, buff, size - 7, 0);
+   cfg80211_rx_mgmt(priv->wdev, s32Freq, 0, buff, size, 0);
}
 }
 
-- 
1.9.1

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


[PATCH RESEND 08/70] staging: wilc1000: disable power save when AP mode

2016-02-04 Thread Glen Lee
This patch disables power save mode in case of AP mode.

Signed-off-by: Glen Lee <glen@atmel.com>
---
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 4d63282..adca14c 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -2203,6 +2203,7 @@ static int start_ap(struct wiphy *wiphy, struct 
net_device *dev,
PRINT_ER("Error in setting channel\n");
 
wilc_wlan_set_bssid(dev, wl->vif[vif->u8IfIdx]->src_addr, AP_MODE);
+   wilc_set_power_mgmt(vif, 0, 0);
 
s32Error = wilc_add_beacon(vif, settings->beacon_interval,
   settings->dtim_period, beacon->head_len,
-- 
1.9.1

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


[PATCH RESEND 07/70] staging: wilc1000: increase link speed

2016-02-04 Thread Glen Lee
This patch increases throughput by enabling tcp ack filter base on checking
statistics and also handling tcp session.

Signed-off-by: Glen Lee <glen@atmel.com>
---
 drivers/staging/wilc1000/host_interface.c | 31 +--
 drivers/staging/wilc1000/wilc_wfi_netdevice.h |  2 ++
 drivers/staging/wilc1000/wilc_wlan.c  | 27 ++-
 3 files changed, 34 insertions(+), 26 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 7e1b5a0..4bbf38c 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -57,6 +57,9 @@
 #define BLOCK_ACK_REQ_SIZE  0x14
 #define FALSE_FRMWR_CHANNEL100
 
+#define TCP_ACK_FILTER_LINK_SPEED_THRESH   54
+#define DEFAULT_LINK_SPEED 72
+
 struct cfg_param_attr {
struct cfg_param_val cfg_attr_info;
 };
@@ -2187,7 +2190,14 @@ static s32 Handle_GetStatistics(struct wilc_vif *vif,
if (result)
PRINT_ER("Failed to send scan paramters config packet\n");
 
-   up(_sema_wait_response);
+   if (pstrStatistics->link_speed > TCP_ACK_FILTER_LINK_SPEED_THRESH &&
+   pstrStatistics->link_speed != DEFAULT_LINK_SPEED)
+   wilc_enable_tcp_ack_filter(true);
+   else if (pstrStatistics->link_speed != DEFAULT_LINK_SPEED)
+   wilc_enable_tcp_ack_filter(false);
+
+   if (pstrStatistics != >wilc->dummy_statistics)
+   up(_sema_wait_response);
return 0;
 }
 
@@ -3606,7 +3616,8 @@ int wilc_get_statistics(struct wilc_vif *vif, struct 
rf_info *stats)
return -EFAULT;
}
 
-   down(_sema_wait_response);
+   if (stats != >wilc->dummy_statistics)
+   down(_sema_wait_response);
return result;
 }
 
@@ -3698,21 +3709,9 @@ static void GetPeriodicRSSI(unsigned long arg)
return;
}
 
-   if (vif->hif_drv->hif_state == HOST_IF_CONNECTED) {
-   s32 result = 0;
-   struct host_if_msg msg;
-
-   memset(, 0, sizeof(struct host_if_msg));
-
-   msg.id = HOST_IF_MSG_GET_RSSI;
-   msg.vif = vif;
+   if (vif->hif_drv->hif_state == HOST_IF_CONNECTED)
+   wilc_get_statistics(vif, >wilc->dummy_statistics);
 
-   result = wilc_mq_send(_msg_q, , sizeof(struct 
host_if_msg));
-   if (result) {
-   PRINT_ER("Failed to send get host channel param's 
message queue ");
-   return;
-   }
-   }
periodic_rssi.data = (unsigned long)vif;
mod_timer(_rssi, jiffies + msecs_to_jiffies(5000));
 }
diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h 
b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
index 54e762ec..9f8c79e 100644
--- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h
+++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
@@ -217,6 +217,8 @@ struct wilc {
 
struct device *dev;
bool suspend_event;
+
+   struct rf_info dummy_statistics;
 };
 
 struct WILC_WFI_mon_priv {
diff --git a/drivers/staging/wilc1000/wilc_wlan.c 
b/drivers/staging/wilc1000/wilc_wlan.c
index 9442016..04d4c92 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -178,19 +178,21 @@ static inline int init_tcp_tracking(void)
 
 static inline int add_tcp_session(u32 src_prt, u32 dst_prt, u32 seq)
 {
-   ack_session_info[tcp_session].seq_num = seq;
-   ack_session_info[tcp_session].bigger_ack_num = 0;
-   ack_session_info[tcp_session].src_port = src_prt;
-   ack_session_info[tcp_session].dst_port = dst_prt;
-   tcp_session++;
-
+   if (tcp_session < 2 * MAX_TCP_SESSION) {
+   ack_session_info[tcp_session].seq_num = seq;
+   ack_session_info[tcp_session].bigger_ack_num = 0;
+   ack_session_info[tcp_session].src_port = src_prt;
+   ack_session_info[tcp_session].dst_port = dst_prt;
+   tcp_session++;
+   }
PRINT_D(TCP_ENH, "TCP Session %d to Ack %d\n", tcp_session, seq);
return 0;
 }
 
 static inline int update_tcp_session(u32 index, u32 ack)
 {
-   if (ack > ack_session_info[index].bigger_ack_num)
+   if (index < 2 * MAX_TCP_SESSION &&
+   ack > ack_session_info[index].bigger_ack_num)
ack_session_info[index].bigger_ack_num = ack;
return 0;
 }
@@ -198,7 +200,7 @@ static inline int update_tcp_session(u32 index, u32 ack)
 static inline int add_tcp_pending_ack(u32 ack, u32 session_index,
  struct txq_entry_t *txqe)
 {
-   if (pending_acks < MAX_PENDING_ACKS) {
+   if (pending_base + pending_acks < MAX_PENDING_ACKS) {
pending_acks_info[pendin

[PATCH RESEND 10/70] staging: wilc1000: add ops tx power in cfg80211

2016-02-04 Thread Glen Lee
This patch implements set_tx_power and get_tx_power of cfg80211_ops.
In addition, Id of HOST_IF_MSG_DEL_ALL_RX_BA_SESSIONS is changed with 37.

Signed-off-by: Glen Lee <glen@atmel.com>
---
 drivers/staging/wilc1000/host_interface.c | 88 ++-
 drivers/staging/wilc1000/host_interface.h |  2 +
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 35 +
 drivers/staging/wilc1000/wilc_wlan_if.h   |  1 +
 4 files changed, 125 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 4bbf38c..4b1d92c 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -46,7 +46,9 @@
 #define HOST_IF_MSG_DEL_BA_SESSION  34
 #define HOST_IF_MSG_Q_IDLE  35
 #define HOST_IF_MSG_DEL_ALL_STA 36
-#define HOST_IF_MSG_DEL_ALL_RX_BA_SESSIONS  34
+#define HOST_IF_MSG_DEL_ALL_RX_BA_SESSIONS  37
+#define HOST_IF_MSG_SET_TX_POWER   38
+#define HOST_IF_MSG_GET_TX_POWER   39
 #define HOST_IF_MSG_EXIT100
 
 #define HOST_IF_SCAN_TIMEOUT4000
@@ -166,6 +168,10 @@ struct sta_inactive_t {
u8 mac[6];
 };
 
+struct tx_power {
+   u8 tx_pwr;
+};
+
 union message_body {
struct scan_attr scan_info;
struct connect_attr con_info;
@@ -191,6 +197,7 @@ union message_body {
struct reg_frame reg_frame;
char *data;
struct del_all_sta del_all_sta_info;
+   struct tx_power tx_power;
 };
 
 struct host_if_msg {
@@ -2783,6 +2790,40 @@ static s32 Handle_DelAllRxBASessions(struct wilc_vif 
*vif,
return result;
 }
 
+static void handle_set_tx_pwr(struct wilc_vif *vif, u8 tx_pwr)
+{
+   int ret;
+   struct wid wid;
+
+   wid.id = (u16)WID_TX_POWER;
+   wid.type = WID_CHAR;
+   wid.val = _pwr;
+   wid.size = sizeof(char);
+
+   ret = wilc_send_config_pkt(vif->wilc, SET_CFG, , 1,
+wilc_get_vif_idx(vif));
+   if (ret)
+   netdev_err(vif->ndev, "Failed to set TX PWR\n");
+}
+
+static void handle_get_tx_pwr(struct wilc_vif *vif, u8 *tx_pwr)
+{
+   s32 ret = 0;
+   struct wid wid;
+
+   wid.id = (u16)WID_TX_POWER;
+   wid.type = WID_CHAR;
+   wid.val = (s8 *)tx_pwr;
+   wid.size = sizeof(char);
+
+   ret = wilc_send_config_pkt(vif->wilc, GET_CFG, , 1,
+wilc_get_vif_idx(vif));
+   if (ret)
+   netdev_err(vif->ndev, "Failed to get TX PWR\n");
+
+   up(_sema_wait_response);
+}
+
 static int hostIFthread(void *pvArg)
 {
u32 u32Ret;
@@ -2986,6 +3027,13 @@ static int hostIFthread(void *pvArg)
Handle_DelAllSta(msg.vif, _all_sta_info);
break;
 
+   case HOST_IF_MSG_SET_TX_POWER:
+   handle_set_tx_pwr(msg.vif, msg.body.tx_power.tx_pwr);
+   break;
+
+   case HOST_IF_MSG_GET_TX_POWER:
+   handle_get_tx_pwr(msg.vif, _power.tx_pwr);
+   break;
default:
PRINT_ER("[Host Interface] undefined Received Msg 
ID\n");
break;
@@ -4596,3 +4644,41 @@ static int host_int_get_ipaddress(struct wilc_vif *vif, 
u8 *ip_addr, u8 idx)
 
return result;
 }
+
+int wilc_set_tx_power(struct wilc_vif *vif, u8 tx_power)
+{
+   int ret = 0;
+   struct host_if_msg msg;
+
+   memset(, 0, sizeof(struct host_if_msg));
+
+   msg.id = HOST_IF_MSG_SET_TX_POWER;
+   msg.body.tx_power.tx_pwr = tx_power;
+   msg.vif = vif;
+
+   ret = wilc_mq_send(_msg_q, , sizeof(struct host_if_msg));
+   if (ret)
+   netdev_err(vif->ndev, "wilc_mq_send fail\n");
+
+   return ret;
+}
+
+int wilc_get_tx_power(struct wilc_vif *vif, u8 *tx_power)
+{
+   int ret = 0;
+   struct host_if_msg msg;
+
+   memset(, 0, sizeof(struct host_if_msg));
+
+   msg.id = HOST_IF_MSG_GET_TX_POWER;
+   msg.vif = vif;
+
+   ret = wilc_mq_send(_msg_q, , sizeof(struct host_if_msg));
+   if (ret)
+   netdev_err(vif->ndev, "Failed to get TX PWR\n");
+
+   down(_sema_wait_response);
+   *tx_power = msg.body.tx_power.tx_pwr;
+
+   return ret;
+}
diff --git a/drivers/staging/wilc1000/host_interface.h 
b/drivers/staging/wilc1000/host_interface.h
index 3302a5b..69c36a7 100644
--- a/drivers/staging/wilc1000/host_interface.h
+++ b/drivers/staging/wilc1000/host_interface.h
@@ -365,6 +365,8 @@ int wilc_set_operation_mode(struct wilc_vif *vif, u32 mode);
 int wilc_get_statistics(struct wilc_vif *vif, struct rf_info *stats);
 void wilc_resolve_disconnect_aberration(struct wilc_vif *vif);
 int wilc_get_vif_idx(struct wilc_vif *vif);
+int wilc_set_tx_power(struct wi

[PATCH RESEND 04/70] staging: wilc1000: handle connecting error

2016-02-04 Thread Glen Lee
If connection fails, wilc1000_connecting needs to be set false also and return
immediately because goto lable 'done' doesn't do anything. Remove lable 'done'
as well.

Signed-off-by: Glen Lee <glen@atmel.com>
---
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 13 ++---
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index b0350da..4d63282 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -757,8 +757,8 @@ static int connect(struct wiphy *wiphy, struct net_device 
*dev,
PRINT_D(CFG80211_DBG, "No Scan results yet\n");
else
PRINT_D(CFG80211_DBG, "Required bss not in scan 
results: Error(%d)\n", s32Error);
-
-   goto done;
+   wilc_connecting = 0;
+   return s32Error;
}
 
priv->WILC_WFI_wep_default = 0;
@@ -845,8 +845,8 @@ static int connect(struct wiphy *wiphy, struct net_device 
*dev,
} else {
s32Error = -ENOTSUPP;
PRINT_ER("Not supported cipher: Error(%d)\n", s32Error);
-
-   goto done;
+   wilc_connecting = 0;
+   return s32Error;
}
}
 
@@ -912,11 +912,10 @@ static int connect(struct wiphy *wiphy, struct net_device 
*dev,
if (s32Error != 0) {
PRINT_ER("wilc_set_join_req(): Error(%d)\n", s32Error);
s32Error = -ENOENT;
-   goto done;
+   wilc_connecting = 0;
+   return s32Error;
}
 
-done:
-
return s32Error;
 }
 
-- 
1.9.1

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


[PATCH RESEND 05/70] staging: wilc1000: tcp_process: fix a build warning

2016-02-04 Thread Glen Lee
This patch fixes build warning "flags is used uninitialized" when
TCP_ACK_FILTER is defined.

Fixes: 562ed3f1f78a ("staging/wilc1000: pass struct wilc to most linux_wlan.c 
functions")
Signed-off-by: Glen Lee <glen@atmel.com>
---
 drivers/staging/wilc1000/wilc_wlan.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/staging/wilc1000/wilc_wlan.c 
b/drivers/staging/wilc1000/wilc_wlan.c
index 5682581..25cf325 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -234,6 +234,7 @@ static inline int tcp_process(struct net_device *dev, 
struct txq_entry_t *tqe)
vif = netdev_priv(dev);
wilc = vif->wilc;
 
+   spin_lock_irqsave(>txq_spinlock, flags);
 
eth_hdr_ptr = [0];
h_proto = ntohs(*((unsigned short *)_hdr_ptr[12]));
-- 
1.9.1

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


[PATCH RESEND 11/70] staging: wilc1000: fix WEP security bug

2016-02-04 Thread Glen Lee
Station cannot connect to soft AP mode wilc when it is configured for WEP
security. This patch fixes it by setting the key index within the key value and
change the last else condition with DEFAULTKEY action case, and also do not use
WILC_WFI_wep_default index to set wep key id.

Signed-off-by: Glen Lee <glen@atmel.com>
---
 drivers/staging/wilc1000/host_interface.c | 27 +++
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c |  9 +---
 drivers/staging/wilc1000/wilc_wfi_netdevice.h |  1 -
 3 files changed, 14 insertions(+), 23 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 4b1d92c..67bcf88 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -1737,14 +1737,7 @@ static int Handle_Key(struct wilc_vif *vif,
strWIDList[1].size = sizeof(char);
strWIDList[1].val = (s8 
*)>attr.wep.auth_type;
 
-   strWIDList[2].id = (u16)WID_KEY_ID;
-   strWIDList[2].type = WID_CHAR;
-
-   strWIDList[2].val = (s8 
*)>attr.wep.index;
-   strWIDList[2].size = sizeof(char);
-
-   pu8keybuf = kmemdup(pstrHostIFkeyAttr->attr.wep.key,
-   pstrHostIFkeyAttr->attr.wep.key_len,
+   pu8keybuf = kmalloc(pstrHostIFkeyAttr->attr.wep.key_len 
+ 2,
GFP_KERNEL);
 
if (pu8keybuf == NULL) {
@@ -1752,15 +1745,21 @@ static int Handle_Key(struct wilc_vif *vif,
return -ENOMEM;
}
 
+   pu8keybuf[0] = pstrHostIFkeyAttr->attr.wep.index;
+   pu8keybuf[1] = pstrHostIFkeyAttr->attr.wep.key_len;
+
+   memcpy([2], pstrHostIFkeyAttr->attr.wep.key,
+  pstrHostIFkeyAttr->attr.wep.key_len);
+
kfree(pstrHostIFkeyAttr->attr.wep.key);
 
-   strWIDList[3].id = (u16)WID_WEP_KEY_VALUE;
-   strWIDList[3].type = WID_STR;
-   strWIDList[3].size = 
pstrHostIFkeyAttr->attr.wep.key_len;
-   strWIDList[3].val = (s8 *)pu8keybuf;
+   strWIDList[2].id = (u16)WID_WEP_KEY_VALUE;
+   strWIDList[2].type = WID_STR;
+   strWIDList[2].size = 
pstrHostIFkeyAttr->attr.wep.key_len + 2;
+   strWIDList[2].val = (s8 *)pu8keybuf;
 
result = wilc_send_config_pkt(vif->wilc, SET_CFG,
- strWIDList, 4,
+ strWIDList, 3,
  wilc_get_vif_idx(vif));
kfree(pu8keybuf);
} else if (pstrHostIFkeyAttr->action & ADDKEY) {
@@ -1797,7 +1796,7 @@ static int Handle_Key(struct wilc_vif *vif,
result = wilc_send_config_pkt(vif->wilc, SET_CFG,
  , 1,
  wilc_get_vif_idx(vif));
-   } else {
+   } else if (pstrHostIFkeyAttr->action & DEFAULTKEY) {
wid.id = (u16)WID_KEY_ID;
wid.type = WID_CHAR;
wid.val = (s8 *)>attr.wep.index;
diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index e6133fd..1907331 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -761,7 +761,6 @@ static int connect(struct wiphy *wiphy, struct net_device 
*dev,
return s32Error;
}
 
-   priv->WILC_WFI_wep_default = 0;
memset(priv->WILC_WFI_wep_key, 0, sizeof(priv->WILC_WFI_wep_key));
memset(priv->WILC_WFI_wep_key_len, 0, 
sizeof(priv->WILC_WFI_wep_key_len));
 
@@ -788,7 +787,6 @@ static int connect(struct wiphy *wiphy, struct net_device 
*dev,
for (i = 0; i < sme->key_len; i++)
PRINT_D(CORECONFIG_DBG, "WEP Key 
Value[%d] = %d\n", i, sme->key[i]);
}
-   priv->WILC_WFI_wep_default = sme->key_idx;
priv->WILC_WFI_wep_key_len[sme->key_idx] = sme->key_len;
memcpy(priv->WILC_WFI_wep_key[sme->key_idx], sme->key, 
sme->key_len);
 
@@ -806,7 +804,6 @@ static int connect(struct wiphy *wiphy, struct net_device 
*dev,
pcgroup_encrypt_val = "WEP104";
pcciph

[PATCH RESEND 14/70] staging: wilc1000: pass vif to wilc_send_config_pkt

2016-02-04 Thread Glen Lee
This patch passes vif instead of wilc to wilc_send_config_pkt and it's related
functions as well, because we need vif which is currently being used and
vif has wilc as well.
Change custom print with netdev_xxx format if there are custom print inside
the functions we have changed.

Function parameter of following functions are modified to vif.
wilc_send_config_pkt
wilc_wlan_cfg_set
wilc_wlan_cfg_get
wilc_wlan_cfg_commit
wilc_wlan_txq_add_cfg_pkt
wilc_wlan_txq_add_to_head

Signed-off-by: Glen Lee <glen@atmel.com>
---
 drivers/staging/wilc1000/host_interface.c | 94 +++
 drivers/staging/wilc1000/linux_wlan.c | 88 ++---
 drivers/staging/wilc1000/wilc_wlan.c  | 57 +++
 drivers/staging/wilc1000/wilc_wlan.h  |  7 ++-
 4 files changed, 128 insertions(+), 118 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 67bcf88..6f583a4 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -312,7 +312,7 @@ static s32 handle_set_channel(struct wilc_vif *vif,
 
PRINT_D(HOSTINF_DBG, "Setting channel\n");
 
-   result = wilc_send_config_pkt(vif->wilc, SET_CFG, , 1,
+   result = wilc_send_config_pkt(vif, SET_CFG, , 1,
  wilc_get_vif_idx(vif));
 
if (result) {
@@ -334,7 +334,7 @@ static s32 handle_set_wfi_drv_handler(struct wilc_vif *vif,
wid.val = (s8 *)hif_drv_handler;
wid.size = sizeof(*hif_drv_handler);
 
-   result = wilc_send_config_pkt(vif->wilc, SET_CFG, , 1,
+   result = wilc_send_config_pkt(vif, SET_CFG, , 1,
  hif_drv_handler->handler);
 
if (!hif_drv_handler->handler)
@@ -359,7 +359,7 @@ static s32 handle_set_operation_mode(struct wilc_vif *vif,
wid.val = (s8 *)_op_mode->mode;
wid.size = sizeof(u32);
 
-   result = wilc_send_config_pkt(vif->wilc, SET_CFG, , 1,
+   result = wilc_send_config_pkt(vif, SET_CFG, , 1,
  wilc_get_vif_idx(vif));
 
if ((hif_op_mode->mode) == IDLE_MODE)
@@ -392,7 +392,7 @@ static s32 handle_set_ip_address(struct wilc_vif *vif, u8 
*ip_addr, u8 idx)
wid.val = (u8 *)ip_addr;
wid.size = IP_ALEN;
 
-   result = wilc_send_config_pkt(vif->wilc, SET_CFG, , 1,
+   result = wilc_send_config_pkt(vif, SET_CFG, , 1,
  wilc_get_vif_idx(vif));
 
host_int_get_ipaddress(vif, firmware_ip_addr, idx);
@@ -417,7 +417,7 @@ static s32 handle_get_ip_address(struct wilc_vif *vif, u8 
idx)
wid.val = kmalloc(IP_ALEN, GFP_KERNEL);
wid.size = IP_ALEN;
 
-   result = wilc_send_config_pkt(vif->wilc, GET_CFG, , 1,
+   result = wilc_send_config_pkt(vif, GET_CFG, , 1,
  wilc_get_vif_idx(vif));
 
PRINT_INFO(HOSTINF_DBG, "%pI4\n", wid.val);
@@ -460,7 +460,7 @@ static s32 handle_set_mac_address(struct wilc_vif *vif,
wid.size = ETH_ALEN;
PRINT_D(GENERIC_DBG, "mac addr = :%pM\n", wid.val);
 
-   result = wilc_send_config_pkt(vif->wilc, SET_CFG, , 1,
+   result = wilc_send_config_pkt(vif, SET_CFG, , 1,
  wilc_get_vif_idx(vif));
if (result) {
PRINT_ER("Failed to set mac address\n");
@@ -482,7 +482,7 @@ static s32 handle_get_mac_address(struct wilc_vif *vif,
wid.val = get_mac_addr->mac_addr;
wid.size = ETH_ALEN;
 
-   result = wilc_send_config_pkt(vif->wilc, GET_CFG, , 1,
+   result = wilc_send_config_pkt(vif, GET_CFG, , 1,
  wilc_get_vif_idx(vif));
 
if (result) {
@@ -778,7 +778,7 @@ static s32 handle_cfg_param(struct wilc_vif *vif,
wid_cnt++;
}
 
-   result = wilc_send_config_pkt(vif->wilc, SET_CFG, wid_list,
+   result = wilc_send_config_pkt(vif, SET_CFG, wid_list,
  wid_cnt, wilc_get_vif_idx(vif));
 
if (result)
@@ -902,7 +902,7 @@ static s32 Handle_Scan(struct wilc_vif *vif,
else if (hif_drv->hif_state == HOST_IF_IDLE)
scan_while_connected = false;
 
-   result = wilc_send_config_pkt(vif->wilc, SET_CFG, strWIDList,
+   result = wilc_send_config_pkt(vif, SET_CFG, strWIDList,
  u32WidsCount,
  wilc_get_vif_idx(vif));
 
@@ -948,7 +948,7 @@ static s32 Handle_ScanDone(struct wilc_vif *vif,
wid.val = (s8 *)_running_scan;
wid.size = sizeof(char);
 
-   result = wilc_send_config_pkt(vif->wilc, SET_CFG, , 1,
+   result = wilc_send_config_pkt(vif, SET_CFG, , 1,
  wilc_get_vif_idx(vif));
 

[PATCH RESEND 12/70] staging: wilc1000: get mac address after setting drv handler

2016-02-04 Thread Glen Lee
This patch moves wilc_get_mac_address and address memcpy function after
calling wilc_set_wif_drv_handler to get selected mac address.

Signed-off-by: Glen Lee <glen@atmel.com>
---
 drivers/staging/wilc1000/linux_wlan.c | 9 +
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index 2fafcc4..9de57ae 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -1018,12 +1018,8 @@ int wilc_mac_open(struct net_device *ndev)
return ret;
}
 
-   wilc_get_mac_address(vif, mac_add);
-   PRINT_D(INIT_DBG, "Mac address: %pM\n", mac_add);
-
for (i = 0; i < wl->vif_num; i++) {
if (ndev == wl->vif[i]->ndev) {
-   memcpy(wl->vif[i]->src_addr, mac_add, ETH_ALEN);
if (vif->iftype == AP_MODE) {
wilc_set_wfi_drv_handler(vif,
 wilc_get_vif_idx(vif),
@@ -1044,6 +1040,11 @@ int wilc_mac_open(struct net_device *ndev)
 1);
}
wilc_set_operation_mode(vif, vif->iftype);
+
+   wilc_get_mac_address(vif, mac_add);
+   netdev_dbg(ndev, "Mac address: %pM\n", mac_add);
+   memcpy(wl->vif[i]->src_addr, mac_add, ETH_ALEN);
+
break;
}
}
-- 
1.9.1

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


[PATCH RESEND 20/70] staging: wilc1000: replaces PRINT_XXX with netdev_xxx

2016-02-04 Thread Glen Lee
From: Leo Kim <leo@atmel.com>

This patches replaces PRINT_XXX with netdev_xxx.

Signed-off-by: Leo Kim <leo@atmel.com>
Signed-off-by: Glen Lee <glen@atmel.com>
---
 drivers/staging/wilc1000/linux_wlan.c | 109 +-
 1 file changed, 54 insertions(+), 55 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index 13c6cb2..c16cc40 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -101,12 +101,12 @@ static int dev_state_ev_handler(struct notifier_block 
*this,
if (wilc_enable_ps)
wilc_set_power_mgmt(vif, 1, 0);
 
-   PRINT_D(GENERIC_DBG, "[%s] Up IP\n", dev_iface->ifa_label);
+   netdev_dbg(dev, "[%s] Up IP\n", dev_iface->ifa_label);
 
ip_addr_buf = (char *)_iface->ifa_address;
-   PRINT_D(GENERIC_DBG, "IP add=%d:%d:%d:%d\n",
-   ip_addr_buf[0], ip_addr_buf[1],
-   ip_addr_buf[2], ip_addr_buf[3]);
+   netdev_dbg(dev, "IP add=%d:%d:%d:%d\n",
+  ip_addr_buf[0], ip_addr_buf[1],
+  ip_addr_buf[2], ip_addr_buf[3]);
wilc_setup_ipaddress(vif, ip_addr_buf, vif->u8IfIdx);
 
break;
@@ -122,12 +122,12 @@ static int dev_state_ev_handler(struct notifier_block 
*this,
 
wilc_resolve_disconnect_aberration(vif);
 
-   PRINT_D(GENERIC_DBG, "[%s] Down IP\n", dev_iface->ifa_label);
+   netdev_dbg(dev, "[%s] Down IP\n", dev_iface->ifa_label);
 
ip_addr_buf = null_ip;
-   PRINT_D(GENERIC_DBG, "IP add=%d:%d:%d:%d\n",
-   ip_addr_buf[0], ip_addr_buf[1],
-   ip_addr_buf[2], ip_addr_buf[3]);
+   netdev_dbg(dev, "IP add=%d:%d:%d:%d\n",
+  ip_addr_buf[0], ip_addr_buf[1],
+  ip_addr_buf[2], ip_addr_buf[3]);
 
wilc_setup_ipaddress(vif, ip_addr_buf, vif->u8IfIdx);
 
@@ -150,7 +150,7 @@ static irqreturn_t isr_uh_routine(int irq, void *user_data)
wilc = vif->wilc;
 
if (wilc->close) {
-   PRINT_ER("Driver is CLOSING: Can't handle UH interrupt\n");
+   netdev_err(dev, "Can't handle UH interrupt\n");
return IRQ_HANDLED;
}
return IRQ_WAKE_THREAD;
@@ -160,12 +160,13 @@ static irqreturn_t isr_bh_routine(int irq, void *userdata)
 {
struct wilc_vif *vif;
struct wilc *wilc;
+   struct net_device *dev = (struct net_device *)userdata;
 
vif = netdev_priv(userdata);
wilc = vif->wilc;
 
if (wilc->close) {
-   PRINT_ER("Driver is CLOSING: Can't handle BH interrupt\n");
+   netdev_err(dev, "Can't handle BH interrupt\n");
return IRQ_HANDLED;
}
 
@@ -188,7 +189,7 @@ static int init_irq(struct net_device *dev)
wl->dev_irq_num = gpio_to_irq(wl->gpio);
} else {
ret = -1;
-   PRINT_ER("could not obtain gpio for WILC_INTR\n");
+   netdev_err(dev, "could not obtain gpio for WILC_INTR\n");
}
 
if (ret != -1 && request_threaded_irq(wl->dev_irq_num,
@@ -196,12 +197,13 @@ static int init_irq(struct net_device *dev)
  isr_bh_routine,
  IRQF_TRIGGER_LOW | IRQF_ONESHOT,
  "WILC_IRQ", dev) < 0) {
-   PRINT_ER("Failed to request IRQ for GPIO: %d\n", wl->gpio);
+   netdev_err(dev, "Failed to request IRQ GPIO: %d\n", wl->gpio);
gpio_free(wl->gpio);
ret = -1;
} else {
-   PRINT_D(INIT_DBG, "IRQ request succeeded IRQ-NUM= %d on GPIO: 
%d\n",
-   wl->dev_irq_num, wl->gpio);
+   netdev_dbg(dev,
+  "IRQ request succeeded IRQ-NUM= %d on GPIO: %d\n",
+  wl->dev_irq_num, wl->gpio);
}
 
return ret;
@@ -402,7 +404,7 @@ int wilc_wlan_get_firmware(struct net_device *dev)
goto _fail_;
 
if (request_firmware(_firmware, firmware, wilc->dev) != 0) {
-   PRINT_ER("%s - firmare not available\n", firmware);
+   netdev_err(dev, "%s - firmare not available\n", firmware);
ret = -1;
goto _fail_;
}
@@ -443,7 +445,7 @@ static int wilc1000_firmware_download(struct net_device 
*dev)
wilc = vif->wilc;
 
if (!wilc->

[PATCH RESEND 18/70] staging: wilc1000: remove warnings line over 80 characters

2016-02-04 Thread Glen Lee
From: Leo Kim <leo@atmel.com>

This patch removes the warnings reported by checkpatch.pl
for line over 80 characters.

Signed-off-by: Leo Kim <leo@atmel.com>
Signed-off-by: Glen Lee <glen@atmel.com>
---
 drivers/staging/wilc1000/linux_wlan.c | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index f5f787e..1446b19 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -25,7 +25,8 @@
 
 #include 
 
-static int dev_state_ev_handler(struct notifier_block *this, unsigned long 
event, void *ptr);
+static int dev_state_ev_handler(struct notifier_block *this,
+   unsigned long event, void *ptr);
 
 static struct notifier_block g_dev_notifier = {
.notifier_call = dev_state_ev_handler
@@ -57,7 +58,8 @@ static const struct net_device_ops wilc_netdev_ops = {
 
 };
 
-static int dev_state_ev_handler(struct notifier_block *this, unsigned long 
event, void *ptr)
+static int dev_state_ev_handler(struct notifier_block *this,
+   unsigned long event, void *ptr)
 {
struct in_ifaddr *dev_iface = (struct in_ifaddr *)ptr;
struct wilc_priv *priv;
-- 
1.9.1

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


[PATCH RESEND 25/70] staging: wilc1000: wilc_parse_network_info(): renames local variables

2016-02-04 Thread Glen Lee
From: Leo Kim 

This patch renames to avoid camelcase, changes follow are:
 - pstrNetworkInfo to network_info
 - u8MsgType to msg_type
 - u8MsgID to msg_id
 - u16MsgLen to msg_len
 - u16WidID to wid_id
 - u16WidLen to wid_len
 - pu8WidVal to wid_val

Signed-off-by: Leo Kim 
---
 drivers/staging/wilc1000/coreconfigurator.c | 67 ++---
 1 file changed, 33 insertions(+), 34 deletions(-)

diff --git a/drivers/staging/wilc1000/coreconfigurator.c 
b/drivers/staging/wilc1000/coreconfigurator.c
index 43f0a29..24afeb8 100644
--- a/drivers/staging/wilc1000/coreconfigurator.c
+++ b/drivers/staging/wilc1000/coreconfigurator.c
@@ -272,27 +272,27 @@ static u8 get_current_channel_802_11n(u8 *pu8msa, u16 
rx_len)
 
 s32 wilc_parse_network_info(u8 *msg_buffer, tstrNetworkInfo **ret_network_info)
 {
-   tstrNetworkInfo *pstrNetworkInfo = NULL;
-   u8 u8MsgType = 0;
-   u8 u8MsgID = 0;
-   u16 u16MsgLen = 0;
+   tstrNetworkInfo *network_info = NULL;
+   u8 msg_type = 0;
+   u8 msg_id = 0;
+   u16 msg_len = 0;
 
-   u16 u16WidID = (u16)WID_NIL;
-   u16 u16WidLen  = 0;
-   u8  *pu8WidVal = NULL;
+   u16 wid_id = (u16)WID_NIL;
+   u16 wid_len  = 0;
+   u8 *wid_val = NULL;
 
-   u8MsgType = msg_buffer[0];
+   msg_type = msg_buffer[0];
 
-   if ('N' != u8MsgType) {
+   if ('N' != msg_type) {
PRINT_ER("Received Message format incorrect.\n");
return -EFAULT;
}
 
-   u8MsgID = msg_buffer[1];
-   u16MsgLen = MAKE_WORD16(msg_buffer[2], msg_buffer[3]);
-   u16WidID = MAKE_WORD16(msg_buffer[4], msg_buffer[5]);
-   u16WidLen = MAKE_WORD16(msg_buffer[6], msg_buffer[7]);
-   pu8WidVal = _buffer[8];
+   msg_id = msg_buffer[1];
+   msg_len = MAKE_WORD16(msg_buffer[2], msg_buffer[3]);
+   wid_id = MAKE_WORD16(msg_buffer[4], msg_buffer[5]);
+   wid_len = MAKE_WORD16(msg_buffer[6], msg_buffer[7]);
+   wid_val = _buffer[8];
 
{
u8  *pu8msa = NULL;
@@ -304,53 +304,52 @@ s32 wilc_parse_network_info(u8 *msg_buffer, 
tstrNetworkInfo **ret_network_info)
u32 u32Tsf_Lo;
u32 u32Tsf_Hi;
 
-   pstrNetworkInfo = kzalloc(sizeof(tstrNetworkInfo), GFP_KERNEL);
-   if (!pstrNetworkInfo)
+   network_info = kzalloc(sizeof(tstrNetworkInfo), GFP_KERNEL);
+   if (!network_info)
return -ENOMEM;
 
-   pstrNetworkInfo->s8rssi = pu8WidVal[0];
+   network_info->s8rssi = wid_val[0];
 
-   pu8msa = [1];
+   pu8msa = _val[1];
 
-   rx_len = u16WidLen - 1;
-   pstrNetworkInfo->u16CapInfo = get_cap_info(pu8msa);
-   pstrNetworkInfo->u32Tsf = get_beacon_timestamp_lo(pu8msa);
-   PRINT_D(CORECONFIG_DBG, "TSF :%x\n", pstrNetworkInfo->u32Tsf);
+   rx_len = wid_len - 1;
+   network_info->u16CapInfo = get_cap_info(pu8msa);
+   network_info->u32Tsf = get_beacon_timestamp_lo(pu8msa);
+   PRINT_D(CORECONFIG_DBG, "TSF :%x\n", network_info->u32Tsf);
 
u32Tsf_Lo = get_beacon_timestamp_lo(pu8msa);
u32Tsf_Hi = get_beacon_timestamp_hi(pu8msa);
 
-   pstrNetworkInfo->u64Tsf = u32Tsf_Lo | ((u64)u32Tsf_Hi << 32);
+   network_info->u64Tsf = u32Tsf_Lo | ((u64)u32Tsf_Hi << 32);
 
-   get_ssid(pu8msa, pstrNetworkInfo->au8ssid, 
>u8SsidLen);
-   get_BSSID(pu8msa, pstrNetworkInfo->au8bssid);
+   get_ssid(pu8msa, network_info->au8ssid, 
_info->u8SsidLen);
+   get_BSSID(pu8msa, network_info->au8bssid);
 
-   pstrNetworkInfo->u8channel = get_current_channel_802_11n(pu8msa,
+   network_info->u8channel = get_current_channel_802_11n(pu8msa,
rx_len + FCS_LEN);
 
u8index = MAC_HDR_LEN + TIME_STAMP_LEN;
 
-   pstrNetworkInfo->u16BeaconPeriod = get_beacon_period(pu8msa + 
u8index);
+   network_info->u16BeaconPeriod = get_beacon_period(pu8msa + 
u8index);
 
u8index += BEACON_INTERVAL_LEN + CAP_INFO_LEN;
 
pu8TimElm = get_tim_elm(pu8msa, rx_len + FCS_LEN, u8index);
if (pu8TimElm)
-   pstrNetworkInfo->u8DtimPeriod = pu8TimElm[3];
+   network_info->u8DtimPeriod = pu8TimElm[3];
pu8IEs = [MAC_HDR_LEN + TIME_STAMP_LEN + 
BEACON_INTERVAL_LEN + CAP_INFO_LEN];
u16IEsLen = rx_len - (MAC_HDR_LEN + TIME_STAMP_LEN + 
BEACON_INTERVAL_LEN + CAP_INFO_LEN);
 
if (u16IEsLen > 0) {
-   pstrNetworkInfo->pu8IEs = kmemdup(pu8IEs, u16IEsLen,
- GFP_KERNEL);
-   if (!pstrNetworkInfo->pu8IEs)
+  

[PATCH RESEND 16/70] staging: wilc1000: fixes missing a blank line after declarations

2016-02-04 Thread Glen Lee
From: Leo Kim <leo@atmel.com>

This patch fixes the warnings reported by checkpatch.pl
for Missing a blank line after declarations.

Signed-off-by: Leo Kim <leo@atmel.com>
Signed-off-by: Glen Lee <glen@atmel.com>
---
 drivers/staging/wilc1000/linux_wlan.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index 06c79dd..5992478 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -853,6 +853,7 @@ static void wlan_deinitialize_threads(struct net_device 
*dev)
 {
struct wilc_vif *vif;
struct wilc *wl;
+
vif = netdev_priv(dev);
wl = vif->wilc;
 
@@ -1472,6 +1473,7 @@ int wilc_netdev_init(struct wilc **wilc, struct device 
*dev, int io_type,
 
{
struct wireless_dev *wdev;
+
wdev = wilc_create_wiphy(ndev, dev);
 
if (dev)
-- 
1.9.1

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


[PATCH RESEND 24/70] staging: wilc1000: wilc_parse_network_info(): renames function variables

2016-02-04 Thread Glen Lee
From: Leo Kim 

This patch renames to avoid camelcase, changes follow are:
 - pu8MsgBuffer to msg_buffer
 - ppstrNetworkInfo to ret_network_info

Signed-off-by: Leo Kim 
---
 drivers/staging/wilc1000/coreconfigurator.c | 16 
 drivers/staging/wilc1000/coreconfigurator.h |  2 +-
 2 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/wilc1000/coreconfigurator.c 
b/drivers/staging/wilc1000/coreconfigurator.c
index 6f17e2b..43f0a29 100644
--- a/drivers/staging/wilc1000/coreconfigurator.c
+++ b/drivers/staging/wilc1000/coreconfigurator.c
@@ -270,7 +270,7 @@ static u8 get_current_channel_802_11n(u8 *pu8msa, u16 
rx_len)
return 0;
 }
 
-s32 wilc_parse_network_info(u8 *pu8MsgBuffer, tstrNetworkInfo 
**ppstrNetworkInfo)
+s32 wilc_parse_network_info(u8 *msg_buffer, tstrNetworkInfo **ret_network_info)
 {
tstrNetworkInfo *pstrNetworkInfo = NULL;
u8 u8MsgType = 0;
@@ -281,18 +281,18 @@ s32 wilc_parse_network_info(u8 *pu8MsgBuffer, 
tstrNetworkInfo **ppstrNetworkInfo
u16 u16WidLen  = 0;
u8  *pu8WidVal = NULL;
 
-   u8MsgType = pu8MsgBuffer[0];
+   u8MsgType = msg_buffer[0];
 
if ('N' != u8MsgType) {
PRINT_ER("Received Message format incorrect.\n");
return -EFAULT;
}
 
-   u8MsgID = pu8MsgBuffer[1];
-   u16MsgLen = MAKE_WORD16(pu8MsgBuffer[2], pu8MsgBuffer[3]);
-   u16WidID = MAKE_WORD16(pu8MsgBuffer[4], pu8MsgBuffer[5]);
-   u16WidLen = MAKE_WORD16(pu8MsgBuffer[6], pu8MsgBuffer[7]);
-   pu8WidVal  = [8];
+   u8MsgID = msg_buffer[1];
+   u16MsgLen = MAKE_WORD16(msg_buffer[2], msg_buffer[3]);
+   u16WidID = MAKE_WORD16(msg_buffer[4], msg_buffer[5]);
+   u16WidLen = MAKE_WORD16(msg_buffer[6], msg_buffer[7]);
+   pu8WidVal = _buffer[8];
 
{
u8  *pu8msa = NULL;
@@ -350,7 +350,7 @@ s32 wilc_parse_network_info(u8 *pu8MsgBuffer, 
tstrNetworkInfo **ppstrNetworkInfo
 
}
 
-   *ppstrNetworkInfo = pstrNetworkInfo;
+   *ret_network_info = pstrNetworkInfo;
 
return 0;
 }
diff --git a/drivers/staging/wilc1000/coreconfigurator.h 
b/drivers/staging/wilc1000/coreconfigurator.h
index ee107ac..aec0779 100644
--- a/drivers/staging/wilc1000/coreconfigurator.h
+++ b/drivers/staging/wilc1000/coreconfigurator.h
@@ -120,7 +120,7 @@ typedef struct {
size_t ie_len;
 } tstrDisconnectNotifInfo;
 
-s32 wilc_parse_network_info(u8 *pu8MsgBuffer, tstrNetworkInfo 
**ppstrNetworkInfo);
+s32 wilc_parse_network_info(u8 *msg_buffer, tstrNetworkInfo 
**ret_network_info);
 s32 wilc_dealloc_network_info(tstrNetworkInfo *pstrNetworkInfo);
 
 s32 wilc_parse_assoc_resp_info(u8 *pu8Buffer, u32 u32BufferLen,
-- 
1.9.1

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


[PATCH RESEND 19/70] staging: wilc1000: removes unnecessary debug logs

2016-02-04 Thread Glen Lee
From: Leo Kim <leo@atmel.com>

This patch removes unnecessary debug logs.

Signed-off-by: Leo Kim <leo@atmel.com>
Signed-off-by: Glen Lee <glen@atmel.com>
---
 drivers/staging/wilc1000/linux_wlan.c | 154 ++
 1 file changed, 24 insertions(+), 130 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index 1446b19..13c6cb2 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -70,47 +70,32 @@ static int dev_state_ev_handler(struct notifier_block *this,
u8 null_ip[4] = {0};
char wlan_dev_name[5] = "wlan0";
 
-   if (!dev_iface || !dev_iface->ifa_dev || !dev_iface->ifa_dev->dev) {
-   PRINT_D(GENERIC_DBG, "dev_iface = NULL\n");
+   if (!dev_iface || !dev_iface->ifa_dev || !dev_iface->ifa_dev->dev)
return NOTIFY_DONE;
-   }
 
if (memcmp(dev_iface->ifa_label, "wlan0", 5) &&
-   memcmp(dev_iface->ifa_label, "p2p0", 4)) {
-   PRINT_D(GENERIC_DBG, "Interface is neither WLAN0 nor P2P0\n");
+   memcmp(dev_iface->ifa_label, "p2p0", 4))
return NOTIFY_DONE;
-   }
 
dev  = (struct net_device *)dev_iface->ifa_dev->dev;
-   if (!dev->ieee80211_ptr || !dev->ieee80211_ptr->wiphy) {
-   PRINT_D(GENERIC_DBG, "No Wireless registerd\n");
+   if (!dev->ieee80211_ptr || !dev->ieee80211_ptr->wiphy)
return NOTIFY_DONE;
-   }
+
priv = wiphy_priv(dev->ieee80211_ptr->wiphy);
-   if (!priv) {
-   PRINT_D(GENERIC_DBG, "No Wireless Priv\n");
+   if (!priv)
return NOTIFY_DONE;
-   }
+
hif_drv = (struct host_if_drv *)priv->hif_drv;
vif = netdev_priv(dev);
-   if (!vif || !hif_drv) {
-   PRINT_D(GENERIC_DBG, "No Wireless Priv\n");
+   if (!vif || !hif_drv)
return NOTIFY_DONE;
-   }
-
-   PRINT_INFO(GENERIC_DBG, "dev_state_ev_handler +++\n");
 
switch (event) {
case NETDEV_UP:
-   PRINT_D(GENERIC_DBG, "dev_state_ev_handler event=NETDEV_UP 
%p\n", dev);
-
-   PRINT_INFO(GENERIC_DBG, "\n == IP Address Obtained 
===\n\n");
-
if (vif->iftype == STATION_MODE || vif->iftype == CLIENT_MODE) {
hif_drv->IFC_UP = 1;
wilc_optaining_ip = false;
del_timer(_during_ip_timer);
-   PRINT_D(GENERIC_DBG, "IP obtained , enable scan\n");
}
 
if (wilc_enable_ps)
@@ -127,9 +112,6 @@ static int dev_state_ev_handler(struct notifier_block *this,
break;
 
case NETDEV_DOWN:
-   PRINT_D(GENERIC_DBG, "dev_state_ev_handler event=NETDEV_DOWN 
%p\n", dev);
-
-   PRINT_INFO(GENERIC_DBG, "\n == IP Address Released 
===\n\n");
if (vif->iftype == STATION_MODE || vif->iftype == CLIENT_MODE) {
hif_drv->IFC_UP = 0;
wilc_optaining_ip = false;
@@ -152,9 +134,6 @@ static int dev_state_ev_handler(struct notifier_block *this,
break;
 
default:
-   PRINT_INFO(GENERIC_DBG, "dev_state_ev_handler event=default\n");
-   PRINT_INFO(GENERIC_DBG, "[%s] unknown dev event: %lu\n", 
dev_iface->ifa_label, event);
-
break;
}
 
@@ -169,7 +148,6 @@ static irqreturn_t isr_uh_routine(int irq, void *user_data)
 
vif = netdev_priv(dev);
wilc = vif->wilc;
-   PRINT_D(INT_DBG, "Interrupt received UH\n");
 
if (wilc->close) {
PRINT_ER("Driver is CLOSING: Can't handle UH interrupt\n");
@@ -191,7 +169,6 @@ static irqreturn_t isr_bh_routine(int irq, void *userdata)
return IRQ_HANDLED;
}
 
-   PRINT_D(INT_DBG, "Interrupt received BH\n");
wilc_handle_isr(wilc);
 
return IRQ_HANDLED;
@@ -255,12 +232,9 @@ int wilc_lock_timeout(struct wilc *nic, void *vp, u32 
timeout)
/* FIXME: replace with mutex_lock or wait_for_completion */
int error = -1;
 
-   PRINT_D(LOCK_DBG, "Locking %p\n", vp);
if (vp)
error = down_timeout((struct semaphore *)vp,
 msecs_to_jiffies(timeout));
-   else
-   PRINT_ER("Failed, mutex is NULL\n");
return error;
 }
 
@@ -358,28 +332,21 @@ static int linux_wlan_txq_task(void *vp)
 
up(>txq_thread_started);
while (1) {
-   

[PATCH RESEND 17/70] staging: wilc1000: rename pBssid of tx_complete_data structure

2016-02-04 Thread Glen Lee
From: Leo Kim <leo@atmel.com>

This patch renames pBssid variable of tx_complete_data structure to bssid
to avoid camelcase.

Signed-off-by: Leo Kim <leo@atmel.com>
Signed-off-by: Glen Lee <glen@atmel.com>
---
 drivers/staging/wilc1000/linux_wlan.c   | 2 +-
 drivers/staging/wilc1000/wilc_wlan.c| 2 +-
 drivers/staging/wilc1000/wilc_wlan_if.h | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index 5992478..f5f787e 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -1193,7 +1193,7 @@ int wilc_mac_xmit(struct sk_buff *skb, struct net_device 
*ndev)
PRINT_D(TX_DBG, "Adding tx packet to TX Queue\n");
vif->netstats.tx_packets++;
vif->netstats.tx_bytes += tx_data->size;
-   tx_data->pBssid = wilc->vif[vif->u8IfIdx]->bssid;
+   tx_data->bssid = wilc->vif[vif->u8IfIdx]->bssid;
queue_count = wilc_wlan_txq_add_net_pkt(ndev, (void *)tx_data,
tx_data->buff, tx_data->size,
linux_wlan_tx_complete);
diff --git a/drivers/staging/wilc1000/wilc_wlan.c 
b/drivers/staging/wilc1000/wilc_wlan.c
index 392ef16..ebf38a5 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -809,7 +809,7 @@ int wilc_wlan_handle_txq(struct net_device *dev, u32 
*txq_count)
if (tqe->type == WILC_CFG_PKT) {
buffer_offset = 
ETH_CONFIG_PKT_HDR_OFFSET;
} else if (tqe->type == WILC_NET_PKT) {
-   char *bssid = ((struct tx_complete_data 
*)(tqe->priv))->pBssid;
+   char *bssid = ((struct tx_complete_data 
*)(tqe->priv))->bssid;
 
buffer_offset = ETH_ETHERNET_HDR_OFFSET;
memcpy([offset + 4], bssid, 6);
diff --git a/drivers/staging/wilc1000/wilc_wlan_if.h 
b/drivers/staging/wilc1000/wilc_wlan_if.h
index 455a98f..294552d 100644
--- a/drivers/staging/wilc1000/wilc_wlan_if.h
+++ b/drivers/staging/wilc1000/wilc_wlan_if.h
@@ -82,7 +82,7 @@ typedef struct {
 struct tx_complete_data {
int size;
void *buff;
-   u8 *pBssid;
+   u8 *bssid;
struct sk_buff *skb;
 };
 
-- 
1.9.1

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


[PATCH RESEND 21/70] staging: wilc1000: removes void function return

2016-02-04 Thread Glen Lee
From: Leo Kim <leo@atmel.com>

This patch removes the warning reported by checkpatch.pl
for void function return statements are not generally useful.

Signed-off-by: Leo Kim <leo@atmel.com>
Signed-off-by: Glen Lee <glen@atmel.com>
---
 drivers/staging/wilc1000/linux_wlan.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index c16cc40..5c87105 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -1047,8 +1047,6 @@ static void wilc_set_multicast_list(struct net_device 
*dev)
}
 
wilc_setup_multicast_filter(vif, true, (dev->mc.count));
-
-   return;
 }
 
 static void linux_wlan_tx_complete(void *priv, int status)
-- 
1.9.1

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


[PATCH RESEND 15/70] staging: wilc1000: rename hWILCWFIDrv of wilc_priv structure

2016-02-04 Thread Glen Lee
From: Leo Kim <leo@atmel.com>

This patch renames hWILCWFIDrv pointer variable of wilc_priv structure
to hif_drv to avoid camelcase.

Signed-off-by: Leo Kim <leo@atmel.com>
Signed-off-by: Glen Lee <glen@atmel.com>
---
 drivers/staging/wilc1000/linux_wlan.c |  8 
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 22 --
 drivers/staging/wilc1000/wilc_wfi_netdevice.h |  2 +-
 3 files changed, 17 insertions(+), 15 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index a3b4939..06c79dd 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -89,7 +89,7 @@ static int dev_state_ev_handler(struct notifier_block *this, 
unsigned long event
PRINT_D(GENERIC_DBG, "No Wireless Priv\n");
return NOTIFY_DONE;
}
-   hif_drv = (struct host_if_drv *)priv->hWILCWFIDrv;
+   hif_drv = (struct host_if_drv *)priv->hif_drv;
vif = netdev_priv(dev);
if (!vif || !hif_drv) {
PRINT_D(GENERIC_DBG, "No Wireless Priv\n");
@@ -515,7 +515,7 @@ static int linux_wlan_init_test_config(struct net_device 
*dev,
 
PRINT_D(TX_DBG, "Start configuring Firmware\n");
priv = wiphy_priv(dev->ieee80211_ptr->wiphy);
-   hif_drv = (struct host_if_drv *)priv->hWILCWFIDrv;
+   hif_drv = (struct host_if_drv *)priv->hif_drv;
PRINT_D(INIT_DBG, "Host = %p\n", hif_drv);
wilc_get_mac_address(vif, mac_add);
 
@@ -1089,7 +1089,7 @@ static void wilc_set_multicast_list(struct net_device 
*dev)
 
priv = wiphy_priv(dev->ieee80211_ptr->wiphy);
vif = netdev_priv(dev);
-   hif_drv = (struct host_if_drv *)priv->hWILCWFIDrv;
+   hif_drv = (struct host_if_drv *)priv->hif_drv;
 
if (!dev)
return;
@@ -1228,7 +1228,7 @@ int wilc_mac_close(struct net_device *ndev)
return 0;
}
 
-   hif_drv = (struct host_if_drv *)priv->hWILCWFIDrv;
+   hif_drv = (struct host_if_drv *)priv->hif_drv;
 
PRINT_D(GENERIC_DBG, "Mac close\n");
 
diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 1907331..d1cb0b2 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -512,7 +512,7 @@ static void CfgConnectResult(enum conn_event 
enuConnDisconnEvent,
dev = priv->dev;
vif = netdev_priv(dev);
wl = vif->wilc;
-   pstrWFIDrv = (struct host_if_drv *)priv->hWILCWFIDrv;
+   pstrWFIDrv = (struct host_if_drv *)priv->hif_drv;
 
if (enuConnDisconnEvent == CONN_DISCONN_EVENT_CONN_RESP) {
u16 u16ConnectStatus;
@@ -711,9 +711,11 @@ static int connect(struct wiphy *wiphy, struct net_device 
*dev,
wilc_connecting = 1;
priv = wiphy_priv(wiphy);
vif = netdev_priv(priv->dev);
-   pstrWFIDrv = (struct host_if_drv *)(priv->hWILCWFIDrv);
+   pstrWFIDrv = (struct host_if_drv *)priv->hif_drv;
 
-   PRINT_D(CFG80211_DBG, "Connecting to SSID [%s] on netdev [%p] host if 
[%p]\n", sme->ssid, dev, priv->hWILCWFIDrv);
+   PRINT_D(CFG80211_DBG,
+   "Connecting to SSID [%s] on netdev [%p] host if [%p]\n",
+   sme->ssid, dev, priv->hif_drv);
if (!(strncmp(sme->ssid, "DIRECT-", 7))) {
PRINT_D(CFG80211_DBG, "Connected to Direct network,OBSS 
disabled\n");
pstrWFIDrv->p2p_connect = 1;
@@ -928,7 +930,7 @@ static int disconnect(struct wiphy *wiphy, struct 
net_device *dev, u16 reason_co
priv = wiphy_priv(wiphy);
vif = netdev_priv(priv->dev);
 
-   pstrWFIDrv = (struct host_if_drv *)priv->hWILCWFIDrv;
+   pstrWFIDrv = (struct host_if_drv *)priv->hif_drv;
if (!pstrWFIDrv->p2p_connect)
wlan_channel = INVALID_CHANNEL;
wilc_wlan_set_bssid(priv->dev, NullBssid, STATION_MODE);
@@ -1276,7 +1278,7 @@ static int del_key(struct wiphy *wiphy, struct net_device 
*netdev,
wilc_remove_wep_key(vif, key_index);
} else {
PRINT_D(CFG80211_DBG, "Removing all installed keys\n");
-   wilc_remove_key(priv->hWILCWFIDrv, mac_addr);
+   wilc_remove_key(priv->hif_drv, mac_addr);
}
 
return 0;
@@ -1632,7 +1634,7 @@ void WILC_WFI_p2p_rx (struct net_device *dev, u8 *buff, 
u32 size)
s32 s32Freq;
 
priv = wiphy_priv(dev->ieee80211_ptr->wiphy);
-   pstrWFIDrv = (struct host_if_drv *)priv->hWILCWFIDrv;
+   pstrWFIDrv = (struct host_if_drv *)priv->hif_drv;
 
memcpy(, (buff - HOST_HDR_OFFSET), HOST_HDR_OFFSET);
 
@@ -1844,7 +1846,7 @@ 

[PATCH RESEND 13/70] staging: wilc1000: move wilc_send_config_pkt to wilc_wlan.c

2016-02-04 Thread Glen Lee
This patch moves the function wilc_send_config_pkt to wilc_wlan.c which
handles transport since the purpose of the function is sending/getting of
config information. coreconfiguator.[ch] will be rename with frame.[ch] later.
The print codes of the function is removed also and they will be implemented
with netdev_xx print format later.
struct wid need to be moved to wilc_wlan_if.h which defines configure
informations.

Signed-off-by: Glen Lee <glen@atmel.com>
---
 drivers/staging/wilc1000/coreconfigurator.c | 59 -
 drivers/staging/wilc1000/coreconfigurator.h |  9 -
 drivers/staging/wilc1000/wilc_wlan.c| 39 +++
 drivers/staging/wilc1000/wilc_wlan.h|  2 +
 drivers/staging/wilc1000/wilc_wlan_if.h |  7 
 5 files changed, 48 insertions(+), 68 deletions(-)

diff --git a/drivers/staging/wilc1000/coreconfigurator.c 
b/drivers/staging/wilc1000/coreconfigurator.c
index 49ae9b1..6f17e2b 100644
--- a/drivers/staging/wilc1000/coreconfigurator.c
+++ b/drivers/staging/wilc1000/coreconfigurator.c
@@ -433,62 +433,3 @@ s32 wilc_dealloc_assoc_resp_info(tstrConnectRespInfo 
*pstrConnectRespInfo)
 
return s32Error;
 }
-
-/**
- *  @brief  sends certain Configuration Packet based on the input 
WIDs pstrWIDs
- *  using driver config layer
- *
- *  @details
- *  @param[in]  pstrWIDs WIDs to be sent in the configuration packet
- *  @param[in]  u32WIDsCount number of WIDs to be sent in the configuration 
packet
- *  @param[out] pu8RxResp The received Packet Response
- *  @param[out] ps32RxRespLen Length of the received Packet Response
- *  @return Error code indicating success/failure
- *  @note
- *  @authormabubakr
- *  @date  1 Mar 2012
- *  @version   1.0
- */
-s32 wilc_send_config_pkt(struct wilc *wilc, u8 mode, struct wid *wids,
-u32 count, u32 drv)
-{
-   s32 counter = 0, ret = 0;
-
-   if (mode == GET_CFG) {
-   for (counter = 0; counter < count; counter++) {
-   PRINT_INFO(CORECONFIG_DBG, "Sending CFG packet 
[%d][%d]\n", !counter,
-  (counter == count - 1));
-   if (!wilc_wlan_cfg_get(wilc, !counter,
-  wids[counter].id,
-  (counter == count - 1),
-  drv)) {
-   ret = -ETIMEDOUT;
-   printk("[Sendconfigpkt]Get Timed out\n");
-   break;
-   }
-   }
-   counter = 0;
-   for (counter = 0; counter < count; counter++) {
-   wids[counter].size = wilc_wlan_cfg_get_val(
-   wids[counter].id,
-   wids[counter].val,
-   wids[counter].size);
-   }
-   } else if (mode == SET_CFG) {
-   for (counter = 0; counter < count; counter++) {
-   PRINT_D(CORECONFIG_DBG, "Sending config SET PACKET 
WID:%x\n", wids[counter].id);
-   if (!wilc_wlan_cfg_set(wilc, !counter,
-  wids[counter].id,
-  wids[counter].val,
-  wids[counter].size,
-  (counter == count - 1),
-  drv)) {
-   ret = -ETIMEDOUT;
-   printk("[Sendconfigpkt]Set Timed out\n");
-   break;
-   }
-   }
-   }
-
-   return ret;
-}
diff --git a/drivers/staging/wilc1000/coreconfigurator.h 
b/drivers/staging/wilc1000/coreconfigurator.h
index fc43d04..ee107ac 100644
--- a/drivers/staging/wilc1000/coreconfigurator.h
+++ b/drivers/staging/wilc1000/coreconfigurator.h
@@ -70,13 +70,6 @@ typedef enum {
CONNECT_STS_FORCE_16_BIT = 0x
 } tenuConnectSts;
 
-struct wid {
-   u16 id;
-   enum wid_type type;
-   s32 size;
-   s8 *val;
-};
-
 typedef struct {
u8 u8Full;
u8 u8Index;
@@ -127,8 +120,6 @@ typedef struct {
size_t ie_len;
 } tstrDisconnectNotifInfo;
 
-s32 wilc_send_config_pkt(struct wilc *wilc, u8 mode, struct wid *wids,
-u32 count, u32 drv);
 s32 wilc_parse_network_info(u8 *pu8MsgBuffer, tstrNetworkInfo 
**ppstrNetworkInfo);
 s32 wilc_dealloc_network_info(tstrNetworkInfo *pstrNetworkInfo);
 
diff --git a/drivers/staging/wilc1000/wilc_wlan.c 
b/drivers/staging/wilc1000/wilc_wlan.c
index 04d4c92..265ddfe 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -1439,6 +1439,45 @@ int wilc

[PATCH RESEND 32/70] staging: wilc1000: fix warnings for line over 80 characters

2016-02-04 Thread Glen Lee
From: Chris Park 

This patch fixes warnings reported by checkpatch.pl
for line over 80 characters

Signed-off-by: Chris Park 
Signed-off-by: Leo Kim 
---
 drivers/staging/wilc1000/wilc_wlan.c | 33 -
 drivers/staging/wilc1000/wilc_wlan.h |  3 ++-
 2 files changed, 22 insertions(+), 14 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_wlan.c 
b/drivers/staging/wilc1000/wilc_wlan.c
index ebf38a5..a6f4e15 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -113,7 +113,8 @@ static void wilc_wlan_txq_add_to_tail(struct net_device 
*dev,
up(>txq_event);
 }
 
-static int wilc_wlan_txq_add_to_head(struct wilc_vif *vif, struct txq_entry_t 
*tqe)
+static int wilc_wlan_txq_add_to_head(struct wilc_vif *vif,
+struct txq_entry_t *tqe)
 {
unsigned long flags;
struct wilc *wilc = vif->wilc;
@@ -695,8 +696,9 @@ int wilc_wlan_handle_txq(struct net_device *dev, u32 
*txq_count)
acquire_bus(wilc, ACQUIRE_AND_WAKEUP);
counter = 0;
do {
-   ret = wilc->hif_func->hif_read_reg(wilc, 
WILC_HOST_TX_CTRL,
-  );
+   ret = wilc->hif_func->hif_read_reg(wilc,
+  WILC_HOST_TX_CTRL,
+  );
if (!ret) {
wilc_debug(N_ERR, "[wilc txq]: fail can't read 
reg vmm_tbl_entry..\n");
break;
@@ -728,8 +730,9 @@ int wilc_wlan_handle_txq(struct net_device *dev, u32 
*txq_count)
break;
}
 
-   ret = wilc->hif_func->hif_write_reg(wilc, 
WILC_HOST_VMM_CTL,
-   0x2);
+   ret = wilc->hif_func->hif_write_reg(wilc,
+   WILC_HOST_VMM_CTL,
+   0x2);
if (!ret) {
wilc_debug(N_ERR, "[wilc txq]: fail can't write 
reg host_vmm_ctl..\n");
break;
@@ -1063,7 +1066,8 @@ void wilc_handle_isr(struct wilc *wilc)
 }
 EXPORT_SYMBOL_GPL(wilc_handle_isr);
 
-int wilc_wlan_firmware_download(struct wilc *wilc, const u8 *buffer, u32 
buffer_size)
+int wilc_wlan_firmware_download(struct wilc *wilc, const u8 *buffer,
+   u32 buffer_size)
 {
u32 offset;
u32 addr, size, size2, blksz;
@@ -1096,8 +1100,8 @@ int wilc_wlan_firmware_download(struct wilc *wilc, const 
u8 *buffer, u32 buffer_
size2 = blksz;
 
memcpy(dma_buffer, [offset], size2);
-   ret = wilc->hif_func->hif_block_tx(wilc, addr, 
dma_buffer,
-  size2);
+   ret = wilc->hif_func->hif_block_tx(wilc, addr,
+  dma_buffer, size2);
if (!ret)
break;
 
@@ -1233,7 +1237,8 @@ int wilc_wlan_stop(struct wilc *wilc)
}
 
do {
-   ret = wilc->hif_func->hif_read_reg(wilc, WILC_GLB_RESET_0, 
);
+   ret = wilc->hif_func->hif_read_reg(wilc,
+  WILC_GLB_RESET_0, );
if (!ret) {
PRINT_ER("Error while reading reg\n");
release_bus(wilc, RELEASE_ALLOW_SLEEP);
@@ -1246,14 +1251,16 @@ int wilc_wlan_stop(struct wilc *wilc)
PRINT_D(GENERIC_DBG, "Bit 10 not reset : Retry %d\n",
timeout);
reg &= ~BIT(10);
-   ret = wilc->hif_func->hif_write_reg(wilc, 
WILC_GLB_RESET_0,
-   reg);
+   ret = wilc->hif_func->hif_write_reg(wilc,
+   WILC_GLB_RESET_0,
+   reg);
timeout--;
} else {
PRINT_D(GENERIC_DBG, "Bit 10 reset after : Retry %d\n",
timeout);
-   ret = wilc->hif_func->hif_read_reg(wilc, 
WILC_GLB_RESET_0,
-  );
+   ret = wilc->hif_func->hif_read_reg(wilc,
+  WILC_GLB_RESET_0,
+  );
if (!ret) {

[PATCH RESEND 33/70] staging: wilc1000: remove useless log message

2016-02-04 Thread Glen Lee
From: Chris Park 

This patch remove useless log message in wilc_wlan.c file

Signed-off-by: Chris Park 
Signed-off-by: Leo Kim 
---
 drivers/staging/wilc1000/wilc_wlan.c | 128 ++-
 1 file changed, 22 insertions(+), 106 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_wlan.c 
b/drivers/staging/wilc1000/wilc_wlan.c
index a6f4e15..400d311 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -104,12 +104,9 @@ static void wilc_wlan_txq_add_to_tail(struct net_device 
*dev,
wilc->txq_tail = tqe;
}
wilc->txq_entries += 1;
-   PRINT_D(TX_DBG, "Number of entries in TxQ = %d\n", wilc->txq_entries);
 
spin_unlock_irqrestore(>txq_spinlock, flags);
 
-   PRINT_D(TX_DBG, "Wake the txq_handling\n");
-
up(>txq_event);
 }
 
@@ -137,12 +134,10 @@ static int wilc_wlan_txq_add_to_head(struct wilc_vif *vif,
wilc->txq_head = tqe;
}
wilc->txq_entries += 1;
-   netdev_dbg(vif->ndev, "Number of entries in TxQ = %d\n", 
wilc->txq_entries);
 
spin_unlock_irqrestore(>txq_spinlock, flags);
up(>txq_add_to_head_cs);
up(>txq_event);
-   netdev_dbg(vif->ndev, "Wake up the txq_handler\n");
 
return 0;
 }
@@ -188,7 +183,6 @@ static inline int add_tcp_session(u32 src_prt, u32 dst_prt, 
u32 seq)
ack_session_info[tcp_session].dst_port = dst_prt;
tcp_session++;
}
-   PRINT_D(TCP_ENH, "TCP Session %d to Ack %d\n", tcp_session, seq);
return 0;
 }
 
@@ -310,8 +304,6 @@ static int wilc_wlan_txq_filter_dup_tcp_ack(struct 
net_device *dev)
if (pending_acks_info[i].ack_num < 
ack_session_info[pending_acks_info[i].session_index].bigger_ack_num) {
struct txq_entry_t *tqe;
 
-   PRINT_D(TCP_ENH, "DROP ACK: %u\n",
-   pending_acks_info[i].ack_num);
tqe = pending_acks_info[i].txqe;
if (tqe) {
wilc_wlan_txq_remove(wilc, tqe);
@@ -379,7 +371,6 @@ static int wilc_wlan_txq_add_cfg_pkt(struct wilc_vif *vif, 
u8 *buffer,
tqe->tx_complete_func = NULL;
tqe->priv = NULL;
tqe->tcp_pending_ack_idx = NOT_TCP_ACK;
-   netdev_dbg(vif->ndev, "Adding the config packet at the Queue tail\n");
 
if (wilc_wlan_txq_add_to_head(vif, tqe))
return 0;
@@ -408,7 +399,6 @@ int wilc_wlan_txq_add_net_pkt(struct net_device *dev, void 
*priv, u8 *buffer,
tqe->tx_complete_func = func;
tqe->priv = priv;
 
-   PRINT_D(TX_DBG, "Adding mgmt packet at the Queue tail\n");
tqe->tcp_pending_ack_idx = NOT_TCP_ACK;
if (is_tcp_ack_filter_enabled())
tcp_process(dev, tqe);
@@ -438,7 +428,6 @@ int wilc_wlan_txq_add_mgmt_pkt(struct net_device *dev, void 
*priv, u8 *buffer,
tqe->tx_complete_func = func;
tqe->priv = priv;
tqe->tcp_pending_ack_idx = NOT_TCP_ACK;
-   PRINT_D(TX_DBG, "Adding Network packet at the Queue tail\n");
wilc_wlan_txq_add_to_tail(dev, tqe);
return 1;
 }
@@ -478,18 +467,15 @@ static int wilc_wlan_rxq_add(struct wilc *wilc, struct 
rxq_entry_t *rqe)
 
mutex_lock(>rxq_cs);
if (!wilc->rxq_head) {
-   PRINT_D(RX_DBG, "Add to Queue head\n");
rqe->next = NULL;
wilc->rxq_head = rqe;
wilc->rxq_tail = rqe;
} else {
-   PRINT_D(RX_DBG, "Add to Queue tail\n");
wilc->rxq_tail->next = rqe;
rqe->next = NULL;
wilc->rxq_tail = rqe;
}
wilc->rxq_entries += 1;
-   PRINT_D(RX_DBG, "Number of queue entries: %d\n", wilc->rxq_entries);
mutex_unlock(>rxq_cs);
return wilc->rxq_entries;
 }
@@ -497,7 +483,6 @@ static int wilc_wlan_rxq_add(struct wilc *wilc, struct 
rxq_entry_t *rqe)
 static struct rxq_entry_t *wilc_wlan_rxq_remove(struct wilc *wilc)
 {
 
-   PRINT_D(RX_DBG, "Getting rxQ element\n");
if (wilc->rxq_head) {
struct rxq_entry_t *rqe;
 
@@ -505,11 +490,9 @@ static struct rxq_entry_t *wilc_wlan_rxq_remove(struct 
wilc *wilc)
rqe = wilc->rxq_head;
wilc->rxq_head = wilc->rxq_head->next;
wilc->rxq_entries -= 1;
-   PRINT_D(RX_DBG, "RXQ entries decreased\n");
mutex_unlock(>rxq_cs);
return rqe;
}
-   PRINT_D(RX_DBG, "Nothing to get from Q\n");
return NULL;
 }
 
@@ -643,7 +626,6 @@ int wilc_wlan_handle_txq(struct net_device *dev, u32 
*txq_count)
wilc_lock_timeout(wilc, >txq_add_to_head_cs,
CFG_PKTS_TIMEOUT);
wilc_wlan_txq_filter_dup_tcp_ack(dev);
-   PRINT_D(TX_DBG, "Getting the 

[PATCH RESEND 30/70] staging: wilc1000: wilc_dealloc_assoc_resp_info(): renames function variables

2016-02-04 Thread Glen Lee
From: Leo Kim 

This patch renames to avoid camelcase, changes follow are:
 - pstrConnectRespInfo to connect_resp_info

Signed-off-by: Leo Kim 
---
 drivers/staging/wilc1000/coreconfigurator.c | 14 +++---
 drivers/staging/wilc1000/coreconfigurator.h |  2 +-
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/wilc1000/coreconfigurator.c 
b/drivers/staging/wilc1000/coreconfigurator.c
index c0be33d..c78da2c 100644
--- a/drivers/staging/wilc1000/coreconfigurator.c
+++ b/drivers/staging/wilc1000/coreconfigurator.c
@@ -410,20 +410,20 @@ s32 wilc_parse_assoc_resp_info(u8 *buffer, u32 buffer_len,
return 0;
 }
 
-s32 wilc_dealloc_assoc_resp_info(tstrConnectRespInfo *pstrConnectRespInfo)
+s32 wilc_dealloc_assoc_resp_info(tstrConnectRespInfo *connect_resp_info)
 {
s32 result = 0;
 
-   if (pstrConnectRespInfo) {
-   if (pstrConnectRespInfo->pu8RespIEs) {
-   kfree(pstrConnectRespInfo->pu8RespIEs);
-   pstrConnectRespInfo->pu8RespIEs = NULL;
+   if (connect_resp_info) {
+   if (connect_resp_info->pu8RespIEs) {
+   kfree(connect_resp_info->pu8RespIEs);
+   connect_resp_info->pu8RespIEs = NULL;
} else {
result = -EFAULT;
}
 
-   kfree(pstrConnectRespInfo);
-   pstrConnectRespInfo = NULL;
+   kfree(connect_resp_info);
+   connect_resp_info = NULL;
 
} else {
result = -EFAULT;
diff --git a/drivers/staging/wilc1000/coreconfigurator.h 
b/drivers/staging/wilc1000/coreconfigurator.h
index 6a2c323..ec810b5 100644
--- a/drivers/staging/wilc1000/coreconfigurator.h
+++ b/drivers/staging/wilc1000/coreconfigurator.h
@@ -124,7 +124,7 @@ s32 wilc_parse_network_info(u8 *msg_buffer, tstrNetworkInfo 
**ret_network_info);
 s32 wilc_dealloc_network_info(tstrNetworkInfo *pstrNetworkInfo);
 s32 wilc_parse_assoc_resp_info(u8 *buffer, u32 buffer_len,
   tstrConnectRespInfo **ret_connect_resp_info);
-s32 wilc_dealloc_assoc_resp_info(tstrConnectRespInfo *pstrConnectRespInfo);
+s32 wilc_dealloc_assoc_resp_info(tstrConnectRespInfo *connect_resp_info);
 void wilc_scan_complete_received(struct wilc *wilc, u8 *pu8Buffer,
 u32 u32Length);
 void wilc_network_info_received(struct wilc *wilc, u8 *pu8Buffer,
-- 
1.9.1

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


[PATCH RESEND 31/70] staging: wilc1000: wilc_dealloc_network_info(): renames function variables

2016-02-04 Thread Glen Lee
From: Leo Kim 

This patch renames to avoid camelcase, changes follow are:
 - pstrNetworkInfo to network_info

Signed-off-by: Leo Kim 
---
 drivers/staging/wilc1000/coreconfigurator.c | 14 +++---
 drivers/staging/wilc1000/coreconfigurator.h |  2 +-
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/wilc1000/coreconfigurator.c 
b/drivers/staging/wilc1000/coreconfigurator.c
index c78da2c..a0b80bf 100644
--- a/drivers/staging/wilc1000/coreconfigurator.c
+++ b/drivers/staging/wilc1000/coreconfigurator.c
@@ -354,20 +354,20 @@ s32 wilc_parse_network_info(u8 *msg_buffer, 
tstrNetworkInfo **ret_network_info)
return 0;
 }
 
-s32 wilc_dealloc_network_info(tstrNetworkInfo *pstrNetworkInfo)
+s32 wilc_dealloc_network_info(tstrNetworkInfo *network_info)
 {
s32 result = 0;
 
-   if (pstrNetworkInfo) {
-   if (pstrNetworkInfo->pu8IEs) {
-   kfree(pstrNetworkInfo->pu8IEs);
-   pstrNetworkInfo->pu8IEs = NULL;
+   if (network_info) {
+   if (network_info->pu8IEs) {
+   kfree(network_info->pu8IEs);
+   network_info->pu8IEs = NULL;
} else {
result = -EFAULT;
}
 
-   kfree(pstrNetworkInfo);
-   pstrNetworkInfo = NULL;
+   kfree(network_info);
+   network_info = NULL;
 
} else {
result = -EFAULT;
diff --git a/drivers/staging/wilc1000/coreconfigurator.h 
b/drivers/staging/wilc1000/coreconfigurator.h
index ec810b5..d801e58 100644
--- a/drivers/staging/wilc1000/coreconfigurator.h
+++ b/drivers/staging/wilc1000/coreconfigurator.h
@@ -121,7 +121,7 @@ typedef struct {
 } tstrDisconnectNotifInfo;
 
 s32 wilc_parse_network_info(u8 *msg_buffer, tstrNetworkInfo 
**ret_network_info);
-s32 wilc_dealloc_network_info(tstrNetworkInfo *pstrNetworkInfo);
+s32 wilc_dealloc_network_info(tstrNetworkInfo *network_info);
 s32 wilc_parse_assoc_resp_info(u8 *buffer, u32 buffer_len,
   tstrConnectRespInfo **ret_connect_resp_info);
 s32 wilc_dealloc_assoc_resp_info(tstrConnectRespInfo *connect_resp_info);
-- 
1.9.1

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


[PATCH RESEND 27/70] staging: wilc1000: rename variable s32Error

2016-02-04 Thread Glen Lee
From: Leo Kim 

This patch renames variable s32Error to result
to avoid CamelCase naming convention.
Also, remove the unused variable s32Error and replace with direct return.

Signed-off-by: Leo Kim 
---
 drivers/staging/wilc1000/coreconfigurator.c | 19 +--
 1 file changed, 9 insertions(+), 10 deletions(-)

diff --git a/drivers/staging/wilc1000/coreconfigurator.c 
b/drivers/staging/wilc1000/coreconfigurator.c
index 2a4e324..88e5661 100644
--- a/drivers/staging/wilc1000/coreconfigurator.c
+++ b/drivers/staging/wilc1000/coreconfigurator.c
@@ -356,30 +356,29 @@ s32 wilc_parse_network_info(u8 *msg_buffer, 
tstrNetworkInfo **ret_network_info)
 
 s32 wilc_dealloc_network_info(tstrNetworkInfo *pstrNetworkInfo)
 {
-   s32 s32Error = 0;
+   s32 result = 0;
 
if (pstrNetworkInfo) {
if (pstrNetworkInfo->pu8IEs) {
kfree(pstrNetworkInfo->pu8IEs);
pstrNetworkInfo->pu8IEs = NULL;
} else {
-   s32Error = -EFAULT;
+   result = -EFAULT;
}
 
kfree(pstrNetworkInfo);
pstrNetworkInfo = NULL;
 
} else {
-   s32Error = -EFAULT;
+   result = -EFAULT;
}
 
-   return s32Error;
+   return result;
 }
 
 s32 wilc_parse_assoc_resp_info(u8 *pu8Buffer, u32 u32BufferLen,
   tstrConnectRespInfo **ppstrConnectRespInfo)
 {
-   s32 s32Error = 0;
tstrConnectRespInfo *pstrConnectRespInfo = NULL;
u16 u16AssocRespLen = 0;
u8 *pu8IEs = NULL;
@@ -408,27 +407,27 @@ s32 wilc_parse_assoc_resp_info(u8 *pu8Buffer, u32 
u32BufferLen,
 
*ppstrConnectRespInfo = pstrConnectRespInfo;
 
-   return s32Error;
+   return 0;
 }
 
 s32 wilc_dealloc_assoc_resp_info(tstrConnectRespInfo *pstrConnectRespInfo)
 {
-   s32 s32Error = 0;
+   s32 result = 0;
 
if (pstrConnectRespInfo) {
if (pstrConnectRespInfo->pu8RespIEs) {
kfree(pstrConnectRespInfo->pu8RespIEs);
pstrConnectRespInfo->pu8RespIEs = NULL;
} else {
-   s32Error = -EFAULT;
+   result = -EFAULT;
}
 
kfree(pstrConnectRespInfo);
pstrConnectRespInfo = NULL;
 
} else {
-   s32Error = -EFAULT;
+   result = -EFAULT;
}
 
-   return s32Error;
+   return result;
 }
-- 
1.9.1

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


[PATCH RESEND 22/70] staging: wilc1000: renames u8IfIdx of wilc_vif structure

2016-02-04 Thread Glen Lee
From: Leo Kim <leo@atmel.com>

This patch renames u8IfIdx variable of wilc_vif structure to idx
to avoid camelcase.

Signed-off-by: Leo Kim <leo@atmel.com>
Signed-off-by: Glen Lee <glen@atmel.com>
---
 drivers/staging/wilc1000/host_interface.c | 2 +-
 drivers/staging/wilc1000/linux_wlan.c | 8 
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 2 +-
 drivers/staging/wilc1000/wilc_wfi_netdevice.h | 2 +-
 4 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 6f583a4..2022deb 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -281,7 +281,7 @@ static int host_int_get_ipaddress(struct wilc_vif *vif, u8 
*ip_addr, u8 idx);
  */
 int wilc_get_vif_idx(struct wilc_vif *vif)
 {
-   return vif->u8IfIdx + 1;
+   return vif->idx + 1;
 }
 
 /* We need to minus 1 from idx which is from wilc device to get real index
diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index 5c87105..9ca33536 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -107,7 +107,7 @@ static int dev_state_ev_handler(struct notifier_block *this,
netdev_dbg(dev, "IP add=%d:%d:%d:%d\n",
   ip_addr_buf[0], ip_addr_buf[1],
   ip_addr_buf[2], ip_addr_buf[3]);
-   wilc_setup_ipaddress(vif, ip_addr_buf, vif->u8IfIdx);
+   wilc_setup_ipaddress(vif, ip_addr_buf, vif->idx);
 
break;
 
@@ -129,7 +129,7 @@ static int dev_state_ev_handler(struct notifier_block *this,
   ip_addr_buf[0], ip_addr_buf[1],
   ip_addr_buf[2], ip_addr_buf[3]);
 
-   wilc_setup_ipaddress(vif, ip_addr_buf, vif->u8IfIdx);
+   wilc_setup_ipaddress(vif, ip_addr_buf, vif->idx);
 
break;
 
@@ -1104,7 +1104,7 @@ int wilc_mac_xmit(struct sk_buff *skb, struct net_device 
*ndev)
 
vif->netstats.tx_packets++;
vif->netstats.tx_bytes += tx_data->size;
-   tx_data->bssid = wilc->vif[vif->u8IfIdx]->bssid;
+   tx_data->bssid = wilc->vif[vif->idx]->bssid;
queue_count = wilc_wlan_txq_add_net_pkt(ndev, (void *)tx_data,
tx_data->buff, tx_data->size,
linux_wlan_tx_complete);
@@ -1360,7 +1360,7 @@ int wilc_netdev_init(struct wilc **wilc, struct device 
*dev, int io_type,
else
strcpy(ndev->name, "p2p%d");
 
-   vif->u8IfIdx = wl->vif_num;
+   vif->idx = wl->vif_num;
vif->wilc = *wilc;
wl->vif[i] = vif;
wl->vif[wl->vif_num]->ndev = ndev;
diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index d1cb0b2..a9181d3 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -2197,7 +2197,7 @@ static int start_ap(struct wiphy *wiphy, struct 
net_device *dev,
if (s32Error != 0)
PRINT_ER("Error in setting channel\n");
 
-   wilc_wlan_set_bssid(dev, wl->vif[vif->u8IfIdx]->src_addr, AP_MODE);
+   wilc_wlan_set_bssid(dev, wl->vif[vif->idx]->src_addr, AP_MODE);
wilc_set_power_mgmt(vif, 0, 0);
 
s32Error = wilc_add_beacon(vif, settings->beacon_interval,
diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h 
b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
index 64fcb77..07a4ff1 100644
--- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h
+++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
@@ -148,7 +148,7 @@ typedef struct {
 } struct_frame_reg;
 
 struct wilc_vif {
-   u8 u8IfIdx;
+   u8 idx;
u8 iftype;
int monitor_flag;
int mac_opened;
-- 
1.9.1

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


[PATCH RESEND 23/70] staging: wilc1000: fixes variable dereferenced before check

2016-02-04 Thread Glen Lee
From: Leo Kim <leo@atmel.com>

This patch fixes the warning reported by smatch.
 - wilc_wlan_get_firmware() warn: variable dereferenced before check 'vif'
 - wilc_set_multicast_list() warn: variable dereferenced before check 'dev'

Just delete them and no need add null check since they are net_device from
ndo_set_rx_mode of net_device_ops and vif of netdev_priv.

Signed-off-by: Leo Kim <leo@atmel.com>
Signed-off-by: Glen Lee <glen@atmel.com>
---
 drivers/staging/wilc1000/linux_wlan.c | 6 --
 1 file changed, 6 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index 9ca33536..22a2f98 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -397,9 +397,6 @@ int wilc_wlan_get_firmware(struct net_device *dev)
 
netdev_info(dev, "loading firmware %s\n", firmware);
 
-   if (!vif)
-   goto _fail_;
-
if (!(>ndev->dev))
goto _fail_;
 
@@ -1017,9 +1014,6 @@ static void wilc_set_multicast_list(struct net_device 
*dev)
vif = netdev_priv(dev);
hif_drv = (struct host_if_drv *)priv->hif_drv;
 
-   if (!dev)
-   return;
-
if (dev->flags & IFF_PROMISC)
return;
 
-- 
1.9.1

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


[PATCH RESEND 28/70] staging: wilc1000: wilc_parse_assoc_resp_info(): renames function variables

2016-02-04 Thread Glen Lee
From: Leo Kim 

This patch renames to avoid camelcase, changes follow are:
 - pu8Buffer to buffer
 - u32BufferLen to buffer_len
 - ppstrConnectRespInfo to ret_connect_resp_info

Signed-off-by: Leo Kim 
---
 drivers/staging/wilc1000/coreconfigurator.c | 16 
 drivers/staging/wilc1000/coreconfigurator.h |  5 ++---
 2 files changed, 10 insertions(+), 11 deletions(-)

diff --git a/drivers/staging/wilc1000/coreconfigurator.c 
b/drivers/staging/wilc1000/coreconfigurator.c
index 88e5661..48c8573 100644
--- a/drivers/staging/wilc1000/coreconfigurator.c
+++ b/drivers/staging/wilc1000/coreconfigurator.c
@@ -376,8 +376,8 @@ s32 wilc_dealloc_network_info(tstrNetworkInfo 
*pstrNetworkInfo)
return result;
 }
 
-s32 wilc_parse_assoc_resp_info(u8 *pu8Buffer, u32 u32BufferLen,
-  tstrConnectRespInfo **ppstrConnectRespInfo)
+s32 wilc_parse_assoc_resp_info(u8 *buffer, u32 buffer_len,
+  tstrConnectRespInfo **ret_connect_resp_info)
 {
tstrConnectRespInfo *pstrConnectRespInfo = NULL;
u16 u16AssocRespLen = 0;
@@ -388,14 +388,14 @@ s32 wilc_parse_assoc_resp_info(u8 *pu8Buffer, u32 
u32BufferLen,
if (!pstrConnectRespInfo)
return -ENOMEM;
 
-   u16AssocRespLen = (u16)u32BufferLen;
+   u16AssocRespLen = (u16)buffer_len;
 
-   pstrConnectRespInfo->u16ConnectStatus = get_asoc_status(pu8Buffer);
+   pstrConnectRespInfo->u16ConnectStatus = get_asoc_status(buffer);
if (pstrConnectRespInfo->u16ConnectStatus == SUCCESSFUL_STATUSCODE) {
-   pstrConnectRespInfo->u16capability = 
get_assoc_resp_cap_info(pu8Buffer);
-   pstrConnectRespInfo->u16AssocID = get_asoc_id(pu8Buffer);
+   pstrConnectRespInfo->u16capability = 
get_assoc_resp_cap_info(buffer);
+   pstrConnectRespInfo->u16AssocID = get_asoc_id(buffer);
 
-   pu8IEs = [CAP_INFO_LEN + STATUS_CODE_LEN + AID_LEN];
+   pu8IEs = [CAP_INFO_LEN + STATUS_CODE_LEN + AID_LEN];
u16IEsLen = u16AssocRespLen - (CAP_INFO_LEN + STATUS_CODE_LEN + 
AID_LEN);
 
pstrConnectRespInfo->pu8RespIEs = kmemdup(pu8IEs, u16IEsLen, 
GFP_KERNEL);
@@ -405,7 +405,7 @@ s32 wilc_parse_assoc_resp_info(u8 *pu8Buffer, u32 
u32BufferLen,
pstrConnectRespInfo->u16RespIEsLen = u16IEsLen;
}
 
-   *ppstrConnectRespInfo = pstrConnectRespInfo;
+   *ret_connect_resp_info = pstrConnectRespInfo;
 
return 0;
 }
diff --git a/drivers/staging/wilc1000/coreconfigurator.h 
b/drivers/staging/wilc1000/coreconfigurator.h
index aec0779..6a2c323 100644
--- a/drivers/staging/wilc1000/coreconfigurator.h
+++ b/drivers/staging/wilc1000/coreconfigurator.h
@@ -122,9 +122,8 @@ typedef struct {
 
 s32 wilc_parse_network_info(u8 *msg_buffer, tstrNetworkInfo 
**ret_network_info);
 s32 wilc_dealloc_network_info(tstrNetworkInfo *pstrNetworkInfo);
-
-s32 wilc_parse_assoc_resp_info(u8 *pu8Buffer, u32 u32BufferLen,
-  tstrConnectRespInfo **ppstrConnectRespInfo);
+s32 wilc_parse_assoc_resp_info(u8 *buffer, u32 buffer_len,
+  tstrConnectRespInfo **ret_connect_resp_info);
 s32 wilc_dealloc_assoc_resp_info(tstrConnectRespInfo *pstrConnectRespInfo);
 void wilc_scan_complete_received(struct wilc *wilc, u8 *pu8Buffer,
 u32 u32Length);
-- 
1.9.1

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


[PATCH RESEND 29/70] staging: wilc1000: wilc_parse_assoc_resp_info(): renames local variables

2016-02-04 Thread Glen Lee
From: Leo Kim 

This patch renames to avoid camelcase, changes follow are:
 - pstrConnectRespInfo to connect_resp_info
 - u16AssocRespLen to assoc_resp_len
 - pu8IEs to ies
 - u16IEsLen to ies_len

Signed-off-by: Leo Kim 
---
 drivers/staging/wilc1000/coreconfigurator.c | 34 ++---
 1 file changed, 17 insertions(+), 17 deletions(-)

diff --git a/drivers/staging/wilc1000/coreconfigurator.c 
b/drivers/staging/wilc1000/coreconfigurator.c
index 48c8573..c0be33d 100644
--- a/drivers/staging/wilc1000/coreconfigurator.c
+++ b/drivers/staging/wilc1000/coreconfigurator.c
@@ -379,33 +379,33 @@ s32 wilc_dealloc_network_info(tstrNetworkInfo 
*pstrNetworkInfo)
 s32 wilc_parse_assoc_resp_info(u8 *buffer, u32 buffer_len,
   tstrConnectRespInfo **ret_connect_resp_info)
 {
-   tstrConnectRespInfo *pstrConnectRespInfo = NULL;
-   u16 u16AssocRespLen = 0;
-   u8 *pu8IEs = NULL;
-   u16 u16IEsLen = 0;
+   tstrConnectRespInfo *connect_resp_info = NULL;
+   u16 assoc_resp_len = 0;
+   u8 *ies = NULL;
+   u16 ies_len = 0;
 
-   pstrConnectRespInfo = kzalloc(sizeof(tstrConnectRespInfo), GFP_KERNEL);
-   if (!pstrConnectRespInfo)
+   connect_resp_info = kzalloc(sizeof(tstrConnectRespInfo), GFP_KERNEL);
+   if (!connect_resp_info)
return -ENOMEM;
 
-   u16AssocRespLen = (u16)buffer_len;
+   assoc_resp_len = (u16)buffer_len;
 
-   pstrConnectRespInfo->u16ConnectStatus = get_asoc_status(buffer);
-   if (pstrConnectRespInfo->u16ConnectStatus == SUCCESSFUL_STATUSCODE) {
-   pstrConnectRespInfo->u16capability = 
get_assoc_resp_cap_info(buffer);
-   pstrConnectRespInfo->u16AssocID = get_asoc_id(buffer);
+   connect_resp_info->u16ConnectStatus = get_asoc_status(buffer);
+   if (connect_resp_info->u16ConnectStatus == SUCCESSFUL_STATUSCODE) {
+   connect_resp_info->u16capability = 
get_assoc_resp_cap_info(buffer);
+   connect_resp_info->u16AssocID = get_asoc_id(buffer);
 
-   pu8IEs = [CAP_INFO_LEN + STATUS_CODE_LEN + AID_LEN];
-   u16IEsLen = u16AssocRespLen - (CAP_INFO_LEN + STATUS_CODE_LEN + 
AID_LEN);
+   ies = [CAP_INFO_LEN + STATUS_CODE_LEN + AID_LEN];
+   ies_len = assoc_resp_len - (CAP_INFO_LEN + STATUS_CODE_LEN + 
AID_LEN);
 
-   pstrConnectRespInfo->pu8RespIEs = kmemdup(pu8IEs, u16IEsLen, 
GFP_KERNEL);
-   if (!pstrConnectRespInfo->pu8RespIEs)
+   connect_resp_info->pu8RespIEs = kmemdup(ies, ies_len, 
GFP_KERNEL);
+   if (!connect_resp_info->pu8RespIEs)
return -ENOMEM;
 
-   pstrConnectRespInfo->u16RespIEsLen = u16IEsLen;
+   connect_resp_info->u16RespIEsLen = ies_len;
}
 
-   *ret_connect_resp_info = pstrConnectRespInfo;
+   *ret_connect_resp_info = connect_resp_info;
 
return 0;
 }
-- 
1.9.1

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


[PATCH RESEND 26/70] staging: wilc1000: wilc_parse_network_info(): renames local inner variables

2016-02-04 Thread Glen Lee
From: Leo Kim 

This patch renames to avoid camelcase, changes follow are:
 - pu8TimElm to tim_elm
 - pu8IEs to ies
 - u16IEsLen to ies_len
 - u32Tsf_Lo to tsf_lo
 - u32Tsf_Hi to tsf_hi

And, remove the prefix variable defined name, below are:
 - u8index to index
 - pu8msa to msa

Signed-off-by: Leo Kim 
---
 drivers/staging/wilc1000/coreconfigurator.c | 54 ++---
 1 file changed, 27 insertions(+), 27 deletions(-)

diff --git a/drivers/staging/wilc1000/coreconfigurator.c 
b/drivers/staging/wilc1000/coreconfigurator.c
index 24afeb8..2a4e324 100644
--- a/drivers/staging/wilc1000/coreconfigurator.c
+++ b/drivers/staging/wilc1000/coreconfigurator.c
@@ -295,14 +295,14 @@ s32 wilc_parse_network_info(u8 *msg_buffer, 
tstrNetworkInfo **ret_network_info)
wid_val = _buffer[8];
 
{
-   u8  *pu8msa = NULL;
+   u8 *msa = NULL;
u16 rx_len = 0;
-   u8 *pu8TimElm = NULL;
-   u8 *pu8IEs = NULL;
-   u16 u16IEsLen = 0;
-   u8 u8index = 0;
-   u32 u32Tsf_Lo;
-   u32 u32Tsf_Hi;
+   u8 *tim_elm = NULL;
+   u8 *ies = NULL;
+   u16 ies_len = 0;
+   u8 index = 0;
+   u32 tsf_lo;
+   u32 tsf_hi;
 
network_info = kzalloc(sizeof(tstrNetworkInfo), GFP_KERNEL);
if (!network_info)
@@ -310,43 +310,43 @@ s32 wilc_parse_network_info(u8 *msg_buffer, 
tstrNetworkInfo **ret_network_info)
 
network_info->s8rssi = wid_val[0];
 
-   pu8msa = _val[1];
+   msa = _val[1];
 
rx_len = wid_len - 1;
-   network_info->u16CapInfo = get_cap_info(pu8msa);
-   network_info->u32Tsf = get_beacon_timestamp_lo(pu8msa);
+   network_info->u16CapInfo = get_cap_info(msa);
+   network_info->u32Tsf = get_beacon_timestamp_lo(msa);
PRINT_D(CORECONFIG_DBG, "TSF :%x\n", network_info->u32Tsf);
 
-   u32Tsf_Lo = get_beacon_timestamp_lo(pu8msa);
-   u32Tsf_Hi = get_beacon_timestamp_hi(pu8msa);
+   tsf_lo = get_beacon_timestamp_lo(msa);
+   tsf_hi = get_beacon_timestamp_hi(msa);
 
-   network_info->u64Tsf = u32Tsf_Lo | ((u64)u32Tsf_Hi << 32);
+   network_info->u64Tsf = tsf_lo | ((u64)tsf_hi << 32);
 
-   get_ssid(pu8msa, network_info->au8ssid, 
_info->u8SsidLen);
-   get_BSSID(pu8msa, network_info->au8bssid);
+   get_ssid(msa, network_info->au8ssid, _info->u8SsidLen);
+   get_BSSID(msa, network_info->au8bssid);
 
-   network_info->u8channel = get_current_channel_802_11n(pu8msa,
+   network_info->u8channel = get_current_channel_802_11n(msa,
rx_len + FCS_LEN);
 
-   u8index = MAC_HDR_LEN + TIME_STAMP_LEN;
+   index = MAC_HDR_LEN + TIME_STAMP_LEN;
 
-   network_info->u16BeaconPeriod = get_beacon_period(pu8msa + 
u8index);
+   network_info->u16BeaconPeriod = get_beacon_period(msa + index);
 
-   u8index += BEACON_INTERVAL_LEN + CAP_INFO_LEN;
+   index += BEACON_INTERVAL_LEN + CAP_INFO_LEN;
 
-   pu8TimElm = get_tim_elm(pu8msa, rx_len + FCS_LEN, u8index);
-   if (pu8TimElm)
-   network_info->u8DtimPeriod = pu8TimElm[3];
-   pu8IEs = [MAC_HDR_LEN + TIME_STAMP_LEN + 
BEACON_INTERVAL_LEN + CAP_INFO_LEN];
-   u16IEsLen = rx_len - (MAC_HDR_LEN + TIME_STAMP_LEN + 
BEACON_INTERVAL_LEN + CAP_INFO_LEN);
+   tim_elm = get_tim_elm(msa, rx_len + FCS_LEN, index);
+   if (tim_elm)
+   network_info->u8DtimPeriod = tim_elm[3];
+   ies = [MAC_HDR_LEN + TIME_STAMP_LEN + BEACON_INTERVAL_LEN + 
CAP_INFO_LEN];
+   ies_len = rx_len - (MAC_HDR_LEN + TIME_STAMP_LEN + 
BEACON_INTERVAL_LEN + CAP_INFO_LEN);
 
-   if (u16IEsLen > 0) {
-   network_info->pu8IEs = kmemdup(pu8IEs, u16IEsLen,
+   if (ies_len > 0) {
+   network_info->pu8IEs = kmemdup(ies, ies_len,
   GFP_KERNEL);
if (!network_info->pu8IEs)
return -ENOMEM;
}
-   network_info->u16IEsLen = u16IEsLen;
+   network_info->u16IEsLen = ies_len;
}
 
*ret_network_info = network_info;
-- 
1.9.1

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


[PATCH RESEND 37/70] staging: wilc1000: Optimize code of wilc_get_chipid function

2016-02-04 Thread Glen Lee
From: Chris Park 

This patch optimize code of wilc_get_chipid function.
u8 type changed to boolean type and removed unnecessary if statement.

Signed-off-by: Chris Park 
Signed-off-by: Leo Kim 
---
 drivers/staging/wilc1000/linux_wlan.c   |  4 ++--
 drivers/staging/wilc1000/wilc_wlan.c| 19 +++
 drivers/staging/wilc1000/wilc_wlan_if.h |  2 +-
 3 files changed, 10 insertions(+), 15 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index 22a2f98..9e5dea4 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -388,7 +388,7 @@ int wilc_wlan_get_firmware(struct net_device *dev)
vif = netdev_priv(dev);
wilc = vif->wilc;
 
-   chip_id = wilc_get_chipid(wilc, 0);
+   chip_id = wilc_get_chipid(wilc, false);
 
if (chip_id < 0x1003a0)
firmware = FIRMWARE_1002;
@@ -475,7 +475,7 @@ static int linux_wlan_init_test_config(struct net_device 
*dev,
wilc_get_mac_address(vif, mac_add);
 
netdev_dbg(dev, "MAC address is : %pM\n", mac_add);
-   wilc_get_chipid(wilc, 0);
+   wilc_get_chipid(wilc, false);
 
*(int *)c_val = 1;
 
diff --git a/drivers/staging/wilc1000/wilc_wlan.c 
b/drivers/staging/wilc1000/wilc_wlan.c
index dc26322..46087e2 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -1441,36 +1441,31 @@ static u32 init_chip(struct net_device *dev)
return ret;
 }
 
-u32 wilc_get_chipid(struct wilc *wilc, u8 update)
+u32 wilc_get_chipid(struct wilc *wilc, bool update)
 {
static u32 chipid;
u32 tempchipid = 0;
-   u32 rfrevid;
+   u32 rfrevid = 0;
 
-   if (chipid == 0 || update != 0) {
+   if (chipid == 0 || update) {
wilc->hif_func->hif_read_reg(wilc, 0x1000, );
wilc->hif_func->hif_read_reg(wilc, 0x13f4, );
if (!ISWILC1000(tempchipid)) {
chipid = 0;
-   goto _fail_;
+   return chipid;
}
if (tempchipid == 0x1002a0) {
-   if (rfrevid == 0x1) {
-   } else {
+   if (rfrevid != 0x1)
tempchipid = 0x1002a1;
-   }
} else if (tempchipid == 0x1002b0) {
-   if (rfrevid == 3) {
-   } else if (rfrevid == 4) {
+   if (rfrevid == 0x4)
tempchipid = 0x1002b1;
-   } else {
+   else if (rfrevid != 0x3)
tempchipid = 0x1002b2;
-   }
}
 
chipid = tempchipid;
}
-_fail_:
return chipid;
 }
 
diff --git a/drivers/staging/wilc1000/wilc_wlan_if.h 
b/drivers/staging/wilc1000/wilc_wlan_if.h
index 294552d..269c56e 100644
--- a/drivers/staging/wilc1000/wilc_wlan_if.h
+++ b/drivers/staging/wilc1000/wilc_wlan_if.h
@@ -921,6 +921,6 @@ struct wilc;
 int wilc_wlan_init(struct net_device *dev);
 void wilc_bus_set_max_speed(void);
 void wilc_bus_set_default_speed(void);
-u32 wilc_get_chipid(struct wilc *wilc, u8 update);
+u32 wilc_get_chipid(struct wilc *wilc, bool update);
 
 #endif
-- 
1.9.1

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


[PATCH RESEND 34/70] staging: wilc1000: remove useless function

2016-02-04 Thread Glen Lee
From: Chris Park 

This patch remove useless function remove_TCP_related
in wilc_wlan.c file

Signed-off-by: Chris Park 
Signed-off-by: Leo Kim 
---
 drivers/staging/wilc1000/wilc_wlan.c | 9 -
 1 file changed, 9 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_wlan.c 
b/drivers/staging/wilc1000/wilc_wlan.c
index 400d311..8618e27 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -206,15 +206,6 @@ static inline int add_tcp_pending_ack(u32 ack, u32 
session_index,
}
return 0;
 }
-static inline int remove_TCP_related(struct wilc *wilc)
-{
-   unsigned long flags;
-
-   spin_lock_irqsave(>txq_spinlock, flags);
-
-   spin_unlock_irqrestore(>txq_spinlock, flags);
-   return 0;
-}
 
 static inline int tcp_process(struct net_device *dev, struct txq_entry_t *tqe)
 {
-- 
1.9.1

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


[PATCH RESEND 35/70] staging: wilc1000: remove unnecessary braces

2016-02-04 Thread Glen Lee
From: Chris Park 

This patch remove warnings reported by checkpatch.pl
for unnecessary braces

Signed-off-by: Chris Park 
Signed-off-by: Leo Kim 
---
 drivers/staging/wilc1000/wilc_wlan.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_wlan.c 
b/drivers/staging/wilc1000/wilc_wlan.c
index 8618e27..e2c84db 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -984,15 +984,15 @@ void wilc_handle_isr(struct wilc *wilc)
if (int_status & PLL_INT_EXT)
wilc_pllupdate_isr_ext(wilc, int_status);
 
-   if (int_status & DATA_INT_EXT) {
+   if (int_status & DATA_INT_EXT)
wilc_wlan_handle_isr_ext(wilc, int_status);
-   }
+
if (int_status & SLEEP_INT_EXT)
wilc_sleeptimer_isr_ext(wilc, int_status);
 
-   if (!(int_status & (ALL_INT_EXT))) {
+   if (!(int_status & (ALL_INT_EXT)))
wilc_unknown_isr_ext(wilc);
-   }
+
release_bus(wilc, RELEASE_ALLOW_SLEEP);
 }
 EXPORT_SYMBOL_GPL(wilc_handle_isr);
-- 
1.9.1

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


[PATCH RESEND 36/70] staging: wilc1000: remove warnings missing a blank line after declarations

2016-02-04 Thread Glen Lee
From: Chris Park 

This patch remove warnings reported by checkpatch.pl
for missing a blank line after declarations

Signed-off-by: Chris Park 
Signed-off-by: Leo Kim 
---
 drivers/staging/wilc1000/wilc_wlan.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/staging/wilc1000/wilc_wlan.c 
b/drivers/staging/wilc1000/wilc_wlan.c
index e2c84db..dc26322 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -1143,6 +1143,7 @@ int wilc_wlan_stop(struct wilc *wilc)
u32 reg = 0;
int ret;
u8 timeout = 10;
+
acquire_bus(wilc, ACQUIRE_AND_WAKEUP);
 
ret = wilc->hif_func->hif_read_reg(wilc, WILC_GLB_RESET_0, );
-- 
1.9.1

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


[PATCH RESEND 39/70] staging: wilc1000: wilc_msgqueue.c: removes debug print log

2016-02-04 Thread Glen Lee
From: Leo Kim 

This patches removes unnecessary debug print logs.

Signed-off-by: Leo Kim 
---
 drivers/staging/wilc1000/wilc_msgqueue.c | 18 --
 1 file changed, 4 insertions(+), 14 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_msgqueue.c 
b/drivers/staging/wilc1000/wilc_msgqueue.c
index 5fe85eb..780ddd3 100644
--- a/drivers/staging/wilc1000/wilc_msgqueue.c
+++ b/drivers/staging/wilc1000/wilc_msgqueue.c
@@ -60,15 +60,11 @@ int wilc_mq_send(struct message_queue *mq,
unsigned long flags;
struct message *new_msg = NULL;
 
-   if ((!mq) || (send_buf_size == 0) || (!send_buf)) {
-   PRINT_ER("mq or send_buf is null\n");
+   if (!mq || (send_buf_size == 0) || !send_buf)
return -EINVAL;
-   }
 
-   if (mq->exiting) {
-   PRINT_ER("mq fail\n");
+   if (mq->exiting)
return -EFAULT;
-   }
 
/* construct a new message */
new_msg = kmalloc(sizeof(*new_msg), GFP_ATOMIC);
@@ -107,15 +103,11 @@ int wilc_mq_recv(struct message_queue *mq,
struct message *msg;
unsigned long flags;
 
-   if ((!mq) || (recv_buf_size == 0) || (!recv_buf) || (!recv_len)) {
-   PRINT_ER("mq or recv_buf is null\n");
+   if (!mq || (recv_buf_size == 0) || !recv_buf || !recv_len)
return -EINVAL;
-   }
 
-   if (mq->exiting) {
-   PRINT_ER("mq fail\n");
+   if (mq->exiting)
return -EFAULT;
-   }
 
spin_lock_irqsave(>lock, flags);
mq->recv_count++;
@@ -127,7 +119,6 @@ int wilc_mq_recv(struct message_queue *mq,
if (list_empty(>msg_list)) {
spin_unlock_irqrestore(>lock, flags);
up(>sem);
-   PRINT_ER("msg is null\n");
return -EFAULT;
}
/* check buffer size */
@@ -135,7 +126,6 @@ int wilc_mq_recv(struct message_queue *mq,
if (recv_buf_size < msg->len) {
spin_unlock_irqrestore(>lock, flags);
up(>sem);
-   PRINT_ER("recv_buf_size overflow\n");
return -EOVERFLOW;
}
 
-- 
1.9.1

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


  1   2   3   4   5   6   7   8   9   10   >