Re: [PATCH] memory_hotplug: Free pages as higher order

2018-09-24 Thread Arun KS

On 2018-09-21 21:12, Dan Williams wrote:

On Fri, Sep 21, 2018 at 2:40 AM Arun KS  wrote:


When free pages are done with higher order, time spend on
coalescing pages by buddy allocator can be reduced. With
section size of 256MB, hot add latency of a single section
shows improvement from 50-60 ms to less than 1 ms, hence
improving the hot add latency by 60%.

Modify external providers of online callback to align with
the change.

Signed-off-by: Arun KS 

---

Changes since RFC:
- Rebase.
- As suggested by Michal Hocko remove pages_per_block.
- Modifed external providers of online_page_callback.

RFC:
https://lore.kernel.org/patchwork/patch/984754/
---
 drivers/hv/hv_balloon.c|  6 +++--
 drivers/xen/balloon.c  | 18 +++---
 include/linux/memory_hotplug.h |  2 +-
 mm/memory_hotplug.c| 55 
+-

 4 files changed, 63 insertions(+), 18 deletions(-)

diff --git a/drivers/hv/hv_balloon.c b/drivers/hv/hv_balloon.c
index b1b7880..c5bc0b5 100644
--- a/drivers/hv/hv_balloon.c
+++ b/drivers/hv/hv_balloon.c
@@ -771,7 +771,7 @@ static void hv_mem_hot_add(unsigned long start, 
unsigned long size,

}
 }

-static void hv_online_page(struct page *pg)
+static int hv_online_page(struct page *pg, unsigned int order)
 {
struct hv_hotadd_state *has;
unsigned long flags;
@@ -783,10 +783,12 @@ static void hv_online_page(struct page *pg)
if ((pfn < has->start_pfn) || (pfn >= has->end_pfn))
continue;

-   hv_page_online_one(has, pg);
+   hv_bring_pgs_online(has, pfn, (1UL << order));
break;
}
spin_unlock_irqrestore(&dm_device.ha_lock, flags);
+
+   return 0;
 }

 static int pfn_covered(unsigned long start_pfn, unsigned long 
pfn_cnt)

diff --git a/drivers/xen/balloon.c b/drivers/xen/balloon.c
index e12bb25..010cf4d 100644
--- a/drivers/xen/balloon.c
+++ b/drivers/xen/balloon.c
@@ -390,8 +390,8 @@ static enum bp_state 
reserve_additional_memory(void)


/*
 * add_memory_resource() will call online_pages() which in its 
turn
-* will call xen_online_page() callback causing deadlock if we 
don't
-* release balloon_mutex here. Unlocking here is safe because 
the
+* will call xen_bring_pgs_online() callback causing deadlock 
if we
+* don't release balloon_mutex here. Unlocking here is safe 
because the

 * callers drop the mutex before trying again.
 */
mutex_unlock(&balloon_mutex);
@@ -422,6 +422,18 @@ static void xen_online_page(struct page *page)
mutex_unlock(&balloon_mutex);
 }

+static int xen_bring_pgs_online(struct page *pg, unsigned int order)
+{
+   unsigned long i, size = (1 << order);
+   unsigned long start_pfn = page_to_pfn(pg);
+
+   pr_debug("Online %lu pages starting at pfn 0x%lx\n", size, 
start_pfn);

+   for (i = 0; i < size; i++)
+   xen_online_page(pfn_to_page(start_pfn + i));
+
+   return 0;
+}
+
 static int xen_memory_notifier(struct notifier_block *nb, unsigned 
long val, void *v)

 {
if (val == MEM_ONLINE)
@@ -744,7 +756,7 @@ static int __init balloon_init(void)
balloon_stats.max_retry_count = RETRY_UNLIMITED;

 #ifdef CONFIG_XEN_BALLOON_MEMORY_HOTPLUG
-   set_online_page_callback(&xen_online_page);
+   set_online_page_callback(&xen_bring_pgs_online);
register_memory_notifier(&xen_memory_nb);
register_sysctl_table(xen_root);

diff --git a/include/linux/memory_hotplug.h 
b/include/linux/memory_hotplug.h

index 34a2822..7b04c1d 100644
--- a/include/linux/memory_hotplug.h
+++ b/include/linux/memory_hotplug.h
@@ -87,7 +87,7 @@ extern int test_pages_in_a_zone(unsigned long 
start_pfn, unsigned long end_pfn,

unsigned long *valid_start, unsigned long *valid_end);
 extern void __offline_isolated_pages(unsigned long, unsigned long);

-typedef void (*online_page_callback_t)(struct page *page);
+typedef int (*online_page_callback_t)(struct page *page, unsigned int 
order);


 extern int set_online_page_callback(online_page_callback_t callback);
 extern int restore_online_page_callback(online_page_callback_t 
callback);

diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
index 38d94b7..24c2b8e 100644
--- a/mm/memory_hotplug.c
+++ b/mm/memory_hotplug.c
@@ -47,7 +47,7 @@
  * and restore_online_page_callback() for generic callback restore.
  */

-static void generic_online_page(struct page *page);
+static int generic_online_page(struct page *page, unsigned int 
order);


 static online_page_callback_t online_page_callback = 
generic_online_page;

 static DEFINE_MUTEX(online_page_callback_lock);
@@ -655,26 +655,57 @@ void __online_page_free(struct page *page)
 }
 EXPORT_SYMBOL_GPL(__online_page_free);

-static void generic_online_page(struct page *page)
+static int generic_online_page(struct page *page, unsigned int order)
 {
-   __online_page_set_limits(page);
-   _

Re: [PATCH 1/2] gpiolib: Fix missing updates of bitmap index

2018-09-24 Thread Linus Walleij
On Mon, Sep 24, 2018 at 1:52 AM Janusz Krzysztofik  wrote:

> In new code introduced by commit b17566a6b08b ("gpiolib: Implement fast
> processing path in get/set array"), bitmap index is not updated with
> next found zero bit position as it should while skipping over pins
> already processed via fast bitmap path, possibly resulting in an
> infinite loop.  Fix it.
>
> Signed-off-by: Janusz Krzysztofik 

Patch applied!

Thanks for working on getting this into shape!

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


Re: [PATCH 2/2] gpiolib: Fix array members of same chip processed separately

2018-09-24 Thread Linus Walleij
On Mon, Sep 24, 2018 at 1:52 AM Janusz Krzysztofik  wrote:

> New code introduced by commit bf9346f5d47b ("gpiolib: Identify arrays
> matching GPIO hardware") forcibly tries to find an array member which
> has its array index number equal to its hardware pin number and set
> up an array info for possible fast bitmap processing of all arrray
> pins belonging to that chip which also satisfy that numbering rule.
>
> Depending on array content, it may happen that consecutive array
> members which belong to the same chip but don't have array indexes
> equal to their pin hardware numbers will be split into groups, some of
> them processed together via the fast bitmap path, and rest of them
> separetely.  However, applications may expect all those pins being
> processed together with a single call to .set_multiple() chip callback,
> like that was done before the change.
>
> Limit applicability of fast bitmap processing path to cases where all
> pins of consecutive array members starting from 0 which belong to the
> same chip have their hardware numbers equal to their corresponding
> array indexes.  That should still speed up processing of applications
> using whole GPIO banks as I/O ports, while not breaking simultaneous
> manipulation of consecutive pins of the same chip which don't follow
> the equal numbering rule.
>
> Cc: Jonathan Corbet 
> Signed-off-by: Janusz Krzysztofik 

Patch applied!

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


Re: [PATCH] staging: rtl8188eu, rtl8723bs: fix spelling mistake "evet" -> "event"

2018-09-24 Thread Dan Carpenter
It's better to just delete these.

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


Re: [PATCH 0/2] gpiolib: Fix issues introduced by fast bitmap processing path

2018-09-24 Thread Marek Szyprowski
Hi Janusz,

On 2018-09-24 01:53, Janusz Krzysztofik wrote:
> While investigating possible reasons of GPIO fast bitmap processing
> related boot hang on Samsung Snow Chromebook, reported by Marek
> Szyprowski (thanks!), I've discovered one coding bug, addressed by
> PATCH 1/2 of this series, and one potential regression introduced at
> design level of the solution, hopefully fixed by PATCH 2/2.  See
> commit messages for details.
>
> Janusz Krzysztofik (2):
>gpiolib: Fix missing updates of bitmap index
>gpiolib: Fix array members of same chip processed separately
>
> The fixes should resolve the boot hang observed by Marek, however the
> second change excludes that particular case from fast bitmap processing
> and restores the old behaviour.

I confirm, that the above 2 patches fixes boot issue on Samsung Snow
Chromebook with next-20180920.

Tested-by: Marek Szyprowski 

> Hence, it is possible still another
> issue which have had an influence on that boot hang exists in the code.
> In order to fully verify the fix, it would have to be tested on a
> platform where an array of GPIO descriptors is used which starts from
> at least two consecutive pins of one GPIO chip in hardware order,
> starting ftom 0, followed by one or more pins belonging to other
> chip(s).
>
> In order to verify if separate calls to .set() chip callback for each
> pin instead of one call to .set_multiple() is actually the reason of
> boot hang on Samsung Snow Chromebook, the affected driver -
> drivers/mmc/core/pwrseq_simple.c - would have to be temporarily
> modified for testing purposes so it calls gpiod_set_value() for each
> pin instead of gpiod_set_array_value() for all of them.  If that would
> also result in boot hang, we could be sure the issue was really the
> one addressed by the second fix.  Marek, could you please try to
> perform such test?

Yes, I've just tested next-20180920 only with the first patch from this
patchset and the mentioned change to drivers/mmc/core/pwrseq_simple.c.
It boots fine, so indeed the issue is in handling of arrays of gpios.

Just to be sure I did it right, this is my change to the mentioned file:

diff --git a/drivers/mmc/core/pwrseq_simple.c 
b/drivers/mmc/core/pwrseq_simple.c
index 7f882a2bb872..9397dc1f2e38 100644
--- a/drivers/mmc/core/pwrseq_simple.c
+++ b/drivers/mmc/core/pwrseq_simple.c
@@ -38,16 +38,11 @@ static void mmc_pwrseq_simple_set_gpios_value(struct 
mmc_pwrseq_simple *pwrseq,
   int value)
  {
     struct gpio_descs *reset_gpios = pwrseq->reset_gpios;
+   int i;

-   if (!IS_ERR(reset_gpios)) {
-   DECLARE_BITMAP(values, BITS_PER_TYPE(value));
-   int nvalues = reset_gpios->ndescs;
-
-   values[0] = value;
-
-   gpiod_set_array_value_cansleep(nvalues, reset_gpios->desc,
-  reset_gpios->info, values);
-   }
+   if (!IS_ERR(reset_gpios))
+   for (i = 0; i < reset_gpios->ndescs; i++)
+ gpiod_set_value_cansleep(reset_gpios->desc[i], value);
  }

  static void mmc_pwrseq_simple_pre_power_on(struct mmc_host *host)


Best regards
-- 
Marek Szyprowski, PhD
Samsung R&D Institute Poland

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


Re: [PATCH v2 4/5] staging: vc04_services: Surround complex macros

2018-09-24 Thread Dan Carpenter
On Sun, Sep 23, 2018 at 03:06:19PM +0100, Aymen Qader wrote:
> This patch fixes the checkpatch.pl error:
> 
> ERROR: Macros with complex values should be enclosed in parentheses
> 
> in the interface/vchi directory
> 
> Signed-off-by: Aymen Qader 
> ---
>  drivers/staging/vc04_services/interface/vchi/vchi.h | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/staging/vc04_services/interface/vchi/vchi.h 
> b/drivers/staging/vc04_services/interface/vchi/vchi.h
> index d8e660240a44..f818cf2e27e1 100644
> --- a/drivers/staging/vc04_services/interface/vchi/vchi.h
> +++ b/drivers/staging/vc04_services/interface/vchi/vchi.h
> @@ -92,14 +92,14 @@ typedef struct vchi_msg_vector_ex {
>  } VCHI_MSG_VECTOR_EX_T;
>  
>  // Construct an entry in a msg vector for a pointer (p) of length (l)
> -#define VCHI_VEC_POINTER(p, l)  VCHI_VEC_POINTER, { { 
> (VCHI_MEM_HANDLE_T)(p), (l) } }
> +#define VCHI_VEC_POINTER(p, l)  (VCHI_VEC_POINTER, { { 
> (VCHI_MEM_HANDLE_T)(p), (l) } })
>  
>  // Construct an entry in a msg vector for a message handle (h), starting at 
> offset (o) of length (l)
> -#define VCHI_VEC_HANDLE(h, o, l) VCHI_VEC_HANDLE,  { { (h), (o), (l) } }
> +#define VCHI_VEC_HANDLE(h, o, l) (VCHI_VEC_HANDLE,  { { (h), (o), (l) } })
>  
>  // Macros to manipulate 'FOURCC' values
>  #define MAKE_FOURCC(x) ((int32_t)((x[0] << 24) | (x[1] << 16) | (x[2] << 8) 
> | x[3]))
> -#define FOURCC_TO_CHAR(x) (x >> 24) & 0xFF, (x >> 16) & 0xFF, (x >> 8) & 
> 0xFF, x & 0xFF
> +#define FOURCC_TO_CHAR(x) ((x >> 24) & 0xFF, (x >> 16) & 0xFF, (x >> 8) & 
> 0xFF, x & 0xFF)
>  

These are never used so far as I can see, but if they were, then this
would probably break the code.  Go through the git log and find out how
they used to work and if they can be removed.

regards,
dan carpenter

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


Re: [PATCH v2 5/5] staging: vc04_services: Remove spaces after '*'

2018-09-24 Thread Dan Carpenter
On Sun, Sep 23, 2018 at 03:06:20PM +0100, Aymen Qader wrote:
> This patch fixes the checkpatch.pl error:
> 
> ERROR: "foo * bar" should be "foo* bar"

It should be "foo *bar".

