Hello Dear.

2018-08-31 Thread michel



With Due Respect,

I know that this mail will come to you as a surprise as we have never met 
before, but need not to worry as I am contacting you independently of my 
investigation and no one is informed of this communication. I need your urgent 
assistance in transferring the sum of $11.3million immediately to your private 
account.The money has been here in our Bank lying dormant for years now without 
anybody coming for the claim of it.

I want to release the money to you as the relative to our deceased customer 
(the account owner) who died a long with his supposed NEXT OF KIN since 16th 
October 2005. The Banking laws here does not allow such money to stay more than 
13 years, because the money will be recalled to the Bank treasury account as 
unclaimed fund.

By indicating your interest I will send you the full details on how the 
business will be executed.

Please respond urgently and delete if you are not interested.

Best Regards,
Mr.Michel Duku.


Hello Dear.

2018-08-31 Thread michel



With Due Respect,

I know that this mail will come to you as a surprise as we have never met 
before, but need not to worry as I am contacting you independently of my 
investigation and no one is informed of this communication. I need your urgent 
assistance in transferring the sum of $11.3million immediately to your private 
account.The money has been here in our Bank lying dormant for years now without 
anybody coming for the claim of it.

I want to release the money to you as the relative to our deceased customer 
(the account owner) who died a long with his supposed NEXT OF KIN since 16th 
October 2005. The Banking laws here does not allow such money to stay more than 
13 years, because the money will be recalled to the Bank treasury account as 
unclaimed fund.

By indicating your interest I will send you the full details on how the 
business will be executed.

Please respond urgently and delete if you are not interested.

Best Regards,
Mr.Michel Duku.


Re: [GIT PULL] Char/Misc driver patches for 4.19-rc1

2018-08-31 Thread Greg KH
On Fri, Aug 31, 2018 at 01:19:36PM +0200, Pavel Machek wrote:
> Hi!
> 
> > - gnss, finally an in-kernel GPS subsystem to try to tame all of
> >   the crazy out-of-tree drivers that have been floating around
> >   for years, combined with some really hacky userspace
> >   implementations.  This is only for GNSS receivers, but you
> >   have to start somewhere, and this is great to see.
> 
> Yes, it  is labeled as a GPS subsystem, but there's nothing GPS
> specific in there; it does not understand the data, it just passes
> around bytes.
> 
> Which would not be a problem, except that it takes /dev/gnssX
> namespace, so when we need to introduce hardware abstraction for
> GPS, we will not have suitable names available.

Given that no such code seems to be showing up any year soon, that's a
request that we will just have to deal with if it ever shows up.

What we have now in the tree is good enough for now.

greg k-h


Re: [GIT PULL] Char/Misc driver patches for 4.19-rc1

2018-08-31 Thread Greg KH
On Fri, Aug 31, 2018 at 01:19:36PM +0200, Pavel Machek wrote:
> Hi!
> 
> > - gnss, finally an in-kernel GPS subsystem to try to tame all of
> >   the crazy out-of-tree drivers that have been floating around
> >   for years, combined with some really hacky userspace
> >   implementations.  This is only for GNSS receivers, but you
> >   have to start somewhere, and this is great to see.
> 
> Yes, it  is labeled as a GPS subsystem, but there's nothing GPS
> specific in there; it does not understand the data, it just passes
> around bytes.
> 
> Which would not be a problem, except that it takes /dev/gnssX
> namespace, so when we need to introduce hardware abstraction for
> GPS, we will not have suitable names available.

Given that no such code seems to be showing up any year soon, that's a
request that we will just have to deal with if it ever shows up.

What we have now in the tree is good enough for now.

greg k-h


Give retouching

2018-08-31 Thread Jimmy Wilson

Hi,

Have you received my email from last week?

I would like to speak with the person who manage your photos for your
company?

We are here to provide you all kinds of imaging editing.

What we can provide you:
Cutting out for photos
Clipping path for photos
Masking for photos
Retouching for your photos
Retouching for the Beauty Model and Portraits.

We have 20 staffs in house and daily basis 1000 images can be processed.

We give testing for your photos.

Thanks,
Jimmy Wilson



Give retouching

2018-08-31 Thread Jimmy Wilson

Hi,

Have you received my email from last week?

I would like to speak with the person who manage your photos for your
company?

We are here to provide you all kinds of imaging editing.

What we can provide you:
Cutting out for photos
Clipping path for photos
Masking for photos
Retouching for your photos
Retouching for the Beauty Model and Portraits.

We have 20 staffs in house and daily basis 1000 images can be processed.

We give testing for your photos.

Thanks,
Jimmy Wilson



[PATCH rdma-next] RDMA/qedr: remove set but not used variable 'ctx'

2018-08-31 Thread YueHaibing
Fixes gcc '-Wunused-but-set-variable' warning:

drivers/infiniband/hw/qedr/verbs.c: In function 'qedr_create_srq':
drivers/infiniband/hw/qedr/verbs.c:1450:24: warning:
 variable 'ctx' set but not used [-Wunused-but-set-variable]

Signed-off-by: YueHaibing 
---
 drivers/infiniband/hw/qedr/verbs.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/infiniband/hw/qedr/verbs.c 