> 
> in the interface/vchi directory
> 
> Signed-off-by: Aymen Qader 
> ---
>  drivers/staging/vc04_services/interface/vchi/vchi.h | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/staging/vc04_services/interface/vchi/vchi.h 
> b/drivers/staging/vc04_services/interface/vchi/vchi.h
> index f818cf2e27e1..77bf92018165 100644
> --- a/drivers/staging/vc04_services/interface/vchi/vchi.h
> +++ b/drivers/staging/vc04_services/interface/vchi/vchi.h
> @@ -154,7 +154,7 @@ typedef struct service_info_tag {
>  extern "C" {
>  #endif
>  
> -extern /*@observer@*/ VCHI_CONNECTION_T * vchi_create_connection(const 
> VCHI_CONNECTION_API_T * function_table,

^
> +extern /*@observer@*/ VCHI_CONNECTION_T *vchi_create_connection(const 
> VCHI_CONNECTION_API_T * function_table,
>const 
> VCHI_MESSAGE_DRIVER_T * low_level);

 ^^^

Change these as well.

regards,
dan carpenter

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


Re: [PATCH v2 0/5] staging: vc04_services: Fix checkpatch.pl errors

2018-09-24 Thread Dan Carpenter
On Sun, Sep 23, 2018 at 03:06:15PM +0100, Aymen Qader wrote:
> v2: Added cover letter correctly
> 

We weren't super stressed that the cover letter threading was wrong.
We're not ogres.  Anyway, just fixup the last two and resend a v3.

regards,
dan carpenter

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


Re: [PATCH 0/2] gpiolib: Fix issues introduced by fast bitmap processing path

2018-09-24 Thread Janusz Krzysztofik
Hi Marek,

2018-09-24 11:43 GMT+02:00, Marek Szyprowski :
> Hi Janusz,
>
> On 2018-09-24 01:53, Janusz Krzysztofik wrote:
>> While investigating possible reasons of GPIO fast bitmap processing
>> related boot hang on Samsung Snow Chromebook, reported by Marek
>> Szyprowski (thanks!), I've discovered one coding bug, addressed by
>> PATCH 1/2 of this series, and one potential regression introduced at
>> design level of the solution, hopefully fixed by PATCH 2/2.  See
>> commit messages for details.
>>
>> Janusz Krzysztofik (2):
>>gpiolib: Fix missing updates of bitmap index
>>gpiolib: Fix array members of same chip processed separately
>>
>> The fixes should resolve the boot hang observed by Marek, however the
>> second change excludes that particular case from fast bitmap processing
>> and restores the old behaviour.
>
> I confirm, that the above 2 patches fixes boot issue on Samsung Snow
> Chromebook with next-20180920.
>
> Tested-by: Marek Szyprowski 
>
>> Hence, it is possible still another
>> issue which have had an influence on that boot hang exists in the code.
>> In order to fully verify the fix, it would have to be tested on a
>> platform where an array of GPIO descriptors is used which starts from
>> at least two consecutive pins of one GPIO chip in hardware order,
>> starting ftom 0, followed by one or more pins belonging to other
>> chip(s).
>>
>> In order to verify if separate calls to .set() chip callback for each
>> pin instead of one call to .set_multiple() is actually the reason of
>> boot hang on Samsung Snow Chromebook, the affected driver -
>> drivers/mmc/core/pwrseq_simple.c - would have to be temporarily
>> modified for testing purposes so it calls gpiod_set_value() for each
>> pin instead of gpiod_set_array_value() for all of them.  If that would
>> also result in boot hang, we could be sure the issue was really the
>> one addressed by the second fix.  Marek, could you please try to
>> perform such test?
>
> Yes, I've just tested next-20180920 only with the first patch from this
> patchset and the mentioned change to drivers/mmc/core/pwrseq_simple.c.
> It boots fine, so indeed the issue is in handling of arrays of gpios.
>
> Just to be sure I did it right, this is my change to the mentioned file:

Yeah, that's what I had on mind.  However, I'd be more lucky if it didn't work
for you.  Setting the pins sequentially, not simultaneously as before, was
exactly what I hoped was the reason of the hang.

> diff --git a/drivers/mmc/core/pwrseq_simple.c
> b/drivers/mmc/core/pwrseq_simple.c
> index 7f882a2bb872..9397dc1f2e38 100644
> --- a/drivers/mmc/core/pwrseq_simple.c
> +++ b/drivers/mmc/core/pwrseq_simple.c
> @@ -38,16 +38,11 @@ static void mmc_pwrseq_simple_set_gpios_value(struct
> mmc_pwrseq_simple *pwrseq,
>int value)
>   {
>  struct gpio_descs *reset_gpios = pwrseq->reset_gpios;
> +   int i;
>
> -   if (!IS_ERR(reset_gpios)) {
> -   DECLARE_BITMAP(values, BITS_PER_TYPE(value));
> -   int nvalues = reset_gpios->ndescs;
> -
> -   values[0] = value;
> -
> -   gpiod_set_array_value_cansleep(nvalues, reset_gpios->desc,
> -  reset_gpios->info, values);
> -   }
> +   if (!IS_ERR(reset_gpios))
> +   for (i = 0; i < reset_gpios->ndescs; i++)

The only difference from the behaviour when the hang was occurring is now
the order the pins are manipulated.  Maybe that matters?
Could you please retry the same with the order of pins reversed, either in
the .dts file or here inside this for loop?

Thanks,
Janusz

> + gpiod_set_value_cansleep(reset_gpios->desc[i], value);
>   }
>
>   static void mmc_pwrseq_simple_pre_power_on(struct mmc_host *host)
>
>
> Best regards
> --
> Marek Szyprowski, PhD
> Samsung R&D Institute Poland
>
>
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 0/2] gpiolib: Fix issues introduced by fast bitmap processing path

2018-09-24 Thread Marek Szyprowski
Hi Janusz,

On 2018-09-24 13:08, Janusz Krzysztofik wrote:
> 2018-09-24 11:43 GMT+02:00, Marek Szyprowski :
>> On 2018-09-24 01:53, Janusz Krzysztofik wrote:
>>> While investigating possible reasons of GPIO fast bitmap processing
>>> related boot hang on Samsung Snow Chromebook, reported by Marek
>>> Szyprowski (thanks!), I've discovered one coding bug, addressed by
>>> PATCH 1/2 of this series, and one potential regression introduced at
>>> design level of the solution, hopefully fixed by PATCH 2/2.  See
>>> commit messages for details.
>>>
>>> Janusz Krzysztofik (2):
>>> gpiolib: Fix missing updates of bitmap index
>>> gpiolib: Fix array members of same chip processed separately
>>>
>>> The fixes should resolve the boot hang observed by Marek, however the
>>> second change excludes that particular case from fast bitmap processing
>>> and restores the old behaviour.
>> I confirm, that the above 2 patches fixes boot issue on Samsung Snow
>> Chromebook with next-20180920.
>>
>> Tested-by: Marek Szyprowski 
>>
>>> Hence, it is possible still another
>>> issue which have had an influence on that boot hang exists in the code.
>>> In order to fully verify the fix, it would have to be tested on a
>>> platform where an array of GPIO descriptors is used which starts from
>>> at least two consecutive pins of one GPIO chip in hardware order,
>>> starting ftom 0, followed by one or more pins belonging to other
>>> chip(s).
>>>
>>> In order to verify if separate calls to .set() chip callback for each
>>> pin instead of one call to .set_multiple() is actually the reason of
>>> boot hang on Samsung Snow Chromebook, the affected driver -
>>> drivers/mmc/core/pwrseq_simple.c - would have to be temporarily
>>> modified for testing purposes so it calls gpiod_set_value() for each
>>> pin instead of gpiod_set_array_value() for all of them.  If that would
>>> also result in boot hang, we could be sure the issue was really the
>>> one addressed by the second fix.  Marek, could you please try to
>>> perform such test?
>> Yes, I've just tested next-20180920 only with the first patch from this
>> patchset and the mentioned change to drivers/mmc/core/pwrseq_simple.c.
>> It boots fine, so indeed the issue is in handling of arrays of gpios.
>>
>> Just to be sure I did it right, this is my change to the mentioned file:
> Yeah, that's what I had on mind.  However, I'd be more lucky if it didn't work
> for you.  Setting the pins sequentially, not simultaneously as before, was
> exactly what I hoped was the reason of the hang.
>
>> diff --git a/drivers/mmc/core/pwrseq_simple.c
>> b/drivers/mmc/core/pwrseq_simple.c
>> index 7f882a2bb872..9397dc1f2e38 100644
>> --- a/drivers/mmc/core/pwrseq_simple.c
>> +++ b/drivers/mmc/core/pwrseq_simple.c
>> @@ -38,16 +38,11 @@ static void mmc_pwrseq_simple_set_gpios_value(struct
>> mmc_pwrseq_simple *pwrseq,
>> int value)
>>{
>>   struct gpio_descs *reset_gpios = pwrseq->reset_gpios;
>> +   int i;
>>
>> -   if (!IS_ERR(reset_gpios)) {
>> -   DECLARE_BITMAP(values, BITS_PER_TYPE(value));
>> -   int nvalues = reset_gpios->ndescs;
>> -
>> -   values[0] = value;
>> -
>> -   gpiod_set_array_value_cansleep(nvalues, reset_gpios->desc,
>> -  reset_gpios->info, values);
>> -   }
>> +   if (!IS_ERR(reset_gpios))
>> +   for (i = 0; i < reset_gpios->ndescs; i++)
> The only difference from the behaviour when the hang was occurring is now
> the order the pins are manipulated.  Maybe that matters?
> Could you please retry the same with the order of pins reversed, either in
> the .dts file or here inside this for loop?

I've switched the order of pins in dts and next-20180920 + first patch + 
above
change also boots fine.

Best regards
-- 
Marek Szyprowski, PhD
Samsung R&D Institute Poland

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


Re: [PATCH 0/2] gpiolib: Fix issues introduced by fast bitmap processing path

2018-09-24 Thread Janusz Krzysztofik
Hi Marek,

2018-09-24 13:38 GMT+02:00, Marek Szyprowski :
> Hi Janusz,
>
> On 2018-09-24 13:08, Janusz Krzysztofik wrote:
>> 2018-09-24 11:43 GMT+02:00, Marek Szyprowski :
>>> On 2018-09-24 01:53, Janusz Krzysztofik wrote:
 While investigating possible reasons of GPIO fast bitmap processing
 related boot hang on Samsung Snow Chromebook, reported by Marek
 Szyprowski (thanks!), I've discovered one coding bug, addressed by
 PATCH 1/2 of this series, and one potential regression introduced at
 design level of the solution, hopefully fixed by PATCH 2/2.  See
 commit messages for details.

 Janusz Krzysztofik (2):
 gpiolib: Fix missing updates of bitmap index
 gpiolib: Fix array members of same chip processed separately

 The fixes should resolve the boot hang observed by Marek, however the
 second change excludes that particular case from fast bitmap processing
 and restores the old behaviour.
>>> I confirm, that the above 2 patches fixes boot issue on Samsung Snow
>>> Chromebook with next-20180920.
>>>
>>> Tested-by: Marek Szyprowski 
>>>
 Hence, it is possible still another
 issue which have had an influence on that boot hang exists in the code.
 In order to fully verify the fix, it would have to be tested on a
 platform where an array of GPIO descriptors is used which starts from
 at least two consecutive pins of one GPIO chip in hardware order,
 starting ftom 0, followed by one or more pins belonging to other
 chip(s).

 In order to verify if separate calls to .set() chip callback for each
 pin instead of one call to .set_multiple() is actually the reason of
 boot hang on Samsung Snow Chromebook, the affected driver -
 drivers/mmc/core/pwrseq_simple.c - would have to be temporarily
 modified for testing purposes so it calls gpiod_set_value() for each
 pin instead of gpiod_set_array_value() for all of them.  If that would
 also result in boot hang, we could be sure the issue was really the
 one addressed by the second fix.  Marek, could you please try to
 perform such test?
>>> Yes, I've just tested next-20180920 only with the first patch from this
>>> patchset and the mentioned change to drivers/mmc/core/pwrseq_simple.c.
>>> It boots fine, so indeed the issue is in handling of arrays of gpios.
>>>
>>> Just to be sure I did it right, this is my change to the mentioned file:
>> Yeah, that's what I had on mind.  However, I'd be more lucky if it didn't
>> work
>> for you.  Setting the pins sequentially, not simultaneously as before,
>> was
>> exactly what I hoped was the reason of the hang.
>>
>>> diff --git a/drivers/mmc/core/pwrseq_simple.c
>>> b/drivers/mmc/core/pwrseq_simple.c
>>> index 7f882a2bb872..9397dc1f2e38 100644
>>> --- a/drivers/mmc/core/pwrseq_simple.c
>>> +++ b/drivers/mmc/core/pwrseq_simple.c
>>> @@ -38,16 +38,11 @@ static void mmc_pwrseq_simple_set_gpios_value(struct
>>> mmc_pwrseq_simple *pwrseq,
>>> int value)
>>>{
>>>   struct gpio_descs *reset_gpios = pwrseq->reset_gpios;
>>> +   int i;
>>>
>>> -   if (!IS_ERR(reset_gpios)) {
>>> -   DECLARE_BITMAP(values, BITS_PER_TYPE(value));
>>> -   int nvalues = reset_gpios->ndescs;
>>> -
>>> -   values[0] = value;
>>> -
>>> -   gpiod_set_array_value_cansleep(nvalues,
>>> reset_gpios->desc,
>>> -  reset_gpios->info,
>>> values);
>>> -   }
>>> +   if (!IS_ERR(reset_gpios))
>>> +   for (i = 0; i < reset_gpios->ndescs; i++)
>> The only difference from the behaviour when the hang was occurring is now
>> the order the pins are manipulated.  Maybe that matters?
>> Could you please retry the same with the order of pins reversed, either
>> in
>> the .dts file or here inside this for loop?
>
> I've switched the order of pins in dts and next-20180920 + first patch +
> above
> change also boots fine.

Thanks for performing those tests.

Since we are not able to reproduce the issue by any means other than
using the original code introduced by fast bitmap processing changes,
regardless of the first fix being applied or not, and we are only able to
resolve the hangup by excluding affected use case from the fast path,
we have to assume one or more bugs which affect mixed arrays, i.e.,
those which apply for fast bitmap processing only in part, may still exist
in the code introduced by the fast bitmap processing series.  I hope we
are able to resolve it soon, before the changes reach mainline.

Thanks,
Janusz


> Best regards
> --
> Marek Szyprowski, PhD
> Samsung R&D Institute Poland
>
>
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] staging: rtl8723bs: fix spelling mistake "toogle" -> "toggle"

2018-09-24 Thread Colin King
From: Colin Ian King 

Trivial fix to spelling mistake in struct field name

Signed-off-by: Colin Ian King 
---
 drivers/staging/rtl8723bs/core/rtw_debug.c| 2 +-
 drivers/staging/rtl8723bs/include/drv_types.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_debug.c 
b/drivers/staging/rtl8723bs/core/rtw_debug.c
index f852fde47350..a2a2cefd1786 100644
--- a/drivers/staging/rtl8723bs/core/rtw_debug.c
+++ b/drivers/staging/rtl8723bs/core/rtw_debug.c
@@ -657,7 +657,7 @@ int proc_get_suspend_resume_info(struct seq_file *m, void 
*v)
DBG_871X_SEL_NL(m, "dbg_enwow_dload_fw_fail_cnt =%d\n", 
pdbgpriv->dbg_enwow_dload_fw_fail_cnt);
DBG_871X_SEL_NL(m, "dbg_ips_drvopen_fail_cnt =%d\n", 
pdbgpriv->dbg_ips_drvopen_fail_cnt);
DBG_871X_SEL_NL(m, "dbg_poll_fail_cnt =%d\n", 
pdbgpriv->dbg_poll_fail_cnt);
-   DBG_871X_SEL_NL(m, "dbg_rpwm_toogle_cnt =%d\n", 
pdbgpriv->dbg_rpwm_toogle_cnt);
+   DBG_871X_SEL_NL(m, "dbg_rpwm_toggle_cnt =%d\n", 
pdbgpriv->dbg_rpwm_toggle_cnt);
DBG_871X_SEL_NL(m, "dbg_rpwm_timeout_fail_cnt =%d\n", 
pdbgpriv->dbg_rpwm_timeout_fail_cnt);
 
return 0;
diff --git a/drivers/staging/rtl8723bs/include/drv_types.h 
b/drivers/staging/rtl8723bs/include/drv_types.h
index c57f290f605a..062fda9962be 100644
--- a/drivers/staging/rtl8723bs/include/drv_types.h
+++ b/drivers/staging/rtl8723bs/include/drv_types.h
@@ -381,7 +381,7 @@ struct debug_priv {
u32 dbg_enwow_dload_fw_fail_cnt;
u32 dbg_ips_drvopen_fail_cnt;
u32 dbg_poll_fail_cnt;
-   u32 dbg_rpwm_toogle_cnt;
+   u32 dbg_rpwm_toggle_cnt;
u32 dbg_rpwm_timeout_fail_cnt;
u64 dbg_rx_fifo_last_overflow;
u64 dbg_rx_fifo_curr_overflow;
-- 
2.17.1

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


[PATCH v3 0/4] staging: vc04_services: Fix checkpatch.pl errors

2018-09-24 Thread Aymen Qader
This patchset fixes the following checkpatch.pl errors in the
interface/vchi directory:

ERROR: space prohibited after/before that open/closed parenthesis
ERROR: code indent should use tabs where possible
ERROR: space required after that ','
ERROR: Macros with complex values should be enclosed in parentheses
ERROR: "foo * bar" should be "foo* bar"

Aymen Qader (4):
  staging: vc04_services: Fix "space prohibited"
  staging: vc04_services: Use tabs instead of spaces
  staging: vc04_services: Remove unused macros
  staging: vc04_services: Remove spaces after '*'

 .../vc04_services/interface/vchi/vchi.h   | 208 +++---
 .../vc04_services/interface/vchi/vchi_cfg.h   |   2 +-
 2 files changed, 86 insertions(+), 124 deletions(-)

-- 
2.17.1

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


[PATCH v3 3/4] staging: vc04_services: Remove unused macros

2018-09-24 Thread Aymen Qader
This patch removes the macros and structs associated with the
"vchi_msg_queuev_ex" function, which was previously removed in 49bec49.
Also fixes the checkpatch.pl errors:

ERROR: Macros with complex values should be enclosed in parentheses
ERROR: space required after that ','

Signed-off-by: Aymen Qader 
---
 .../vc04_services/interface/vchi/vchi.h   | 38 ---
 1 file changed, 38 deletions(-)

diff --git a/drivers/staging/vc04_services/interface/vchi/vchi.h 
b/drivers/staging/vc04_services/interface/vchi/vchi.h
index cb2582a4eb6a..f96676227ddc 100644
--- a/drivers/staging/vc04_services/interface/vchi/vchi.h
+++ b/drivers/staging/vc04_services/interface/vchi/vchi.h
@@ -60,46 +60,8 @@ struct vchi_version {
 #define VCHI_VERSION(v_) { v_, v_ }
 #define VCHI_VERSION_EX(v_, m_) { v_, m_ }
 
-typedef enum {
-   VCHI_VEC_POINTER,
-   VCHI_VEC_HANDLE,
-   VCHI_VEC_LIST
-} VCHI_MSG_VECTOR_TYPE_T;
-
-typedef struct vchi_msg_vector_ex {
-
-   VCHI_MSG_VECTOR_TYPE_T type;
-   union {
-  // a memory handle
-   struct {
-   VCHI_MEM_HANDLE_T handle;
-   uint32_t offset;
-   int32_t vec_len;
-   } handle;
-
-  // an ordinary data pointer
-   struct {
-   const void *vec_base;
-   int32_t vec_len;
-  } ptr;
-
-  // a nested vector list
-   struct {
-   struct vchi_msg_vector_ex *vec;
-   uint32_t vec_len;
-   } list;
-   } u;
-} VCHI_MSG_VECTOR_EX_T;
-
-// Construct an entry in a msg vector for a pointer (p) of length (l)
-#define VCHI_VEC_POINTER(p,l)  VCHI_VEC_POINTER, { { (VCHI_MEM_HANDLE_T)(p), 
(l) } }
-
-// Construct an entry in a msg vector for a message handle (h), starting at 
offset (o) of length (l)
-#define VCHI_VEC_HANDLE(h,o,l) VCHI_VEC_HANDLE,  { { (h), (o), (l) } }
-
 // Macros to manipulate 'FOURCC' values
 #define MAKE_FOURCC(x) ((int32_t)((x[0] << 24) | (x[1] << 16) | (x[2] << 8) | 
x[3]))
-#define FOURCC_TO_CHAR(x) (x >> 24) & 0xFF,(x >> 16) & 0xFF,(x >> 8) & 0xFF, x 
& 0xFF
 
 // Opaque service information
 struct opaque_vchi_service_t;
-- 
2.17.1

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


[PATCH v3 2/4] staging: vc04_services: Use tabs instead of spaces

2018-09-24 Thread Aymen Qader
This patch fixes the checkpatch.pl error:

ERROR: code indent should use tabs where possible

in the interface/vchi directory

Signed-off-by: Aymen Qader 
---
 .../vc04_services/interface/vchi/vchi.h   | 116 +-
 1 file changed, 58 insertions(+), 58 deletions(-)

diff --git a/drivers/staging/vc04_services/interface/vchi/vchi.h 
b/drivers/staging/vc04_services/interface/vchi/vchi.h
index ffb8caaacaea..cb2582a4eb6a 100644
--- a/drivers/staging/vc04_services/interface/vchi/vchi.h
+++ b/drivers/staging/vc04_services/interface/vchi/vchi.h
@@ -71,23 +71,23 @@ typedef struct vchi_msg_vector_ex {
VCHI_MSG_VECTOR_TYPE_T type;
union {
   // a memory handle
-  struct {
- VCHI_MEM_HANDLE_T handle;
- uint32_t offset;
- int32_t vec_len;
-  } handle;
+   struct {
+   VCHI_MEM_HANDLE_T handle;
+   uint32_t offset;
+   int32_t vec_len;
+   } handle;
 
   // an ordinary data pointer
-  struct {
- const void *vec_base;
- int32_t vec_len;
+   struct {
+   const void *vec_base;
+   int32_t vec_len;
   } ptr;
 
   // a nested vector list
-  struct {
- struct vchi_msg_vector_ex *vec;
- uint32_t vec_len;
-  } list;
+   struct {
+   struct vchi_msg_vector_ex *vec;
+   uint32_t vec_len;
+   } list;
} u;
 } VCHI_MSG_VECTOR_EX_T;
 
@@ -155,7 +155,7 @@ extern "C" {
 #endif
 
 extern /*@observer@*/ VCHI_CONNECTION_T * vchi_create_connection(const 
VCHI_CONNECTION_API_T * function_table,
-   const VCHI_MESSAGE_DRIVER_T 
* low_level);
+const 
VCHI_MESSAGE_DRIVER_T * low_level);
 
 // Routine used to initialise the vchi on both local + remote connections
 extern int32_t vchi_initialise(VCHI_INSTANCE_T *instance_handle);
@@ -163,8 +163,8 @@ extern int32_t vchi_initialise(VCHI_INSTANCE_T 
*instance_handle);
 extern int32_t vchi_exit(void);
 
 extern int32_t vchi_connect(VCHI_CONNECTION_T **connections,
- const uint32_t num_connections,
- VCHI_INSTANCE_T instance_handle);
+   const uint32_t num_connections,
+   VCHI_INSTANCE_T instance_handle);
 
 //When this is called, ensure that all services have no data pending.
 //Bulk transfers can remain 'queued'
@@ -172,7 +172,7 @@ extern int32_t vchi_disconnect(VCHI_INSTANCE_T 
instance_handle);
 
 // Global control over bulk CRC checking
 extern int32_t vchi_crc_control(VCHI_CONNECTION_T *connection,
- VCHI_CRC_CONTROL_T control);
+   VCHI_CRC_CONTROL_T control);
 
 // helper functions
 extern void * vchi_allocate_buffer(VCHI_SERVICE_HANDLE_T handle, uint32_t 
*length);
@@ -184,19 +184,19 @@ extern uint32_t vchi_current_time(VCHI_INSTANCE_T 
instance_handle);
  */
 // Routine to create a named service
 extern int32_t vchi_service_create(VCHI_INSTANCE_T instance_handle,
-SERVICE_CREATION_T *setup,
-VCHI_SERVICE_HANDLE_T *handle);
+  SERVICE_CREATION_T *setup,
+  VCHI_SERVICE_HANDLE_T *handle);
 
 // Routine to destroy a service
 extern int32_t vchi_service_destroy(const VCHI_SERVICE_HANDLE_T handle);
 
 // Routine to open a named service
 extern int32_t vchi_service_open(VCHI_INSTANCE_T instance_handle,
-  SERVICE_CREATION_T *setup,
-  VCHI_SERVICE_HANDLE_T *handle);
+SERVICE_CREATION_T *setup,
+VCHI_SERVICE_HANDLE_T *handle);
 
 extern int32_t vchi_get_peer_version(const VCHI_SERVICE_HANDLE_T handle,
-  short *peer_version);
+short *peer_version);
 
 // Routine to close a named service
 extern int32_t vchi_service_close(const VCHI_SERVICE_HANDLE_T handle);
@@ -227,18 +227,18 @@ vchi_queue_user_message(VCHI_SERVICE_HANDLE_T handle,
 // Routine to receive a msg from a service
 // Dequeue is equivalent to hold, copy into client buffer, release
 extern int32_t vchi_msg_dequeue(VCHI_SERVICE_HANDLE_T handle,
- void *data,
- uint32_t max_data_size_to_read,
- uint32_t *actual_msg_size,
- VCHI_FLAGS_T flags);
+   void *data,
+   uint32_t max_data_size_to_read,
+   uint32_t *actual_msg_size,
+   VCHI_FLAGS_T flags);
 
 // Routine to look at a message in place.
 // The message

[PATCH v3 1/4] staging: vc04_services: Fix "space prohibited"

2018-09-24 Thread Aymen Qader
This patch fixes the checkpatch.pl error:

ERROR: space prohibited after/before that open/closed parenthesis

in the interface/vchi directory.

Signed-off-by: Aymen Qader 
---
 .../vc04_services/interface/vchi/vchi.h   | 106 +-
 .../vc04_services/interface/vchi/vchi_cfg.h   |   2 +-
 2 files changed, 54 insertions(+), 54 deletions(-)

diff --git a/drivers/staging/vc04_services/interface/vchi/vchi.h 
b/drivers/staging/vc04_services/interface/vchi/vchi.h
index 66a3a060fad2..ffb8caaacaea 100644
--- a/drivers/staging/vc04_services/interface/vchi/vchi.h
+++ b/drivers/staging/vc04_services/interface/vchi/vchi.h
@@ -98,7 +98,7 @@ typedef struct vchi_msg_vector_ex {
 #define VCHI_VEC_HANDLE(h,o,l) VCHI_VEC_HANDLE,  { { (h), (o), (l) } }
 
 // Macros to manipulate 'FOURCC' values
-#define MAKE_FOURCC(x) ((int32_t)( (x[0] << 24) | (x[1] << 16) | (x[2] << 8) | 
x[3] ))
+#define MAKE_FOURCC(x) ((int32_t)((x[0] << 24) | (x[1] << 16) | (x[2] << 8) | 
x[3]))
 #define FOURCC_TO_CHAR(x) (x >> 24) & 0xFF,(x >> 16) & 0xFF,(x >> 8) & 0xFF, x 
& 0xFF
 
 // Opaque service information
@@ -154,25 +154,25 @@ typedef struct service_info_tag {
 extern "C" {
 #endif
 
-extern /*@observer@*/ VCHI_CONNECTION_T * vchi_create_connection( const 
VCHI_CONNECTION_API_T * function_table,
+extern /*@observer@*/ VCHI_CONNECTION_T * vchi_create_connection(const 
VCHI_CONNECTION_API_T * function_table,
const VCHI_MESSAGE_DRIVER_T 
* low_level);
 
 // Routine used to initialise the vchi on both local + remote connections
-extern int32_t vchi_initialise( VCHI_INSTANCE_T *instance_handle );
+extern int32_t vchi_initialise(VCHI_INSTANCE_T *instance_handle);
 
-extern int32_t vchi_exit( void );
+extern int32_t vchi_exit(void);
 
-extern int32_t vchi_connect( VCHI_CONNECTION_T **connections,
+extern int32_t vchi_connect(VCHI_CONNECTION_T **connections,
  const uint32_t num_connections,
- VCHI_INSTANCE_T instance_handle );
+ VCHI_INSTANCE_T instance_handle);
 
 //When this is called, ensure that all services have no data pending.
 //Bulk transfers can remain 'queued'
-extern int32_t vchi_disconnect( VCHI_INSTANCE_T instance_handle );
+extern int32_t vchi_disconnect(VCHI_INSTANCE_T instance_handle);
 
 // Global control over bulk CRC checking
-extern int32_t vchi_crc_control( VCHI_CONNECTION_T *connection,
- VCHI_CRC_CONTROL_T control );
+extern int32_t vchi_crc_control(VCHI_CONNECTION_T *connection,
+ VCHI_CRC_CONTROL_T control);
 
 // helper functions
 extern void * vchi_allocate_buffer(VCHI_SERVICE_HANDLE_T handle, uint32_t 
*length);
@@ -183,32 +183,32 @@ extern uint32_t vchi_current_time(VCHI_INSTANCE_T 
instance_handle);
  Global service API
  */
 // Routine to create a named service
-extern int32_t vchi_service_create( VCHI_INSTANCE_T instance_handle,
+extern int32_t vchi_service_create(VCHI_INSTANCE_T instance_handle,
 SERVICE_CREATION_T *setup,
-VCHI_SERVICE_HANDLE_T *handle );
+VCHI_SERVICE_HANDLE_T *handle);
 
 // Routine to destroy a service
-extern int32_t vchi_service_destroy( const VCHI_SERVICE_HANDLE_T handle );
+extern int32_t vchi_service_destroy(const VCHI_SERVICE_HANDLE_T handle);
 
 // Routine to open a named service
-extern int32_t vchi_service_open( VCHI_INSTANCE_T instance_handle,
+extern int32_t vchi_service_open(VCHI_INSTANCE_T instance_handle,
   SERVICE_CREATION_T *setup,
   VCHI_SERVICE_HANDLE_T *handle);
 
-extern int32_t vchi_get_peer_version( const VCHI_SERVICE_HANDLE_T handle,
-  short *peer_version );
+extern int32_t vchi_get_peer_version(const VCHI_SERVICE_HANDLE_T handle,
+  short *peer_version);
 
 // Routine to close a named service
-extern int32_t vchi_service_close( const VCHI_SERVICE_HANDLE_T handle );
+extern int32_t vchi_service_close(const VCHI_SERVICE_HANDLE_T handle);
 
 // Routine to increment ref count on a named service
-extern int32_t vchi_service_use( const VCHI_SERVICE_HANDLE_T handle );
+extern int32_t vchi_service_use(const VCHI_SERVICE_HANDLE_T handle);
 
 // Routine to decrement ref count on a named service
-extern int32_t vchi_service_release( const VCHI_SERVICE_HANDLE_T handle );
+extern int32_t vchi_service_release(const VCHI_SERVICE_HANDLE_T handle);
 
 // Routine to set a control option for a named service
-extern int32_t vchi_service_set_option( const VCHI_SERVICE_HANDLE_T handle,
+extern int32_t vchi_service_set_option(const VCHI_SERVICE_HANDLE_T handle,
VCHI_SERVICE_OPTION_T option,
   

[PATCH v3 4/4] staging: vc04_services: Remove spaces after '*'

2018-09-24 Thread Aymen Qader
This patch fixes the checkpatch.pl error:

ERROR: "foo * bar" should be "foo *bar"

in the interface/vchi directory

Signed-off-by: Aymen Qader 
---
 drivers/staging/vc04_services/interface/vchi/vchi.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/vc04_services/interface/vchi/vchi.h 
b/drivers/staging/vc04_services/interface/vchi/vchi.h
index f96676227ddc..3fe19d72b3ab 100644
--- a/drivers/staging/vc04_services/interface/vchi/vchi.h
+++ b/drivers/staging/vc04_services/interface/vchi/vchi.h
@@ -116,8 +116,8 @@ typedef struct service_info_tag {
 extern "C" {
 #endif
 
-extern /*@observer@*/ VCHI_CONNECTION_T * vchi_create_connection(const 
VCHI_CONNECTION_API_T * function_table,
-const 
VCHI_MESSAGE_DRIVER_T * low_level);
+extern /*@observer@*/ VCHI_CONNECTION_T *vchi_create_connection(const 
VCHI_CONNECTION_API_T *function_table,
+const 
VCHI_MESSAGE_DRIVER_T *low_level);
 
 // Routine used to initialise the vchi on both local + remote connections
 extern int32_t vchi_initialise(VCHI_INSTANCE_T *instance_handle);
@@ -137,7 +137,7 @@ extern int32_t vchi_crc_control(VCHI_CONNECTION_T 
*connection,
VCHI_CRC_CONTROL_T control);
 
 // helper functions
-extern void * vchi_allocate_buffer(VCHI_SERVICE_HANDLE_T handle, uint32_t 
*length);
+extern void *vchi_allocate_buffer(VCHI_SERVICE_HANDLE_T handle, uint32_t 
*length);
 extern void vchi_free_buffer(VCHI_SERVICE_HANDLE_T handle, void *address);
 extern uint32_t vchi_current_time(VCHI_INSTANCE_T instance_handle);
 
-- 
2.17.1

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


Your photo work

2018-09-24 Thread Larry

Did you receive my email from last week?

We are a team to provide you different kind of image editing services.
Such as cutting out your photos or give clipping path.
It includes retouching if needed.

The editing mostly is used for
ecommerce products photos or portrait photos.

We can give you editing test.
Please reply if you have needs for this.

Thanks,
Larry

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


[PATCH] staging: rtl8723bs: fix spelling mistake "unvalid" -> "invalid"

2018-09-24 Thread Colin King
From: Colin Ian King 

Trivial fix to spelling mistake in DBG_871X debug messages.

Signed-off-by: Colin Ian King 
---
 drivers/staging/rtl8723bs/hal/hal_com_phycfg.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/rtl8723bs/hal/hal_com_phycfg.c 
b/drivers/staging/rtl8723bs/hal/hal_com_phycfg.c
index 0833cce43dd3..12c1cd590056 100644
--- a/drivers/staging/rtl8723bs/hal/hal_com_phycfg.c
+++ b/drivers/staging/rtl8723bs/hal/hal_com_phycfg.c
@@ -3084,7 +3084,7 @@ static int phy_ParsePowerLimitTableFile(struct adapter 
*Adapter, char *buffer)
 
if (colNum > TXPWR_LMT_MAX_REGULATION_NUM) {
DBG_871X(
-   "unvalid col number %d (greater than 
max %d)\n",
+   "invalid col number %d (greater than 
max %d)\n",
colNum, TXPWR_LMT_MAX_REGULATION_NUM
);
return _FAIL;
@@ -3102,7 +3102,7 @@ static int phy_ParsePowerLimitTableFile(struct adapter 
*Adapter, char *buffer)
/* DBG_871X("regulation %s!\n", 
regulation[forCnt]); */
 
if (regulation_name_cnt == 0) {
-   DBG_871X("unvalid number of 
regulation!\n");
+   DBG_871X("invalid number of 
regulation!\n");
return _FAIL;
}
}
-- 
2.17.1

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


[PATCH v4 1/4] staging: vc04_services: Fix "space prohibited"

2018-09-24 Thread Aymen Qader
This patch fixes the checkpatch.pl error:

ERROR: space prohibited after/before that open/closed parenthesis

in the interface/vchi directory.

Signed-off-by: Aymen Qader 
---
 .../vc04_services/interface/vchi/vchi.h   | 106 +-
 .../vc04_services/interface/vchi/vchi_cfg.h   |   2 +-
 2 files changed, 54 insertions(+), 54 deletions(-)

diff --git a/drivers/staging/vc04_services/interface/vchi/vchi.h 
b/drivers/staging/vc04_services/interface/vchi/vchi.h
index 66a3a060fad2..ffb8caaacaea 100644
--- a/drivers/staging/vc04_services/interface/vchi/vchi.h
+++ b/drivers/staging/vc04_services/interface/vchi/vchi.h
@@ -98,7 +98,7 @@ typedef struct vchi_msg_vector_ex {
 #define VCHI_VEC_HANDLE(h,o,l) VCHI_VEC_HANDLE,  { { (h), (o), (l) } }
 
 // Macros to manipulate 'FOURCC' values
-#define MAKE_FOURCC(x) ((int32_t)( (x[0] << 24) | (x[1] << 16) | (x[2] << 8) | 
x[3] ))
+#define MAKE_FOURCC(x) ((int32_t)((x[0] << 24) | (x[1] << 16) | (x[2] << 8) | 
x[3]))
 #define FOURCC_TO_CHAR(x) (x >> 24) & 0xFF,(x >> 16) & 0xFF,(x >> 8) & 0xFF, x 
& 0xFF
 
 // Opaque service information
@@ -154,25 +154,25 @@ typedef struct service_info_tag {
 extern "C" {
 #endif
 
-extern /*@observer@*/ VCHI_CONNECTION_T * vchi_create_connection( const 
VCHI_CONNECTION_API_T * function_table,
+extern /*@observer@*/ VCHI_CONNECTION_T * vchi_create_connection(const 
VCHI_CONNECTION_API_T * function_table,
const VCHI_MESSAGE_DRIVER_T 
* low_level);
 
 // Routine used to initialise the vchi on both local + remote connections
-extern int32_t vchi_initialise( VCHI_INSTANCE_T *instance_handle );
+extern int32_t vchi_initialise(VCHI_INSTANCE_T *instance_handle);
 
-extern int32_t vchi_exit( void );
+extern int32_t vchi_exit(void);
 
-extern int32_t vchi_connect( VCHI_CONNECTION_T **connections,
+extern int32_t vchi_connect(VCHI_CONNECTION_T **connections,
  const uint32_t num_connections,
- VCHI_INSTANCE_T instance_handle );
+ VCHI_INSTANCE_T instance_handle);
 
 //When this is called, ensure that all services have no data pending.
 //Bulk transfers can remain 'queued'
-extern int32_t vchi_disconnect( VCHI_INSTANCE_T instance_handle );
+extern int32_t vchi_disconnect(VCHI_INSTANCE_T instance_handle);
 
 // Global control over bulk CRC checking
-extern int32_t vchi_crc_control( VCHI_CONNECTION_T *connection,
- VCHI_CRC_CONTROL_T control );
+extern int32_t vchi_crc_control(VCHI_CONNECTION_T *connection,
+ VCHI_CRC_CONTROL_T control);
 
 // helper functions
 extern void * vchi_allocate_buffer(VCHI_SERVICE_HANDLE_T handle, uint32_t 
*length);
@@ -183,32 +183,32 @@ extern uint32_t vchi_current_time(VCHI_INSTANCE_T 
instance_handle);
  Global service API
  */
 // Routine to create a named service
-extern int32_t vchi_service_create( VCHI_INSTANCE_T instance_handle,
+extern int32_t vchi_service_create(VCHI_INSTANCE_T instance_handle,
 SERVICE_CREATION_T *setup,
-VCHI_SERVICE_HANDLE_T *handle );
+VCHI_SERVICE_HANDLE_T *handle);
 
 // Routine to destroy a service
-extern int32_t vchi_service_destroy( const VCHI_SERVICE_HANDLE_T handle );
+extern int32_t vchi_service_destroy(const VCHI_SERVICE_HANDLE_T handle);
 
 // Routine to open a named service
-extern int32_t vchi_service_open( VCHI_INSTANCE_T instance_handle,
+extern int32_t vchi_service_open(VCHI_INSTANCE_T instance_handle,
   SERVICE_CREATION_T *setup,
   VCHI_SERVICE_HANDLE_T *handle);
 
-extern int32_t vchi_get_peer_version( const VCHI_SERVICE_HANDLE_T handle,
-  short *peer_version );
+extern int32_t vchi_get_peer_version(const VCHI_SERVICE_HANDLE_T handle,
+  short *peer_version);
 
 // Routine to close a named service
-extern int32_t vchi_service_close( const VCHI_SERVICE_HANDLE_T handle );
+extern int32_t vchi_service_close(const VCHI_SERVICE_HANDLE_T handle);
 
 // Routine to increment ref count on a named service
-extern int32_t vchi_service_use( const VCHI_SERVICE_HANDLE_T handle );
+extern int32_t vchi_service_use(const VCHI_SERVICE_HANDLE_T handle);
 
 // Routine to decrement ref count on a named service
-extern int32_t vchi_service_release( const VCHI_SERVICE_HANDLE_T handle );
+extern int32_t vchi_service_release(const VCHI_SERVICE_HANDLE_T handle);
 
 // Routine to set a control option for a named service
-extern int32_t vchi_service_set_option( const VCHI_SERVICE_HANDLE_T handle,
+extern int32_t vchi_service_set_option(const VCHI_SERVICE_HANDLE_T handle,
VCHI_SERVICE_OPTION_T option,
   

[PATCH v4 0/4] staging: vc04_services: Fix checkpatch.pl errors

2018-09-24 Thread Aymen Qader
This patchset fixes the following checkpatch.pl errors in the
interface/vchi directory:

ERROR: space prohibited after/before that open/closed parenthesis
ERROR: code indent should use tabs where possible
ERROR: space required after that ','
ERROR: Macros with complex values should be enclosed in parentheses
ERROR: "foo * bar" should be "foo* bar"

Aymen Qader (4):
  staging: vc04_services: Fix "space prohibited"
  staging: vc04_services: Use tabs instead of spaces
  staging: vc04_services: Remove unused macros
  staging: vc04_services: Remove spaces after '*'

v2: Added cover letter correctly
v3: Remove unused macros
v4: Added patch changelog to cover letter

 .../vc04_services/interface/vchi/vchi.h   | 208 +++---
 .../vc04_services/interface/vchi/vchi_cfg.h   |   2 +-
 2 files changed, 86 insertions(+), 124 deletions(-)

-- 
2.17.1

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


[PATCH v4 4/4] staging: vc04_services: Remove spaces after '*'

2018-09-24 Thread Aymen Qader
This patch fixes the checkpatch.pl error:

ERROR: "foo * bar" should be "foo *bar"

in the interface/vchi directory

Signed-off-by: Aymen Qader 
---
 drivers/staging/vc04_services/interface/vchi/vchi.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/vc04_services/interface/vchi/vchi.h 
b/drivers/staging/vc04_services/interface/vchi/vchi.h
index f96676227ddc..3fe19d72b3ab 100644
--- a/drivers/staging/vc04_services/interface/vchi/vchi.h
+++ b/drivers/staging/vc04_services/interface/vchi/vchi.h
@@ -116,8 +116,8 @@ typedef struct service_info_tag {
 extern "C" {
 #endif
 
-extern /*@observer@*/ VCHI_CONNECTION_T * vchi_create_connection(const 
VCHI_CONNECTION_API_T * function_table,
-const 
VCHI_MESSAGE_DRIVER_T * low_level);
+extern /*@observer@*/ VCHI_CONNECTION_T *vchi_create_connection(const 
VCHI_CONNECTION_API_T *function_table,
+const 
VCHI_MESSAGE_DRIVER_T *low_level);
 
 // Routine used to initialise the vchi on both local + remote connections
 extern int32_t vchi_initialise(VCHI_INSTANCE_T *instance_handle);
@@ -137,7 +137,7 @@ extern int32_t vchi_crc_control(VCHI_CONNECTION_T 
*connection,
VCHI_CRC_CONTROL_T control);
 
 // helper functions
-extern void * vchi_allocate_buffer(VCHI_SERVICE_HANDLE_T handle, uint32_t 
*length);
+extern void *vchi_allocate_buffer(VCHI_SERVICE_HANDLE_T handle, uint32_t 
*length);
 extern void vchi_free_buffer(VCHI_SERVICE_HANDLE_T handle, void *address);
 extern uint32_t vchi_current_time(VCHI_INSTANCE_T instance_handle);
 
-- 
2.17.1

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


[PATCH v4 3/4] staging: vc04_services: Remove unused macros

2018-09-24 Thread Aymen Qader
This patch removes the macros and structs associated with the
"vchi_msg_queuev_ex" function, which was previously removed in 49bec49.
Also fixes the checkpatch.pl errors:

ERROR: Macros with complex values should be enclosed in parentheses
ERROR: space required after that ','

Signed-off-by: Aymen Qader 
---
 .../vc04_services/interface/vchi/vchi.h   | 38 ---
 1 file changed, 38 deletions(-)

diff --git a/drivers/staging/vc04_services/interface/vchi/vchi.h 
b/drivers/staging/vc04_services/interface/vchi/vchi.h
index cb2582a4eb6a..f96676227ddc 100644
--- a/drivers/staging/vc04_services/interface/vchi/vchi.h
+++ b/drivers/staging/vc04_services/interface/vchi/vchi.h
@@ -60,46 +60,8 @@ struct vchi_version {
 #define VCHI_VERSION(v_) { v_, v_ }
 #define VCHI_VERSION_EX(v_, m_) { v_, m_ }
 
-typedef enum {
-   VCHI_VEC_POINTER,
-   VCHI_VEC_HANDLE,
-   VCHI_VEC_LIST
-} VCHI_MSG_VECTOR_TYPE_T;
-
-typedef struct vchi_msg_vector_ex {
-
-   VCHI_MSG_VECTOR_TYPE_T type;
-   union {
-  // a memory handle
-   struct {
-   VCHI_MEM_HANDLE_T handle;
-   uint32_t offset;
-   int32_t vec_len;
-   } handle;
-
-  // an ordinary data pointer
-   struct {
-   const void *vec_base;
-   int32_t vec_len;
-  } ptr;
-
-  // a nested vector list
-   struct {
-   struct vchi_msg_vector_ex *vec;
-   uint32_t vec_len;
-   } list;
-   } u;
-} VCHI_MSG_VECTOR_EX_T;
-
-// Construct an entry in a msg vector for a pointer (p) of length (l)
-#define VCHI_VEC_POINTER(p,l)  VCHI_VEC_POINTER, { { (VCHI_MEM_HANDLE_T)(p), 
(l) } }
-
-// Construct an entry in a msg vector for a message handle (h), starting at 
offset (o) of length (l)
-#define VCHI_VEC_HANDLE(h,o,l) VCHI_VEC_HANDLE,  { { (h), (o), (l) } }
-
 // Macros to manipulate 'FOURCC' values
 #define MAKE_FOURCC(x) ((int32_t)((x[0] << 24) | (x[1] << 16) | (x[2] << 8) | 
x[3]))
-#define FOURCC_TO_CHAR(x) (x >> 24) & 0xFF,(x >> 16) & 0xFF,(x >> 8) & 0xFF, x 
& 0xFF
 
 // Opaque service information
 struct opaque_vchi_service_t;
-- 
2.17.1

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


[PATCH v4 2/4] staging: vc04_services: Use tabs instead of spaces

2018-09-24 Thread Aymen Qader
This patch fixes the checkpatch.pl error:

ERROR: code indent should use tabs where possible

in the interface/vchi directory

Signed-off-by: Aymen Qader 
---
 .../vc04_services/interface/vchi/vchi.h   | 116 +-
 1 file changed, 58 insertions(+), 58 deletions(-)

diff --git a/drivers/staging/vc04_services/interface/vchi/vchi.h 
b/drivers/staging/vc04_services/interface/vchi/vchi.h
index ffb8caaacaea..cb2582a4eb6a 100644
--- a/drivers/staging/vc04_services/interface/vchi/vchi.h
+++ b/drivers/staging/vc04_services/interface/vchi/vchi.h
@@ -71,23 +71,23 @@ typedef struct vchi_msg_vector_ex {
VCHI_MSG_VECTOR_TYPE_T type;
union {
   // a memory handle
-  struct {
- VCHI_MEM_HANDLE_T handle;
- uint32_t offset;
- int32_t vec_len;
-  } handle;
+   struct {
+   VCHI_MEM_HANDLE_T handle;
+   uint32_t offset;
+   int32_t vec_len;
+   } handle;
 
   // an ordinary data pointer
-  struct {
- const void *vec_base;
- int32_t vec_len;
+   struct {
+   const void *vec_base;
+   int32_t vec_len;
   } ptr;
 
   // a nested vector list
-  struct {
- struct vchi_msg_vector_ex *vec;
- uint32_t vec_len;
-  } list;
+   struct {
+   struct vchi_msg_vector_ex *vec;
+   uint32_t vec_len;
+   } list;
} u;
 } VCHI_MSG_VECTOR_EX_T;
 
@@ -155,7 +155,7 @@ extern "C" {
 #endif
 
 extern /*@observer@*/ VCHI_CONNECTION_T * vchi_create_connection(const 
VCHI_CONNECTION_API_T * function_table,
-   const VCHI_MESSAGE_DRIVER_T 
* low_level);
+const 
VCHI_MESSAGE_DRIVER_T * low_level);
 
 // Routine used to initialise the vchi on both local + remote connections
 extern int32_t vchi_initialise(VCHI_INSTANCE_T *instance_handle);
@@ -163,8 +163,8 @@ extern int32_t vchi_initialise(VCHI_INSTANCE_T 
*instance_handle);
 extern int32_t vchi_exit(void);
 
 extern int32_t vchi_connect(VCHI_CONNECTION_T **connections,
- const uint32_t num_connections,
- VCHI_INSTANCE_T instance_handle);
+   const uint32_t num_connections,
+   VCHI_INSTANCE_T instance_handle);
 
 //When this is called, ensure that all services have no data pending.
 //Bulk transfers can remain 'queued'
@@ -172,7 +172,7 @@ extern int32_t vchi_disconnect(VCHI_INSTANCE_T 
instance_handle);
 
 // Global control over bulk CRC checking
 extern int32_t vchi_crc_control(VCHI_CONNECTION_T *connection,
- VCHI_CRC_CONTROL_T control);
+   VCHI_CRC_CONTROL_T control);
 
 // helper functions
 extern void * vchi_allocate_buffer(VCHI_SERVICE_HANDLE_T handle, uint32_t 
*length);
@@ -184,19 +184,19 @@ extern uint32_t vchi_current_time(VCHI_INSTANCE_T 
instance_handle);
  */
 // Routine to create a named service
 extern int32_t vchi_service_create(VCHI_INSTANCE_T instance_handle,
-SERVICE_CREATION_T *setup,
-VCHI_SERVICE_HANDLE_T *handle);
+  SERVICE_CREATION_T *setup,
+  VCHI_SERVICE_HANDLE_T *handle);
 
 // Routine to destroy a service
 extern int32_t vchi_service_destroy(const VCHI_SERVICE_HANDLE_T handle);
 
 // Routine to open a named service
 extern int32_t vchi_service_open(VCHI_INSTANCE_T instance_handle,
-  SERVICE_CREATION_T *setup,
-  VCHI_SERVICE_HANDLE_T *handle);
+SERVICE_CREATION_T *setup,
+VCHI_SERVICE_HANDLE_T *handle);
 
 extern int32_t vchi_get_peer_version(const VCHI_SERVICE_HANDLE_T handle,
-  short *peer_version);
+short *peer_version);
 
 // Routine to close a named service
 extern int32_t vchi_service_close(const VCHI_SERVICE_HANDLE_T handle);
@@ -227,18 +227,18 @@ vchi_queue_user_message(VCHI_SERVICE_HANDLE_T handle,
 // Routine to receive a msg from a service
 // Dequeue is equivalent to hold, copy into client buffer, release
 extern int32_t vchi_msg_dequeue(VCHI_SERVICE_HANDLE_T handle,
- void *data,
- uint32_t max_data_size_to_read,
- uint32_t *actual_msg_size,
- VCHI_FLAGS_T flags);
+   void *data,
+   uint32_t max_data_size_to_read,
+   uint32_t *actual_msg_size,
+   VCHI_FLAGS_T flags);
 
 // Routine to look at a message in place.
 // The message

[PATCH] staging: emxx_udc: remove unnecessary nullpointer checks

2018-09-24 Thread Arkadiusz Lis
This patch removes nullpointer checks which are redundant. container_of
returns structure containing entity which we know for sure is not null,
so the whole structure can not be null.

Signed-off-by: Arkadiusz Lis 
---
 drivers/staging/emxx_udc/emxx_udc.c | 24 ++--
 1 file changed, 2 insertions(+), 22 deletions(-)

diff --git a/drivers/staging/emxx_udc/emxx_udc.c 
b/drivers/staging/emxx_udc/emxx_udc.c
index 3e51476a7045..0e8d3f232fe9 100644
--- a/drivers/staging/emxx_udc/emxx_udc.c
+++ b/drivers/staging/emxx_udc/emxx_udc.c
@@ -2513,7 +2513,7 @@ static int nbu2ss_ep_enable(
}
 
ep = container_of(_ep, struct nbu2ss_ep, ep);
-   if ((!ep) || (!ep->udc)) {
+   if ((!ep->udc)) {
pr_err(" *** %s, ep == NULL !!\n", __func__);
return -EINVAL;
}
@@ -2570,7 +2570,7 @@ static int nbu2ss_ep_disable(struct usb_ep *_ep)
}
 
ep = container_of(_ep, struct nbu2ss_ep, ep);
-   if ((!ep) || (!ep->udc)) {
+   if (!ep->udc) {
pr_err("udc: *** %s, ep == NULL !!\n", __func__);
return -EINVAL;
}
@@ -2743,10 +2743,6 @@ static int nbu2ss_ep_dequeue(
}
 
ep = container_of(_ep, struct nbu2ss_ep, ep);
-   if (!ep) {
-   pr_err("%s, ep == NULL !!\n", __func__);
-   return -EINVAL;
-   }
 
udc = ep->udc;
if (!udc)
@@ -2787,10 +2783,6 @@ static int nbu2ss_ep_set_halt(struct usb_ep *_ep, int 
value)
}
 
ep = container_of(_ep, struct nbu2ss_ep, ep);
-   if (!ep) {
-   pr_err("%s, bad ep\n", __func__);
-   return -EINVAL;
-   }
 
udc = ep->udc;
if (!udc) {
@@ -2839,10 +2831,6 @@ static int nbu2ss_ep_fifo_status(struct usb_ep *_ep)
}
 
ep = container_of(_ep, struct nbu2ss_ep, ep);
-   if (!ep) {
-   pr_err("%s, bad ep\n", __func__);
-   return -EINVAL;
-   }
 
udc = ep->udc;
if (!udc) {
@@ -2885,10 +2873,6 @@ static void  nbu2ss_ep_fifo_flush(struct usb_ep *_ep)
}
 
ep = container_of(_ep, struct nbu2ss_ep, ep);
-   if (!ep) {
-   pr_err("udc: %s, bad ep\n", __func__);
-   return;
-   }
 
udc = ep->udc;
if (!udc) {
@@ -2959,10 +2943,6 @@ static int nbu2ss_gad_wakeup(struct usb_gadget *pgadget)
}
 
udc = container_of(pgadget, struct nbu2ss_udc, gadget);
-   if (!udc) {
-   dev_err(&pgadget->dev, "%s, udc == NULL\n", __func__);
-   return -EINVAL;
-   }
 
data = gpio_get_value(VBUS_VALUE);
if (data == 0) {
-- 
2.17.1

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


Re: [PATCH v2 05/17] compat_ioctl: move more drivers to generic_compat_ioctl_ptrarg

2018-09-24 Thread Arnd Bergmann
On Tue, Sep 18, 2018 at 7:59 PM Jason Gunthorpe  wrote:
>
> On Tue, Sep 18, 2018 at 10:51:08AM -0700, Darren Hart wrote:
> > On Fri, Sep 14, 2018 at 09:57:48PM +0100, Al Viro wrote:
> > > On Fri, Sep 14, 2018 at 01:35:06PM -0700, Darren Hart wrote:
> > >
> > > > Acked-by: Darren Hart (VMware) 
> > > >
> > > > As for a longer term solution, would it be possible to init fops in such
> > > > a way that the compat_ioctl call defaults to generic_compat_ioctl_ptrarg
> > > > so we don't have to duplicate this boilerplate for every ioctl fops
> > > > structure?
> > >
> > > Bad idea, that...  Because several years down the road somebody will 
> > > add
> > > an ioctl that takes an unsigned int for argument.  Without so much as 
> > > looking
> > > at your magical mystery macro being used to initialize file_operations.
> >
> > Fair, being explicit in the declaration as it is currently may be
> > preferable then.
>
> It would be much cleaner and safer if you could arrange things to add
> something like this to struct file_operations:
>
>   long (*ptr_ioctl) (struct file *, unsigned int, void __user *);
>
> Where the core code automatically converts the unsigned long to the
> void __user * as appropriate.
>
> Then it just works right always and the compiler will help address
> Al's concern down the road.

I think if we wanted to do this with a new file operation, the best
way would be to do the copy_from_user()/copy_to_user() in the caller
as well.

We already do this inside of some subsystems, notably drivers/media/,
and it simplifies the implementation of the ioctl handler function
significantly. We obviously cannot do this in general, both because of
traditional drivers that have 16-bit command codes (drivers/tty and others)
and also because of drivers that by accident defined the commands
incorrectly and use the wrong type or the wrong direction in the
definition.

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


Re: [PATCH v2 05/17] compat_ioctl: move more drivers to generic_compat_ioctl_ptrarg

2018-09-24 Thread Jason Gunthorpe
On Mon, Sep 24, 2018 at 10:18:52PM +0200, Arnd Bergmann wrote:
> On Tue, Sep 18, 2018 at 7:59 PM Jason Gunthorpe  wrote:
> >
> > On Tue, Sep 18, 2018 at 10:51:08AM -0700, Darren Hart wrote:
> > > On Fri, Sep 14, 2018 at 09:57:48PM +0100, Al Viro wrote:
> > > > On Fri, Sep 14, 2018 at 01:35:06PM -0700, Darren Hart wrote:
> > > >
> > > > > Acked-by: Darren Hart (VMware) 
> > > > >
> > > > > As for a longer term solution, would it be possible to init fops in 
> > > > > such
> > > > > a way that the compat_ioctl call defaults to 
> > > > > generic_compat_ioctl_ptrarg
> > > > > so we don't have to duplicate this boilerplate for every ioctl fops
> > > > > structure?
> > > >
> > > > Bad idea, that...  Because several years down the road somebody 
> > > > will add
> > > > an ioctl that takes an unsigned int for argument.  Without so much as 
> > > > looking
> > > > at your magical mystery macro being used to initialize file_operations.
> > >
> > > Fair, being explicit in the declaration as it is currently may be
> > > preferable then.
> >
> > It would be much cleaner and safer if you could arrange things to add
> > something like this to struct file_operations:
> >
> >   long (*ptr_ioctl) (struct file *, unsigned int, void __user *);
> >
> > Where the core code automatically converts the unsigned long to the
> > void __user * as appropriate.
> >
> > Then it just works right always and the compiler will help address
> > Al's concern down the road.
> 
> I think if we wanted to do this with a new file operation, the best
> way would be to do the copy_from_user()/copy_to_user() in the caller
> as well.
>
> We already do this inside of some subsystems, notably drivers/media/,
> and it simplifies the implementation of the ioctl handler function
> significantly. We obviously cannot do this in general, both because of
> traditional drivers that have 16-bit command codes (drivers/tty and others)
> and also because of drivers that by accident defined the commands
> incorrectly and use the wrong type or the wrong direction in the
> definition.

That could work well, but the first idea could be done globally and
mechanically, while this would require very careful per-driver
investigation. 

Particularly if the core code has worse performance.. ie due to
kmalloc calls or something.

I think it would make more sense to start by having the core do the
case to __user and then add another entry point to have the core do
the copy_from_user, and so on.

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


Re: [patch 00/11] x86/vdso: Cleanups, simmplifications and CLOCK_TAI support

2018-09-24 Thread Arnd Bergmann
On Mon, Sep 17, 2018 at 3:00 PM Thomas Gleixner  wrote:
>
> On Fri, 14 Sep 2018, Arnd Bergmann wrote:
> > On Fri, Sep 14, 2018 at 2:52 PM Thomas Gleixner  wrote:
> > A couple of architectures (s390, ia64, riscv, powerpc, arm64)
> > implement the vdso as assembler code at the moment, so they
> > won't be as easy to consolidate (other than outright replacing all
> > the code).
> >
> > The other five:
> > arch/x86/entry/vdso/vclock_gettime.c
> > arch/sparc/vdso/vclock_gettime.c
> > arch/nds32/kernel/vdso/gettimeofday.c
> > arch/mips/vdso/gettimeofday.c
> > arch/arm/vdso/vgettimeofday.c
> >
> > are basically all minor variations of the same code base and could be
> > consolidated to some degree.
> > Any suggestions here? Should we plan to do that consolitdation based on
> > your new version, or just add clock_gettime64 in arm32 and x86-32, and then
> > be done with it? The other ones will obviously still be fast for 32-bit 
> > time_t
> > and will have a working non-vdso sys_clock_getttime64().
>
> In principle consolidating all those implementations should be possible to
> some extent and probably worthwhile. What's arch specific are the actual
> accessors to the hardware clocks.

Ok.

> > I also wonder about clock_getres(): half the architectures seem to implement
> > it in vdso, but notably arm32 and x86 don't, and I had not expected it to be
> > performance critical given that the result is easily cached in user space.
>
> getres() is not really performance critical, but adding it does not create
> a huge problem either.

Right, I'd just not add a getres_time64() to the vdso then.

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


Re: [PATCH v2 05/17] compat_ioctl: move more drivers to generic_compat_ioctl_ptrarg

2018-09-24 Thread Arnd Bergmann
On Mon, Sep 24, 2018 at 10:35 PM Jason Gunthorpe  wrote:
> On Mon, Sep 24, 2018 at 10:18:52PM +0200, Arnd Bergmann wrote:
> > On Tue, Sep 18, 2018 at 7:59 PM Jason Gunthorpe  wrote:
> > > On Tue, Sep 18, 2018 at 10:51:08AM -0700, Darren Hart wrote:
> > > > On Fri, Sep 14, 2018 at 09:57:48PM +0100, Al Viro wrote:
> > > > > On Fri, Sep 14, 2018 at 01:35:06PM -0700, Darren Hart wrote:
> > We already do this inside of some subsystems, notably drivers/media/,
> > and it simplifies the implementation of the ioctl handler function
> > significantly. We obviously cannot do this in general, both because of
> > traditional drivers that have 16-bit command codes (drivers/tty and others)
> > and also because of drivers that by accident defined the commands
> > incorrectly and use the wrong type or the wrong direction in the
> > definition.
>
> That could work well, but the first idea could be done globally and
> mechanically, while this would require very careful per-driver
> investigation.
>
> Particularly if the core code has worse performance.. ie due to
> kmalloc calls or something.
>
> I think it would make more sense to start by having the core do the
> case to __user and then add another entry point to have the core do
> the copy_from_user, and so on.

Having six separate callback pointers to implement a single
system call seems a bit excessive though.

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


Re: ICH BRAUCHE IHRE FINANZIELLE UNTERSTÜTZUNG!!

2018-09-24 Thread Olivia Nicolas


Von: Olivia Nicolas
Liebste,
Guten Tag und danke für Ihre Aufmerksamkeit. Bitte ich möchte, dass Sie meine 
E-Mail sorgfältig lesen und mir helfen, dieses Projekt zu bearbeiten. Ich bin 
Fräulein Olivia Nicolas und ich schreibe demütig für Ihre Partnerschaft und 
Unterstützung bei der Übertragung und Investition meiner Erbschaft US $ 
6.500.000,00 (Sechs Millionen fünfhunderttausend US-Dollar), die mein 
verstorbener geliebter Vater in einer Bank hinterlegt hat, bevor er starb.

Ich möchte Ihnen versichern, dass dieser Fonds von meinem verstorbenen Vater 
legal erworben wurde und keinen kriminellen Hintergrund hat. Mein Vater hat 
diesen Fonds legal erworben, bevor er während seiner Geschäftsreise zu Tode 
vergiftet wurde. Der Tod meines Vaters wurde verdächtigt, von seinen Verwandten 
geplant zu werden, die während dieser Zeit seiner Geschäftsreise mit ihm 
reisten. Weil nach 3 Monaten des Todes meines Vaters seine Verwandten alle 
Eigenschaften meines verstorbenen Vaters in Anspruch nahmen und verkauften.

Die Verwandten meines verstorbenen Vaters wissen nichts von den sechs Millionen 
US-Dollar, die mein verstorbener Vater bei der Bank deponiert hat, und mein 
verstorbener Vater hat mir vor seinem Tod heimlich gesagt, dass ich in jedem 
Land nach einem ausländischen Partner suchen sollte meiner Wahl, wo ich dieses 
Geld für meine eigenen Zwecke übertrage.

Bitte helfen Sie mir, dieses Geld für geschäftliche Zwecke in Ihrem Land auf 
Ihr Konto zu überweisen. Ich habe diese Entscheidung getroffen, weil ich von 
den Verwandten meines verstorbenen Vaters eine Menge Demütigungen erlitten 
habe. Zur Zeit habe ich mit dem Direktor der Bank gesprochen, wo mein 
verstorbener Vater dieses Geld hinterlegt hat. Ich habe dem Bankdirektor 
erklärt, wie dringend es ist, dass der Fonds ins Ausland transferiert wird, 
damit ich dieses Land zu meiner Sicherheit verlassen kann. Der Direktor der 
Bank hat mir versichert, dass der Fonds transferiert wird, sobald ich jemanden 
überbringe, der ehrlich ist, den Fonds in meinem Namen zu diesem Zweck zu 
erhalten.

Bitte seien Sie versichert, dass die Bank den Fonds auf Ihr Konto überweisen 
wird und es kein Problem geben wird. Diese Transaktion ist 100% risikofrei und 
legitim. Ich bin bereit, Ihnen 30% des Gesamtbetrages als Entschädigung für 
Ihre Bemühungen / Eingaben nach der erfolgreichen Überweisung dieses Fonds auf 
Ihr Konto anzubieten. Sie werden mir auch helfen, 10% an 
Wohltätigkeitsorganisationen und Mütterlose Babys in Ihrem Land zu spenden.

Bitte, alles was ich möchte, dass du für mich tust, ist, als mein ausländischer 
Partner zu stehen, so dass die Bank diesen Fonds auf dein Konto überweist, 
damit ich dieses Land leben kann. Bitte, ich brauche jetzt dringend Hilfe wegen 
meines jetzigen Zustandes. Auf Ihre volle Annahme, mit mir zu diesem Zweck zu 
arbeiten, geben Sie bitte Ihr Interesse durch Antwort zurück zu mir, damit ich 
Ihnen die notwendigen Informationen und die Details, wie weiter verfahren 
werde, gebe ich Ihnen 30% des Geldes für Ihre Hilfe und Hilfe, damit umzugehen.

Ihre dringende Antwort wird geschätzt.
Freundliche Grüße
Olivia Nicolas
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] staging: vc04_services: Update TODO re: arm64

2018-09-24 Thread Aymen Qader
This patch removes the TODO item to remove manual cache flushing from b
ulk_receieve - this was done in 7e8dbea. Also remove the unnecessary
asm/cacheflush.h header.

Signed-off-by: Aymen Qader 
---
 drivers/staging/vc04_services/bcm2835-camera/TODO | 6 --
 drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.c | 1 -
 2 files changed, 7 deletions(-)

diff --git a/drivers/staging/vc04_services/bcm2835-camera/TODO 
b/drivers/staging/vc04_services/bcm2835-camera/TODO
index cefce72d814f..6c2b4ffe4996 100644
--- a/drivers/staging/vc04_services/bcm2835-camera/TODO
+++ b/drivers/staging/vc04_services/bcm2835-camera/TODO
@@ -15,9 +15,3 @@ padding in the V4L2 spec, but that padding doesn't match what 
the
 hardware can do.  If we exposed the native padding requirements
 through the V4L2 "multiplanar" formats, the firmware would have one
 less copy it needed to do.
-
-3) Port to ARM64
-
-The bulk_receive() does some manual cache flushing that are 32-bit ARM
-only, which we should convert to proper cross-platform APIs.
-
diff --git a/drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.c 
b/drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.c
index 51e5b04ff0f5..6e5c1d4ee122 100644
--- a/drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.c
+++ b/drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.c
@@ -21,7 +21,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 
 #include "mmal-common.h"
-- 
2.17.1

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


Re: ICH BRAUCHE IHRE FINANZIELLE UNTERSTÜTZUNG!!

2018-09-24 Thread Olivia Nicolas


Von: Olivia Nicolas
Liebste,
Guten Tag und danke für Ihre Aufmerksamkeit. Bitte ich möchte, dass Sie meine 
E-Mail sorgfältig lesen und mir helfen, dieses Projekt zu bearbeiten. Ich bin 
Fräulein Olivia Nicolas und ich schreibe demütig für Ihre Partnerschaft und 
Unterstützung bei der Übertragung und Investition meiner Erbschaft US $ 
6.500.000,00 (Sechs Millionen fünfhunderttausend US-Dollar), die mein 
verstorbener geliebter Vater in einer Bank hinterlegt hat, bevor er starb.

Ich möchte Ihnen versichern, dass dieser Fonds von meinem verstorbenen Vater 
legal erworben wurde und keinen kriminellen Hintergrund hat. Mein Vater hat 
diesen Fonds legal erworben, bevor er während seiner Geschäftsreise zu Tode 
vergiftet wurde. Der Tod meines Vaters wurde verdächtigt, von seinen Verwandten 
geplant zu werden, die während dieser Zeit seiner Geschäftsreise mit ihm 
reisten. Weil nach 3 Monaten des Todes meines Vaters seine Verwandten alle 
Eigenschaften meines verstorbenen Vaters in Anspruch nahmen und verkauften.

Die Verwandten meines verstorbenen Vaters wissen nichts von den sechs Millionen 
US-Dollar, die mein verstorbener Vater bei der Bank deponiert hat, und mein 
verstorbener Vater hat mir vor seinem Tod heimlich gesagt, dass ich in jedem 
Land nach einem ausländischen Partner suchen sollte meiner Wahl, wo ich dieses 
Geld für meine eigenen Zwecke übertrage.

Bitte helfen Sie mir, dieses Geld für geschäftliche Zwecke in Ihrem Land auf 
Ihr Konto zu überweisen. Ich habe diese Entscheidung getroffen, weil ich von 
den Verwandten meines verstorbenen Vaters eine Menge Demütigungen erlitten 
habe. Zur Zeit habe ich mit dem Direktor der Bank gesprochen, wo mein 
verstorbener Vater dieses Geld hinterlegt hat. Ich habe dem Bankdirektor 
erklärt, wie dringend es ist, dass der Fonds ins Ausland transferiert wird, 
damit ich dieses Land zu meiner Sicherheit verlassen kann. Der Direktor der 
Bank hat mir versichert, dass der Fonds transferiert wird, sobald ich jemanden 
überbringe, der ehrlich ist, den Fonds in meinem Namen zu diesem Zweck zu 
erhalten.

Bitte seien Sie versichert, dass die Bank den Fonds auf Ihr Konto überweisen 
wird und es kein Problem geben wird. Diese Transaktion ist 100% risikofrei und 
legitim. Ich bin bereit, Ihnen 30% des Gesamtbetrages als Entschädigung für 
Ihre Bemühungen / Eingaben nach der erfolgreichen Überweisung dieses Fonds auf 
Ihr Konto anzubieten. Sie werden mir auch helfen, 10% an 
Wohltätigkeitsorganisationen und Mütterlose Babys in Ihrem Land zu spenden.

Bitte, alles was ich möchte, dass du für mich tust, ist, als mein ausländischer 
Partner zu stehen, so dass die Bank diesen Fonds auf dein Konto überweist, 
damit ich dieses Land leben kann. Bitte, ich brauche jetzt dringend Hilfe wegen 
meines jetzigen Zustandes. Auf Ihre volle Annahme, mit mir zu diesem Zweck zu 
arbeiten, geben Sie bitte Ihr Interesse durch Antwort zurück zu mir, damit ich 
Ihnen die notwendigen Informationen und die Details, wie weiter verfahren 
werde, gebe ich Ihnen 30% des Geldes für Ihre Hilfe und Hilfe, damit umzugehen.

Ihre dringende Antwort wird geschätzt.
Freundliche Grüße
Olivia Nicolas
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] staging: vc04_services: Update TODO re: arm64

2018-09-24 Thread Scott Branden

Hi Aymen


On 18-09-24 03:48 PM, Aymen Qader wrote:

This patch removes the TODO item to remove manual cache flushing from b

Remove the use of "This patch".
Please read 
https://www.kernel.org/doc/html/latest/process/submitting-patches.html

"Describe your changes in imperative mood"

Also, it looks like you broke "bulk_receive" across 2 lines.
Please correct and fix receive typo.

ulk_receieve - this was done in 7e8dbea. Also remove the unnecessary

also read in the guidelines:
If you want to refer to a specific commit, don't just refer to the SHA-1 
ID of the commit.
Please also include the oneline summary of the commit, to make it easier 
for reviewers to know what it is about.

asm/cacheflush.h header.

Signed-off-by: Aymen Qader 
---
  drivers/staging/vc04_services/bcm2835-camera/TODO | 6 --
  drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.c | 1 -
  2 files changed, 7 deletions(-)

diff --git a/drivers/staging/vc04_services/bcm2835-camera/TODO 
b/drivers/staging/vc04_services/bcm2835-camera/TODO
index cefce72d814f..6c2b4ffe4996 100644
--- a/drivers/staging/vc04_services/bcm2835-camera/TODO
+++ b/drivers/staging/vc04_services/bcm2835-camera/TODO
@@ -15,9 +15,3 @@ padding in the V4L2 spec, but that padding doesn't match what 
the
  hardware can do.  If we exposed the native padding requirements
  through the V4L2 "multiplanar" formats, the firmware would have one
  less copy it needed to do.
-
-3) Port to ARM64
-
-The bulk_receive() does some manual cache flushing that are 32-bit ARM
-only, which we should convert to proper cross-platform APIs.
-
diff --git a/drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.c 
b/drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.c
index 51e5b04ff0f5..6e5c1d4ee122 100644
--- a/drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.c
+++ b/drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.c
@@ -21,7 +21,6 @@
  #include 
  #include 
  #include 
-#include 
  #include 
  
  #include "mmal-common.h"


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


[PATCH v2] staging: vc04_services: Update TODO re: arm64

2018-09-24 Thread Aymen Qader
Remove the TODO item to remove manual cache flushing from bulk_receive.
This was previously done in this commit:

(7e8dbdea) staging: bcm2835-camera: Remove explicit cache flush
operations

Also remove the unnecessary asm/cacheflush.h header.

Signed-off-by: Aymen Qader 
---
v2: Make commit message clearer

 drivers/staging/vc04_services/bcm2835-camera/TODO | 6 --
 drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.c | 1 -
 2 files changed, 7 deletions(-)

diff --git a/drivers/staging/vc04_services/bcm2835-camera/TODO 
b/drivers/staging/vc04_services/bcm2835-camera/TODO
index cefce72d814f..6c2b4ffe4996 100644
--- a/drivers/staging/vc04_services/bcm2835-camera/TODO
+++ b/drivers/staging/vc04_services/bcm2835-camera/TODO
@@ -15,9 +15,3 @@ padding in the V4L2 spec, but that padding doesn't match what 
the
 hardware can do.  If we exposed the native padding requirements
 through the V4L2 "multiplanar" formats, the firmware would have one
 less copy it needed to do.
-
-3) Port to ARM64
-
-The bulk_receive() does some manual cache flushing that are 32-bit ARM
-only, which we should convert to proper cross-platform APIs.
-
diff --git a/drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.c 
b/drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.c
index 51e5b04ff0f5..6e5c1d4ee122 100644
--- a/drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.c
+++ b/drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.c
@@ -21,7 +21,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 
 #include "mmal-common.h"
-- 
2.17.1

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


[PATCH] staging: erofs: change inode related info in erofs_statfs()

2018-09-24 Thread Chengguang Xu
As a read only filesystem, it's better to show available
inode num as 0 in statfs.

Signed-off-by: Chengguang Xu 
---
 drivers/staging/erofs/super.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/erofs/super.c b/drivers/staging/erofs/super.c
index 51b076255988..6601a242071f 100644
--- a/drivers/staging/erofs/super.c
+++ b/drivers/staging/erofs/super.c
@@ -627,8 +627,8 @@ static int erofs_statfs(struct dentry *dentry, struct 
kstatfs *buf)
buf->f_blocks = sbi->blocks;
buf->f_bfree = buf->f_bavail = 0;
 
-   buf->f_files = ULLONG_MAX;
-   buf->f_ffree = ULLONG_MAX - sbi->inos;
+   buf->f_files = sbi->inos;
+   buf->f_ffree = 0;
 
buf->f_namelen = EROFS_NAME_LEN;
 
-- 
2.17.1

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


Re: [PATCH] staging: erofs: change inode related info in erofs_statfs()

2018-09-24 Thread Gao Xiang
Hi Chengguang,

On 2018/9/25 7:41, Chengguang Xu wrote:
> As a read only filesystem, it's better to show available
> inode num as 0 in statfs.
> 
> Signed-off-by: Chengguang Xu 
> ---
>  drivers/staging/erofs/super.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/staging/erofs/super.c b/drivers/staging/erofs/super.c
> index 51b076255988..6601a242071f 100644
> --- a/drivers/staging/erofs/super.c
> +++ b/drivers/staging/erofs/super.c
> @@ -627,8 +627,8 @@ static int erofs_statfs(struct dentry *dentry, struct 
> kstatfs *buf)
>   buf->f_blocks = sbi->blocks;
>   buf->f_bfree = buf->f_bavail = 0;
>  
> - buf->f_files = ULLONG_MAX;
> - buf->f_ffree = ULLONG_MAX - sbi->inos;
> + buf->f_files = sbi->inos;

For erofs, nid indicates the inode position rather than just a id, and it could 
not be continious.

The in-byte inode position is calculated by the following formula:
nid * 32(inode_v1) + meta_blkaddr * 4096

These two fields are defined as:
fsfilcnt_tf_filesTotal number of file serial numbers.
fsfilcnt_tf_ffreeTotal number of free file serial numbers.

I'm afraid if f_files == sbi->inos, the actual inode number (nid) could be 
larger than f_files.
I have no idea whether it could give undefined behavior to user program...

Thanks,
Gao Xiang


> + buf->f_ffree = 0;
>  
>   buf->f_namelen = EROFS_NAME_LEN;
>  
> 
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH RFCv2 3/6] mm/memory_hotplug: fix online/offline_pages called w.o. mem_hotplug_lock