b/drivers/infiniband/hw/qedr/verbs.c
index 8cc3df2..9d4d165 100644
--- a/drivers/infiniband/hw/qedr/verbs.c
+++ b/drivers/infiniband/hw/qedr/verbs.c
@@ -1447,7 +1447,6 @@ struct ib_srq *qedr_create_srq(struct ib_pd *ibpd,
u64 pbl_base_addr, phy_prod_pair_addr;
struct ib_ucontext *ib_ctx = NULL;
struct qedr_srq_hwq_info *hw_srq;
-   struct qedr_ucontext *ctx = NULL;
u32 page_cnt, page_size;
struct qedr_srq *srq;
int rc = 0;
@@ -1473,7 +1472,6 @@ struct ib_srq *qedr_create_srq(struct ib_pd *ibpd,
 
if (udata && ibpd->uobject && ibpd->uobject->context) {
ib_ctx = ibpd->uobject->context;
-   ctx = get_qedr_ucontext(ib_ctx);
 
if (ib_copy_from_udata(, udata, sizeof(ureq))) {
DP_ERR(dev,



[PATCH rdma-next] RDMA/qedr: remove set but not used variable 'ctx'

2018-08-31 Thread YueHaibing
Fixes gcc '-Wunused-but-set-variable' warning:

drivers/infiniband/hw/qedr/verbs.c: In function 'qedr_create_srq':
drivers/infiniband/hw/qedr/verbs.c:1450:24: warning:
 variable 'ctx' set but not used [-Wunused-but-set-variable]

Signed-off-by: YueHaibing 
---
 drivers/infiniband/hw/qedr/verbs.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/infiniband/hw/qedr/verbs.c 
b/drivers/infiniband/hw/qedr/verbs.c
index 8cc3df2..9d4d165 100644
--- a/drivers/infiniband/hw/qedr/verbs.c
+++ b/drivers/infiniband/hw/qedr/verbs.c
@@ -1447,7 +1447,6 @@ struct ib_srq *qedr_create_srq(struct ib_pd *ibpd,
u64 pbl_base_addr, phy_prod_pair_addr;
struct ib_ucontext *ib_ctx = NULL;
struct qedr_srq_hwq_info *hw_srq;
-   struct qedr_ucontext *ctx = NULL;
u32 page_cnt, page_size;
struct qedr_srq *srq;
int rc = 0;
@@ -1473,7 +1472,6 @@ struct ib_srq *qedr_create_srq(struct ib_pd *ibpd,
 
if (udata && ibpd->uobject && ibpd->uobject->context) {
ib_ctx = ibpd->uobject->context;
-   ctx = get_qedr_ucontext(ib_ctx);
 
if (ib_copy_from_udata(, udata, sizeof(ureq))) {
DP_ERR(dev,



[PATCH] x86/fault: Decode page fault OOPSes better

2018-08-31 Thread Andy Lutomirski
One of Linus' favorite hobbies seems to be looking at OOPSes and
decoding the error code in his head.  This is not one of my favorite
hobbies :)

Teach the page fault OOPS hander to decode the error code.  If it's
a !USER fault from user mode, print an explicit note to that effect
and print out the addresses of various tables that might cause such
an error.

Signed-off-by: Andy Lutomirski 
---

This is not the best-tested thing in the world, although it appears to
work.  I think it would have made developing PTI much more pleasant.

 arch/x86/mm/fault.c | 76 +
 1 file changed, 76 insertions(+)

diff --git a/arch/x86/mm/fault.c b/arch/x86/mm/fault.c
index b9123c497e0a..9381ce880c9d 100644
--- a/arch/x86/mm/fault.c
+++ b/arch/x86/mm/fault.c
@@ -25,6 +25,7 @@
 #include   /* emulate_vsyscall */
 #include   /* struct vm86  */
 #include/* vma_pkey()   */
+#include   /* store_idt(), ... */
 
 #define CREATE_TRACE_POINTS
 #include 
@@ -640,10 +641,43 @@ static int is_f00f_bug(struct pt_regs *regs, unsigned 
long address)
return 0;
 }
 
+static void show_ldttss(const struct desc_ptr *gdt, const char *name, u16 
index)
+{
+   u32 offset = (index >> 3) * sizeof(struct desc_struct);
+   unsigned long addr;
+   struct ldttss_desc desc;
+
+   if (index == 0) {
+   pr_alert("%s: NULL\n", name);
+   return;
+   }
+
+   if (offset + sizeof(struct ldttss_desc) >= gdt->size) {
+   pr_alert("%s: 0x%hx -- out of bounds\n", name, index);
+   return;
+   }
+
+   if (probe_kernel_read(, (void *)(gdt->address + offset),
+ sizeof(struct ldttss_desc))) {
+   pr_alert("%s: 0x%hx -- GDT entry is not readable\n",
+name, index);
+   return;
+   }
+
+   addr = desc.base0 | (desc.base1 << 16) | (desc.base2 << 24);
+#ifdef CONFIG_X86_64
+   addr |= ((u64)desc.base3 << 32);
+#endif
+   pr_alert("%s: 0x%hx -- base=0x%lx limit=0x%x\n",
+name, index, addr, (desc.limit0 | (desc.limit1 << 16)));
+}
+
 static void
 show_fault_oops(struct pt_regs *regs, unsigned long error_code,
unsigned long address)
 {
+   char errcode[64];
+
if (!oops_may_print())
return;
 
@@ -671,6 +705,48 @@ show_fault_oops(struct pt_regs *regs, unsigned long 
error_code,
 address < PAGE_SIZE ? "NULL pointer dereference" : "paging 
request",
 (void *)address);
 
+   errcode[0] = 0;
+#define ERRSTR(x) if (error_code & X86_PF_##x) strcat(errcode, " " #x)
+   ERRSTR(PROT);
+   ERRSTR(WRITE);
+   ERRSTR(USER);
+   ERRSTR(RSVD);
+   ERRSTR(INSTR);
+   ERRSTR(PK);
+#undef ERRSTR
+   pr_alert("HW error: %s\n", errcode[0] ? errcode + 1 :
+"normal kernel read fault");
+   if (!(error_code & X86_PF_USER) && user_mode(regs)) {
+   struct desc_ptr idt, gdt;
+   u16 ldtr, tr;
+
+   pr_alert("This was a system access from user code\n");
+
+   /*
+* This can happen for quite a few reasons.  The more obvious
+* ones are faults accessing the GDT, or LDT.  Perhaps
+* surprisingly, if the CPU tries to deliver a benign or
+* contributory exception from user code and gets a page fault
+* during delivery, the page fault can be delivered as though
+* it originated directly from user code.  This could happen
+* due to wrong permissions on the IDT, GDT, LDT, TSS, or
+* kernel or IST stack.
+*/
+   store_idt();
+
+   /* Usable even on Xen PV -- it's just slow. */
+   native_store_gdt();
+
+   pr_alert("IDT: 0x%lx (limit=0x%hx) GDT: 0x%lx (limit=0x%hx)\n",
+idt.address, idt.size, gdt.address, gdt.size);
+
+   store_ldt(ldtr);
+   show_ldttss(, "LDTR", ldtr);
+
+   store_tr(tr);
+   show_ldttss(, "TR", tr);
+   }
+
dump_pagetable(address);
 }
 
-- 
2.17.1



[PATCH] x86/fault: Decode page fault OOPSes better

2018-08-31 Thread Andy Lutomirski
One of Linus' favorite hobbies seems to be looking at OOPSes and
decoding the error code in his head.  This is not one of my favorite
hobbies :)

Teach the page fault OOPS hander to decode the error code.  If it's
a !USER fault from user mode, print an explicit note to that effect
and print out the addresses of various tables that might cause such
an error.

Signed-off-by: Andy Lutomirski 
---

This is not the best-tested thing in the world, although it appears to
work.  I think it would have made developing PTI much more pleasant.

 arch/x86/mm/fault.c | 76 +
 1 file changed, 76 insertions(+)

diff --git a/arch/x86/mm/fault.c b/arch/x86/mm/fault.c
index b9123c497e0a..9381ce880c9d 100644
--- a/arch/x86/mm/fault.c
+++ b/arch/x86/mm/fault.c
@@ -25,6 +25,7 @@
 #include   /* emulate_vsyscall */
 #include   /* struct vm86  */
 #include/* vma_pkey()   */
+#include   /* store_idt(), ... */
 
 #define CREATE_TRACE_POINTS
 #include 
@@ -640,10 +641,43 @@ static int is_f00f_bug(struct pt_regs *regs, unsigned 
long address)
return 0;
 }
 
+static void show_ldttss(const struct desc_ptr *gdt, const char *name, u16 
index)
+{
+   u32 offset = (index >> 3) * sizeof(struct desc_struct);
+   unsigned long addr;
+   struct ldttss_desc desc;
+
+   if (index == 0) {
+   pr_alert("%s: NULL\n", name);
+   return;
+   }
+
+   if (offset + sizeof(struct ldttss_desc) >= gdt->size) {
+   pr_alert("%s: 0x%hx -- out of bounds\n", name, index);
+   return;
+   }
+
+   if (probe_kernel_read(, (void *)(gdt->address + offset),
+ sizeof(struct ldttss_desc))) {
+   pr_alert("%s: 0x%hx -- GDT entry is not readable\n",
+name, index);
+   return;
+   }
+
+   addr = desc.base0 | (desc.base1 << 16) | (desc.base2 << 24);
+#ifdef CONFIG_X86_64
+   addr |= ((u64)desc.base3 << 32);
+#endif
+   pr_alert("%s: 0x%hx -- base=0x%lx limit=0x%x\n",
+name, index, addr, (desc.limit0 | (desc.limit1 << 16)));
+}
+
 static void
 show_fault_oops(struct pt_regs *regs, unsigned long error_code,
unsigned long address)
 {
+   char errcode[64];
+
if (!oops_may_print())
return;
 
@@ -671,6 +705,48 @@ show_fault_oops(struct pt_regs *regs, unsigned long 
error_code,
 address < PAGE_SIZE ? "NULL pointer dereference" : "paging 
request",
 (void *)address);
 
+   errcode[0] = 0;
+#define ERRSTR(x) if (error_code & X86_PF_##x) strcat(errcode, " " #x)
+   ERRSTR(PROT);
+   ERRSTR(WRITE);
+   ERRSTR(USER);
+   ERRSTR(RSVD);
+   ERRSTR(INSTR);
+   ERRSTR(PK);
+#undef ERRSTR
+   pr_alert("HW error: %s\n", errcode[0] ? errcode + 1 :
+"normal kernel read fault");
+   if (!(error_code & X86_PF_USER) && user_mode(regs)) {
+   struct desc_ptr idt, gdt;
+   u16 ldtr, tr;
+
+   pr_alert("This was a system access from user code\n");
+
+   /*
+* This can happen for quite a few reasons.  The more obvious
+* ones are faults accessing the GDT, or LDT.  Perhaps
+* surprisingly, if the CPU tries to deliver a benign or
+* contributory exception from user code and gets a page fault
+* during delivery, the page fault can be delivered as though
+* it originated directly from user code.  This could happen
+* due to wrong permissions on the IDT, GDT, LDT, TSS, or
+* kernel or IST stack.
+*/
+   store_idt();
+
+   /* Usable even on Xen PV -- it's just slow. */
+   native_store_gdt();
+
+   pr_alert("IDT: 0x%lx (limit=0x%hx) GDT: 0x%lx (limit=0x%hx)\n",
+idt.address, idt.size, gdt.address, gdt.size);
+
+   store_ldt(ldtr);
+   show_ldttss(, "LDTR", ldtr);
+
+   store_tr(tr);
+   show_ldttss(, "TR", tr);
+   }
+
dump_pagetable(address);
 }
 
-- 
2.17.1



Re: [PATCH v3] x86/vdso: Handle clock_gettime(CLOCK_TAI) in vDSO

2018-08-31 Thread Andy Lutomirski
(Hi, Florian!)

On Fri, Aug 31, 2018 at 6:59 PM, Matt Rickard  wrote:
> Process clock_gettime(CLOCK_TAI) in vDSO.
> This makes the call about as fast as CLOCK_REALTIME and CLOCK_MONOTONIC:
>
>   nanoseconds
>  before after clockname
> - -
> 23387 CLOCK_TAI
>  9693 CLOCK_REALTIME
>  8887 CLOCK_MONOTONIC

Are you sure you did this right?  With the clocksource set to TSC
(which is the only reasonable choice unless KVM has seriously cleaned
up its act), with retpolines enabled, I get 24ns for CLOCK_MONOTONIC
without your patch and 32ns with your patch.  And there is indeed a
retpoline in the disassembled output:

  e5:   e8 07 00 00 00  callq  f1 <__vdso_clock_gettime+0x31>
  ea:   f3 90   pause
  ec:   0f ae e8lfence
  ef:   eb f9   jmpea <__vdso_clock_gettime+0x2a>
  f1:   48 89 04 24 mov%rax,(%rsp)
  f5:   c3  retq

You're probably going to have to set -fno-jump-tables or do something
clever like adding a whole array of (seconds, nsec) in gtod and
indexing that array by the clock id.

Meanwhile, I wrote the following trivial patch to add a
__vdso_clock_gettime_monotonic export.  It runs in 21ns, and I suspect
that the speedup is even a bit bigger when cache-cold because it
avoids some branches.  What do you all think?  Florian, do you think
glibc would be willing to add some magic to turn
clock_gettime(CLOCK_MONOTONIC, t) into
__vdso_clock_gettime_monotonic(t) when CLOCK_MONOTONIC is a constant?
diff --git a/arch/x86/entry/vdso/vclock_gettime.c b/arch/x86/entry/vdso/vclock_gettime.c
index 91ed1bb2a3bb..4f22e9cb97a5 100644
--- a/arch/x86/entry/vdso/vclock_gettime.c
+++ b/arch/x86/entry/vdso/vclock_gettime.c
@@ -319,6 +319,14 @@ notrace int __vdso_clock_gettime(clockid_t clock, struct timespec *ts)
 int clock_gettime(clockid_t, struct timespec *)
 	__attribute__((weak, alias("__vdso_clock_gettime")));
 
+notrace int __vdso_clock_gettime_monotonic(struct timespec *ts)
+{
+	if (likely(do_monotonic(ts) != VCLOCK_NONE))
+		return 0;
+
+	return vdso_fallback_gettime(CLOCK_MONOTONIC, ts);
+}
+
 notrace int __vdso_gettimeofday(struct timeval *tv, struct timezone *tz)
 {
 	if (likely(tv != NULL)) {
diff --git a/arch/x86/entry/vdso/vdso.lds.S b/arch/x86/entry/vdso/vdso.lds.S
index d3a2dce4cfa9..28e23cbc02c9 100644
--- a/arch/x86/entry/vdso/vdso.lds.S
+++ b/arch/x86/entry/vdso/vdso.lds.S
@@ -15,6 +15,11 @@
  * This controls what userland symbols we export from the vDSO.
  */
 VERSION {
+	LINUX_4.19 {
+	global:
+		__vdso_clock_gettime_monotonic;
+	};
+
 	LINUX_2.6 {
 	global:
 		clock_gettime;


Re: [PATCH v3] x86/vdso: Handle clock_gettime(CLOCK_TAI) in vDSO

2018-08-31 Thread Andy Lutomirski
(Hi, Florian!)

On Fri, Aug 31, 2018 at 6:59 PM, Matt Rickard  wrote:
> Process clock_gettime(CLOCK_TAI) in vDSO.
> This makes the call about as fast as CLOCK_REALTIME and CLOCK_MONOTONIC:
>
>   nanoseconds
>  before after clockname
> - -
> 23387 CLOCK_TAI
>  9693 CLOCK_REALTIME
>  8887 CLOCK_MONOTONIC

Are you sure you did this right?  With the clocksource set to TSC
(which is the only reasonable choice unless KVM has seriously cleaned
up its act), with retpolines enabled, I get 24ns for CLOCK_MONOTONIC
without your patch and 32ns with your patch.  And there is indeed a
retpoline in the disassembled output:

  e5:   e8 07 00 00 00  callq  f1 <__vdso_clock_gettime+0x31>
  ea:   f3 90   pause
  ec:   0f ae e8lfence
  ef:   eb f9   jmpea <__vdso_clock_gettime+0x2a>
  f1:   48 89 04 24 mov%rax,(%rsp)
  f5:   c3  retq

You're probably going to have to set -fno-jump-tables or do something
clever like adding a whole array of (seconds, nsec) in gtod and
indexing that array by the clock id.

Meanwhile, I wrote the following trivial patch to add a
__vdso_clock_gettime_monotonic export.  It runs in 21ns, and I suspect
that the speedup is even a bit bigger when cache-cold because it
avoids some branches.  What do you all think?  Florian, do you think
glibc would be willing to add some magic to turn
clock_gettime(CLOCK_MONOTONIC, t) into
__vdso_clock_gettime_monotonic(t) when CLOCK_MONOTONIC is a constant?
diff --git a/arch/x86/entry/vdso/vclock_gettime.c b/arch/x86/entry/vdso/vclock_gettime.c
index 91ed1bb2a3bb..4f22e9cb97a5 100644
--- a/arch/x86/entry/vdso/vclock_gettime.c
+++ b/arch/x86/entry/vdso/vclock_gettime.c
@@ -319,6 +319,14 @@ notrace int __vdso_clock_gettime(clockid_t clock, struct timespec *ts)
 int clock_gettime(clockid_t, struct timespec *)
 	__attribute__((weak, alias("__vdso_clock_gettime")));
 
+notrace int __vdso_clock_gettime_monotonic(struct timespec *ts)
+{
+	if (likely(do_monotonic(ts) != VCLOCK_NONE))
+		return 0;
+
+	return vdso_fallback_gettime(CLOCK_MONOTONIC, ts);
+}
+
 notrace int __vdso_gettimeofday(struct timeval *tv, struct timezone *tz)
 {
 	if (likely(tv != NULL)) {
diff --git a/arch/x86/entry/vdso/vdso.lds.S b/arch/x86/entry/vdso/vdso.lds.S
index d3a2dce4cfa9..28e23cbc02c9 100644
--- a/arch/x86/entry/vdso/vdso.lds.S
+++ b/arch/x86/entry/vdso/vdso.lds.S
@@ -15,6 +15,11 @@
  * This controls what userland symbols we export from the vDSO.
  */
 VERSION {
+	LINUX_4.19 {
+	global:
+		__vdso_clock_gettime_monotonic;
+	};
+
 	LINUX_2.6 {
 	global:
 		clock_gettime;


Re: [PATCH v5 1/2] clk: Add of_clk_get_by_name_optional() function

2018-08-31 Thread Stephen Boyd
Quoting Phil Edworthy (2018-08-31 07:07:22)
> diff --git a/drivers/clk/clkdev.c b/drivers/clk/clkdev.c
> index 9ab3db8..4adb99e 100644
> --- a/drivers/clk/clkdev.c
> +++ b/drivers/clk/clkdev.c
> @@ -54,30 +54,29 @@ EXPORT_SYMBOL(of_clk_get);
>  
>  static struct clk *__of_clk_get_by_name(struct device_node *np,
> const char *dev_id,
> -   const char *name)
> +   const char *name,
> +   bool optional)
>  {
> struct clk *clk = ERR_PTR(-ENOENT);
> +   struct device_node *child = np;
> +   int index = 0;
>  
> /* Walk up the tree of devices looking for a clock that matches */
> while (np) {
> -   int index = 0;
>  
> /*
>  * For named clocks, first look up the name in the
>  * "clock-names" property.  If it cannot be found, then
> -* index will be an error code, and of_clk_get() will fail.
> +* index will be an error code.
>  */
> if (name)
> index = of_property_match_string(np, "clock-names", 
> name);
> -   clk = __of_clk_get(np, index, dev_id, name);
> -   if (!IS_ERR(clk)) {
> -   break;
> -   } else if (name && index >= 0) {
> -   if (PTR_ERR(clk) != -EPROBE_DEFER)
> -   pr_err("ERROR: could not get clock 
> %pOF:%s(%i)\n",
> -   np, name ? name : "", index);
> +   if (index >= 0)
> +   clk = __of_clk_get(np, index, dev_id, name);
> +   if (!IS_ERR(clk))

Was this change necessary? It looks like we can leave it all alone and
keep passing a negative number to __of_clk_get() and have that return an
error pointer which we then return immediately as an error. But, if the
clock is optional and we've passed a name here, shouldn't we treat an
error from of_property_match_string() as success too? This is all
looking pretty fragile so maybe it can be better commented and also more
explicit instead of relying on the reader to jump through all the
function calls to figure out what the return value is in some cases.

> return clk;
> -   }
> +   if (name && index >= 0)
> +   break;

And this causes us to duplicate logic down below because we have to
check it again if it's not optional or some other error condition?

>  
> /*
>  * No matching clock found on this node.  If the parent node
> @@ -89,6 +88,16 @@ static struct clk *__of_clk_get_by_name(struct device_node 
> *np,
> break;
> }
>  
> +   /* The clock is not valid, but it could be optional or deferred */
> +   if (optional && PTR_ERR(clk) == -ENOENT) {
> +   clk = NULL;
> +   pr_info("no optional clock %pOF:%s\n", child,
> +   name ? name : "");

Is this intentionally pr_info?

> +   } else if (name && index >= 0 && PTR_ERR(clk) != -EPROBE_DEFER) {
> +   pr_err("ERROR: could not get clock %pOF:%s(%i)\n",
> +   child, name, index);
> +   }
> +
> return clk;
>  }
>  


Re: [PATCH v5 1/2] clk: Add of_clk_get_by_name_optional() function

2018-08-31 Thread Stephen Boyd
Quoting Phil Edworthy (2018-08-31 07:07:22)
> diff --git a/drivers/clk/clkdev.c b/drivers/clk/clkdev.c
> index 9ab3db8..4adb99e 100644
> --- a/drivers/clk/clkdev.c
> +++ b/drivers/clk/clkdev.c
> @@ -54,30 +54,29 @@ EXPORT_SYMBOL(of_clk_get);
>  
>  static struct clk *__of_clk_get_by_name(struct device_node *np,
> const char *dev_id,
> -   const char *name)
> +   const char *name,
> +   bool optional)
>  {
> struct clk *clk = ERR_PTR(-ENOENT);
> +   struct device_node *child = np;
> +   int index = 0;
>  
> /* Walk up the tree of devices looking for a clock that matches */
> while (np) {
> -   int index = 0;
>  
> /*
>  * For named clocks, first look up the name in the
>  * "clock-names" property.  If it cannot be found, then
> -* index will be an error code, and of_clk_get() will fail.
> +* index will be an error code.
>  */
> if (name)
> index = of_property_match_string(np, "clock-names", 
> name);
> -   clk = __of_clk_get(np, index, dev_id, name);
> -   if (!IS_ERR(clk)) {
> -   break;
> -   } else if (name && index >= 0) {
> -   if (PTR_ERR(clk) != -EPROBE_DEFER)
> -   pr_err("ERROR: could not get clock 
> %pOF:%s(%i)\n",
> -   np, name ? name : "", index);
> +   if (index >= 0)
> +   clk = __of_clk_get(np, index, dev_id, name);
> +   if (!IS_ERR(clk))

Was this change necessary? It looks like we can leave it all alone and
keep passing a negative number to __of_clk_get() and have that return an
error pointer which we then return immediately as an error. But, if the
clock is optional and we've passed a name here, shouldn't we treat an
error from of_property_match_string() as success too? This is all
looking pretty fragile so maybe it can be better commented and also more
explicit instead of relying on the reader to jump through all the
function calls to figure out what the return value is in some cases.

> return clk;
> -   }
> +   if (name && index >= 0)
> +   break;

And this causes us to duplicate logic down below because we have to
check it again if it's not optional or some other error condition?

>  
> /*
>  * No matching clock found on this node.  If the parent node
> @@ -89,6 +88,16 @@ static struct clk *__of_clk_get_by_name(struct device_node 
> *np,
> break;
> }
>  
> +   /* The clock is not valid, but it could be optional or deferred */
> +   if (optional && PTR_ERR(clk) == -ENOENT) {
> +   clk = NULL;
> +   pr_info("no optional clock %pOF:%s\n", child,
> +   name ? name : "");

Is this intentionally pr_info?

> +   } else if (name && index >= 0 && PTR_ERR(clk) != -EPROBE_DEFER) {
> +   pr_err("ERROR: could not get clock %pOF:%s(%i)\n",
> +   child, name, index);
> +   }
> +
> return clk;
>  }
>  


Re: [PATCH] arm64: dts: ti: k3-am65: Change #address-cells and #size-cells of interconnect to 2

2018-08-31 Thread Nishanth Menon
On 15:56-20180828, Kishon Vijay Abraham I wrote:
[...]
>   cbass_mcu: interconnect@2838 {
>   compatible = "simple-bus";
>   #address-cells = <1>;
>   #size-cells = <1>;
> - ranges = <0x2838 0x2838 0x0388>, /* MCU 
> NAVSS*/
> -  <0x4020 0x4020 0x00900100>, /* First 
> peripheral window */
> -  <0x4204 0x4204 0x03ac2400>, /* WKUP */
> -  <0x4510 0x4510 0x00c24000>, /* MMRs, 
> remaining NAVSS */
> -  <0x4600 0x4600 0x0020>, /* CPSW */
> -  <0x4700 0x4700 0x00068400>; /* OSPI 
> space 1 */
> + ranges = <0x2838 0x00 0x2838 0x0388>, /* 
> MCU NAVSS*/
> +  <0x4020 0x00 0x4020 0x00900100>, /* 
> First peripheral window */
> +  <0x4204 0x00 0x4204 0x03ac2400>, /* 
> WKUP */
> +  <0x4510 0x00 0x4510 0x00c24000>, /* 
> MMRs, remaining NAVSS */
> +  <0x4600 0x00 0x4600 0x0020>, /* 
> CPSW */
> +  <0x4700 0x00 0x4700 0x00068400>; /* 
> OSPI space 1 */
>  


You might need #address-cells and #size-cells as 2 in MCU as
well.. Could you refer to response from Vignesh?
https://marc.info/?l=linux-arm-kernel=153572924921895=2

-- 
Regards,
Nishanth Menon


Re: [PATCH] arm64: dts: ti: k3-am65: Change #address-cells and #size-cells of interconnect to 2

2018-08-31 Thread Nishanth Menon
On 15:56-20180828, Kishon Vijay Abraham I wrote:
[...]
>   cbass_mcu: interconnect@2838 {
>   compatible = "simple-bus";
>   #address-cells = <1>;
>   #size-cells = <1>;
> - ranges = <0x2838 0x2838 0x0388>, /* MCU 
> NAVSS*/
> -  <0x4020 0x4020 0x00900100>, /* First 
> peripheral window */
> -  <0x4204 0x4204 0x03ac2400>, /* WKUP */
> -  <0x4510 0x4510 0x00c24000>, /* MMRs, 
> remaining NAVSS */
> -  <0x4600 0x4600 0x0020>, /* CPSW */
> -  <0x4700 0x4700 0x00068400>; /* OSPI 
> space 1 */
> + ranges = <0x2838 0x00 0x2838 0x0388>, /* 
> MCU NAVSS*/
> +  <0x4020 0x00 0x4020 0x00900100>, /* 
> First peripheral window */
> +  <0x4204 0x00 0x4204 0x03ac2400>, /* 
> WKUP */
> +  <0x4510 0x00 0x4510 0x00c24000>, /* 
> MMRs, remaining NAVSS */
> +  <0x4600 0x00 0x4600 0x0020>, /* 
> CPSW */
> +  <0x4700 0x00 0x4700 0x00068400>; /* 
> OSPI space 1 */
>  


You might need #address-cells and #size-cells as 2 in MCU as
well.. Could you refer to response from Vignesh?
https://marc.info/?l=linux-arm-kernel=153572924921895=2

-- 
Regards,
Nishanth Menon


Re: [PATCH 2/3] of/fdt: avoid re-parsing '#{address,size}-cells' in of_fdt_limit_memory

2018-08-31 Thread kbuild test robot
Hi Rob,

I love your patch! Perhaps something to improve:

[auto build test WARNING on robh/for-next]
[also build test WARNING on v4.19-rc1 next-20180831]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]

url:
https://github.com/0day-ci/linux/commits/Rob-Herring/of-root-size-address-cells-clean-ups/20180831-160759
base:   https://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git for-next
config: i386-allmodconfig (attached as .config)
compiler: gcc-7 (Debian 7.3.0-16) 7.3.0
reproduce:
# save the attached .config to linux build tree
make ARCH=i386 

All warnings (new ones prefixed by >>):

>> WARNING: vmlinux.o(.text+0x718907): Section mismatch in reference from the 
>> function of_fdt_limit_memory() to the variable .init.data:dt_root_addr_cells
   The function of_fdt_limit_memory() references
   the variable __initdata dt_root_addr_cells.
   This is often because of_fdt_limit_memory lacks a __initdata
   annotation or the annotation of dt_root_addr_cells is wrong.
--
>> WARNING: vmlinux.o(.text+0x718917): Section mismatch in reference from the 
>> function of_fdt_limit_memory() to the variable .init.data:dt_root_size_cells
   The function of_fdt_limit_memory() references
   the variable __initdata dt_root_size_cells.
   This is often because of_fdt_limit_memory lacks a __initdata
   annotation or the annotation of dt_root_size_cells is wrong.

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: application/gzip


Re: [PATCH 2/3] of/fdt: avoid re-parsing '#{address,size}-cells' in of_fdt_limit_memory

2018-08-31 Thread kbuild test robot
Hi Rob,

I love your patch! Perhaps something to improve:

[auto build test WARNING on robh/for-next]
[also build test WARNING on v4.19-rc1 next-20180831]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]

url:
https://github.com/0day-ci/linux/commits/Rob-Herring/of-root-size-address-cells-clean-ups/20180831-160759
base:   https://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git for-next
config: i386-allmodconfig (attached as .config)
compiler: gcc-7 (Debian 7.3.0-16) 7.3.0
reproduce:
# save the attached .config to linux build tree
make ARCH=i386 

All warnings (new ones prefixed by >>):

>> WARNING: vmlinux.o(.text+0x718907): Section mismatch in reference from the 
>> function of_fdt_limit_memory() to the variable .init.data:dt_root_addr_cells
   The function of_fdt_limit_memory() references
   the variable __initdata dt_root_addr_cells.
   This is often because of_fdt_limit_memory lacks a __initdata
   annotation or the annotation of dt_root_addr_cells is wrong.
--
>> WARNING: vmlinux.o(.text+0x718917): Section mismatch in reference from the 
>> function of_fdt_limit_memory() to the variable .init.data:dt_root_size_cells
   The function of_fdt_limit_memory() references
   the variable __initdata dt_root_size_cells.
   This is often because of_fdt_limit_memory lacks a __initdata
   annotation or the annotation of dt_root_size_cells is wrong.

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: application/gzip


Re: REGRESSION: boot stalls on several old dual core Intel CPUs

2018-08-31 Thread Kevin Shanahan
On Thu, Aug 30, 2018 at 03:04:39PM +0200, Peter Zijlstra wrote:
> On Thu, Aug 30, 2018 at 12:55:30PM +0200, Siegfried Metz wrote:
> > Dear kernel developers,
> > 
> > since mainline kernel 4.18 (up to the latest mainline kernel 4.18.5)
> > Intel Core 2 Duo processors are affected by boot stalling early in the
> > boot process. As it is so early there is no dmesg output (or any log).
> > 
> > A few users in the Arch Linux community used git bisect and tracked the
> > issue down to this the bad commit:
> > 7197e77abcb65a71d0b21d67beb24f153a96055e clocksource: Remove kthread
> 
> I just dug out my core2duo laptop (Lenovo T500) and build a tip/master
> kernel for it (x86_64 debian distro .config).
> 
> Seems to boot just fine.. 3/3 so far.
> 
> Any other clues?

One additional data point, my affected system is a Dell Latitude E6400
laptop which has a P8400 CPU:

  vendor_id : GenuineIntel
  cpu family: 6
  model : 23
  model name: Intel(R) Core(TM)2 Duo CPU P8400  @ 2.26GHz
  stepping  : 6
  microcode : 0x610

Judging from what is being discussed in the Arch forums, it does seem
to related to the CPU having unstable TSC and transitioning to another
clock source.  Workarounds that seem to be reliable are either booting
with clocksource= or with nosmp.

One person did point out that the commit that introduced the kthread
did so to remove a deadlock - is the circular locking dependency
mentioned in that commit still relevant?

commit 01548f4d3e8e94caf323a4f664eb347fd34a34ab
Author: Martin Schwidefsky 
Date:   Tue Aug 18 17:09:42 2009 +0200

clocksource: Avoid clocksource watchdog circular locking dependency

stop_machine from a multithreaded workqueue is not allowed because
of a circular locking dependency between cpu_down and the workqueue
execution. Use a kernel thread to do the clocksource downgrade.

Signed-off-by: Martin Schwidefsky 
Cc: Peter Zijlstra 
Cc: john stultz 
LKML-Reference: <20090818170942.3ab80c91@skybase>
Signed-off-by: Thomas Gleixner 

Thanks,
Kevin.


Re: REGRESSION: boot stalls on several old dual core Intel CPUs

2018-08-31 Thread Kevin Shanahan
On Thu, Aug 30, 2018 at 03:04:39PM +0200, Peter Zijlstra wrote:
> On Thu, Aug 30, 2018 at 12:55:30PM +0200, Siegfried Metz wrote:
> > Dear kernel developers,
> > 
> > since mainline kernel 4.18 (up to the latest mainline kernel 4.18.5)
> > Intel Core 2 Duo processors are affected by boot stalling early in the
> > boot process. As it is so early there is no dmesg output (or any log).
> > 
> > A few users in the Arch Linux community used git bisect and tracked the
> > issue down to this the bad commit:
> > 7197e77abcb65a71d0b21d67beb24f153a96055e clocksource: Remove kthread
> 
> I just dug out my core2duo laptop (Lenovo T500) and build a tip/master
> kernel for it (x86_64 debian distro .config).
> 
> Seems to boot just fine.. 3/3 so far.
> 
> Any other clues?

One additional data point, my affected system is a Dell Latitude E6400
laptop which has a P8400 CPU:

  vendor_id : GenuineIntel
  cpu family: 6
  model : 23
  model name: Intel(R) Core(TM)2 Duo CPU P8400  @ 2.26GHz
  stepping  : 6
  microcode : 0x610

Judging from what is being discussed in the Arch forums, it does seem
to related to the CPU having unstable TSC and transitioning to another
clock source.  Workarounds that seem to be reliable are either booting
with clocksource= or with nosmp.

One person did point out that the commit that introduced the kthread
did so to remove a deadlock - is the circular locking dependency
mentioned in that commit still relevant?

commit 01548f4d3e8e94caf323a4f664eb347fd34a34ab
Author: Martin Schwidefsky 
Date:   Tue Aug 18 17:09:42 2009 +0200

clocksource: Avoid clocksource watchdog circular locking dependency

stop_machine from a multithreaded workqueue is not allowed because
of a circular locking dependency between cpu_down and the workqueue
execution. Use a kernel thread to do the clocksource downgrade.

Signed-off-by: Martin Schwidefsky 
Cc: Peter Zijlstra 
Cc: john stultz 
LKML-Reference: <20090818170942.3ab80c91@skybase>
Signed-off-by: Thomas Gleixner 

Thanks,
Kevin.


[GIT PULL] clk fixes for v4.19-rc1

2018-08-31 Thread sboyd
From: Stephen Boyd 

The following changes since commit 5b394b2ddf0347bef56e50c69a58773c94343ff3:

  Linux 4.19-rc1 (2018-08-26 14:11:59 -0700)

are available in the Git repository at:

  https://git.kernel.org/pub/scm/linux/kernel/git/clk/linux.git 
tags/clk-fixes-for-linus

for you to fetch changes up to bded6c03e398dc6e862dc8301fb9a60175740653:

  clk: x86: Set default parent to 48Mhz (2018-08-30 14:47:41 -0700)


Two small fixes, one for the x86 Stoney SoC to get a more accurate clk
frequency and the other to fix a bad allocation in the Nuvoton NPCM7XX
driver.


Akshu Agrawal (1):
  clk: x86: Set default parent to 48Mhz

Gustavo A. R. Silva (1):
  clk: npcm7xx: fix memory allocation

 drivers/clk/clk-npcm7xx.c | 4 ++--
 drivers/clk/x86/clk-st.c  | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

-- 
Sent by a computer through tubes


[GIT PULL] clk fixes for v4.19-rc1

2018-08-31 Thread sboyd
From: Stephen Boyd 

The following changes since commit 5b394b2ddf0347bef56e50c69a58773c94343ff3:

  Linux 4.19-rc1 (2018-08-26 14:11:59 -0700)

are available in the Git repository at:

  https://git.kernel.org/pub/scm/linux/kernel/git/clk/linux.git 
tags/clk-fixes-for-linus

for you to fetch changes up to bded6c03e398dc6e862dc8301fb9a60175740653:

  clk: x86: Set default parent to 48Mhz (2018-08-30 14:47:41 -0700)


Two small fixes, one for the x86 Stoney SoC to get a more accurate clk
frequency and the other to fix a bad allocation in the Nuvoton NPCM7XX
driver.


Akshu Agrawal (1):
  clk: x86: Set default parent to 48Mhz

Gustavo A. R. Silva (1):
  clk: npcm7xx: fix memory allocation

 drivers/clk/clk-npcm7xx.c | 4 ++--
 drivers/clk/x86/clk-st.c  | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

-- 
Sent by a computer through tubes


[PATCH v3] x86/vdso: Handle clock_gettime(CLOCK_TAI) in vDSO

2018-08-31 Thread Matt Rickard
Process clock_gettime(CLOCK_TAI) in vDSO.
This makes the call about as fast as CLOCK_REALTIME and CLOCK_MONOTONIC:

  nanoseconds
 before after clockname
    - -
23387 CLOCK_TAI
 9693 CLOCK_REALTIME
 8887 CLOCK_MONOTONIC

Signed-off-by: Matt Rickard 
---
 arch/x86/entry/vdso/vclock_gettime.c| 25 +
 arch/x86/entry/vsyscall/vsyscall_gtod.c |  2 ++
 arch/x86/include/asm/vgtod.h|  1 +
 3 files changed, 28 insertions(+)

diff --git a/arch/x86/entry/vdso/vclock_gettime.c 
b/arch/x86/entry/vdso/vclock_gettime.c
index f19856d95c60..91ed1bb2a3bb 100644
--- a/arch/x86/entry/vdso/vclock_gettime.c
+++ b/arch/x86/entry/vdso/vclock_gettime.c
@@ -246,6 +246,27 @@ notrace static int __always_inline do_monotonic(struct 
timespec *ts)
return mode;
 }
 
+notrace static int __always_inline do_tai(struct timespec *ts)
+{
+   unsigned long seq;
+   u64 ns;
+   int mode;
+
+   do {
+   seq = gtod_read_begin(gtod);
+   mode = gtod->vclock_mode;
+   ts->tv_sec = gtod->tai_time_sec;
+   ns = gtod->wall_time_snsec;
+   ns += vgetsns();
+   ns >>= gtod->shift;
+   } while (unlikely(gtod_read_retry(gtod, seq)));
+
+   ts->tv_sec += __iter_div_u64_rem(ns, NSEC_PER_SEC, );
+   ts->tv_nsec = ns;
+
+   return mode;
+}
+
 notrace static void do_realtime_coarse(struct timespec *ts)
 {
unsigned long seq;
@@ -277,6 +298,10 @@ notrace int __vdso_clock_gettime(clockid_t clock, struct 
timespec *ts)
if (do_monotonic(ts) == VCLOCK_NONE)
goto fallback;
break;
+   case CLOCK_TAI:
+   if (do_tai(ts) == VCLOCK_NONE)
+   goto fallback;
+   break;
case CLOCK_REALTIME_COARSE:
do_realtime_coarse(ts);
break;
diff --git a/arch/x86/entry/vsyscall/vsyscall_gtod.c 
b/arch/x86/entry/vsyscall/vsyscall_gtod.c
index e1216dd95c04..d61392fe17f6 100644
--- a/arch/x86/entry/vsyscall/vsyscall_gtod.c
+++ b/arch/x86/entry/vsyscall/vsyscall_gtod.c
@@ -53,6 +53,8 @@ void update_vsyscall(struct timekeeper *tk)
vdata->monotonic_time_snsec = tk->tkr_mono.xtime_nsec
+ ((u64)tk->wall_to_monotonic.tv_nsec
<< tk->tkr_mono.shift);
+   vdata->tai_time_sec = tk->xtime_sec
+   + tk->tai_offset;
while (vdata->monotonic_time_snsec >=
(((u64)NSEC_PER_SEC) << 
tk->tkr_mono.shift)) {
vdata->monotonic_time_snsec -=
diff --git a/arch/x86/include/asm/vgtod.h b/arch/x86/include/asm/vgtod.h
index fb856c9f0449..adc9f7b20b9c 100644
--- a/arch/x86/include/asm/vgtod.h
+++ b/arch/x86/include/asm/vgtod.h
@@ -32,6 +32,7 @@ struct vsyscall_gtod_data {
gtod_long_t wall_time_coarse_nsec;
gtod_long_t monotonic_time_coarse_sec;
gtod_long_t monotonic_time_coarse_nsec;
+   gtod_long_t tai_time_sec;
 
int tz_minuteswest;
int tz_dsttime;


[PATCH v3] x86/vdso: Handle clock_gettime(CLOCK_TAI) in vDSO

2018-08-31 Thread Matt Rickard
Process clock_gettime(CLOCK_TAI) in vDSO.
This makes the call about as fast as CLOCK_REALTIME and CLOCK_MONOTONIC:

  nanoseconds
 before after clockname
    - -
23387 CLOCK_TAI
 9693 CLOCK_REALTIME
 8887 CLOCK_MONOTONIC

Signed-off-by: Matt Rickard 
---
 arch/x86/entry/vdso/vclock_gettime.c| 25 +
 arch/x86/entry/vsyscall/vsyscall_gtod.c |  2 ++
 arch/x86/include/asm/vgtod.h|  1 +
 3 files changed, 28 insertions(+)

diff --git a/arch/x86/entry/vdso/vclock_gettime.c 
b/arch/x86/entry/vdso/vclock_gettime.c
index f19856d95c60..91ed1bb2a3bb 100644
--- a/arch/x86/entry/vdso/vclock_gettime.c
+++ b/arch/x86/entry/vdso/vclock_gettime.c
@@ -246,6 +246,27 @@ notrace static int __always_inline do_monotonic(struct 
timespec *ts)
return mode;
 }
 
+notrace static int __always_inline do_tai(struct timespec *ts)
+{
+   unsigned long seq;
+   u64 ns;
+   int mode;
+
+   do {
+   seq = gtod_read_begin(gtod);
+   mode = gtod->vclock_mode;
+   ts->tv_sec = gtod->tai_time_sec;
+   ns = gtod->wall_time_snsec;
+   ns += vgetsns();
+   ns >>= gtod->shift;
+   } while (unlikely(gtod_read_retry(gtod, seq)));
+
+   ts->tv_sec += __iter_div_u64_rem(ns, NSEC_PER_SEC, );
+   ts->tv_nsec = ns;
+
+   return mode;
+}
+
 notrace static void do_realtime_coarse(struct timespec *ts)
 {
unsigned long seq;
@@ -277,6 +298,10 @@ notrace int __vdso_clock_gettime(clockid_t clock, struct 
timespec *ts)
if (do_monotonic(ts) == VCLOCK_NONE)
goto fallback;
break;
+   case CLOCK_TAI:
+   if (do_tai(ts) == VCLOCK_NONE)
+   goto fallback;
+   break;
case CLOCK_REALTIME_COARSE:
do_realtime_coarse(ts);
break;
diff --git a/arch/x86/entry/vsyscall/vsyscall_gtod.c 
b/arch/x86/entry/vsyscall/vsyscall_gtod.c
index e1216dd95c04..d61392fe17f6 100644
--- a/arch/x86/entry/vsyscall/vsyscall_gtod.c
+++ b/arch/x86/entry/vsyscall/vsyscall_gtod.c
@@ -53,6 +53,8 @@ void update_vsyscall(struct timekeeper *tk)
vdata->monotonic_time_snsec = tk->tkr_mono.xtime_nsec
+ ((u64)tk->wall_to_monotonic.tv_nsec
<< tk->tkr_mono.shift);
+   vdata->tai_time_sec = tk->xtime_sec
+   + tk->tai_offset;
while (vdata->monotonic_time_snsec >=
(((u64)NSEC_PER_SEC) << 
tk->tkr_mono.shift)) {
vdata->monotonic_time_snsec -=
diff --git a/arch/x86/include/asm/vgtod.h b/arch/x86/include/asm/vgtod.h
index fb856c9f0449..adc9f7b20b9c 100644
--- a/arch/x86/include/asm/vgtod.h
+++ b/arch/x86/include/asm/vgtod.h
@@ -32,6 +32,7 @@ struct vsyscall_gtod_data {
gtod_long_t wall_time_coarse_nsec;
gtod_long_t monotonic_time_coarse_sec;
gtod_long_t monotonic_time_coarse_nsec;
+   gtod_long_t tai_time_sec;
 
int tz_minuteswest;
int tz_dsttime;


Re: [PATCH] mm: slowly shrink slabs with a relatively small number of objects

2018-08-31 Thread Rik van Riel
On Fri, 2018-08-31 at 14:31 -0700, Roman Gushchin wrote:
> On Fri, Aug 31, 2018 at 05:15:39PM -0400, Rik van Riel wrote:
> > On Fri, 2018-08-31 at 13:34 -0700, Roman Gushchin wrote:
> > 
> > > diff --git a/mm/vmscan.c b/mm/vmscan.c
> > > index fa2c150ab7b9..c910cf6bf606 100644
> > > --- a/mm/vmscan.c
> > > +++ b/mm/vmscan.c
> > > @@ -476,6 +476,10 @@ static unsigned long do_shrink_slab(struct
> > > shrink_control *shrinkctl,
> > >   delta = freeable >> priority;
> > >   delta *= 4;
> > >   do_div(delta, shrinker->seeks);
> > > +
> > > + if (delta == 0 && freeable > 0)
> > > + delta = min(freeable, batch_size);
> > > +
> > >   total_scan += delta;
> > >   if (total_scan < 0) {
> > >   pr_err("shrink_slab: %pF negative objects to delete
> > > nr=%ld\n",
> > 
> > I agree that we need to shrink slabs with fewer than
> > 4096 objects, but do we want to put more pressure on
> > a slab the moment it drops below 4096 than we applied
> > when it had just over 4096 objects on it?
> > 
> > With this patch, a slab with 5000 objects on it will
> > get 1 item scanned, while a slab with 4000 objects on
> > it will see shrinker->batch or SHRINK_BATCH objects
> > scanned every time.
> > 
> > I don't know if this would cause any issues, just
> > something to ponder.
> 
> Hm, fair enough. So, basically we can always do
> 
> delta = max(delta, min(freeable, batch_size));
> 
> Does it look better?

Yeah, that looks fine to me.

That will read to small cgroups having small caches
reclaimed relatively more quickly than large caches
getting reclaimed, but small caches should also be
faster to refill once they are needed again, so it
is probably fine.

-- 
All Rights Reversed.


signature.asc
Description: This is a digitally signed message part


Re: [PATCH] mm: slowly shrink slabs with a relatively small number of objects

2018-08-31 Thread Rik van Riel
On Fri, 2018-08-31 at 14:31 -0700, Roman Gushchin wrote:
> On Fri, Aug 31, 2018 at 05:15:39PM -0400, Rik van Riel wrote:
> > On Fri, 2018-08-31 at 13:34 -0700, Roman Gushchin wrote:
> > 
> > > diff --git a/mm/vmscan.c b/mm/vmscan.c
> > > index fa2c150ab7b9..c910cf6bf606 100644
> > > --- a/mm/vmscan.c
> > > +++ b/mm/vmscan.c
> > > @@ -476,6 +476,10 @@ static unsigned long do_shrink_slab(struct
> > > shrink_control *shrinkctl,
> > >   delta = freeable >> priority;
> > >   delta *= 4;
> > >   do_div(delta, shrinker->seeks);
> > > +
> > > + if (delta == 0 && freeable > 0)
> > > + delta = min(freeable, batch_size);
> > > +
> > >   total_scan += delta;
> > >   if (total_scan < 0) {
> > >   pr_err("shrink_slab: %pF negative objects to delete
> > > nr=%ld\n",
> > 
> > I agree that we need to shrink slabs with fewer than
> > 4096 objects, but do we want to put more pressure on
> > a slab the moment it drops below 4096 than we applied
> > when it had just over 4096 objects on it?
> > 
> > With this patch, a slab with 5000 objects on it will
> > get 1 item scanned, while a slab with 4000 objects on
> > it will see shrinker->batch or SHRINK_BATCH objects
> > scanned every time.
> > 
> > I don't know if this would cause any issues, just
> > something to ponder.
> 
> Hm, fair enough. So, basically we can always do
> 
> delta = max(delta, min(freeable, batch_size));
> 
> Does it look better?

Yeah, that looks fine to me.

That will read to small cgroups having small caches
reclaimed relatively more quickly than large caches
getting reclaimed, but small caches should also be
faster to refill once they are needed again, so it
is probably fine.

-- 
All Rights Reversed.


signature.asc
Description: This is a digitally signed message part


Re: [PATCH 1/3] ARM: dts: qcom: Add SPMI PMIC Arbiter nodes for APQ8084 and MSM8974

2018-08-31 Thread Frank Rowand
On 08/31/18 16:01, Bjorn Andersson wrote:
> On Fri 31 Aug 15:46 PDT 2018, Frank Rowand wrote:
>>> +   spmi_bus: spmi@fc4cf000 {
>>> +   compatible = "qcom,spmi-pmic-arb";
>>> +   reg-names = "core", "intr", "cnfg";
>>> +   reg = <0xfc4cf000 0x1000>,
>>> + <0xfc4cb000 0x1000>,
>>> + <0xfc4ca000 0x1000>;
>>> +   interrupt-names = "periph_irq";
>>
>>> +   interrupts = <0 190 0>;
>>
>> The final value in this interrupts property means IRQ_TYPE_NONE.
>>
>> A WARN_ON() was added early this year to complain about use of
>> IRQ_TYPE_NONE: 83a86fbb5b56 "irqchip/gic: Loudly complain about
>> the use of IRQ_TYPE_NONE", resulting in many warnings spewing
>> forth when I boot an APQ8074 Dragonboard.  I am trying to
>> determine whether the warning is overly aggressive, or whether
>> the IRQ TYPE is incorrectly specified for the spmi node.
>>
>> The interrupt-parent for the spmi node is intc: 
>> interrupt-controller@f900,
>> which has compatible = "qcom,msm-qgic2".  I do not know the architecture
>> or implementation of this interrupt controller.  Is an IRQ_TYPE_NONE
>> valid in this case, or should a specific type be provided?
>>
> 
> No, IRQ_TYPE_NONE isn't valid and the WARN_ON() is reasonable.
> 
> Please change it to IRQ_TYPE_LEVEL_HIGH. And while you're at it, replace
> the first 0 with GIC_SPI.
> 
> 
> If you have more of these warnings you can most likely look at e.g.
> msm8916 (arm64) to find the right flags.

Thanks, I'll create a patch.


Re: [PATCH 1/3] ARM: dts: qcom: Add SPMI PMIC Arbiter nodes for APQ8084 and MSM8974

2018-08-31 Thread Frank Rowand
On 08/31/18 16:01, Bjorn Andersson wrote:
> On Fri 31 Aug 15:46 PDT 2018, Frank Rowand wrote:
>>> +   spmi_bus: spmi@fc4cf000 {
>>> +   compatible = "qcom,spmi-pmic-arb";
>>> +   reg-names = "core", "intr", "cnfg";
>>> +   reg = <0xfc4cf000 0x1000>,
>>> + <0xfc4cb000 0x1000>,
>>> + <0xfc4ca000 0x1000>;
>>> +   interrupt-names = "periph_irq";
>>
>>> +   interrupts = <0 190 0>;
>>
>> The final value in this interrupts property means IRQ_TYPE_NONE.
>>
>> A WARN_ON() was added early this year to complain about use of
>> IRQ_TYPE_NONE: 83a86fbb5b56 "irqchip/gic: Loudly complain about
>> the use of IRQ_TYPE_NONE", resulting in many warnings spewing
>> forth when I boot an APQ8074 Dragonboard.  I am trying to
>> determine whether the warning is overly aggressive, or whether
>> the IRQ TYPE is incorrectly specified for the spmi node.
>>
>> The interrupt-parent for the spmi node is intc: 
>> interrupt-controller@f900,
>> which has compatible = "qcom,msm-qgic2".  I do not know the architecture
>> or implementation of this interrupt controller.  Is an IRQ_TYPE_NONE
>> valid in this case, or should a specific type be provided?
>>
> 
> No, IRQ_TYPE_NONE isn't valid and the WARN_ON() is reasonable.
> 
> Please change it to IRQ_TYPE_LEVEL_HIGH. And while you're at it, replace
> the first 0 with GIC_SPI.
> 
> 
> If you have more of these warnings you can most likely look at e.g.
> msm8916 (arm64) to find the right flags.

Thanks, I'll create a patch.


Re: [PATCH 0/4] of: Convert to using %pOFn for node name printf

2018-08-31 Thread Frank Rowand
On 08/28/18 08:52, Rob Herring wrote:
> This is the DT portion of converting node name printf's to use the 
> %pOFn format specifier rather than device_node.name. Patches for other 
> subsystems are independent and have been sent separately.
> 
> Rob
> 
> Rob Herring (4):
>   of/unittest: remove use of node name pointer in overlay high level
> test
>   of/unittest: add printf tests for node name
>   of: Convert to using %pOFn instead of device_node.name
>   vsprintf: print OF node name using full_name
> 
>  drivers/of/device.c   |  4 ++--
>  drivers/of/of_mdio.c  | 12 ++--
>  drivers/of/of_numa.c  |  4 ++--
>  drivers/of/overlay.c  |  4 ++--
>  drivers/of/platform.c |  8 
>  drivers/of/unittest.c | 26 --
>  lib/vsprintf.c|  9 +++--
>  7 files changed, 39 insertions(+), 28 deletions(-)
> 


Reviewed-by: Frank Rowand 


Re: [PATCH 0/4] of: Convert to using %pOFn for node name printf

2018-08-31 Thread Frank Rowand
On 08/28/18 08:52, Rob Herring wrote:
> This is the DT portion of converting node name printf's to use the 
> %pOFn format specifier rather than device_node.name. Patches for other 
> subsystems are independent and have been sent separately.
> 
> Rob
> 
> Rob Herring (4):
>   of/unittest: remove use of node name pointer in overlay high level
> test
>   of/unittest: add printf tests for node name
>   of: Convert to using %pOFn instead of device_node.name
>   vsprintf: print OF node name using full_name
> 
>  drivers/of/device.c   |  4 ++--
>  drivers/of/of_mdio.c  | 12 ++--
>  drivers/of/of_numa.c  |  4 ++--
>  drivers/of/overlay.c  |  4 ++--
>  drivers/of/platform.c |  8 
>  drivers/of/unittest.c | 26 --
>  lib/vsprintf.c|  9 +++--
>  7 files changed, 39 insertions(+), 28 deletions(-)
> 


Reviewed-by: Frank Rowand 


[PATCH 0/3] regmap: split regmap_config.use_single_rw

2018-08-31 Thread David Frey
This patch series splits regmap_config.use_single_rw into
use_single_read and use_single_write.

Motivation:
When multiple sequential registers need to be read or written, the
author can either choose to call regmap_bulk_read/write() once or call
regmap_read/write() repeatedly. The _bulk option has the advantages of
being more compact since only one function call is needed and more
efficient since multiple registers are read/written at once instead of
having to pay for transaction and addressing overhead of the underlying
transport multiple times.

Many chips don't support bulk access, but it's still convenient to be
able to read/write multiple registers with a single function call. This
is what use_single_rw=true is for. When this option is set, bulk
reads/writes are automatically split into a series of single register
accesses.

Some other chips (for example the Bosch bmi160 IMU) support bulk reads,
but not bulk writes. Currently for chips like this, the author must
choose between convenience or efficiency by setting use_single_rw =
true/false respectively.

Proposal:
In this patch series I split the use_single_rw member of struct
regmap_config into use_single_read and use_single_write. This change is
in line with what is already implemented inside of the internal struct
regmap which is populated from struct regmap_config.

I submitted separate patches for the change that performs the split and
the update to all of the existing clients. I wasn't sure if this is the
preferred method or if it's better to combine those patches.


David Frey (3):
  regmap: fix comment for regmap.use_single_write
  regmap: split up regmap_config.use_single_rw
  regmap: update users of regmap_config.use_single_rw

 drivers/base/regmap/internal.h   |  2 +-
 drivers/base/regmap/regmap.c |  4 ++--
 drivers/edac/altera_edac.c   |  3 ++-
 drivers/hwmon/lm75.c |  3 ++-
 drivers/hwmon/lm95245.c  |  3 ++-
 drivers/hwmon/tmp102.c   |  3 ++-
 drivers/hwmon/tmp108.c   |  3 ++-
 drivers/iio/light/apds9960.c |  3 ++-
 drivers/iio/light/max44000.c | 23 ---
 drivers/iio/temperature/mlx90632.c   |  3 ++-
 drivers/input/touchscreen/tsc200x-core.c |  3 ++-
 drivers/mfd/altera-a10sr.c   |  3 ++-
 drivers/mfd/da9052-spi.c |  3 ++-
 drivers/mfd/mc13xxx-spi.c|  3 ++-
 drivers/mfd/twl6040.c|  3 ++-
 drivers/regulator/ltc3589.c  |  3 ++-
 drivers/regulator/ltc3676.c  |  3 ++-
 include/linux/regmap.h   | 12 
 sound/hda/hdac_regmap.c  |  3 ++-
 sound/soc/codecs/cs35l33.c   |  3 ++-
 sound/soc/codecs/cs35l35.c   |  3 ++-
 sound/soc/codecs/cs43130.c   |  4 +++-
 sound/soc/codecs/es8328.c|  3 ++-
 sound/soc/codecs/rt1305.c|  3 ++-
 sound/soc/codecs/rt5514.c|  3 ++-
 sound/soc/codecs/rt5616.c|  3 ++-
 sound/soc/codecs/rt5640.c|  3 ++-
 sound/soc/codecs/rt5645.c|  9 ++---
 sound/soc/codecs/rt5651.c|  3 ++-
 sound/soc/codecs/rt5660.c|  3 ++-
 sound/soc/codecs/rt5663.c|  9 ++---
 sound/soc/codecs/rt5665.c|  3 ++-
 sound/soc/codecs/rt5668.c|  3 ++-
 sound/soc/codecs/rt5670.c|  3 ++-
 sound/soc/codecs/rt5682.c|  3 ++-
 35 files changed, 94 insertions(+), 53 deletions(-)

-- 
2.11.0



[PATCH 1/3] regmap: fix comment for regmap.use_single_write

2018-08-31 Thread David Frey
Signed-off-by: David Frey 
---
 drivers/base/regmap/internal.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/base/regmap/internal.h b/drivers/base/regmap/internal.h
index a6bf34d6394e..16414ccace96 100644
--- a/drivers/base/regmap/internal.h
+++ b/drivers/base/regmap/internal.h
@@ -149,7 +149,7 @@ struct regmap {
 
/* if set, converts bulk read to single read */
bool use_single_read;
-   /* if set, converts bulk read to single read */
+   /* if set, converts bulk write to single write */
bool use_single_write;
/* if set, the device supports multi write mode */
bool can_multi_write;
-- 
2.11.0



[PATCH 2/3] regmap: split up regmap_config.use_single_rw

2018-08-31 Thread David Frey
Split regmap_config.use_single_rw into use_single_read and
use_single_write. This change enables drivers of devices which only
support bulk operations in one direction to use the regmap_bulk_*()
functions for both directions and have their bulk operation split into
single operations only when necessary.

Signed-off-by: David Frey 
---
 drivers/base/regmap/regmap.c |  4 ++--
 include/linux/regmap.h   | 12 
 2 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c
index 0360a90ad6b6..78a778c08f92 100644
--- a/drivers/base/regmap/regmap.c
+++ b/drivers/base/regmap/regmap.c
@@ -762,8 +762,8 @@ struct regmap *__regmap_init(struct device *dev,
map->reg_stride_order = ilog2(map->reg_stride);
else
map->reg_stride_order = -1;
-   map->use_single_read = config->use_single_rw || !bus || !bus->read;
-   map->use_single_write = config->use_single_rw || !bus || !bus->write;
+   map->use_single_read = config->use_single_read || !bus || !bus->read;
+   map->use_single_write = config->use_single_write || !bus || !bus->write;
map->can_multi_write = config->can_multi_write && bus && bus->write;
if (bus) {
map->max_raw_read = bus->max_raw_read;
diff --git a/include/linux/regmap.h b/include/linux/regmap.h
index 379505a53722..6ea9bf9377cb 100644
--- a/include/linux/regmap.h
+++ b/include/linux/regmap.h
@@ -315,9 +315,12 @@ typedef void (*regmap_unlock)(void *);
  *   masks are used.
  * @zero_flag_mask: If set, read_flag_mask and write_flag_mask are used even
  *   if they are both empty.
- * @use_single_rw: If set, converts the bulk read and write operations into
- * a series of single read and write operations. This is useful
- * for device that does not support bulk read and write.
+ * @use_single_read: If set, converts the bulk read operation into a series of
+ *   single read operations. This is useful for a device that
+ *   does not support  bulk read.
+ * @use_single_write: If set, converts the bulk write operation into a series 
of
+ *single write operations. This is useful for a device that
+ *does not support bulk write.
  * @can_multi_write: If set, the device supports the multi write mode of bulk
  *   write operations, if clear multi write requests will be
  *   split into individual write operations
@@ -380,7 +383,8 @@ struct regmap_config {
unsigned long write_flag_mask;
bool zero_flag_mask;
 
-   bool use_single_rw;
+   bool use_single_read;
+   bool use_single_write;
bool can_multi_write;
 
enum regmap_endian reg_format_endian;
-- 
2.11.0



[PATCH 3/3] regmap: update users of regmap_config.use_single_rw

2018-08-31 Thread David Frey
Update all struct regmap_config instances where the use_single_rw member
was set to instead set both use_single_read and use_single_write. No
attempt was made to evaluate whether it is possible to set only one of
use_single_read or use_single_write.

Signed-off-by: David Frey 
---
 drivers/edac/altera_edac.c   |  3 ++-
 drivers/hwmon/lm75.c |  3 ++-
 drivers/hwmon/lm95245.c  |  3 ++-
 drivers/hwmon/tmp102.c   |  3 ++-
 drivers/hwmon/tmp108.c   |  3 ++-
 drivers/iio/light/apds9960.c |  3 ++-
 drivers/iio/light/max44000.c | 23 ---
 drivers/iio/temperature/mlx90632.c   |  3 ++-
 drivers/input/touchscreen/tsc200x-core.c |  3 ++-
 drivers/mfd/altera-a10sr.c   |  3 ++-
 drivers/mfd/da9052-spi.c |  3 ++-
 drivers/mfd/mc13xxx-spi.c|  3 ++-
 drivers/mfd/twl6040.c|  3 ++-
 drivers/regulator/ltc3589.c  |  3 ++-
 drivers/regulator/ltc3676.c  |  3 ++-
 sound/hda/hdac_regmap.c  |  3 ++-
 sound/soc/codecs/cs35l33.c   |  3 ++-
 sound/soc/codecs/cs35l35.c   |  3 ++-
 sound/soc/codecs/cs43130.c   |  4 +++-
 sound/soc/codecs/es8328.c|  3 ++-
 sound/soc/codecs/rt1305.c|  3 ++-
 sound/soc/codecs/rt5514.c|  3 ++-
 sound/soc/codecs/rt5616.c|  3 ++-
 sound/soc/codecs/rt5640.c|  3 ++-
 sound/soc/codecs/rt5645.c|  9 ++---
 sound/soc/codecs/rt5651.c|  3 ++-
 sound/soc/codecs/rt5660.c|  3 ++-
 sound/soc/codecs/rt5663.c|  9 ++---
 sound/soc/codecs/rt5665.c|  3 ++-
 sound/soc/codecs/rt5668.c|  3 ++-
 sound/soc/codecs/rt5670.c|  3 ++-
 sound/soc/codecs/rt5682.c|  3 ++-
 32 files changed, 83 insertions(+), 46 deletions(-)

diff --git a/drivers/edac/altera_edac.c b/drivers/edac/altera_edac.c
index 5762c3c383f2..ab7c5a937ab0 100644
--- a/drivers/edac/altera_edac.c
+++ b/drivers/edac/altera_edac.c
@@ -599,7 +599,8 @@ static const struct regmap_config s10_sdram_regmap_cfg = {
.volatile_reg = s10_sdram_volatile_reg,
.reg_read = s10_protected_reg_read,
.reg_write = s10_protected_reg_write,
-   .use_single_rw = true,
+   .use_single_read = true,
+   .use_single_write = true,
 };
 
 static int altr_s10_sdram_probe(struct platform_device *pdev)
diff --git a/drivers/hwmon/lm75.c b/drivers/hwmon/lm75.c
index 49f4b33a5685..542dc4058831 100644
--- a/drivers/hwmon/lm75.c
+++ b/drivers/hwmon/lm75.c
@@ -254,7 +254,8 @@ static const struct regmap_config lm75_regmap_config = {
.volatile_reg = lm75_is_volatile_reg,
.val_format_endian = REGMAP_ENDIAN_BIG,
.cache_type = REGCACHE_RBTREE,
-   .use_single_rw = true,
+   .use_single_read = true,
+   .use_single_write = true,
 };
 
 static void lm75_remove(void *data)
diff --git a/drivers/hwmon/lm95245.c b/drivers/hwmon/lm95245.c
index 27cb06d65594..996b50246175 100644
--- a/drivers/hwmon/lm95245.c
+++ b/drivers/hwmon/lm95245.c
@@ -541,7 +541,8 @@ static const struct regmap_config lm95245_regmap_config = {
.writeable_reg = lm95245_is_writeable_reg,
.volatile_reg = lm95245_is_volatile_reg,
.cache_type = REGCACHE_RBTREE,
-   .use_single_rw = true,
+   .use_single_read = true,
+   .use_single_write = true,
 };
 
 static const u32 lm95245_chip_config[] = {
diff --git a/drivers/hwmon/tmp102.c b/drivers/hwmon/tmp102.c
index dfc40c740d07..6778283e36f9 100644
--- a/drivers/hwmon/tmp102.c
+++ b/drivers/hwmon/tmp102.c
@@ -212,7 +212,8 @@ static const struct regmap_config tmp102_regmap_config = {
.volatile_reg = tmp102_is_volatile_reg,
.val_format_endian = REGMAP_ENDIAN_BIG,
.cache_type = REGCACHE_RBTREE,
-   .use_single_rw = true,
+   .use_single_read = true,
+   .use_single_write = true,
 };
 
 static int tmp102_probe(struct i2c_client *client,
diff --git a/drivers/hwmon/tmp108.c b/drivers/hwmon/tmp108.c
index 91bb94639286..429bfeae4ca8 100644
--- a/drivers/hwmon/tmp108.c
+++ b/drivers/hwmon/tmp108.c
@@ -345,7 +345,8 @@ static const struct regmap_config tmp108_regmap_config = {
.volatile_reg = tmp108_is_volatile_reg,
.val_format_endian = REGMAP_ENDIAN_BIG,
.cache_type = REGCACHE_RBTREE,
-   .use_single_rw = true,
+   .use_single_read = true,
+   .use_single_write = true,
 };
 
 static int tmp108_probe(struct i2c_client *client,
diff --git a/drivers/iio/light/apds9960.c b/drivers/iio/light/apds9960.c
index 1f112ae15f3c..b09b8b60bd83 100644
--- a/drivers/iio/light/apds9960.c
+++ b/drivers/iio/light/apds9960.c
@@ -206,7 +206,8 @@ static const struct regmap_config apds9960_regmap_config = {
.name = APDS9960_REGMAP_NAME,
.reg_bits = 8,
.val_bits = 8,

[PATCH 0/3] regmap: split regmap_config.use_single_rw

2018-08-31 Thread David Frey
This patch series splits regmap_config.use_single_rw into
use_single_read and use_single_write.

Motivation:
When multiple sequential registers need to be read or written, the
author can either choose to call regmap_bulk_read/write() once or call
regmap_read/write() repeatedly. The _bulk option has the advantages of
being more compact since only one function call is needed and more
efficient since multiple registers are read/written at once instead of
having to pay for transaction and addressing overhead of the underlying
transport multiple times.

Many chips don't support bulk access, but it's still convenient to be
able to read/write multiple registers with a single function call. This
is what use_single_rw=true is for. When this option is set, bulk
reads/writes are automatically split into a series of single register
accesses.

Some other chips (for example the Bosch bmi160 IMU) support bulk reads,
but not bulk writes. Currently for chips like this, the author must
choose between convenience or efficiency by setting use_single_rw =
true/false respectively.

Proposal:
In this patch series I split the use_single_rw member of struct
regmap_config into use_single_read and use_single_write. This change is
in line with what is already implemented inside of the internal struct
regmap which is populated from struct regmap_config.

I submitted separate patches for the change that performs the split and
the update to all of the existing clients. I wasn't sure if this is the
preferred method or if it's better to combine those patches.


David Frey (3):
  regmap: fix comment for regmap.use_single_write
  regmap: split up regmap_config.use_single_rw
  regmap: update users of regmap_config.use_single_rw

 drivers/base/regmap/internal.h   |  2 +-
 drivers/base/regmap/regmap.c |  4 ++--
 drivers/edac/altera_edac.c   |  3 ++-
 drivers/hwmon/lm75.c |  3 ++-
 drivers/hwmon/lm95245.c  |  3 ++-
 drivers/hwmon/tmp102.c   |  3 ++-
 drivers/hwmon/tmp108.c   |  3 ++-
 drivers/iio/light/apds9960.c |  3 ++-
 drivers/iio/light/max44000.c | 23 ---
 drivers/iio/temperature/mlx90632.c   |  3 ++-
 drivers/input/touchscreen/tsc200x-core.c |  3 ++-
 drivers/mfd/altera-a10sr.c   |  3 ++-
 drivers/mfd/da9052-spi.c |  3 ++-
 drivers/mfd/mc13xxx-spi.c|  3 ++-
 drivers/mfd/twl6040.c|  3 ++-
 drivers/regulator/ltc3589.c  |  3 ++-
 drivers/regulator/ltc3676.c  |  3 ++-
 include/linux/regmap.h   | 12 
 sound/hda/hdac_regmap.c  |  3 ++-
 sound/soc/codecs/cs35l33.c   |  3 ++-
 sound/soc/codecs/cs35l35.c   |  3 ++-
 sound/soc/codecs/cs43130.c   |  4 +++-
 sound/soc/codecs/es8328.c|  3 ++-
 sound/soc/codecs/rt1305.c|  3 ++-
 sound/soc/codecs/rt5514.c|  3 ++-
 sound/soc/codecs/rt5616.c|  3 ++-
 sound/soc/codecs/rt5640.c|  3 ++-
 sound/soc/codecs/rt5645.c|  9 ++---
 sound/soc/codecs/rt5651.c|  3 ++-
 sound/soc/codecs/rt5660.c|  3 ++-
 sound/soc/codecs/rt5663.c|  9 ++---
 sound/soc/codecs/rt5665.c|  3 ++-
 sound/soc/codecs/rt5668.c|  3 ++-
 sound/soc/codecs/rt5670.c|  3 ++-
 sound/soc/codecs/rt5682.c|  3 ++-
 35 files changed, 94 insertions(+), 53 deletions(-)

-- 
2.11.0



[PATCH 1/3] regmap: fix comment for regmap.use_single_write

2018-08-31 Thread David Frey
Signed-off-by: David Frey 
---
 drivers/base/regmap/internal.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/base/regmap/internal.h b/drivers/base/regmap/internal.h
index a6bf34d6394e..16414ccace96 100644
--- a/drivers/base/regmap/internal.h
+++ b/drivers/base/regmap/internal.h
@@ -149,7 +149,7 @@ struct regmap {
 
/* if set, converts bulk read to single read */
bool use_single_read;
-   /* if set, converts bulk read to single read */
+   /* if set, converts bulk write to single write */
bool use_single_write;
/* if set, the device supports multi write mode */
bool can_multi_write;
-- 
2.11.0



[PATCH 2/3] regmap: split up regmap_config.use_single_rw

2018-08-31 Thread David Frey
Split regmap_config.use_single_rw into use_single_read and
use_single_write. This change enables drivers of devices which only
support bulk operations in one direction to use the regmap_bulk_*()
functions for both directions and have their bulk operation split into
single operations only when necessary.

Signed-off-by: David Frey 
---
 drivers/base/regmap/regmap.c |  4 ++--
 include/linux/regmap.h   | 12 
 2 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c
index 0360a90ad6b6..78a778c08f92 100644
--- a/drivers/base/regmap/regmap.c
+++ b/drivers/base/regmap/regmap.c
@@ -762,8 +762,8 @@ struct regmap *__regmap_init(struct device *dev,
map->reg_stride_order = ilog2(map->reg_stride);
else
map->reg_stride_order = -1;
-   map->use_single_read = config->use_single_rw || !bus || !bus->read;
-   map->use_single_write = config->use_single_rw || !bus || !bus->write;
+   map->use_single_read = config->use_single_read || !bus || !bus->read;
+   map->use_single_write = config->use_single_write || !bus || !bus->write;
map->can_multi_write = config->can_multi_write && bus && bus->write;
if (bus) {
map->max_raw_read = bus->max_raw_read;
diff --git a/include/linux/regmap.h b/include/linux/regmap.h
index 379505a53722..6ea9bf9377cb 100644
--- a/include/linux/regmap.h
+++ b/include/linux/regmap.h
@@ -315,9 +315,12 @@ typedef void (*regmap_unlock)(void *);
  *   masks are used.
  * @zero_flag_mask: If set, read_flag_mask and write_flag_mask are used even
  *   if they are both empty.
- * @use_single_rw: If set, converts the bulk read and write operations into
- * a series of single read and write operations. This is useful
- * for device that does not support bulk read and write.
+ * @use_single_read: If set, converts the bulk read operation into a series of
+ *   single read operations. This is useful for a device that
+ *   does not support  bulk read.
+ * @use_single_write: If set, converts the bulk write operation into a series 
of
+ *single write operations. This is useful for a device that
+ *does not support bulk write.
  * @can_multi_write: If set, the device supports the multi write mode of bulk
  *   write operations, if clear multi write requests will be
  *   split into individual write operations
@@ -380,7 +383,8 @@ struct regmap_config {
unsigned long write_flag_mask;
bool zero_flag_mask;
 
-   bool use_single_rw;
+   bool use_single_read;
+   bool use_single_write;
bool can_multi_write;
 
enum regmap_endian reg_format_endian;
-- 
2.11.0



[PATCH 3/3] regmap: update users of regmap_config.use_single_rw

2018-08-31 Thread David Frey
Update all struct regmap_config instances where the use_single_rw member
was set to instead set both use_single_read and use_single_write. No
attempt was made to evaluate whether it is possible to set only one of
use_single_read or use_single_write.

Signed-off-by: David Frey 
---
 drivers/edac/altera_edac.c   |  3 ++-
 drivers/hwmon/lm75.c |  3 ++-
 drivers/hwmon/lm95245.c  |  3 ++-
 drivers/hwmon/tmp102.c   |  3 ++-
 drivers/hwmon/tmp108.c   |  3 ++-
 drivers/iio/light/apds9960.c |  3 ++-
 drivers/iio/light/max44000.c | 23 ---
 drivers/iio/temperature/mlx90632.c   |  3 ++-
 drivers/input/touchscreen/tsc200x-core.c |  3 ++-
 drivers/mfd/altera-a10sr.c   |  3 ++-
 drivers/mfd/da9052-spi.c |  3 ++-
 drivers/mfd/mc13xxx-spi.c|  3 ++-
 drivers/mfd/twl6040.c|  3 ++-
 drivers/regulator/ltc3589.c  |  3 ++-
 drivers/regulator/ltc3676.c  |  3 ++-
 sound/hda/hdac_regmap.c  |  3 ++-
 sound/soc/codecs/cs35l33.c   |  3 ++-
 sound/soc/codecs/cs35l35.c   |  3 ++-
 sound/soc/codecs/cs43130.c   |  4 +++-
 sound/soc/codecs/es8328.c|  3 ++-
 sound/soc/codecs/rt1305.c|  3 ++-
 sound/soc/codecs/rt5514.c|  3 ++-
 sound/soc/codecs/rt5616.c|  3 ++-
 sound/soc/codecs/rt5640.c|  3 ++-
 sound/soc/codecs/rt5645.c|  9 ++---
 sound/soc/codecs/rt5651.c|  3 ++-
 sound/soc/codecs/rt5660.c|  3 ++-
 sound/soc/codecs/rt5663.c|  9 ++---
 sound/soc/codecs/rt5665.c|  3 ++-
 sound/soc/codecs/rt5668.c|  3 ++-
 sound/soc/codecs/rt5670.c|  3 ++-
 sound/soc/codecs/rt5682.c|  3 ++-
 32 files changed, 83 insertions(+), 46 deletions(-)

diff --git a/drivers/edac/altera_edac.c b/drivers/edac/altera_edac.c
index 5762c3c383f2..ab7c5a937ab0 100644
--- a/drivers/edac/altera_edac.c
+++ b/drivers/edac/altera_edac.c
@@ -599,7 +599,8 @@ static const struct regmap_config s10_sdram_regmap_cfg = {
.volatile_reg = s10_sdram_volatile_reg,
.reg_read = s10_protected_reg_read,
.reg_write = s10_protected_reg_write,
-   .use_single_rw = true,
+   .use_single_read = true,
+   .use_single_write = true,
 };
 
 static int altr_s10_sdram_probe(struct platform_device *pdev)
diff --git a/drivers/hwmon/lm75.c b/drivers/hwmon/lm75.c
index 49f4b33a5685..542dc4058831 100644
--- a/drivers/hwmon/lm75.c
+++ b/drivers/hwmon/lm75.c
@@ -254,7 +254,8 @@ static const struct regmap_config lm75_regmap_config = {
.volatile_reg = lm75_is_volatile_reg,
.val_format_endian = REGMAP_ENDIAN_BIG,
.cache_type = REGCACHE_RBTREE,
-   .use_single_rw = true,
+   .use_single_read = true,
+   .use_single_write = true,
 };
 
 static void lm75_remove(void *data)
diff --git a/drivers/hwmon/lm95245.c b/drivers/hwmon/lm95245.c
index 27cb06d65594..996b50246175 100644
--- a/drivers/hwmon/lm95245.c
+++ b/drivers/hwmon/lm95245.c
@@ -541,7 +541,8 @@ static const struct regmap_config lm95245_regmap_config = {
.writeable_reg = lm95245_is_writeable_reg,
.volatile_reg = lm95245_is_volatile_reg,
.cache_type = REGCACHE_RBTREE,
-   .use_single_rw = true,
+   .use_single_read = true,
+   .use_single_write = true,
 };
 
 static const u32 lm95245_chip_config[] = {
diff --git a/drivers/hwmon/tmp102.c b/drivers/hwmon/tmp102.c
index dfc40c740d07..6778283e36f9 100644
--- a/drivers/hwmon/tmp102.c
+++ b/drivers/hwmon/tmp102.c
@@ -212,7 +212,8 @@ static const struct regmap_config tmp102_regmap_config = {
.volatile_reg = tmp102_is_volatile_reg,
.val_format_endian = REGMAP_ENDIAN_BIG,
.cache_type = REGCACHE_RBTREE,
-   .use_single_rw = true,
+   .use_single_read = true,
+   .use_single_write = true,
 };
 
 static int tmp102_probe(struct i2c_client *client,
diff --git a/drivers/hwmon/tmp108.c b/drivers/hwmon/tmp108.c
index 91bb94639286..429bfeae4ca8 100644
--- a/drivers/hwmon/tmp108.c
+++ b/drivers/hwmon/tmp108.c
@@ -345,7 +345,8 @@ static const struct regmap_config tmp108_regmap_config = {
.volatile_reg = tmp108_is_volatile_reg,
.val_format_endian = REGMAP_ENDIAN_BIG,
.cache_type = REGCACHE_RBTREE,
-   .use_single_rw = true,
+   .use_single_read = true,
+   .use_single_write = true,
 };
 
 static int tmp108_probe(struct i2c_client *client,
diff --git a/drivers/iio/light/apds9960.c b/drivers/iio/light/apds9960.c
index 1f112ae15f3c..b09b8b60bd83 100644
--- a/drivers/iio/light/apds9960.c
+++ b/drivers/iio/light/apds9960.c
@@ -206,7 +206,8 @@ static const struct regmap_config apds9960_regmap_config = {
.name = APDS9960_REGMAP_NAME,
.reg_bits = 8,
.val_bits = 8,

Re: [PATCH 7/7] Compiler Attributes: use feature checks instead of version checks

2018-08-31 Thread Nick Desaulniers
Overall, pretty happy with this patch.  Still some thoughts for a v3,
thanks for sending it!

On Fri, Aug 31, 2018 at 10:05 AM Miguel Ojeda
 wrote:
>
> Instead of using version checks per-compiler to define (or not)
> each attribute, use __has_attribute to test for them, following
> the cleanup started with commit 815f0ddb346c
> ("include/linux/compiler*.h: make compiler-*.h mutually exclusive").
>
> All the attributes that are fairly common/standard (i.e. those that
> do not require extra logic to define them) have been moved
> to a new file include/linux/compiler_attributes.h.
>
> In an effort to make the file as regular as possible, comments
> stating the purpose of attributes have been removed. Instead,
> links to the compiler docs have been added (i.e. to gcc and,
> if available, to clang as well). In addition, they have been sorted.
>
> Finally, if an attribute is optional (i.e. if it is guarded
> by __has_attribute), the reason has been stated for future reference.
>
> Cc: Eli Friedman 
> Cc: Christopher Li 
> Cc: Kees Cook 
> Cc: Ingo Molnar 
> Cc: Geert Uytterhoeven 
> Cc: Arnd Bergmann 
> Cc: Greg Kroah-Hartman 
> Cc: Masahiro Yamada 
> Cc: Joe Perches 
> Cc: Dominique Martinet 
> Cc: Nick Desaulniers 
> Cc: Linus Torvalds 
> Signed-off-by: Miguel Ojeda 
> ---
>  include/linux/compiler-clang.h  |   4 -
>  include/linux/compiler-gcc.h|  51 ---
>  include/linux/compiler-intel.h  |   6 -
>  include/linux/compiler_attributes.h | 226 
>  include/linux/compiler_types.h  |  72 +
>  5 files changed, 232 insertions(+), 127 deletions(-)
>  create mode 100644 include/linux/compiler_attributes.h
>
> diff --git a/include/linux/compiler-clang.h b/include/linux/compiler-clang.h
> index 0aee694d3ab8..3e7dafb3ea80 100644
> --- a/include/linux/compiler-clang.h
> +++ b/include/linux/compiler-clang.h
> @@ -21,8 +21,6 @@
>  #define __SANITIZE_ADDRESS__
>  #endif
>
> -#define __no_sanitize_address __attribute__((no_sanitize("address")))
> -
>  /*
>   * Not all versions of clang implement the the type-generic versions
>   * of the builtin overflow checkers. Fortunately, clang implements
> @@ -41,5 +39,3 @@
>   * compilers, like ICC.
>   */
>  #define barrier() __asm__ __volatile__("" : : : "memory")
> -#define __assume_aligned(a, ...)   \
> -   __attribute__((assume_aligned(a, ## __VA_ARGS__)))
> diff --git a/include/linux/compiler-gcc.h b/include/linux/compiler-gcc.h
> index 32e6ce06163f..627fa8941436 100644
> --- a/include/linux/compiler-gcc.h
> +++ b/include/linux/compiler-gcc.h
> @@ -116,9 +116,6 @@
> __builtin_unreachable();\
> } while (0)
>
> -/* Mark a function definition as prohibited from being cloned. */
> -#define __noclone  __attribute__((noclone, optimize("no-tracer")))
> -
>  #if defined(RANDSTRUCT_PLUGIN) && !defined(__CHECKER__)
>  #define __randomize_layout __attribute__((randomize_layout))
>  #define __no_randomize_layout __attribute__((no_randomize_layout))
> @@ -127,32 +124,6 @@
>  #define randomized_struct_fields_end   } __randomize_layout;
>  #endif
>
> -/*
> - * When used with Link Time Optimization, gcc can optimize away C functions 
> or
> - * variables which are referenced only from assembly code.  __visible tells 
> the
> - * optimizer that something else uses this function or variable, thus 
> preventing
> - * this.
> - */
> -#define __visible  __attribute__((externally_visible))
> -
> -/* gcc version specific checks */
> -
> -#if GCC_VERSION >= 40900
> -/*
> - * __assume_aligned(n, k): Tell the optimizer that the returned
> - * pointer can be assumed to be k modulo n. The second argument is
> - * optional (default 0), so we use a variadic macro to make the
> - * shorthand.
> - *
> - * Beware: Do not apply this to functions which may return
> - * ERR_PTRs. Also, it is probably unwise to apply it to functions
> - * returning extra information in the low bits (but in that case the
> - * compiler should see some alignment anyway, when the return value is
> - * massaged by 'flags = ptr & 3; ptr &= ~3;').
> - */
> -#define __assume_aligned(a, ...) __attribute__((assume_aligned(a, ## 
> __VA_ARGS__)))
> -#endif
> -
>  /*
>   * GCC 'asm goto' miscompiles certain code sequences:
>   *
> @@ -184,32 +155,10 @@
>  #define KASAN_ABI_VERSION 3
>  #endif
>
> -#if GCC_VERSION >= 40902
> -/*
> - * Tell the compiler that address safety instrumentation (KASAN)
> - * should not be applied to that function.
> - * Conflicts with inlining: 
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67368
> - */
> -#define __no_sanitize_address __attribute__((no_sanitize_address))
> -#endif
> -
>  #if GCC_VERSION >= 50100
> -/*
> - * Mark structures as requiring designated initializers.
> - * https://gcc.gnu.org/onlinedocs/gcc/Designated-Inits.html
> - */
> -#define __designated_init __attribute__((designated_init))
>  #define COMPILER_HAS_GENERIC_BUILTIN_OVERFLOW 1
>  #endif
>
> -#if !defined(__noclone)
> -#define 

Re: [PATCH 7/7] Compiler Attributes: use feature checks instead of version checks

2018-08-31 Thread Nick Desaulniers
Overall, pretty happy with this patch.  Still some thoughts for a v3,
thanks for sending it!

On Fri, Aug 31, 2018 at 10:05 AM Miguel Ojeda
 wrote:
>
> Instead of using version checks per-compiler to define (or not)
> each attribute, use __has_attribute to test for them, following
> the cleanup started with commit 815f0ddb346c
> ("include/linux/compiler*.h: make compiler-*.h mutually exclusive").
>
> All the attributes that are fairly common/standard (i.e. those that
> do not require extra logic to define them) have been moved
> to a new file include/linux/compiler_attributes.h.
>
> In an effort to make the file as regular as possible, comments
> stating the purpose of attributes have been removed. Instead,
> links to the compiler docs have been added (i.e. to gcc and,
> if available, to clang as well). In addition, they have been sorted.
>
> Finally, if an attribute is optional (i.e. if it is guarded
> by __has_attribute), the reason has been stated for future reference.
>
> Cc: Eli Friedman 
> Cc: Christopher Li 
> Cc: Kees Cook 
> Cc: Ingo Molnar 
> Cc: Geert Uytterhoeven 
> Cc: Arnd Bergmann 
> Cc: Greg Kroah-Hartman 
> Cc: Masahiro Yamada 
> Cc: Joe Perches 
> Cc: Dominique Martinet 
> Cc: Nick Desaulniers 
> Cc: Linus Torvalds 
> Signed-off-by: Miguel Ojeda 
> ---
>  include/linux/compiler-clang.h  |   4 -
>  include/linux/compiler-gcc.h|  51 ---
>  include/linux/compiler-intel.h  |   6 -
>  include/linux/compiler_attributes.h | 226 
>  include/linux/compiler_types.h  |  72 +
>  5 files changed, 232 insertions(+), 127 deletions(-)
>  create mode 100644 include/linux/compiler_attributes.h
>
> diff --git a/include/linux/compiler-clang.h b/include/linux/compiler-clang.h
> index 0aee694d3ab8..3e7dafb3ea80 100644
> --- a/include/linux/compiler-clang.h
> +++ b/include/linux/compiler-clang.h
> @@ -21,8 +21,6 @@
>  #define __SANITIZE_ADDRESS__
>  #endif
>
> -#define __no_sanitize_address __attribute__((no_sanitize("address")))
> -
>  /*
>   * Not all versions of clang implement the the type-generic versions
>   * of the builtin overflow checkers. Fortunately, clang implements
> @@ -41,5 +39,3 @@
>   * compilers, like ICC.
>   */
>  #define barrier() __asm__ __volatile__("" : : : "memory")
> -#define __assume_aligned(a, ...)   \
> -   __attribute__((assume_aligned(a, ## __VA_ARGS__)))
> diff --git a/include/linux/compiler-gcc.h b/include/linux/compiler-gcc.h
> index 32e6ce06163f..627fa8941436 100644
> --- a/include/linux/compiler-gcc.h
> +++ b/include/linux/compiler-gcc.h
> @@ -116,9 +116,6 @@
> __builtin_unreachable();\
> } while (0)
>
> -/* Mark a function definition as prohibited from being cloned. */
> -#define __noclone  __attribute__((noclone, optimize("no-tracer")))
> -
>  #if defined(RANDSTRUCT_PLUGIN) && !defined(__CHECKER__)
>  #define __randomize_layout __attribute__((randomize_layout))
>  #define __no_randomize_layout __attribute__((no_randomize_layout))
> @@ -127,32 +124,6 @@
>  #define randomized_struct_fields_end   } __randomize_layout;
>  #endif
>
> -/*
> - * When used with Link Time Optimization, gcc can optimize away C functions 
> or
> - * variables which are referenced only from assembly code.  __visible tells 
> the
> - * optimizer that something else uses this function or variable, thus 
> preventing
> - * this.
> - */
> -#define __visible  __attribute__((externally_visible))
> -
> -/* gcc version specific checks */
> -
> -#if GCC_VERSION >= 40900
> -/*
> - * __assume_aligned(n, k): Tell the optimizer that the returned
> - * pointer can be assumed to be k modulo n. The second argument is
> - * optional (default 0), so we use a variadic macro to make the
> - * shorthand.
> - *
> - * Beware: Do not apply this to functions which may return
> - * ERR_PTRs. Also, it is probably unwise to apply it to functions
> - * returning extra information in the low bits (but in that case the
> - * compiler should see some alignment anyway, when the return value is
> - * massaged by 'flags = ptr & 3; ptr &= ~3;').
> - */
> -#define __assume_aligned(a, ...) __attribute__((assume_aligned(a, ## 
> __VA_ARGS__)))
> -#endif
> -
>  /*
>   * GCC 'asm goto' miscompiles certain code sequences:
>   *
> @@ -184,32 +155,10 @@
>  #define KASAN_ABI_VERSION 3
>  #endif
>
> -#if GCC_VERSION >= 40902
> -/*
> - * Tell the compiler that address safety instrumentation (KASAN)
> - * should not be applied to that function.
> - * Conflicts with inlining: 
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67368
> - */
> -#define __no_sanitize_address __attribute__((no_sanitize_address))
> -#endif
> -
>  #if GCC_VERSION >= 50100
> -/*
> - * Mark structures as requiring designated initializers.
> - * https://gcc.gnu.org/onlinedocs/gcc/Designated-Inits.html
> - */
> -#define __designated_init __attribute__((designated_init))
>  #define COMPILER_HAS_GENERIC_BUILTIN_OVERFLOW 1
>  #endif
>
> -#if !defined(__noclone)
> -#define 

[PATCH 07/20] staging:rtl8192u: Refactor RT_TRACE - Style

2018-08-31 Thread John Whitmore
Refactor the MACRO RT_TRACE to add parentheses around the parameter
'component', this clears the checkpatch warning with respect to
precedence issues.

This is a coding style change which should have no impact on runtime
code execution.

Signed-off-by: John Whitmore 
---
 drivers/staging/rtl8192u/r8192U.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/rtl8192u/r8192U.h 
b/drivers/staging/rtl8192u/r8192U.h
index b5ad69af8dac..c613894a6088 100644
--- a/drivers/staging/rtl8192u/r8192U.h
+++ b/drivers/staging/rtl8192u/r8192U.h
@@ -52,7 +52,7 @@
 extern u32 rt_global_debug_component;
 #define RT_TRACE(component, x, args...) \
do {\
-   if (rt_global_debug_component & component)  \
+   if (rt_global_debug_component & (component))\
pr_debug("RTL8192U: " x "\n", ##args);  \
} while (0)
 
-- 
2.18.0



[PATCH 05/20] staging:rtl8192u: Rename RTL819xU_MODULE_NAME - Style

2018-08-31 Thread John Whitmore
Rename the MACRO RTL819xU_MODULE_NAME to RTL819XU_MODULE_NAME, this
clears the checkpatch issue with CamelCase naming.

This is a coding style change which should have no impact on runtime
code execution.

Signed-off-by: John Whitmore 
---
 drivers/staging/rtl8192u/r8192U.h  | 2 +-
 drivers/staging/rtl8192u/r8192U_core.c | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/rtl8192u/r8192U.h 
b/drivers/staging/rtl8192u/r8192U.h
index 4dcfcb4d3911..81a7072a6285 100644
--- a/drivers/staging/rtl8192u/r8192U.h
+++ b/drivers/staging/rtl8192u/r8192U.h
@@ -40,7 +40,7 @@
 #include "ieee80211/ieee80211.h"
 
 #define RTL8192U
-#define RTL819xU_MODULE_NAME "rtl819xU"
+#define RTL819XU_MODULE_NAME "rtl819xU"
 /* HW security */
 #define MAX_KEY_LEN 61
 #define KEY_BUF_SIZE5
diff --git a/drivers/staging/rtl8192u/r8192U_core.c 
b/drivers/staging/rtl8192u/r8192U_core.c
index 98bb40c50f40..b3d32ea29fee 100644
--- a/drivers/staging/rtl8192u/r8192U_core.c
+++ b/drivers/staging/rtl8192u/r8192U_core.c
@@ -128,7 +128,7 @@ static void rtl8192_usb_disconnect(struct usb_interface 
*intf);
 
 
 static struct usb_driver rtl8192_usb_driver = {
-   .name   = RTL819xU_MODULE_NAME,   /* Driver name   */
+   .name   = RTL819XU_MODULE_NAME,   /* Driver name   */
.id_table   = rtl8192_usb_id_tbl, /* PCI_ID table  */
.probe  = rtl8192_usb_probe,  /* probe fn  */
.disconnect = rtl8192_usb_disconnect, /* remove fn */
@@ -627,7 +627,7 @@ static int __maybe_unused proc_get_stats_rx(struct seq_file 
*m, void *v)
 static void rtl8192_proc_module_init(void)
 {
RT_TRACE(COMP_INIT, "Initializing proc filesystem");
-   rtl8192_proc = proc_mkdir(RTL819xU_MODULE_NAME, init_net.proc_net);
+   rtl8192_proc = proc_mkdir(RTL819XU_MODULE_NAME, init_net.proc_net);
 }
 
 static void rtl8192_proc_init_one(struct net_device *dev)
-- 
2.18.0



[PATCH 05/20] staging:rtl8192u: Rename RTL819xU_MODULE_NAME - Style

2018-08-31 Thread John Whitmore
Rename the MACRO RTL819xU_MODULE_NAME to RTL819XU_MODULE_NAME, this
clears the checkpatch issue with CamelCase naming.

This is a coding style change which should have no impact on runtime
code execution.

Signed-off-by: John Whitmore 
---
 drivers/staging/rtl8192u/r8192U.h  | 2 +-
 drivers/staging/rtl8192u/r8192U_core.c | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/rtl8192u/r8192U.h 
b/drivers/staging/rtl8192u/r8192U.h
index 4dcfcb4d3911..81a7072a6285 100644
--- a/drivers/staging/rtl8192u/r8192U.h
+++ b/drivers/staging/rtl8192u/r8192U.h
@@ -40,7 +40,7 @@
 #include "ieee80211/ieee80211.h"
 
 #define RTL8192U
-#define RTL819xU_MODULE_NAME "rtl819xU"
+#define RTL819XU_MODULE_NAME "rtl819xU"
 /* HW security */
 #define MAX_KEY_LEN 61
 #define KEY_BUF_SIZE5
diff --git a/drivers/staging/rtl8192u/r8192U_core.c 
b/drivers/staging/rtl8192u/r8192U_core.c
index 98bb40c50f40..b3d32ea29fee 100644
--- a/drivers/staging/rtl8192u/r8192U_core.c
+++ b/drivers/staging/rtl8192u/r8192U_core.c
@@ -128,7 +128,7 @@ static void rtl8192_usb_disconnect(struct usb_interface 
*intf);
 
 
 static struct usb_driver rtl8192_usb_driver = {
-   .name   = RTL819xU_MODULE_NAME,   /* Driver name   */
+   .name   = RTL819XU_MODULE_NAME,   /* Driver name   */
.id_table   = rtl8192_usb_id_tbl, /* PCI_ID table  */
.probe  = rtl8192_usb_probe,  /* probe fn  */
.disconnect = rtl8192_usb_disconnect, /* remove fn */
@@ -627,7 +627,7 @@ static int __maybe_unused proc_get_stats_rx(struct seq_file 
*m, void *v)
 static void rtl8192_proc_module_init(void)
 {
RT_TRACE(COMP_INIT, "Initializing proc filesystem");
-   rtl8192_proc = proc_mkdir(RTL819xU_MODULE_NAME, init_net.proc_net);
+   rtl8192_proc = proc_mkdir(RTL819XU_MODULE_NAME, init_net.proc_net);
 }
 
 static void rtl8192_proc_init_one(struct net_device *dev)
-- 
2.18.0



[PATCH 07/20] staging:rtl8192u: Refactor RT_TRACE - Style

2018-08-31 Thread John Whitmore
Refactor the MACRO RT_TRACE to add parentheses around the parameter
'component', this clears the checkpatch warning with respect to
precedence issues.

This is a coding style change which should have no impact on runtime
code execution.

Signed-off-by: John Whitmore 
---
 drivers/staging/rtl8192u/r8192U.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/rtl8192u/r8192U.h 
b/drivers/staging/rtl8192u/r8192U.h
index b5ad69af8dac..c613894a6088 100644
--- a/drivers/staging/rtl8192u/r8192U.h
+++ b/drivers/staging/rtl8192u/r8192U.h
@@ -52,7 +52,7 @@
 extern u32 rt_global_debug_component;
 #define RT_TRACE(component, x, args...) \
do {\
-   if (rt_global_debug_component & component)  \
+   if (rt_global_debug_component & (component))\
pr_debug("RTL8192U: " x "\n", ##args);  \
} while (0)
 
-- 
2.18.0



[PATCH 03/20] staging:rtl8192u: Remove unused functions - Style

2018-08-31 Thread John Whitmore
Remove unused function declarations. This is a coding style change
which should have no impact on runtime code execution.

Signed-off-by: John Whitmore 
---
 drivers/staging/rtl8192u/r8192U.h  | 10 --
 drivers/staging/rtl8192u/r8192U_core.c |  7 ---
 2 files changed, 17 deletions(-)

diff --git a/drivers/staging/rtl8192u/r8192U.h 
b/drivers/staging/rtl8192u/r8192U.h
index 70bbd1fadcca..b3e6ce2acedb 100644
--- a/drivers/staging/rtl8192u/r8192U.h
+++ b/drivers/staging/rtl8192u/r8192U.h
@@ -1103,22 +1103,12 @@ void force_pci_posting(struct net_device *dev);
 
 void rtl8192_rtx_disable(struct net_device *dev);
 void rtl8192_rx_enable(struct net_device *dev);
-void rtl8192_tx_enable(struct net_device *dev);
 
-void rtl8192_disassociate(struct net_device *dev);
-void rtl8185_set_rf_pins_enable(struct net_device *dev, u32 a);
-
-void rtl8192_set_anaparam(struct net_device *dev, u32 a);
-void rtl8185_set_anaparam2(struct net_device *dev, u32 a);
 void rtl8192_update_msr(struct net_device *dev);
 int rtl8192_down(struct net_device *dev);
 int rtl8192_up(struct net_device *dev);
 void rtl8192_commit(struct net_device *dev);
 void rtl8192_set_chan(struct net_device *dev, short ch);
-void write_phy(struct net_device *dev, u8 adr, u8 data);
-void write_phy_cck(struct net_device *dev, u8 adr, u32 data);
-void write_phy_ofdm(struct net_device *dev, u8 adr, u32 data);
-void rtl8185_tx_antenna(struct net_device *dev, u8 ant);
 void rtl8192_set_rxconf(struct net_device *dev);
 void rtl819xusb_beacon_tx(struct net_device *dev, u16 tx_rate);
 
diff --git a/drivers/staging/rtl8192u/r8192U_core.c 
b/drivers/staging/rtl8192u/r8192U_core.c
index 12783b88eb58..98bb40c50f40 100644
--- a/drivers/staging/rtl8192u/r8192U_core.c
+++ b/drivers/staging/rtl8192u/r8192U_core.c
@@ -830,13 +830,6 @@ void rtl8192_rx_enable(struct net_device *dev)
rtl8192_rx_initiate(dev);
 }
 
-
-void rtl8192_tx_enable(struct net_device *dev)
-{
-}
-
-
-
 void rtl8192_rtx_disable(struct net_device *dev)
 {
u8 cmd;
-- 
2.18.0



[PATCH 09/20] staging:rtl8192u: Remove RT_DEBUG_DATA - Style

2018-08-31 Thread John Whitmore
Remove the RT_DEBUG_DATA Macro. The macro causes a number of
checkpatch issues, and is not actually used in code, so can simply
be removed without issue.

This is a coding style change which should not impact runtime
code execution.

Signed-off-by: John Whitmore 
---
 drivers/staging/rtl8192u/r8192U.h | 20 
 1 file changed, 20 deletions(-)

diff --git a/drivers/staging/rtl8192u/r8192U.h 
b/drivers/staging/rtl8192u/r8192U.h
index e65a893fd084..528c50be3894 100644
--- a/drivers/staging/rtl8192u/r8192U.h
+++ b/drivers/staging/rtl8192u/r8192U.h
@@ -103,28 +103,8 @@ extern u32 rt_global_debug_component;
 #expr, __FILE__, __func__, __LINE__);  \
}   \
} while (0)
-/*
- * Debug out data buf.
- * If you want to print DATA buffer related BA,
- * please set ieee80211_debug_level to DATA|BA
- */
-#define RT_DEBUG_DATA(level, data, datalen) \
-   do {\
-   if ((rt_global_debug_component & (level)) == (level)) { \
-   int i;  \
-   u8 *pdata = (u8 *)data; \
-   pr_debug("RTL8192U: %s()\n", __func__); \
-   for (i = 0; i < (int)(datalen); i++) {  \
-   printk("%2x ", pdata[i]);   \
-   if ((i+1)%16 == 0)  \
-   printk("\n");   \
-   }   \
-   printk("\n");   \
-   }   \
-   } while (0)
 #else
 #define RTL8192U_ASSERT(expr) do {} while (0)
-#define RT_DEBUG_DATA(level, data, datalen) do {} while (0)
 #endif /* RTL8169_DEBUG */
 
 /* Queue Select Value in TxDesc */
-- 
2.18.0



[PATCH 03/20] staging:rtl8192u: Remove unused functions - Style

2018-08-31 Thread John Whitmore
Remove unused function declarations. This is a coding style change
which should have no impact on runtime code execution.

Signed-off-by: John Whitmore 
---
 drivers/staging/rtl8192u/r8192U.h  | 10 --
 drivers/staging/rtl8192u/r8192U_core.c |  7 ---
 2 files changed, 17 deletions(-)

diff --git a/drivers/staging/rtl8192u/r8192U.h 
b/drivers/staging/rtl8192u/r8192U.h
index 70bbd1fadcca..b3e6ce2acedb 100644
--- a/drivers/staging/rtl8192u/r8192U.h
+++ b/drivers/staging/rtl8192u/r8192U.h
@@ -1103,22 +1103,12 @@ void force_pci_posting(struct net_device *dev);
 
 void rtl8192_rtx_disable(struct net_device *dev);
 void rtl8192_rx_enable(struct net_device *dev);
-void rtl8192_tx_enable(struct net_device *dev);
 
-void rtl8192_disassociate(struct net_device *dev);
-void rtl8185_set_rf_pins_enable(struct net_device *dev, u32 a);
-
-void rtl8192_set_anaparam(struct net_device *dev, u32 a);
-void rtl8185_set_anaparam2(struct net_device *dev, u32 a);
 void rtl8192_update_msr(struct net_device *dev);
 int rtl8192_down(struct net_device *dev);
 int rtl8192_up(struct net_device *dev);
 void rtl8192_commit(struct net_device *dev);
 void rtl8192_set_chan(struct net_device *dev, short ch);
-void write_phy(struct net_device *dev, u8 adr, u8 data);
-void write_phy_cck(struct net_device *dev, u8 adr, u32 data);
-void write_phy_ofdm(struct net_device *dev, u8 adr, u32 data);
-void rtl8185_tx_antenna(struct net_device *dev, u8 ant);
 void rtl8192_set_rxconf(struct net_device *dev);
 void rtl819xusb_beacon_tx(struct net_device *dev, u16 tx_rate);
 
diff --git a/drivers/staging/rtl8192u/r8192U_core.c 
b/drivers/staging/rtl8192u/r8192U_core.c
index 12783b88eb58..98bb40c50f40 100644
--- a/drivers/staging/rtl8192u/r8192U_core.c
+++ b/drivers/staging/rtl8192u/r8192U_core.c
@@ -830,13 +830,6 @@ void rtl8192_rx_enable(struct net_device *dev)
rtl8192_rx_initiate(dev);
 }
 
-
-void rtl8192_tx_enable(struct net_device *dev)
-{
-}
-
-
-
 void rtl8192_rtx_disable(struct net_device *dev)
 {
u8 cmd;
-- 
2.18.0



[PATCH 09/20] staging:rtl8192u: Remove RT_DEBUG_DATA - Style

2018-08-31 Thread John Whitmore
Remove the RT_DEBUG_DATA Macro. The macro causes a number of
checkpatch issues, and is not actually used in code, so can simply
be removed without issue.

This is a coding style change which should not impact runtime
code execution.

Signed-off-by: John Whitmore 
---
 drivers/staging/rtl8192u/r8192U.h | 20 
 1 file changed, 20 deletions(-)

diff --git a/drivers/staging/rtl8192u/r8192U.h 
b/drivers/staging/rtl8192u/r8192U.h
index e65a893fd084..528c50be3894 100644
--- a/drivers/staging/rtl8192u/r8192U.h
+++ b/drivers/staging/rtl8192u/r8192U.h
@@ -103,28 +103,8 @@ extern u32 rt_global_debug_component;
 #expr, __FILE__, __func__, __LINE__);  \
}   \
} while (0)
-/*
- * Debug out data buf.
- * If you want to print DATA buffer related BA,
- * please set ieee80211_debug_level to DATA|BA
- */
-#define RT_DEBUG_DATA(level, data, datalen) \
-   do {\
-   if ((rt_global_debug_component & (level)) == (level)) { \
-   int i;  \
-   u8 *pdata = (u8 *)data; \
-   pr_debug("RTL8192U: %s()\n", __func__); \
-   for (i = 0; i < (int)(datalen); i++) {  \
-   printk("%2x ", pdata[i]);   \
-   if ((i+1)%16 == 0)  \
-   printk("\n");   \
-   }   \
-   printk("\n");   \
-   }   \
-   } while (0)
 #else
 #define RTL8192U_ASSERT(expr) do {} while (0)
-#define RT_DEBUG_DATA(level, data, datalen) do {} while (0)
 #endif /* RTL8169_DEBUG */
 
 /* Queue Select Value in TxDesc */
-- 
2.18.0



[PATCH 19/20] staging:rtl8192u: Rename LINIP - Style

2018-08-31 Thread John Whitmore
Rename the member variable 'LINIP' to 'linip', this change is to
conform to the coding style guidelines, member variables in
lowercase.

This is a simple coding style change which should not impact runtime
code execution.

Signed-off-by: John Whitmore 
---
 drivers/staging/rtl8192u/r8192U.h  | 2 +-
 drivers/staging/rtl8192u/r8192U_core.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/rtl8192u/r8192U.h 
b/drivers/staging/rtl8192u/r8192U.h
index 66efa59eabf0..68e82b32a88e 100644
--- a/drivers/staging/rtl8192u/r8192U.h
+++ b/drivers/staging/rtl8192u/r8192U.h
@@ -164,7 +164,7 @@ struct tx_desc_819x_usb {
u8  cmd_init:1;
u8  last_seg:1;
u8  first_seg:1;
-   u8  LINIP:1;
+   u8  linip:1;
u8  OWN:1;
 
/* DWORD 1 */
diff --git a/drivers/staging/rtl8192u/r8192U_core.c 
b/drivers/staging/rtl8192u/r8192U_core.c
index a4d1b55a1117..911d0214b48a 100644
--- a/drivers/staging/rtl8192u/r8192U_core.c
+++ b/drivers/staging/rtl8192u/r8192U_core.c
@@ -1514,7 +1514,7 @@ short rtl8192_tx(struct net_device *dev, struct sk_buff 
*skb)
/* Fill Tx descriptor */
memset(tx_desc, 0, sizeof(struct tx_desc_819x_usb));
/* DWORD 0 */
-   tx_desc->LINIP = 0;
+   tx_desc->linip = 0;
tx_desc->cmd_init = 1;
tx_desc->offset =  sizeof(struct tx_fwinfo_819x_usb) + 8;
tx_desc->pkt_size = (skb->len - TX_PACKET_SHIFT_BYTES) & 0x;
-- 
2.18.0



[PATCH 14/20] staging:rtl8192u: Rename Offset - Style

2018-08-31 Thread John Whitmore
Rename the member variable 'Offset' to 'offset', this clears the
checkpatch issue with CamelCase naming.

This is a coding style change which should not impact runtime code
execution.

Signed-off-by: John Whitmore 
---
 drivers/staging/rtl8192u/r8192U.h  | 2 +-
 drivers/staging/rtl8192u/r8192U_core.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/rtl8192u/r8192U.h 
b/drivers/staging/rtl8192u/r8192U.h
index 9931ede1524b..8aaea1d8cf50 100644
--- a/drivers/staging/rtl8192u/r8192U.h
+++ b/drivers/staging/rtl8192u/r8192U.h
@@ -159,7 +159,7 @@ extern u32 rt_global_debug_component;
 struct tx_desc_819x_usb {
/* DWORD 0 */
u16 pkt_size;
-   u8  Offset;
+   u8  offset;
u8  Reserved0:3;
u8  CmdInit:1;
u8  LastSeg:1;
diff --git a/drivers/staging/rtl8192u/r8192U_core.c 
b/drivers/staging/rtl8192u/r8192U_core.c
index 2a3cb0f1ac07..d4af6cc01fc6 100644
--- a/drivers/staging/rtl8192u/r8192U_core.c
+++ b/drivers/staging/rtl8192u/r8192U_core.c
@@ -1516,7 +1516,7 @@ short rtl8192_tx(struct net_device *dev, struct sk_buff 
*skb)
/* DWORD 0 */
tx_desc->LINIP = 0;
tx_desc->CmdInit = 1;
-   tx_desc->Offset =  sizeof(struct tx_fwinfo_819x_usb) + 8;
+   tx_desc->offset =  sizeof(struct tx_fwinfo_819x_usb) + 8;
tx_desc->pkt_size = (skb->len - TX_PACKET_SHIFT_BYTES) & 0x;
 
/*DWORD 1*/
-- 
2.18.0



[PATCH 20/20] staging:rtl8192u: Rename OWN - Style

2018-08-31 Thread John Whitmore
Rename the member variable 'OWN' to 'own', this is to comply with the
coding standard, where variables are named in lowercase.

This is a simple coding style change which should have no impact on
runtime code execution.

Signed-off-by: John Whitmore 
---
 drivers/staging/rtl8192u/r8192U.h  | 2 +-
 drivers/staging/rtl8192u/r8192U_core.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/rtl8192u/r8192U.h 
b/drivers/staging/rtl8192u/r8192U.h
index 68e82b32a88e..f963b664e221 100644
--- a/drivers/staging/rtl8192u/r8192U.h
+++ b/drivers/staging/rtl8192u/r8192U.h
@@ -165,7 +165,7 @@ struct tx_desc_819x_usb {
u8  last_seg:1;
u8  first_seg:1;
u8  linip:1;
-   u8  OWN:1;
+   u8  own:1;
 
/* DWORD 1 */
u8  TxFWInfoSize;
diff --git a/drivers/staging/rtl8192u/r8192U_core.c 
b/drivers/staging/rtl8192u/r8192U_core.c
index 911d0214b48a..4d0f70ec31ac 100644
--- a/drivers/staging/rtl8192u/r8192U_core.c
+++ b/drivers/staging/rtl8192u/r8192U_core.c
@@ -1558,7 +1558,7 @@ short rtl8192_tx(struct net_device *dev, struct sk_buff 
*skb)
/* DWORD 0 */
tx_desc->first_seg = 1;
tx_desc->last_seg = 1;
-   tx_desc->OWN = 1;
+   tx_desc->own = 1;
 
/* DWORD 2 */
tx_desc->TxBufferSize = (u32)(skb->len - USB_HWDESC_HEADER_LEN);
-- 
2.18.0



[PATCH 02/20] staging:rtl8192u: Remove read_cam() - Style

2018-08-31 Thread John Whitmore
Remove the function read_cam(), as it is unused in code.

Simple style change which should not impact runtime code execution.

Signed-off-by: John Whitmore 
---
 drivers/staging/rtl8192u/r8192U.h  | 2 --
 drivers/staging/rtl8192u/r8192U_core.c | 9 -
 2 files changed, 11 deletions(-)

diff --git a/drivers/staging/rtl8192u/r8192U.h 
b/drivers/staging/rtl8192u/r8192U.h
index 77324a471de1..70bbd1fadcca 100644
--- a/drivers/staging/rtl8192u/r8192U.h
+++ b/drivers/staging/rtl8192u/r8192U.h
@@ -1091,8 +1091,6 @@ bool init_firmware(struct net_device *dev);
 short rtl819xU_tx_cmd(struct net_device *dev, struct sk_buff *skb);
 short rtl8192_tx(struct net_device *dev, struct sk_buff *skb);
 
-u32 read_cam(struct net_device *dev, u8 addr);
-
 int read_nic_byte(struct net_device *dev, int x, u8 *data);
 int read_nic_byte_E(struct net_device *dev, int x, u8 *data);
 int read_nic_dword(struct net_device *dev, int x, u32 *data);
diff --git a/drivers/staging/rtl8192u/r8192U_core.c 
b/drivers/staging/rtl8192u/r8192U_core.c
index caa618a845df..12783b88eb58 100644
--- a/drivers/staging/rtl8192u/r8192U_core.c
+++ b/drivers/staging/rtl8192u/r8192U_core.c
@@ -237,15 +237,6 @@ static void CamResetAllEntry(struct net_device *dev)
write_nic_dword(dev, RWCAM, ulcommand);
 }
 
-u32 read_cam(struct net_device *dev, u8 addr)
-{
-   u32 data;
-
-   write_nic_dword(dev, RWCAM, 0x8000 | (addr & 0xff));
-   read_nic_dword(dev, 0xa8, );
-   return data;
-}
-
 int write_nic_byte_E(struct net_device *dev, int indx, u8 data)
 {
int status;
-- 
2.18.0



[PATCH 01/20] staging:rtl8192u: Remove write_cam() - Style

2018-08-31 Thread John Whitmore
Remove the function write_cam() as it is unused.

Simple style change which should not impact runtime code execution.

Signed-off-by: John Whitmore 
---
 drivers/staging/rtl8192u/r8192U.h  | 1 -
 drivers/staging/rtl8192u/r8192U_core.c | 7 ---
 2 files changed, 8 deletions(-)

diff --git a/drivers/staging/rtl8192u/r8192U.h 
b/drivers/staging/rtl8192u/r8192U.h
index 1b51601df1ee..77324a471de1 100644
--- a/drivers/staging/rtl8192u/r8192U.h
+++ b/drivers/staging/rtl8192u/r8192U.h
@@ -1092,7 +1092,6 @@ short rtl819xU_tx_cmd(struct net_device *dev, struct 
sk_buff *skb);
 short rtl8192_tx(struct net_device *dev, struct sk_buff *skb);
 
 u32 read_cam(struct net_device *dev, u8 addr);
-void write_cam(struct net_device *dev, u8 addr, u32 data);
 
 int read_nic_byte(struct net_device *dev, int x, u8 *data);
 int read_nic_byte_E(struct net_device *dev, int x, u8 *data);
diff --git a/drivers/staging/rtl8192u/r8192U_core.c 
b/drivers/staging/rtl8192u/r8192U_core.c
index 6b22aaa40ff9..caa618a845df 100644
--- a/drivers/staging/rtl8192u/r8192U_core.c
+++ b/drivers/staging/rtl8192u/r8192U_core.c
@@ -237,13 +237,6 @@ static void CamResetAllEntry(struct net_device *dev)
write_nic_dword(dev, RWCAM, ulcommand);
 }
 
-
-void write_cam(struct net_device *dev, u8 addr, u32 data)
-{
-   write_nic_dword(dev, WCAMI, data);
-   write_nic_dword(dev, RWCAM, BIT(31) | BIT(16) | (addr & 0xff));
-}
-
 u32 read_cam(struct net_device *dev, u8 addr)
 {
u32 data;
-- 
2.18.0



[PATCH 12/20] staging:rtl8192u: Rename CCK_Table_length - Style

2018-08-31 Thread John Whitmore
Rename the constant CCK_Table_length to CCK_TABLE_LENGTH, this clears
the checkpatch issue with CamelCase naming.

This is a simple coding style change which should not impact runtime
code execution.

Signed-off-by: John Whitmore 
---
 drivers/staging/rtl8192u/r8192U.h|  2 +-
 drivers/staging/rtl8192u/r8192U_dm.c | 14 +++---
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/rtl8192u/r8192U.h 
b/drivers/staging/rtl8192u/r8192U.h
index 6edbc8146e82..e86a4b35a1f4 100644
--- a/drivers/staging/rtl8192u/r8192U.h
+++ b/drivers/staging/rtl8192u/r8192U.h
@@ -153,7 +153,7 @@ extern u32 rt_global_debug_component;
 #definePHY_BEACON_RSSI_SLID_WIN_MAX10
 /* For Tx Power Tracking */
 #defineOFDM_TABLE_LENGTH   19
-#defineCCK_Table_length12
+#defineCCK_TABLE_LENGTH12
 
 /* For rtl819x */
 struct tx_desc_819x_usb {
diff --git a/drivers/staging/rtl8192u/r8192U_dm.c 
b/drivers/staging/rtl8192u/r8192U_dm.c
index 19b3b11c5edb..874da0620936 100644
--- a/drivers/staging/rtl8192u/r8192U_dm.c
+++ b/drivers/staging/rtl8192u/r8192U_dm.c
@@ -476,7 +476,7 @@ static u32 OFDMSwingTable[OFDM_TABLE_LENGTH] = {
0x1040  /* 18, -12db */
 };
 
-static u8  CCKSwingTable_Ch1_Ch13[CCK_Table_length][8] = {
+static u8  CCKSwingTable_Ch1_Ch13[CCK_TABLE_LENGTH][8] = {
{0x36, 0x35, 0x2e, 0x25, 0x1c, 0x12, 0x09, 0x04},   /* 0, +0db ===> 
CCK40M default */
{0x30, 0x2f, 0x29, 0x21, 0x19, 0x10, 0x08, 0x03},   /* 1, -1db */
{0x2b, 0x2a, 0x25, 0x1e, 0x16, 0x0e, 0x07, 0x03},   /* 2, -2db */
@@ -491,7 +491,7 @@ static u8   CCKSwingTable_Ch1_Ch13[CCK_Table_length][8] = {
{0x0f, 0x0f, 0x0d, 0x0b, 0x08, 0x05, 0x03, 0x01}/* 11, -11db */
 };
 
-static u8  CCKSwingTable_Ch14[CCK_Table_length][8] = {
+static u8  CCKSwingTable_Ch14[CCK_TABLE_LENGTH][8] = {
{0x36, 0x35, 0x2e, 0x1b, 0x00, 0x00, 0x00, 0x00},   /* 0, +0db  
===> CCK40M default */
{0x30, 0x2f, 0x29, 0x18, 0x00, 0x00, 0x00, 0x00},   /* 1, -1db */
{0x2b, 0x2a, 0x25, 0x15, 0x00, 0x00, 0x00, 0x00},   /* 2, -2db */
@@ -682,7 +682,7 @@ static void dm_TXPowerTrackingCallback_ThermalMeter(struct 
net_device *dev)
 
/* Query CCK default setting From 0xa22 */
TempCCk = rtl8192_QueryBBReg(dev, rCCK0_TxFilter1, bMaskByte2);
-   for (i = 0; i < CCK_Table_length; i++) {
+   for (i = 0; i < CCK_TABLE_LENGTH; i++) {
if (TempCCk == (u32)CCKSwingTable_Ch1_Ch13[i][0]) {
priv->CCK_index = (u8) i;
RT_TRACE(COMP_POWER_TRACKING, "Initial reg0x%x 
= 0x%x, CCK_index=0x%x\n",
@@ -718,10 +718,10 @@ static void 
dm_TXPowerTrackingCallback_ThermalMeter(struct net_device *dev)
tmpCCK40Mindex = tmpCCK20Mindex - 6;
if (tmpOFDMindex >= OFDM_TABLE_LENGTH)
tmpOFDMindex = OFDM_TABLE_LENGTH - 1;
-   if (tmpCCK20Mindex >= CCK_Table_length)
-   tmpCCK20Mindex = CCK_Table_length-1;
-   if (tmpCCK40Mindex >= CCK_Table_length)
-   tmpCCK40Mindex = CCK_Table_length-1;
+   if (tmpCCK20Mindex >= CCK_TABLE_LENGTH)
+   tmpCCK20Mindex = CCK_TABLE_LENGTH - 1;
+   if (tmpCCK40Mindex >= CCK_TABLE_LENGTH)
+   tmpCCK40Mindex = CCK_TABLE_LENGTH - 1;
} else {
tmpval = (u8)tmpRegA - priv->ThermalMeter[0];
 
-- 
2.18.0



[PATCH 16/20] staging:rtl8192u: Rename CmdInit - Style

2018-08-31 Thread John Whitmore
Rename the member variable 'CmdInit, to 'cmd_init', this change
clears the checkpatch issue with CamelCase naming.

This is a simple coding style change which should have no impact on
runtime code execution.

Signed-off-by: John Whitmore 
---
 drivers/staging/rtl8192u/r8192U.h  | 2 +-
 drivers/staging/rtl8192u/r8192U_core.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/rtl8192u/r8192U.h 
b/drivers/staging/rtl8192u/r8192U.h
index 5d643870a1e3..4d29b7427a0e 100644
--- a/drivers/staging/rtl8192u/r8192U.h
+++ b/drivers/staging/rtl8192u/r8192U.h
@@ -161,7 +161,7 @@ struct tx_desc_819x_usb {
u16 pkt_size;
u8  offset;
u8  reserved0:3;
-   u8  CmdInit:1;
+   u8  cmd_init:1;
u8  LastSeg:1;
u8  FirstSeg:1;
u8  LINIP:1;
diff --git a/drivers/staging/rtl8192u/r8192U_core.c 
b/drivers/staging/rtl8192u/r8192U_core.c
index d4af6cc01fc6..b385c686370b 100644
--- a/drivers/staging/rtl8192u/r8192U_core.c
+++ b/drivers/staging/rtl8192u/r8192U_core.c
@@ -1515,7 +1515,7 @@ short rtl8192_tx(struct net_device *dev, struct sk_buff 
*skb)
memset(tx_desc, 0, sizeof(struct tx_desc_819x_usb));
/* DWORD 0 */
tx_desc->LINIP = 0;
-   tx_desc->CmdInit = 1;
+   tx_desc->cmd_init = 1;
tx_desc->offset =  sizeof(struct tx_fwinfo_819x_usb) + 8;
tx_desc->pkt_size = (skb->len - TX_PACKET_SHIFT_BYTES) & 0x;
 
-- 
2.18.0



[PATCH 04/20] staging:rtl8192u: Add SPDX-License-Identifier - Style

2018-08-31 Thread John Whitmore
Add SPDX-License-Identifier tag to the start of header file. This is
a coding style change which should have no impact on runtime code
execution.

Signed-off-by: John Whitmore 
---
 drivers/staging/rtl8192u/r8192U.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/staging/rtl8192u/r8192U.h 
b/drivers/staging/rtl8192u/r8192U.h
index b3e6ce2acedb..4dcfcb4d3911 100644
--- a/drivers/staging/rtl8192u/r8192U.h
+++ b/drivers/staging/rtl8192u/r8192U.h
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: GPL-2.0 */
 /*
  * This is part of rtl8187 OpenSource driver.
  * Copyright (C) Andrea Merello 2004-2005  
-- 
2.18.0



[PATCH 06/20] staging:rtl8192u: Rename Rx_Smooth_Factor - Style

2018-08-31 Thread John Whitmore
Rename the MACRO Rx_Smooth_Factor to RX_SMOOTH_FACTOR, this clears the
checkpatch issue with CamelCase naming.

This is a coding style change which should have no impact on runtime
code execution.

Signed-off-by: John Whitmore 
---
 drivers/staging/rtl8192u/r8192U.h  |  2 +-
 drivers/staging/rtl8192u/r8192U_core.c | 20 ++--
 2 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/drivers/staging/rtl8192u/r8192U.h 
b/drivers/staging/rtl8192u/r8192U.h
index 81a7072a6285..b5ad69af8dac 100644
--- a/drivers/staging/rtl8192u/r8192U.h
+++ b/drivers/staging/rtl8192u/r8192U.h
@@ -45,7 +45,7 @@
 #define MAX_KEY_LEN 61
 #define KEY_BUF_SIZE5
 
-#defineRx_Smooth_Factor20
+#defineRX_SMOOTH_FACTOR20
 #define DMESG(x, a...)
 #define DMESGW(x, a...)
 #define DMESGE(x, a...)
diff --git a/drivers/staging/rtl8192u/r8192U_core.c 
b/drivers/staging/rtl8192u/r8192U_core.c
index b3d32ea29fee..dd87cee6604b 100644
--- a/drivers/staging/rtl8192u/r8192U_core.c
+++ b/drivers/staging/rtl8192u/r8192U_core.c
@@ -3975,13 +3975,13 @@ static void rtl8192_process_phyinfo(struct r8192_priv 
*priv, u8 *buffer,

pprevious_stats->RxMIMOSignalStrength[rfpath];
if (pprevious_stats->RxMIMOSignalStrength[rfpath]  > 
priv->stats.rx_rssi_percentage[rfpath]) {
priv->stats.rx_rssi_percentage[rfpath] =
-   
((priv->stats.rx_rssi_percentage[rfpath] * (Rx_Smooth_Factor - 1)) +
-
(pprevious_stats->RxMIMOSignalStrength[rfpath])) / (Rx_Smooth_Factor);
+   
((priv->stats.rx_rssi_percentage[rfpath] * (RX_SMOOTH_FACTOR - 1)) +
+
(pprevious_stats->RxMIMOSignalStrength[rfpath])) / (RX_SMOOTH_FACTOR);
priv->stats.rx_rssi_percentage[rfpath] = 
priv->stats.rx_rssi_percentage[rfpath]  + 1;
} else {
priv->stats.rx_rssi_percentage[rfpath] =
-   
((priv->stats.rx_rssi_percentage[rfpath] * (Rx_Smooth_Factor - 1)) +
-
(pprevious_stats->RxMIMOSignalStrength[rfpath])) / (Rx_Smooth_Factor);
+   
((priv->stats.rx_rssi_percentage[rfpath] * (RX_SMOOTH_FACTOR - 1)) +
+
(pprevious_stats->RxMIMOSignalStrength[rfpath])) / (RX_SMOOTH_FACTOR);
}
RT_TRACE(COMP_DBG,
 "priv->stats.rx_rssi_percentage[rfPath]  = 
%d\n",
@@ -4026,13 +4026,13 @@ static void rtl8192_process_phyinfo(struct r8192_priv 
*priv, u8 *buffer,
pprevious_stats->RxPWDBAll;
if (pprevious_stats->RxPWDBAll > 
(u32)priv->undecorated_smoothed_pwdb) {
priv->undecorated_smoothed_pwdb =
-   (((priv->undecorated_smoothed_pwdb) * 
(Rx_Smooth_Factor - 1)) +
-(pprevious_stats->RxPWDBAll)) / 
(Rx_Smooth_Factor);
+   (((priv->undecorated_smoothed_pwdb) * 
(RX_SMOOTH_FACTOR - 1)) +
+(pprevious_stats->RxPWDBAll)) / 
(RX_SMOOTH_FACTOR);
priv->undecorated_smoothed_pwdb = 
priv->undecorated_smoothed_pwdb + 1;
} else {
priv->undecorated_smoothed_pwdb =
-   (((priv->undecorated_smoothed_pwdb) * 
(Rx_Smooth_Factor - 1)) +
-(pprevious_stats->RxPWDBAll)) / 
(Rx_Smooth_Factor);
+   (((priv->undecorated_smoothed_pwdb) * 
(RX_SMOOTH_FACTOR - 1)) +
+(pprevious_stats->RxPWDBAll)) / 
(RX_SMOOTH_FACTOR);
}
}
 
@@ -4075,8 +4075,8 @@ static void rtl8192_process_phyinfo(struct r8192_priv 
*priv, u8 *buffer,
if 
(priv->stats.rx_evm_percentage[nspatial_stream] == 0) /* initialize */

priv->stats.rx_evm_percentage[nspatial_stream] = 
pprevious_stats->RxMIMOSignalQuality[nspatial_stream];

priv->stats.rx_evm_percentage[nspatial_stream] =
-   
((priv->stats.rx_evm_percentage[nspatial_stream] * (Rx_Smooth_Factor - 1)) +
-
(pprevious_stats->RxMIMOSignalQuality[nspatial_stream] * 1)) / 
(Rx_Smooth_Factor);
+   
((priv->stats.rx_evm_percentage[nspatial_stream] * (RX_SMOOTH_FACTOR - 1)) +
+
(pprevious_stats->RxMIMOSignalQuality[nspatial_stream] * 1)) / 
(RX_SMOOTH_FACTOR);
}

[PATCH 20/20] staging:rtl8192u: Rename OWN - Style

2018-08-31 Thread John Whitmore
Rename the member variable 'OWN' to 'own', this is to comply with the
coding standard, where variables are named in lowercase.

This is a simple coding style change which should have no impact on
runtime code execution.

Signed-off-by: John Whitmore 
---
 drivers/staging/rtl8192u/r8192U.h  | 2 +-
 drivers/staging/rtl8192u/r8192U_core.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/rtl8192u/r8192U.h 
b/drivers/staging/rtl8192u/r8192U.h
index 68e82b32a88e..f963b664e221 100644
--- a/drivers/staging/rtl8192u/r8192U.h
+++ b/drivers/staging/rtl8192u/r8192U.h
@@ -165,7 +165,7 @@ struct tx_desc_819x_usb {
u8  last_seg:1;
u8  first_seg:1;
u8  linip:1;
-   u8  OWN:1;
+   u8  own:1;
 
/* DWORD 1 */
u8  TxFWInfoSize;
diff --git a/drivers/staging/rtl8192u/r8192U_core.c 
b/drivers/staging/rtl8192u/r8192U_core.c
index 911d0214b48a..4d0f70ec31ac 100644
--- a/drivers/staging/rtl8192u/r8192U_core.c
+++ b/drivers/staging/rtl8192u/r8192U_core.c
@@ -1558,7 +1558,7 @@ short rtl8192_tx(struct net_device *dev, struct sk_buff 
*skb)
/* DWORD 0 */
tx_desc->first_seg = 1;
tx_desc->last_seg = 1;
-   tx_desc->OWN = 1;
+   tx_desc->own = 1;
 
/* DWORD 2 */
tx_desc->TxBufferSize = (u32)(skb->len - USB_HWDESC_HEADER_LEN);
-- 
2.18.0



[PATCH 02/20] staging:rtl8192u: Remove read_cam() - Style

2018-08-31 Thread John Whitmore
Remove the function read_cam(), as it is unused in code.

Simple style change which should not impact runtime code execution.

Signed-off-by: John Whitmore 
---
 drivers/staging/rtl8192u/r8192U.h  | 2 --
 drivers/staging/rtl8192u/r8192U_core.c | 9 -
 2 files changed, 11 deletions(-)

diff --git a/drivers/staging/rtl8192u/r8192U.h 
b/drivers/staging/rtl8192u/r8192U.h
index 77324a471de1..70bbd1fadcca 100644
--- a/drivers/staging/rtl8192u/r8192U.h
+++ b/drivers/staging/rtl8192u/r8192U.h
@@ -1091,8 +1091,6 @@ bool init_firmware(struct net_device *dev);
 short rtl819xU_tx_cmd(struct net_device *dev, struct sk_buff *skb);
 short rtl8192_tx(struct net_device *dev, struct sk_buff *skb);
 
-u32 read_cam(struct net_device *dev, u8 addr);
-
 int read_nic_byte(struct net_device *dev, int x, u8 *data);
 int read_nic_byte_E(struct net_device *dev, int x, u8 *data);
 int read_nic_dword(struct net_device *dev, int x, u32 *data);
diff --git a/drivers/staging/rtl8192u/r8192U_core.c 
b/drivers/staging/rtl8192u/r8192U_core.c
index caa618a845df..12783b88eb58 100644
--- a/drivers/staging/rtl8192u/r8192U_core.c
+++ b/drivers/staging/rtl8192u/r8192U_core.c
@@ -237,15 +237,6 @@ static void CamResetAllEntry(struct net_device *dev)
write_nic_dword(dev, RWCAM, ulcommand);
 }
 
-u32 read_cam(struct net_device *dev, u8 addr)
-{
-   u32 data;
-
-   write_nic_dword(dev, RWCAM, 0x8000 | (addr & 0xff));
-   read_nic_dword(dev, 0xa8, );
-   return data;
-}
-
 int write_nic_byte_E(struct net_device *dev, int indx, u8 data)
 {
int status;
-- 
2.18.0



[PATCH 01/20] staging:rtl8192u: Remove write_cam() - Style

2018-08-31 Thread John Whitmore
Remove the function write_cam() as it is unused.

Simple style change which should not impact runtime code execution.

Signed-off-by: John Whitmore 
---
 drivers/staging/rtl8192u/r8192U.h  | 1 -
 drivers/staging/rtl8192u/r8192U_core.c | 7 ---
 2 files changed, 8 deletions(-)

diff --git a/drivers/staging/rtl8192u/r8192U.h 
b/drivers/staging/rtl8192u/r8192U.h
index 1b51601df1ee..77324a471de1 100644
--- a/drivers/staging/rtl8192u/r8192U.h
+++ b/drivers/staging/rtl8192u/r8192U.h
@@ -1092,7 +1092,6 @@ short rtl819xU_tx_cmd(struct net_device *dev, struct 
sk_buff *skb);
 short rtl8192_tx(struct net_device *dev, struct sk_buff *skb);
 
 u32 read_cam(struct net_device *dev, u8 addr);
-void write_cam(struct net_device *dev, u8 addr, u32 data);
 
 int read_nic_byte(struct net_device *dev, int x, u8 *data);
 int read_nic_byte_E(struct net_device *dev, int x, u8 *data);
diff --git a/drivers/staging/rtl8192u/r8192U_core.c 
b/drivers/staging/rtl8192u/r8192U_core.c
index 6b22aaa40ff9..caa618a845df 100644
--- a/drivers/staging/rtl8192u/r8192U_core.c
+++ b/drivers/staging/rtl8192u/r8192U_core.c
@@ -237,13 +237,6 @@ static void CamResetAllEntry(struct net_device *dev)
write_nic_dword(dev, RWCAM, ulcommand);
 }
 
-
-void write_cam(struct net_device *dev, u8 addr, u32 data)
-{
-   write_nic_dword(dev, WCAMI, data);
-   write_nic_dword(dev, RWCAM, BIT(31) | BIT(16) | (addr & 0xff));
-}
-
 u32 read_cam(struct net_device *dev, u8 addr)
 {
u32 data;
-- 
2.18.0



[PATCH 12/20] staging:rtl8192u: Rename CCK_Table_length - Style

2018-08-31 Thread John Whitmore
Rename the constant CCK_Table_length to CCK_TABLE_LENGTH, this clears
the checkpatch issue with CamelCase naming.

This is a simple coding style change which should not impact runtime
code execution.

Signed-off-by: John Whitmore 
---
 drivers/staging/rtl8192u/r8192U.h|  2 +-
 drivers/staging/rtl8192u/r8192U_dm.c | 14 +++---
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/rtl8192u/r8192U.h 
b/drivers/staging/rtl8192u/r8192U.h
index 6edbc8146e82..e86a4b35a1f4 100644
--- a/drivers/staging/rtl8192u/r8192U.h
+++ b/drivers/staging/rtl8192u/r8192U.h
@@ -153,7 +153,7 @@ extern u32 rt_global_debug_component;
 #definePHY_BEACON_RSSI_SLID_WIN_MAX10
 /* For Tx Power Tracking */
 #defineOFDM_TABLE_LENGTH   19
-#defineCCK_Table_length12
+#defineCCK_TABLE_LENGTH12
 
 /* For rtl819x */
 struct tx_desc_819x_usb {
diff --git a/drivers/staging/rtl8192u/r8192U_dm.c 
b/drivers/staging/rtl8192u/r8192U_dm.c
index 19b3b11c5edb..874da0620936 100644
--- a/drivers/staging/rtl8192u/r8192U_dm.c
+++ b/drivers/staging/rtl8192u/r8192U_dm.c
@@ -476,7 +476,7 @@ static u32 OFDMSwingTable[OFDM_TABLE_LENGTH] = {
0x1040  /* 18, -12db */
 };
 
-static u8  CCKSwingTable_Ch1_Ch13[CCK_Table_length][8] = {
+static u8  CCKSwingTable_Ch1_Ch13[CCK_TABLE_LENGTH][8] = {
{0x36, 0x35, 0x2e, 0x25, 0x1c, 0x12, 0x09, 0x04},   /* 0, +0db ===> 
CCK40M default */
{0x30, 0x2f, 0x29, 0x21, 0x19, 0x10, 0x08, 0x03},   /* 1, -1db */
{0x2b, 0x2a, 0x25, 0x1e, 0x16, 0x0e, 0x07, 0x03},   /* 2, -2db */
@@ -491,7 +491,7 @@ static u8   CCKSwingTable_Ch1_Ch13[CCK_Table_length][8] = {
{0x0f, 0x0f, 0x0d, 0x0b, 0x08, 0x05, 0x03, 0x01}/* 11, -11db */
 };
 
-static u8  CCKSwingTable_Ch14[CCK_Table_length][8] = {
+static u8  CCKSwingTable_Ch14[CCK_TABLE_LENGTH][8] = {
{0x36, 0x35, 0x2e, 0x1b, 0x00, 0x00, 0x00, 0x00},   /* 0, +0db  
===> CCK40M default */
{0x30, 0x2f, 0x29, 0x18, 0x00, 0x00, 0x00, 0x00},   /* 1, -1db */
{0x2b, 0x2a, 0x25, 0x15, 0x00, 0x00, 0x00, 0x00},   /* 2, -2db */
@@ -682,7 +682,7 @@ static void dm_TXPowerTrackingCallback_ThermalMeter(struct 
net_device *dev)
 
/* Query CCK default setting From 0xa22 */
TempCCk = rtl8192_QueryBBReg(dev, rCCK0_TxFilter1, bMaskByte2);
-   for (i = 0; i < CCK_Table_length; i++) {
+   for (i = 0; i < CCK_TABLE_LENGTH; i++) {
if (TempCCk == (u32)CCKSwingTable_Ch1_Ch13[i][0]) {
priv->CCK_index = (u8) i;
RT_TRACE(COMP_POWER_TRACKING, "Initial reg0x%x 
= 0x%x, CCK_index=0x%x\n",
@@ -718,10 +718,10 @@ static void 
dm_TXPowerTrackingCallback_ThermalMeter(struct net_device *dev)
tmpCCK40Mindex = tmpCCK20Mindex - 6;
if (tmpOFDMindex >= OFDM_TABLE_LENGTH)
tmpOFDMindex = OFDM_TABLE_LENGTH - 1;
-   if (tmpCCK20Mindex >= CCK_Table_length)
-   tmpCCK20Mindex = CCK_Table_length-1;
-   if (tmpCCK40Mindex >= CCK_Table_length)
-   tmpCCK40Mindex = CCK_Table_length-1;
+   if (tmpCCK20Mindex >= CCK_TABLE_LENGTH)
+   tmpCCK20Mindex = CCK_TABLE_LENGTH - 1;
+   if (tmpCCK40Mindex >= CCK_TABLE_LENGTH)
+   tmpCCK40Mindex = CCK_TABLE_LENGTH - 1;
} else {
tmpval = (u8)tmpRegA - priv->ThermalMeter[0];
 
-- 
2.18.0



[PATCH 16/20] staging:rtl8192u: Rename CmdInit - Style

2018-08-31 Thread John Whitmore
Rename the member variable 'CmdInit, to 'cmd_init', this change
clears the checkpatch issue with CamelCase naming.

This is a simple coding style change which should have no impact on
runtime code execution.

Signed-off-by: John Whitmore 
---
 drivers/staging/rtl8192u/r8192U.h  | 2 +-
 drivers/staging/rtl8192u/r8192U_core.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/rtl8192u/r8192U.h 
b/drivers/staging/rtl8192u/r8192U.h
index 5d643870a1e3..4d29b7427a0e 100644
--- a/drivers/staging/rtl8192u/r8192U.h
+++ b/drivers/staging/rtl8192u/r8192U.h
@@ -161,7 +161,7 @@ struct tx_desc_819x_usb {
u16 pkt_size;
u8  offset;
u8  reserved0:3;
-   u8  CmdInit:1;
+   u8  cmd_init:1;
u8  LastSeg:1;
u8  FirstSeg:1;
u8  LINIP:1;
diff --git a/drivers/staging/rtl8192u/r8192U_core.c 
b/drivers/staging/rtl8192u/r8192U_core.c
index d4af6cc01fc6..b385c686370b 100644
--- a/drivers/staging/rtl8192u/r8192U_core.c
+++ b/drivers/staging/rtl8192u/r8192U_core.c
@@ -1515,7 +1515,7 @@ short rtl8192_tx(struct net_device *dev, struct sk_buff 
*skb)
memset(tx_desc, 0, sizeof(struct tx_desc_819x_usb));
/* DWORD 0 */
tx_desc->LINIP = 0;
-   tx_desc->CmdInit = 1;
+   tx_desc->cmd_init = 1;
tx_desc->offset =  sizeof(struct tx_fwinfo_819x_usb) + 8;
tx_desc->pkt_size = (skb->len - TX_PACKET_SHIFT_BYTES) & 0x;
 
-- 
2.18.0



[PATCH 19/20] staging:rtl8192u: Rename LINIP - Style

2018-08-31 Thread John Whitmore
Rename the member variable 'LINIP' to 'linip', this change is to
conform to the coding style guidelines, member variables in
lowercase.

This is a simple coding style change which should not impact runtime
code execution.

Signed-off-by: John Whitmore 
---
 drivers/staging/rtl8192u/r8192U.h  | 2 +-
 drivers/staging/rtl8192u/r8192U_core.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/rtl8192u/r8192U.h 
b/drivers/staging/rtl8192u/r8192U.h
index 66efa59eabf0..68e82b32a88e 100644
--- a/drivers/staging/rtl8192u/r8192U.h
+++ b/drivers/staging/rtl8192u/r8192U.h
@@ -164,7 +164,7 @@ struct tx_desc_819x_usb {
u8  cmd_init:1;
u8  last_seg:1;
u8  first_seg:1;
-   u8  LINIP:1;
+   u8  linip:1;
u8  OWN:1;
 
/* DWORD 1 */
diff --git a/drivers/staging/rtl8192u/r8192U_core.c 
b/drivers/staging/rtl8192u/r8192U_core.c
index a4d1b55a1117..911d0214b48a 100644
--- a/drivers/staging/rtl8192u/r8192U_core.c
+++ b/drivers/staging/rtl8192u/r8192U_core.c
@@ -1514,7 +1514,7 @@ short rtl8192_tx(struct net_device *dev, struct sk_buff 
*skb)
/* Fill Tx descriptor */
memset(tx_desc, 0, sizeof(struct tx_desc_819x_usb));
/* DWORD 0 */
-   tx_desc->LINIP = 0;
+   tx_desc->linip = 0;
tx_desc->cmd_init = 1;
tx_desc->offset =  sizeof(struct tx_fwinfo_819x_usb) + 8;
tx_desc->pkt_size = (skb->len - TX_PACKET_SHIFT_BYTES) & 0x;
-- 
2.18.0



[PATCH 14/20] staging:rtl8192u: Rename Offset - Style

2018-08-31 Thread John Whitmore
Rename the member variable 'Offset' to 'offset', this clears the
checkpatch issue with CamelCase naming.

This is a coding style change which should not impact runtime code
execution.

Signed-off-by: John Whitmore 
---
 drivers/staging/rtl8192u/r8192U.h  | 2 +-
 drivers/staging/rtl8192u/r8192U_core.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/rtl8192u/r8192U.h 
b/drivers/staging/rtl8192u/r8192U.h
index 9931ede1524b..8aaea1d8cf50 100644
--- a/drivers/staging/rtl8192u/r8192U.h
+++ b/drivers/staging/rtl8192u/r8192U.h
@@ -159,7 +159,7 @@ extern u32 rt_global_debug_component;
 struct tx_desc_819x_usb {
/* DWORD 0 */
u16 pkt_size;
-   u8  Offset;
+   u8  offset;
u8  Reserved0:3;
u8  CmdInit:1;
u8  LastSeg:1;
diff --git a/drivers/staging/rtl8192u/r8192U_core.c 
b/drivers/staging/rtl8192u/r8192U_core.c
index 2a3cb0f1ac07..d4af6cc01fc6 100644
--- a/drivers/staging/rtl8192u/r8192U_core.c
+++ b/drivers/staging/rtl8192u/r8192U_core.c
@@ -1516,7 +1516,7 @@ short rtl8192_tx(struct net_device *dev, struct sk_buff 
*skb)
/* DWORD 0 */
tx_desc->LINIP = 0;
tx_desc->CmdInit = 1;
-   tx_desc->Offset =  sizeof(struct tx_fwinfo_819x_usb) + 8;
+   tx_desc->offset =  sizeof(struct tx_fwinfo_819x_usb) + 8;
tx_desc->pkt_size = (skb->len - TX_PACKET_SHIFT_BYTES) & 0x;
 
/*DWORD 1*/
-- 
2.18.0



[PATCH 06/20] staging:rtl8192u: Rename Rx_Smooth_Factor - Style

2018-08-31 Thread John Whitmore
Rename the MACRO Rx_Smooth_Factor to RX_SMOOTH_FACTOR, this clears the
checkpatch issue with CamelCase naming.

This is a coding style change which should have no impact on runtime
code execution.

Signed-off-by: John Whitmore 
---
 drivers/staging/rtl8192u/r8192U.h  |  2 +-
 drivers/staging/rtl8192u/r8192U_core.c | 20 ++--
 2 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/drivers/staging/rtl8192u/r8192U.h 
b/drivers/staging/rtl8192u/r8192U.h
index 81a7072a6285..b5ad69af8dac 100644
--- a/drivers/staging/rtl8192u/r8192U.h
+++ b/drivers/staging/rtl8192u/r8192U.h
@@ -45,7 +45,7 @@
 #define MAX_KEY_LEN 61
 #define KEY_BUF_SIZE5
 
-#defineRx_Smooth_Factor20
+#defineRX_SMOOTH_FACTOR20
 #define DMESG(x, a...)
 #define DMESGW(x, a...)
 #define DMESGE(x, a...)
diff --git a/drivers/staging/rtl8192u/r8192U_core.c 
b/drivers/staging/rtl8192u/r8192U_core.c
index b3d32ea29fee..dd87cee6604b 100644
--- a/drivers/staging/rtl8192u/r8192U_core.c
+++ b/drivers/staging/rtl8192u/r8192U_core.c
@@ -3975,13 +3975,13 @@ static void rtl8192_process_phyinfo(struct r8192_priv 
*priv, u8 *buffer,

pprevious_stats->RxMIMOSignalStrength[rfpath];
if (pprevious_stats->RxMIMOSignalStrength[rfpath]  > 
priv->stats.rx_rssi_percentage[rfpath]) {
priv->stats.rx_rssi_percentage[rfpath] =
-   
((priv->stats.rx_rssi_percentage[rfpath] * (Rx_Smooth_Factor - 1)) +
-
(pprevious_stats->RxMIMOSignalStrength[rfpath])) / (Rx_Smooth_Factor);
+   
((priv->stats.rx_rssi_percentage[rfpath] * (RX_SMOOTH_FACTOR - 1)) +
+
(pprevious_stats->RxMIMOSignalStrength[rfpath])) / (RX_SMOOTH_FACTOR);
priv->stats.rx_rssi_percentage[rfpath] = 
priv->stats.rx_rssi_percentage[rfpath]  + 1;
} else {
priv->stats.rx_rssi_percentage[rfpath] =
-   
((priv->stats.rx_rssi_percentage[rfpath] * (Rx_Smooth_Factor - 1)) +
-
(pprevious_stats->RxMIMOSignalStrength[rfpath])) / (Rx_Smooth_Factor);
+   
((priv->stats.rx_rssi_percentage[rfpath] * (RX_SMOOTH_FACTOR - 1)) +
+
(pprevious_stats->RxMIMOSignalStrength[rfpath])) / (RX_SMOOTH_FACTOR);
}
RT_TRACE(COMP_DBG,
 "priv->stats.rx_rssi_percentage[rfPath]  = 
%d\n",
@@ -4026,13 +4026,13 @@ static void rtl8192_process_phyinfo(struct r8192_priv 
*priv, u8 *buffer,
pprevious_stats->RxPWDBAll;
if (pprevious_stats->RxPWDBAll > 
(u32)priv->undecorated_smoothed_pwdb) {
priv->undecorated_smoothed_pwdb =
-   (((priv->undecorated_smoothed_pwdb) * 
(Rx_Smooth_Factor - 1)) +
-(pprevious_stats->RxPWDBAll)) / 
(Rx_Smooth_Factor);
+   (((priv->undecorated_smoothed_pwdb) * 
(RX_SMOOTH_FACTOR - 1)) +
+(pprevious_stats->RxPWDBAll)) / 
(RX_SMOOTH_FACTOR);
priv->undecorated_smoothed_pwdb = 
priv->undecorated_smoothed_pwdb + 1;
} else {
priv->undecorated_smoothed_pwdb =
-   (((priv->undecorated_smoothed_pwdb) * 
(Rx_Smooth_Factor - 1)) +
-(pprevious_stats->RxPWDBAll)) / 
(Rx_Smooth_Factor);
+   (((priv->undecorated_smoothed_pwdb) * 
(RX_SMOOTH_FACTOR - 1)) +
+(pprevious_stats->RxPWDBAll)) / 
(RX_SMOOTH_FACTOR);
}
}
 
@@ -4075,8 +4075,8 @@ static void rtl8192_process_phyinfo(struct r8192_priv 
*priv, u8 *buffer,
if 
(priv->stats.rx_evm_percentage[nspatial_stream] == 0) /* initialize */

priv->stats.rx_evm_percentage[nspatial_stream] = 
pprevious_stats->RxMIMOSignalQuality[nspatial_stream];

priv->stats.rx_evm_percentage[nspatial_stream] =
-   
((priv->stats.rx_evm_percentage[nspatial_stream] * (Rx_Smooth_Factor - 1)) +
-
(pprevious_stats->RxMIMOSignalQuality[nspatial_stream] * 1)) / 
(Rx_Smooth_Factor);
+   
((priv->stats.rx_evm_percentage[nspatial_stream] * (RX_SMOOTH_FACTOR - 1)) +
+
(pprevious_stats->RxMIMOSignalQuality[nspatial_stream] * 1)) / 
(RX_SMOOTH_FACTOR);
}

[PATCH 04/20] staging:rtl8192u: Add SPDX-License-Identifier - Style

2018-08-31 Thread John Whitmore
Add SPDX-License-Identifier tag to the start of header file. This is
a coding style change which should have no impact on runtime code
execution.

Signed-off-by: John Whitmore 
---
 drivers/staging/rtl8192u/r8192U.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/staging/rtl8192u/r8192U.h 
b/drivers/staging/rtl8192u/r8192U.h
index b3e6ce2acedb..4dcfcb4d3911 100644
--- a/drivers/staging/rtl8192u/r8192U.h
+++ b/drivers/staging/rtl8192u/r8192U.h
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: GPL-2.0 */
 /*
  * This is part of rtl8187 OpenSource driver.
  * Copyright (C) Andrea Merello 2004-2005  
-- 
2.18.0



[PATCH 11/20] staging:rtl8192u: Rename OFDM_Table_Length - Style

2018-08-31 Thread John Whitmore
Rename the defined constant OFDM_Table_Length to OFDM_TABLE_LENGTH,
this clears the checkpatch issue with CamelCase naming.

This is a simple coding style change which should not impact runtime
code execution.

Signed-off-by: John Whitmore 
---
 drivers/staging/rtl8192u/r8192U.h| 2 +-
 drivers/staging/rtl8192u/r8192U_dm.c | 8 
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/rtl8192u/r8192U.h 
b/drivers/staging/rtl8192u/r8192U.h
index 87c1a69b2e1c..6edbc8146e82 100644
--- a/drivers/staging/rtl8192u/r8192U.h
+++ b/drivers/staging/rtl8192u/r8192U.h
@@ -152,7 +152,7 @@ extern u32 rt_global_debug_component;
 #define IEEE80211_WATCH_DOG_TIME2000
 #definePHY_BEACON_RSSI_SLID_WIN_MAX10
 /* For Tx Power Tracking */
-#defineOFDM_Table_Length   19
+#defineOFDM_TABLE_LENGTH   19
 #defineCCK_Table_length12
 
 /* For rtl819x */
diff --git a/drivers/staging/rtl8192u/r8192U_dm.c 
b/drivers/staging/rtl8192u/r8192U_dm.c
index 5fb5f583f703..19b3b11c5edb 100644
--- a/drivers/staging/rtl8192u/r8192U_dm.c
+++ b/drivers/staging/rtl8192u/r8192U_dm.c
@@ -454,7 +454,7 @@ static void dm_bandwidth_autoswitch(struct net_device *dev)
 }  /* dm_BandwidthAutoSwitch */
 
 /* OFDM default at 0db, index=6. */
-static u32 OFDMSwingTable[OFDM_Table_Length] = {
+static u32 OFDMSwingTable[OFDM_TABLE_LENGTH] = {
0x7f8001fe, /* 0, +6db */
0x71c001c7, /* 1, +5db */
0x65400195, /* 2, +4db */
@@ -672,7 +672,7 @@ static void dm_TXPowerTrackingCallback_ThermalMeter(struct 
net_device *dev)
if (!priv->btxpower_trackingInit) {
/* Query OFDM default setting */
tmpRegA = rtl8192_QueryBBReg(dev, rOFDM0_XATxIQImbalance, 
bMaskDWord);
-   for (i = 0; i < OFDM_Table_Length; i++) { /* find the index */
+   for (i = 0; i < OFDM_TABLE_LENGTH; i++) { /* find the index */
if (tmpRegA == OFDMSwingTable[i]) {
priv->OFDM_index = (u8)i;
RT_TRACE(COMP_POWER_TRACKING, "Initial reg0x%x 
= 0x%x, OFDM_index=0x%x\n",
@@ -716,8 +716,8 @@ static void dm_TXPowerTrackingCallback_ThermalMeter(struct 
net_device *dev)
if (priv->ThermalMeter[0] >= (u8)tmpRegA) { /* lower temperature */
tmpOFDMindex = tmpCCK20Mindex = 
6+(priv->ThermalMeter[0]-(u8)tmpRegA);
tmpCCK40Mindex = tmpCCK20Mindex - 6;
-   if (tmpOFDMindex >= OFDM_Table_Length)
-   tmpOFDMindex = OFDM_Table_Length-1;
+   if (tmpOFDMindex >= OFDM_TABLE_LENGTH)
+   tmpOFDMindex = OFDM_TABLE_LENGTH - 1;
if (tmpCCK20Mindex >= CCK_Table_length)
tmpCCK20Mindex = CCK_Table_length-1;
if (tmpCCK40Mindex >= CCK_Table_length)
-- 
2.18.0



[PATCH 00/20] staging:rtl8192u: r8192U.h cleanup - Style

2018-08-31 Thread John Whitmore
Yet another series of patchs to cleanup and clear some checkpatch
isses, this time the file r8192U.h. These are all simple changes
which are mostly renaming variables. A MACRO has been removed as
it's not used in the code, and added SPDX-License-Identifier.

John Whitmore (20):
  staging:rtl8192u: Remove write_cam() - Style
  staging:rtl8192u: Remove read_cam() - Style
  staging:rtl8192u: Remove unused functions - Style
  staging:rtl8192u: Add SPDX-License-Identifier - Style
  staging:rtl8192u: Rename RTL819xU_MODULE_NAME - Style
  staging:rtl8192u: Rename Rx_Smooth_Factor - Style
  staging:rtl8192u: Refactor RT_TRACE - Style
  staging:rtl8192u: Fix space characters - Style
  staging:rtl8192u: Remove RT_DEBUG_DATA - Style
  staging:rtl8192u: Rename PHY_Beacon_RSSI_SLID_WIN_MAX - Style
  staging:rtl8192u: Rename OFDM_Table_Length - Style
  staging:rtl8192u: Rename CCK_Table_length - Style
  staging:rtl8192u: Rename PktSize Style
  staging:rtl8192u: Rename Offset - Style
  staging:rtl8192u: Rename Reserved... structure members - Style
  staging:rtl8192u: Rename CmdInit - Style
  staging:rtl8192u: Rename LastSeg - Style
  staging:rtl8192u: Rename FirstSeg - Style
  staging:rtl8192u: Rename LINIP - Style
  staging:rtl8192u: Rename OWN - Style

 drivers/staging/rtl8192u/r8192U.h  | 82 --
 drivers/staging/rtl8192u/r8192U_core.c | 67 +++--
 drivers/staging/rtl8192u/r8192U_dm.c   | 22 +++
 3 files changed, 58 insertions(+), 113 deletions(-)

-- 
2.18.0



[PATCH 11/20] staging:rtl8192u: Rename OFDM_Table_Length - Style

2018-08-31 Thread John Whitmore
Rename the defined constant OFDM_Table_Length to OFDM_TABLE_LENGTH,
this clears the checkpatch issue with CamelCase naming.

This is a simple coding style change which should not impact runtime
code execution.

Signed-off-by: John Whitmore 
---
 drivers/staging/rtl8192u/r8192U.h| 2 +-
 drivers/staging/rtl8192u/r8192U_dm.c | 8 
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/rtl8192u/r8192U.h 
b/drivers/staging/rtl8192u/r8192U.h
index 87c1a69b2e1c..6edbc8146e82 100644
--- a/drivers/staging/rtl8192u/r8192U.h
+++ b/drivers/staging/rtl8192u/r8192U.h
@@ -152,7 +152,7 @@ extern u32 rt_global_debug_component;
 #define IEEE80211_WATCH_DOG_TIME2000
 #definePHY_BEACON_RSSI_SLID_WIN_MAX10
 /* For Tx Power Tracking */
-#defineOFDM_Table_Length   19
+#defineOFDM_TABLE_LENGTH   19
 #defineCCK_Table_length12
 
 /* For rtl819x */
diff --git a/drivers/staging/rtl8192u/r8192U_dm.c 
b/drivers/staging/rtl8192u/r8192U_dm.c
index 5fb5f583f703..19b3b11c5edb 100644
--- a/drivers/staging/rtl8192u/r8192U_dm.c
+++ b/drivers/staging/rtl8192u/r8192U_dm.c
@@ -454,7 +454,7 @@ static void dm_bandwidth_autoswitch(struct net_device *dev)
 }  /* dm_BandwidthAutoSwitch */
 
 /* OFDM default at 0db, index=6. */
-static u32 OFDMSwingTable[OFDM_Table_Length] = {
+static u32 OFDMSwingTable[OFDM_TABLE_LENGTH] = {
0x7f8001fe, /* 0, +6db */
0x71c001c7, /* 1, +5db */
0x65400195, /* 2, +4db */
@@ -672,7 +672,7 @@ static void dm_TXPowerTrackingCallback_ThermalMeter(struct 
net_device *dev)
if (!priv->btxpower_trackingInit) {
/* Query OFDM default setting */
tmpRegA = rtl8192_QueryBBReg(dev, rOFDM0_XATxIQImbalance, 
bMaskDWord);
-   for (i = 0; i < OFDM_Table_Length; i++) { /* find the index */
+   for (i = 0; i < OFDM_TABLE_LENGTH; i++) { /* find the index */
if (tmpRegA == OFDMSwingTable[i]) {
priv->OFDM_index = (u8)i;
RT_TRACE(COMP_POWER_TRACKING, "Initial reg0x%x 
= 0x%x, OFDM_index=0x%x\n",
@@ -716,8 +716,8 @@ static void dm_TXPowerTrackingCallback_ThermalMeter(struct 
net_device *dev)
if (priv->ThermalMeter[0] >= (u8)tmpRegA) { /* lower temperature */
tmpOFDMindex = tmpCCK20Mindex = 
6+(priv->ThermalMeter[0]-(u8)tmpRegA);
tmpCCK40Mindex = tmpCCK20Mindex - 6;
-   if (tmpOFDMindex >= OFDM_Table_Length)
-   tmpOFDMindex = OFDM_Table_Length-1;
+   if (tmpOFDMindex >= OFDM_TABLE_LENGTH)
+   tmpOFDMindex = OFDM_TABLE_LENGTH - 1;
if (tmpCCK20Mindex >= CCK_Table_length)
tmpCCK20Mindex = CCK_Table_length-1;
if (tmpCCK40Mindex >= CCK_Table_length)
-- 
2.18.0



[PATCH 00/20] staging:rtl8192u: r8192U.h cleanup - Style

2018-08-31 Thread John Whitmore
Yet another series of patchs to cleanup and clear some checkpatch
isses, this time the file r8192U.h. These are all simple changes
which are mostly renaming variables. A MACRO has been removed as
it's not used in the code, and added SPDX-License-Identifier.

John Whitmore (20):
  staging:rtl8192u: Remove write_cam() - Style
  staging:rtl8192u: Remove read_cam() - Style
  staging:rtl8192u: Remove unused functions - Style
  staging:rtl8192u: Add SPDX-License-Identifier - Style
  staging:rtl8192u: Rename RTL819xU_MODULE_NAME - Style
  staging:rtl8192u: Rename Rx_Smooth_Factor - Style
  staging:rtl8192u: Refactor RT_TRACE - Style
  staging:rtl8192u: Fix space characters - Style
  staging:rtl8192u: Remove RT_DEBUG_DATA - Style
  staging:rtl8192u: Rename PHY_Beacon_RSSI_SLID_WIN_MAX - Style
  staging:rtl8192u: Rename OFDM_Table_Length - Style
  staging:rtl8192u: Rename CCK_Table_length - Style
  staging:rtl8192u: Rename PktSize Style
  staging:rtl8192u: Rename Offset - Style
  staging:rtl8192u: Rename Reserved... structure members - Style
  staging:rtl8192u: Rename CmdInit - Style
  staging:rtl8192u: Rename LastSeg - Style
  staging:rtl8192u: Rename FirstSeg - Style
  staging:rtl8192u: Rename LINIP - Style
  staging:rtl8192u: Rename OWN - Style

 drivers/staging/rtl8192u/r8192U.h  | 82 --
 drivers/staging/rtl8192u/r8192U_core.c | 67 +++--
 drivers/staging/rtl8192u/r8192U_dm.c   | 22 +++
 3 files changed, 58 insertions(+), 113 deletions(-)

-- 
2.18.0



[PATCH 08/20] staging:rtl8192u: Fix space characters - Style

2018-08-31 Thread John Whitmore
Fix the spacing issues, remove space after cast operation, and replace
spaces at start of line with tab.

These changes are purely coding style changes to resolve checkpatch
issues. There should be no impact on runtime code execution.

Signed-off-by: John Whitmore 
---
 drivers/staging/rtl8192u/r8192U.h | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/rtl8192u/r8192U.h 
b/drivers/staging/rtl8192u/r8192U.h
index c613894a6088..e65a893fd084 100644
--- a/drivers/staging/rtl8192u/r8192U.h
+++ b/drivers/staging/rtl8192u/r8192U.h
@@ -112,7 +112,7 @@ extern u32 rt_global_debug_component;
do {\
if ((rt_global_debug_component & (level)) == (level)) { \
int i;  \
-   u8 *pdata = (u8 *) data;\
+   u8 *pdata = (u8 *)data; \
pr_debug("RTL8192U: %s()\n", __func__); \
for (i = 0; i < (int)(datalen); i++) {  \
printk("%2x ", pdata[i]);   \
@@ -877,9 +877,9 @@ typedef struct r8192_priv {
int rx_inx;
 #endif
 
-   struct sk_buff_head rx_queue;
-   struct sk_buff_head skb_queue;
-   struct work_struct qos_activate;
+   struct sk_buff_head rx_queue;
+   struct sk_buff_head skb_queue;
+   struct work_struct qos_activate;
short  tx_urb_index;
atomic_t tx_pending[0x10]; /* UART_PRIORITY + 1 */
 
@@ -1027,7 +1027,7 @@ typedef struct r8192_priv {
u8  nrxAMPDU_aggr_num;
 
/* For gpio */
-bool bHwRadioOff;
+   bool bHwRadioOff;
 
u32 reset_count;
bool bpbc_pressed;
-- 
2.18.0



[PATCH 10/20] staging:rtl8192u: Rename PHY_Beacon_RSSI_SLID_WIN_MAX - Style

2018-08-31 Thread John Whitmore
Rename the Macro PHY_Beacon_RSSI_SLID_WIN_MAX to
PHY_BEACON_RSSI_SLID_WIN_MAX, this clears the checkpatch issue with
CamelCase naming.

This is purely a coding style change which should not impact runtime
code execution.

Signed-off-by: John Whitmore 
---
 drivers/staging/rtl8192u/r8192U.h  | 2 +-
 drivers/staging/rtl8192u/r8192U_core.c | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/rtl8192u/r8192U.h 
b/drivers/staging/rtl8192u/r8192U.h
index 528c50be3894..87c1a69b2e1c 100644
--- a/drivers/staging/rtl8192u/r8192U.h
+++ b/drivers/staging/rtl8192u/r8192U.h
@@ -150,7 +150,7 @@ extern u32 rt_global_debug_component;
 #define RTL819X_DEFAULT_RF_TYPE RF_1T2R
 
 #define IEEE80211_WATCH_DOG_TIME2000
-#definePHY_Beacon_RSSI_SLID_WIN_MAX10
+#definePHY_BEACON_RSSI_SLID_WIN_MAX10
 /* For Tx Power Tracking */
 #defineOFDM_Table_Length   19
 #defineCCK_Table_length12
diff --git a/drivers/staging/rtl8192u/r8192U_core.c 
b/drivers/staging/rtl8192u/r8192U_core.c
index dd87cee6604b..4d43176bdb6c 100644
--- a/drivers/staging/rtl8192u/r8192U_core.c
+++ b/drivers/staging/rtl8192u/r8192U_core.c
@@ -3997,15 +3997,15 @@ static void rtl8192_process_phyinfo(struct r8192_priv 
*priv, u8 *buffer,
 
if (pprevious_stats->bPacketBeacon) {
/* record the beacon pwdb to the sliding window. */
-   if (slide_beacon_adc_pwdb_statistics++ >= 
PHY_Beacon_RSSI_SLID_WIN_MAX) {
-   slide_beacon_adc_pwdb_statistics = 
PHY_Beacon_RSSI_SLID_WIN_MAX;
+   if (slide_beacon_adc_pwdb_statistics++ >= 
PHY_BEACON_RSSI_SLID_WIN_MAX) {
+   slide_beacon_adc_pwdb_statistics = 
PHY_BEACON_RSSI_SLID_WIN_MAX;
last_beacon_adc_pwdb = 
priv->stats.Slide_Beacon_pwdb[slide_beacon_adc_pwdb_index];
priv->stats.Slide_Beacon_Total -= last_beacon_adc_pwdb;
}
priv->stats.Slide_Beacon_Total += pprevious_stats->RxPWDBAll;
priv->stats.Slide_Beacon_pwdb[slide_beacon_adc_pwdb_index] = 
pprevious_stats->RxPWDBAll;
slide_beacon_adc_pwdb_index++;
-   if (slide_beacon_adc_pwdb_index >= PHY_Beacon_RSSI_SLID_WIN_MAX)
+   if (slide_beacon_adc_pwdb_index >= PHY_BEACON_RSSI_SLID_WIN_MAX)
slide_beacon_adc_pwdb_index = 0;
pprevious_stats->RxPWDBAll = priv->stats.Slide_Beacon_Total / 
slide_beacon_adc_pwdb_statistics;
if (pprevious_stats->RxPWDBAll >= 3)
-- 
2.18.0



[PATCH 13/20] staging:rtl8192u: Rename PktSize Style

2018-08-31 Thread John Whitmore
Rename the member variable 'PktSize' to 'pkt_size', this change
clears the checkpatch issue with CamelCase naming.

This is a simple coding style change which should not impact runtime
code execution.

Signed-off-by: John Whitmore 
---
 drivers/staging/rtl8192u/r8192U.h  | 2 +-
 drivers/staging/rtl8192u/r8192U_core.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/rtl8192u/r8192U.h 
b/drivers/staging/rtl8192u/r8192U.h
index e86a4b35a1f4..9931ede1524b 100644
--- a/drivers/staging/rtl8192u/r8192U.h
+++ b/drivers/staging/rtl8192u/r8192U.h
@@ -158,7 +158,7 @@ extern u32 rt_global_debug_component;
 /* For rtl819x */
 struct tx_desc_819x_usb {
/* DWORD 0 */
-   u16 PktSize;
+   u16 pkt_size;
u8  Offset;
u8  Reserved0:3;
u8  CmdInit:1;
diff --git a/drivers/staging/rtl8192u/r8192U_core.c 
b/drivers/staging/rtl8192u/r8192U_core.c
index 4d43176bdb6c..2a3cb0f1ac07 100644
--- a/drivers/staging/rtl8192u/r8192U_core.c
+++ b/drivers/staging/rtl8192u/r8192U_core.c
@@ -1517,7 +1517,7 @@ short rtl8192_tx(struct net_device *dev, struct sk_buff 
*skb)
tx_desc->LINIP = 0;
tx_desc->CmdInit = 1;
tx_desc->Offset =  sizeof(struct tx_fwinfo_819x_usb) + 8;
-   tx_desc->PktSize = (skb->len - TX_PACKET_SHIFT_BYTES) & 0x;
+   tx_desc->pkt_size = (skb->len - TX_PACKET_SHIFT_BYTES) & 0x;
 
/*DWORD 1*/
tx_desc->SecCAMID = 0;
-- 
2.18.0



[PATCH 17/20] staging:rtl8192u: Rename LastSeg - Style

2018-08-31 Thread John Whitmore
Rename the member variable 'LastSeg' to 'last_seg', this change
clears the checkpatch issue with CamelCase naming.

This is a simple coding style change which should not impact runtime
code execution.

Signed-off-by: John Whitmore 
---
 drivers/staging/rtl8192u/r8192U.h  | 2 +-
 drivers/staging/rtl8192u/r8192U_core.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/rtl8192u/r8192U.h 
b/drivers/staging/rtl8192u/r8192U.h
index 4d29b7427a0e..672cbfa688f7 100644
--- a/drivers/staging/rtl8192u/r8192U.h
+++ b/drivers/staging/rtl8192u/r8192U.h
@@ -162,7 +162,7 @@ struct tx_desc_819x_usb {
u8  offset;
u8  reserved0:3;
u8  cmd_init:1;
-   u8  LastSeg:1;
+   u8  last_seg:1;
u8  FirstSeg:1;
u8  LINIP:1;
u8  OWN:1;
diff --git a/drivers/staging/rtl8192u/r8192U_core.c 
b/drivers/staging/rtl8192u/r8192U_core.c
index b385c686370b..dfbba1177470 100644
--- a/drivers/staging/rtl8192u/r8192U_core.c
+++ b/drivers/staging/rtl8192u/r8192U_core.c
@@ -1557,7 +1557,7 @@ short rtl8192_tx(struct net_device *dev, struct sk_buff 
*skb)
 */
/* DWORD 0 */
tx_desc->FirstSeg = 1;
-   tx_desc->LastSeg = 1;
+   tx_desc->last_seg = 1;
tx_desc->OWN = 1;
 
/* DWORD 2 */
-- 
2.18.0



[PATCH 18/20] staging:rtl8192u: Rename FirstSeg - Style

2018-08-31 Thread John Whitmore
Rename the member variable 'FirstSeg' to 'first_seg', this change
clears the checkpatch issue with CamelCase naming.

This is a simple coding style change and as such should not impact
runtime code execution.

Signed-off-by: John Whitmore 
---
 drivers/staging/rtl8192u/r8192U.h  | 2 +-
 drivers/staging/rtl8192u/r8192U_core.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/rtl8192u/r8192U.h 
b/drivers/staging/rtl8192u/r8192U.h
index 672cbfa688f7..66efa59eabf0 100644
--- a/drivers/staging/rtl8192u/r8192U.h
+++ b/drivers/staging/rtl8192u/r8192U.h
@@ -163,7 +163,7 @@ struct tx_desc_819x_usb {
u8  reserved0:3;
u8  cmd_init:1;
u8  last_seg:1;
-   u8  FirstSeg:1;
+   u8  first_seg:1;
u8  LINIP:1;
u8  OWN:1;
 
diff --git a/drivers/staging/rtl8192u/r8192U_core.c 
b/drivers/staging/rtl8192u/r8192U_core.c
index dfbba1177470..a4d1b55a1117 100644
--- a/drivers/staging/rtl8192u/r8192U_core.c
+++ b/drivers/staging/rtl8192u/r8192U_core.c
@@ -1556,7 +1556,7 @@ short rtl8192_tx(struct net_device *dev, struct sk_buff 
*skb)
 * all of the descriptors
 */
/* DWORD 0 */
-   tx_desc->FirstSeg = 1;
+   tx_desc->first_seg = 1;
tx_desc->last_seg = 1;
tx_desc->OWN = 1;
 
-- 
2.18.0



[PATCH 15/20] staging:rtl8192u: Rename Reserved... structure members - Style

2018-08-31 Thread John Whitmore
Rename the 'Reserved...' members of the 'tx_desc_819x_usb' structure
to 'reserved...'. This change clears the checkpatch issue with
CamelCase naming.

This is a simple coding style change which should not impact runtime
code execution.

Signed-off-by: John Whitmore 
---
 drivers/staging/rtl8192u/r8192U.h | 14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/rtl8192u/r8192U.h 
b/drivers/staging/rtl8192u/r8192U.h
index 8aaea1d8cf50..5d643870a1e3 100644
--- a/drivers/staging/rtl8192u/r8192U.h
+++ b/drivers/staging/rtl8192u/r8192U.h
@@ -160,7 +160,7 @@ struct tx_desc_819x_usb {
/* DWORD 0 */
u16 pkt_size;
u8  offset;
-   u8  Reserved0:3;
+   u8  reserved0:3;
u8  CmdInit:1;
u8  LastSeg:1;
u8  FirstSeg:1;
@@ -177,7 +177,7 @@ struct tx_desc_819x_usb {
u8  PIFS:1;
u8  QueueSelect:5;
u8  NoACM:1;
-   u8  Reserved1:2;
+   u8  reserved1:2;
u8  SecCAMID:5;
u8  SecDescAssign:1;
u8  SecType:2;
@@ -185,13 +185,13 @@ struct tx_desc_819x_usb {
/* DWORD 2 */
u16 TxBufferSize;
u8  ResvForPaddingLen:7;
-   u8  Reserved3:1;
-   u8  Reserved4;
+   u8  reserved3:1;
+   u8  reserved4;
 
/* DWORD 3, 4, 5 */
-   u32 Reserved5;
-   u32 Reserved6;
-   u32 Reserved7;
+   u32 reserved5;
+   u32 reserved6;
+   u32 reserved7;
 };
 
 struct tx_desc_cmd_819x_usb {
-- 
2.18.0



[PATCH 08/20] staging:rtl8192u: Fix space characters - Style

2018-08-31 Thread John Whitmore
Fix the spacing issues, remove space after cast operation, and replace
spaces at start of line with tab.

These changes are purely coding style changes to resolve checkpatch
issues. There should be no impact on runtime code execution.

Signed-off-by: John Whitmore 
---
 drivers/staging/rtl8192u/r8192U.h | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/rtl8192u/r8192U.h 
b/drivers/staging/rtl8192u/r8192U.h
index c613894a6088..e65a893fd084 100644
--- a/drivers/staging/rtl8192u/r8192U.h
+++ b/drivers/staging/rtl8192u/r8192U.h
@@ -112,7 +112,7 @@ extern u32 rt_global_debug_component;
do {\
if ((rt_global_debug_component & (level)) == (level)) { \
int i;  \
-   u8 *pdata = (u8 *) data;\
+   u8 *pdata = (u8 *)data; \
pr_debug("RTL8192U: %s()\n", __func__); \
for (i = 0; i < (int)(datalen); i++) {  \
printk("%2x ", pdata[i]);   \
@@ -877,9 +877,9 @@ typedef struct r8192_priv {
int rx_inx;
 #endif
 
-   struct sk_buff_head rx_queue;
-   struct sk_buff_head skb_queue;
-   struct work_struct qos_activate;
+   struct sk_buff_head rx_queue;
+   struct sk_buff_head skb_queue;
+   struct work_struct qos_activate;
short  tx_urb_index;
atomic_t tx_pending[0x10]; /* UART_PRIORITY + 1 */
 
@@ -1027,7 +1027,7 @@ typedef struct r8192_priv {
u8  nrxAMPDU_aggr_num;
 
/* For gpio */
-bool bHwRadioOff;
+   bool bHwRadioOff;
 
u32 reset_count;
bool bpbc_pressed;
-- 
2.18.0



[PATCH 10/20] staging:rtl8192u: Rename PHY_Beacon_RSSI_SLID_WIN_MAX - Style

2018-08-31 Thread John Whitmore
Rename the Macro PHY_Beacon_RSSI_SLID_WIN_MAX to
PHY_BEACON_RSSI_SLID_WIN_MAX, this clears the checkpatch issue with
CamelCase naming.

This is purely a coding style change which should not impact runtime
code execution.

Signed-off-by: John Whitmore 
---
 drivers/staging/rtl8192u/r8192U.h  | 2 +-
 drivers/staging/rtl8192u/r8192U_core.c | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/rtl8192u/r8192U.h 
b/drivers/staging/rtl8192u/r8192U.h
index 528c50be3894..87c1a69b2e1c 100644
--- a/drivers/staging/rtl8192u/r8192U.h
+++ b/drivers/staging/rtl8192u/r8192U.h
@@ -150,7 +150,7 @@ extern u32 rt_global_debug_component;
 #define RTL819X_DEFAULT_RF_TYPE RF_1T2R
 
 #define IEEE80211_WATCH_DOG_TIME2000
-#definePHY_Beacon_RSSI_SLID_WIN_MAX10
+#definePHY_BEACON_RSSI_SLID_WIN_MAX10
 /* For Tx Power Tracking */
 #defineOFDM_Table_Length   19
 #defineCCK_Table_length12
diff --git a/drivers/staging/rtl8192u/r8192U_core.c 
b/drivers/staging/rtl8192u/r8192U_core.c
index dd87cee6604b..4d43176bdb6c 100644
--- a/drivers/staging/rtl8192u/r8192U_core.c
+++ b/drivers/staging/rtl8192u/r8192U_core.c
@@ -3997,15 +3997,15 @@ static void rtl8192_process_phyinfo(struct r8192_priv 
*priv, u8 *buffer,
 
if (pprevious_stats->bPacketBeacon) {
/* record the beacon pwdb to the sliding window. */
-   if (slide_beacon_adc_pwdb_statistics++ >= 
PHY_Beacon_RSSI_SLID_WIN_MAX) {
-   slide_beacon_adc_pwdb_statistics = 
PHY_Beacon_RSSI_SLID_WIN_MAX;
+   if (slide_beacon_adc_pwdb_statistics++ >= 
PHY_BEACON_RSSI_SLID_WIN_MAX) {
+   slide_beacon_adc_pwdb_statistics = 
PHY_BEACON_RSSI_SLID_WIN_MAX;
last_beacon_adc_pwdb = 
priv->stats.Slide_Beacon_pwdb[slide_beacon_adc_pwdb_index];
priv->stats.Slide_Beacon_Total -= last_beacon_adc_pwdb;
}
priv->stats.Slide_Beacon_Total += pprevious_stats->RxPWDBAll;
priv->stats.Slide_Beacon_pwdb[slide_beacon_adc_pwdb_index] = 
pprevious_stats->RxPWDBAll;
slide_beacon_adc_pwdb_index++;
-   if (slide_beacon_adc_pwdb_index >= PHY_Beacon_RSSI_SLID_WIN_MAX)
+   if (slide_beacon_adc_pwdb_index >= PHY_BEACON_RSSI_SLID_WIN_MAX)
slide_beacon_adc_pwdb_index = 0;
pprevious_stats->RxPWDBAll = priv->stats.Slide_Beacon_Total / 
slide_beacon_adc_pwdb_statistics;
if (pprevious_stats->RxPWDBAll >= 3)
-- 
2.18.0



[PATCH 13/20] staging:rtl8192u: Rename PktSize Style

2018-08-31 Thread John Whitmore
Rename the member variable 'PktSize' to 'pkt_size', this change
clears the checkpatch issue with CamelCase naming.

This is a simple coding style change which should not impact runtime
code execution.

Signed-off-by: John Whitmore 
---
 drivers/staging/rtl8192u/r8192U.h  | 2 +-
 drivers/staging/rtl8192u/r8192U_core.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/rtl8192u/r8192U.h 
b/drivers/staging/rtl8192u/r8192U.h
index e86a4b35a1f4..9931ede1524b 100644
--- a/drivers/staging/rtl8192u/r8192U.h
+++ b/drivers/staging/rtl8192u/r8192U.h
@@ -158,7 +158,7 @@ extern u32 rt_global_debug_component;
 /* For rtl819x */
 struct tx_desc_819x_usb {
/* DWORD 0 */
-   u16 PktSize;
+   u16 pkt_size;
u8  Offset;
u8  Reserved0:3;
u8  CmdInit:1;
diff --git a/drivers/staging/rtl8192u/r8192U_core.c 
b/drivers/staging/rtl8192u/r8192U_core.c
index 4d43176bdb6c..2a3cb0f1ac07 100644
--- a/drivers/staging/rtl8192u/r8192U_core.c
+++ b/drivers/staging/rtl8192u/r8192U_core.c
@@ -1517,7 +1517,7 @@ short rtl8192_tx(struct net_device *dev, struct sk_buff 
*skb)
tx_desc->LINIP = 0;
tx_desc->CmdInit = 1;
tx_desc->Offset =  sizeof(struct tx_fwinfo_819x_usb) + 8;
-   tx_desc->PktSize = (skb->len - TX_PACKET_SHIFT_BYTES) & 0x;
+   tx_desc->pkt_size = (skb->len - TX_PACKET_SHIFT_BYTES) & 0x;
 
/*DWORD 1*/
tx_desc->SecCAMID = 0;
-- 
2.18.0



[PATCH 17/20] staging:rtl8192u: Rename LastSeg - Style

2018-08-31 Thread John Whitmore
Rename the member variable 'LastSeg' to 'last_seg', this change
clears the checkpatch issue with CamelCase naming.

This is a simple coding style change which should not impact runtime
code execution.

Signed-off-by: John Whitmore 
---
 drivers/staging/rtl8192u/r8192U.h  | 2 +-
 drivers/staging/rtl8192u/r8192U_core.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/rtl8192u/r8192U.h 
b/drivers/staging/rtl8192u/r8192U.h
index 4d29b7427a0e..672cbfa688f7 100644
--- a/drivers/staging/rtl8192u/r8192U.h
+++ b/drivers/staging/rtl8192u/r8192U.h
@@ -162,7 +162,7 @@ struct tx_desc_819x_usb {
u8  offset;
u8  reserved0:3;
u8  cmd_init:1;
-   u8  LastSeg:1;
+   u8  last_seg:1;
u8  FirstSeg:1;
u8  LINIP:1;
u8  OWN:1;
diff --git a/drivers/staging/rtl8192u/r8192U_core.c 
b/drivers/staging/rtl8192u/r8192U_core.c
index b385c686370b..dfbba1177470 100644
--- a/drivers/staging/rtl8192u/r8192U_core.c
+++ b/drivers/staging/rtl8192u/r8192U_core.c
@@ -1557,7 +1557,7 @@ short rtl8192_tx(struct net_device *dev, struct sk_buff 
*skb)
 */
/* DWORD 0 */
tx_desc->FirstSeg = 1;
-   tx_desc->LastSeg = 1;
+   tx_desc->last_seg = 1;
tx_desc->OWN = 1;
 
/* DWORD 2 */
-- 
2.18.0



[PATCH 18/20] staging:rtl8192u: Rename FirstSeg - Style

2018-08-31 Thread John Whitmore
Rename the member variable 'FirstSeg' to 'first_seg', this change
clears the checkpatch issue with CamelCase naming.

This is a simple coding style change and as such should not impact
runtime code execution.

Signed-off-by: John Whitmore 
---
 drivers/staging/rtl8192u/r8192U.h  | 2 +-
 drivers/staging/rtl8192u/r8192U_core.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/rtl8192u/r8192U.h 
b/drivers/staging/rtl8192u/r8192U.h
index 672cbfa688f7..66efa59eabf0 100644
--- a/drivers/staging/rtl8192u/r8192U.h
+++ b/drivers/staging/rtl8192u/r8192U.h
@@ -163,7 +163,7 @@ struct tx_desc_819x_usb {
u8  reserved0:3;
u8  cmd_init:1;
u8  last_seg:1;
-   u8  FirstSeg:1;
+   u8  first_seg:1;
u8  LINIP:1;
u8  OWN:1;
 
diff --git a/drivers/staging/rtl8192u/r8192U_core.c 
b/drivers/staging/rtl8192u/r8192U_core.c
index dfbba1177470..a4d1b55a1117 100644
--- a/drivers/staging/rtl8192u/r8192U_core.c
+++ b/drivers/staging/rtl8192u/r8192U_core.c
@@ -1556,7 +1556,7 @@ short rtl8192_tx(struct net_device *dev, struct sk_buff 
*skb)
 * all of the descriptors
 */
/* DWORD 0 */
-   tx_desc->FirstSeg = 1;
+   tx_desc->first_seg = 1;
tx_desc->last_seg = 1;
tx_desc->OWN = 1;
 
-- 
2.18.0



[PATCH 15/20] staging:rtl8192u: Rename Reserved... structure members - Style

2018-08-31 Thread John Whitmore
Rename the 'Reserved...' members of the 'tx_desc_819x_usb' structure
to 'reserved...'. This change clears the checkpatch issue with
CamelCase naming.

This is a simple coding style change which should not impact runtime
code execution.

Signed-off-by: John Whitmore 
---
 drivers/staging/rtl8192u/r8192U.h | 14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/rtl8192u/r8192U.h 
b/drivers/staging/rtl8192u/r8192U.h
index 8aaea1d8cf50..5d643870a1e3 100644
--- a/drivers/staging/rtl8192u/r8192U.h
+++ b/drivers/staging/rtl8192u/r8192U.h
@@ -160,7 +160,7 @@ struct tx_desc_819x_usb {
/* DWORD 0 */
u16 pkt_size;
u8  offset;
-   u8  Reserved0:3;
+   u8  reserved0:3;
u8  CmdInit:1;
u8  LastSeg:1;
u8  FirstSeg:1;
@@ -177,7 +177,7 @@ struct tx_desc_819x_usb {
u8  PIFS:1;
u8  QueueSelect:5;
u8  NoACM:1;
-   u8  Reserved1:2;
+   u8  reserved1:2;
u8  SecCAMID:5;
u8  SecDescAssign:1;
u8  SecType:2;
@@ -185,13 +185,13 @@ struct tx_desc_819x_usb {
/* DWORD 2 */
u16 TxBufferSize;
u8  ResvForPaddingLen:7;
-   u8  Reserved3:1;
-   u8  Reserved4;
+   u8  reserved3:1;
+   u8  reserved4;
 
/* DWORD 3, 4, 5 */
-   u32 Reserved5;
-   u32 Reserved6;
-   u32 Reserved7;
+   u32 reserved5;
+   u32 reserved6;
+   u32 reserved7;
 };
 
 struct tx_desc_cmd_819x_usb {
-- 
2.18.0



Re: [PATCH 1/3] ARM: dts: qcom: Add SPMI PMIC Arbiter nodes for APQ8084 and MSM8974

2018-08-31 Thread Bjorn Andersson
On Fri 31 Aug 15:46 PDT 2018, Frank Rowand wrote:
> > +   spmi_bus: spmi@fc4cf000 {
> > +   compatible = "qcom,spmi-pmic-arb";
> > +   reg-names = "core", "intr", "cnfg";
> > +   reg = <0xfc4cf000 0x1000>,
> > + <0xfc4cb000 0x1000>,
> > + <0xfc4ca000 0x1000>;
> > +   interrupt-names = "periph_irq";
> 
> > +   interrupts = <0 190 0>;
> 
> The final value in this interrupts property means IRQ_TYPE_NONE.
> 
> A WARN_ON() was added early this year to complain about use of
> IRQ_TYPE_NONE: 83a86fbb5b56 "irqchip/gic: Loudly complain about
> the use of IRQ_TYPE_NONE", resulting in many warnings spewing
> forth when I boot an APQ8074 Dragonboard.  I am trying to
> determine whether the warning is overly aggressive, or whether
> the IRQ TYPE is incorrectly specified for the spmi node.
> 
> The interrupt-parent for the spmi node is intc: interrupt-controller@f900,
> which has compatible = "qcom,msm-qgic2".  I do not know the architecture
> or implementation of this interrupt controller.  Is an IRQ_TYPE_NONE
> valid in this case, or should a specific type be provided?
> 

No, IRQ_TYPE_NONE isn't valid and the WARN_ON() is reasonable.

Please change it to IRQ_TYPE_LEVEL_HIGH. And while you're at it, replace
the first 0 with GIC_SPI.


If you have more of these warnings you can most likely look at e.g.
msm8916 (arm64) to find the right flags.

Regards,
Bjorn


Re: [PATCH 1/3] ARM: dts: qcom: Add SPMI PMIC Arbiter nodes for APQ8084 and MSM8974

2018-08-31 Thread Bjorn Andersson
On Fri 31 Aug 15:46 PDT 2018, Frank Rowand wrote:
> > +   spmi_bus: spmi@fc4cf000 {
> > +   compatible = "qcom,spmi-pmic-arb";
> > +   reg-names = "core", "intr", "cnfg";
> > +   reg = <0xfc4cf000 0x1000>,
> > + <0xfc4cb000 0x1000>,
> > + <0xfc4ca000 0x1000>;
> > +   interrupt-names = "periph_irq";
> 
> > +   interrupts = <0 190 0>;
> 
> The final value in this interrupts property means IRQ_TYPE_NONE.
> 
> A WARN_ON() was added early this year to complain about use of
> IRQ_TYPE_NONE: 83a86fbb5b56 "irqchip/gic: Loudly complain about
> the use of IRQ_TYPE_NONE", resulting in many warnings spewing
> forth when I boot an APQ8074 Dragonboard.  I am trying to
> determine whether the warning is overly aggressive, or whether
> the IRQ TYPE is incorrectly specified for the spmi node.
> 
> The interrupt-parent for the spmi node is intc: interrupt-controller@f900,
> which has compatible = "qcom,msm-qgic2".  I do not know the architecture
> or implementation of this interrupt controller.  Is an IRQ_TYPE_NONE
> valid in this case, or should a specific type be provided?
> 

No, IRQ_TYPE_NONE isn't valid and the WARN_ON() is reasonable.

Please change it to IRQ_TYPE_LEVEL_HIGH. And while you're at it, replace
the first 0 with GIC_SPI.


If you have more of these warnings you can most likely look at e.g.
msm8916 (arm64) to find the right flags.

Regards,
Bjorn


Re: VirtIO console hangs

2018-08-31 Thread Nicholas Piggin
On Fri, 31 Aug 2018 15:17:44 +
Matteo Croce  wrote:

> On Fri, Aug 31, 2018 at 3:49 AM Nicholas Piggin  wrote:
> >
> > On Tue, 28 Aug 2018 15:00:14 +
> > Matteo Croce  wrote:
> >  
> > > On Tue, Aug 28, 2018 at 2:35 PM Nicholas Piggin  
> > > wrote:  
> > > >
> > > > On Tue, 28 Aug 2018 12:54:08 +
> > > > Matteo Croce  wrote:
> > > >  
> > > > > With kernel 4.19.0-rc1 virtio_console hangs very often.
> > > > > I can always trigger the bug by pasting some characters in the
> > > > > terminal window, the console will stop receiving keypresses, but I can
> > > > > still see output from the console.
> > > > > Stangely, logging in the VM via SSH and sending lot of data to hvc0,
> > > > > like 'dmesg >/dev/hvc0' will fix the issue until the next paste.
> > > > >
> > > > > I did a git bisect and I've found that this is the offending commit,
> > > > > reverting it fixes it.
> > > > >
> > > > > Cheers,
> > > > >
> > > > > commit ec97eaad1383ab2500fcf9a07ade6044fbcc67f5
> > > > > Author: Nicholas Piggin 
> > > > > Date:   Tue May 1 00:55:54 2018 +1000
> > > > >
> > > > > tty: hvc: hvc_poll() break hv read loop  
> > > >
> > > > Thanks for the report. I can't immediately see what the problem
> > > > is. Can you try get a stack trace of where it is stuck?
> > > >  
> > >
> > > I tried but didn't get one.
> > >  
> > > > Perhaps try this patch if you have time (it's a bit of a shot
> > > > in the dark).
> > > >  
> > >
> > > Yes it seems to fix. Thanks!  
> >
> > Okay sorry for the delay, I can reproduce it here and found a better
> > fix, if I could trouble you to test again.
> >
> > [PATCH] tty: hvc: hvc_poll() fix read loop hang
> >  
> 
> Hi Nicholas,
> 
> the patch works, but now pasting text inside the terminal is extremely
> slow, it feels worse than a 9600 baud serial line.
> 
> Btw, I had to apply the patch by hand as it was corrupted, some lines
> were collapsed into one.

Oh, when you revert the above commit, does it fix the speed problem as
well? I realise I'm testing with a remote machine that probably is not
connected with much better than 9600 baud... I will set up a local test.

Thanks,
Nick


Re: VirtIO console hangs

2018-08-31 Thread Nicholas Piggin
On Fri, 31 Aug 2018 15:17:44 +
Matteo Croce  wrote:

> On Fri, Aug 31, 2018 at 3:49 AM Nicholas Piggin  wrote:
> >
> > On Tue, 28 Aug 2018 15:00:14 +
> > Matteo Croce  wrote:
> >  
> > > On Tue, Aug 28, 2018 at 2:35 PM Nicholas Piggin  
> > > wrote:  
> > > >
> > > > On Tue, 28 Aug 2018 12:54:08 +
> > > > Matteo Croce  wrote:
> > > >  
> > > > > With kernel 4.19.0-rc1 virtio_console hangs very often.
> > > > > I can always trigger the bug by pasting some characters in the
> > > > > terminal window, the console will stop receiving keypresses, but I can
> > > > > still see output from the console.
> > > > > Stangely, logging in the VM via SSH and sending lot of data to hvc0,
> > > > > like 'dmesg >/dev/hvc0' will fix the issue until the next paste.
> > > > >
> > > > > I did a git bisect and I've found that this is the offending commit,
> > > > > reverting it fixes it.
> > > > >
> > > > > Cheers,
> > > > >
> > > > > commit ec97eaad1383ab2500fcf9a07ade6044fbcc67f5
> > > > > Author: Nicholas Piggin 
> > > > > Date:   Tue May 1 00:55:54 2018 +1000
> > > > >
> > > > > tty: hvc: hvc_poll() break hv read loop  
> > > >
> > > > Thanks for the report. I can't immediately see what the problem
> > > > is. Can you try get a stack trace of where it is stuck?
> > > >  
> > >
> > > I tried but didn't get one.
> > >  
> > > > Perhaps try this patch if you have time (it's a bit of a shot
> > > > in the dark).
> > > >  
> > >
> > > Yes it seems to fix. Thanks!  
> >
> > Okay sorry for the delay, I can reproduce it here and found a better
> > fix, if I could trouble you to test again.
> >
> > [PATCH] tty: hvc: hvc_poll() fix read loop hang
> >  
> 
> Hi Nicholas,
> 
> the patch works, but now pasting text inside the terminal is extremely
> slow, it feels worse than a 9600 baud serial line.
> 
> Btw, I had to apply the patch by hand as it was corrupted, some lines
> were collapsed into one.

Oh, when you revert the above commit, does it fix the speed problem as
well? I realise I'm testing with a remote machine that probably is not
connected with much better than 9600 baud... I will set up a local test.

Thanks,
Nick


Re: Make perf script easier to use for itrace

2018-08-31 Thread Kim Phillips
On Fri, 31 Aug 2018 15:01:56 -0700
Andi Kleen  wrote:

> Also available in
> git://git.kernel.org/pub/scm/linux/kernel/git/ak/linux-misc.git 
> pt/easy-script-2
> 
> v1: Initial post
> v2: Address review comments. Minor fixes to descriptions. Now builds 
> everywhere.

OK, I grabbed the pt/easy-script-2 branch (commit 4c69fd388e17), and
see build failures for a 'make -C perf' build using gcc version 7.3.0
(Ubuntu 18.04):

builtin-script.c: In function ‘parse_output_fields’:
builtin-script.c:2571:22: error: array subscript is above array bounds 
[-Werror=array-bounds]
 output[j].fields &= ~all_output_options[i].field;
  ^~
builtin-script.c:2571:22: error: array subscript is above array bounds 
[-Werror=array-bounds]
 output[j].fields &= ~all_output_options[i].field;
 ~^~~
builtin-script.c:2574:10: error: array subscript is above array bounds 
[-Werror=array-bounds]
output[j].user_set = true;
~~^~~
builtin-script.c:2575:10: error: array subscript is above array bounds 
[-Werror=array-bounds]
output[j].wildcard_set = true;
~~^~~
...
util/cs-etm.c: In function ‘cs_etm__process_auxtrace_info’:
util/cs-etm.c:1436:14: error: ‘struct perf_session’ has no member named 
‘itrace_synth’; did you mean ‘itrace_synth_opts’?
 session->itrace_synth.default_no_sample);
  ^~~~
  itrace_synth_opts

Thanks,

Kim

p.s. FWIW, my make VF=1 output:

Auto-detecting system features:
... dwarf: [ on  ]
...dwarf_getlocations: [ on  ]
... glibc: [ on  ]
...  gtk2: [ on  ]
...  libaudit: [ on  ]
...libbfd: [ on  ]
...libelf: [ on  ]
...   libnuma: [ on  ]
...numa_num_possible_cpus: [ on  ]
...   libperl: [ on  ]
... libpython: [ on  ]
...  libslang: [ on  ]
... libcrypto: [ on  ]
... libunwind: [ on  ]
...libdw-dwarf-unwind: [ on  ]
...  zlib: [ on  ]
...  lzma: [ on  ]
... get_cpuid: [ on  ]
...   bpf: [ on  ]
... backtrace: [ on  ]
...fortify-source: [ on  ]
... sync-compare-and-swap: [ on  ]
...  gtk2-infobar: [ on  ]
... libelf-getphdrnum: [ on  ]
...   libelf-gelf_getnote: [ on  ]
...  libelf-getshdrstrndx: [ on  ]
...   libelf-mmap: [ on  ]
... libpython-version: [ on  ]
... libunwind-x86: [ OFF ]
...  libunwind-x86_64: [ on  ]
... libunwind-arm: [ OFF ]
... libunwind-aarch64: [ OFF ]
...   pthread-attr-setaffinity-np: [ on  ]
...   pthread-barrier: [ on  ]
...stackprotector-all: [ on  ]
...   timerfd: [ on  ]
...  sched_getcpu: [ on  ]
...   sdt: [ on  ]
... setns: [ on  ]
...libopencsd: [ on  ]

...bionic: [ OFF ]
...compile-32: [ OFF ]
...   compile-x32: [ OFF ]
...cplus-demangle: [ on  ]
... hello: [ OFF ]
... libbabeltrace: [ on  ]
...   liberty: [ on  ]
... liberty-z: [ on  ]
... libunwind-debug-frame: [ OFF ]
... libunwind-debug-frame-arm: [ OFF ]
... libunwind-debug-frame-aarch64: [ OFF ]
...   cxx: [ OFF ]
...  llvm: [ OFF ]
...  llvm-version: [ OFF ]
... clang: [ OFF ]
...prefix: /home/kim
...bindir: /home/kim/bin
...libdir: /home/kim/lib64
...sysconfdir: /home/kim/etc
... LIBUNWIND_DIR: 
... LIBDW_DIR: 
...  JDIR: /usr/lib/jvm/java-1.8.0-openjdk-amd64
... DWARF post unwind library: libunwind



Re: Make perf script easier to use for itrace

2018-08-31 Thread Kim Phillips
On Fri, 31 Aug 2018 15:01:56 -0700
Andi Kleen  wrote:

> Also available in
> git://git.kernel.org/pub/scm/linux/kernel/git/ak/linux-misc.git 
> pt/easy-script-2
> 
> v1: Initial post
> v2: Address review comments. Minor fixes to descriptions. Now builds 
> everywhere.

OK, I grabbed the pt/easy-script-2 branch (commit 4c69fd388e17), and
see build failures for a 'make -C perf' build using gcc version 7.3.0
(Ubuntu 18.04):

builtin-script.c: In function ‘parse_output_fields’:
builtin-script.c:2571:22: error: array subscript is above array bounds 
[-Werror=array-bounds]
 output[j].fields &= ~all_output_options[i].field;
  ^~
builtin-script.c:2571:22: error: array subscript is above array bounds 
[-Werror=array-bounds]
 output[j].fields &= ~all_output_options[i].field;
 ~^~~
builtin-script.c:2574:10: error: array subscript is above array bounds 
[-Werror=array-bounds]
output[j].user_set = true;
~~^~~
builtin-script.c:2575:10: error: array subscript is above array bounds 
[-Werror=array-bounds]
output[j].wildcard_set = true;
~~^~~
...
util/cs-etm.c: In function ‘cs_etm__process_auxtrace_info’:
util/cs-etm.c:1436:14: error: ‘struct perf_session’ has no member named 
‘itrace_synth’; did you mean ‘itrace_synth_opts’?
 session->itrace_synth.default_no_sample);
  ^~~~
  itrace_synth_opts

Thanks,

Kim

p.s. FWIW, my make VF=1 output:

Auto-detecting system features:
... dwarf: [ on  ]
...dwarf_getlocations: [ on  ]
... glibc: [ on  ]
...  gtk2: [ on  ]
...  libaudit: [ on  ]
...libbfd: [ on  ]
...libelf: [ on  ]
...   libnuma: [ on  ]
...numa_num_possible_cpus: [ on  ]
...   libperl: [ on  ]
... libpython: [ on  ]
...  libslang: [ on  ]
... libcrypto: [ on  ]
... libunwind: [ on  ]
...libdw-dwarf-unwind: [ on  ]
...  zlib: [ on  ]
...  lzma: [ on  ]
... get_cpuid: [ on  ]
...   bpf: [ on  ]
... backtrace: [ on  ]
...fortify-source: [ on  ]
... sync-compare-and-swap: [ on  ]
...  gtk2-infobar: [ on  ]
... libelf-getphdrnum: [ on  ]
...   libelf-gelf_getnote: [ on  ]
...  libelf-getshdrstrndx: [ on  ]
...   libelf-mmap: [ on  ]
... libpython-version: [ on  ]
... libunwind-x86: [ OFF ]
...  libunwind-x86_64: [ on  ]
... libunwind-arm: [ OFF ]
... libunwind-aarch64: [ OFF ]
...   pthread-attr-setaffinity-np: [ on  ]
...   pthread-barrier: [ on  ]
...stackprotector-all: [ on  ]
...   timerfd: [ on  ]
...  sched_getcpu: [ on  ]
...   sdt: [ on  ]
... setns: [ on  ]
...libopencsd: [ on  ]

...bionic: [ OFF ]
...compile-32: [ OFF ]
...   compile-x32: [ OFF ]
...cplus-demangle: [ on  ]
... hello: [ OFF ]
... libbabeltrace: [ on  ]
...   liberty: [ on  ]
... liberty-z: [ on  ]
... libunwind-debug-frame: [ OFF ]
... libunwind-debug-frame-arm: [ OFF ]
... libunwind-debug-frame-aarch64: [ OFF ]
...   cxx: [ OFF ]
...  llvm: [ OFF ]
...  llvm-version: [ OFF ]
... clang: [ OFF ]
...prefix: /home/kim
...bindir: /home/kim/bin
...libdir: /home/kim/lib64
...sysconfdir: /home/kim/etc
... LIBUNWIND_DIR: 
... LIBDW_DIR: 
...  JDIR: /usr/lib/jvm/java-1.8.0-openjdk-amd64
... DWARF post unwind library: libunwind



[PATCH v2] PCI: qcom: Fix error handling in pm_runtime support

2018-08-31 Thread Bjorn Andersson
The driver does not cope with the fact that probe can fail in a number
of cases after enabling pm_runtime on the device, this results in
warnings about "Unbalanced pm_runtime_enable". Further more if probe
fails after invoking host_init the power-domain will be left referenced.

As it's not possible for the error handling in qcom_pcie_host_init() to
handle errors happening after returning from that function the
pm_runtime_get_sync() is moved to probe() as well.

Fixes: 854b69efbdd2 ("PCI: qcom: add runtime pm support to pcie_port")
Acked-by: Stanimir Varbanov 
Signed-off-by: Bjorn Andersson 
---

Changes since v1:
- Dropped remove function, as this can't be called
- Handle pm_runtime_get_sync() errors
- Add "Fixes" tag

 drivers/pci/controller/dwc/pcie-qcom.c | 56 ++
 1 file changed, 39 insertions(+), 17 deletions(-)

diff --git a/drivers/pci/controller/dwc/pcie-qcom.c 
b/drivers/pci/controller/dwc/pcie-qcom.c
index d2373e4d141c..3bfaad052736 100644
--- a/drivers/pci/controller/dwc/pcie-qcom.c
+++ b/drivers/pci/controller/dwc/pcie-qcom.c
@@ -1117,7 +1117,6 @@ static int qcom_pcie_host_init(struct pcie_port *pp)
struct qcom_pcie *pcie = to_qcom_pcie(pci);
int ret;
 
-   pm_runtime_get_sync(pci->dev);
qcom_ep_reset_assert(pcie);
 
ret = pcie->ops->init(pcie);
@@ -1154,7 +1153,6 @@ static int qcom_pcie_host_init(struct pcie_port *pp)
phy_power_off(pcie->phy);
 err_deinit:
pcie->ops->deinit(pcie);
-   pm_runtime_put(pci->dev);
 
return ret;
 }
@@ -1244,6 +1242,12 @@ static int qcom_pcie_probe(struct platform_device *pdev)
return -ENOMEM;
 
pm_runtime_enable(dev);
+   ret = pm_runtime_get_sync(dev);
+   if (ret < 0) {
+   pm_runtime_disable(dev);
+   return ret;
+   }
+
pci->dev = dev;
pci->ops = _pcie_ops;
pp = >pp;
@@ -1253,44 +1257,56 @@ static int qcom_pcie_probe(struct platform_device *pdev)
pcie->ops = of_device_get_match_data(dev);
 
pcie->reset = devm_gpiod_get_optional(dev, "perst", GPIOD_OUT_LOW);
-   if (IS_ERR(pcie->reset))
-   return PTR_ERR(pcie->reset);
+   if (IS_ERR(pcie->reset)) {
+   ret = PTR_ERR(pcie->reset);
+   goto err_pm_runtime_put;
+   }
 
res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "parf");
pcie->parf = devm_ioremap_resource(dev, res);
-   if (IS_ERR(pcie->parf))
-   return PTR_ERR(pcie->parf);
+   if (IS_ERR(pcie->parf)) {
+   ret = PTR_ERR(pcie->parf);
+   goto err_pm_runtime_put;
+   }
 
res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "dbi");
pci->dbi_base = devm_pci_remap_cfg_resource(dev, res);
-   if (IS_ERR(pci->dbi_base))
-   return PTR_ERR(pci->dbi_base);
+   if (IS_ERR(pci->dbi_base)) {
+   ret = PTR_ERR(pci->dbi_base);
+   goto err_pm_runtime_put;
+   }
 
res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "elbi");
pcie->elbi = devm_ioremap_resource(dev, res);
-   if (IS_ERR(pcie->elbi))
-   return PTR_ERR(pcie->elbi);
+   if (IS_ERR(pcie->elbi)) {
+   ret = PTR_ERR(pcie->elbi);
+   goto err_pm_runtime_put;
+   }
 
pcie->phy = devm_phy_optional_get(dev, "pciephy");
-   if (IS_ERR(pcie->phy))
-   return PTR_ERR(pcie->phy);
+   if (IS_ERR(pcie->phy)) {
+   ret = PTR_ERR(pcie->phy);
+   goto err_pm_runtime_put;
+   }
 
ret = pcie->ops->get_resources(pcie);
if (ret)
-   return ret;
+   goto err_pm_runtime_put;
 
pp->ops = _pcie_dw_ops;
 
if (IS_ENABLED(CONFIG_PCI_MSI)) {
pp->msi_irq = platform_get_irq_byname(pdev, "msi");
-   if (pp->msi_irq < 0)
-   return pp->msi_irq;
+   if (pp->msi_irq < 0) {
+   ret = pp->msi_irq;
+   goto err_pm_runtime_put;
+   }
}
 
ret = phy_init(pcie->phy);
if (ret) {
pm_runtime_disable(>dev);
-   return ret;
+   goto err_pm_runtime_put;
}
 
platform_set_drvdata(pdev, pcie);
@@ -1299,10 +1315,16 @@ static int qcom_pcie_probe(struct platform_device *pdev)
if (ret) {
dev_err(dev, "cannot initialize host\n");
pm_runtime_disable(>dev);
-   return ret;
+   goto err_pm_runtime_put;
}
 
return 0;
+
+err_pm_runtime_put:
+   pm_runtime_put(dev);
+   pm_runtime_disable(dev);
+
+   return ret;
 }
 
 static const struct of_device_id qcom_pcie_match[] = {
-- 
2.18.0



[PATCH v2] PCI: qcom: Fix error handling in pm_runtime support

2018-08-31 Thread Bjorn Andersson
The driver does not cope with the fact that probe can fail in a number
of cases after enabling pm_runtime on the device, this results in
warnings about "Unbalanced pm_runtime_enable". Further more if probe
fails after invoking host_init the power-domain will be left referenced.

As it's not possible for the error handling in qcom_pcie_host_init() to
handle errors happening after returning from that function the
pm_runtime_get_sync() is moved to probe() as well.

Fixes: 854b69efbdd2 ("PCI: qcom: add runtime pm support to pcie_port")
Acked-by: Stanimir Varbanov 
Signed-off-by: Bjorn Andersson 
---

Changes since v1:
- Dropped remove function, as this can't be called
- Handle pm_runtime_get_sync() errors
- Add "Fixes" tag

 drivers/pci/controller/dwc/pcie-qcom.c | 56 ++
 1 file changed, 39 insertions(+), 17 deletions(-)

diff --git a/drivers/pci/controller/dwc/pcie-qcom.c 
b/drivers/pci/controller/dwc/pcie-qcom.c
index d2373e4d141c..3bfaad052736 100644
--- a/drivers/pci/controller/dwc/pcie-qcom.c
+++ b/drivers/pci/controller/dwc/pcie-qcom.c
@@ -1117,7 +1117,6 @@ static int qcom_pcie_host_init(struct pcie_port *pp)
struct qcom_pcie *pcie = to_qcom_pcie(pci);
int ret;
 
-   pm_runtime_get_sync(pci->dev);
qcom_ep_reset_assert(pcie);
 
ret = pcie->ops->init(pcie);
@@ -1154,7 +1153,6 @@ static int qcom_pcie_host_init(struct pcie_port *pp)
phy_power_off(pcie->phy);
 err_deinit:
pcie->ops->deinit(pcie);
-   pm_runtime_put(pci->dev);
 
return ret;
 }
@@ -1244,6 +1242,12 @@ static int qcom_pcie_probe(struct platform_device *pdev)
return -ENOMEM;
 
pm_runtime_enable(dev);
+   ret = pm_runtime_get_sync(dev);
+   if (ret < 0) {
+   pm_runtime_disable(dev);
+   return ret;
+   }
+
pci->dev = dev;
pci->ops = _pcie_ops;
pp = >pp;
@@ -1253,44 +1257,56 @@ static int qcom_pcie_probe(struct platform_device *pdev)
pcie->ops = of_device_get_match_data(dev);
 
pcie->reset = devm_gpiod_get_optional(dev, "perst", GPIOD_OUT_LOW);
-   if (IS_ERR(pcie->reset))
-   return PTR_ERR(pcie->reset);
+   if (IS_ERR(pcie->reset)) {
+   ret = PTR_ERR(pcie->reset);
+   goto err_pm_runtime_put;
+   }
 
res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "parf");
pcie->parf = devm_ioremap_resource(dev, res);
-   if (IS_ERR(pcie->parf))
-   return PTR_ERR(pcie->parf);
+   if (IS_ERR(pcie->parf)) {
+   ret = PTR_ERR(pcie->parf);
+   goto err_pm_runtime_put;
+   }
 
res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "dbi");
pci->dbi_base = devm_pci_remap_cfg_resource(dev, res);
-   if (IS_ERR(pci->dbi_base))
-   return PTR_ERR(pci->dbi_base);
+   if (IS_ERR(pci->dbi_base)) {
+   ret = PTR_ERR(pci->dbi_base);
+   goto err_pm_runtime_put;
+   }
 
res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "elbi");
pcie->elbi = devm_ioremap_resource(dev, res);
-   if (IS_ERR(pcie->elbi))
-   return PTR_ERR(pcie->elbi);
+   if (IS_ERR(pcie->elbi)) {
+   ret = PTR_ERR(pcie->elbi);
+   goto err_pm_runtime_put;
+   }
 
pcie->phy = devm_phy_optional_get(dev, "pciephy");
-   if (IS_ERR(pcie->phy))
-   return PTR_ERR(pcie->phy);
+   if (IS_ERR(pcie->phy)) {
+   ret = PTR_ERR(pcie->phy);
+   goto err_pm_runtime_put;
+   }
 
ret = pcie->ops->get_resources(pcie);
if (ret)
-   return ret;
+   goto err_pm_runtime_put;
 
pp->ops = _pcie_dw_ops;
 
if (IS_ENABLED(CONFIG_PCI_MSI)) {
pp->msi_irq = platform_get_irq_byname(pdev, "msi");
-   if (pp->msi_irq < 0)
-   return pp->msi_irq;
+   if (pp->msi_irq < 0) {
+   ret = pp->msi_irq;
+   goto err_pm_runtime_put;
+   }
}
 
ret = phy_init(pcie->phy);
if (ret) {
pm_runtime_disable(>dev);
-   return ret;
+   goto err_pm_runtime_put;
}
 
platform_set_drvdata(pdev, pcie);
@@ -1299,10 +1315,16 @@ static int qcom_pcie_probe(struct platform_device *pdev)
if (ret) {
dev_err(dev, "cannot initialize host\n");
pm_runtime_disable(>dev);
-   return ret;
+   goto err_pm_runtime_put;
}
 
return 0;
+
+err_pm_runtime_put:
+   pm_runtime_put(dev);
+   pm_runtime_disable(dev);
+
+   return ret;
 }
 
 static const struct of_device_id qcom_pcie_match[] = {
-- 
2.18.0



Re: VirtIO console hangs

2018-08-31 Thread Nicholas Piggin
On Fri, 31 Aug 2018 15:17:44 +
Matteo Croce  wrote:

> On Fri, Aug 31, 2018 at 3:49 AM Nicholas Piggin  wrote:
> >
> > On Tue, 28 Aug 2018 15:00:14 +
> > Matteo Croce  wrote:
> >  
> > > On Tue, Aug 28, 2018 at 2:35 PM Nicholas Piggin  
> > > wrote:  
> > > >
> > > > On Tue, 28 Aug 2018 12:54:08 +
> > > > Matteo Croce  wrote:
> > > >  
> > > > > With kernel 4.19.0-rc1 virtio_console hangs very often.
> > > > > I can always trigger the bug by pasting some characters in the
> > > > > terminal window, the console will stop receiving keypresses, but I can
> > > > > still see output from the console.
> > > > > Stangely, logging in the VM via SSH and sending lot of data to hvc0,
> > > > > like 'dmesg >/dev/hvc0' will fix the issue until the next paste.
> > > > >
> > > > > I did a git bisect and I've found that this is the offending commit,
> > > > > reverting it fixes it.
> > > > >
> > > > > Cheers,
> > > > >
> > > > > commit ec97eaad1383ab2500fcf9a07ade6044fbcc67f5
> > > > > Author: Nicholas Piggin 
> > > > > Date:   Tue May 1 00:55:54 2018 +1000
> > > > >
> > > > > tty: hvc: hvc_poll() break hv read loop  
> > > >
> > > > Thanks for the report. I can't immediately see what the problem
> > > > is. Can you try get a stack trace of where it is stuck?
> > > >  
> > >
> > > I tried but didn't get one.
> > >  
> > > > Perhaps try this patch if you have time (it's a bit of a shot
> > > > in the dark).
> > > >  
> > >
> > > Yes it seems to fix. Thanks!  
> >
> > Okay sorry for the delay, I can reproduce it here and found a better
> > fix, if I could trouble you to test again.
> >
> > [PATCH] tty: hvc: hvc_poll() fix read loop hang
> >  
> 
> Hi Nicholas,
> 
> the patch works, but now pasting text inside the terminal is extremely
> slow, it feels worse than a 9600 baud serial line.
> 
> Btw, I had to apply the patch by hand as it was corrupted, some lines
> were collapsed into one.

Okay I didn't test a very big paste, I'll work on it.

Thanks,
Nick


Re: VirtIO console hangs

2018-08-31 Thread Nicholas Piggin
On Fri, 31 Aug 2018 15:17:44 +
Matteo Croce  wrote:

> On Fri, Aug 31, 2018 at 3:49 AM Nicholas Piggin  wrote:
> >
> > On Tue, 28 Aug 2018 15:00:14 +
> > Matteo Croce  wrote:
> >  
> > > On Tue, Aug 28, 2018 at 2:35 PM Nicholas Piggin  
> > > wrote:  
> > > >
> > > > On Tue, 28 Aug 2018 12:54:08 +
> > > > Matteo Croce  wrote:
> > > >  
> > > > > With kernel 4.19.0-rc1 virtio_console hangs very often.
> > > > > I can always trigger the bug by pasting some characters in the
> > > > > terminal window, the console will stop receiving keypresses, but I can
> > > > > still see output from the console.
> > > > > Stangely, logging in the VM via SSH and sending lot of data to hvc0,
> > > > > like 'dmesg >/dev/hvc0' will fix the issue until the next paste.
> > > > >
> > > > > I did a git bisect and I've found that this is the offending commit,
> > > > > reverting it fixes it.
> > > > >
> > > > > Cheers,
> > > > >
> > > > > commit ec97eaad1383ab2500fcf9a07ade6044fbcc67f5
> > > > > Author: Nicholas Piggin 
> > > > > Date:   Tue May 1 00:55:54 2018 +1000
> > > > >
> > > > > tty: hvc: hvc_poll() break hv read loop  
> > > >
> > > > Thanks for the report. I can't immediately see what the problem
> > > > is. Can you try get a stack trace of where it is stuck?
> > > >  
> > >
> > > I tried but didn't get one.
> > >  
> > > > Perhaps try this patch if you have time (it's a bit of a shot
> > > > in the dark).
> > > >  
> > >
> > > Yes it seems to fix. Thanks!  
> >
> > Okay sorry for the delay, I can reproduce it here and found a better
> > fix, if I could trouble you to test again.
> >
> > [PATCH] tty: hvc: hvc_poll() fix read loop hang
> >  
> 
> Hi Nicholas,
> 
> the patch works, but now pasting text inside the terminal is extremely
> slow, it feels worse than a 9600 baud serial line.
> 
> Btw, I had to apply the patch by hand as it was corrupted, some lines
> were collapsed into one.

Okay I didn't test a very big paste, I'll work on it.

Thanks,
Nick


Re: [PATCH 1/3] ARM: dts: qcom: Add SPMI PMIC Arbiter nodes for APQ8084 and MSM8974

2018-08-31 Thread Frank Rowand
Hi All,

The email for Ivan is no longer valid.  Can anyone else help me with
my question?

Thanks,

Frank


On 08/31/18 15:46, Frank Rowand wrote:
> Hi Ivan,
> 
> 
> On 02/03/15 04:17, Ivan T. Ivanov wrote:
>> Add SPMI PMIC Arbiter configuration nodes for APQ8084 and MSM8974.
>>
>> Signed-off-by: Ivan T. Ivanov 
>> ---
>>  arch/arm/boot/dts/qcom-apq8084.dtsi | 16 
>>  arch/arm/boot/dts/qcom-msm8974.dtsi | 16 
>>  2 files changed, 32 insertions(+)
>>
>> diff --git a/arch/arm/boot/dts/qcom-apq8084.dtsi 
>> b/arch/arm/boot/dts/qcom-apq8084.dtsi
>> index 1f130bc..dbedf64 100644
>> --- a/arch/arm/boot/dts/qcom-apq8084.dtsi
>> +++ b/arch/arm/boot/dts/qcom-apq8084.dtsi
>> @@ -226,5 +226,21 @@
>>  clock-names = "core", "iface";
>>  status = "disabled";
>>  };
>> +
>> +spmi_bus: spmi@fc4cf000 {
>> +compatible = "qcom,spmi-pmic-arb";
>> +reg-names = "core", "intr", "cnfg";
>> +reg = <0xfc4cf000 0x1000>,
>> +  <0xfc4cb000 0x1000>,
>> +  <0xfc4ca000 0x1000>;
>> +interrupt-names = "periph_irq";
>> +interrupts = <0 190 0>;> +  qcom,ee 
>> = <0>;
>> +qcom,channel = <0>;
>> +#address-cells = <2>;
>> +#size-cells = <0>;
>> +interrupt-controller;
>> +#interrupt-cells = <4>;
>> +};
>>  };
>>  };
>> diff --git a/arch/arm/boot/dts/qcom-msm8974.dtsi 
>> b/arch/arm/boot/dts/qcom-msm8974.dtsi
>> index e265ec1..2d11641 100644
>> --- a/arch/arm/boot/dts/qcom-msm8974.dtsi
>> +++ b/arch/arm/boot/dts/qcom-msm8974.dtsi
>> @@ -247,5 +247,21 @@
>>  #address-cells = <1>;
>>  #size-cells = <0>;
>>  };
>> +
>> +spmi_bus: spmi@fc4cf000 {
>> +compatible = "qcom,spmi-pmic-arb";
>> +reg-names = "core", "intr", "cnfg";
>> +reg = <0xfc4cf000 0x1000>,
>> +  <0xfc4cb000 0x1000>,
>> +  <0xfc4ca000 0x1000>;
>> +interrupt-names = "periph_irq";
> 
>> +interrupts = <0 190 0>;
> 
> The final value in this interrupts property means IRQ_TYPE_NONE.
> 
> A WARN_ON() was added early this year to complain about use of
> IRQ_TYPE_NONE: 83a86fbb5b56 "irqchip/gic: Loudly complain about
> the use of IRQ_TYPE_NONE", resulting in many warnings spewing
> forth when I boot an APQ8074 Dragonboard.  I am trying to
> determine whether the warning is overly aggressive, or whether
> the IRQ TYPE is incorrectly specified for the spmi node.
> 
> The interrupt-parent for the spmi node is intc: interrupt-controller@f900,
> which has compatible = "qcom,msm-qgic2".  I do not know the architecture
> or implementation of this interrupt controller.  Is an IRQ_TYPE_NONE
> valid in this case, or should a specific type be provided?
> 
> Thanks!
> 
> -Frank
> 
> 
>> +qcom,ee = <0>;
>> +qcom,channel = <0>;
>> +#address-cells = <2>;
>> +#size-cells = <0>;
>> +interrupt-controller;
>> +#interrupt-cells = <4>;
>> +};
>>  };
>>  };
>> --
>> 1.9.1
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe devicetree" in
>> the body of a message to majord...@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>>
> 
> .
> 



Re: [PATCH 1/3] ARM: dts: qcom: Add SPMI PMIC Arbiter nodes for APQ8084 and MSM8974

2018-08-31 Thread Frank Rowand
Hi All,

The email for Ivan is no longer valid.  Can anyone else help me with
my question?

Thanks,

Frank


On 08/31/18 15:46, Frank Rowand wrote:
> Hi Ivan,
> 
> 
> On 02/03/15 04:17, Ivan T. Ivanov wrote:
>> Add SPMI PMIC Arbiter configuration nodes for APQ8084 and MSM8974.
>>
>> Signed-off-by: Ivan T. Ivanov 
>> ---
>>  arch/arm/boot/dts/qcom-apq8084.dtsi | 16 
>>  arch/arm/boot/dts/qcom-msm8974.dtsi | 16 
>>  2 files changed, 32 insertions(+)
>>
>> diff --git a/arch/arm/boot/dts/qcom-apq8084.dtsi 
>> b/arch/arm/boot/dts/qcom-apq8084.dtsi
>> index 1f130bc..dbedf64 100644
>> --- a/arch/arm/boot/dts/qcom-apq8084.dtsi
>> +++ b/arch/arm/boot/dts/qcom-apq8084.dtsi
>> @@ -226,5 +226,21 @@
>>  clock-names = "core", "iface";
>>  status = "disabled";
>>  };
>> +
>> +spmi_bus: spmi@fc4cf000 {
>> +compatible = "qcom,spmi-pmic-arb";
>> +reg-names = "core", "intr", "cnfg";
>> +reg = <0xfc4cf000 0x1000>,
>> +  <0xfc4cb000 0x1000>,
>> +  <0xfc4ca000 0x1000>;
>> +interrupt-names = "periph_irq";
>> +interrupts = <0 190 0>;> +  qcom,ee 
>> = <0>;
>> +qcom,channel = <0>;
>> +#address-cells = <2>;
>> +#size-cells = <0>;
>> +interrupt-controller;
>> +#interrupt-cells = <4>;
>> +};
>>  };
>>  };
>> diff --git a/arch/arm/boot/dts/qcom-msm8974.dtsi 
>> b/arch/arm/boot/dts/qcom-msm8974.dtsi
>> index e265ec1..2d11641 100644
>> --- a/arch/arm/boot/dts/qcom-msm8974.dtsi
>> +++ b/arch/arm/boot/dts/qcom-msm8974.dtsi
>> @@ -247,5 +247,21 @@
>>  #address-cells = <1>;
>>  #size-cells = <0>;
>>  };
>> +
>> +spmi_bus: spmi@fc4cf000 {
>> +compatible = "qcom,spmi-pmic-arb";
>> +reg-names = "core", "intr", "cnfg";
>> +reg = <0xfc4cf000 0x1000>,
>> +  <0xfc4cb000 0x1000>,
>> +  <0xfc4ca000 0x1000>;
>> +interrupt-names = "periph_irq";
> 
>> +interrupts = <0 190 0>;
> 
> The final value in this interrupts property means IRQ_TYPE_NONE.
> 
> A WARN_ON() was added early this year to complain about use of
> IRQ_TYPE_NONE: 83a86fbb5b56 "irqchip/gic: Loudly complain about
> the use of IRQ_TYPE_NONE", resulting in many warnings spewing
> forth when I boot an APQ8074 Dragonboard.  I am trying to
> determine whether the warning is overly aggressive, or whether
> the IRQ TYPE is incorrectly specified for the spmi node.
> 
> The interrupt-parent for the spmi node is intc: interrupt-controller@f900,
> which has compatible = "qcom,msm-qgic2".  I do not know the architecture
> or implementation of this interrupt controller.  Is an IRQ_TYPE_NONE
> valid in this case, or should a specific type be provided?
> 
> Thanks!
> 
> -Frank
> 
> 
>> +qcom,ee = <0>;
>> +qcom,channel = <0>;
>> +#address-cells = <2>;
>> +#size-cells = <0>;
>> +interrupt-controller;
>> +#interrupt-cells = <4>;
>> +};
>>  };
>>  };
>> --
>> 1.9.1
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe devicetree" in
>> the body of a message to majord...@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>>
> 
> .
> 



Re: [PATCH 1/3] ARM: dts: qcom: Add SPMI PMIC Arbiter nodes for APQ8084 and MSM8974

2018-08-31 Thread Frank Rowand
Hi Ivan,


On 02/03/15 04:17, Ivan T. Ivanov wrote:
> Add SPMI PMIC Arbiter configuration nodes for APQ8084 and MSM8974.
> 
> Signed-off-by: Ivan T. Ivanov 
> ---
>  arch/arm/boot/dts/qcom-apq8084.dtsi | 16 
>  arch/arm/boot/dts/qcom-msm8974.dtsi | 16 
>  2 files changed, 32 insertions(+)
> 
> diff --git a/arch/arm/boot/dts/qcom-apq8084.dtsi 
> b/arch/arm/boot/dts/qcom-apq8084.dtsi
> index 1f130bc..dbedf64 100644
> --- a/arch/arm/boot/dts/qcom-apq8084.dtsi
> +++ b/arch/arm/boot/dts/qcom-apq8084.dtsi
> @@ -226,5 +226,21 @@
>   clock-names = "core", "iface";
>   status = "disabled";
>   };
> +
> + spmi_bus: spmi@fc4cf000 {
> + compatible = "qcom,spmi-pmic-arb";
> + reg-names = "core", "intr", "cnfg";
> + reg = <0xfc4cf000 0x1000>,
> +   <0xfc4cb000 0x1000>,
> +   <0xfc4ca000 0x1000>;
> + interrupt-names = "periph_irq";
> + interrupts = <0 190 0>;> +  qcom,ee 
> = <0>;
> + qcom,channel = <0>;
> + #address-cells = <2>;
> + #size-cells = <0>;
> + interrupt-controller;
> + #interrupt-cells = <4>;
> + };
>   };
>  };
> diff --git a/arch/arm/boot/dts/qcom-msm8974.dtsi 
> b/arch/arm/boot/dts/qcom-msm8974.dtsi
> index e265ec1..2d11641 100644
> --- a/arch/arm/boot/dts/qcom-msm8974.dtsi
> +++ b/arch/arm/boot/dts/qcom-msm8974.dtsi
> @@ -247,5 +247,21 @@
>   #address-cells = <1>;
>   #size-cells = <0>;
>   };
> +
> + spmi_bus: spmi@fc4cf000 {
> + compatible = "qcom,spmi-pmic-arb";
> + reg-names = "core", "intr", "cnfg";
> + reg = <0xfc4cf000 0x1000>,
> +   <0xfc4cb000 0x1000>,
> +   <0xfc4ca000 0x1000>;
> + interrupt-names = "periph_irq";

> + interrupts = <0 190 0>;

The final value in this interrupts property means IRQ_TYPE_NONE.

A WARN_ON() was added early this year to complain about use of
IRQ_TYPE_NONE: 83a86fbb5b56 "irqchip/gic: Loudly complain about
the use of IRQ_TYPE_NONE", resulting in many warnings spewing
forth when I boot an APQ8074 Dragonboard.  I am trying to
determine whether the warning is overly aggressive, or whether
the IRQ TYPE is incorrectly specified for the spmi node.

The interrupt-parent for the spmi node is intc: interrupt-controller@f900,
which has compatible = "qcom,msm-qgic2".  I do not know the architecture
or implementation of this interrupt controller.  Is an IRQ_TYPE_NONE
valid in this case, or should a specific type be provided?

Thanks!

-Frank


> + qcom,ee = <0>;
> + qcom,channel = <0>;
> + #address-cells = <2>;
> + #size-cells = <0>;
> + interrupt-controller;
> + #interrupt-cells = <4>;
> + };
>   };
>  };
> --
> 1.9.1
> 
> --
> To unsubscribe from this list: send the line "unsubscribe devicetree" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 



Re: [PATCH 1/3] ARM: dts: qcom: Add SPMI PMIC Arbiter nodes for APQ8084 and MSM8974

2018-08-31 Thread Frank Rowand
Hi Ivan,


On 02/03/15 04:17, Ivan T. Ivanov wrote:
> Add SPMI PMIC Arbiter configuration nodes for APQ8084 and MSM8974.
> 
> Signed-off-by: Ivan T. Ivanov 
> ---
>  arch/arm/boot/dts/qcom-apq8084.dtsi | 16 
>  arch/arm/boot/dts/qcom-msm8974.dtsi | 16 
>  2 files changed, 32 insertions(+)
> 
> diff --git a/arch/arm/boot/dts/qcom-apq8084.dtsi 
> b/arch/arm/boot/dts/qcom-apq8084.dtsi
> index 1f130bc..dbedf64 100644
> --- a/arch/arm/boot/dts/qcom-apq8084.dtsi
> +++ b/arch/arm/boot/dts/qcom-apq8084.dtsi
> @@ -226,5 +226,21 @@
>   clock-names = "core", "iface";
>   status = "disabled";
>   };
> +
> + spmi_bus: spmi@fc4cf000 {
> + compatible = "qcom,spmi-pmic-arb";
> + reg-names = "core", "intr", "cnfg";
> + reg = <0xfc4cf000 0x1000>,
> +   <0xfc4cb000 0x1000>,
> +   <0xfc4ca000 0x1000>;
> + interrupt-names = "periph_irq";
> + interrupts = <0 190 0>;> +  qcom,ee 
> = <0>;
> + qcom,channel = <0>;
> + #address-cells = <2>;
> + #size-cells = <0>;
> + interrupt-controller;
> + #interrupt-cells = <4>;
> + };
>   };
>  };
> diff --git a/arch/arm/boot/dts/qcom-msm8974.dtsi 
> b/arch/arm/boot/dts/qcom-msm8974.dtsi
> index e265ec1..2d11641 100644
> --- a/arch/arm/boot/dts/qcom-msm8974.dtsi
> +++ b/arch/arm/boot/dts/qcom-msm8974.dtsi
> @@ -247,5 +247,21 @@
>   #address-cells = <1>;
>   #size-cells = <0>;
>   };
> +
> + spmi_bus: spmi@fc4cf000 {
> + compatible = "qcom,spmi-pmic-arb";
> + reg-names = "core", "intr", "cnfg";
> + reg = <0xfc4cf000 0x1000>,
> +   <0xfc4cb000 0x1000>,
> +   <0xfc4ca000 0x1000>;
> + interrupt-names = "periph_irq";

> + interrupts = <0 190 0>;

The final value in this interrupts property means IRQ_TYPE_NONE.

A WARN_ON() was added early this year to complain about use of
IRQ_TYPE_NONE: 83a86fbb5b56 "irqchip/gic: Loudly complain about
the use of IRQ_TYPE_NONE", resulting in many warnings spewing
forth when I boot an APQ8074 Dragonboard.  I am trying to
determine whether the warning is overly aggressive, or whether
the IRQ TYPE is incorrectly specified for the spmi node.

The interrupt-parent for the spmi node is intc: interrupt-controller@f900,
which has compatible = "qcom,msm-qgic2".  I do not know the architecture
or implementation of this interrupt controller.  Is an IRQ_TYPE_NONE
valid in this case, or should a specific type be provided?

Thanks!

-Frank


> + qcom,ee = <0>;
> + qcom,channel = <0>;
> + #address-cells = <2>;
> + #size-cells = <0>;
> + interrupt-controller;
> + #interrupt-cells = <4>;
> + };
>   };
>  };
> --
> 1.9.1
> 
> --
> To unsubscribe from this list: send the line "unsubscribe devicetree" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 



[PATCH] sched/fair: fix vruntime_normalized for remote non-migration wakeup

2018-08-31 Thread Steve Muckle
When a task which previously ran on a given CPU is remotely queued to
wake up on that same CPU, there is a period where the task's state is
TASK_WAKING and its vruntime is not normalized. This is not accounted
for in vruntime_normalized() which will cause an
error in the task's vruntime if it is switched from the fair class
during this time, for example if it is boosted to RT priority via
rt_mutex_setprio. The rq's min_vruntime will not be subtracted from the
task's vruntime but it will be added again when the task returns to the
fair class. The task's vruntime will have been erroneously doubled and
the effective priority of the task will be reduced.

Note this will also lead to inflation of all vruntimes since the doubled
vruntime value will become the rq's min_vruntime when other tasks leave
the rq. This leads to repeated doubling of the vruntime and priority
penalty.

Fix this by recognizing a WAKING task's vruntime as normalized only if
sched_remote_wakeup is true. This indicates a migration, in which case
the vruntime would have been normalized in migrate_task_rq_fair().

Based on a similar patch from joaod...@google.com.

Suggested-by: Peter Zijlstra 
Signed-off-by: Steve Muckle 
---
 kernel/sched/fair.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index b39fb596f6c1..b3b62cf37fb6 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -9638,7 +9638,8 @@ static inline bool vruntime_normalized(struct task_struct 
*p)
 * - A task which has been woken up by try_to_wake_up() and
 *   waiting for actually being woken up by sched_ttwu_pending().
 */
-   if (!se->sum_exec_runtime || p->state == TASK_WAKING)
+   if (!se->sum_exec_runtime ||
+   (p->state == TASK_WAKING && p->sched_remote_wakeup))
return true;
 
return false;
-- 
2.19.0.rc1.350.ge57e33dbd1-goog



[PATCH] sched/fair: fix vruntime_normalized for remote non-migration wakeup

2018-08-31 Thread Steve Muckle
When a task which previously ran on a given CPU is remotely queued to
wake up on that same CPU, there is a period where the task's state is
TASK_WAKING and its vruntime is not normalized. This is not accounted
for in vruntime_normalized() which will cause an
error in the task's vruntime if it is switched from the fair class
during this time, for example if it is boosted to RT priority via
rt_mutex_setprio. The rq's min_vruntime will not be subtracted from the
task's vruntime but it will be added again when the task returns to the
fair class. The task's vruntime will have been erroneously doubled and
the effective priority of the task will be reduced.

Note this will also lead to inflation of all vruntimes since the doubled
vruntime value will become the rq's min_vruntime when other tasks leave
the rq. This leads to repeated doubling of the vruntime and priority
penalty.

Fix this by recognizing a WAKING task's vruntime as normalized only if
sched_remote_wakeup is true. This indicates a migration, in which case
the vruntime would have been normalized in migrate_task_rq_fair().

Based on a similar patch from joaod...@google.com.

Suggested-by: Peter Zijlstra 
Signed-off-by: Steve Muckle 
---
 kernel/sched/fair.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index b39fb596f6c1..b3b62cf37fb6 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -9638,7 +9638,8 @@ static inline bool vruntime_normalized(struct task_struct 
*p)
 * - A task which has been woken up by try_to_wake_up() and
 *   waiting for actually being woken up by sched_ttwu_pending().
 */
-   if (!se->sum_exec_runtime || p->state == TASK_WAKING)
+   if (!se->sum_exec_runtime ||
+   (p->state == TASK_WAKING && p->sched_remote_wakeup))
return true;
 
return false;
-- 
2.19.0.rc1.350.ge57e33dbd1-goog



Re: [PATCH 2/7] Compiler Attributes: use the no-underscores syntax

2018-08-31 Thread Miguel Ojeda
On Sat, Sep 1, 2018 at 12:10 AM, Miguel Ojeda
 wrote:
> arch/parisc/boot/compressed/misc.c:#define malloc   malloc_gzip
> include/linux/decompress/mm.h:#define malloc(a) kmalloc(a, GFP_KERNEL)
> lib/inflate.c:#define malloc(a) kmalloc(a, GFP_KERNEL)
> include/linux/compiler_types.h:#define noinline_for_stack noinline
> include/linux/raid/pq.h:#define noinline __attribute__((noinline))
> tools/include/linux/compiler.h:#define noinline
> arch/mips/sgi-ip27/ip27-reset.c:#define noreturn while(1);

A better list, searching for all attributes used anywhere in the kernel:

git grep -E 
'^\s*#define\s+(address_space|alias|aligned|always_inline|assume_aligned|bitwise|bnd_legacy|cold|common|const|constructor|context|deprecated|designated_init|destructor|error|externally_visible|flatten|force|format|format|gnu_inline|hot|hotpatch|indirect_branch|latent_entropy|long_call|malloc|may_alias|mode|model|naked|nocast|noclone|noderef|noinline|no_instrument_function|nonnull|no_randomize_layout|noreturn|no_sanitize_address|optimize|packed|pure|randomize_layout|regparm|require_context|safe|section|syscall_linkage|target|tls_model|unused|used|user|vector_size|visibility|warning|warn_unused_result|weak)(\(|\s|$)'

arch/mips/sgi-ip27/ip27-reset.c:#define noreturn while(1);
 /* Silence gcc.  */
arch/parisc/boot/compressed/misc.c:#define malloc   malloc_gzip
arch/powerpc/xmon/ansidecl.h:#defineconst
drivers/gpu/drm/nouveau/nvkm/subdev/bios/init.c:#define error(fmt,
args...) bioslog(ERROR, fmt, ##args)
include/linux/compiler_attributes.h:#define   noinline
__attribute__((noinline))
include/linux/decompress/mm.h:#define malloc(a) kmalloc(a, GFP_KERNEL)
include/linux/raid/pq.h:#define noinline __attribute__((noinline))
lib/inflate.c:#define malloc(a) kmalloc(a, GFP_KERNEL)
tools/include/linux/compiler-gcc.h:#define  noinline
__attribute__((noinline))
tools/include/linux/compiler.h:#define noinline
tools/testing/selftests/futex/include/logging.h:#define error(message,
err, args...) \

None of these should make a problem. And it would may avoid people
using such common-name-macros in the future ;-)

Cheers,
Miguel


Re: [PATCH 2/7] Compiler Attributes: use the no-underscores syntax

2018-08-31 Thread Miguel Ojeda
On Sat, Sep 1, 2018 at 12:10 AM, Miguel Ojeda
 wrote:
> arch/parisc/boot/compressed/misc.c:#define malloc   malloc_gzip
> include/linux/decompress/mm.h:#define malloc(a) kmalloc(a, GFP_KERNEL)
> lib/inflate.c:#define malloc(a) kmalloc(a, GFP_KERNEL)
> include/linux/compiler_types.h:#define noinline_for_stack noinline
> include/linux/raid/pq.h:#define noinline __attribute__((noinline))
> tools/include/linux/compiler.h:#define noinline
> arch/mips/sgi-ip27/ip27-reset.c:#define noreturn while(1);

A better list, searching for all attributes used anywhere in the kernel:

git grep -E 
'^\s*#define\s+(address_space|alias|aligned|always_inline|assume_aligned|bitwise|bnd_legacy|cold|common|const|constructor|context|deprecated|designated_init|destructor|error|externally_visible|flatten|force|format|format|gnu_inline|hot|hotpatch|indirect_branch|latent_entropy|long_call|malloc|may_alias|mode|model|naked|nocast|noclone|noderef|noinline|no_instrument_function|nonnull|no_randomize_layout|noreturn|no_sanitize_address|optimize|packed|pure|randomize_layout|regparm|require_context|safe|section|syscall_linkage|target|tls_model|unused|used|user|vector_size|visibility|warning|warn_unused_result|weak)(\(|\s|$)'

arch/mips/sgi-ip27/ip27-reset.c:#define noreturn while(1);
 /* Silence gcc.  */
arch/parisc/boot/compressed/misc.c:#define malloc   malloc_gzip
arch/powerpc/xmon/ansidecl.h:#defineconst
drivers/gpu/drm/nouveau/nvkm/subdev/bios/init.c:#define error(fmt,
args...) bioslog(ERROR, fmt, ##args)
include/linux/compiler_attributes.h:#define   noinline
__attribute__((noinline))
include/linux/decompress/mm.h:#define malloc(a) kmalloc(a, GFP_KERNEL)
include/linux/raid/pq.h:#define noinline __attribute__((noinline))
lib/inflate.c:#define malloc(a) kmalloc(a, GFP_KERNEL)
tools/include/linux/compiler-gcc.h:#define  noinline
__attribute__((noinline))
tools/include/linux/compiler.h:#define noinline
tools/testing/selftests/futex/include/logging.h:#define error(message,
err, args...) \

None of these should make a problem. And it would may avoid people
using such common-name-macros in the future ;-)

Cheers,
Miguel


  1   2   3   4   5   6   7   8   9   10   >