2018-09-24 Thread Rashmica Gupta
On Mon, 2018-09-17 at 09:32 +0200, David Hildenbrand wrote:
> Am 03.09.18 um 02:36 schrieb Rashmica:
> > Hi David,
> > 
> > 
> > On 21/08/18 20:44, David Hildenbrand wrote:
> > 
> > > There seem to be some problems as result of 30467e0b3be ("mm,
> > > hotplug:
> > > fix concurrent memory hot-add deadlock"), which tried to fix a
> > > possible
> > > lock inversion reported and discussed in [1] due to the two locks
> > >   a) device_lock()
> > >   b) mem_hotplug_lock
> > > 
> > > While add_memory() first takes b), followed by a) during
> > > bus_probe_device(), onlining of memory from user space first took
> > > b),
> > > followed by a), exposing a possible deadlock.
> > 
> > Do you mean "onlining of memory from user space first took a),
> > followed by b)"? 
> 
> Very right, thanks.
> 
> > 
> > > In [1], and it was decided to not make use of
> > > device_hotplug_lock, but
> > > rather to enforce a locking order.
> > > 
> > > The problems I spotted related to this:
> > > 
> > > 1. Memory block device attributes: While .state first calls
> > >mem_hotplug_begin() and the calls device_online() - which
> > > takes
> > >device_lock() - .online does no longer call
> > > mem_hotplug_begin(), so
> > >effectively calls online_pages() without mem_hotplug_lock.
> > > 
> > > 2. device_online() should be called under device_hotplug_lock,
> > > however
> > >onlining memory during add_memory() does not take care of
> > > that.
> > > 
> > > In addition, I think there is also something wrong about the
> > > locking in
> > > 
> > > 3. arch/powerpc/platforms/powernv/memtrace.c calls
> > > offline_pages()
> > >without locks. This was introduced after 30467e0b3be. And
> > > skimming over
> > >the code, I assume it could need some more care in regards to
> > > locking
> > >(e.g. device_online() called without device_hotplug_lock - but
> > > I'll
> > >not touch that for now).
> > 
> > Can you mention that you fixed this in later patches?
> 
> Sure!
> 
> > 
> > 
> > The series looks good to me. Feel free to add my reviewed-by:
> > 
> > Reviewed-by: Rashmica Gupta 
> > 
> 
> Thanks, r-b only for this patch or all of the series?

Sorry, I somehow missed this. To all of the series.
> 
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 04/13] staging: comedi: ni_routing: Add NI signal routing info

2018-09-24 Thread Spencer E. Olson

These static arrays are
  (1) not expressed with as much "const"ness as suggested
  (2) included into one compile unit
because
 - ni_device_routes.routes and ni_route_set.src are sorted at module
   load time using the kernel sort(...) routine.
 - ni_device_routes.n_route_sets and ni_route_set.n_src data
   members are changed as a result of the counting/sorting.
 - ni_device_routes.routes and ni_route_set.src are both searched at
   runtime using the kernel bsearch(...) routine.

These choices were made as a compromise between maintenance, 
code-execution performance, and memory footprint.  Rather than require a 
large, mostly sparse table be kept for each ni hardware device, the 
signal route information is divided up into one large table of register 
values for each device family and smaller hardware-specific sorted lists 
that can easily be searched to identify possible signal routes.


It seemed unreasonable to require a developer to maintain the proper 
order of the structures to provide for best searching.  It also seemed 
unreasonable to require the developer to specifically instantiate the 
ni_device_routes.n_route_sets and ni_route_set.n_src data members correctly.


Because these arrays are sorted (at module load time) by ni_routes, it 
seemed best to have the symbols for these tables only have static 
linkage, thus ensuring that _only_ the ni_routes module accesses these.



On 09/21/2018 06:09 AM, Ian Abbott wrote:

On 19/09/18 17:38, Spencer E. Olson wrote:

See README for a thorough discussion of this content.

Adds tables of all register values for routing various signals to various
terminals on National Instruments hardware.  This information is directly
compared to and taken from register-level programming documentation 
and/or

register-level programming examples as provided by National Instruments.

Furthermore, this information was mostly compared (favorably) to the
register values already used in the comedi drivers for NI hardware.

Adds tables of valid routes for many devices.  This information is not
consistent from device to device, nor entirely consistent within device
families.  One additional major challenge is that this information 
does not

seem to be obtainable in any programmatic fashion, neither through the
proprietary NIDAQmx(-base) c-libraries, nor with register level
programming, _nor_ through any documentation.  In fact, the only 
consistent

source of this information is through the proprietary NI-MAX software,
which currently only runs on Windows platforms.  A further challenge is
that this information cannot be exported from NI-MAX, except by 
screenshot.


The collection and maintenance of this information is somewhat tedious 
and

requires frequent re-examination and comparison of NI-MAX and/or the
NI-MHDDK documentation (register programming information) and NI-MHDDK
examples.  Tools are added with this patch to facilitate generating CSV
files from the data tables.  These CSV files can be used with a 
spreadsheet
program to provide better visual comparision with screenshots gathered 
from

NI-MAX.  Tools are also added to regenerate the data tables from CSV
content--this greatly enhances updating data tables with large changes
(such as when adding devices).

Signed-off-by: Spencer E. Olson 
---
  .../staging/comedi/drivers/ni_routing/README  |  240 ++
  .../drivers/ni_routing/ni_device_routes.c |   66 +
  .../ni_routing/ni_device_routes/pci-6070e.c   |  637 
  .../ni_routing/ni_device_routes/pci-6220.c    | 1416 +++
  .../ni_routing/ni_device_routes/pci-6221.c    | 1600 
  .../ni_routing/ni_device_routes/pci-6229.c    | 1600 
  .../ni_routing/ni_device_routes/pci-6251.c    | 1650 
  .../ni_routing/ni_device_routes/pci-6254.c    | 1462 +++
  .../ni_routing/ni_device_routes/pci-6259.c    | 1650 
  .../ni_routing/ni_device_routes/pci-6534.c    |  288 ++
  .../ni_routing/ni_device_routes/pci-6602.c    | 3376 +
  .../ni_routing/ni_device_routes/pci-6713.c    |  398 ++
  .../ni_routing/ni_device_routes/pci-6723.c    |  398 ++
  .../ni_routing/ni_device_routes/pci-6733.c    |  426 +++
  .../ni_routing/ni_device_routes/pxi-6030e.c   |  606 +++
  .../ni_routing/ni_device_routes/pxi-6224.c    | 1430 +++
  .../ni_routing/ni_device_routes/pxi-6225.c    | 1611 
  .../ni_routing/ni_device_routes/pxi-6251.c    | 1653 
  .../ni_routing/ni_device_routes/pxi-6733.c    |  426 +++
  .../ni_routing/ni_device_routes/pxie-6251.c   | 1654 
  .../drivers/ni_routing/ni_route_values.c  |   96 +
  .../ni_routing/ni_route_values/ni_660x.c  |  641 
  .../ni_routing/ni_route_values/ni_eseries.c   |  593 +++
  .../ni_routing/ni_route_values/ni_mseries.c   | 1743 +
  .../drivers/ni_routing/tools/.gitignore   |    4 +
  .../comedi/drivers/ni_routing/tools/Makefile  |   67 +
  .../ni_routing/tools/convert_c_to_py.c    |  161 +
  .../ni_routing/tools/convert_csv_to_c.py  |  4

[PATCH v2] memory_hotplug: Free pages as higher order

2018-09-24 Thread Arun KS
When free pages are done with higher order, time spend on
coalescing pages by buddy allocator can be reduced. With
section size of 256MB, hot add latency of a single section
shows improvement from 50-60 ms to less than 1 ms, hence
improving the hot add latency by 60%.

Modify external providers of online callback to align with
the change.

Signed-off-by: Arun KS 
---
Changes since v1:
- Removed prefetch()

Changes since RFC:
- Rebase.
- As suggested by Michal Hocko remove pages_per_block.
- Modifed external providers of online_page_callback.

v1: https://lore.kernel.org/patchwork/patch/989445/
RFC: https://lore.kernel.org/patchwork/patch/984754/
---
 drivers/hv/hv_balloon.c|  6 +++--
 drivers/xen/balloon.c  | 18 ---
 include/linux/memory_hotplug.h |  2 +-
 mm/memory_hotplug.c| 51 --
 4 files changed, 59 insertions(+), 18 deletions(-)

diff --git a/drivers/hv/hv_balloon.c b/drivers/hv/hv_balloon.c
index b1b7880..c5bc0b5 100644
--- a/drivers/hv/hv_balloon.c
+++ b/drivers/hv/hv_balloon.c
@@ -771,7 +771,7 @@ static void hv_mem_hot_add(unsigned long start, unsigned 
long size,
}
 }
 
-static void hv_online_page(struct page *pg)
+static int hv_online_page(struct page *pg, unsigned int order)
 {
struct hv_hotadd_state *has;
unsigned long flags;
@@ -783,10 +783,12 @@ static void hv_online_page(struct page *pg)
if ((pfn < has->start_pfn) || (pfn >= has->end_pfn))
continue;
 
-   hv_page_online_one(has, pg);
+   hv_bring_pgs_online(has, pfn, (1UL << order));
break;
}
spin_unlock_irqrestore(&dm_device.ha_lock, flags);
+
+   return 0;
 }
 
 static int pfn_covered(unsigned long start_pfn, unsigned long pfn_cnt)
diff --git a/drivers/xen/balloon.c b/drivers/xen/balloon.c
index e12bb25..010cf4d 100644
--- a/drivers/xen/balloon.c
+++ b/drivers/xen/balloon.c
@@ -390,8 +390,8 @@ static enum bp_state reserve_additional_memory(void)
 
/*
 * add_memory_resource() will call online_pages() which in its turn
-* will call xen_online_page() callback causing deadlock if we don't
-* release balloon_mutex here. Unlocking here is safe because the
+* will call xen_bring_pgs_online() callback causing deadlock if we
+* don't release balloon_mutex here. Unlocking here is safe because the
 * callers drop the mutex before trying again.
 */
mutex_unlock(&balloon_mutex);
@@ -422,6 +422,18 @@ static void xen_online_page(struct page *page)
mutex_unlock(&balloon_mutex);
 }
 
+static int xen_bring_pgs_online(struct page *pg, unsigned int order)
+{
+   unsigned long i, size = (1 << order);
+   unsigned long start_pfn = page_to_pfn(pg);
+
+   pr_debug("Online %lu pages starting at pfn 0x%lx\n", size, start_pfn);
+   for (i = 0; i < size; i++)
+   xen_online_page(pfn_to_page(start_pfn + i));
+
+   return 0;
+}
+
 static int xen_memory_notifier(struct notifier_block *nb, unsigned long val, 
void *v)
 {
if (val == MEM_ONLINE)
@@ -744,7 +756,7 @@ static int __init balloon_init(void)
balloon_stats.max_retry_count = RETRY_UNLIMITED;
 
 #ifdef CONFIG_XEN_BALLOON_MEMORY_HOTPLUG
-   set_online_page_callback(&xen_online_page);
+   set_online_page_callback(&xen_bring_pgs_online);
register_memory_notifier(&xen_memory_nb);
register_sysctl_table(xen_root);
 
diff --git a/include/linux/memory_hotplug.h b/include/linux/memory_hotplug.h
index 34a2822..7b04c1d 100644
--- a/include/linux/memory_hotplug.h
+++ b/include/linux/memory_hotplug.h
@@ -87,7 +87,7 @@ extern int test_pages_in_a_zone(unsigned long start_pfn, 
unsigned long end_pfn,
unsigned long *valid_start, unsigned long *valid_end);
 extern void __offline_isolated_pages(unsigned long, unsigned long);
 
-typedef void (*online_page_callback_t)(struct page *page);
+typedef int (*online_page_callback_t)(struct page *page, unsigned int order);
 
 extern int set_online_page_callback(online_page_callback_t callback);
 extern int restore_online_page_callback(online_page_callback_t callback);
diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
index 38d94b7..9f67794 100644
--- a/mm/memory_hotplug.c
+++ b/mm/memory_hotplug.c
@@ -47,7 +47,7 @@
  * and restore_online_page_callback() for generic callback restore.
  */
 
-static void generic_online_page(struct page *page);
+static int generic_online_page(struct page *page, unsigned int order);
 
 static online_page_callback_t online_page_callback = generic_online_page;
 static DEFINE_MUTEX(online_page_callback_lock);
@@ -655,26 +655,53 @@ void __online_page_free(struct page *page)
 }
 EXPORT_SYMBOL_GPL(__online_page_free);
 
-static void generic_online_page(struct page *page)
+static int generic_online_page(struct page *page, unsigned int order)
 {
-   __online_page_set_limits(page);
-   __online_page_incr

[PATCH v3 06/29] staging: wilc1000: use 'void' return type for host_int_get_assoc_res_info()

2018-09-24 Thread Ajay Singh
Change return type to 'void' for host_int_get_assoc_res_info() as its
return value is not used. 'rcvd_assoc_resp_info_len' parameter value is
used to know the status.

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

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 7729f83..237a098d 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -1388,10 +1388,10 @@ static void handle_rcvd_ntwrk_info(struct work_struct 
*work)
kfree(msg);
 }
 
-static s32 host_int_get_assoc_res_info(struct wilc_vif *vif,
-  u8 *assoc_resp_info,
-  u32 max_assoc_resp_info_len,
-  u32 *rcvd_assoc_resp_info_len)
+static void host_int_get_assoc_res_info(struct wilc_vif *vif,
+   u8 *assoc_resp_info,
+   u32 max_assoc_resp_info_len,
+   u32 *rcvd_assoc_resp_info_len)
 {
int result;
struct wid wid;
@@ -1406,11 +1406,10 @@ static s32 host_int_get_assoc_res_info(struct wilc_vif 
*vif,
if (result) {
*rcvd_assoc_resp_info_len = 0;
netdev_err(vif->ndev, "Failed to send association response\n");
-   return -EINVAL;
+   return;
}
 
*rcvd_assoc_resp_info_len = wid.size;
-   return result;
 }
 
 static inline void host_int_free_user_conn_req(struct host_if_drv *hif_drv)
-- 
2.7.4

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


[PATCH v3 00/29] staging: wilc1000: avoid static variables and cleanup changes

2018-09-24 Thread Ajay Singh
This patch series contains changes to avoid the use of static variables.
Cleanup changes to fix some checkpatch issues and return void for
function if their return value is not used.
Also deleted 'wilc_debugfs.c' file as it's not used.

Changes since v2:
   Included Joe's suggestion for patch#28
- replaced previous patch with an improved version(refactor code)

Changes since v1:
   Address Dan's comment for patch#29
- return the correct error for failure in the second iteration

Ajay Singh (29):
  staging: wilc1000: change return type to 'void' for
wilc_frame_register()
  staging: wilc1000: change return type to 'void' for
wilc_wlan_set_bssid()
  staging: wilc1000: change return type to 'void' for lock init & deinit
functions
  staging: wilc1000: change return type to 'void' for
wilc_deinit_host_int()
  staging: wilc1000: change return type to 'void' for
wilc_wfi_deinit_mon_interface()
  staging: wilc1000: use 'void' return type for
host_int_get_assoc_res_info()
  staging: wilc1000: use 'void' return for wilc_wlan_txq_add_to_head()
  staging: wilc1000: change return type to 'void' tcp ack filter
functions
  staging: wilc1000: use 'void' return for
wilc_wlan_txq_filter_dup_tcp_ack()
  staging: wilc1000: change return type to 'void' for
wilc_wlan_cfg_indicate_rx()
  staging: wilc1000: refactor wilc_wlan_parse_info_frame() function
  staging: wilc1000: set default value of cfg response type in
wilc_wlan_cfg_indicate_rx()
  staging: wilc1000: changes 'val' type to u8 in wilc_cfg_byte struct
  staging: wilc1000: remove unused wid type values
  staging: wilc1000: remove unused wid from cfg struct
  staging: wilc1000: refactor code to remove 'mac_status' from
'wilc_mac_cfg' struct
  staging: wilc1000: refactor code to avoid static variables for config
parameters
  staging: wilc1000: rename 'wilc_mac_cfg' struct to 'wilc_cfg_str_vals'
  staging: wilc1000: avoid the use of 'hif_driver_comp' completion
variable
  staging: wilc1000: remove use of unnecessary 'wilc_connected_ssid'
variable
  staging: wilc1000: avoid use of 'g_sdio' static variable
  staging: wilc1000: avoid use of 'g_spi' static variable
  staging: wilc1000: remove unnecessary memset in sdio_init() &
wilc_spi_init()
  staging: wilc1000: remove p2p related static variables to wilc_vif
struct
  staging: wilc1000: remove wilc_debugfs.c file as its not used
  staging: wilc1000: remove unnecessary option used with ccflags-y in
Makefile
  staging: wilc1000: use usleep_range() in place of udelay()
  staging: wilc1000: refactor wilc_set_multicast_list() function
  staging: wilc1000: return exact error of register_netdev() from
wilc_netdev_init()

 drivers/staging/wilc1000/Makefile |   5 +-
 drivers/staging/wilc1000/host_interface.c |  64 ++---
 drivers/staging/wilc1000/host_interface.h |   6 +-
 drivers/staging/wilc1000/linux_mon.c  |   3 +-
 drivers/staging/wilc1000/linux_wlan.c |  64 +++--
 drivers/staging/wilc1000/wilc_debugfs.c   | 115 -
 drivers/staging/wilc1000/wilc_sdio.c  |  56 +++--
 drivers/staging/wilc1000/wilc_spi.c   |  57 +++--
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c |  90 +++
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.h |   4 +-
 drivers/staging/wilc1000/wilc_wfi_netdevice.h |  14 +-
 drivers/staging/wilc1000/wilc_wlan.c  |  44 ++--
 drivers/staging/wilc1000/wilc_wlan.h  |   3 +-
 drivers/staging/wilc1000/wilc_wlan_cfg.c  | 294 +-
 drivers/staging/wilc1000/wilc_wlan_cfg.h  |  26 +-
 drivers/staging/wilc1000/wilc_wlan_if.h   |   4 -
 16 files changed, 340 insertions(+), 509 deletions(-)
 delete mode 100644 drivers/staging/wilc1000/wilc_debugfs.c

-- 
2.7.4

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


[PATCH v3 01/29] staging: wilc1000: change return type to 'void' for wilc_frame_register()

2018-09-24 Thread Ajay Singh
Cleanup patch to use 'void' return type for wilc_frame_register(), as
its return value is not used.

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

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 5388be9..7729f83 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -3641,14 +3641,14 @@ int wilc_listen_state_expired(struct wilc_vif *vif, u32 
session_id)
return result;
 }
 
-int wilc_frame_register(struct wilc_vif *vif, u16 frame_type, bool reg)
+void wilc_frame_register(struct wilc_vif *vif, u16 frame_type, bool reg)
 {
int result;
struct host_if_msg *msg;
 
msg = wilc_alloc_work(vif, handle_register_frame, false);
if (IS_ERR(msg))
-   return PTR_ERR(msg);
+   return;
 
switch (frame_type) {
case ACTION:
@@ -3670,8 +3670,6 @@ int wilc_frame_register(struct wilc_vif *vif, u16 
frame_type, bool reg)
netdev_err(vif->ndev, "%s: enqueue work failed\n", __func__);
kfree(msg);
}
-
-   return result;
 }
 
 int wilc_add_beacon(struct wilc_vif *vif, u32 interval, u32 dtim_period,
diff --git a/drivers/staging/wilc1000/host_interface.h 
b/drivers/staging/wilc1000/host_interface.h
index a48818f..15ffaeb 100644
--- a/drivers/staging/wilc1000/host_interface.h
+++ b/drivers/staging/wilc1000/host_interface.h
@@ -348,7 +348,7 @@ int wilc_remain_on_channel(struct wilc_vif *vif, u32 
session_id,
   wilc_remain_on_chan_ready ready,
   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);
+void wilc_frame_register(struct wilc_vif *vif, u16 frame_type, bool reg);
 int wilc_set_wfi_drv_handler(struct wilc_vif *vif, int index, u8 mode,
 u8 ifc_id);
 int wilc_set_operation_mode(struct wilc_vif *vif, u32 mode);
-- 
2.7.4

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


[PATCH v3 02/29] staging: wilc1000: change return type to 'void' for wilc_wlan_set_bssid()

2018-09-24 Thread Ajay Singh
Cleanup patch to use 'void' return type for wilc_wlan_set_bssid(),
as its always returns the same value.

Signed-off-by: Ajay Singh 
---
 drivers/staging/wilc1000/linux_wlan.c | 4 +---
 drivers/staging/wilc1000/wilc_wfi_netdevice.h | 2 +-
 2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index 49afda6..d1d2c64 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -192,14 +192,12 @@ static struct net_device *get_if_handler(struct wilc 
*wilc, u8 *mac_header)
return NULL;
 }
 
-int wilc_wlan_set_bssid(struct net_device *wilc_netdev, u8 *bssid, u8 mode)
+void wilc_wlan_set_bssid(struct net_device *wilc_netdev, u8 *bssid, u8 mode)
 {
struct wilc_vif *vif = netdev_priv(wilc_netdev);
 
memcpy(vif->bssid, bssid, 6);
vif->mode = mode;
-
-   return 0;
 }
 
 int wilc_wlan_get_num_conn_ifcs(struct wilc *wilc)
diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h 
b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
index 1837808..30151b2 100644
--- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h
+++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
@@ -215,6 +215,6 @@ void wilc_netdev_cleanup(struct wilc *wilc);
 int wilc_netdev_init(struct wilc **wilc, struct device *dev, int io_type,
 const struct wilc_hif_func *ops);
 void wilc_wfi_mgmt_rx(struct wilc *wilc, u8 *buff, u32 size);
-int wilc_wlan_set_bssid(struct net_device *wilc_netdev, u8 *bssid, u8 mode);
+void wilc_wlan_set_bssid(struct net_device *wilc_netdev, u8 *bssid, u8 mode);
 
 #endif
-- 
2.7.4

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


[PATCH v3 03/29] staging: wilc1000: change return type to 'void' for lock init & deinit functions

2018-09-24 Thread Ajay Singh
Cleanup patch to use 'void' return type for wlan_deinit_locks() &
wlan_init_locks(), as same value is return.

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

diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index d1d2c64..e2669b9 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -525,7 +525,7 @@ static int linux_wlan_init_test_config(struct net_device 
*dev,
return -1;
 }
 
-static int wlan_deinit_locks(struct net_device *dev)
+static void wlan_deinit_locks(struct net_device *dev)
 {
struct wilc_vif *vif = netdev_priv(dev);
struct wilc *wilc = vif->wilc;
@@ -533,8 +533,6 @@ static int wlan_deinit_locks(struct net_device *dev)
mutex_destroy(&wilc->hif_cs);
mutex_destroy(&wilc->rxq_cs);
mutex_destroy(&wilc->txq_add_to_head_cs);
-
-   return 0;
 }
 
 static void wlan_deinitialize_threads(struct net_device *dev)
@@ -588,7 +586,7 @@ static void wilc_wlan_deinitialize(struct net_device *dev)
}
 }
 
-static int wlan_init_locks(struct net_device *dev)
+static void wlan_init_locks(struct net_device *dev)
 {
struct wilc_vif *vif = netdev_priv(dev);
struct wilc *wl = vif->wilc;
@@ -604,8 +602,6 @@ static int wlan_init_locks(struct net_device *dev)
init_completion(&wl->cfg_event);
init_completion(&wl->sync_event);
init_completion(&wl->txq_thread_started);
-
-   return 0;
 }
 
 static int wlan_initialize_threads(struct net_device *dev)
-- 
2.7.4

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


[PATCH v3 07/29] staging: wilc1000: use 'void' return for wilc_wlan_txq_add_to_head()

2018-09-24 Thread Ajay Singh
Use 'void' return for wilc_wlan_txq_add_to_head() as its always
return '0' value.

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

diff --git a/drivers/staging/wilc1000/wilc_wlan.c 
b/drivers/staging/wilc1000/wilc_wlan.c
index 590a51c..8057db9 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -71,8 +71,8 @@ static void wilc_wlan_txq_add_to_tail(struct net_device *dev,
complete(&wilc->txq_event);
 }
 
-static int wilc_wlan_txq_add_to_head(struct wilc_vif *vif,
-struct txq_entry_t *tqe)
+static void wilc_wlan_txq_add_to_head(struct wilc_vif *vif,
+ struct txq_entry_t *tqe)
 {
unsigned long flags;
struct wilc *wilc = vif->wilc;
@@ -87,8 +87,6 @@ static int wilc_wlan_txq_add_to_head(struct wilc_vif *vif,
spin_unlock_irqrestore(&wilc->txq_spinlock, flags);
mutex_unlock(&wilc->txq_add_to_head_cs);
complete(&wilc->txq_event);
-
-   return 0;
 }
 
 #define NOT_TCP_ACK(-1)
@@ -275,10 +273,7 @@ static int wilc_wlan_txq_add_cfg_pkt(struct wilc_vif *vif, 
u8 *buffer,
tqe->priv = NULL;
tqe->ack_idx = NOT_TCP_ACK;
 
-   if (wilc_wlan_txq_add_to_head(vif, tqe)) {
-   kfree(tqe);
-   return 0;
-   }
+   wilc_wlan_txq_add_to_head(vif, tqe);
 
return 1;
 }
-- 
2.7.4

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


[PATCH v3 04/29] staging: wilc1000: change return type to 'void' for wilc_deinit_host_int()

2018-09-24 Thread Ajay Singh
Cleanup patch to use 'void' return type for wilc_deinit_host_int(),
as its return value is not used in caller.

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

diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 37c26d4..02a8846 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -2175,7 +2175,7 @@ int wilc_init_host_int(struct net_device *net)
return ret;
 }
 
-int wilc_deinit_host_int(struct net_device *net)
+void wilc_deinit_host_int(struct net_device *net)
 {
int ret;
struct wilc_priv *priv = wdev_priv(net->ieee80211_ptr);
@@ -2192,8 +2192,6 @@ int wilc_deinit_host_int(struct net_device *net)
 
if (ret)
netdev_err(net, "Error while deinitializing host interface\n");
-
-   return ret;
 }
 
 void wilc_free_wiphy(struct net_device *net)
diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.h 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.h
index be412b6..1858f56 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.h
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.h
@@ -11,7 +11,7 @@
 struct wireless_dev *wilc_create_wiphy(struct net_device *net,
   struct device *dev);
 void wilc_free_wiphy(struct net_device *net);
-int wilc_deinit_host_int(struct net_device *net);
+void wilc_deinit_host_int(struct net_device *net);
 int wilc_init_host_int(struct net_device *net);
 void wilc_wfi_monitor_rx(u8 *buff, u32 size);
 int wilc_wfi_deinit_mon_interface(void);
-- 
2.7.4

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


[PATCH v3 12/29] staging: wilc1000: set default value of cfg response type in wilc_wlan_cfg_indicate_rx()

2018-09-24 Thread Ajay Singh
Handle the setting of default value for 'wilc_cfg_rsp' type for all
cases in wilc_wlan_cfg_indicate_rx() as the caller make use of this
value to know the type of the received message.

Signed-off-by: Ajay Singh 
---
 drivers/staging/wilc1000/wilc_wlan_cfg.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_wlan_cfg.c 
b/drivers/staging/wilc1000/wilc_wlan_cfg.c
index 2b5471b..2c463a3 100644
--- a/drivers/staging/wilc1000/wilc_wlan_cfg.c
+++ b/drivers/staging/wilc1000/wilc_wlan_cfg.c
@@ -507,6 +507,7 @@ void wilc_wlan_cfg_indicate_rx(struct wilc *wilc, u8 
*frame, int size,
msg_id = frame[1];  /* seq no */
frame += 4;
size -= 4;
+   rsp->type = 0;
 
/*
 * The valid types of response messages are
@@ -532,7 +533,6 @@ void wilc_wlan_cfg_indicate_rx(struct wilc *wilc, u8 
*frame, int size,
 
case 'N':
wilc_network_info_received(wilc, frame - 4, size + 4);
-   rsp->type = 0;
break;
 
case 'S':
@@ -540,7 +540,6 @@ void wilc_wlan_cfg_indicate_rx(struct wilc *wilc, u8 
*frame, int size,
break;
 
default:
-   rsp->type = 0;
rsp->seq_no = msg_id;
break;
}
-- 
2.7.4

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


[PATCH v3 10/29] staging: wilc1000: change return type to 'void' for wilc_wlan_cfg_indicate_rx()

2018-09-24 Thread Ajay Singh
Cleanup patch to use 'void' return type for wilc_wlan_cfg_indicate_rx(),
as its return value is not used in caller. The value set in
'rsp' argument is used to get the success status.

Signed-off-by: Ajay Singh 
---
 drivers/staging/wilc1000/wilc_wlan_cfg.c | 8 ++--
 drivers/staging/wilc1000/wilc_wlan_cfg.h | 4 ++--
 2 files changed, 4 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_wlan_cfg.c 
b/drivers/staging/wilc1000/wilc_wlan_cfg.c
index 4215763..42c64ed 100644
--- a/drivers/staging/wilc1000/wilc_wlan_cfg.c
+++ b/drivers/staging/wilc1000/wilc_wlan_cfg.c
@@ -502,10 +502,9 @@ int wilc_wlan_cfg_get_wid_value(u16 wid, u8 *buffer, u32 
buffer_size)
return ret;
 }
 
-int wilc_wlan_cfg_indicate_rx(struct wilc *wilc, u8 *frame, int size,
- struct wilc_cfg_rsp *rsp)
+void wilc_wlan_cfg_indicate_rx(struct wilc *wilc, u8 *frame, int size,
+  struct wilc_cfg_rsp *rsp)
 {
-   int ret = 1;
u8 msg_type;
u8 msg_id;
 
@@ -547,11 +546,8 @@ int wilc_wlan_cfg_indicate_rx(struct wilc *wilc, u8 
*frame, int size,
default:
rsp->type = 0;
rsp->seq_no = msg_id;
-   ret = 0;
break;
}
-
-   return ret;
 }
 
 int wilc_wlan_cfg_init(void)
diff --git a/drivers/staging/wilc1000/wilc_wlan_cfg.h 
b/drivers/staging/wilc1000/wilc_wlan_cfg.h
index 0c649d1..189e617 100644
--- a/drivers/staging/wilc1000/wilc_wlan_cfg.h
+++ b/drivers/staging/wilc1000/wilc_wlan_cfg.h
@@ -31,8 +31,8 @@ struct wilc;
 int wilc_wlan_cfg_set_wid(u8 *frame, u32 offset, u16 id, u8 *buf, int size);
 int wilc_wlan_cfg_get_wid(u8 *frame, u32 offset, u16 id);
 int wilc_wlan_cfg_get_wid_value(u16 wid, u8 *buffer, u32 buffer_size);
-int wilc_wlan_cfg_indicate_rx(struct wilc *wilc, u8 *frame, int size,
- struct wilc_cfg_rsp *rsp);
+void wilc_wlan_cfg_indicate_rx(struct wilc *wilc, u8 *frame, int size,
+  struct wilc_cfg_rsp *rsp);
 int wilc_wlan_cfg_init(void);
 
 #endif
-- 
2.7.4

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


[PATCH v3 09/29] staging: wilc1000: use 'void' return for wilc_wlan_txq_filter_dup_tcp_ack()

2018-09-24 Thread Ajay Singh
Use 'void' return for wilc_wlan_txq_filter_dup_tcp_ack() as it always
return value '1' and its not used by the caller.

Signed-off-by: Ajay Singh 
---
 drivers/staging/wilc1000/wilc_wlan.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_wlan.c 
b/drivers/staging/wilc1000/wilc_wlan.c
index 66ce29d..88808d9 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -182,7 +182,7 @@ static inline void tcp_process(struct net_device *dev, 
struct txq_entry_t *tqe)
spin_unlock_irqrestore(&wilc->txq_spinlock, flags);
 }
 
-static int wilc_wlan_txq_filter_dup_tcp_ack(struct net_device *dev)
+static void wilc_wlan_txq_filter_dup_tcp_ack(struct net_device *dev)
 {
struct wilc_vif *vif = netdev_priv(dev);
struct wilc *wilc = vif->wilc;
@@ -237,8 +237,6 @@ static int wilc_wlan_txq_filter_dup_tcp_ack(struct 
net_device *dev)
msecs_to_jiffies(1));
dropped--;
}
-
-   return 1;
 }
 
 void wilc_enable_tcp_ack_filter(struct wilc_vif *vif, bool value)
-- 
2.7.4

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


[PATCH v3 11/29] staging: wilc1000: refactor wilc_wlan_parse_info_frame() function

2018-09-24 Thread Ajay Singh
Return 'void' from wilc_wlan_parse_info_frame() as same constant value
is returned always. Also removed the 'size' from input parameter as its
not used in the function.

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

diff --git a/drivers/staging/wilc1000/wilc_wlan_cfg.c 
b/drivers/staging/wilc1000/wilc_wlan_cfg.c
index 42c64ed..2b5471b 100644
--- a/drivers/staging/wilc1000/wilc_wlan_cfg.c
+++ b/drivers/staging/wilc1000/wilc_wlan_cfg.c
@@ -350,22 +350,17 @@ static void wilc_wlan_parse_response_frame(u8 *info, int 
size)
}
 }
 
-static int wilc_wlan_parse_info_frame(u8 *info, int size)
+static void wilc_wlan_parse_info_frame(u8 *info)
 {
struct wilc_mac_cfg *pd = &g_mac;
u32 wid, len;
-   int type = WILC_CFG_RSP_STATUS;
 
wid = info[0] | (info[1] << 8);
 
len = info[2];
 
-   if (len == 1 && wid == WID_STATUS) {
+   if (len == 1 && wid == WID_STATUS)
pd->mac_status = info[3];
-   type = WILC_CFG_RSP_STATUS;
-   }
-
-   return type;
 }
 
 /
@@ -528,7 +523,8 @@ void wilc_wlan_cfg_indicate_rx(struct wilc *wilc, u8 
*frame, int size,
break;
 
case 'I':
-   rsp->type = wilc_wlan_parse_info_frame(frame, size);
+   wilc_wlan_parse_info_frame(frame);
+   rsp->type = WILC_CFG_RSP_STATUS;
rsp->seq_no = msg_id;
/*call host interface info parse as well*/
wilc_gnrl_async_info_received(wilc, frame - 4, size + 4);
-- 
2.7.4

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


[PATCH v3 08/29] staging: wilc1000: change return type to 'void' tcp ack filter functions

2018-09-24 Thread Ajay Singh
Use 'void' return type for below functions as they always return '0' and
their return value is not used by caller.
add_tcp_pending_ack()
update_tcp_session()
add_tcp_pending_ack()

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

diff --git a/drivers/staging/wilc1000/wilc_wlan.c 
b/drivers/staging/wilc1000/wilc_wlan.c
index 8057db9..66ce29d 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -91,8 +91,8 @@ static void wilc_wlan_txq_add_to_head(struct wilc_vif *vif,
 
 #define NOT_TCP_ACK(-1)
 
-static inline int add_tcp_session(struct wilc_vif *vif, u32 src_prt,
- u32 dst_prt, u32 seq)
+static inline void add_tcp_session(struct wilc_vif *vif, u32 src_prt,
+  u32 dst_prt, u32 seq)
 {
struct tcp_ack_filter *f = &vif->ack_filter;
 
@@ -103,22 +103,20 @@ static inline int add_tcp_session(struct wilc_vif *vif, 
u32 src_prt,
f->ack_session_info[f->tcp_session].dst_port = dst_prt;
f->tcp_session++;
}
-   return 0;
 }
 
-static inline int update_tcp_session(struct wilc_vif *vif, u32 index, u32 ack)
+static inline void update_tcp_session(struct wilc_vif *vif, u32 index, u32 ack)
 {
struct tcp_ack_filter *f = &vif->ack_filter;
 
if (index < 2 * MAX_TCP_SESSION &&
ack > f->ack_session_info[index].bigger_ack_num)
f->ack_session_info[index].bigger_ack_num = ack;
-   return 0;
 }
 
-static inline int add_tcp_pending_ack(struct wilc_vif *vif, u32 ack,
- u32 session_index,
- struct txq_entry_t *txqe)
+static inline void add_tcp_pending_ack(struct wilc_vif *vif, u32 ack,
+  u32 session_index,
+  struct txq_entry_t *txqe)
 {
struct tcp_ack_filter *f = &vif->ack_filter;
u32 i = f->pending_base + f->pending_acks_idx;
@@ -130,7 +128,6 @@ static inline int add_tcp_pending_ack(struct wilc_vif *vif, 
u32 ack,
txqe->ack_idx = i;
f->pending_acks_idx++;
}
-   return 0;
 }
 
 static inline void tcp_process(struct net_device *dev, struct txq_entry_t *tqe)
-- 
2.7.4

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


[PATCH v3 05/29] staging: wilc1000: change return type to 'void' for wilc_wfi_deinit_mon_interface()

2018-09-24 Thread Ajay Singh
Use 'void' return type for wilc_wfi_deinit_mon_interface(), as same
value always return.

Signed-off-by: Ajay Singh 
---
 drivers/staging/wilc1000/linux_mon.c  | 3 +--
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.h | 2 +-
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_mon.c 
b/drivers/staging/wilc1000/linux_mon.c
index 1afdb9e..a634468 100644
--- a/drivers/staging/wilc1000/linux_mon.c
+++ b/drivers/staging/wilc1000/linux_mon.c
@@ -253,7 +253,7 @@ struct net_device *wilc_wfi_init_mon_interface(const char 
*name,
return wilc_wfi_mon;
 }
 
-int wilc_wfi_deinit_mon_interface(void)
+void wilc_wfi_deinit_mon_interface(void)
 {
bool rollback_lock = false;
 
@@ -270,5 +270,4 @@ int wilc_wfi_deinit_mon_interface(void)
}
wilc_wfi_mon = NULL;
}
-   return 0;
 }
diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.h 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.h
index 1858f56..4812c8e 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.h
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.h
@@ -14,7 +14,7 @@ void wilc_free_wiphy(struct net_device *net);
 void wilc_deinit_host_int(struct net_device *net);
 int wilc_init_host_int(struct net_device *net);
 void wilc_wfi_monitor_rx(u8 *buff, u32 size);
-int wilc_wfi_deinit_mon_interface(void);
+void wilc_wfi_deinit_mon_interface(void);
 struct net_device *wilc_wfi_init_mon_interface(const char *name,
   struct net_device *real_dev);
 void wilc_mgmt_frame_register(struct wiphy *wiphy, struct wireless_dev *wdev,
-- 
2.7.4

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


[PATCH v3 14/29] staging: wilc1000: remove unused wid type values

2018-09-24 Thread Ajay Singh
Cleanup patch to remove the wid type not used in the code.

Signed-off-by: Ajay Singh 
---
 drivers/staging/wilc1000/wilc_wlan_if.h | 4 
 1 file changed, 4 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_wlan_if.h 
b/drivers/staging/wilc1000/wilc_wlan_if.h
index b81a73b..ce2066b 100644
--- a/drivers/staging/wilc1000/wilc_wlan_if.h
+++ b/drivers/staging/wilc1000/wilc_wlan_if.h
@@ -204,10 +204,6 @@ enum wid_type {
WID_STR = 3,
WID_BIN_DATA= 4,
WID_BIN = 5,
-   WID_IP  = 6,
-   WID_ADR = 7,
-   WID_UNDEF   = 8,
-   WID_TYPE_FORCE_32BIT= 0x
 };
 
 struct wid {
-- 
2.7.4

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


[PATCH v3 15/29] staging: wilc1000: remove unused wid from cfg struct

2018-09-24 Thread Ajay Singh
Cleanup patch to remove the unused element stored in cfg struct.
Removed those wid from the cfg variables whose value is not
fetched(GET_CFG) from the code. In case the wid is only set to the
firmware then there is need to store them as part of cfg variables, so
removed the unused code.

Signed-off-by: Ajay Singh 
---
 drivers/staging/wilc1000/wilc_wlan_cfg.c | 107 ---
 1 file changed, 107 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_wlan_cfg.c 
b/drivers/staging/wilc1000/wilc_wlan_cfg.c
index 2c463a3..541251b 100644
--- a/drivers/staging/wilc1000/wilc_wlan_cfg.c
+++ b/drivers/staging/wilc1000/wilc_wlan_cfg.c
@@ -20,131 +20,36 @@ enum cfg_cmd_type {
 struct wilc_mac_cfg {
int mac_status;
u8 mac_address[7];
-   u8 ip_address[5];
-   u8 bssid[7];
-   u8 ssid[34];
u8 firmware_version[129];
-   u8 supp_rate[24];
-   u8 wep_key[28];
-   u8 i_psk[66];
-   u8 hw_product_version[33];
-   u8 phyversion[17];
-   u8 supp_username[21];
-   u8 supp_password[64];
-   u8 assoc_req[256];
u8 assoc_rsp[256];
-   u8 firmware_info[8];
-   u8 scan_result[256];
-   u8 scan_result1[256];
 };
 
 static struct wilc_mac_cfg g_mac;
 
 static struct wilc_cfg_byte g_cfg_byte[] = {
-   {WID_BSS_TYPE, 0},
-   {WID_CURRENT_TX_RATE, 0},
-   {WID_CURRENT_CHANNEL, 0},
-   {WID_PREAMBLE, 0},
-   {WID_11G_OPERATING_MODE, 0},
{WID_STATUS, 0},
-   {WID_SCAN_TYPE, 0},
-   {WID_KEY_ID, 0},
-   {WID_QOS_ENABLE, 0},
-   {WID_POWER_MANAGEMENT, 0},
-   {WID_11I_MODE, 0},
-   {WID_AUTH_TYPE, 0},
-   {WID_SITE_SURVEY, 0},
-   {WID_LISTEN_INTERVAL, 0},
-   {WID_DTIM_PERIOD, 0},
-   {WID_ACK_POLICY, 0},
-   {WID_BCAST_SSID, 0},
-   {WID_REKEY_POLICY, 0},
-   {WID_SHORT_SLOT_ALLOWED, 0},
-   {WID_START_SCAN_REQ, 0},
{WID_RSSI, 0},
{WID_LINKSPEED, 0},
-   {WID_AUTO_RX_SENSITIVITY, 0},
-   {WID_DATAFLOW_CONTROL, 0},
-   {WID_SCAN_FILTER, 0},
-   {WID_11N_PROT_MECH, 0},
-   {WID_11N_ERP_PROT_TYPE, 0},
-   {WID_11N_ENABLE, 0},
-   {WID_11N_OPERATING_MODE, 0},
-   {WID_11N_OBSS_NONHT_DETECTION, 0},
-   {WID_11N_HT_PROT_TYPE, 0},
-   {WID_11N_RIFS_PROT_ENABLE, 0},
-   {WID_11N_SMPS_MODE, 0},
-   {WID_11N_CURRENT_TX_MCS, 0},
-   {WID_11N_SHORT_GI_ENABLE, 0},
-   {WID_RIFS_MODE, 0},
-   {WID_TX_ABORT_CONFIG, 0},
-   {WID_11N_IMMEDIATE_BA_ENABLED, 0},
-   {WID_11N_TXOP_PROT_DISABLE, 0},
{WID_NIL, 0}
 };
 
 static struct wilc_cfg_hword g_cfg_hword[] = {
-   {WID_LINK_LOSS_THRESHOLD, 0},
-   {WID_RTS_THRESHOLD, 0},
-   {WID_FRAG_THRESHOLD, 0},
-   {WID_SHORT_RETRY_LIMIT, 0},
-   {WID_LONG_RETRY_LIMIT, 0},
-   {WID_BEACON_INTERVAL, 0},
-   {WID_RX_SENSE, 0},
-   {WID_ACTIVE_SCAN_TIME, 0},
-   {WID_PASSIVE_SCAN_TIME, 0},
-   {WID_SITE_SURVEY_SCAN_TIME, 0},
-   {WID_JOIN_START_TIMEOUT, 0},
-   {WID_AUTH_TIMEOUT, 0},
-   {WID_ASOC_TIMEOUT, 0},
-   {WID_11I_PROTOCOL_TIMEOUT, 0},
-   {WID_EAPOL_RESPONSE_TIMEOUT, 0},
-   {WID_11N_SIG_QUAL_VAL, 0},
-   {WID_CCA_THRESHOLD, 0},
{WID_NIL, 0}
 };
 
 static struct wilc_cfg_word g_cfg_word[] = {
{WID_FAILED_COUNT, 0},
-   {WID_RETRY_COUNT, 0},
-   {WID_MULTIPLE_RETRY_COUNT, 0},
-   {WID_FRAME_DUPLICATE_COUNT, 0},
-   {WID_ACK_FAILURE_COUNT, 0},
{WID_RECEIVED_FRAGMENT_COUNT, 0},
-   {WID_MCAST_RECEIVED_FRAME_COUNT, 0},
-   {WID_FCS_ERROR_COUNT, 0},
{WID_SUCCESS_FRAME_COUNT, 0},
-   {WID_TX_FRAGMENT_COUNT, 0},
-   {WID_TX_MULTICAST_FRAME_COUNT, 0},
-   {WID_RTS_SUCCESS_COUNT, 0},
-   {WID_RTS_FAILURE_COUNT, 0},
-   {WID_WEP_UNDECRYPTABLE_COUNT, 0},
-   {WID_REKEY_PERIOD, 0},
-   {WID_REKEY_PACKET_COUNT, 0},
-   {WID_HW_RX_COUNT, 0},
{WID_GET_INACTIVE_TIME, 0},
{WID_NIL, 0}
 
 };
 
 static struct wilc_cfg_str g_cfg_str[] = {
-   {WID_SSID, g_mac.ssid}, /* 33 + 1 bytes */
{WID_FIRMWARE_VERSION, g_mac.firmware_version},
-   {WID_OPERATIONAL_RATE_SET, g_mac.supp_rate},
-   {WID_BSSID, g_mac.bssid},   /* 6 bytes */
-   {WID_WEP_KEY_VALUE, g_mac.wep_key}, /* 27 bytes */
-   {WID_11I_PSK, g_mac.i_psk}, /* 65 bytes */
-   {WID_HARDWARE_VERSION, g_mac.hw_product_version},
{WID_MAC_ADDR, g_mac.mac_address},
-   {WID_PHY_VERSION, g_mac.phyversion},
-   {WID_SUPP_USERNAME, g_mac.supp_username},
-   {WID_SUPP_PASSWORD, g_mac.supp_password},
-   {WID_SITE_SURVEY_RESULTS, g_mac.scan_result},
-   {WID_SITE_SURVEY_RESULTS, g_mac.scan_result1},
-   {WID_ASSOC_REQ_INFO, g_mac.assoc_req},
{WID_ASSOC_RES_INFO, g_mac.assoc_rsp},
-   {WID_FIRMWARE_INFO, g_mac.firmware_version},
-   {WID_IP_ADDRESS, g_mac.ip_address},
{WID_NIL, NULL}
 };
 
@@ -327,12 +232,6 @@ static void wilc_wlan_parse_re

[PATCH v3 16/29] staging: wilc1000: refactor code to remove 'mac_status' from 'wilc_mac_cfg' struct

2018-09-24 Thread Ajay Singh
Refactor the code by removing use of 'mac_status' from 'wilc_mac_cfg'
and only have the string type configuration values in 'wilc_mac_cfg'
struct. Now fetch the value 'WID_STATUS' configuration from 'g_cfg_byte'
array.

Signed-off-by: Ajay Singh 
---
 drivers/staging/wilc1000/linux_wlan.c |  4 ++--
 drivers/staging/wilc1000/wilc_wfi_netdevice.h |  2 +-
 drivers/staging/wilc1000/wilc_wlan_cfg.c  | 23 ++-
 3 files changed, 17 insertions(+), 12 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index e2669b9..d9f927e 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -159,9 +159,9 @@ static void deinit_irq(struct net_device *dev)
 
 void wilc_mac_indicate(struct wilc *wilc)
 {
-   int status;
+   s8 status;
 
-   wilc_wlan_cfg_get_val(WID_STATUS, (unsigned char *)&status, 4);
+   wilc_wlan_cfg_get_val(WID_STATUS, &status, 1);
if (wilc->mac_status == MAC_STATUS_INIT) {
wilc->mac_status = status;
complete(&wilc->sync_event);
diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h 
b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
index 30151b2..70bae3a 100644
--- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h
+++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
@@ -155,7 +155,7 @@ struct wilc_vif {
 struct wilc {
const struct wilc_hif_func *hif_func;
int io_type;
-   int mac_status;
+   s8 mac_status;
struct gpio_desc *gpio_irq;
bool initialized;
int dev_irq_num;
diff --git a/drivers/staging/wilc1000/wilc_wlan_cfg.c 
b/drivers/staging/wilc1000/wilc_wlan_cfg.c
index 541251b..4434976 100644
--- a/drivers/staging/wilc1000/wilc_wlan_cfg.c
+++ b/drivers/staging/wilc1000/wilc_wlan_cfg.c
@@ -18,7 +18,6 @@ enum cfg_cmd_type {
 };
 
 struct wilc_mac_cfg {
-   int mac_status;
u8 mac_address[7];
u8 firmware_version[129];
u8 assoc_rsp[256];
@@ -251,15 +250,26 @@ static void wilc_wlan_parse_response_frame(u8 *info, int 
size)
 
 static void wilc_wlan_parse_info_frame(u8 *info)
 {
-   struct wilc_mac_cfg *pd = &g_mac;
u32 wid, len;
 
wid = info[0] | (info[1] << 8);
 
len = info[2];
 
-   if (len == 1 && wid == WID_STATUS)
-   pd->mac_status = info[3];
+   if (len == 1 && wid == WID_STATUS) {
+   int i = 0;
+
+   do {
+   if (g_cfg_byte[i].id == WID_NIL)
+   break;
+
+   if (g_cfg_byte[i].id == wid) {
+   g_cfg_byte[i].val = info[3];
+   break;
+   }
+   i++;
+   } while (1);
+   }
 }
 
 /
@@ -323,11 +333,6 @@ int wilc_wlan_cfg_get_wid_value(u16 wid, u8 *buffer, u32 
buffer_size)
u32 type = (wid >> 12) & 0xf;
int i, ret = 0;
 
-   if (wid == WID_STATUS) {
-   *((u32 *)buffer) = g_mac.mac_status;
-   return 4;
-   }
-
i = 0;
if (type == CFG_BYTE_CMD) {
do {
-- 
2.7.4

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


[PATCH v3 17/29] staging: wilc1000: refactor code to avoid static variables for config parameters

2018-09-24 Thread Ajay Singh
Refactor the code in wilc_wlan_cfg.c file to avoid the use of static
variables. Move the static variables as part of wilc struct and also
dynamically allocating memory for keeping those variables.

Signed-off-by: Ajay Singh 
---
 drivers/staging/wilc1000/linux_wlan.c |  12 +-
 drivers/staging/wilc1000/wilc_wfi_netdevice.h |   2 +
 drivers/staging/wilc1000/wilc_wlan.c  |  12 +-
 drivers/staging/wilc1000/wilc_wlan.h  |   3 +-
 drivers/staging/wilc1000/wilc_wlan_cfg.c  | 159 +-
 drivers/staging/wilc1000/wilc_wlan_cfg.h  |  20 +++-
 6 files changed, 138 insertions(+), 70 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index d9f927e..8ecd664 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -161,7 +161,7 @@ void wilc_mac_indicate(struct wilc *wilc)
 {
s8 status;
 
-   wilc_wlan_cfg_get_val(WID_STATUS, &status, 1);
+   wilc_wlan_cfg_get_val(wilc, WID_STATUS, &status, 1);
if (wilc->mac_status == MAC_STATUS_INIT) {
wilc->mac_status = status;
complete(&wilc->sync_event);
@@ -677,7 +677,7 @@ static int wilc_wlan_initialize(struct net_device *dev, 
struct wilc_vif *vif)
int size;
char firmware_ver[20];
 
-   size = wilc_wlan_cfg_get_val(WID_FIRMWARE_VERSION,
+   size = wilc_wlan_cfg_get_val(wl, WID_FIRMWARE_VERSION,
 firmware_ver,
 sizeof(firmware_ver));
firmware_ver[size] = '\0';
@@ -1035,6 +1035,7 @@ void wilc_netdev_cleanup(struct wilc *wilc)
 
flush_workqueue(wilc->hif_workqueue);
destroy_workqueue(wilc->hif_workqueue);
+   wilc_wlan_cfg_deinit(wilc);
kfree(wilc);
 }
 EXPORT_SYMBOL_GPL(wilc_netdev_cleanup);
@@ -1060,6 +1061,9 @@ int wilc_netdev_init(struct wilc **wilc, struct device 
*dev, int io_type,
if (!wl)
return -ENOMEM;
 
+   if (wilc_wlan_cfg_init(wl))
+   goto free_wl;
+
*wilc = wl;
wl->io_type = io_type;
wl->hif_func = ops;
@@ -1070,7 +1074,7 @@ int wilc_netdev_init(struct wilc **wilc, struct device 
*dev, int io_type,
 
wl->hif_workqueue = create_singlethread_workqueue("WILC_wq");
if (!wl->hif_workqueue)
-   goto free_wl;
+   goto free_cfg;
 
register_inetaddr_notifier(&g_dev_notifier);
 
@@ -1139,6 +1143,8 @@ int wilc_netdev_init(struct wilc **wilc, struct device 
*dev, int io_type,
}
unregister_inetaddr_notifier(&g_dev_notifier);
destroy_workqueue(wl->hif_workqueue);
+free_cfg:
+   wilc_wlan_cfg_deinit(wl);
 free_wl:
kfree(wl);
return -ENOMEM;
diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h 
b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
index 70bae3a..484c265 100644
--- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h
+++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
@@ -16,6 +16,7 @@
 
 #include "host_interface.h"
 #include "wilc_wlan.h"
+#include "wilc_wlan_cfg.h"
 
 #define FLOW_CONTROL_LOWER_THRESHOLD   128
 #define FLOW_CONTROL_UPPER_THRESHOLD   256
@@ -203,6 +204,7 @@ struct wilc {
int clients_count;
struct workqueue_struct *hif_workqueue;
enum chip_ps_states chip_ps_state;
+   struct wilc_cfg cfg;
 };
 
 struct wilc_wfi_mon_priv {
diff --git a/drivers/staging/wilc1000/wilc_wlan.c 
b/drivers/staging/wilc1000/wilc_wlan.c
index 88808d9..0ec0d9b 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -1194,9 +1194,9 @@ int wilc_wlan_cfg_get(struct wilc_vif *vif, int start, 
u16 wid, int commit,
return ret_size;
 }
 
-int wilc_wlan_cfg_get_val(u16 wid, u8 *buffer, u32 buffer_size)
+int wilc_wlan_cfg_get_val(struct wilc *wl, u16 wid, u8 *buffer, u32 
buffer_size)
 {
-   return wilc_wlan_cfg_get_wid_value(wid, buffer, buffer_size);
+   return wilc_wlan_cfg_get_wid_value(wl, wid, buffer, buffer_size);
 }
 
 int wilc_send_config_pkt(struct wilc_vif *vif, u8 mode, struct wid *wids,
@@ -1216,7 +1216,8 @@ int wilc_send_config_pkt(struct wilc_vif *vif, u8 mode, 
struct wid *wids,
}
}
for (i = 0; i < count; i++) {
-   wids[i].size = wilc_wlan_cfg_get_val(wids[i].id,
+   wids[i].size = wilc_wlan_cfg_get_val(vif->wilc,
+wids[i].id,
 wids[i].val,
 wids[i].size);
}
@@ -1315,11 +1316,6 @@ int wilc_wlan_init(struct net_device *dev)
goto fail;
}
 
-   if (!wilc_wlan_cfg_init()) {
- 

[PATCH v3 22/29] staging: wilc1000: avoid use of 'g_spi' static variable

2018-09-24 Thread Ajay Singh
Instead of using static variable 'g_spi' move it as part of 'wilc'
struct. Also allocating the memory in the probe function and
free is taken care in wilc_netdev_cleanup().

Signed-off-by: Ajay Singh 
---
 drivers/staging/wilc1000/wilc_spi.c | 58 +++--
 1 file changed, 36 insertions(+), 22 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_spi.c 
b/drivers/staging/wilc1000/wilc_spi.c
index 5517477..2559cf0 100644
--- a/drivers/staging/wilc1000/wilc_spi.c
+++ b/drivers/staging/wilc1000/wilc_spi.c
@@ -14,7 +14,6 @@ struct wilc_spi {
int has_thrpt_enh;
 };
 
-static struct wilc_spi g_spi;
 static const struct wilc_hif_func wilc_hif_spi;
 
 /
@@ -107,6 +106,11 @@ static int wilc_bus_probe(struct spi_device *spi)
int ret;
struct wilc *wilc;
struct gpio_desc *gpio;
+   struct wilc_spi *spi_priv;
+
+   spi_priv = kzalloc(sizeof(*spi_priv), GFP_KERNEL);
+   if (!spi_priv)
+   return -ENOMEM;
 
gpio = gpiod_get(&spi->dev, "irq", GPIOD_IN);
if (IS_ERR(gpio)) {
@@ -117,11 +121,14 @@ static int wilc_bus_probe(struct spi_device *spi)
}
 
ret = wilc_netdev_init(&wilc, NULL, HIF_SPI, &wilc_hif_spi);
-   if (ret)
+   if (ret) {
+   kfree(spi_priv);
return ret;
+   }
 
spi_set_drvdata(spi, wilc);
wilc->dev = &spi->dev;
+   wilc->bus_data = spi_priv;
wilc->gpio_irq = gpio;
 
return 0;
@@ -275,6 +282,7 @@ static int spi_cmd_complete(struct wilc *wilc, u8 cmd, u32 
adr, u8 *b, u32 sz,
u8 clockless)
 {
struct spi_device *spi = to_spi_device(wilc->dev);
+   struct wilc_spi *spi_priv = wilc->bus_data;
u8 wb[32], rb[32];
u8 wix, rix;
u32 len2;
@@ -375,7 +383,7 @@ static int spi_cmd_complete(struct wilc *wilc, u8 cmd, u32 
adr, u8 *b, u32 sz,
if (result != N_OK)
return result;
 
-   if (!g_spi.crc_off)
+   if (!spi_priv->crc_off)
wb[len - 1] = (crc7(0x7f, (const u8 *)&wb[0], len - 1)) << 1;
else
len -= 1;
@@ -393,7 +401,7 @@ static int spi_cmd_complete(struct wilc *wilc, u8 cmd, u32 
adr, u8 *b, u32 sz,
} else if (cmd == CMD_INTERNAL_READ || cmd == CMD_SINGLE_READ) {
int tmp = NUM_RSP_BYTES + NUM_DATA_HDR_BYTES + NUM_DATA_BYTES
+ NUM_DUMMY_BYTES;
-   if (!g_spi.crc_off)
+   if (!spi_priv->crc_off)
len2 = len + tmp + NUM_CRC_BYTES;
else
len2 = len + tmp;
@@ -485,7 +493,7 @@ static int spi_cmd_complete(struct wilc *wilc, u8 cmd, u32 
adr, u8 *b, u32 sz,
return N_FAIL;
}
 
-   if (!g_spi.crc_off) {
+   if (!spi_priv->crc_off) {
/*
 * Read Crc
 */
@@ -527,7 +535,7 @@ static int spi_cmd_complete(struct wilc *wilc, u8 cmd, u32 
adr, u8 *b, u32 sz,
/*
 * Read Crc
 */
-   if (!g_spi.crc_off && wilc_spi_rx(wilc, crc, 2)) {
+   if (!spi_priv->crc_off && wilc_spi_rx(wilc, crc, 2)) {
dev_err(&spi->dev,
"Failed block crc read, bus err\n");
return N_FAIL;
@@ -585,7 +593,7 @@ static int spi_cmd_complete(struct wilc *wilc, u8 cmd, u32 
adr, u8 *b, u32 sz,
/*
 * Read Crc
 */
-   if (!g_spi.crc_off && wilc_spi_rx(wilc, crc, 2)) {
+   if (!spi_priv->crc_off && wilc_spi_rx(wilc, crc, 2)) {
dev_err(&spi->dev,
"Failed block crc read, bus err\n");
result = N_FAIL;
@@ -602,6 +610,7 @@ static int spi_cmd_complete(struct wilc *wilc, u8 cmd, u32 
adr, u8 *b, u32 sz,
 static int spi_data_write(struct wilc *wilc, u8 *b, u32 sz)
 {
struct spi_device *spi = to_spi_device(wilc->dev);
+   struct wilc_spi *spi_priv = wilc->bus_data;
int ix, nbytes;
int result = 1;
u8 cmd, order, crc[2] = {0};
@@ -648,7 +657,7 @@ static int spi_data_write(struct wilc *wilc, u8 *b, u32 sz)
/*
 * Write Crc
 */
-   if (!g_spi.crc_off) {
+   if (!spi_priv->crc_off) {
if (wilc_spi_tx(wilc, crc, 2)) {
dev_err(&spi->dev, "Failed data block crc 
write, bus error...\n");
result = N_FAIL;
@@ -816,6 +825,7 @@ static int _wilc_spi_deinit(struct wilc *wilc)
 static int wilc_spi_init(struct wilc *wilc, bool resume)
 {
struct spi_d

[PATCH v3 13/29] staging: wilc1000: changes 'val' type to u8 in wilc_cfg_byte struct

2018-09-24 Thread Ajay Singh
Use the correct datatype for storing the byte value in 'wilc_cfg_byte'
struct.

Signed-off-by: Ajay Singh 
---
 drivers/staging/wilc1000/wilc_wlan_cfg.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/wilc1000/wilc_wlan_cfg.h 
b/drivers/staging/wilc1000/wilc_wlan_cfg.h
index 189e617..082093f 100644
--- a/drivers/staging/wilc1000/wilc_wlan_cfg.h
+++ b/drivers/staging/wilc1000/wilc_wlan_cfg.h
@@ -9,7 +9,7 @@
 
 struct wilc_cfg_byte {
u16 id;
-   u16 val;
+   u8 val;
 };
 
 struct wilc_cfg_hword {
-- 
2.7.4

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


[PATCH v3 21/29] staging: wilc1000: avoid use of 'g_sdio' static variable

2018-09-24 Thread Ajay Singh
Instead of using static variable 'g_sdio' move it as part of 'wilc'
struct. Also allocating the memory in the probe function and free during
deinitialization.

Signed-off-by: Ajay Singh 
---
 drivers/staging/wilc1000/linux_wlan.c |  1 +
 drivers/staging/wilc1000/wilc_sdio.c  | 54 +--
 drivers/staging/wilc1000/wilc_wfi_netdevice.h |  1 +
 3 files changed, 36 insertions(+), 20 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index b666e1e..560c168 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -1037,6 +1037,7 @@ void wilc_netdev_cleanup(struct wilc *wilc)
flush_workqueue(wilc->hif_workqueue);
destroy_workqueue(wilc->hif_workqueue);
wilc_wlan_cfg_deinit(wilc);
+   kfree(wilc->bus_data);
kfree(wilc);
 }
 EXPORT_SYMBOL_GPL(wilc_netdev_cleanup);
diff --git a/drivers/staging/wilc1000/wilc_sdio.c 
b/drivers/staging/wilc1000/wilc_sdio.c
index b2080d8..7ef047c 100644
--- a/drivers/staging/wilc1000/wilc_sdio.c
+++ b/drivers/staging/wilc1000/wilc_sdio.c
@@ -30,7 +30,6 @@ struct wilc_sdio {
int has_thrpt_enh3;
 };
 
-static struct wilc_sdio g_sdio;
 static const struct wilc_hif_func wilc_hif_sdio;
 
 static int sdio_write_reg(struct wilc *wilc, u32 addr, u32 data);
@@ -109,6 +108,11 @@ static int linux_sdio_probe(struct sdio_func *func,
struct wilc *wilc;
int ret;
struct gpio_desc *gpio = NULL;
+   struct wilc_sdio *sdio_priv;
+
+   sdio_priv = kzalloc(sizeof(*sdio_priv), GFP_KERNEL);
+   if (!sdio_priv)
+   return -ENOMEM;
 
if (IS_ENABLED(CONFIG_WILC1000_HW_OOB_INTR)) {
gpio = gpiod_get(&func->dev, "irq", GPIOD_IN);
@@ -124,9 +128,11 @@ static int linux_sdio_probe(struct sdio_func *func,
ret = wilc_netdev_init(&wilc, &func->dev, HIF_SDIO, &wilc_hif_sdio);
if (ret) {
dev_err(&func->dev, "Couldn't initialize netdev\n");
+   kfree(sdio_priv);
return ret;
}
sdio_set_drvdata(func, wilc);
+   wilc->bus_data = sdio_priv;
wilc->dev = &func->dev;
wilc->gpio_irq = gpio;
 
@@ -381,6 +387,7 @@ static int sdio_set_func1_block_size(struct wilc *wilc, u32 
block_size)
 static int sdio_write_reg(struct wilc *wilc, u32 addr, u32 data)
 {
struct sdio_func *func = dev_to_sdio_func(wilc->dev);
+   struct wilc_sdio *sdio_priv = wilc->bus_data;
int ret;
 
cpu_to_le32s(&data);
@@ -415,7 +422,7 @@ static int sdio_write_reg(struct wilc *wilc, u32 addr, u32 
data)
cmd.increment = 1;
cmd.count = 4;
cmd.buffer = (u8 *)&data;
-   cmd.block_size = g_sdio.block_size;
+   cmd.block_size = sdio_priv->block_size;
ret = wilc_sdio_cmd53(wilc, &cmd);
if (ret) {
dev_err(&func->dev,
@@ -434,7 +441,8 @@ static int sdio_write_reg(struct wilc *wilc, u32 addr, u32 
data)
 static int sdio_write(struct wilc *wilc, u32 addr, u8 *buf, u32 size)
 {
struct sdio_func *func = dev_to_sdio_func(wilc->dev);
-   u32 block_size = g_sdio.block_size;
+   struct wilc_sdio *sdio_priv = wilc->bus_data;
+   u32 block_size = sdio_priv->block_size;
struct sdio_cmd53 cmd;
int nblk, nleft, ret;
 
@@ -523,6 +531,7 @@ static int sdio_write(struct wilc *wilc, u32 addr, u8 *buf, 
u32 size)
 static int sdio_read_reg(struct wilc *wilc, u32 addr, u32 *data)
 {
struct sdio_func *func = dev_to_sdio_func(wilc->dev);
+   struct wilc_sdio *sdio_priv = wilc->bus_data;
int ret;
 
if (addr >= 0xf0 && addr <= 0xff) {
@@ -553,7 +562,7 @@ static int sdio_read_reg(struct wilc *wilc, u32 addr, u32 
*data)
cmd.count = 4;
cmd.buffer = (u8 *)data;
 
-   cmd.block_size = g_sdio.block_size;
+   cmd.block_size = sdio_priv->block_size;
ret = wilc_sdio_cmd53(wilc, &cmd);
if (ret) {
dev_err(&func->dev,
@@ -574,7 +583,8 @@ static int sdio_read_reg(struct wilc *wilc, u32 addr, u32 
*data)
 static int sdio_read(struct wilc *wilc, u32 addr, u8 *buf, u32 size)
 {
struct sdio_func *func = dev_to_sdio_func(wilc->dev);
-   u32 block_size = g_sdio.block_size;
+   struct wilc_sdio *sdio_priv = wilc->bus_data;
+   u32 block_size = sdio_priv->block_size;
struct sdio_cmd53 cmd;
int nblk, nleft, ret;
 
@@ -674,13 +684,14 @@ static int sdio_deinit(struct wilc *wilc)
 static int sdio_init(struct wilc *wilc, bool resume)
 {
struct sdio_func *func = dev_to_sdio_func(wilc->dev);
+   struct wilc_sdio *sdio_priv = wilc->bus_data;
struct sdio_cmd52 cmd;
int loop, ret;
u32 chipid;
 
if (!resume) {
-   memset(&g_sdio, 0, sizeof(struct wilc_sdio));
-   g

[PATCH v3 18/29] staging: wilc1000: rename 'wilc_mac_cfg' struct to 'wilc_cfg_str_vals'

2018-09-24 Thread Ajay Singh
Rename 'wilc_mac_cfg' struct to 'wilc_cfg_str_vals' as its more
appropriate for structure to store the values of string configuration.

Signed-off-by: Ajay Singh 
---
 drivers/staging/wilc1000/wilc_wlan_cfg.c | 14 +++---
 drivers/staging/wilc1000/wilc_wlan_cfg.h |  4 ++--
 2 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_wlan_cfg.c 
b/drivers/staging/wilc1000/wilc_wlan_cfg.c
index 8f1e962..930a389 100644
--- a/drivers/staging/wilc1000/wilc_wlan_cfg.c
+++ b/drivers/staging/wilc1000/wilc_wlan_cfg.c
@@ -438,7 +438,7 @@ void wilc_wlan_cfg_indicate_rx(struct wilc *wilc, u8 
*frame, int size,
 
 int wilc_wlan_cfg_init(struct wilc *wl)
 {
-   struct wilc_mac_cfg *mac_cfg;
+   struct wilc_cfg_str_vals *str_vals;
int i = 0;
 
wl->cfg.b = kmemdup(g_cfg_byte, sizeof(g_cfg_byte), GFP_KERNEL);
@@ -457,20 +457,20 @@ int wilc_wlan_cfg_init(struct wilc *wl)
if (!wl->cfg.s)
goto out_w;
 
-   mac_cfg = kzalloc(sizeof(mac_cfg), GFP_KERNEL);
-   if (!mac_cfg)
+   str_vals = kzalloc(sizeof(str_vals), GFP_KERNEL);
+   if (!str_vals)
goto out_s;
 
-   wl->cfg.str_vals = mac_cfg;
+   wl->cfg.str_vals = str_vals;
/* store the string cfg parameters */
wl->cfg.s[i].id = WID_FIRMWARE_VERSION;
-   wl->cfg.s[i].str = mac_cfg->firmware_version;
+   wl->cfg.s[i].str = str_vals->firmware_version;
i++;
wl->cfg.s[i].id = WID_MAC_ADDR;
-   wl->cfg.s[i].str = mac_cfg->mac_address;
+   wl->cfg.s[i].str = str_vals->mac_address;
i++;
wl->cfg.s[i].id = WID_ASSOC_RES_INFO;
-   wl->cfg.s[i].str = mac_cfg->assoc_rsp;
+   wl->cfg.s[i].str = str_vals->assoc_rsp;
i++;
wl->cfg.s[i].id = WID_NIL;
wl->cfg.s[i].str = NULL;
diff --git a/drivers/staging/wilc1000/wilc_wlan_cfg.h 
b/drivers/staging/wilc1000/wilc_wlan_cfg.h
index 176eef1..e5ca6ce 100644
--- a/drivers/staging/wilc1000/wilc_wlan_cfg.h
+++ b/drivers/staging/wilc1000/wilc_wlan_cfg.h
@@ -27,7 +27,7 @@ struct wilc_cfg_str {
u8 *str;
 };
 
-struct wilc_mac_cfg {
+struct wilc_cfg_str_vals {
u8 mac_address[7];
u8 firmware_version[129];
u8 assoc_rsp[256];
@@ -38,7 +38,7 @@ struct wilc_cfg {
struct wilc_cfg_hword *hw;
struct wilc_cfg_word *w;
struct wilc_cfg_str *s;
-   struct wilc_mac_cfg *str_vals;
+   struct wilc_cfg_str_vals *str_vals;
 };
 
 struct wilc;
-- 
2.7.4

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


[PATCH v3 19/29] staging: wilc1000: avoid the use of 'hif_driver_comp' completion variable

2018-09-24 Thread Ajay Singh
Instead of using extra completion variable to handle the sync call now
using msg->is_sync flag to handle the sync call.

Signed-off-by: Ajay Singh 
---
 drivers/staging/wilc1000/host_interface.c | 23 +++
 drivers/staging/wilc1000/host_interface.h |  2 +-
 drivers/staging/wilc1000/linux_wlan.c |  3 ++-
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c |  2 +-
 4 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 237a098d..529390d 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -187,7 +187,6 @@ struct join_bss_param {
 };
 
 static struct host_if_drv *terminated_handle;
-static struct completion hif_driver_comp;
 static struct mutex hif_deinit_lock;
 
 /* 'msg' should be free by the caller for syc */
@@ -310,10 +309,12 @@ static void handle_set_wfi_drv_handler(struct work_struct 
*work)
if (ret)
netdev_err(vif->ndev, "Failed to set driver handler\n");
 
-   complete(&hif_driver_comp);
kfree(buffer);
 
 free_msg:
+   if (msg->is_sync)
+   complete(&msg->work_comp);
+
kfree(msg);
 }
 
@@ -333,9 +334,6 @@ static void handle_set_operation_mode(struct work_struct 
*work)
ret = wilc_send_config_pkt(vif, SET_CFG, &wid, 1,
   wilc_get_vif_idx(vif));
 
-   if (hif_op_mode->mode == IDLE_MODE)
-   complete(&hif_driver_comp);
-
if (ret)
netdev_err(vif->ndev, "Failed to set operation mode\n");
 
@@ -3118,12 +3116,12 @@ int wilc_set_mac_chnl_num(struct wilc_vif *vif, u8 
channel)
 }
 
 int wilc_set_wfi_drv_handler(struct wilc_vif *vif, int index, u8 mode,
-u8 ifc_id)
+u8 ifc_id, bool is_sync)
 {
int result;
struct host_if_msg *msg;
 
-   msg = wilc_alloc_work(vif, handle_set_wfi_drv_handler, false);
+   msg = wilc_alloc_work(vif, handle_set_wfi_drv_handler, is_sync);
if (IS_ERR(msg))
return PTR_ERR(msg);
 
@@ -3135,8 +3133,12 @@ int wilc_set_wfi_drv_handler(struct wilc_vif *vif, int 
index, u8 mode,
if (result) {
netdev_err(vif->ndev, "%s: enqueue work failed\n", __func__);
kfree(msg);
+   return result;
}
 
+   if (is_sync)
+   wait_for_completion(&msg->work_comp);
+
return result;
 }
 
@@ -3380,10 +3382,8 @@ int wilc_init(struct net_device *dev, struct host_if_drv 
**hif_drv_handler)
 
vif->obtaining_ip = false;
 
-   if (wilc->clients_count == 0) {
-   init_completion(&hif_driver_comp);
+   if (wilc->clients_count == 0)
mutex_init(&hif_deinit_lock);
-   }
 
timer_setup(&vif->periodic_rssi, get_periodic_rssi, 0);
mod_timer(&vif->periodic_rssi, jiffies + msecs_to_jiffies(5000));
@@ -3430,8 +3430,7 @@ int wilc_deinit(struct wilc_vif *vif)
del_timer_sync(&vif->periodic_rssi);
del_timer_sync(&hif_drv->remain_on_ch_timer);
 
-   wilc_set_wfi_drv_handler(vif, 0, 0, 0);
-   wait_for_completion(&hif_driver_comp);
+   wilc_set_wfi_drv_handler(vif, 0, 0, 0, true);
 
if (hif_drv->usr_scan_req.scan_result) {
hif_drv->usr_scan_req.scan_result(SCAN_EVENT_ABORTED, NULL,
diff --git a/drivers/staging/wilc1000/host_interface.h 
b/drivers/staging/wilc1000/host_interface.h
index 15ffaeb..4416f8f 100644
--- a/drivers/staging/wilc1000/host_interface.h
+++ b/drivers/staging/wilc1000/host_interface.h
@@ -350,7 +350,7 @@ int wilc_remain_on_channel(struct wilc_vif *vif, u32 
session_id,
 int wilc_listen_state_expired(struct wilc_vif *vif, u32 session_id);
 void wilc_frame_register(struct wilc_vif *vif, u16 frame_type, bool reg);
 int wilc_set_wfi_drv_handler(struct wilc_vif *vif, int index, u8 mode,
-u8 ifc_id);
+u8 ifc_id, bool is_sync);
 int wilc_set_operation_mode(struct wilc_vif *vif, u32 mode);
 int wilc_get_statistics(struct wilc_vif *vif, struct rf_info *stats,
bool is_sync);
diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index 8ecd664..b666e1e 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -753,7 +753,8 @@ static int wilc_mac_open(struct net_device *ndev)
for (i = 0; i < wl->vif_num; i++) {
if (ndev == wl->vif[i]->ndev) {
wilc_set_wfi_drv_handler(vif, wilc_get_vif_idx(vif),
-vif->iftype, vif->ifc_id);
+vif->iftype, vif->ifc_id,
+false);
wilc_set_operation_mode(vif, vif->iftype);
break;

[PATCH v3 20/29] staging: wilc1000: remove use of unnecessary 'wilc_connected_ssid' variable

2018-09-24 Thread Ajay Singh
'wilc_connected_ssid' actually used to store the BSSID information for
connected BSSID. 'wilc_vif' already has 'bssid' variable to store the
same information. So refactor code to remove 'wilc_connected_ssid' and
instead used 'wilc_vif' struct 'bssid' element.

Signed-off-by: Ajay Singh 
---
 drivers/staging/wilc1000/host_interface.c | 24 ---
 drivers/staging/wilc1000/host_interface.h |  2 --
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 24 ++-
 3 files changed, 15 insertions(+), 35 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 529390d..01db899 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -813,7 +813,6 @@ static void handle_scan(struct work_struct *work)
kfree(msg);
 }
 
-u8 wilc_connected_ssid[6] = {0};
 static void handle_connect(struct work_struct *work)
 {
struct host_if_msg *msg = container_of(work, struct host_if_msg, work);
@@ -835,11 +834,6 @@ static void handle_connect(struct work_struct *work)
return;
}
 
-   if (memcmp(conn_attr->bssid, wilc_connected_ssid, ETH_ALEN) == 0) {
-   netdev_err(vif->ndev, "Discard connect request\n");
-   goto error;
-   }
-
bss_param = conn_attr->params;
if (!bss_param) {
netdev_err(vif->ndev, "Required BSSID not found\n");
@@ -1019,10 +1013,6 @@ static void handle_connect(struct work_struct *work)
cur_byte = wid_list[wid_cnt].val;
wid_cnt++;
 
-   if (conn_attr->bssid)
-   memcpy(wilc_connected_ssid,
-  conn_attr->bssid, ETH_ALEN);
-
result = wilc_send_config_pkt(vif, SET_CFG, wid_list,
  wid_cnt,
  wilc_get_vif_idx(vif));
@@ -1145,8 +1135,6 @@ static void handle_connect_timeout(struct work_struct 
*work)
kfree(hif_drv->usr_conn_req.ies);
hif_drv->usr_conn_req.ies = NULL;
 
-   eth_zero_addr(wilc_connected_ssid);
-
 out:
kfree(msg);
 }
@@ -1452,16 +1440,6 @@ static inline void host_int_parse_assoc_resp_info(struct 
wilc_vif *vif,
}
}
 
-   if (mac_status == MAC_STATUS_CONNECTED &&
-   conn_info.status != WLAN_STATUS_SUCCESS) {
-   netdev_err(vif->ndev,
-  "Received MAC status is MAC_STATUS_CONNECTED, Assoc 
Resp is not SUCCESS\n");
-   eth_zero_addr(wilc_connected_ssid);
-   } else if (mac_status == MAC_STATUS_DISCONNECTED){
-   netdev_err(vif->ndev, "Received MAC status is 
MAC_STATUS_DISCONNECTED\n");
-   eth_zero_addr(wilc_connected_ssid);
-   }
-
if (hif_drv->usr_conn_req.bssid) {
memcpy(conn_info.bssid, hif_drv->usr_conn_req.bssid, 6);
 
@@ -1874,8 +1852,6 @@ static void handle_disconnect(struct work_struct *work)
vif->obtaining_ip = false;
wilc_set_power_mgmt(vif, 0, 0);
 
-   eth_zero_addr(wilc_connected_ssid);
-
result = wilc_send_config_pkt(vif, SET_CFG, &wid, 1,
  wilc_get_vif_idx(vif));
 
diff --git a/drivers/staging/wilc1000/host_interface.h 
b/drivers/staging/wilc1000/host_interface.h
index 4416f8f..33fb731 100644
--- a/drivers/staging/wilc1000/host_interface.h
+++ b/drivers/staging/wilc1000/host_interface.h
@@ -359,6 +359,4 @@ int wilc_get_vif_idx(struct wilc_vif *vif);
 int wilc_set_tx_power(struct wilc_vif *vif, u8 tx_power);
 int wilc_get_tx_power(struct wilc_vif *vif, u8 *tx_power);
 
-extern u8 wilc_connected_ssid[6];
-
 #endif
diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 76d017d..1a4d262 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -478,7 +478,6 @@ static void cfg_connect_result(enum conn_event 
conn_disconn_evt,
connect_status = WLAN_STATUS_UNSPECIFIED_FAILURE;
wilc_wlan_set_bssid(priv->dev, null_bssid,
STATION_MODE);
-   eth_zero_addr(wilc_connected_ssid);
 
if (!wfi_drv->p2p_connect)
wlan_channel = INVALID_CHANNEL;
@@ -521,7 +520,6 @@ static void cfg_connect_result(enum conn_event 
conn_disconn_evt,
wilc_ie = false;
eth_zero_addr(priv->associated_bss);
wilc_wlan_set_bssid(priv->dev, null_bssid, STATION_MODE);
-   eth_zero_addr(wilc_connected_ssid);
 
if (!wfi_drv->p2p_connect)
wlan_channel = INVALID_CHANNEL;
@@ -696,8 +694,12 @@ static int connect(struct wiphy *wiphy, struct net_device 
*dev,
nw_info = &priv->scanned_shadow[sel_bssi_idx];
} else {
 

[PATCH v3 27/29] staging: wilc1000: use usleep_range() in place of udelay()

2018-09-24 Thread Ajay Singh
Changes to avoid the below checkpatch warning:

'usleep_range is preferred over udelay; see
Documentation/timers/timers-howto.txt;'

Signed-off-by: Ajay Singh 
---
 drivers/staging/wilc1000/wilc_wlan.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/wilc1000/wilc_wlan.c 
b/drivers/staging/wilc1000/wilc_wlan.c
index 0ec0d9b..a48c906 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -412,7 +412,7 @@ void chip_wakeup(struct wilc *wilc)
} while (wilc_get_chipid(wilc, true) == 0);
} else if ((wilc->io_type & 0x1) == HIF_SDIO) {
wilc->hif_func->hif_write_reg(wilc, 0xfa, 1);
-   udelay(200);
+   usleep_range(200, 400);
wilc->hif_func->hif_read_reg(wilc, 0xf0, ®);
do {
wilc->hif_func->hif_write_reg(wilc, 0xf0,
-- 
2.7.4

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


[PATCH v3 24/29] staging: wilc1000: remove p2p related static variables to wilc_vif struct

2018-09-24 Thread Ajay Singh
Avoid use of static variable and move them as part of private
data(wilc_priv) struct.

Signed-off-by: Ajay Singh 
---
 drivers/staging/wilc1000/linux_wlan.c |  2 +
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 60 +++
 drivers/staging/wilc1000/wilc_wfi_netdevice.h |  7 +++
 3 files changed, 38 insertions(+), 31 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index 560c168..695d5b2 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -729,6 +729,7 @@ static int wilc_mac_open(struct net_device *ndev)
 {
struct wilc_vif *vif = netdev_priv(ndev);
struct wilc *wl = vif->wilc;
+   struct wilc_priv *priv = wdev_priv(vif->ndev->ieee80211_ptr);
unsigned char mac_add[ETH_ALEN] = {0};
int ret = 0;
int i = 0;
@@ -782,6 +783,7 @@ static int wilc_mac_open(struct net_device *ndev)
 vif->frame_reg[1].reg);
netif_wake_queue(ndev);
wl->open_ifcs++;
+   priv->p2p.local_random = 0x01;
vif->mac_opened = 1;
return 0;
 }
diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 1a4d262..4fd 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -137,10 +137,7 @@ struct p2p_mgmt_data {
 static u8 wlan_channel = INVALID_CHANNEL;
 static u8 curr_channel;
 static u8 p2p_oui[] = {0x50, 0x6f, 0x9A, 0x09};
-static u8 p2p_local_random = 0x01;
-static u8 p2p_recv_random;
 static u8 p2p_vendor_spec[] = {0xdd, 0x05, 0x00, 0x08, 0x40, 0x03};
-static bool wilc_ie;
 
 static struct ieee80211_supported_band wilc_band_2ghz = {
.channels = ieee80211_2ghz_channels,
@@ -515,9 +512,9 @@ static void cfg_connect_result(enum conn_event 
conn_disconn_evt,
GFP_KERNEL);
} else if (conn_disconn_evt == CONN_DISCONN_EVENT_DISCONN_NOTIF) {
vif->obtaining_ip = false;
-   p2p_local_random = 0x01;
-   p2p_recv_random = 0x00;
-   wilc_ie = false;
+   priv->p2p.local_random = 0x01;
+   priv->p2p.recv_random = 0x00;
+   priv->p2p.is_wilc_ie = false;
eth_zero_addr(priv->associated_bss);
wilc_wlan_set_bssid(priv->dev, null_bssid, STATION_MODE);
 
@@ -829,9 +826,9 @@ static int disconnect(struct wiphy *wiphy, struct 
net_device *dev,
wlan_channel = INVALID_CHANNEL;
wilc_wlan_set_bssid(priv->dev, null_bssid, STATION_MODE);
 
-   p2p_local_random = 0x01;
-   p2p_recv_random = 0x00;
-   wilc_ie = false;
+   priv->p2p.local_random = 0x01;
+   priv->p2p.recv_random = 0x00;
+   priv->p2p.is_wilc_ie = false;
wfi_drv->p2p_timeout = 0;
 
ret = wilc_disconnect(vif, reason_code);
@@ -1330,20 +1327,21 @@ static void wilc_wfi_cfg_parse_rx_vendor_spec(struct 
wilc_priv *priv, u8 *buff,
struct wilc_vif *vif = netdev_priv(priv->dev);
 
subtype = buff[P2P_PUB_ACTION_SUBTYPE];
-   if ((subtype == GO_NEG_REQ || subtype == GO_NEG_RSP) && !wilc_ie) {
+   if ((subtype == GO_NEG_REQ || subtype == GO_NEG_RSP) &&
+   !priv->p2p.is_wilc_ie) {
for (i = P2P_PUB_ACTION_SUBTYPE; i < size; i++) {
if (!memcmp(p2p_vendor_spec, &buff[i], 6)) {
-   p2p_recv_random = buff[i + 6];
-   wilc_ie = true;
+   priv->p2p.recv_random = buff[i + 6];
+   priv->p2p.is_wilc_ie = true;
break;
}
}
}
 
-   if (p2p_local_random <= p2p_recv_random) {
+   if (priv->p2p.local_random <= priv->p2p.recv_random) {
netdev_dbg(vif->ndev,
   "PEER WILL BE GO LocaRand=%02x RecvRand %02x\n",
-  p2p_local_random, p2p_recv_random);
+  priv->p2p.local_random, priv->p2p.recv_random);
return;
}
 
@@ -1411,7 +1409,7 @@ void wilc_wfi_p2p_rx(struct net_device *dev, u8 *buff, 
u32 size)
  size);
 
if ((subtype == GO_NEG_REQ || subtype == GO_NEG_RSP) &&
-   wilc_ie)
+   priv->p2p.is_wilc_ie)
size -= 7;
 
break;
@@ -1503,7 +1501,8 @@ static int cancel_remain_on_channel(struct wiphy *wiphy,
priv->remain_on_ch_params.listen_session_id);
 }
 
-static void wilc_wfi_cfg_tx_vendor_spec(struct p2p_mgmt_data *mgmt_tx,
+static void wilc_wfi_cfg_tx_vendor_spec(struct wilc_priv *priv,
+   struct p2p_mgmt_data

[PATCH v3 26/29] staging: wilc1000: remove unnecessary option used with ccflags-y in Makefile

2018-09-24 Thread Ajay Singh
Cleanup patch to remove -I(src) and -DWILC_ASIC_A0 option used in
ccflag-y in Makefile.

Signed-off-by: Ajay Singh 
---
 drivers/staging/wilc1000/Makefile | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/staging/wilc1000/Makefile 
b/drivers/staging/wilc1000/Makefile
index 5718bc4..37e8560 100644
--- a/drivers/staging/wilc1000/Makefile
+++ b/drivers/staging/wilc1000/Makefile
@@ -4,8 +4,6 @@ obj-$(CONFIG_WILC1000) += wilc1000.o
 ccflags-y += -DFIRMWARE_1002=\"atmel/wilc1002_firmware.bin\" \
-DFIRMWARE_1003=\"atmel/wilc1003_firmware.bin\"
 
-ccflags-y += -I$(src)/ -DWILC_ASIC_A0
-
 wilc1000-objs := wilc_wfi_cfgoperations.o linux_wlan.o linux_mon.o \
coreconfigurator.o host_interface.o \
wilc_wlan_cfg.o wilc_wlan.o
-- 
2.7.4

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


[PATCH v3 23/29] staging: wilc1000: remove unnecessary memset in sdio_init() & wilc_spi_init()

2018-09-24 Thread Ajay Singh
Cleanup changes to avoid unnecessary setting 'wilc->bus_data' value to
zero as the buffer was allocated using kzalloc().

Signed-off-by: Ajay Singh 
---
 drivers/staging/wilc1000/wilc_sdio.c | 4 +---
 drivers/staging/wilc1000/wilc_spi.c  | 3 ---
 2 files changed, 1 insertion(+), 6 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_sdio.c 
b/drivers/staging/wilc1000/wilc_sdio.c
index 7ef047c..ca351c9 100644
--- a/drivers/staging/wilc1000/wilc_sdio.c
+++ b/drivers/staging/wilc1000/wilc_sdio.c
@@ -689,10 +689,8 @@ static int sdio_init(struct wilc *wilc, bool resume)
int loop, ret;
u32 chipid;
 
-   if (!resume) {
-   memset(sdio_priv, 0, sizeof(struct wilc_sdio));
+   if (!resume)
sdio_priv->irq_gpio = wilc->dev_irq_num;
-   }
 
/**
 *  function 0 csa enable
diff --git a/drivers/staging/wilc1000/wilc_spi.c 
b/drivers/staging/wilc1000/wilc_spi.c
index 2559cf0..cef127b 100644
--- a/drivers/staging/wilc1000/wilc_spi.c
+++ b/drivers/staging/wilc1000/wilc_spi.c
@@ -838,12 +838,9 @@ static int wilc_spi_init(struct wilc *wilc, bool resume)
return 1;
}
 
-   memset(spi_priv, 0, sizeof(struct wilc_spi));
-
/*
 * configure protocol
 */
-   spi_priv->crc_off = 0;
 
/*
 * TODO: We can remove the CRC trials if there is a definite
-- 
2.7.4

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


[PATCH v3 25/29] staging: wilc1000: remove wilc_debugfs.c file as its not used

2018-09-24 Thread Ajay Singh
Deleted wilc_debugfs.c file as it's not used.

Earlier discussion link:
[1]. https://www.spinics.net/lists/linux-wireless/msg176076.html

Suggested-by: Greg KH 
Signed-off-by: Ajay Singh 
---
 drivers/staging/wilc1000/Makefile   |   5 +-
 drivers/staging/wilc1000/wilc_debugfs.c | 115 
 2 files changed, 2 insertions(+), 118 deletions(-)
 delete mode 100644 drivers/staging/wilc1000/wilc_debugfs.c

diff --git a/drivers/staging/wilc1000/Makefile 
b/drivers/staging/wilc1000/Makefile
index ee7e26b..5718bc4 100644
--- a/drivers/staging/wilc1000/Makefile
+++ b/drivers/staging/wilc1000/Makefile
@@ -4,12 +4,11 @@ obj-$(CONFIG_WILC1000) += wilc1000.o
 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 += -I$(src)/ -DWILC_ASIC_A0
 
 wilc1000-objs := wilc_wfi_cfgoperations.o linux_wlan.o linux_mon.o \
coreconfigurator.o host_interface.o \
-   wilc_wlan_cfg.o wilc_debugfs.o \
-   wilc_wlan.o
+   wilc_wlan_cfg.o wilc_wlan.o
 
 obj-$(CONFIG_WILC1000_SDIO) += wilc1000-sdio.o
 wilc1000-sdio-objs += wilc_sdio.o
diff --git a/drivers/staging/wilc1000/wilc_debugfs.c 
b/drivers/staging/wilc1000/wilc_debugfs.c
deleted file mode 100644
index 8001df6..000
--- a/drivers/staging/wilc1000/wilc_debugfs.c
+++ /dev/null
@@ -1,115 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-/*
- * Copyright (c) 2012 - 2018 Microchip Technology Inc., and its subsidiaries.
- * All rights reserved.
- */
-
-#if defined(WILC_DEBUGFS)
-#include 
-#include 
-
-#include "wilc_wlan_if.h"
-
-static struct dentry *wilc_dir;
-
-#define DEBUG   BIT(0)
-#define INFOBIT(1)
-#define WRN BIT(2)
-#define ERR BIT(3)
-
-#define DBG_LEVEL_ALL  (DEBUG | INFO | WRN | ERR)
-static atomic_t WILC_DEBUG_LEVEL = ATOMIC_INIT(ERR);
-EXPORT_SYMBOL_GPL(WILC_DEBUG_LEVEL);
-
-static ssize_t wilc_debug_level_read(struct file *file, char __user *userbuf,
-size_t count, loff_t *ppos)
-{
-   char buf[128];
-   int res = 0;
-
-   /* only allow read from start */
-   if (*ppos > 0)
-   return 0;
-
-   res = scnprintf(buf, sizeof(buf), "Debug Level: %x\n",
-   atomic_read(&WILC_DEBUG_LEVEL));
-
-   return simple_read_from_buffer(userbuf, count, ppos, buf, res);
-}
-
-static ssize_t wilc_debug_level_write(struct file *filp,
- const char __user *buf, size_t count,
- loff_t *ppos)
-{
-   int flag = 0;
-   int ret;
-
-   ret = kstrtouint_from_user(buf, count, 16, &flag);
-   if (ret)
-   return ret;
-
-   if (flag > DBG_LEVEL_ALL) {
-   pr_info("%s, value (0x%08x) is out of range, stay previous flag 
(0x%08x)\n",
-   __func__, flag, atomic_read(&WILC_DEBUG_LEVEL));
-   return -EINVAL;
-   }
-
-   atomic_set(&WILC_DEBUG_LEVEL, (int)flag);
-
-   if (flag == 0)
-   pr_info("Debug-level disabled\n");
-   else
-   pr_info("Debug-level enabled\n");
-
-   return count;
-}
-
-#define FOPS(_open, _read, _write, _poll) { \
-   .owner  = THIS_MODULE, \
-   .open   = (_open), \
-   .read   = (_read), \
-   .write  = (_write), \
-   .poll   = (_poll), \
-}
-
-struct wilc_debugfs_info_t {
-   const char *name;
-   int perm;
-   unsigned int data;
-   const struct file_operations fops;
-};
-
-static struct wilc_debugfs_info_t debugfs_info[] = {
-   {
-   "wilc_debug_level",
-   0666,
-   (DEBUG | ERR),
-   FOPS(NULL, wilc_debug_level_read, wilc_debug_level_write, NULL),
-   },
-};
-
-static int __init wilc_debugfs_init(void)
-{
-   int i;
-   struct wilc_debugfs_info_t *info;
-
-   wilc_dir = debugfs_create_dir("wilc_wifi", NULL);
-   for (i = 0; i < ARRAY_SIZE(debugfs_info); i++) {
-   info = &debugfs_info[i];
-   debugfs_create_file(info->name,
-   info->perm,
-   wilc_dir,
-   &info->data,
-   &info->fops);
-   }
-   return 0;
-}
-module_init(wilc_debugfs_init);
-
-static void __exit wilc_debugfs_remove(void)
-{
-   debugfs_remove_recursive(wilc_dir);
-}
-module_exit(wilc_debugfs_remove);
-
-#endif
-- 
2.7.4

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


[PATCH v3 28/29] staging: wilc1000: refactor wilc_set_multicast_list() function

2018-09-24 Thread Ajay Singh
Refactor wilc_set_multicast_list() by making below changes:
o use kmalloc_array
o remove unnecessary res
o add u8 *cur_mc
o use i as index
o use '%pM' extension in netdev_dbg()

The below checkpatch issue is also resolved after code refactor.
'spaces preferred around that '/' (ctx:VxV)'

Suggested-by: Joe Perches 
Signed-off-by: Ajay Singh 
---
 drivers/staging/wilc1000/linux_wlan.c | 20 ++--
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index 695d5b2..3ac82a1 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -799,9 +799,9 @@ static void wilc_set_multicast_list(struct net_device *dev)
 {
struct netdev_hw_addr *ha;
struct wilc_vif *vif = netdev_priv(dev);
-   int i = 0;
+   int i;
u8 *mc_list;
-   int res;
+   u8 *cur_mc;
 
if (dev->flags & IFF_PROMISC)
return;
@@ -817,20 +817,20 @@ static void wilc_set_multicast_list(struct net_device 
*dev)
return;
}
 
-   mc_list = kmalloc(dev->mc.count * ETH_ALEN, GFP_KERNEL);
+   mc_list = kmalloc_array(dev->mc.count, ETH_ALEN, GFP_KERNEL);
if (!mc_list)
return;
 
+   cur_mc = mc_list;
+   i = 0;
netdev_for_each_mc_addr(ha, dev) {
-   memcpy(mc_list + i, ha->addr, ETH_ALEN);
-   netdev_dbg(dev, "Entry[%d]: %x:%x:%x:%x:%x:%x\n", i/ETH_ALEN,
-  mc_list[i], mc_list[i + 1], mc_list[i + 2],
-  mc_list[i + 3], mc_list[i + 4], mc_list[i + 5]);
-   i += ETH_ALEN;
+   memcpy(cur_mc, ha->addr, ETH_ALEN);
+   netdev_dbg(dev, "Entry[%d]: %pM\n", i, cur_mc);
+   i++;
+   cur_mc += ETH_ALEN;
}
 
-   res = wilc_setup_multicast_filter(vif, true, dev->mc.count, mc_list);
-   if (res)
+   if (wilc_setup_multicast_filter(vif, true, dev->mc.count, mc_list))
kfree(mc_list);
 }
 
-- 
2.7.4

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


[PATCH v3 29/29] staging: wilc1000: return exact error of register_netdev() from wilc_netdev_init()

2018-09-24 Thread Ajay Singh
Refactor wilc_netdev_init() to return the error code received from
register_netdev() during the failure condition.

Earlier discussion link
[1]. https://www.spinics.net/lists/linux-wireless/msg177304.html

Suggested-by: Claudiu Beznea 
Signed-off-by: Ajay Singh 
---
 drivers/staging/wilc1000/linux_wlan.c | 14 ++
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index 3ac82a1..9ee04ea 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -1065,7 +1065,8 @@ int wilc_netdev_init(struct wilc **wilc, struct device 
*dev, int io_type,
if (!wl)
return -ENOMEM;
 
-   if (wilc_wlan_cfg_init(wl))
+   ret = wilc_wlan_cfg_init(wl);
+   if (ret)
goto free_wl;
 
*wilc = wl;
@@ -1077,8 +1078,10 @@ int wilc_netdev_init(struct wilc **wilc, struct device 
*dev, int io_type,
INIT_LIST_HEAD(&wl->rxq_head.list);
 
wl->hif_workqueue = create_singlethread_workqueue("WILC_wq");
-   if (!wl->hif_workqueue)
+   if (!wl->hif_workqueue) {
+   ret = -ENOMEM;
goto free_cfg;
+   }
 
register_inetaddr_notifier(&g_dev_notifier);
 
@@ -1086,8 +1089,10 @@ int wilc_netdev_init(struct wilc **wilc, struct device 
*dev, int io_type,
struct wireless_dev *wdev;
 
ndev = alloc_etherdev(sizeof(struct wilc_vif));
-   if (!ndev)
+   if (!ndev) {
+   ret = -ENOMEM;
goto free_ndev;
+   }
 
vif = netdev_priv(ndev);
memset(vif, 0, sizeof(struct wilc_vif));
@@ -1110,6 +1115,7 @@ int wilc_netdev_init(struct wilc **wilc, struct device 
*dev, int io_type,
wdev = wilc_create_wiphy(ndev, dev);
if (!wdev) {
netdev_err(ndev, "Can't register WILC Wiphy\n");
+   ret = -ENOMEM;
goto free_ndev;
}
 
@@ -1151,7 +1157,7 @@ int wilc_netdev_init(struct wilc **wilc, struct device 
*dev, int io_type,
wilc_wlan_cfg_deinit(wl);
 free_wl:
kfree(wl);
-   return -ENOMEM;
+   return ret;
 }
 EXPORT_SYMBOL_GPL(wilc_netdev_init);
 
-- 
2.7.4

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


[PATCH] staging: dgnc: Fix Kconfig help header and text

2018-09-24 Thread sehro rautenkranz
Replace Kconfig help header and text to match other modules. Issue found
by checkpatch.

Signed-off-by: sehro rautenkranz 
---
 drivers/staging/dgnc/Kconfig | 8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/dgnc/Kconfig b/drivers/staging/dgnc/Kconfig
index 032c2a795238..c845b357b53d 100644
--- a/drivers/staging/dgnc/Kconfig
+++ b/drivers/staging/dgnc/Kconfig
@@ -2,5 +2,9 @@ config DGNC
tristate "Digi Neo and Classic PCI Products"
default n
depends on TTY && PCI
-   ---help---
-   Driver for the Digi International Neo and Classic PCI based product 
line.
+   help
+Say Y here to enable support for the Digi International Neo and
+Classic PCI based product line.
+
+To compile this driver as a module, say M here: the module will be
+called dgnc
-- 
2.19.0

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