[PATCH 3/6] security: Introduce security_settime64()

2015-07-14 Thread Baolin Wang
security_settime() returns a timespec, which is not year 2038 safe
on 32bit systems. Thus this patch introduces the security_settime64()
function with timespec64 type.

We also convert the cap_settime() helper function to use the 64bit types.

Signed-off-by: Baolin Wang 
---
 include/linux/lsm_hooks.h |5 +++--
 include/linux/security.h  |   20 +---
 security/commoncap.c  |2 +-
 security/security.c   |2 +-
 4 files changed, 22 insertions(+), 7 deletions(-)

diff --git a/include/linux/lsm_hooks.h b/include/linux/lsm_hooks.h
index 9429f05..d791f35 100644
--- a/include/linux/lsm_hooks.h
+++ b/include/linux/lsm_hooks.h
@@ -1191,7 +1191,8 @@
  * Return 0 if permission is granted.
  * @settime:
  * Check permission to change the system time.
- * struct timespec and timezone are defined in include/linux/time.h
+ * struct timespec64 is defined in include/linux/time64.h and timezone
+ * is defined in include/linux/time.h
  * @ts contains new time
  * @tz contains new timezone
  * Return 0 if permission is granted.
@@ -1324,7 +1325,7 @@ union security_list_options {
int (*quotactl)(int cmds, int type, int id, struct super_block *sb);
int (*quota_on)(struct dentry *dentry);
int (*syslog)(int type);
-   int (*settime)(const struct timespec *ts, const struct timezone *tz);
+   int (*settime)(const struct timespec64 *ts, const struct timezone *tz);
int (*vm_enough_memory)(struct mm_struct *mm, long pages);
 
int (*bprm_set_creds)(struct linux_binprm *bprm);
diff --git a/include/linux/security.h b/include/linux/security.h
index 79d85dd..105fc27 100644
--- a/include/linux/security.h
+++ b/include/linux/security.h
@@ -69,7 +69,7 @@ struct timezone;
 /* These functions are in security/commoncap.c */
 extern int cap_capable(const struct cred *cred, struct user_namespace *ns,
   int cap, int audit);
-extern int cap_settime(const struct timespec *ts, const struct timezone *tz);
+extern int cap_settime(const struct timespec64 *ts, const struct timezone *tz);
 extern int cap_ptrace_access_check(struct task_struct *child, unsigned int 
mode);
 extern int cap_ptrace_traceme(struct task_struct *parent);
 extern int cap_capget(struct task_struct *target, kernel_cap_t *effective, 
kernel_cap_t *inheritable, kernel_cap_t *permitted);
@@ -206,7 +206,13 @@ int security_capable_noaudit(const struct cred *cred, 
struct user_namespace *ns,
 int security_quotactl(int cmds, int type, int id, struct super_block *sb);
 int security_quota_on(struct dentry *dentry);
 int security_syslog(int type);
-int security_settime(const struct timespec *ts, const struct timezone *tz);
+int security_settime64(const struct timespec64 *ts, const struct timezone *tz);
+static inline int security_settime(const struct timespec *ts, const struct 
timezone *tz)
+{
+   struct timespec64 ts64 = timespec_to_timespec64(*ts);
+
+   return security_settime64(, tz);
+}
 int security_vm_enough_memory_mm(struct mm_struct *mm, long pages);
 int security_bprm_set_creds(struct linux_binprm *bprm);
 int security_bprm_check(struct linux_binprm *bprm);
@@ -457,10 +463,18 @@ static inline int security_syslog(int type)
return 0;
 }
 
+static inline int security_settime64(const struct timespec64 *ts,
+const struct timezone *tz)
+{
+   return cap_settime(ts, tz);
+}
+
 static inline int security_settime(const struct timespec *ts,
   const struct timezone *tz)
 {
-   return cap_settime(ts, tz);
+   struct timespec64 ts64 = timespec_to_timespec64(*ts);
+
+   return cap_settime(, tz);
 }
 
 static inline int security_vm_enough_memory_mm(struct mm_struct *mm, long 
pages)
diff --git a/security/commoncap.c b/security/commoncap.c
index d103f5a4..17b1f79 100644
--- a/security/commoncap.c
+++ b/security/commoncap.c
@@ -111,7 +111,7 @@ int cap_capable(const struct cred *cred, struct 
user_namespace *targ_ns,
  * Determine whether the current process may set the system clock and timezone
  * information, returning 0 if permission granted, -ve if denied.
  */
-int cap_settime(const struct timespec *ts, const struct timezone *tz)
+int cap_settime(const struct timespec64 *ts, const struct timezone *tz)
 {
if (!capable(CAP_SYS_TIME))
return -EPERM;
diff --git a/security/security.c b/security/security.c
index 595fffa..8d0dbd6 100644
--- a/security/security.c
+++ b/security/security.c
@@ -213,7 +213,7 @@ int security_syslog(int type)
return call_int_hook(syslog, 0, type);
 }
 
-int security_settime(const struct timespec *ts, const struct timezone *tz)
+int security_settime64(const struct timespec64 *ts, const struct timezone *tz)
 {
return call_int_hook(settime, 0, ts, tz);
 }
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More 

[PATCH 2/6] timekeeping: Introduce current_kernel_time64()

2015-07-14 Thread Baolin Wang
The current_kernel_time() is not year 2038 safe on 32bit systems
since it returns a timespec value. Introduce current_kernel_time64()
which returns a timespec64 value.

Signed-off-by: Baolin Wang 
---
 include/linux/timekeeping.h |9 -
 kernel/time/timekeeping.c   |6 +++---
 2 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/include/linux/timekeeping.h b/include/linux/timekeeping.h
index 3aa72e6..657ea03 100644
--- a/include/linux/timekeeping.h
+++ b/include/linux/timekeeping.h
@@ -18,10 +18,17 @@ extern int do_sys_settimeofday(const struct timespec *tv,
  * Kernel time accessors
  */
 unsigned long get_seconds(void);
-struct timespec current_kernel_time(void);
+struct timespec64 current_kernel_time64(void);
 /* does not take xtime_lock */
 struct timespec __current_kernel_time(void);
 
+static inline struct timespec current_kernel_time(void)
+{
+   struct timespec64 now = current_kernel_time64();
+
+   return timespec64_to_timespec(now);
+}
+
 /*
  * timespec based interfaces
  */
diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c
index bca3667..2d58742 100644
--- a/kernel/time/timekeeping.c
+++ b/kernel/time/timekeeping.c
@@ -1874,7 +1874,7 @@ struct timespec __current_kernel_time(void)
return timespec64_to_timespec(tk_xtime(tk));
 }
 
-struct timespec current_kernel_time(void)
+struct timespec64 current_kernel_time64(void)
 {
struct timekeeper *tk = _core.timekeeper;
struct timespec64 now;
@@ -1886,9 +1886,9 @@ struct timespec current_kernel_time(void)
now = tk_xtime(tk);
} while (read_seqcount_retry(_core.seq, seq));
 
-   return timespec64_to_timespec(now);
+   return now;
 }
-EXPORT_SYMBOL(current_kernel_time);
+EXPORT_SYMBOL(current_kernel_time64);
 
 struct timespec64 get_monotonic_coarse64(void)
 {
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 1/6] time: Introduce struct itimerspec64

2015-07-14 Thread Baolin Wang
The struct itimerspec is not year 2038 safe on 32bit systems due to
the limitation of the struct timespec members. Introduce itimerspec64
which uses struct timespec64 instead and provide conversion functions.

Signed-off-by: Baolin Wang 
---
 include/linux/time64.h |   35 +++
 1 file changed, 35 insertions(+)

diff --git a/include/linux/time64.h b/include/linux/time64.h
index 77b5df2..367d5af 100644
--- a/include/linux/time64.h
+++ b/include/linux/time64.h
@@ -12,11 +12,18 @@ typedef __s64 time64_t;
  */
 #if __BITS_PER_LONG == 64
 # define timespec64 timespec
+#define itimerspec64 itimerspec
 #else
 struct timespec64 {
time64_ttv_sec; /* seconds */
longtv_nsec;/* nanoseconds */
 };
+
+struct itimerspec64 {
+   struct timespec64 it_interval;
+   struct timespec64 it_value;
+};
+
 #endif
 
 /* Parameters used to convert the timespec values: */
@@ -45,6 +52,16 @@ static inline struct timespec64 timespec_to_timespec64(const 
struct timespec ts)
return ts;
 }
 
+static inline struct itimerspec itimerspec64_to_itimerspec(struct itimerspec64 
*its64)
+{
+   return *its64;
+}
+
+static inline struct itimerspec64 itimerspec_to_itimerspec64(struct itimerspec 
*its)
+{
+   return *its;
+}
+
 # define timespec64_equal  timespec_equal
 # define timespec64_comparetimespec_compare
 # define set_normalized_timespec64 set_normalized_timespec
@@ -77,6 +94,24 @@ static inline struct timespec64 timespec_to_timespec64(const 
struct timespec ts)
return ret;
 }
 
+static inline struct itimerspec itimerspec64_to_itimerspec(struct itimerspec64 
*its64)
+{
+   struct itimerspec ret;
+
+   ret.it_interval = timespec64_to_timespec(its64->it_interval);
+   ret.it_value = timespec64_to_timespec(its64->it_value);
+   return ret;
+}
+
+static inline struct itimerspec64 itimerspec_to_itimerspec64(struct itimerspec 
*its)
+{
+   struct itimerspec64 ret;
+
+   ret.it_interval = timespec_to_timespec64(its->it_interval);
+   ret.it_value = timespec_to_timespec64(its->it_value);
+   return ret;
+}
+
 static inline int timespec64_equal(const struct timespec64 *a,
   const struct timespec64 *b)
 {
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 0/6] Introduce 64bit accessors and structures required to address y2038 issues in the posix_clock subsystem

2015-07-14 Thread Baolin Wang
This patch series change the 32-bit time types (timespec/itimerspec) to
the 64-bit types (timespec64/itimerspec64), and add new 64bit accessor
functions, which are required in order to avoid y2038 issues in the
posix_clock subsystem.

In order to avoid spamming people too much, I'm only sending the first
few patches of the patch series, and left the other patches for later.

And if you are interested in the whole patch series, see:
https://git.linaro.org/people/baolin.wang/upstream_0627.git

Thoughts and feedback would be appreciated.

Baolin Wang (6):
  time: Introduce struct itimerspec64
  timekeeping: Introduce current_kernel_time64()
  security: Introduce security_settime64()
  time: Introduce do_sys_settimeofday64()
  time: Introduce timespec64_to_jiffies()/jiffies_to_timespec64()
  cputime: Introduce cputime_to_timespec64()/timespec64_to_cputime()

 arch/powerpc/include/asm/cputime.h|6 +++---
 arch/s390/include/asm/cputime.h   |8 
 include/asm-generic/cputime_jiffies.h |   10 +-
 include/asm-generic/cputime_nsecs.h   |6 +++---
 include/linux/cputime.h   |   16 +++
 include/linux/jiffies.h   |   22 ++---
 include/linux/lsm_hooks.h |5 +++--
 include/linux/security.h  |   20 ---
 include/linux/time64.h|   35 +
 include/linux/timekeeping.h   |   24 +++---
 kernel/time/time.c|   28 +++---
 kernel/time/timekeeping.c |6 +++---
 security/commoncap.c  |2 +-
 security/security.c   |2 +-
 14 files changed, 148 insertions(+), 42 deletions(-)

-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v3] [SCSI] mpt2sas, mpt3sas: Abort initialization if no memory I/O resources detected

2015-07-14 Thread Yinghai Lu
On Tue, Jul 14, 2015 at 9:49 PM, Sreekanth Reddy
 wrote:
> Driver crashes if the BIOS do not set up at least one
> memory I/O resource. This failure can happen if the device is too
> slow to respond during POST and is missed by the BIOS, but Linux
> then detects the device later in the boot process.

But pci subsystem should assign resources to those unassigned BAR.

Do you mean even kernel can not assign resource to them? or it takes so long for
mpt FW to get ready?

Thanks

Yinghai
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 3/5] x86, acpi, cpu-hotplug: Introduce apicid_to_cpuid[] array to store persistent cpuid <-> apicid mapping.

2015-07-14 Thread Jiang Liu
On 2015/7/15 11:33, Tang Chen wrote:
> Hi Mika,
> 
> On 07/07/2015 07:14 PM, Mika Penttilä wrote:
>> I think you forgot to reserve CPU 0 for BSP in cpuid mask.
> 
> Sorry for the late reply.
> 
> I'm not familiar with BSP.  Do you mean in get_cpuid(),
> I should reserve 0 for physical cpu0 in BSP ?
> 
> Would you please share more detail ?

BSP stands for "Bootstrapping Processor". In other word,
BSP is CPU0.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [RFC v4 17/25] powerpc, fbdev: Use arch_nvram_ops methods instead of nvram_read_byte() and nvram_write_byte()

2015-07-14 Thread Finn Thain

On Tue, 14 Jul 2015, Benjamin Herrenschmidt wrote:

> On Tue, 2015-07-14 at 17:58 +1000, Finn Thain wrote:
> > Make use of arch_nvram_ops in device drivers so that the nvram_* 
> > function exports can be removed.
> > 
> > Since they are no longer global symbols, rename the PPC32 nvram_* 
> > functions appropriately.
> > 
> > Add the missing CONFIG_NVRAM test to imsttfb to avoid a build failure.
> > 
> > Add a CONFIG_PPC32 test to matroxfb because PPC64 doesn't implement 
> > the read_byte() method.
> 
> This is a bit fishy in a way because some of that nvram stuff is really 
> about powermac/apple nvram offsets, ie, "XPRAM".

Yes, the generalization that PPC64 does not have XPRAM is wrong, but that 
wasn't originally my doing. If we were to address that issue, this patch 
series may not be the best place to do so.

The situation presently is that CONFIG_NVRAM cannot be enabled on PPC64. I 
took advantage of that simplification, despite the corner cases where it 
fails.

The corner cases are found among PPC64 systems with Matrox cards. The 
other PowerMac video drivers are not really relevant here due to "depends 
on PPC32" or "#if defined(CONFIG_PPC32)", meaning that nvram_read_byte() 
isn't a problem there.

Perhaps only dual-boot systems are at issue because AFAIK only Mac OS 
offers a user friendly way to edit XPRAM settings (?) Further, does the 
video mode setting in XPRAM relate only to the MacOS main screen and not 
to other devices? That is, are we concerned here only with dual-boot PPC64 
machines with one matrox card, as the main screen, and no Linux desktop 
environment and no video mode settings on the kernel command line?

> Maybe we should have a dedicated accessor for "mac_xpram" and NULL-check 
> it rather than using ifdef's ?

I wanted arch_nvram_ops to be const data, which means a NULL check won't 
work, because defined(CONFIG_PPC_PMAC) does not imply availability of 
XPRAM at run-time.

There is a similar situation in the m68k portion of this patch series: a 
multi-platform kernel binary might run on an Atari or a Mac. On m68k I 
resolved this with MACH_IS_MAC(), which is analogous to 
machine_is(powermac).

So I can see how to implement XPRAM for matroxfb and imsttfb on PPC64. But 
this is an enhancement that I would defer unless the present limitation is 
already problematic.

-- 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 17/36] PCI: Add support for more than two alt_size under same bridge

2015-07-14 Thread Yijing Wang
On 2015/7/15 13:08, Yinghai Lu wrote:
> On Tue, Jul 14, 2015 at 8:07 PM, Yijing Wang  wrote:
>> On 2015/7/7 7:39, Yinghai Lu wrote:
>>> Need to increase size to make sure it could fit all alt entries.
>>>
>>> So at last, we use 8M/17M as parent bridge alt_align/alt_size.
>>
>> Tested-by: Yijing Wang 
> 
> Thanks for testing.
> 
>>
>> Hi Yinghai, does this patch depend on the previous items in this patchset ?
> 
> Yes, it depends most of patches from patch1 to this patch.
> 
>> Could you provide another version of this patch for stable branch, eg. 3.10 
>> stable ?
> 
> That is RHEL 7 kernel, right ?

Yes.

> 
> After those patches get into upstream, I will try to port them to 3.10 stable.

Thanks very much!

> 
> Thanks
> 
> Yinghai
> 
> .
> 


-- 
Thanks!
Yijing

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: Re: [PATCH 1/3] panic: Disable crash_kexec_post_notifiers if kdump is not available

2015-07-14 Thread Masami Hiramatsu
On 2015/07/15 3:23, Vivek Goyal wrote:
> On Tue, Jul 14, 2015 at 01:01:12PM -0500, Eric W. Biederman wrote:
>> Vivek Goyal  writes:
>>
>>> On Tue, Jul 14, 2015 at 05:29:53PM +, dwal...@fifo99.com wrote:
>>>
>>> [..]
 If a machine is failing, there are high chance it can't deliver you the
 notification. Detecting that failure suing some kind of polling 
 mechanism
 might be more reliable. And it will make even kdump mechanism more
 reliable so that it does not have to run panic notifiers after the 
 crash.
>>>
>>> I think what your suggesting is that my company should change how it's 
>>> hardware works
>>> and that's not really an option for me. This isn't a simple thing like 
>>> checking over the
>>> network if the machine is down or not, this is way more complex 
>>> hardware design.
>>
>> That means you are ready to live with an unreliable design. There might 
>> be
>> cases where notifier does not get run properly and you will not do switch
>> despite the fact that OS has failed. I was just trying to nudge you in
>> a direction which could be more reliable mechanism.
>
> Sigh I see some deep confusion going on here.
>
> The panic notifiers are just that panic notifiers.  They have not been
> nor should they be tied to kexec.   If those notifiers force a switch
> over of between machines I fail to see why you would care if it was
> kexec or another panic situation that is forcing that switchover.

 Hidehiro isn't fixing the failover situation on my side, he's fixing 
 register
 information collection when crash_kexec_post_notifiers is used.
>>>
>>> Sure. Given that we have created this new parameter, let us fix it so that
>>> we can capture the other cpu register state in crash dump.
>>>
>>> I am little disappointed that it was not tested well when this parameter was
>>> introuced. We should have atleast tested it to the extent to see if there
>>> is proper cpu state present for all cpus in the crash dump.
>>>
>>> At that point of time it looked like a simple modification
>>> to allow panic notifiers before crash_kexec().
>>
>> Either that or we say no one cares enough, and it known broken so let's
>> just revert the fool thing.
> 
> Masami, you introduced this option. Are you fine with the revert? Is it
> really being used and tested?

Actually, it is tested but under very limited situation. I think we
need a clear acceptance criteria, IOW, we need a testset for kdump
so that we can make things better.
Would you have it? maybe we can push it into kselftest.

>> I honestly can't see how to support panic notifiers, before kexec.
>> There is no way to tell what is being done and all of the pieces
>> including smp_send_stop are known to be buggy.
> 
> we should be able to replace smp_send_stop() with what crash_kexec() is
> doing to stop the machine? If yes, then it should be fine I guess. This
> parameter description clearly says that specify it at your own risk. So
> we are not issuing a big support statement for successful kdump after
> panic notifiers. If it is something fixable, otherwise user needs
> to deal with it.

Agreed (as I've sent in other replay).

Thank you,

-- 
Masami HIRAMATSU
Linux Technology Research Center, System Productivity Research Dept.
Center for Technology Innovation - Systems Engineering
Hitachi, Ltd., Research & Development Group
E-mail: masami.hiramatsu...@hitachi.com
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 0/2] CLK: TI: add dpll_clksel_mac_clk node

2015-07-14 Thread Tony Lindgren
* Tero Kristo  [150714 06:30]:
> On 07/14/2015 02:06 PM, Tony Lindgren wrote:
> >* Keerthy  [150625 06:48]:
> >>
> >>On Thursday 18 June 2015 02:36 PM, Mugunthan V N wrote:
> >>>On Thursday 18 June 2015 01:31 PM, Keerthy wrote:
> The series adds the missing clock node needed for cpsw.
> 
> Keerthy (2):
>    CLK: TI: add dpll_clksel_mac_clk node
>    ARM: dts: am4372: Set the default clock rate for dpll_clksel_mac_clk
>  clock
> 
>   arch/arm/boot/dts/am4372.dtsi| 7 +--
>   arch/arm/boot/dts/am43xx-clocks.dtsi | 9 +
>   drivers/clk/ti/clk-43xx.c| 1 +
>   3 files changed, 15 insertions(+), 2 deletions(-)
> 
> >>>
> >>>Tested-by: Mugunthan V N 
> >>
> >>Thanks Mugunthan.
> >>
> >>A gentle ping on this series.
> >
> >Tero, care to review this series?
> 
> Acked-by: Tero Kristo 
> 
> I guess this should go through your tree as this is mostly dts changes?

Actually I don't have anything coming for the clock dtsi files for
v4.3 merge window, so it's best that you queue these. For the dts
changes, please feel free to add:

Acked-by: Tony Lindgren 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 17/36] PCI: Add support for more than two alt_size under same bridge

2015-07-14 Thread Yinghai Lu
On Tue, Jul 14, 2015 at 8:07 PM, Yijing Wang  wrote:
> On 2015/7/7 7:39, Yinghai Lu wrote:
>> Need to increase size to make sure it could fit all alt entries.
>>
>> So at last, we use 8M/17M as parent bridge alt_align/alt_size.
>
> Tested-by: Yijing Wang 

Thanks for testing.

>
> Hi Yinghai, does this patch depend on the previous items in this patchset ?

Yes, it depends most of patches from patch1 to this patch.

> Could you provide another version of this patch for stable branch, eg. 3.10 
> stable ?

That is RHEL 7 kernel, right ?

After those patches get into upstream, I will try to port them to 3.10 stable.

Thanks

Yinghai
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v2 05/23] staging: rtl8192e: Remove unused fields from rtllib_stats

2015-07-14 Thread Sudip Mukherjee
On Wed, Jul 15, 2015 at 10:27:20AM +0530, Sudip Mukherjee wrote:
> On Tue, Jul 14, 2015 at 10:04:08PM +0200, Mateusz Kulikowski wrote:
> > None of them are used in the driver.
> > 
> > Signed-off-by: Mateusz Kulikowski 
> > ---
> >  drivers/staging/rtl8192e/rtllib.h | 19 ---
> >  1 file changed, 19 deletions(-)
> > 
> > diff --git a/drivers/staging/rtl8192e/rtllib.h 
> > b/drivers/staging/rtl8192e/rtllib.h
> > index 8ba92ed..dc0653a 100644
> > --- a/drivers/staging/rtl8192e/rtllib.h
> > +++ b/drivers/staging/rtl8192e/rtllib.h
> > @@ -691,27 +691,8 @@ struct rtllib_frag_entry {
> >  };
> >  
> >  struct rtllib_stats {
> > -   unsigned int tx_unicast_frames;
> > -   unsigned int tx_multicast_frames;
> > -   unsigned int tx_fragments;
> > -   unsigned int tx_unicast_octets;
> > -   unsigned int tx_multicast_octets;
> > -   unsigned int tx_deferred_transmissions;
> > -   unsigned int tx_single_retry_frames;
> > -   unsigned int tx_multiple_retry_frames;
> > -   unsigned int tx_retry_limit_exceeded;
> > unsigned int tx_discards;
> > -   unsigned int rx_unicast_frames;
> > -   unsigned int rx_multicast_frames;
> > -   unsigned int rx_fragments;
> > -   unsigned int rx_unicast_octets;
> > -   unsigned int rx_multicast_octets;
> > -   unsigned int rx_fcs_errors;
> > -   unsigned int rx_discards_no_buffer;
> > -   unsigned int tx_discards_wrong_sa;
> > unsigned int rx_discards_undecryptable;
> Dan had commented before that tx_discards and rx_discards_undecryptable
> are also not used. Their only uses are:
>  ieee->ieee_stats.rx_discards_undecryptable++ and
>  ieee->ieee_stats.tx_discards++

Ok, next patch does that. Sorry for the noise.
 
regards
sudip
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v2 05/23] staging: rtl8192e: Remove unused fields from rtllib_stats

2015-07-14 Thread Sudip Mukherjee
On Tue, Jul 14, 2015 at 10:04:08PM +0200, Mateusz Kulikowski wrote:
> None of them are used in the driver.
> 
> Signed-off-by: Mateusz Kulikowski 
> ---
>  drivers/staging/rtl8192e/rtllib.h | 19 ---
>  1 file changed, 19 deletions(-)
> 
> diff --git a/drivers/staging/rtl8192e/rtllib.h 
> b/drivers/staging/rtl8192e/rtllib.h
> index 8ba92ed..dc0653a 100644
> --- a/drivers/staging/rtl8192e/rtllib.h
> +++ b/drivers/staging/rtl8192e/rtllib.h
> @@ -691,27 +691,8 @@ struct rtllib_frag_entry {
>  };
>  
>  struct rtllib_stats {
> - unsigned int tx_unicast_frames;
> - unsigned int tx_multicast_frames;
> - unsigned int tx_fragments;
> - unsigned int tx_unicast_octets;
> - unsigned int tx_multicast_octets;
> - unsigned int tx_deferred_transmissions;
> - unsigned int tx_single_retry_frames;
> - unsigned int tx_multiple_retry_frames;
> - unsigned int tx_retry_limit_exceeded;
>   unsigned int tx_discards;
> - unsigned int rx_unicast_frames;
> - unsigned int rx_multicast_frames;
> - unsigned int rx_fragments;
> - unsigned int rx_unicast_octets;
> - unsigned int rx_multicast_octets;
> - unsigned int rx_fcs_errors;
> - unsigned int rx_discards_no_buffer;
> - unsigned int tx_discards_wrong_sa;
>   unsigned int rx_discards_undecryptable;
Dan had commented before that tx_discards and rx_discards_undecryptable
are also not used. Their only uses are:
 ieee->ieee_stats.rx_discards_undecryptable++ and
 ieee->ieee_stats.tx_discards++

regards
sudip
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH RFC] vfs: add a O_NOMTIME flag

2015-07-14 Thread NeilBrown
On Tue, 14 Jul 2015 15:13:00 +0200 Pavel Machek  wrote:

> Hi!
> 
> > BTW When you "swap" to a file the mtime doesn't get updated.  No one seems 
> > to
> > complain about that.  I guess it is a rather narrow use-case though.
> 
> Actually yes, I'd like to complain.
> 
> It was not swap, it was mount -o loop, but I guess that's the same
> case. Then rsync refused to work on that file... and being on slow ARM
> system it took me a while to figure out WTF is going on.
> 
> So yes, we have problems with mtime, and yes, they matter.
>   Pavel

Odd...
I assume you mean
  mount -o loop /some/file  /mountpoint

and then when you write to the filesystem on /mountpoint the mtime
of /some/file doesn't get updated?
I think it should.
 drivers/block/loop.c uses vfs_iter_write() to write to a file.
 That calls f_op->write_iter which will typically call
 generic_file_write_iter() which will call file_update_time() to update
 the time stamps.

What filesystem was /some/file on?
I just did some testing on ext4 and it seems to do the right thing
mtime gets updated.

NeilBrown
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] MAINTAINERS: Update LSILOGIC MPT FUSION DRIVERS (FC/SAS/SPI) maintainers list

2015-07-14 Thread Sreekanth Reddy
Updating maintainers list for the entry LSILOGIC MPT FUSION DRIVERS in
MAINTAINERS file

Signed-off-by: Sreekanth Reddy 
---
 MAINTAINERS | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index 2d3d55c..c3cd5c9 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -6348,10 +6348,9 @@ S:   Maintained
 F: arch/arm/mach-lpc32xx/
 
 LSILOGIC MPT FUSION DRIVERS (FC/SAS/SPI)
-M: Nagalakshmi Nandigama 
-M: Praveen Krishnamoorthy 
+M: Sathya Prakash 
 M: Sreekanth Reddy 
-M: Abhijit Mahajan 
+M: Chaitra Basappa 
 L: mpt-fusionlinux@avagotech.com
 L: linux-s...@vger.kernel.org
 W: http://www.lsilogic.com/support
-- 
2.0.2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v3] [SCSI] mpt2sas, mpt3sas: Abort initialization if no memory I/O resources detected

2015-07-14 Thread Sreekanth Reddy
Driver crashes if the BIOS do not set up at least one
memory I/O resource. This failure can happen if the device is too
slow to respond during POST and is missed by the BIOS, but Linux
then detects the device later in the boot process.

Changes in v3:
   Rearranged the code to remove the code redundancy

Signed-off-by: Sreekanth Reddy 
---
 drivers/scsi/mpt2sas/mpt2sas_base.c | 16 +---
 drivers/scsi/mpt3sas/mpt3sas_base.c | 16 +---
 2 files changed, 18 insertions(+), 14 deletions(-)

diff --git a/drivers/scsi/mpt2sas/mpt2sas_base.c 
b/drivers/scsi/mpt2sas/mpt2sas_base.c
index 11248de..6dec7cf 100644
--- a/drivers/scsi/mpt2sas/mpt2sas_base.c
+++ b/drivers/scsi/mpt2sas/mpt2sas_base.c
@@ -1557,7 +1557,8 @@ mpt2sas_base_map_resources(struct MPT2SAS_ADAPTER *ioc)
goto out_fail;
}
 
-   for (i = 0, memap_sz = 0, pio_sz = 0 ; i < DEVICE_COUNT_RESOURCE; i++) {
+   for (i = 0, memap_sz = 0, pio_sz = 0; (i < DEVICE_COUNT_RESOURCE) &&
+(!memap_sz || !pio_sz); i++) {
if (pci_resource_flags(pdev, i) & IORESOURCE_IO) {
if (pio_sz)
continue;
@@ -1572,16 +1573,17 @@ mpt2sas_base_map_resources(struct MPT2SAS_ADAPTER *ioc)
chip_phys = (u64)ioc->chip_phys;
memap_sz = pci_resource_len(pdev, i);
ioc->chip = ioremap(ioc->chip_phys, memap_sz);
-   if (ioc->chip == NULL) {
-   printk(MPT2SAS_ERR_FMT "unable to map "
-   "adapter memory!\n", ioc->name);
-   r = -EINVAL;
-   goto out_fail;
-   }
}
}
}
 
+   if (ioc->chip == NULL) {
+   printk(MPT2SAS_ERR_FMT "unable to map adapter memory! "
+  "or resource not found\n", ioc->name);
+   r = -EINVAL;
+   goto out_fail;
+   }
+
_base_mask_interrupts(ioc);
 
r = _base_get_ioc_facts(ioc, CAN_SLEEP);
diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.c 
b/drivers/scsi/mpt3sas/mpt3sas_base.c
index 14a781b..43f87e9 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_base.c
+++ b/drivers/scsi/mpt3sas/mpt3sas_base.c
@@ -1843,7 +1843,8 @@ mpt3sas_base_map_resources(struct MPT3SAS_ADAPTER *ioc)
goto out_fail;
}
 
-   for (i = 0, memap_sz = 0, pio_sz = 0 ; i < DEVICE_COUNT_RESOURCE; i++) {
+   for (i = 0, memap_sz = 0, pio_sz = 0; (i < DEVICE_COUNT_RESOURCE) &&
+(!memap_sz || !pio_sz); i++) {
if (pci_resource_flags(pdev, i) & IORESOURCE_IO) {
if (pio_sz)
continue;
@@ -1856,15 +1857,16 @@ mpt3sas_base_map_resources(struct MPT3SAS_ADAPTER *ioc)
chip_phys = (u64)ioc->chip_phys;
memap_sz = pci_resource_len(pdev, i);
ioc->chip = ioremap(ioc->chip_phys, memap_sz);
-   if (ioc->chip == NULL) {
-   pr_err(MPT3SAS_FMT "unable to map adapter 
memory!\n",
-   ioc->name);
-   r = -EINVAL;
-   goto out_fail;
-   }
}
}
 
+   if (ioc->chip == NULL) {
+   pr_err(MPT3SAS_FMT "unable to map adapter memory! "
+   " or resource not found\n", ioc->name);
+   r = -EINVAL;
+   goto out_fail;
+   }
+
_base_mask_interrupts(ioc);
 
r = _base_get_ioc_facts(ioc, CAN_SLEEP);
-- 
2.0.2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 4/5] staging: sm7xxfb: define new macros

2015-07-14 Thread Sudip Mukherjee
On Tue, Jul 14, 2015 at 08:05:08PM -0700, Greg Kroah-Hartman wrote:
> On Tue, Jul 07, 2015 at 01:44:36PM +0530, Sudip Mukherjee wrote:
> > +#define mmio_addr  0x00c0
> > +#define seqw17
> 
> Odd, empty macros are not good, because:
> 
> > -#ifdef __BIG_ENDIAN
> > if (sfb->fb->var.bits_per_pixel == 32)
> > -   smtc_seqw(0x17, 0x30);
> > -#endif
> > +   seqw17;
> 
> That just looks wrong :(
I think it will look better in c file if I make it as
#define seqw17()
I will respin the patches and send.

regards
sudip 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v2 0/4] Add Broadcom North Star 2 support

2015-07-14 Thread Ray Jui
This patch series adds Broadcom North Star 2 (NS2) SoC support. NS2 is an ARMv8
based SoC and under the Broadcom iProc family.

Sorry for tying this with the Broadcom iProc PCIe driver fixes for ARM64. I
have to tie them together because iProc PCIe support is enabled by default
when ARCH_BCM_IPROC is enabled. Without the fixes in the iProc PCIe driver,
enabling CONFIG_ARCH_BCM_IPROC would break the build for arm64 defconfig. Let
me know if there's a better way to handle this.

This patch series is generated based on v4.2-rc2 and tested on Broadcom NS2 SVK

Code available on GITHUB: https://github.com/Broadcom/arm64-linux.git
branch is ns2-core-v2

Changes from V1:
- Took Arnd's advice to tweak the location of struct pci_sys_data within
struct iproc_pcie. This helps to get rid of most of the CONFIG_ARM wrap in
iProc PCIe core driver
- Use stdout-path and alias for serial console in NS2 SVK dts
- Add all 4 CPU descriptions in NS2 dtsi
- Remove "clock-frequency" property in the armv8 timer node so timer frequency
can be determined based on readings from CNTFRQ_EL0
- Remove config flag ARCH_BCM_NS2. Leave only ARCH_BCM_IPROC for all Broadcom
arm64 SoCs as advised

Ray Jui (4):
  PCI: iproc: enable arm64 support for iProc PCIe
  PCI: iproc: Fix ARM64 dependency in Kconfig
  arm64: Add Broadcom iProc family support
  arm64: dts: Add Broadcom North Star 2 support

 Documentation/devicetree/bindings/arm/bcm/ns2.txt |9 ++
 arch/arm64/Kconfig|5 +
 arch/arm64/boot/dts/Makefile  |1 +
 arch/arm64/boot/dts/broadcom/Makefile |5 +
 arch/arm64/boot/dts/broadcom/ns2-svk.dts  |   60 +++
 arch/arm64/boot/dts/broadcom/ns2.dtsi |  118 +
 arch/arm64/configs/defconfig  |2 +
 drivers/pci/host/Kconfig  |2 +-
 drivers/pci/host/pcie-iproc.c |   15 +--
 drivers/pci/host/pcie-iproc.h |8 +-
 10 files changed, 211 insertions(+), 14 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/arm/bcm/ns2.txt
 create mode 100644 arch/arm64/boot/dts/broadcom/Makefile
 create mode 100644 arch/arm64/boot/dts/broadcom/ns2-svk.dts
 create mode 100644 arch/arm64/boot/dts/broadcom/ns2.dtsi

-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v2 2/4] PCI: iproc: Fix ARM64 dependency in Kconfig

2015-07-14 Thread Ray Jui
Allow Broadcom iProc PCIe core driver to be compiled for ARM64

Signed-off-by: Ray Jui 
Reviewed-by: Vikram Prakash 
Reviewed-by: Scott Branden 
---
 drivers/pci/host/Kconfig |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/pci/host/Kconfig b/drivers/pci/host/Kconfig
index c132bdd..d2c6144 100644
--- a/drivers/pci/host/Kconfig
+++ b/drivers/pci/host/Kconfig
@@ -117,7 +117,7 @@ config PCI_VERSATILE
 
 config PCIE_IPROC
tristate "Broadcom iProc PCIe controller"
-   depends on OF && ARM
+   depends on OF && (ARM || ARM64)
default n
help
  This enables the iProc PCIe core controller support for Broadcom's
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v2 3/4] arm64: Add Broadcom iProc family support

2015-07-14 Thread Ray Jui
This patch adds support to Broadcom's iProc family of arm64 based SoCs
in the arm64 Kconfig and defconfig files

Signed-off-by: Ray Jui 
Reviewed-by: Scott Branden 
---
 arch/arm64/Kconfig   |5 +
 arch/arm64/configs/defconfig |2 ++
 2 files changed, 7 insertions(+)

diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index 318175f..969ef4a 100644
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -162,6 +162,11 @@ source "kernel/Kconfig.freezer"
 
 menu "Platform selection"
 
+config ARCH_BCM_IPROC
+   bool "Broadcom iProc SoC Family"
+   help
+ This enables support for Broadcom iProc based SoCs
+
 config ARCH_EXYNOS
bool
help
diff --git a/arch/arm64/configs/defconfig b/arch/arm64/configs/defconfig
index 4e17e7e..c83d51f 100644
--- a/arch/arm64/configs/defconfig
+++ b/arch/arm64/configs/defconfig
@@ -31,6 +31,7 @@ CONFIG_MODULES=y
 CONFIG_MODULE_UNLOAD=y
 # CONFIG_BLK_DEV_BSG is not set
 # CONFIG_IOSCHED_DEADLINE is not set
+CONFIG_ARCH_BCM_IPROC=y
 CONFIG_ARCH_EXYNOS7=y
 CONFIG_ARCH_FSL_LS2085A=y
 CONFIG_ARCH_HISI=y
@@ -102,6 +103,7 @@ CONFIG_SERIO_AMBAKMI=y
 CONFIG_LEGACY_PTY_COUNT=16
 CONFIG_SERIAL_8250=y
 CONFIG_SERIAL_8250_CONSOLE=y
+CONFIG_SERIAL_8250_DW=y
 CONFIG_SERIAL_8250_MT6577=y
 CONFIG_SERIAL_AMBA_PL011=y
 CONFIG_SERIAL_AMBA_PL011_CONSOLE=y
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v2 1/4] PCI: iproc: enable arm64 support for iProc PCIe

2015-07-14 Thread Ray Jui
This patch enables arm64 support to the iProc PCIe driver

Signed-off-by: Ray Jui 
Reviewed-by: Scott Branden 
---
 drivers/pci/host/pcie-iproc.c |   15 ---
 drivers/pci/host/pcie-iproc.h |8 ++--
 2 files changed, 10 insertions(+), 13 deletions(-)

diff --git a/drivers/pci/host/pcie-iproc.c b/drivers/pci/host/pcie-iproc.c
index d77481e..8a556d5 100644
--- a/drivers/pci/host/pcie-iproc.c
+++ b/drivers/pci/host/pcie-iproc.c
@@ -58,11 +58,6 @@
 #define SYS_RC_INTX_EN   0x330
 #define SYS_RC_INTX_MASK 0xf
 
-static inline struct iproc_pcie *sys_to_pcie(struct pci_sys_data *sys)
-{
-   return sys->private_data;
-}
-
 /**
  * Note access to the configuration registers are protected at the higher layer
  * by 'pci_lock' in drivers/pci/access.c
@@ -71,8 +66,7 @@ static void __iomem *iproc_pcie_map_cfg_bus(struct pci_bus 
*bus,
unsigned int devfn,
int where)
 {
-   struct pci_sys_data *sys = bus->sysdata;
-   struct iproc_pcie *pcie = sys_to_pcie(sys);
+   struct iproc_pcie *pcie = bus->sysdata;
unsigned slot = PCI_SLOT(devfn);
unsigned fn = PCI_FUNC(devfn);
unsigned busno = bus->number;
@@ -208,10 +202,7 @@ int iproc_pcie_setup(struct iproc_pcie *pcie, struct 
list_head *res)
 
iproc_pcie_reset(pcie);
 
-   pcie->sysdata.private_data = pcie;
-
-   bus = pci_create_root_bus(pcie->dev, 0, _pcie_ops,
- >sysdata, res);
+   bus = pci_create_root_bus(pcie->dev, 0, _pcie_ops, pcie, res);
if (!bus) {
dev_err(pcie->dev, "unable to create PCI root bus\n");
ret = -ENOMEM;
@@ -229,7 +220,9 @@ int iproc_pcie_setup(struct iproc_pcie *pcie, struct 
list_head *res)
 
pci_scan_child_bus(bus);
pci_assign_unassigned_bus_resources(bus);
+#ifdef CONFIG_ARM
pci_fixup_irqs(pci_common_swizzle, pcie->map_irq);
+#endif
pci_bus_add_devices(bus);
 
return 0;
diff --git a/drivers/pci/host/pcie-iproc.h b/drivers/pci/host/pcie-iproc.h
index ba0a108..0ee9673 100644
--- a/drivers/pci/host/pcie-iproc.h
+++ b/drivers/pci/host/pcie-iproc.h
@@ -18,18 +18,22 @@
 
 /**
  * iProc PCIe device
+ * @sysdata: Per PCI controller data. This needs to be kept at the beginning of
+ * struct iproc_pcie, to enable support of both ARM32 and ARM64 platforms with
+ * minimal changes in the iProc PCIe core driver
  * @dev: pointer to device data structure
  * @base: PCIe host controller I/O register base
  * @resources: linked list of all PCI resources
- * @sysdata: Per PCI controller data
  * @root_bus: pointer to root bus
  * @phy: optional PHY device that controls the Serdes
  * @irqs: interrupt IDs
  */
 struct iproc_pcie {
+#ifdef CONFIG_ARM
+   struct pci_sys_data sysdata;
+#endif
struct device *dev;
void __iomem *base;
-   struct pci_sys_data sysdata;
struct pci_bus *root_bus;
struct phy *phy;
int irqs[IPROC_PCIE_MAX_NUM_IRQS];
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v2 4/4] arm64: dts: Add Broadcom North Star 2 support

2015-07-14 Thread Ray Jui
Add Broadcom NS2 device tree binding document. Also add initial device
tree dtsi for Broadcom North Star 2 (NS2) SoC and board support for NS2
SVK board

Signed-off-by: Jon Mason 
Signed-off-by: Ray Jui 
Reviewed-by: Scott Branden 
---
 Documentation/devicetree/bindings/arm/bcm/ns2.txt |9 ++
 arch/arm64/boot/dts/Makefile  |1 +
 arch/arm64/boot/dts/broadcom/Makefile |5 +
 arch/arm64/boot/dts/broadcom/ns2-svk.dts  |   60 +++
 arch/arm64/boot/dts/broadcom/ns2.dtsi |  118 +
 5 files changed, 193 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/arm/bcm/ns2.txt
 create mode 100644 arch/arm64/boot/dts/broadcom/Makefile
 create mode 100644 arch/arm64/boot/dts/broadcom/ns2-svk.dts
 create mode 100644 arch/arm64/boot/dts/broadcom/ns2.dtsi

diff --git a/Documentation/devicetree/bindings/arm/bcm/ns2.txt 
b/Documentation/devicetree/bindings/arm/bcm/ns2.txt
new file mode 100644
index 000..35f056f
--- /dev/null
+++ b/Documentation/devicetree/bindings/arm/bcm/ns2.txt
@@ -0,0 +1,9 @@
+Broadcom North Star 2 (NS2) device tree bindings
+
+
+Boards with NS2 shall have the following properties:
+
+Required root node property:
+
+NS2 SVK board
+compatible = "brcm,ns2-svk", "brcm,ns2";
diff --git a/arch/arm64/boot/dts/Makefile b/arch/arm64/boot/dts/Makefile
index 38913be..9f95941 100644
--- a/arch/arm64/boot/dts/Makefile
+++ b/arch/arm64/boot/dts/Makefile
@@ -1,6 +1,7 @@
 dts-dirs += amd
 dts-dirs += apm
 dts-dirs += arm
+dts-dirs += broadcom
 dts-dirs += cavium
 dts-dirs += exynos
 dts-dirs += freescale
diff --git a/arch/arm64/boot/dts/broadcom/Makefile 
b/arch/arm64/boot/dts/broadcom/Makefile
new file mode 100644
index 000..e21fe66
--- /dev/null
+++ b/arch/arm64/boot/dts/broadcom/Makefile
@@ -0,0 +1,5 @@
+dtb-$(CONFIG_ARCH_BCM_IPROC) += ns2-svk.dtb
+
+always := $(dtb-y)
+subdir-y   := $(dts-dirs)
+clean-files:= *.dtb
diff --git a/arch/arm64/boot/dts/broadcom/ns2-svk.dts 
b/arch/arm64/boot/dts/broadcom/ns2-svk.dts
new file mode 100644
index 000..a43d93f
--- /dev/null
+++ b/arch/arm64/boot/dts/broadcom/ns2-svk.dts
@@ -0,0 +1,60 @@
+/*
+ *  BSD LICENSE
+ *
+ *  Copyright(c) 2015 Broadcom Corporation.  All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions
+ *  are met:
+ *
+ ** Redistributions of source code must retain the above copyright
+ *  notice, this list of conditions and the following disclaimer.
+ ** Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in
+ *  the documentation and/or other materials provided with the
+ *  distribution.
+ ** Neither the name of Broadcom Corporation nor the names of its
+ *  contributors may be used to endorse or promote products derived
+ *  from this software without specific prior written permission.
+ *
+ *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ *  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ *  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ *  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ *  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/dts-v1/;
+
+#include "ns2.dtsi"
+
+/ {
+   model = "Broadcom NS2 SVK";
+   compatible = "brcm,ns2-svk", "brcm,ns2";
+
+   aliases {
+   serial0 = 
+   };
+
+   chosen {
+   stdout-path = "serial0:115200n8";
+   bootargs = "earlycon=uart8250,mmio32,0x6613";
+   };
+
+   memory {
+   device_type = "memory";
+   reg = <0x0 0x8000 0x 0x4000>;
+   };
+
+   soc: soc {
+   uart3: serial@6613 {
+   status = "ok";
+   };
+   };
+};
diff --git a/arch/arm64/boot/dts/broadcom/ns2.dtsi 
b/arch/arm64/boot/dts/broadcom/ns2.dtsi
new file mode 100644
index 000..3c92d92
--- /dev/null
+++ b/arch/arm64/boot/dts/broadcom/ns2.dtsi
@@ -0,0 +1,118 @@
+/*
+ *  BSD LICENSE
+ *
+ *  Copyright(c) 2015 Broadcom Corporation.  All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions
+ *  are met:
+ *
+ ** 

Re: compile failure linux 3.10 with gcc 4.9.3 for mips

2015-07-14 Thread Khem Raj
Reinoud Koornstra  gmail.com> writes:

> 
> Hi Everyone,
> 
> Did anybody enounter the following compiler problem with linux 3.10.81?
> gcc version is 4.9.3 for mips.
> 
> arch/mips/kernel/r4k_fpu.S: Assembler messages:
> arch/mips/kernel/r4k_fpu.S:59: Error: opcode not supported on this
> processor: mips3 (mips3) `sdc1 $f0,272+0($4)'

following backport might help

https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit?
id=842dfc11ea9a21f9825167c8a4f2834b205b0a79

> 
> Thanks,
> 
> Reinoud.
> 




--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


linux-next: Tree for Jul 15

2015-07-14 Thread Stephen Rothwell
Hi all,

Changes since 20150714:

New tree: ftrace-fixes

The drm-intel tree gained another conflict against the drm-intel-fixes
tree.

The drm-misc tree lost its build failure.

The tip tree gained a build failure so I applied a fix patch.

Non-merge commits (relative to Linus' tree): 1971
 1793 files changed, 88842 insertions(+), 26978 deletions(-)



I have created today's linux-next tree at
git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
(patches at http://www.kernel.org/pub/linux/kernel/next/ ).  If you
are tracking the linux-next tree using git, you should not use "git pull"
to do so as that will try to merge the new linux-next release with the
old one.  You should use "git fetch" and checkout or reset to the new
master.

You can see which trees have been included by looking in the Next/Trees
file in the source.  There are also quilt-import.log and merge.log
files in the Next directory.  Between each merge, the tree was built
with a ppc64_defconfig for powerpc and an allmodconfig for x86_64,
a multi_v7_defconfig for arm and a native build of tools/perf. After
the final fixups (if any), it is also built with powerpc allnoconfig
(32 and 64 bit), ppc44x_defconfig and allyesconfig (this fails its final
link) and i386, sparc, sparc64 and arm defconfig.

Below is a summary of the state of the merge.

I am currently merging 224 trees (counting Linus' and 33 trees of patches
pending for Linus' tree).

Stats about the size of the tree over time can be seen at
http://neuling.org/linux-next-size.html .

Status of my local build tests will be at
http://kisskb.ellerman.id.au/linux-next .  If maintainers want to give
advice about cross compilers/configs that work, we are always open to add
more builds.

Thanks to Randy Dunlap for doing many randconfig builds.  And to Paul
Gortmaker for triage and bug fixes.

-- 
Cheers,
Stephen Rothwells...@canb.auug.org.au

$ git checkout master
$ git reset --hard stable
Merging origin/master (f760b87f8f12 Merge 
git://git.kernel.org/pub/scm/linux/kernel/git/davem/net)
Merging fixes/master (c7e9ad7da219 Merge branch 'perf-urgent-for-linus' of 
git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip)
Merging kbuild-current/rc-fixes (c517d838eb7d Linux 4.0-rc1)
Merging arc-current/for-curr (e4140819dadc ARC: signal handling robustify)
Merging arm-current/fixes (11b8b25ce4f8 ARM: fix lockdep unannotated irqs-off 
warning)
Merging m68k-current/for-linus (1214c525484c m68k: Use for_each_sg())
Merging metag-fixes/fixes (0164a711c97b metag: Fix ioremap_wc/ioremap_cached 
build errors)
Merging mips-fixes/mips-fixes (1795cd9b3a91 Linux 3.16-rc5)
Merging powerpc-fixes/fixes (bc0195aad0da Linux 4.2-rc2)
Merging powerpc-merge-mpe/fixes (bc0195aad0da Linux 4.2-rc2)
Merging powerpc-merge-benh/merge (c517d838eb7d Linux 4.0-rc1)
Merging sparc/master (4a10a91756ef Merge branch 'upstream' of 
git://git.infradead.org/users/pcmoore/audit)
Merging net/master (f760b87f8f12 Merge 
git://git.kernel.org/pub/scm/linux/kernel/git/davem/net)
Merging ipsec/master (31a418986a58 xen: netback: read hotplug script once at 
start of day.)
Merging sound-current/for-linus (4d0e677523a9 ALSA: line6: Fix -EBUSY error 
during active monitoring)
Merging pci-current/for-linus (bc0195aad0da Linux 4.2-rc2)
Merging wireless-drivers/master (7865598ec24a ath9k_hw: fix device ID check for 
AR956x)
Merging driver-core.current/driver-core-linus (bc0195aad0da Linux 4.2-rc2)
Merging tty.current/tty-linus (bc0195aad0da Linux 4.2-rc2)
Merging usb.current/usb-linus (d4669bb1427c Merge tag 'fixes-for-v4.2-rc2' of 
git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb into usb-linus)
Merging usb-gadget-fixes/fixes (b2e2c94b878b usb: gadget: f_midi: fix error 
recovery path)
Merging usb-serial-fixes/usb-linus (d23f47d4927f USB: serial: Destroy 
serial_minors IDR on module exit)
Merging staging.current/staging-linus (8c5dfdbbebf5 Merge tag 
'iio-fixes-for-4.2b' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio 
into staging-linus)
Merging char-misc.current/char-misc-linus (bc0195aad0da Linux 4.2-rc2)
Merging input-current/for-linus (dbf3c370862d Revert "Input: synaptics - 
allocate 3 slots to keep stability in image sensors")
Merging crypto-current/master (030f4e968741 crypto: nx - Fix reentrancy bugs)
Merging ide/master (d681f1166919 ide: remove deprecated use of pci api)
Merging devicetree-current/devicetree/merge (f76502aa9140 of/dynamic: Fix test 
for PPC_PSERIES)
Merging rr-fixes/fixes (758556bdc1c8 module: Fix load_module() error path)
Merging vfio-fixes/for-linus (db7d4d7f4021 vfio: Fix runaway interruptible 
timeout)
Merging kselftest-fixes/fixes (d770e558e219 Linux 4.2-rc1)
Merging backlight-fixes/for-backlight-fixes (68feaca0b13e backlight: pwm: 
Handle EPROBE_DEFER while requesting the PWM)
Merging ftrace-fixes/for-next-urgent (6224beb12e19 tracing: Have branch tracer 
use 

Re: [Patch V5 00/16] xen: support pv-domains larger than 512GB

2015-07-14 Thread Juergen Gross

On 07/10/2015 03:39 PM, Konrad Rzeszutek Wilk wrote:

On Fri, Jul 10, 2015 at 02:47:45PM +0200, Juergen Gross wrote:

Support 64 bit pv-domains with more than 512GB of memory.

Following test have been done:
- 64 bit dom0 on 8GB machine
- 64 bit dom0 on 1TB machine (resolving p2m/E820-map conflict)
- 32 bit dom0 on 8GB machine
- 64 bit dom0 on 8GB machine with faked kernel/E820-map conflict
- 64 bit dom0 on 8GB machine with faked pgtable/E820-map conflict
- 64 bit dom0 on 8GB machine with faked initrd/E820-map conflict
- 64 bit dom0 on 8GB machine with faked p2m/E820-map conflict
- 64 bit domU (sizes up to 900GB)
- 32 bit domU


Woot!

Thank you for doing that. I noticed that you used the 'normal'
sizes, but nothing as odd as '3145M' or such to try to break
things. Not sure if it is worht it - as the test suite that
Boris runs does run with some odd sizes to catch this.


How did you notice the domU sizes from these lines? :-)

I tested with sizes being power of 2 as well as other values (e.g.
10 MB).


I only had one comment about the #13 patch, otherwise I think
we are OK with this patchset?


Can I take this as an "Acked-by" for the other patches?


Juergen

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v5 05/19] staging: sm750fb: remove space between function name and parenthesis

2015-07-14 Thread Juston Li
Fixes checkpatch.pl warning:
WARNING: space prohibited between function name and open parenthesis '('

Signed-off-by: Juston Li 
---
 drivers/staging/sm750fb/sm750_accel.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/sm750fb/sm750_accel.c 
b/drivers/staging/sm750fb/sm750_accel.c
index 73d84de..982cf1e 100644
--- a/drivers/staging/sm750fb/sm750_accel.c
+++ b/drivers/staging/sm750fb/sm750_accel.c
@@ -278,11 +278,11 @@ unsigned int rop2)   /* ROP value */
{
 
write_dpr(accel, DE_SOURCE,
- FIELD_SET  (0, DE_SOURCE, WRAP, DISABLE) |
+ FIELD_SET(0, DE_SOURCE, WRAP, DISABLE) |
  FIELD_VALUE(0, DE_SOURCE, X_K1, sx)   |
  FIELD_VALUE(0, DE_SOURCE, Y_K2, sy)); /* dpr0 */
write_dpr(accel, DE_DESTINATION,
- FIELD_SET  (0, DE_DESTINATION, WRAP, DISABLE) |
+ FIELD_SET(0, DE_DESTINATION, WRAP, DISABLE) |
  FIELD_VALUE(0, DE_DESTINATION, X,dx)  |
  FIELD_VALUE(0, DE_DESTINATION, Y,dy)); /* dpr04 */
write_dpr(accel, DE_DIMENSION,
@@ -390,11 +390,11 @@ int hw_imageblit(struct lynx_accel *accel,
 /* Note: For 2D Source in Host Write, only X_K1_MONO field is needed, 
and Y_K2 field is not used.
For mono bitmap, use startBit for X_K1. */
write_dpr(accel, DE_SOURCE,
- FIELD_SET  (0, DE_SOURCE, WRAP, DISABLE)   |
+ FIELD_SET(0, DE_SOURCE, WRAP, DISABLE)   |
  FIELD_VALUE(0, DE_SOURCE, X_K1_MONO, startBit)); /* dpr00 */
 
write_dpr(accel, DE_DESTINATION,
- FIELD_SET  (0, DE_DESTINATION, WRAP, DISABLE) |
+ FIELD_SET(0, DE_DESTINATION, WRAP, DISABLE) |
  FIELD_VALUE(0, DE_DESTINATION, X,dx)|
  FIELD_VALUE(0, DE_DESTINATION, Y,dy)); /* dpr04 */
 
-- 
2.4.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v5 01/19] staging: sm750fb: use tabs for indentation

2015-07-14 Thread Juston Li
Replace spaces with tabs for indentation to fix the checkpatch.pl error
ERROR: code indent should use tabs where possible
WARNING: please, no spaces at the start of a line

Signed-off-by: Juston Li 
---
 drivers/staging/sm750fb/ddk750_display.c | 100 
 drivers/staging/sm750fb/ddk750_display.h |   2 +-
 drivers/staging/sm750fb/ddk750_dvi.c |  66 +++---
 drivers/staging/sm750fb/ddk750_help.h|   4 +-
 drivers/staging/sm750fb/ddk750_hwi2c.c   | 246 +--
 drivers/staging/sm750fb/ddk750_mode.c| 142 +--
 drivers/staging/sm750fb/ddk750_mode.h|  46 ++--
 drivers/staging/sm750fb/ddk750_power.c   | 254 ++--
 drivers/staging/sm750fb/ddk750_power.h   |   8 +-
 drivers/staging/sm750fb/ddk750_reg.h |  18 +-
 drivers/staging/sm750fb/ddk750_sii164.c  | 394 +++
 drivers/staging/sm750fb/ddk750_sii164.h  |  28 +--
 drivers/staging/sm750fb/sm750.h  |  26 +-
 drivers/staging/sm750fb/sm750_accel.c| 370 ++---
 drivers/staging/sm750fb/sm750_accel.h|   4 +-
 drivers/staging/sm750fb/sm750_help.h |  26 +-
 drivers/staging/sm750fb/sm750_hw.h   |  28 +--
 17 files changed, 881 insertions(+), 881 deletions(-)

diff --git a/drivers/staging/sm750fb/ddk750_display.c 
b/drivers/staging/sm750fb/ddk750_display.c
index a3e6720..1c4049f 100644
--- a/drivers/staging/sm750fb/ddk750_display.c
+++ b/drivers/staging/sm750fb/ddk750_display.c
@@ -24,7 +24,7 @@ static void setDisplayControl(int ctrl, int dispState)
/* Timing should be enabled first before enabling the 
plane
 * because changing at the same time does not guarantee 
that
 * the plane will also enabled or disabled.
-*/
+*/
ulDisplayCtrlReg = FIELD_SET(ulDisplayCtrlReg,

PANEL_DISPLAY_CTRL, TIMING, ENABLE);
POKE32(PANEL_DISPLAY_CTRL, ulDisplayCtrlReg);
@@ -135,8 +135,8 @@ static void waitNextVerticalSync(int ctrl, int delay)
if(!ctrl){
/* primary controller */
 
-/* Do not wait when the Primary PLL is off or display control is 
already off.
-  This will prevent the software to wait forever. */
+   /* Do not wait when the Primary PLL is off or display control 
is already off.
+  This will prevent the software to wait forever. */
if ((FIELD_GET(PEEK32(PANEL_PLL_CTRL), PANEL_PLL_CTRL, POWER) ==
 PANEL_PLL_CTRL_POWER_OFF) ||
(FIELD_GET(PEEK32(PANEL_DISPLAY_CTRL), 
PANEL_DISPLAY_CTRL, TIMING) ==
@@ -145,26 +145,26 @@ static void waitNextVerticalSync(int ctrl, int delay)
return;
}
 
-while (delay-- > 0)
-{
-/* Wait for end of vsync. */
-do
-{
-status = FIELD_GET(PEEK32(SYSTEM_CTRL),
-   SYSTEM_CTRL,
-   PANEL_VSYNC);
-}
-while (status == SYSTEM_CTRL_PANEL_VSYNC_ACTIVE);
-
-/* Wait for start of vsync. */
-do
-{
-status = FIELD_GET(PEEK32(SYSTEM_CTRL),
-   SYSTEM_CTRL,
-   PANEL_VSYNC);
-}
-while (status == SYSTEM_CTRL_PANEL_VSYNC_INACTIVE);
-}
+   while (delay-- > 0)
+   {
+   /* Wait for end of vsync. */
+   do
+   {
+   status = FIELD_GET(PEEK32(SYSTEM_CTRL),
+  SYSTEM_CTRL,
+  PANEL_VSYNC);
+   }
+   while (status == SYSTEM_CTRL_PANEL_VSYNC_ACTIVE);
+
+   /* Wait for start of vsync. */
+   do
+   {
+   status = FIELD_GET(PEEK32(SYSTEM_CTRL),
+  SYSTEM_CTRL,
+  PANEL_VSYNC);
+   }
+   while (status == SYSTEM_CTRL_PANEL_VSYNC_INACTIVE);
+   }
 
}else{
 
@@ -275,33 +275,33 @@ void ddk750_setLogicalDispOut(disp_output_t output)
 
 int ddk750_initDVIDisp(void)
 {
-/* Initialize DVI. If the dviInit fail and the VendorID or the DeviceID are
-   not zeroed, then set the failure flag. If it is zeroe, it might mean
-   that the system is in Dual CRT Monitor configuration. */
-
-/* De-skew enabled with default 111b value.
-   This will fix some artifacts problem in some mode on board 2.2.
-   Somehow this fix does not affect board 2.1.
- */
-if ((dviInit(1,  

[PATCH v5 04/19] staging: sm750fb: add space before open parenthesis

2015-07-14 Thread Juston Li
Fixes checkpatch.pl error:
ERROR: space required before the open parenthesis '('

Signed-off-by: Juston Li 
---
 drivers/staging/sm750fb/ddk750_display.c | 20 ++--
 drivers/staging/sm750fb/ddk750_dvi.c |  2 +-
 drivers/staging/sm750fb/ddk750_help.c|  2 +-
 drivers/staging/sm750fb/ddk750_mode.c| 12 ++--
 drivers/staging/sm750fb/ddk750_power.c   |  6 +++---
 drivers/staging/sm750fb/sm750_accel.c|  8 
 drivers/staging/sm750fb/sm750_cursor.c   | 32 
 drivers/staging/sm750fb/sm750_help.h |  2 +-
 8 files changed, 42 insertions(+), 42 deletions(-)

diff --git a/drivers/staging/sm750fb/ddk750_display.c 
b/drivers/staging/sm750fb/ddk750_display.c
index 1c4049f..973dec3 100644
--- a/drivers/staging/sm750fb/ddk750_display.c
+++ b/drivers/staging/sm750fb/ddk750_display.c
@@ -49,7 +49,7 @@ static void setDisplayControl(int ctrl, int dispState)
{
cnt++;
POKE32(PANEL_DISPLAY_CTRL, ulDisplayCtrlReg);
-   } while((PEEK32(PANEL_DISPLAY_CTRL) & ~ulReservedBits) 
!=
+   } while ((PEEK32(PANEL_DISPLAY_CTRL) & ~ulReservedBits) 
!=
(ulDisplayCtrlReg & ~ulReservedBits));
printk("Set Panel Plane enbit:after tried %d times\n", 
cnt);
}
@@ -104,7 +104,7 @@ static void setDisplayControl(int ctrl, int dispState)
{
cnt++;
POKE32(CRT_DISPLAY_CTRL, ulDisplayCtrlReg);
-   } while((PEEK32(CRT_DISPLAY_CTRL) & ~ulReservedBits) !=
+   } while ((PEEK32(CRT_DISPLAY_CTRL) & ~ulReservedBits) !=
(ulDisplayCtrlReg & ~ulReservedBits));
printk("Set Crt Plane enbit:after tried %d 
times\n", cnt);
}
@@ -132,7 +132,7 @@ static void setDisplayControl(int ctrl, int dispState)
 static void waitNextVerticalSync(int ctrl, int delay)
 {
unsigned int status;
-   if(!ctrl){
+   if (!ctrl){
/* primary controller */
 
/* Do not wait when the Primary PLL is off or display control 
is already off.
@@ -233,14 +233,14 @@ static void swPanelPowerSequence(int disp, int delay)
 void ddk750_setLogicalDispOut(disp_output_t output)
 {
unsigned int reg;
-   if(output & PNL_2_USAGE){
+   if (output & PNL_2_USAGE){
/* set panel path controller select */
reg = PEEK32(PANEL_DISPLAY_CTRL);
reg = FIELD_VALUE(reg, PANEL_DISPLAY_CTRL, SELECT, (output & 
PNL_2_MASK)>>PNL_2_OFFSET);
POKE32(PANEL_DISPLAY_CTRL, reg);
}
 
-   if(output & CRT_2_USAGE){
+   if (output & CRT_2_USAGE){
/* set crt path controller select */
reg = PEEK32(CRT_DISPLAY_CTRL);
reg = FIELD_VALUE(reg, CRT_DISPLAY_CTRL, SELECT, (output & 
CRT_2_MASK)>>CRT_2_OFFSET);
@@ -250,25 +250,25 @@ void ddk750_setLogicalDispOut(disp_output_t output)
 
}
 
-   if(output & PRI_TP_USAGE){
+   if (output & PRI_TP_USAGE){
/* set primary timing and plane en_bit */
setDisplayControl(0, (output_TP_MASK)>>PRI_TP_OFFSET);
}
 
-   if(output & SEC_TP_USAGE){
+   if (output & SEC_TP_USAGE){
/* set secondary timing and plane en_bit*/
setDisplayControl(1, (output_TP_MASK)>>SEC_TP_OFFSET);
}
 
-   if(output & PNL_SEQ_USAGE){
+   if (output & PNL_SEQ_USAGE){
/* set  panel sequence */
swPanelPowerSequence((output_SEQ_MASK)>>PNL_SEQ_OFFSET, 4);
}
 
-   if(output & DAC_USAGE)
+   if (output & DAC_USAGE)
setDAC((output & DAC_MASK)>>DAC_OFFSET);
 
-   if(output & DPMS_USAGE)
+   if (output & DPMS_USAGE)
ddk750_setDPMS((output & DPMS_MASK) >> DPMS_OFFSET);
 }
 
diff --git a/drivers/staging/sm750fb/ddk750_dvi.c 
b/drivers/staging/sm750fb/ddk750_dvi.c
index 35866fa..4c64436 100644
--- a/drivers/staging/sm750fb/ddk750_dvi.c
+++ b/drivers/staging/sm750fb/ddk750_dvi.c
@@ -45,7 +45,7 @@ int dviInit(
 {
dvi_ctrl_device_t *pCurrentDviCtrl;
pCurrentDviCtrl = g_dcftSupportedDviController;
-   if(pCurrentDviCtrl->pfnInit != NULL)
+   if (pCurrentDviCtrl->pfnInit != NULL)
{
return pCurrentDviCtrl->pfnInit(edgeSelect, busSelect, 
dualEdgeClkSelect, hsyncEnable,
vsyncEnable, deskewEnable, 
deskewSetting, continuousSyncEnable,
diff --git a/drivers/staging/sm750fb/ddk750_help.c 
b/drivers/staging/sm750fb/ddk750_help.c
index f027df5..9637dd3 100644
--- a/drivers/staging/sm750fb/ddk750_help.c
+++ b/drivers/staging/sm750fb/ddk750_help.c
@@ -10,7 +10,7 @@ void ddk750_set_mmio(void __iomem 

[PATCH v5 06/19] staging: sm750fb: add space before open brace

2015-07-14 Thread Juston Li
Fixes checkpatch.pl error:
ERROR: space required before the open brace '{'

Signed-off-by: Juston Li 
---
 drivers/staging/sm750fb/ddk750_display.c | 14 +++---
 drivers/staging/sm750fb/ddk750_mode.c|  8 
 drivers/staging/sm750fb/ddk750_power.c   |  4 ++--
 drivers/staging/sm750fb/sm750_accel.c|  6 +++---
 drivers/staging/sm750fb/sm750_cursor.c   | 14 +++---
 5 files changed, 23 insertions(+), 23 deletions(-)

diff --git a/drivers/staging/sm750fb/ddk750_display.c 
b/drivers/staging/sm750fb/ddk750_display.c
index 973dec3..c7171a4 100644
--- a/drivers/staging/sm750fb/ddk750_display.c
+++ b/drivers/staging/sm750fb/ddk750_display.c
@@ -132,7 +132,7 @@ static void setDisplayControl(int ctrl, int dispState)
 static void waitNextVerticalSync(int ctrl, int delay)
 {
unsigned int status;
-   if (!ctrl){
+   if (!ctrl) {
/* primary controller */
 
/* Do not wait when the Primary PLL is off or display control 
is already off.
@@ -166,7 +166,7 @@ static void waitNextVerticalSync(int ctrl, int delay)
while (status == SYSTEM_CTRL_PANEL_VSYNC_INACTIVE);
}
 
-   }else{
+   }else {
 
/* Do not wait when the Primary PLL is off or display control 
is already off.
   This will prevent the software to wait forever. */
@@ -233,14 +233,14 @@ static void swPanelPowerSequence(int disp, int delay)
 void ddk750_setLogicalDispOut(disp_output_t output)
 {
unsigned int reg;
-   if (output & PNL_2_USAGE){
+   if (output & PNL_2_USAGE) {
/* set panel path controller select */
reg = PEEK32(PANEL_DISPLAY_CTRL);
reg = FIELD_VALUE(reg, PANEL_DISPLAY_CTRL, SELECT, (output & 
PNL_2_MASK)>>PNL_2_OFFSET);
POKE32(PANEL_DISPLAY_CTRL, reg);
}
 
-   if (output & CRT_2_USAGE){
+   if (output & CRT_2_USAGE) {
/* set crt path controller select */
reg = PEEK32(CRT_DISPLAY_CTRL);
reg = FIELD_VALUE(reg, CRT_DISPLAY_CTRL, SELECT, (output & 
CRT_2_MASK)>>CRT_2_OFFSET);
@@ -250,17 +250,17 @@ void ddk750_setLogicalDispOut(disp_output_t output)
 
}
 
-   if (output & PRI_TP_USAGE){
+   if (output & PRI_TP_USAGE) {
/* set primary timing and plane en_bit */
setDisplayControl(0, (output_TP_MASK)>>PRI_TP_OFFSET);
}
 
-   if (output & SEC_TP_USAGE){
+   if (output & SEC_TP_USAGE) {
/* set secondary timing and plane en_bit*/
setDisplayControl(1, (output_TP_MASK)>>SEC_TP_OFFSET);
}
 
-   if (output & PNL_SEQ_USAGE){
+   if (output & PNL_SEQ_USAGE) {
/* set  panel sequence */
swPanelPowerSequence((output_SEQ_MASK)>>PNL_SEQ_OFFSET, 4);
}
diff --git a/drivers/staging/sm750fb/ddk750_mode.c 
b/drivers/staging/sm750fb/ddk750_mode.c
index cfe528c..efc1fab 100644
--- a/drivers/staging/sm750fb/ddk750_mode.c
+++ b/drivers/staging/sm750fb/ddk750_mode.c
@@ -107,9 +107,9 @@ static int programModeRegisters(mode_parameter_t 
*pModeParam, pll_value_t *pll)
  FIELD_SET(0, CRT_DISPLAY_CTRL, PLANE, 
ENABLE);
 
 
-   if (getChipType() == SM750LE){
+   if (getChipType() == SM750LE) {
displayControlAdjust_SM750LE(pModeParam, ulTmpValue);
-   }else{
+   }else {
ulReg = PEEK32(CRT_DISPLAY_CTRL)
& FIELD_CLEAR(CRT_DISPLAY_CTRL, 
VSYNC_PHASE)
& FIELD_CLEAR(CRT_DISPLAY_CTRL, 
HSYNC_PHASE)
@@ -179,7 +179,7 @@ static int programModeRegisters(mode_parameter_t 
*pModeParam, pll_value_t *pll)
}
 #endif
}
-   else{
+   else {
ret = -1;
}
return ret;
@@ -193,7 +193,7 @@ int ddk750_setModeTiming(mode_parameter_t *parm, 
clock_type_t clock)
pll.clockType = clock;
 
uiActualPixelClk = calcPllValue(parm->pixel_clock, );
-   if (getChipType() == SM750LE){
+   if (getChipType() == SM750LE) {
/* set graphic mode via IO method */
outb_p(0x88, 0x3d4);
outb_p(0x06, 0x3d5);
diff --git a/drivers/staging/sm750fb/ddk750_power.c 
b/drivers/staging/sm750fb/ddk750_power.c
index a2d9ee6..e2c0bb3 100644
--- a/drivers/staging/sm750fb/ddk750_power.c
+++ b/drivers/staging/sm750fb/ddk750_power.c
@@ -5,10 +5,10 @@
 void ddk750_setDPMS(DPMS_t state)
 {
unsigned int value;
-   if (getChipType() == SM750LE){
+   if (getChipType() == SM750LE) {
value = PEEK32(CRT_DISPLAY_CTRL);
POKE32(CRT_DISPLAY_CTRL, FIELD_VALUE(value, CRT_DISPLAY_CTRL, 
DPMS, state));
-   }else{
+   }else {
value = PEEK32(SYSTEM_CTRL);
value= FIELD_VALUE(value, 

[PATCH v5 07/19] staging: sm750fb: add space after close brace

2015-07-14 Thread Juston Li
Fixes checkpatch.pl error:
ERROR: space required after that close brace '}'

Signed-off-by: Juston Li 
---
 drivers/staging/sm750fb/ddk750_display.c | 2 +-
 drivers/staging/sm750fb/ddk750_mode.c| 2 +-
 drivers/staging/sm750fb/ddk750_power.c   | 2 +-
 drivers/staging/sm750fb/sm750.h  | 2 +-
 drivers/staging/sm750fb/sm750_cursor.c   | 8 
 5 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/sm750fb/ddk750_display.c 
b/drivers/staging/sm750fb/ddk750_display.c
index c7171a4..4a3cb86 100644
--- a/drivers/staging/sm750fb/ddk750_display.c
+++ b/drivers/staging/sm750fb/ddk750_display.c
@@ -166,7 +166,7 @@ static void waitNextVerticalSync(int ctrl, int delay)
while (status == SYSTEM_CTRL_PANEL_VSYNC_INACTIVE);
}
 
-   }else {
+   } else {
 
/* Do not wait when the Primary PLL is off or display control 
is already off.
   This will prevent the software to wait forever. */
diff --git a/drivers/staging/sm750fb/ddk750_mode.c 
b/drivers/staging/sm750fb/ddk750_mode.c
index efc1fab..3d8b06d 100644
--- a/drivers/staging/sm750fb/ddk750_mode.c
+++ b/drivers/staging/sm750fb/ddk750_mode.c
@@ -109,7 +109,7 @@ static int programModeRegisters(mode_parameter_t 
*pModeParam, pll_value_t *pll)
 
if (getChipType() == SM750LE) {
displayControlAdjust_SM750LE(pModeParam, ulTmpValue);
-   }else {
+   } else {
ulReg = PEEK32(CRT_DISPLAY_CTRL)
& FIELD_CLEAR(CRT_DISPLAY_CTRL, 
VSYNC_PHASE)
& FIELD_CLEAR(CRT_DISPLAY_CTRL, 
HSYNC_PHASE)
diff --git a/drivers/staging/sm750fb/ddk750_power.c 
b/drivers/staging/sm750fb/ddk750_power.c
index e2c0bb3..5f697b8 100644
--- a/drivers/staging/sm750fb/ddk750_power.c
+++ b/drivers/staging/sm750fb/ddk750_power.c
@@ -8,7 +8,7 @@ void ddk750_setDPMS(DPMS_t state)
if (getChipType() == SM750LE) {
value = PEEK32(CRT_DISPLAY_CTRL);
POKE32(CRT_DISPLAY_CTRL, FIELD_VALUE(value, CRT_DISPLAY_CTRL, 
DPMS, state));
-   }else {
+   } else {
value = PEEK32(SYSTEM_CTRL);
value= FIELD_VALUE(value, SYSTEM_CTRL, DPMS, state);
POKE32(SYSTEM_CTRL, value);
diff --git a/drivers/staging/sm750fb/sm750.h b/drivers/staging/sm750fb/sm750.h
index 71e9a7a..8ac5410 100644
--- a/drivers/staging/sm750fb/sm750.h
+++ b/drivers/staging/sm750fb/sm750.h
@@ -53,7 +53,7 @@ struct lynx_share{
int mtrr_off;
struct{
int vram;
-   }mtrr;
+   } mtrr;
/* all smi graphic adaptor got below attributes */
unsigned long vidmem_start;
unsigned long vidreg_start;
diff --git a/drivers/staging/sm750fb/sm750_cursor.c 
b/drivers/staging/sm750fb/sm750_cursor.c
index 3a21af9..2fcec32 100644
--- a/drivers/staging/sm750fb/sm750_cursor.c
+++ b/drivers/staging/sm750fb/sm750_cursor.c
@@ -143,7 +143,7 @@ void hw_cursor_setData(struct lynx_cursor *cursor,
if (opr & (0x80 >> j))
{   /* use fg color,id = 2 */
data |= 2 << (j*2);
-   }else {
+   } else {
/* use bg color,id = 1 */
data |= 1 << (j*2);
}
@@ -173,7 +173,7 @@ void hw_cursor_setData(struct lynx_cursor *cursor,
/* need a return */
pstart += offset;
pbuffer = pstart;
-   }else {
+   } else {
pbuffer += sizeof(u16);
}
 
@@ -223,7 +223,7 @@ void hw_cursor_setData2(struct lynx_cursor *cursor,
if (opr & (0x80 >> j))
{   /* use fg color,id = 2 */
data |= 2 << (j*2);
-   }else {
+   } else {
/* use bg color,id = 1 */
data |= 1 << (j*2);
}
@@ -242,7 +242,7 @@ void hw_cursor_setData2(struct lynx_cursor *cursor,
/* need a return */
pstart += offset;
pbuffer = pstart;
-   }else {
+   } else {
pbuffer += sizeof(u16);
}
 
-- 
2.4.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v5 09/19] staging: sm750fb: add space after struct definition

2015-07-14 Thread Juston Li
Fixes checkpatch.pl warning:
WARNING: missing space after struct definition

Signed-off-by: Juston Li 
---
 drivers/staging/sm750fb/sm750.h| 12 ++--
 drivers/staging/sm750fb/sm750_hw.h |  6 +++---
 2 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/sm750fb/sm750.h b/drivers/staging/sm750fb/sm750.h
index 8ac5410..9989ff6 100644
--- a/drivers/staging/sm750fb/sm750.h
+++ b/drivers/staging/sm750fb/sm750.h
@@ -14,7 +14,7 @@
 extern int smi_indent;
 
 
-struct lynx_accel{
+struct lynx_accel {
/* base virtual address of DPR registers */
volatile unsigned char __iomem * dprBase;
/* base virtual address of de data port */
@@ -41,7 +41,7 @@ struct lynx_accel{
 /* lynx_share stands for a presentation of two frame buffer
that use one smi adaptor , it is similar to a basic class of C++
 */
-struct lynx_share{
+struct lynx_share {
/* common members */
u16 devid;
u8 revid;
@@ -68,7 +68,7 @@ struct lynx_share{
void (*resume)(struct lynx_share*);
 };
 
-struct lynx_cursor{
+struct lynx_cursor {
/* cursor width ,height and size */
int w;
int h;
@@ -92,7 +92,7 @@ struct lynx_cursor{
void (*setData)(struct lynx_cursor *, u16, const u8*, const u8*);
 };
 
-struct lynxfb_crtc{
+struct lynxfb_crtc {
unsigned char __iomem *vCursor; /* virtual address of cursor */
unsigned char __iomem *vScreen; /* virtual address of on_screen */
int oCursor; /* cursor address offset in vidmem */
@@ -123,7 +123,7 @@ struct lynxfb_crtc{
struct lynx_cursor cursor;
 };
 
-struct lynxfb_output{
+struct lynxfb_output {
int dpms;
int paths;
/* which paths(s) this output stands for,for sm750:
@@ -149,7 +149,7 @@ struct lynxfb_output{
void  (*clear)(struct lynxfb_output*);
 };
 
-struct lynxfb_par{
+struct lynxfb_par {
/* either 0 or 1 for dual head adaptor,0 is the older one registered */
int index;
unsigned int pseudo_palette[256];
diff --git a/drivers/staging/sm750fb/sm750_hw.h 
b/drivers/staging/sm750fb/sm750_hw.h
index af2db7c..ef0a16f 100644
--- a/drivers/staging/sm750fb/sm750_hw.h
+++ b/drivers/staging/sm750fb/sm750_hw.h
@@ -42,7 +42,7 @@ enum sm750_path {
sm750_pnc = 3,/* panel and crt */
 };
 
-struct init_status{
+struct init_status {
ushort powerMode;
/* below three clocks are in unit of MHZ*/
ushort chip_clk;
@@ -52,7 +52,7 @@ struct init_status{
ushort resetMemory;
 };
 
-struct sm750_state{
+struct sm750_state {
struct init_status initParm;
enum sm750_pnltype pnltype;
enum sm750_dataflow dataflow;
@@ -66,7 +66,7 @@ struct sm750_state{
in C++
  */
 
-struct sm750_share{
+struct sm750_share {
/* it's better to put lynx_share struct to the first place of 
sm750_share */
struct lynx_share share;
struct sm750_state state;
-- 
2.4.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v5 02/19] staging: sm750fb: remove spacing after open parenthesis

2015-07-14 Thread Juston Li
Fixes checkpatch.pl warning:
ERROR: space prohibited after that open parenthesis '('

Signed-off-by: Juston Li 
---
 drivers/staging/sm750fb/ddk750_chip.c  | 6 +++---
 drivers/staging/sm750fb/ddk750_mode.c  | 2 +-
 drivers/staging/sm750fb/ddk750_power.c | 8 
 3 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/sm750fb/ddk750_chip.c 
b/drivers/staging/sm750fb/ddk750_chip.c
index f4975d2..1069a2d 100644
--- a/drivers/staging/sm750fb/ddk750_chip.c
+++ b/drivers/staging/sm750fb/ddk750_chip.c
@@ -599,9 +599,9 @@ unsigned int formatPllReg(pll_value_t *pPLL)
On returning a 32 bit number, the value can be applied to any PLL in 
the calling function.
 */
ulPllReg =
-   FIELD_SET(  0, PANEL_PLL_CTRL, BYPASS, OFF)
-   | FIELD_SET(  0, PANEL_PLL_CTRL, POWER,  ON)
-   | FIELD_SET(  0, PANEL_PLL_CTRL, INPUT,  OSC)
+   FIELD_SET(0, PANEL_PLL_CTRL, BYPASS, OFF)
+   | FIELD_SET(0, PANEL_PLL_CTRL, POWER,  ON)
+   | FIELD_SET(0, PANEL_PLL_CTRL, INPUT,  OSC)
 #ifndef VALIDATION_CHIP
| FIELD_VALUE(0, PANEL_PLL_CTRL, POD,pPLL->POD)
 #endif
diff --git a/drivers/staging/sm750fb/ddk750_mode.c 
b/drivers/staging/sm750fb/ddk750_mode.c
index 1f93d07..31424b2 100644
--- a/drivers/staging/sm750fb/ddk750_mode.c
+++ b/drivers/staging/sm750fb/ddk750_mode.c
@@ -43,7 +43,7 @@ static unsigned long 
displayControlAdjust_SM750LE(mode_parameter_t *pModeParam,
 
/* Set bit 29:27 of display control register for the right clock */
/* Note that SM750LE only need to supported 7 resoluitons. */
-   if ( x == 800 && y == 600 )
+   if (x == 800 && y == 600 )
dispControl = FIELD_SET(dispControl, CRT_DISPLAY_CTRL, CLK, 
PLL41);
else if (x == 1024 && y == 768)
dispControl = FIELD_SET(dispControl, CRT_DISPLAY_CTRL, CLK, 
PLL65);
diff --git a/drivers/staging/sm750fb/ddk750_power.c 
b/drivers/staging/sm750fb/ddk750_power.c
index b7a108b..44b8eb1 100644
--- a/drivers/staging/sm750fb/ddk750_power.c
+++ b/drivers/staging/sm750fb/ddk750_power.c
@@ -59,17 +59,17 @@ void setPowerMode(unsigned int powerMode)
{
control_value =
 #ifdef VALIDATION_CHIP
-   FIELD_SET(  control_value, POWER_MODE_CTRL, 336CLK, OFF) |
+   FIELD_SET(control_value, POWER_MODE_CTRL, 336CLK, OFF) |
 #endif
-   FIELD_SET(  control_value, POWER_MODE_CTRL, OSC_INPUT,  OFF);
+   FIELD_SET(control_value, POWER_MODE_CTRL, OSC_INPUT,  OFF);
}
else
{
control_value =
 #ifdef VALIDATION_CHIP
-   FIELD_SET(  control_value, POWER_MODE_CTRL, 336CLK, ON) |
+   FIELD_SET(control_value, POWER_MODE_CTRL, 336CLK, ON) |
 #endif
-   FIELD_SET(  control_value, POWER_MODE_CTRL, OSC_INPUT,  ON);
+   FIELD_SET(control_value, POWER_MODE_CTRL, OSC_INPUT,  ON);
}
 
/* Program new power mode. */
-- 
2.4.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v5 08/19] staging: sm750fb: add space after enum definition

2015-07-14 Thread Juston Li
Fixes checkpatch.pl warning:
WARNING: missing space after enum definition

Signed-off-by: Juston Li 
---
 drivers/staging/sm750fb/ddk750_display.h | 2 +-
 drivers/staging/sm750fb/sm750_hw.h   | 8 
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/sm750fb/ddk750_display.h 
b/drivers/staging/sm750fb/ddk750_display.h
index 018a661..a7f50cc 100644
--- a/drivers/staging/sm750fb/ddk750_display.h
+++ b/drivers/staging/sm750fb/ddk750_display.h
@@ -129,7 +129,7 @@ typedef enum _disp_output_t
 }
 disp_output_t;
 #else
-typedef enum _disp_output_t{
+typedef enum _disp_output_t {
do_LCD1_PRI = PNL_2_PRI|PRI_TP_ON|PNL_SEQ_ON|DAC_ON,
do_LCD1_SEC = PNL_2_SEC|SEC_TP_ON|PNL_SEQ_ON|DAC_ON,
 #if 0
diff --git a/drivers/staging/sm750fb/sm750_hw.h 
b/drivers/staging/sm750fb/sm750_hw.h
index adc61edf..af2db7c 100644
--- a/drivers/staging/sm750fb/sm750_hw.h
+++ b/drivers/staging/sm750fb/sm750_hw.h
@@ -9,7 +9,7 @@
 #endif
 
 
-enum sm750_pnltype{
+enum sm750_pnltype {
 
sm750_24TFT = 0,/* 24bit tft */
 
@@ -19,7 +19,7 @@ enum sm750_pnltype{
 };
 
 /* vga channel is not concerned  */
-enum sm750_dataflow{
+enum sm750_dataflow {
sm750_simul_pri,/* primary => all head */
 
sm750_simul_sec,/* secondary => all head */
@@ -30,13 +30,13 @@ enum sm750_dataflow{
 };
 
 
-enum sm750_channel{
+enum sm750_channel {
sm750_primary = 0,
/* enum value equal to the register filed data */
sm750_secondary = 1,
 };
 
-enum sm750_path{
+enum sm750_path {
sm750_panel = 1,
sm750_crt = 2,
sm750_pnc = 3,/* panel and crt */
-- 
2.4.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v5 10/19] staging: sm750fb: add space after return type

2015-07-14 Thread Juston Li
Fixes checkpatch.pl warning:
WARNING: missing space after return type

Signed-off-by: Juston Li 
---
 drivers/staging/sm750fb/sm750.h | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/sm750fb/sm750.h b/drivers/staging/sm750fb/sm750.h
index 9989ff6..2d04c0f 100644
--- a/drivers/staging/sm750fb/sm750.h
+++ b/drivers/staging/sm750fb/sm750.h
@@ -108,12 +108,12 @@ struct lynxfb_crtc {
 
void *priv;
 
-   int(*proc_setMode)(struct lynxfb_crtc*,
+   int (*proc_setMode)(struct lynxfb_crtc*,
struct fb_var_screeninfo*,
struct fb_fix_screeninfo*);
 
-   int(*proc_checkMode)(struct lynxfb_crtc*, struct fb_var_screeninfo*);
-   int(*proc_setColReg)(struct lynxfb_crtc*, ushort, ushort, ushort, 
ushort);
+   int (*proc_checkMode)(struct lynxfb_crtc*, struct fb_var_screeninfo*);
+   int (*proc_setColReg)(struct lynxfb_crtc*, ushort, ushort, ushort, 
ushort);
void (*clear)(struct lynxfb_crtc*);
/* pan display */
int (*proc_panDisplay)(struct lynxfb_crtc *,
@@ -140,12 +140,12 @@ struct lynxfb_output {
*/
void *priv;
 
-   int(*proc_setMode)(struct lynxfb_output*,
+   int (*proc_setMode)(struct lynxfb_output*,
struct fb_var_screeninfo*,
struct fb_fix_screeninfo*);
 
-   int(*proc_checkMode)(struct lynxfb_output*, struct fb_var_screeninfo*);
-   int(*proc_setBLANK)(struct lynxfb_output*, int);
+   int (*proc_checkMode)(struct lynxfb_output*, struct fb_var_screeninfo*);
+   int (*proc_setBLANK)(struct lynxfb_output*, int);
void  (*clear)(struct lynxfb_output*);
 };
 
-- 
2.4.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v5 12/19] staging: sm750fb: add spaces around operators

2015-07-14 Thread Juston Li
Fixes checkpath.pl error:
ERROR: spaces required around that operator

Note running checkpatch.pl with '--strict' catches more
of these errors along with cases where spacing is optional
but preferred. Take care of these in a future patch.

Signed-off-by: Juston Li 
---
 drivers/staging/sm750fb/ddk750_chip.c  |  2 +-
 drivers/staging/sm750fb/ddk750_power.c |  2 +-
 drivers/staging/sm750fb/sm750.h|  2 +-
 drivers/staging/sm750fb/sm750_accel.c  |  4 ++--
 drivers/staging/sm750fb/sm750_cursor.c | 12 ++--
 drivers/staging/sm750fb/sm750_help.h   |  2 +-
 6 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/drivers/staging/sm750fb/ddk750_chip.c 
b/drivers/staging/sm750fb/ddk750_chip.c
index 633201e..d7435d7 100644
--- a/drivers/staging/sm750fb/ddk750_chip.c
+++ b/drivers/staging/sm750fb/ddk750_chip.c
@@ -471,7 +471,7 @@ unsigned int calcPllValue(unsigned int request_orig, 
pll_value_t *pll)
M = quo*X;
M += fl_quo * X / 1;
/* round step */
-   M += (fl_quo*X % 1)>5000?1:0;
+   M += (fl_quo*X % 1) > 5000?1:0;
if (M < 256 && M > 0) {
unsigned int diff;
tmpClock = pll->inputFreq * M / N / X;
diff --git a/drivers/staging/sm750fb/ddk750_power.c 
b/drivers/staging/sm750fb/ddk750_power.c
index 5f697b8..28d4402 100644
--- a/drivers/staging/sm750fb/ddk750_power.c
+++ b/drivers/staging/sm750fb/ddk750_power.c
@@ -10,7 +10,7 @@ void ddk750_setDPMS(DPMS_t state)
POKE32(CRT_DISPLAY_CTRL, FIELD_VALUE(value, CRT_DISPLAY_CTRL, 
DPMS, state));
} else {
value = PEEK32(SYSTEM_CTRL);
-   value= FIELD_VALUE(value, SYSTEM_CTRL, DPMS, state);
+   value = FIELD_VALUE(value, SYSTEM_CTRL, DPMS, state);
POKE32(SYSTEM_CTRL, value);
}
 }
diff --git a/drivers/staging/sm750fb/sm750.h b/drivers/staging/sm750fb/sm750.h
index ae872bd..d6916fd 100644
--- a/drivers/staging/sm750fb/sm750.h
+++ b/drivers/staging/sm750fb/sm750.h
@@ -172,7 +172,7 @@ struct lynxfb_par {
 
 static inline unsigned long ps_to_hz(unsigned int psvalue)
 {
-   unsigned long long numerator=1000*1000*1000*1000ULL;
+   unsigned long long numerator = 1000*1000*1000*1000ULL;
/* 10^12 / picosecond period gives frequency in Hz */
do_div(numerator, psvalue);
return (unsigned long)numerator;
diff --git a/drivers/staging/sm750fb/sm750_accel.c 
b/drivers/staging/sm750fb/sm750_accel.c
index afe73e8..0cfe96c 100644
--- a/drivers/staging/sm750fb/sm750_accel.c
+++ b/drivers/staging/sm750fb/sm750_accel.c
@@ -414,10 +414,10 @@ int hw_imageblit(struct lynx_accel *accel,
write_dpr(accel, DE_CONTROL, de_ctrl | deGetTransparency(accel));
 
/* Write MONO data (line by line) to 2D Engine data port */
-   for (i=0; i> j))
@@ -149,7 +149,7 @@ void hw_cursor_setData(struct lynx_cursor *cursor,
}
}
 #else
-   for (j=0;j<8;j++) {
+   for (j = 0;j < 8;j++) {
if (mask & (0x80>>j)) {
if (rop == ROP_XOR)
opr = mask ^ color;
@@ -204,7 +204,7 @@ void hw_cursor_setData2(struct lynx_cursor *cursor,
pstart = cursor->vstart;
pbuffer = pstart;
 
-   for (i=0;i> j))
@@ -229,7 +229,7 @@ void hw_cursor_setData2(struct lynx_cursor *cursor,
}
}
 #else
-   for (j=0;j<8;j++) {
+   for (j = 0;j < 8;j++) {
if (mask & (1

[PATCH v5 11/19] staging: sm750fb: consistent spacing around operators

2015-07-14 Thread Juston Li
Fixes checkpatch.pl error:
ERROR: need consistent spacing around operator

Signed-off-by: Juston Li 
---
 drivers/staging/sm750fb/ddk750_chip.c| 4 ++--
 drivers/staging/sm750fb/ddk750_display.h | 4 ++--
 drivers/staging/sm750fb/sm750.h  | 2 +-
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/sm750fb/ddk750_chip.c 
b/drivers/staging/sm750fb/ddk750_chip.c
index fb1c533..633201e 100644
--- a/drivers/staging/sm750fb/ddk750_chip.c
+++ b/drivers/staging/sm750fb/ddk750_chip.c
@@ -464,7 +464,7 @@ unsigned int calcPllValue(unsigned int request_orig, 
pll_value_t *pll)
RN = N * request;
quo = RN / input;
rem = RN % input;/* rem always small than 14318181 */
-   fl_quo = (rem * 1 /input);
+   fl_quo = (rem * 1 / input);
 
for (d = xcnt - 1; d >= 0; d--) {
X = xparm[d].value;
@@ -474,7 +474,7 @@ unsigned int calcPllValue(unsigned int request_orig, 
pll_value_t *pll)
M += (fl_quo*X % 1)>5000?1:0;
if (M < 256 && M > 0) {
unsigned int diff;
-   tmpClock = pll->inputFreq *M / N / X;
+   tmpClock = pll->inputFreq * M / N / X;
diff = absDiff(tmpClock, request_orig);
if (diff < miniDiff) {
pll->M = M;
diff --git a/drivers/staging/sm750fb/ddk750_display.h 
b/drivers/staging/sm750fb/ddk750_display.h
index a7f50cc..afdf201 100644
--- a/drivers/staging/sm750fb/ddk750_display.h
+++ b/drivers/staging/sm750fb/ddk750_display.h
@@ -46,7 +46,7 @@
0: both off
 */
 #define SEC_TP_OFFSET 5
-#define SEC_TP_MASK (1<< SEC_TP_OFFSET)
+#define SEC_TP_MASK (1 << SEC_TP_OFFSET)
 #define SEC_TP_USAGE (SEC_TP_MASK << 16)
 #define SEC_TP_ON  ((0x1 << SEC_TP_OFFSET)|SEC_TP_USAGE)
 #define SEC_TP_OFF ((0x0 << SEC_TP_OFFSET)|SEC_TP_USAGE)
@@ -67,7 +67,7 @@
 #define DAC_OFFSET 7
 #define DAC_MASK (1 << DAC_OFFSET)
 #define DAC_USAGE (DAC_MASK << 16)
-#define DAC_ON ((0x0<< DAC_OFFSET)|DAC_USAGE)
+#define DAC_ON ((0x0 << DAC_OFFSET)|DAC_USAGE)
 #define DAC_OFF ((0x1 << DAC_OFFSET)|DAC_USAGE)
 
 /* DPMS only affect D-SUB head
diff --git a/drivers/staging/sm750fb/sm750.h b/drivers/staging/sm750fb/sm750.h
index 2d04c0f..ae872bd 100644
--- a/drivers/staging/sm750fb/sm750.h
+++ b/drivers/staging/sm750fb/sm750.h
@@ -10,7 +10,7 @@
 #define MB(x) ((x)<<20)
 #define MHZ(x) ((x) * 100)
 /* align should be 2,4,8,16 */
-#define PADDING(align, data) (((data)+(align)-1)&(~((align) -1)))
+#define PADDING(align, data) (((data)+(align)-1)&(~((align) - 1)))
 extern int smi_indent;
 
 
-- 
2.4.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v5 15/19] staging: sm750fb: remove unnecessary whitespace

2015-07-14 Thread Juston Li
Fixes checkpatch.pl warning:
WARNING: unnecessary whitespace before a quoted newline

Signed-off-by: Juston Li 
---
 drivers/staging/sm750fb/sm750.c| 2 +-
 drivers/staging/sm750fb/sm750_hw.c | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/sm750fb/sm750.c b/drivers/staging/sm750fb/sm750.c
index 4d165ca..c7ab818 100644
--- a/drivers/staging/sm750fb/sm750.c
+++ b/drivers/staging/sm750fb/sm750.c
@@ -967,7 +967,7 @@ static int lynxfb_set_fbinfo(struct fb_info *info, int 
index)
var->accel_flags = 0;
var->vmode = FB_VMODE_NONINTERLACED;
 
-   pr_debug("#1 show info->cmap : 
\nstart=%d,len=%d,red=%p,green=%p,blue=%p,transp=%p\n",
+   pr_debug("#1 show info->cmap 
:\nstart=%d,len=%d,red=%p,green=%p,blue=%p,transp=%p\n",
 info->cmap.start, info->cmap.len,
 info->cmap.red, info->cmap.green, info->cmap.blue,
 info->cmap.transp);
diff --git a/drivers/staging/sm750fb/sm750_hw.c 
b/drivers/staging/sm750fb/sm750_hw.c
index 359165d..fb9c631 100644
--- a/drivers/staging/sm750fb/sm750_hw.c
+++ b/drivers/staging/sm750fb/sm750_hw.c
@@ -250,7 +250,7 @@ int hw_sm750_output_setMode(struct lynxfb_output *output,
POKE32(DISPLAY_CONTROL_750LE, reg);
}
 
-   pr_info("ddk setlogicdispout done \n");
+   pr_info("ddk setlogicdispout done\n");
return ret;
 }
 
@@ -489,14 +489,14 @@ int hw_sm750_setBLANK(struct lynxfb_output *output, int 
blank)
 #else
case VESA_NO_BLANKING:
 #endif
-   pr_info("flag = FB_BLANK_UNBLANK \n");
+   pr_info("flag = FB_BLANK_UNBLANK\n");
dpms = SYSTEM_CTRL_DPMS_VPHP;
pps = PANEL_DISPLAY_CTRL_DATA_ENABLE;
crtdb = CRT_DISPLAY_CTRL_BLANK_OFF;
break;
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 10)
case FB_BLANK_NORMAL:
-   pr_info("flag = FB_BLANK_NORMAL \n");
+   pr_info("flag = FB_BLANK_NORMAL\n");
dpms = SYSTEM_CTRL_DPMS_VPHP;
pps = PANEL_DISPLAY_CTRL_DATA_DISABLE;
crtdb = CRT_DISPLAY_CTRL_BLANK_ON;
-- 
2.4.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v5 13/19] staging: sm750fb: add space after semicolon

2015-07-14 Thread Juston Li
Fixes checkpatch.pl error:
ERROR: space required after that ';'

Signed-off-by: Juston Li 
---
 drivers/staging/sm750fb/sm750.h|  2 +-
 drivers/staging/sm750fb/sm750_cursor.c | 12 ++--
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/sm750fb/sm750.h b/drivers/staging/sm750fb/sm750.h
index d6916fd..9b101a9 100644
--- a/drivers/staging/sm750fb/sm750.h
+++ b/drivers/staging/sm750fb/sm750.h
@@ -168,7 +168,7 @@ struct lynxfb_par {
({ \
unsigned long long hz = 1000*1000*1000*1000ULL; \
do_div(hz, ps); \
-   (unsigned long)hz;})
+   (unsigned long)hz; })
 
 static inline unsigned long ps_to_hz(unsigned int psvalue)
 {
diff --git a/drivers/staging/sm750fb/sm750_cursor.c 
b/drivers/staging/sm750fb/sm750_cursor.c
index 9dabac1..4ed7ca2 100644
--- a/drivers/staging/sm750fb/sm750_cursor.c
+++ b/drivers/staging/sm750fb/sm750_cursor.c
@@ -122,7 +122,7 @@ void hw_cursor_setData(struct lynx_cursor *cursor,
odd=0;
 */
 
-   for (i = 0;i < count;i++)
+   for (i = 0; i < count; i++)
{
color = *pcol++;
mask = *pmsk++;
@@ -137,7 +137,7 @@ void hw_cursor_setData(struct lynx_cursor *cursor,
else
opr = mask & color;
 
-   for (j = 0;j < 8;j++)
+   for (j = 0; j < 8; j++)
{
 
if (opr & (0x80 >> j))
@@ -149,7 +149,7 @@ void hw_cursor_setData(struct lynx_cursor *cursor,
}
}
 #else
-   for (j = 0;j < 8;j++) {
+   for (j = 0; j < 8; j++) {
if (mask & (0x80>>j)) {
if (rop == ROP_XOR)
opr = mask ^ color;
@@ -204,7 +204,7 @@ void hw_cursor_setData2(struct lynx_cursor *cursor,
pstart = cursor->vstart;
pbuffer = pstart;
 
-   for (i = 0;i < count;i++)
+   for (i = 0; i < count; i++)
{
color = *pcol++;
mask = *pmsk++;
@@ -217,7 +217,7 @@ void hw_cursor_setData2(struct lynx_cursor *cursor,
else
opr = mask & color;
 
-   for (j = 0;j < 8;j++)
+   for (j = 0; j < 8; j++)
{
 
if (opr & (0x80 >> j))
@@ -229,7 +229,7 @@ void hw_cursor_setData2(struct lynx_cursor *cursor,
}
}
 #else
-   for (j = 0;j < 8;j++) {
+   for (j = 0; j < 8; j++) {
if (mask & (1

[PATCH v5 17/19] staging: sm750fb: move while to follow do close brace

2015-07-14 Thread Juston Li
Fixes checkpatch.pl error:
ERROR: while should follow close brace '}'

Signed-off-by: Juston Li 
---
 drivers/staging/sm750fb/ddk750_display.c | 12 
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/sm750fb/ddk750_display.c 
b/drivers/staging/sm750fb/ddk750_display.c
index a64ea32..abd6283 100644
--- a/drivers/staging/sm750fb/ddk750_display.c
+++ b/drivers/staging/sm750fb/ddk750_display.c
@@ -139,16 +139,14 @@ static void waitNextVerticalSync(int ctrl, int delay)
status = FIELD_GET(PEEK32(SYSTEM_CTRL),
   SYSTEM_CTRL,
   PANEL_VSYNC);
-   }
-   while (status == SYSTEM_CTRL_PANEL_VSYNC_ACTIVE);
+   } while (status == SYSTEM_CTRL_PANEL_VSYNC_ACTIVE);
 
/* Wait for start of vsync. */
do {
status = FIELD_GET(PEEK32(SYSTEM_CTRL),
   SYSTEM_CTRL,
   PANEL_VSYNC);
-   }
-   while (status == SYSTEM_CTRL_PANEL_VSYNC_INACTIVE);
+   } while (status == SYSTEM_CTRL_PANEL_VSYNC_INACTIVE);
}
 
} else {
@@ -168,16 +166,14 @@ static void waitNextVerticalSync(int ctrl, int delay)
status = FIELD_GET(PEEK32(SYSTEM_CTRL),
   SYSTEM_CTRL,
   CRT_VSYNC);
-   }
-   while (status == SYSTEM_CTRL_CRT_VSYNC_ACTIVE);
+   } while (status == SYSTEM_CTRL_CRT_VSYNC_ACTIVE);
 
/* Wait for start of vsync. */
do {
status = FIELD_GET(PEEK32(SYSTEM_CTRL),
   SYSTEM_CTRL,
   CRT_VSYNC);
-   }
-   while (status == SYSTEM_CTRL_CRT_VSYNC_INACTIVE);
+   } while (status == SYSTEM_CTRL_CRT_VSYNC_INACTIVE);
}
}
 }
-- 
2.4.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v5 16/19] staging: sm750fb: fix brace placement

2015-07-14 Thread Juston Li
Fix brace placement errors caught by checkpatch.pl
ERROR: that open brace { should be on the previous line

Signed-off-by: Juston Li 
---
 drivers/staging/sm750fb/ddk750_chip.h| 12 +++
 drivers/staging/sm750fb/ddk750_display.c | 56 ++--
 drivers/staging/sm750fb/ddk750_display.h |  3 +-
 drivers/staging/sm750fb/ddk750_dvi.c |  6 ++--
 drivers/staging/sm750fb/ddk750_hwi2c.c   |  6 ++--
 drivers/staging/sm750fb/ddk750_mode.c| 13 +++-
 drivers/staging/sm750fb/ddk750_mode.h|  6 ++--
 drivers/staging/sm750fb/ddk750_power.c   | 27 +--
 drivers/staging/sm750fb/ddk750_power.h   |  3 +-
 drivers/staging/sm750fb/ddk750_sii164.c  | 16 +++--
 drivers/staging/sm750fb/ddk750_sii164.h  |  3 +-
 drivers/staging/sm750fb/sm750_accel.c| 45 -
 drivers/staging/sm750fb/sm750_cursor.c   | 23 +
 13 files changed, 71 insertions(+), 148 deletions(-)

diff --git a/drivers/staging/sm750fb/ddk750_chip.h 
b/drivers/staging/sm750fb/ddk750_chip.h
index 4e030e8..6ff0436 100644
--- a/drivers/staging/sm750fb/ddk750_chip.h
+++ b/drivers/staging/sm750fb/ddk750_chip.h
@@ -8,8 +8,7 @@
 #include 
 
 /* This is all the chips recognized by this library */
-typedef enum _logical_chip_type_t
-{
+typedef enum _logical_chip_type_t {
SM_UNKNOWN,
SM718,
SM750,
@@ -18,8 +17,7 @@ typedef enum _logical_chip_type_t
 logical_chip_type_t;
 
 
-typedef enum _clock_type_t
-{
+typedef enum _clock_type_t {
MXCLK_PLL,
PRIMARY_PLL,
SECONDARY_PLL,
@@ -28,8 +26,7 @@ typedef enum _clock_type_t
 }
 clock_type_t;
 
-typedef struct _pll_value_t
-{
+typedef struct _pll_value_t {
clock_type_t clockType;
unsigned long inputFreq; /* Input clock frequency to the PLL */
 
@@ -42,8 +39,7 @@ typedef struct _pll_value_t
 pll_value_t;
 
 /* input struct to initChipParam() function */
-typedef struct _initchip_param_t
-{
+typedef struct _initchip_param_t {
unsigned short powerMode;/* Use power mode 0 or 1 */
unsigned short chipClock;/**
  * Speed of main chip clock in MHz unit
diff --git a/drivers/staging/sm750fb/ddk750_display.c 
b/drivers/staging/sm750fb/ddk750_display.c
index 4a3cb86..a64ea32 100644
--- a/drivers/staging/sm750fb/ddk750_display.c
+++ b/drivers/staging/sm750fb/ddk750_display.c
@@ -15,12 +15,10 @@ static void setDisplayControl(int ctrl, int dispState)
cnt = 0;
 
/* Set the primary display control */
-   if (!ctrl)
-   {
+   if (!ctrl) {
ulDisplayCtrlReg = PEEK32(PANEL_DISPLAY_CTRL);
/* Turn on/off the Panel display control */
-   if (dispState)
-   {
+   if (dispState) {
/* Timing should be enabled first before enabling the 
plane
 * because changing at the same time does not guarantee 
that
 * the plane will also enabled or disabled.
@@ -45,16 +43,13 @@ static void setDisplayControl(int ctrl, int dispState)
 * until a few delay. Need to write
 * and read it a couple times
 */
-   do
-   {
+   do {
cnt++;
POKE32(PANEL_DISPLAY_CTRL, ulDisplayCtrlReg);
} while ((PEEK32(PANEL_DISPLAY_CTRL) & ~ulReservedBits) 
!=
(ulDisplayCtrlReg & ~ulReservedBits));
printk("Set Panel Plane enbit:after tried %d times\n", 
cnt);
-   }
-   else
-   {
+   } else {
/* When turning off, there is no rule on the programming
 * sequence since whenever the clock is off, then it 
does not
 * matter whether the plane is enabled or disabled.
@@ -71,14 +66,11 @@ static void setDisplayControl(int ctrl, int dispState)
POKE32(PANEL_DISPLAY_CTRL, ulDisplayCtrlReg);
}
 
-   }
-   /* Set the secondary display control */
-   else
-   {
+   } else {
+   /* Set the secondary display control */
ulDisplayCtrlReg = PEEK32(CRT_DISPLAY_CTRL);
 
-   if (dispState)
-   {
+   if (dispState) {
/* Timing should be enabled first before enabling the 
plane because changing at the
   same time does not guarantee that the plane will 
also enabled or disabled.
   */
@@ -100,16 +92,13 @@ static void setDisplayControl(int ctrl, int dispState)
FIELD_SET(0, CRT_DISPLAY_CTRL, RESERVED_3_MASK, 
ENABLE) |
FIELD_SET(0, CRT_DISPLAY_CTRL, RESERVED_4_MASK, 
ENABLE);
 
-

[PATCH v5 18/19] staging: sm750fb: remove unnecessary braces

2015-07-14 Thread Juston Li
Fixes checkpatch.pl warning:
WARNING: braces {} are not necessary for single statement blocks

Signed-off-by: Juston Li 
---
 drivers/staging/sm750fb/sm750_accel.c | 9 +++--
 drivers/staging/sm750fb/sm750_hw.c| 6 ++
 2 files changed, 5 insertions(+), 10 deletions(-)

diff --git a/drivers/staging/sm750fb/sm750_accel.c 
b/drivers/staging/sm750fb/sm750_accel.c
index 23be0f7..0f563a9 100644
--- a/drivers/staging/sm750fb/sm750_accel.c
+++ b/drivers/staging/sm750fb/sm750_accel.c
@@ -259,9 +259,8 @@ unsigned int rop2)   /* ROP value */
FIELD_VALUE(0, DE_WINDOW_WIDTH, DESTINATION, (dPitch/Bpp)) |
FIELD_VALUE(0, DE_WINDOW_WIDTH, SOURCE,  (sPitch/Bpp))); /* dpr3c */
 
-   if (accel->de_wait() != 0) {
+   if (accel->de_wait() != 0)
return -1;
-   }
 
{
 
@@ -332,9 +331,8 @@ int hw_imageblit(struct lynx_accel *accel,
ul4BytesPerScan = ulBytesPerScan & ~3;
ulBytesRemain = ulBytesPerScan & 3;
 
-   if (accel->de_wait() != 0) {
+   if (accel->de_wait() != 0)
return -1;
-   }
 
/* 2D Source Base.
 Use 0 for HOST Blt.
@@ -402,9 +400,8 @@ int hw_imageblit(struct lynx_accel *accel,
/* Write MONO data (line by line) to 2D Engine data port */
for (i = 0; i < height; i++) {
/* For each line, send the data in chunks of 4 bytes */
-   for (j = 0; j < (ul4BytesPerScan/4); j++) {
+   for (j = 0; j < (ul4BytesPerScan/4); j++)
write_dpPort(accel, *(unsigned int *)(pSrcbuf + (j * 
4)));
-   }
 
if (ulBytesRemain) {
memcpy(ajRemain, pSrcbuf+ul4BytesPerScan, 
ulBytesRemain);
diff --git a/drivers/staging/sm750fb/sm750_hw.c 
b/drivers/staging/sm750fb/sm750_hw.c
index fb9c631..d1d6ae7 100644
--- a/drivers/staging/sm750fb/sm750_hw.c
+++ b/drivers/staging/sm750fb/sm750_hw.c
@@ -188,9 +188,8 @@ int hw_sm750_inithw(struct lynx_share *share, struct 
pci_dev *pdev)
}
 
/* init 2d engine */
-   if (!share->accel_off) {
+   if (!share->accel_off)
hw_sm750_initAccel(share);
-   }
 
return 0;
 }
@@ -537,9 +536,8 @@ int hw_sm750_setBLANK(struct lynxfb_output *output, int 
blank)
POKE32(CRT_DISPLAY_CTRL, FIELD_VALUE(PEEK32(CRT_DISPLAY_CTRL), 
CRT_DISPLAY_CTRL, BLANK, crtdb));
}
 
-   if (output->paths & sm750_panel) {
+   if (output->paths & sm750_panel)
POKE32(PANEL_DISPLAY_CTRL, 
FIELD_VALUE(PEEK32(PANEL_DISPLAY_CTRL), PANEL_DISPLAY_CTRL, DATA, pps));
-   }
 
return 0;
 }
-- 
2.4.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v5 03/19] staging: sm750fb: remove space before close parenthesis

2015-07-14 Thread Juston Li
Fixes checkpatch.pl error:
ERROR: space prohibited before that close parenthesis ')'

Signed-off-by: Juston Li 
---
 drivers/staging/sm750fb/ddk750_chip.c | 2 +-
 drivers/staging/sm750fb/ddk750_mode.c | 2 +-
 drivers/staging/sm750fb/sm750_accel.c | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/sm750fb/ddk750_chip.c 
b/drivers/staging/sm750fb/ddk750_chip.c
index 1069a2d..fb1c533 100644
--- a/drivers/staging/sm750fb/ddk750_chip.c
+++ b/drivers/staging/sm750fb/ddk750_chip.c
@@ -268,7 +268,7 @@ int ddk750_initHw(initchip_param_t *pInitParam)
 #endif
 
 
-   if (pInitParam->powerMode != 0 )
+   if (pInitParam->powerMode != 0)
pInitParam->powerMode = 0;
setPowerMode(pInitParam->powerMode);
 
diff --git a/drivers/staging/sm750fb/ddk750_mode.c 
b/drivers/staging/sm750fb/ddk750_mode.c
index 31424b2..4ee9ceb 100644
--- a/drivers/staging/sm750fb/ddk750_mode.c
+++ b/drivers/staging/sm750fb/ddk750_mode.c
@@ -43,7 +43,7 @@ static unsigned long 
displayControlAdjust_SM750LE(mode_parameter_t *pModeParam,
 
/* Set bit 29:27 of display control register for the right clock */
/* Note that SM750LE only need to supported 7 resoluitons. */
-   if (x == 800 && y == 600 )
+   if (x == 800 && y == 600)
dispControl = FIELD_SET(dispControl, CRT_DISPLAY_CTRL, CLK, 
PLL41);
else if (x == 1024 && y == 768)
dispControl = FIELD_SET(dispControl, CRT_DISPLAY_CTRL, CLK, 
PLL65);
diff --git a/drivers/staging/sm750fb/sm750_accel.c 
b/drivers/staging/sm750fb/sm750_accel.c
index 64d0458..10cc022 100644
--- a/drivers/staging/sm750fb/sm750_accel.c
+++ b/drivers/staging/sm750fb/sm750_accel.c
@@ -363,7 +363,7 @@ int hw_imageblit(struct lynx_accel *accel,
Note that input pitch is BYTE value, but the 2D Pitch register uses
pixel values. Need Byte to pixel conversion.
 */
-   if(bytePerPixel == 3 ){
+   if(bytePerPixel == 3){
dx *= 3;
width *= 3;
startBit *= 3;
-- 
2.4.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v5 14/19] staging: sm750fb: remove trailing whitespace

2015-07-14 Thread Juston Li
Fixes checkpatch.pl error:
ERROR: trailing whitespace

Signed-off-by: Juston Li 
---
 drivers/staging/sm750fb/ddk750_dvi.c  | 2 +-
 drivers/staging/sm750fb/sm750_accel.c | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/sm750fb/ddk750_dvi.c 
b/drivers/staging/sm750fb/ddk750_dvi.c
index 4c64436..c42db85 100644
--- a/drivers/staging/sm750fb/ddk750_dvi.c
+++ b/drivers/staging/sm750fb/ddk750_dvi.c
@@ -1,4 +1,4 @@
-#define USE_DVICHIP 
+#define USE_DVICHIP
 #ifdef USE_DVICHIP
 #include "ddk750_help.h"
 #include "ddk750_reg.h"
diff --git a/drivers/staging/sm750fb/sm750_accel.c 
b/drivers/staging/sm750fb/sm750_accel.c
index 0cfe96c..db950d4 100644
--- a/drivers/staging/sm750fb/sm750_accel.c
+++ b/drivers/staging/sm750fb/sm750_accel.c
@@ -37,7 +37,7 @@ void hw_de_init(struct lynx_accel *accel)
 {
/* setup 2d engine registers */
u32 reg, clr;
-   
+
write_dpr(accel, DE_MASKS, 0x);
 
/* dpr1c */
@@ -82,7 +82,7 @@ void hw_de_init(struct lynx_accel *accel)
 void hw_set2dformat(struct lynx_accel *accel, int fmt)
 {
u32 reg;
-   
+
/* fmt=0,1,2 for 8,16,32,bpp on sm718/750/502 */
reg = read_dpr(accel, DE_STRETCH_FORMAT);
reg = FIELD_VALUE(reg, DE_STRETCH_FORMAT, PIXEL_FORMAT, fmt);
-- 
2.4.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v5 19/19] staging: sm750fb: add missing blank line after declarations

2015-07-14 Thread Juston Li
Fixes checkpatch.pl
WARNING: Missing a blank line after declarations

Signed-off-by: Juston Li 
---
 drivers/staging/sm750fb/ddk750_chip.c| 1 +
 drivers/staging/sm750fb/ddk750_display.c | 2 ++
 drivers/staging/sm750fb/ddk750_dvi.c | 1 +
 drivers/staging/sm750fb/ddk750_mode.c| 3 +++
 drivers/staging/sm750fb/ddk750_power.c   | 1 +
 drivers/staging/sm750fb/ddk750_sii164.c  | 1 +
 drivers/staging/sm750fb/sm750_accel.c| 1 +
 drivers/staging/sm750fb/sm750_cursor.c   | 2 ++
 drivers/staging/sm750fb/sm750_hw.c   | 7 +++
 9 files changed, 19 insertions(+)

diff --git a/drivers/staging/sm750fb/ddk750_chip.c 
b/drivers/staging/sm750fb/ddk750_chip.c
index d7435d7..5e6798e 100644
--- a/drivers/staging/sm750fb/ddk750_chip.c
+++ b/drivers/staging/sm750fb/ddk750_chip.c
@@ -474,6 +474,7 @@ unsigned int calcPllValue(unsigned int request_orig, 
pll_value_t *pll)
M += (fl_quo*X % 1) > 5000?1:0;
if (M < 256 && M > 0) {
unsigned int diff;
+
tmpClock = pll->inputFreq * M / N / X;
diff = absDiff(tmpClock, request_orig);
if (diff < miniDiff) {
diff --git a/drivers/staging/sm750fb/ddk750_display.c 
b/drivers/staging/sm750fb/ddk750_display.c
index abd6283..8348113 100644
--- a/drivers/staging/sm750fb/ddk750_display.c
+++ b/drivers/staging/sm750fb/ddk750_display.c
@@ -121,6 +121,7 @@ static void setDisplayControl(int ctrl, int dispState)
 static void waitNextVerticalSync(int ctrl, int delay)
 {
unsigned int status;
+
if (!ctrl) {
/* primary controller */
 
@@ -210,6 +211,7 @@ static void swPanelPowerSequence(int disp, int delay)
 void ddk750_setLogicalDispOut(disp_output_t output)
 {
unsigned int reg;
+
if (output & PNL_2_USAGE) {
/* set panel path controller select */
reg = PEEK32(PANEL_DISPLAY_CTRL);
diff --git a/drivers/staging/sm750fb/ddk750_dvi.c 
b/drivers/staging/sm750fb/ddk750_dvi.c
index a18bb4c..a7a2351 100644
--- a/drivers/staging/sm750fb/ddk750_dvi.c
+++ b/drivers/staging/sm750fb/ddk750_dvi.c
@@ -43,6 +43,7 @@ int dviInit(
)
 {
dvi_ctrl_device_t *pCurrentDviCtrl;
+
pCurrentDviCtrl = g_dcftSupportedDviController;
if (pCurrentDviCtrl->pfnInit != NULL) {
return pCurrentDviCtrl->pfnInit(edgeSelect, busSelect, 
dualEdgeClkSelect, hsyncEnable,
diff --git a/drivers/staging/sm750fb/ddk750_mode.c 
b/drivers/staging/sm750fb/ddk750_mode.c
index 9d10446..2399b17 100644
--- a/drivers/staging/sm750fb/ddk750_mode.c
+++ b/drivers/staging/sm750fb/ddk750_mode.c
@@ -80,6 +80,7 @@ static int programModeRegisters(mode_parameter_t *pModeParam, 
pll_value_t *pll)
int ret = 0;
int cnt = 0;
unsigned int ulTmpValue, ulReg;
+
if (pll->clockType == SECONDARY_PLL) {
/* programe secondary pixel clock */
POKE32(CRT_PLL_CTRL, formatPllReg(pll));
@@ -120,6 +121,7 @@ static int programModeRegisters(mode_parameter_t 
*pModeParam, pll_value_t *pll)
 
} else if (pll->clockType == PRIMARY_PLL) {
unsigned int ulReservedBits;
+
POKE32(PANEL_PLL_CTRL, formatPllReg(pll));
 
POKE32(PANEL_HORIZONTAL_TOTAL,
@@ -184,6 +186,7 @@ int ddk750_setModeTiming(mode_parameter_t *parm, 
clock_type_t clock)
 {
pll_value_t pll;
unsigned int uiActualPixelClk;
+
pll.inputFreq = DEFAULT_INPUT_CLOCK;
pll.clockType = clock;
 
diff --git a/drivers/staging/sm750fb/ddk750_power.c 
b/drivers/staging/sm750fb/ddk750_power.c
index c545c2d..c8c51be 100644
--- a/drivers/staging/sm750fb/ddk750_power.c
+++ b/drivers/staging/sm750fb/ddk750_power.c
@@ -5,6 +5,7 @@
 void ddk750_setDPMS(DPMS_t state)
 {
unsigned int value;
+
if (getChipType() == SM750LE) {
value = PEEK32(CRT_DISPLAY_CTRL);
POKE32(CRT_DISPLAY_CTRL, FIELD_VALUE(value, CRT_DISPLAY_CTRL, 
DPMS, state));
diff --git a/drivers/staging/sm750fb/ddk750_sii164.c 
b/drivers/staging/sm750fb/ddk750_sii164.c
index a5153be..0bdf3db 100644
--- a/drivers/staging/sm750fb/ddk750_sii164.c
+++ b/drivers/staging/sm750fb/ddk750_sii164.c
@@ -340,6 +340,7 @@ void sii164EnableHotPlugDetection(
 )
 {
unsigned char detectReg;
+
detectReg = i2cReadReg(SII164_I2C_ADDRESS, SII164_DETECT);
 
/* Depending on each DVI controller, need to enable the hot plug based 
on each
diff --git a/drivers/staging/sm750fb/sm750_accel.c 
b/drivers/staging/sm750fb/sm750_accel.c
index 0f563a9..1dd06a2 100644
--- a/drivers/staging/sm750fb/sm750_accel.c
+++ b/drivers/staging/sm750fb/sm750_accel.c
@@ -152,6 +152,7 @@ unsigned int rop2)   /* ROP value */
 {
unsigned int nDirection, de_ctrl;
int opSign;
+
nDirection = LEFT_TO_RIGHT;
/* Direction of ROP2 operation: 1 = Left to Right, (-1) = 

Re: [patch] checkpatch: Fixes: tag lines are allowed to be long

2015-07-14 Thread Joe Perches
On Tue, 2015-07-14 at 14:07 +0300, Dan Carpenter wrote:
> A lot of the Fixes: tags go over the 75 character limit and that's ok.
> 
> Fixes: 2a076f40d8c9 ('checkpatch, SubmittingPatches: suggest line wrapping 
> commit messages at 75 columns')
> Signed-off-by: Dan Carpenter 
> ---
> The other common cause of false positives it Oops output but I don't
> have an idea how to filter for that.
> 
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> index 90e1edc..537973b 100755[0-9a-f
> --- a/scripts/checkpatch.pl
> +++ b/scripts/checkpatch.pl
> @@ -2310,7 +2310,7 @@ sub process {
>  
>  # Check for line lengths > 75 in commit log, warn once
>   if ($in_commit_log && !$commit_log_long_line &&
> - length($line) > 75) {
> + length($line) > 75 && !($line =~ /^Fixes:/)) {
>   WARN("COMMIT_LOG_LONG_LINE",
>"Possible unwrapped commit description (prefer a 
> maximum 75 chars per line)\n" . $herecurr);
>   $commit_log_long_line = 1;

Maybe some combination of:

^\s*> 
^.*\[\s*timestamp\s*\]
^\s*\[\<0-9a-f\>\]
oops:
BUG: Unable to 
Unable to

Followed by any blank line to reset

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v5 00/19] staging: sm750fb: checkpatch.pl fixes

2015-07-14 Thread Juston Li
This patch set includes 19 patches fixing indentation, spacing, brace placement
and missing blank lines from checkpatch.pl warnings/errors in staging/sm750fb.

Regards
Juston

-
Changes since v4:
 * Rebase to current staging-testing

Changes since v3:
 * Fix comment placement 16/19
 * Rebase to current staging-testing

Changes since v2:

 * Fix Subject
 * Don't rearrange lines in 01/19
 * Split up spacing fixes patch by checkpatch errors into 14 patches
 * Split up brace fixes patch by checkpatch errors in 3 patches

-
Diffstat:
 drivers/staging/sm750fb/ddk750_chip.c|  15 +-
 drivers/staging/sm750fb/ddk750_chip.h|  12 +-
 drivers/staging/sm750fb/ddk750_display.c | 170 -
 drivers/staging/sm750fb/ddk750_display.h |  11 +-
 drivers/staging/sm750fb/ddk750_dvi.c |  75 ++--
 drivers/staging/sm750fb/ddk750_help.c|   2 +-
 drivers/staging/sm750fb/ddk750_help.h|   4 +-
 drivers/staging/sm750fb/ddk750_hwi2c.c   | 244 +++--
 drivers/staging/sm750fb/ddk750_mode.c| 164 +
 drivers/staging/sm750fb/ddk750_mode.h|  52 ++-
 drivers/staging/sm750fb/ddk750_power.c   | 254 +++---
 drivers/staging/sm750fb/ddk750_power.h   |  11 +-
 drivers/staging/sm750fb/ddk750_reg.h |  18 +-
 drivers/staging/sm750fb/ddk750_sii164.c  | 389 ++---
 drivers/staging/sm750fb/ddk750_sii164.h  |  31 +-
 drivers/staging/sm750fb/sm750.c  |   2 +-
 drivers/staging/sm750fb/sm750.h  |  58 +--
 drivers/staging/sm750fb/sm750_accel.c| 379 ++--
 drivers/staging/sm750fb/sm750_accel.h|   4 +-
 drivers/staging/sm750fb/sm750_cursor.c   |  51 ++-
 drivers/staging/sm750fb/sm750_help.h |  28 +-
 drivers/staging/sm750fb/sm750_hw.c   |  19 +-
 drivers/staging/sm750fb/sm750_hw.h   |  42 +--
 23 files changed, 984 insertions(+), 1051 deletions(-)
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] rtc/rtc-opal: Enable alarms only when opal supports tpo

2015-07-14 Thread Stewart Smith
Vaibhav Jain  writes:
> rtc-opal driver provides support for rtc alarms via
> timed-power-on(tpo). However some Power platforms like BML use a fake
> rtc clock and don't support tpo. Such platforms are indicated by the
> missing 'has-tpo' property in the device tree.
>
> Current implementation however enables callback for
> rtc_class_ops.read/set alarm irrespective of the tpo support from the
> platform. This results in a failed opal call when kernel tries to read
> an existing alarms via opal_get_tpo_time during rtc device registration.
>
> This patch fixes this issue by setting opal_rtc_ops.read/set_alarm
> callback pointers only when tpo is supported.
>
> Acked-by: Michael Neuling 
> Acked-by: Neelesh Gupta 
> Signed-off-by: Vaibhav Jain 

Acked-by: Stewart Smith 

FWIW I'm updating OPAL docs with this. The TPO calls aren't actually
documented :(

In future, it'd be great if there was an accompanying skiboot patch
updating the documentation there too.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 3/3] zsmalloc: do not take class lock in zs_pages_to_compact()

2015-07-14 Thread Sergey Senozhatsky
On (07/11/15 18:45), Sergey Senozhatsky wrote:
[..]
> We re-do this calculations during compaction on a per class basis
> anyway.
> 
> zs_unregister_shrinker() will not return until we have an active
> shrinker, so classes won't unexpectedly disappear while
> zs_pages_to_compact(), invoked by zs_shrinker_count(), iterates
> them.
> 
> When called from zram, we are protected by zram's ->init_lock,
> so, again, classes will be there until zs_pages_to_compact()
> iterates them.
> 
> Signed-off-by: Sergey Senozhatsky 
> ---
>  mm/zsmalloc.c | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c
> index b10a228..824c182 100644
> --- a/mm/zsmalloc.c
> +++ b/mm/zsmalloc.c
> @@ -1811,9 +1811,7 @@ unsigned long zs_pages_to_compact(struct zs_pool *pool)
>   if (class->index != i)
>   continue;
>  
> - spin_lock(>lock);
>   pages_to_free += zs_can_compact(class);
> - spin_unlock(>lock);
>   }
>  
>   return pages_to_free;

This patch still makes sense. Agree?

-ss
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v2] PM / Sleep: Use workqueue for user space wakeup sources garbage collector

2015-07-14 Thread SungEun Kim(cleaneye....@lge.com)


On 2015-07-03 오후 2:03, SungEun Kim(cleaneye@lge.com) wrote:
> On 2015-07-03 오전 9:15, Rafael J. Wysocki wrote:
>> On Wednesday, July 01, 2015 05:28:48 PM SungEun Kim wrote:
>>> From: "SungEun Kim" 
>>>
>>> The synchronous synchronize_rcu in wakeup_source_remove makes user
>> process
>>> which writes to /sys/kernel/wake_unlock blocked sometimes.
>>>
>>> For example, when android eventhub tries to release wakelock,
>>> this blocking process can occur, and eventhub can't get input event
>>> for a while.
>>>
>>> Using workqueue instead of direct function call at pm_wake_unlock
>>> can prevent this unnecessary delay of an user space process.
>>
>> The idea is defendable, but the patch is too simple.
>>
>> For example, if the garbage collection is in progress, it is not useful
>> to start a new one.
>>
>> Also the incrementation and clearing of wakelocks_gc_count should be under
>> the lock.
> 
> Thank you for your advices.
> I will correct and amend my patch and then submit v3 patch.
> 
> Thank you.
> SungEun Kim
> 

Dear Wysocki,

I've submit patch v3.
Could you review patch v3?

Thank you.
SungEun Kim

>>
>>
>> -- 
>> I speak only for myself.
>> Rafael J. Wysocki, Intel Open Source Technology Center.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 3/5] x86, acpi, cpu-hotplug: Introduce apicid_to_cpuid[] array to store persistent cpuid <-> apicid mapping.

2015-07-14 Thread Tang Chen

Hi Mika,

On 07/07/2015 07:14 PM, Mika Penttilä wrote:

I think you forgot to reserve CPU 0 for BSP in cpuid mask.


Sorry for the late reply.

I'm not familiar with BSP.  Do you mean in get_cpuid(),
I should reserve 0 for physical cpu0 in BSP ?

Would you please share more detail ?

Thanks.



--Mika

On Tue, Jul 7, 2015 at 12:30 PM, Tang Chen  wrote:

From: Gu Zheng 

In this patch, we introduce a new static array named apicid_to_cpuid[],
which is large enough to store info for all possible cpus.

And then, we modify the cpuid calculation. In generic_processor_info(),
it simply finds the next unused cpuid. And it is also why the cpuid <-> nodeid
mapping changes with node hotplug.

After this patch, we find the next unused cpuid, map it to an apicid,
and store the mapping in apicid_to_cpuid[], so that cpuid <-> apicid
mapping will be persistent.

And finally we will use this array to make cpuid <-> nodeid persistent.

cpuid <-> apicid mapping is established at local apic registeration time.
But non-present or disabled cpus are ignored.

In this patch, we establish all possible cpuid <-> apicid mapping when
registering local apic.


Signed-off-by: Gu Zheng 
Signed-off-by: Tang Chen 
---
  arch/x86/include/asm/mpspec.h |  1 +
  arch/x86/kernel/acpi/boot.c   |  6 ++
  arch/x86/kernel/apic/apic.c   | 47 ---
  3 files changed, 47 insertions(+), 7 deletions(-)

diff --git a/arch/x86/include/asm/mpspec.h b/arch/x86/include/asm/mpspec.h
index b07233b..db902d8 100644
--- a/arch/x86/include/asm/mpspec.h
+++ b/arch/x86/include/asm/mpspec.h
@@ -86,6 +86,7 @@ static inline void early_reserve_e820_mpc_new(void) { }
  #endif

  int generic_processor_info(int apicid, int version);
+int __generic_processor_info(int apicid, int version, bool enabled);

  #define PHYSID_ARRAY_SIZE  BITS_TO_LONGS(MAX_LOCAL_APIC)

diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c
index e49ee24..bcc85b2 100644
--- a/arch/x86/kernel/acpi/boot.c
+++ b/arch/x86/kernel/acpi/boot.c
@@ -174,15 +174,13 @@ static int acpi_register_lapic(int id, u8 enabled)
 return -EINVAL;
 }

-   if (!enabled) {
+   if (!enabled)
 ++disabled_cpus;
-   return -EINVAL;
-   }

 if (boot_cpu_physical_apicid != -1U)
 ver = apic_version[boot_cpu_physical_apicid];

-   return generic_processor_info(id, ver);
+   return __generic_processor_info(id, ver, enabled);
  }

  static int __init
diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c
index a9c9830..c744ffb 100644
--- a/arch/x86/kernel/apic/apic.c
+++ b/arch/x86/kernel/apic/apic.c
@@ -1977,7 +1977,38 @@ void disconnect_bsp_APIC(int virt_wire_setup)
 apic_write(APIC_LVT1, value);
  }

-static int __generic_processor_info(int apicid, int version, bool enabled)
+/*
+ * Logic cpu number(cpuid) to local APIC id persistent mappings.
+ * Do not clear the mapping even if cpu is hot-removed.
+ */
+static int apicid_to_cpuid[] = {
+   [0 ... NR_CPUS - 1] = -1,
+};
+
+/*
+ * Internal cpu id bits, set the bit once cpu present, and never clear it.
+ */
+static cpumask_t cpuid_mask = CPU_MASK_NONE;
+
+static int get_cpuid(int apicid)
+{
+   int free_id, i;
+
+   free_id = cpumask_next_zero(-1, _mask);
+   if (free_id >= nr_cpu_ids)
+   return -1;
+
+   for (i = 0; i < free_id; i++)
+   if (apicid_to_cpuid[i] == apicid)
+   return i;
+
+   apicid_to_cpuid[free_id] = apicid;
+   cpumask_set_cpu(free_id, _mask);
+
+   return free_id;
+}
+
+int __generic_processor_info(int apicid, int version, bool enabled)
  {
 int cpu, max = nr_cpu_ids;
 bool boot_cpu_detected = physid_isset(boot_cpu_physical_apicid,
@@ -2058,8 +2089,18 @@ static int __generic_processor_info(int apicid, int 
version, bool enabled)
  * for BSP.
  */
 cpu = 0;
-   } else
-   cpu = cpumask_next_zero(-1, cpu_present_mask);
+   } else {
+   cpu = get_cpuid(apicid);
+   if (cpu < 0) {
+   int thiscpu = max + disabled_cpus;
+
+   pr_warning("  Processor %d/0x%x ignored.\n",
+  thiscpu, apicid);
+   if (enabled)
+   disabled_cpus++;
+   return -EINVAL;
+   }
+   }

 /*
  * Validate version
--
1.9.3

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

.



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Re: [PATCH v3 00/11] USB: OTG/DRD Core functionality

2015-07-14 Thread Peter Chen
On Tue, Jul 14, 2015 at 11:18:30AM -0700, Andrew Bresticker wrote:
> Hi Peter,
> 
> On Mon, Jul 13, 2015 at 5:59 PM, Peter Chen  wrote:
> > On Mon, Jul 13, 2015 at 12:14:43PM -0700, Andrew Bresticker wrote:
> >> Hi Roger,
> >>
> >> On Wed, Jul 8, 2015 at 3:19 AM, Roger Quadros  wrote:
> >> > Usage model:
> >> > ---
> >> >
> >> > - The OTG controller device is assumed to be the parent of
> >> > the host and gadget controller. It must call usb_otg_register()
> >> > before populating the host and gadget devices so that the OTG
> >> > core is aware that it is an OTG device before the host & gadget
> >> > register. The OTG controller must provide struct otg_fsm_ops *
> >> > which will be called by the OTG core depending on OTG bus state.
> >>
> >> I'm wondering if the requirement that the OTG controller be the parent
> >> of the USB host/device-controllers makes sense.  For some context, I'm
> >> working on adding dual-role support for Tegra210, specifically on a
> >> system with USB Type-C.  On Tegra, the USB host-controller and USB
> >> device-controller are two separate IP blocks (XUSB host and XUSB
> >> device) with another, separate, IP block (XUSB padctl) for the USB PHY
> >> and OTG support.  In the non-Type-C case, your OTG framework could
> >> work well, though it's debatable as to whether or not the XUSB padctl
> >> device should be a parent to the XUSB host/device-controller devices
> >> (currently it isn't - it's just a PHY provider).  But in the Type-C
> >> case, it's an off-chip embedded controller that determines the
> >> dual-role status of the Type-C port, so the above requirement doesn't
> >> make sense at all.
> >
> > Hi Andrew,
> >
> > I think your problem is how to add your core driver to manage device and
> > host functionality together, and once you find how (through padctl/type-c
> > controller) to do it based on current code, it will be clear how to use 
> > roger
> > proposal framework at that time.
> >
> > Most of current core drivers, we use extcon driver (through gpio) or USB
> > vbus/id pin (through internal registers) to manager roles.
> 
> Right, currently I'm modeling the Type-C controller as an extcon
> device and handle the role-changes in the core drivers, but that
> doesn't really make sense for the non-Type-C case where we use the
> XUSB padctl controller and need a full OTG state-machine.

The full OTG FSM is only applied if your board needs it, you can
disable it through dts. Jun [1] and Roger's patchset are for it.

> Roger's new
> OTG/DRD framework would fit my situation perfectly since it makes the
> host/device-controller drivers independent from all the
> OTG/role-changing logic.  The only issue is the requirement that the
> OTG/DRD controller be the parent device of the host/device
> controllers.
> 

The core device is the parent for host/device device, the OTG core
just use the pointer of it, Roger does an example using dwc3 [2].

[1] http://www.spinics.net/lists/linux-usb/msg127110.html
[2] http://www.spinics.net/lists/linux-usb/msg126999.html
-- 

Best Regards,
Peter Chen
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 1/2] ASoC: rockchip: Add machine driver for max98090 codec

2015-07-14 Thread Xing Zheng
From: zhengxing 

The driver is used for rockchip board using a max98090.

Reviewed-by: Dylan Reid 
Signed-off-by: zhengxing 
---

 sound/soc/rockchip/Kconfig |   10 ++
 sound/soc/rockchip/Makefile|4 +
 sound/soc/rockchip/rockchip_max98090.c |  246 
 3 files changed, 260 insertions(+)
 create mode 100644 sound/soc/rockchip/rockchip_max98090.c

diff --git a/sound/soc/rockchip/Kconfig b/sound/soc/rockchip/Kconfig
index e181826..d123566 100644
--- a/sound/soc/rockchip/Kconfig
+++ b/sound/soc/rockchip/Kconfig
@@ -14,3 +14,13 @@ config SND_SOC_ROCKCHIP_I2S
  Say Y or M if you want to add support for I2S driver for
  Rockchip I2S device. The device supports upto maximum of
  8 channels each for play and record.
+
+config SND_SOC_ROCKCHIP_MAX98090
+   tristate "ASoC support for Rockchip boards using a MAX98090 codec"
+   depends on SND_SOC_ROCKCHIP && I2C && GPIOLIB
+   select SND_SOC_ROCKCHIP_I2S
+   select SND_SOC_MAX98090
+   select SND_SOC_TS3A227E
+   help
+ Say Y or M here if you want to add support for SoC audio on Rockchip
+ boards using the MAX98090 codec, such as Veyron.
diff --git a/sound/soc/rockchip/Makefile b/sound/soc/rockchip/Makefile
index b921909..df3445b 100644
--- a/sound/soc/rockchip/Makefile
+++ b/sound/soc/rockchip/Makefile
@@ -2,3 +2,7 @@
 snd-soc-i2s-objs := rockchip_i2s.o
 
 obj-$(CONFIG_SND_SOC_ROCKCHIP_I2S) += snd-soc-i2s.o
+
+snd-soc-rockchip-max98090-objs := rockchip_max98090.o
+
+obj-$(CONFIG_SND_SOC_ROCKCHIP_MAX98090) += snd-soc-rockchip-max98090.o
diff --git a/sound/soc/rockchip/rockchip_max98090.c 
b/sound/soc/rockchip/rockchip_max98090.c
new file mode 100644
index 000..dcdce06
--- /dev/null
+++ b/sound/soc/rockchip/rockchip_max98090.c
@@ -0,0 +1,246 @@
+/*
+ * Rockchip machine ASoC driver for boards using a MAX90809 CODEC.
+ *
+ * Copyright (c) 2014, ROCKCHIP CORPORATION.  All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see .
+ *
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "rockchip_i2s.h"
+#include "../codecs/ts3a227e.h"
+
+#define DRV_NAME "rockchip-snd-max98090"
+
+static struct snd_soc_jack headset_jack;
+static struct snd_soc_jack_pin headset_jack_pins[] = {
+   {
+   .pin = "Headset Jack",
+   .mask = SND_JACK_HEADPHONE | SND_JACK_MICROPHONE |
+   SND_JACK_BTN_0 | SND_JACK_BTN_1 |
+   SND_JACK_BTN_2 | SND_JACK_BTN_3,
+   },
+};
+
+static const struct snd_soc_dapm_widget rk_dapm_widgets[] = {
+   SND_SOC_DAPM_HP("Headphone", NULL),
+   SND_SOC_DAPM_MIC("Headset Mic", NULL),
+   SND_SOC_DAPM_MIC("Int Mic", NULL),
+   SND_SOC_DAPM_SPK("Speaker", NULL),
+};
+
+static const struct snd_soc_dapm_route rk_audio_map[] = {
+   {"IN34", NULL, "Headset Mic"},
+   {"IN34", NULL, "MICBIAS"},
+   {"MICBIAS", NULL, "Headset Mic"},
+   {"DMICL", NULL, "Int Mic"},
+   {"Headphone", NULL, "HPL"},
+   {"Headphone", NULL, "HPR"},
+   {"Speaker", NULL, "SPKL"},
+   {"Speaker", NULL, "SPKR"},
+};
+
+static const struct snd_kcontrol_new rk_mc_controls[] = {
+   SOC_DAPM_PIN_SWITCH("Headphone"),
+   SOC_DAPM_PIN_SWITCH("Headset Mic"),
+   SOC_DAPM_PIN_SWITCH("Int Mic"),
+   SOC_DAPM_PIN_SWITCH("Speaker"),
+};
+
+static int rk_aif1_hw_params(struct snd_pcm_substream *substream,
+struct snd_pcm_hw_params *params)
+{
+   int ret = 0;
+   struct snd_soc_pcm_runtime *rtd = substream->private_data;
+   struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
+   struct snd_soc_dai *codec_dai = rtd->codec_dai;
+   int mclk;
+
+   switch (params_rate(params)) {
+   case 8000:
+   case 16000:
+   case 48000:
+   case 96000:
+   mclk = 12288000;
+   break;
+   case 44100:
+   mclk = 11289600;
+   break;
+   default:
+   return -EINVAL;
+   }
+
+   ret = snd_soc_dai_set_sysclk(cpu_dai, 0, mclk,
+SND_SOC_CLOCK_OUT);
+   if (ret < 0) {
+   dev_err(codec_dai->dev, "Can't set codec clock %d\n", ret);
+   return ret;
+   }
+
+   ret = snd_soc_dai_set_sysclk(codec_dai, 0, mclk,
+  

[RESEND PATCH 1/1] staging:vt6655: remove checks around dev_kfree_skb

2015-07-14 Thread Maninder Singh
dev_kfree_skb checks for NULL pointer itself,
Thus no need of explicit NULL check.

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

diff --git a/drivers/staging/vt6655/device_main.c 
b/drivers/staging/vt6655/device_main.c
index ed040fb..1a50ea6 100644
--- a/drivers/staging/vt6655/device_main.c
+++ b/drivers/staging/vt6655/device_main.c
@@ -758,9 +758,7 @@ static void device_free_td0_ring(struct vnt_private 
*pDevice)
dma_unmap_single(>pcid->dev, pTDInfo->skb_dma,
 pTDInfo->skb->len, DMA_TO_DEVICE);
 
-   if (pTDInfo->skb)
-   dev_kfree_skb(pTDInfo->skb);
-
+   dev_kfree_skb(pTDInfo->skb);
kfree(pDesc->pTDInfo);
}
 }
@@ -777,9 +775,7 @@ static void device_free_td1_ring(struct vnt_private 
*pDevice)
dma_unmap_single(>pcid->dev, pTDInfo->skb_dma,
 pTDInfo->skb->len, DMA_TO_DEVICE);
 
-   if (pTDInfo->skb)
-   dev_kfree_skb(pTDInfo->skb);
-
+   dev_kfree_skb(pTDInfo->skb);
kfree(pDesc->pTDInfo);
}
 }
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 2/2] ASoC: rockchip: Add machine driver for rt5645/rt5650 codec

2015-07-14 Thread Xing Zheng
From: zhengxing 

The driver is used for rockchip board using a rt5645/rt5650.

Reviewed-by: Dylan Reid 
Signed-off-by: zhengxing 

---

 sound/soc/rockchip/Kconfig   |9 ++
 sound/soc/rockchip/Makefile  |2 +
 sound/soc/rockchip/rockchip_rt5645.c |  235 ++
 3 files changed, 246 insertions(+)
 create mode 100644 sound/soc/rockchip/rockchip_rt5645.c

diff --git a/sound/soc/rockchip/Kconfig b/sound/soc/rockchip/Kconfig
index d123566..58bae8e 100644
--- a/sound/soc/rockchip/Kconfig
+++ b/sound/soc/rockchip/Kconfig
@@ -24,3 +24,12 @@ config SND_SOC_ROCKCHIP_MAX98090
help
  Say Y or M here if you want to add support for SoC audio on Rockchip
  boards using the MAX98090 codec, such as Veyron.
+
+config SND_SOC_ROCKCHIP_RT5645
+   tristate "ASoC support for Rockchip boards using a RT5645/RT5650 codec"
+   depends on SND_SOC_ROCKCHIP && I2C && GPIOLIB
+   select SND_SOC_ROCKCHIP_I2S
+   select SND_SOC_RT5645
+   help
+ Say Y or M here if you want to add support for SoC audio on Rockchip
+ boards using the RT5645/RT5650 codec, such as Veyron.
diff --git a/sound/soc/rockchip/Makefile b/sound/soc/rockchip/Makefile
index df3445b..1bc1dc3 100644
--- a/sound/soc/rockchip/Makefile
+++ b/sound/soc/rockchip/Makefile
@@ -4,5 +4,7 @@ snd-soc-i2s-objs := rockchip_i2s.o
 obj-$(CONFIG_SND_SOC_ROCKCHIP_I2S) += snd-soc-i2s.o
 
 snd-soc-rockchip-max98090-objs := rockchip_max98090.o
+snd-soc-rockchip-rt5645-objs := rockchip_rt5645.o
 
 obj-$(CONFIG_SND_SOC_ROCKCHIP_MAX98090) += snd-soc-rockchip-max98090.o
+obj-$(CONFIG_SND_SOC_ROCKCHIP_RT5645) += snd-soc-rockchip-rt5645.o
diff --git a/sound/soc/rockchip/rockchip_rt5645.c 
b/sound/soc/rockchip/rockchip_rt5645.c
new file mode 100644
index 000..1a9a3f2
--- /dev/null
+++ b/sound/soc/rockchip/rockchip_rt5645.c
@@ -0,0 +1,235 @@
+/*
+ * Rockchip machine ASoC driver for boards using a RT5645/RT5650 CODEC.
+ *
+ * Copyright (c) 2015, ROCKCHIP CORPORATION.  All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see .
+ *
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include "rockchip_i2s.h"
+
+#define DRV_NAME "rockchip-snd-rt5645"
+
+static struct snd_soc_jack headset_jack;
+
+/* Jack detect via rt5645 driver. */
+extern int rt5645_set_jack_detect(struct snd_soc_codec *codec,
+   struct snd_soc_jack *hp_jack, struct snd_soc_jack *mic_jack,
+   struct snd_soc_jack *btn_jack);
+
+static const struct snd_soc_dapm_widget rk_dapm_widgets[] = {
+   SND_SOC_DAPM_HP("Headphones", NULL),
+   SND_SOC_DAPM_SPK("Speakers", NULL),
+   SND_SOC_DAPM_MIC("Headset Mic", NULL),
+   SND_SOC_DAPM_MIC("Int Mic", NULL),
+};
+
+static const struct snd_soc_dapm_route rk_audio_map[] = {
+   /* Input Lines */
+   {"DMIC L2", NULL, "Int Mic"},
+   {"DMIC R2", NULL, "Int Mic"},
+   {"RECMIXL", NULL, "Headset Mic"},
+   {"RECMIXR", NULL, "Headset Mic"},
+
+   /* Output Lines */
+   {"Headphones", NULL, "HPOR"},
+   {"Headphones", NULL, "HPOL"},
+   {"Speakers", NULL, "SPOL"},
+   {"Speakers", NULL, "SPOR"},
+};
+
+static const struct snd_kcontrol_new rk_mc_controls[] = {
+   SOC_DAPM_PIN_SWITCH("Headphones"),
+   SOC_DAPM_PIN_SWITCH("Speakers"),
+   SOC_DAPM_PIN_SWITCH("Headset Mic"),
+   SOC_DAPM_PIN_SWITCH("Int Mic"),
+};
+
+static int rk_aif1_hw_params(struct snd_pcm_substream *substream,
+struct snd_pcm_hw_params *params)
+{
+   int ret = 0;
+   struct snd_soc_pcm_runtime *rtd = substream->private_data;
+   struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
+   struct snd_soc_dai *codec_dai = rtd->codec_dai;
+   int mclk;
+
+   switch (params_rate(params)) {
+   case 8000:
+   case 16000:
+   case 48000:
+   case 96000:
+   mclk = 12288000;
+   break;
+   case 44100:
+   mclk = 11289600;
+   break;
+   default:
+   return -EINVAL;
+   }
+
+   ret = snd_soc_dai_set_sysclk(cpu_dai, 0, mclk,
+SND_SOC_CLOCK_OUT);
+   if (ret < 0) {
+   dev_err(codec_dai->dev, "Can't set codec clock %d\n", ret);
+   return ret;
+   }
+
+   ret = snd_soc_dai_set_sysclk(codec_dai, 0, mclk,
+

[PATCH 0/2] Add codec machine driver for rockchip platform

2015-07-14 Thread Xing Zheng
From: zhengxing 

Hi,
  The simple-card is not common at present, soc maybe need own machine
driver for jack detection.
Add drivers for two families of rockchip-bases chromebooks.  These
machine drives don't use simplecard because we need custom jack
detection plumbing.

- use ts3a227e for ext jack detection with max98090
- call rt5645_set_jack_detect function via rt5645 codec driver

Thanks.

zhengxing (2):
  ASoC: rockchip: Add machine driver for max98090 codec
  ASoC: rockchip: Add machine driver for rt5645/rt5650 codec

 sound/soc/rockchip/Kconfig |   19 +++
 sound/soc/rockchip/Makefile|6 +
 sound/soc/rockchip/rockchip_max98090.c |  246 
 sound/soc/rockchip/rockchip_rt5645.c   |  235 ++
 4 files changed, 506 insertions(+)
 create mode 100644 sound/soc/rockchip/rockchip_max98090.c
 create mode 100644 sound/soc/rockchip/rockchip_rt5645.c

-- 
1.7.9.5


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [RFC PATCH v2 1/4] y2038: add 64bit time_t support in timeval for 32bit architecture

2015-07-14 Thread Bamvor Zhang Jian

Hi, Arnd

On 07/09/2015 06:26 PM, Arnd Bergmann wrote:

On Thursday 09 July 2015 17:02:47 Bamvor Zhang Jian wrote:

On 07/09/2015 04:09 AM, John Stultz wrote:

On Mon, Jun 29, 2015 at 7:23 AM, Bamvor Zhang Jian
 wrote:

+int get_timeval64(struct timeval64 *tv,
+  const struct __kernel_timeval __user *utv)
+{
+   struct __kernel_timeval ktv;
+   int ret;
+
+   ret = copy_from_user(, utv, sizeof(ktv));
+   if (ret)
+   return -EFAULT;
+
+   tv->tv_sec = ktv.tv_sec;
+   if (!IS_ENABLED(CONFIG_64BIT)
+#ifdef CONFIG_COMPAT
+  || is_compat_task()
+#endif


These sorts of ifdefs are to be avoided inside of functions.



Instead, it seems is_compat_task() should be defined to 0 in the
!CONFIG_COMPAT case, so you can avoid the ifdefs and the compiler can
still optimize it out.

I add this ifdef because I got compile failure on arm platform. This
file do not include the  directly. And in arm64,
compat.h is included implicitily.
So, I am not sure what I should do here. Include  in
this file directly or add a this check at the beginning of this file?

#ifndef is_compat_task
#define is_compat_task() (0)
#endif



Actually I think we can completely skip this test here: Unlike
timespec, timeval is defined in a way that always lets user space
use a 64-bit type for the microsecond portion (suseconds_t tv_usec).

I do not familar with this type. I grep the suseconds_t in glibc, it
seems that suseconds_t(__SUSECONDS_T_TYPE) is defined as
__SYSCALL_SLONG_TYPE which is __SLONGWORD_TYPE(32bit on 32bit
architecture).

I think we should simplify this case and just assume that user space
does exactly that, and treat a tv_usec value with a nonzero upper
half as an error.

I would also keep this function local to the ppdev driver, in order
to not proliferate this to generic kernel code, but that is something
we can debate, based on what other drivers need. For core kernel
code, we should not need a get_timeval64 function because all system
calls that pass a timeval structure are obsolete and we don't need
to provide 64-bit time_t variants of them.

Got it.

regards

bamvor


Arnd


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 17/36] PCI: Add support for more than two alt_size under same bridge

2015-07-14 Thread Yijing Wang
On 2015/7/7 7:39, Yinghai Lu wrote:
> Need to increase size to make sure it could fit all alt entries.
> 
> In the patch, we first select one big size, and then keep reducing
> the size and retrying to get the minimum value for alt_size.
> 
> Example:
> two bridges: one have 8M/8M, and 1M/1M children res.
>one have 4M/4M, and 1M/1M children res.
> 
> Then we have child pridges alt_align/alt_size: 8M/9M, 4M/5M.
> Before this patch, parent bridge alt_align/alt_size is 8M/14M
> that is wrong.
> With this patch   parent bridge alt_align/alt_size: 8M/17M.
> 
> At same time, child bridges must align/size: 4M/12M, 2M/6M.
> and prarent bridge must align/size: 4M/20M.
> 
> So at last, we use 8M/17M as parent bridge alt_align/alt_size.

Tested-by: Yijing Wang 

Hi Yinghai, does this patch depend on the previous items in this patchset ?
Could you provide another version of this patch for stable branch, eg. 3.10 
stable ?

Thanks!
Yijing.

> 
> Link: https://bugzilla.kernel.org/show_bug.cgi?id=100451
> Reported-by: Yijing Wang 
> Signed-off-by: Yinghai Lu 
> ---
>  drivers/pci/setup-bus.c | 53 
> +
>  1 file changed, 53 insertions(+)
> 
> diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c
> index c0090d4..9427baa 100644
> --- a/drivers/pci/setup-bus.c
> +++ b/drivers/pci/setup-bus.c
> @@ -1304,6 +1304,47 @@ out:
>   return good_align;
>  }
>  
> +static resource_size_t calculate_mem_alt_size(struct list_head *head,
> + resource_size_t max_align, resource_size_t size,
> + resource_size_t align_low)
> +{
> + struct align_test_res *p;
> + resource_size_t tmp;
> + resource_size_t good_size, bad_size;
> + int count = 0, order;
> +
> + good_size = ALIGN(size, align_low);
> +
> + list_for_each_entry(p, head, list)
> + count++;
> +
> + if (count <= 1)
> + goto out;
> +
> + __sort_align_test(head);
> +
> + tmp = max(size, max_align);
> + order = __fls(count);
> + if ((1ULL << order) < count)
> + order++;
> + good_size = ALIGN((tmp << order), align_low);
> + bad_size = ALIGN(size, align_low) - align_low;
> + size = good_size;
> + while (size > bad_size) {
> + /* check if align/size fit all entries */
> + if (is_align_size_good(head, max_align, size, 0))
> + good_size = size;
> + else
> + bad_size = size;
> +
> + size = bad_size + ((good_size - bad_size) >> 1);
> + size = round_down(size, align_low);
> + }
> +
> +out:
> + return good_size;
> +}
> +
>  static inline bool is_optional(int i)
>  {
>  
> @@ -1350,6 +1391,7 @@ static int pbus_size_mem(struct pci_bus *bus, unsigned 
> long mask,
>   mask | IORESOURCE_PREFETCH, type);
>   LIST_HEAD(align_test_list);
>   LIST_HEAD(align_test_add_list);
> + LIST_HEAD(align_test_alt_list);
>   resource_size_t alt_size = 0, alt_align = 0;
>   resource_size_t window_align;
>  
> @@ -1418,6 +1460,10 @@ static int pbus_size_mem(struct pci_bus *bus, unsigned 
> long mask,
>  
>   dev_res = res_to_dev_res(realloc_head, r);
>   if (dev_res && dev_res->alt_size) {
> + add_to_align_test_list(
> + _test_alt_list,
> + dev_res->alt_align,
> + dev_res->alt_size);
>   alt_size += dev_res->alt_size;
>   if (alt_align < dev_res->alt_align)
>   alt_align = dev_res->alt_align;
> @@ -1440,6 +1486,12 @@ static int pbus_size_mem(struct pci_bus *bus, unsigned 
> long mask,
>   alt_align = max_align;
>   alt_size = calculate_memsize(size, min_size,
>0, window_align);
> + } else  {
> + /* need to increase size to fit more alt */
> + alt_align = max(alt_align, window_align);
> + alt_size = calculate_mem_alt_size(_test_alt_list,
> +   alt_align, alt_size,
> +   window_align);
>   }
>   /* must is better ? */
>   if (alt_size >= size0) {
> @@ -1447,6 +1499,7 @@ static int pbus_size_mem(struct pci_bus *bus, unsigned 
> long mask,
>   alt_size = size0;
>   }
>   }
> + free_align_test_list(_test_alt_list);
>  
>   if (sum_add_size == size)
>   sum_add_size = add_size;
> 


-- 
Thanks!
Yijing

--
To unsubscribe from this list: send the line 

Re: [PATCH][RESEND] rts5208:Fix checkpatch warnings

2015-07-14 Thread Greg KH
On Wed, Jul 01, 2015 at 12:27:38PM +0530, Ravi Teja Darbha wrote:
> else is not generally useful after a break or return, hence removed.
> 
> Signed-off-by: Ravi Teja Darbha 
> ---
>  drivers/staging/rts5208/xd.c | 10 --
>  1 file changed, 4 insertions(+), 6 deletions(-)

Why resend?  What is different from the previous version?  What was
wrong with it?

Please be specific when sending patches.

thanks,

greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 04/13] pinctrl: tegra: Only set the gpio range if needed

2015-07-14 Thread Alexandre Courbot
On Tue, Jul 14, 2015 at 5:34 PM, Tomeu Vizoso
 wrote:
> On 13 July 2015 at 22:14, Linus Walleij  wrote:
>> On Wed, Jun 17, 2015 at 3:42 PM, Tomeu Vizoso
>>  wrote:
>>
>>> If the gpio DT node has the gpio-ranges property, the range will be
>>> added by the gpio core and doesn't need to be added by the pinctrl
>>> driver.
>>>
>>> By having the gpio-ranges property, we have an explicit dependency from
>>> the gpio node to the pinctrl node and we can stop using the deprecated
>>> pinctrl_add_gpio_range() function.
>>>
>>> Note that when the GPIO device gets probed before the associated
>>> princtrl device, the gpio core actually won't register the gpio range.
>>> Thus, this patch is only safe to be merged after we have in place a way
>>> to assure that gpio devices are probed after their associated pinctrl
>>> devices (such as ordered probing).
>>>
>>> Signed-off-by: Tomeu Vizoso 
>>
>> This doesn't look like it would hurt, but need Stephen's opinion
>> on it, and I think he's on vacation. Would check with next-in-line
>> Tegra maintainer, Thierry/Alexandre?
>
> Sorry about that, but I have split these changes out into their own
> series after people complained about it.
>
> Have just sent a new version which already has Stephen's ack:
>
> https://lkml.kernel.org/g/1436862596-27730-1-git-send-email-tomeu.viz...@collabora.com

The change looks ok, but why limit it to Tegra? It seems like it could
apply to any driver that supports gpio-range. Or is it because this
will only work with drivers that use ordered probing?
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: Subject: [v3.19 Regression] x86, irq, acpi: Get rid of special handling of GSI for ACPI SCI

2015-07-14 Thread Jiang Liu
On 2015/7/15 1:22, Joseph Salisbury wrote:
> On 07/13/2015 10:42 PM, Jiang Liu wrote:
>> On 2015/7/14 3:36, Joseph Salisbury wrote:
>>> Hello Jiang,
>>>
>>> A kernel bug report was opened against Ubuntu [0]. It was found that
>>> reverting the following commit resolves this bug:
>>>
>>> commit cd68f6bd53cf89d1d5ed889b8af65e9c3574a079
>>> Author: Jiang Liu 
>>> Date:   Mon Oct 27 16:11:52 2014 +0800
>>>
>>> x86, irq, acpi: Get rid of special handling of GSI for ACPI SCI
>>>
>>> The regression was introduced as of v3.19-rc1.
>>> 
>>> I was hoping to get your feedback, since you are the patch author.  Do
>>> you think gathering any additional data will help diagnose this issue,
>>> or would it be best to submit a revert request?
>> Hi Joseph,
>>  Sorry for the trouble. It would be great if we could get
>> more information about the bug, such as bug report info, dmesg and
>> acpidump from the reporting system.
>> Thanks!
>> Gerry
> Comments 3 and 4 have the requested information in the bugzilla bug:
> https://bugzilla.kernel.org/show_bug.cgi?id=101301
> 
> Thanks again for the help!
Hi Joseph,
According to my investigation, it's an ACPI BIOS issue instead
of a kernel bug. But it's actually a regression. Now we enforce stricter
check for ACPI SCI interrupt, which exposes an implementation flaw in
the virtual BIOS.

I have posted the analysis at
https://bugzilla.kernel.org/show_bug.cgi?id=101301
But I have no account at launchpad, so could you please help to copy
the message to launchpad?
https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1440072

Thanks!
Gerry
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: Re: [PATCH 3/3] kexec: Change the timing of callbacks related to "crash_kexec_post_notifiers" boot option

2015-07-14 Thread Masami Hiramatsu
On 2015/07/14 23:42, Vivek Goyal wrote:
> On Fri, Jul 10, 2015 at 08:33:31PM +0900, Hidehiro Kawai wrote:
>> This patch fixes problems reported by Daniel Walker
>> (https://lkml.org/lkml/2015/6/24/44), and also replaces the bug fix
>> commits 5375b70 and f45d85f.
>>
>> If "crash_kexec_post_notifiers" boot option is specified,
>> other cpus are stopped by smp_send_stop() before entering
>> crash_kexec(), while usually machine_crash_shutdown() called by
>> crash_kexec() does that.  This behavior change leads two problems.
>>
>>  Problem 1:
>>  Some function in the crash_kexec() path depend on other cpus being
>>  still online.  If other cpus have been offlined already, they
>>  doesn't work properly.
>>
>>   Example:
>>panic()
>> crash_kexec()
>>  machine_crash_shutdown()
>>   octeon_generic_shutdown() // shutdown watchdog for ONLINE cpus
>>  machine_kexec()
>>
>>  Problem 2:
>>  Most of architectures stop other cpus in the machine_crash_shutdown()
>>  path and save register information at the same time.  However, if
>>  smp_send_stop() is called before that, we can't save the register
>>  information.
>>
>> To solve these problems, this patch changes the timing of calling
>> the callbacks instead of changing the timing of crash_kexec() if
>> crash_kexec_post_notifiers boot option is specified.
>>
>>  Before:
>>   if (!crash_kexec_post_notifiers)
>>   crash_kexec()
>>
>>   smp_send_stop()
>>   atomic_notifier_call_chain()
>>   kmsg_dump()
>>
>>   if (crash_kexec_post_notifiers)
>>   crash_kexec()
>>
>>  After:
>>   crash_kexec()
>>   machine_crash_shutdown()
>>   if (crash_kexec_post_notifiers) {
>>   atomic_notifier_call_chain()
>>   kmsg_dump()
>>   }
>>   machine_kexec()
>>
>>   smp_send_stop()
>>   if (!crash_kexec_post_notifiers) {
>>   atomic_notifier_call_chain()
>>   kmsg_dump()
>>   }
>>
> 
> I think this new code flow looks bad. Now we are calling kmsg_dump()
> and atomic_notifier_call_chain() from inside the crash_kexec() as well
> as from inside panic(). This is bad.
> 
> So basic problem seems to be that cpus need to be stopped once (with
> or without panic notifiers. So why don't we look into desiginig a 
> function which stops cpus, saves register states first and then does
> rest of the processing.
> 
> Something like.
> 
> stop_cpus_save_register_state;
> 
> if (!crash_kexec_post_notifiers)
>   crash_kexec()
> 
> atomic_notifier_call_chain()
> kmsg_dump()
> 
> Here crash_kexec() will have to be modified and it will assume that cpus
> have already been stopped and register states have already been saved.

Ah, nice! I like this idea :)

> 
> IOW, is there a reason that we can't get rid of smp_send_stop() and
> use the mechanism crash_kexec() is using to stop cpus after panic()?

I think there is no reason why we don't do so. smp_send_stop() just
stops other cpus, but crash's one does more (collect registers and
stop watchdogs if needed, etc.). why don't we just replace(improve) it?

Thank you!


-- 
Masami HIRAMATSU
Linux Technology Research Center, System Productivity Research Dept.
Center for Technology Innovation - Systems Engineering
Hitachi, Ltd., Research & Development Group
E-mail: masami.hiramatsu...@hitachi.com
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [RFC PATCH v2] memory-barriers: remove smp_mb__after_unlock_lock()

2015-07-14 Thread Michael Ellerman
On Tue, 2015-07-14 at 08:31 +1000, Benjamin Herrenschmidt wrote:
> On Mon, 2015-07-13 at 13:15 +0100, Will Deacon wrote:
> > smp_mb__after_unlock_lock is used to promote an UNLOCK + LOCK sequence
> > into a full memory barrier.
> > 
> > However:
> > 
> >   - This ordering guarantee is already provided without the barrier on
> > all architectures apart from PowerPC
> > 
> >   - The barrier only applies to UNLOCK + LOCK, not general
> > RELEASE + ACQUIRE operations
> > 
> >   - Locks are generally assumed to offer SC ordering semantics, so
> > having this additional barrier is error-prone and complicates the
> > callers of LOCK/UNLOCK primitives
> > 
> >   - The barrier is not well used outside of RCU and, because it was
> > retrofitted into the kernel, it's not clear whether other areas of
> > the kernel are incorrectly relying on UNLOCK + LOCK implying a full
> > barrier
> > 
> > This patch removes the barrier and instead requires architectures to
> > provide full barrier semantics for an UNLOCK + LOCK sequence.
> > 
> > Cc: Benjamin Herrenschmidt 
> > Cc: Paul McKenney 
> > Cc: Peter Zijlstra 
> > Signed-off-by: Will Deacon 
> > ---
> > 
> > This didn't go anywhere last time I posted it, but here it is again.
> > I'd really appreciate some feedback from the PowerPC guys, especially as
> > to whether this change requires them to add an additional barrier in
> > arch_spin_unlock and what the cost of that would be.
> 
> We'd have to turn the lwsync in unlock or the isync in lock into a full
> barrier. As it is, we *almost* have a full barrier semantic, but not
> quite, as in things can get mixed up inside spin_lock between the LL and
> the SC (things leaking in past LL and things leaking "out" up before SC
> and then getting mixed up in there).
> 
> Michael, at some point you were experimenting a bit with that and tried
> to get some perf numbers of the impact that would have, did that
> solidify ? Otherwise, I'll have a look when I'm back next week.

I was mainly experimenting with replacing the lwsync in lock with an isync.

But I think you're talking about making it a full sync in lock.

That was about +7% on p8, +25% on p7 and +88% on p6.

We got stuck deciding whether isync was safe to use as a memory barrier,
because the wording in the arch is a bit vague.

But if we're talking about a full sync then I think there is no question that's
OK and we should just do it.

cheers


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 3/5] staging: sm7xxfb: use kernel commandline

2015-07-14 Thread Greg Kroah-Hartman
On Tue, Jul 07, 2015 at 01:44:35PM +0530, Sudip Mukherjee wrote:
> We were only using the kernel commandline to set the mode if this driver
> is builtin, but when it is built as a module we were not having any way
> to set the mode. Start using commandline even if it is built as a
> module.
> 
> Signed-off-by: Sudip Mukherjee 

I applied the first 3 patches here, but not 4 and 5.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 4/5] staging: sm7xxfb: define new macros

2015-07-14 Thread Greg Kroah-Hartman
On Tue, Jul 07, 2015 at 01:44:36PM +0530, Sudip Mukherjee wrote:
> Define and use some new macros to work with different situations
> based on little-endian and big-endian.
> 
> Signed-off-by: Sudip Mukherjee 
> ---
>  drivers/staging/sm7xxfb/sm7xx.h   | 19 
>  drivers/staging/sm7xxfb/sm7xxfb.c | 48 
> ---
>  2 files changed, 29 insertions(+), 38 deletions(-)
> 
> diff --git a/drivers/staging/sm7xxfb/sm7xx.h b/drivers/staging/sm7xxfb/sm7xx.h
> index 31a21bd..6905177 100644
> --- a/drivers/staging/sm7xxfb/sm7xx.h
> +++ b/drivers/staging/sm7xxfb/sm7xx.h
> @@ -95,3 +95,22 @@ struct modeinit {
>   unsigned char init_cr30_cr4d[SIZE_CR30_CR4D];
>   unsigned char init_cr90_cra7[SIZE_CR90_CRA7];
>  };
> +
> +#ifdef __BIG_ENDIAN
> +#define pal_rgb(r, g, b, val)(((r & 0xf800) >> 8) | \
> + ((g & 0xe000) >> 13) | \
> + ((g & 0x1c00) << 3) | \
> + ((b & 0xf800) >> 3))
> +#define big_addr 0x80
> +#define mmio_addr0x0080
> +#define seqw17   smtc_seqw(0x17, 0x30)
> +#define big_pixel_depth(p, d){if (p == 24) {p = 32; d = 32; } }
> +#define big_swap(p)  ((p & 0xff00ff00 >> 8) | (p & 0x00ff00ff << 8))
> +#else
> +#define pal_rgb(r, g, b, val)val
> +#define big_addr 0
> +#define mmio_addr0x00c0
> +#define seqw17

Odd, empty macros are not good, because:

> -#ifdef __BIG_ENDIAN
>   if (sfb->fb->var.bits_per_pixel == 32)
> - smtc_seqw(0x17, 0x30);
> -#endif
> + seqw17;

That just looks wrong :(

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v3 1/8] powerpc/perf/hv-24x7: Whitespace - fix parameter alignment

2015-07-14 Thread Sukadev Bhattiprolu
Fix parameter alignment to be consistent with coding style.

Signed-off-by: Sukadev Bhattiprolu 
---
 arch/powerpc/perf/hv-24x7.c |   20 ++--
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/arch/powerpc/perf/hv-24x7.c b/arch/powerpc/perf/hv-24x7.c
index df95629..9d73c69 100644
--- a/arch/powerpc/perf/hv-24x7.c
+++ b/arch/powerpc/perf/hv-24x7.c
@@ -416,7 +416,7 @@ out_val:
 }
 
 static struct attribute *event_to_desc_attr(struct hv_24x7_event_data *event,
-   int nonce)
+   int nonce)
 {
int nl, dl;
char *name = event_name(event, );
@@ -444,7 +444,7 @@ event_to_long_desc_attr(struct hv_24x7_event_data *event, 
int nonce)
 }
 
 static ssize_t event_data_to_attrs(unsigned ix, struct attribute **attrs,
-   struct hv_24x7_event_data *event, int nonce)
+  struct hv_24x7_event_data *event, int nonce)
 {
unsigned i;
 
@@ -512,7 +512,7 @@ static int memord(const void *d1, size_t s1, const void 
*d2, size_t s2)
 }
 
 static int ev_uniq_ord(const void *v1, size_t s1, unsigned d1, const void *v2,
-   size_t s2, unsigned d2)
+  size_t s2, unsigned d2)
 {
int r = memord(v1, s1, v2, s2);
 
@@ -526,7 +526,7 @@ static int ev_uniq_ord(const void *v1, size_t s1, unsigned 
d1, const void *v2,
 }
 
 static int event_uniq_add(struct rb_root *root, const char *name, int nl,
-   unsigned domain)
+ unsigned domain)
 {
struct rb_node **new = &(root->rb_node), *parent = NULL;
struct event_uniq *data;
@@ -650,8 +650,8 @@ static ssize_t catalog_event_len_validate(struct 
hv_24x7_event_data *event,
 #define MAX_4K (SIZE_MAX / 4096)
 
 static int create_events_from_catalog(struct attribute ***events_,
-   struct attribute ***event_descs_,
-   struct attribute ***event_long_descs_)
+ struct attribute ***event_descs_,
+ struct attribute ***event_long_descs_)
 {
unsigned long hret;
size_t catalog_len, catalog_page_len, event_entry_count,
@@ -1008,8 +1008,8 @@ static const struct attribute_group *attr_groups[] = {
 };
 
 static void log_24x7_hcall(struct hv_24x7_request_buffer *request_buffer,
-   struct hv_24x7_data_result_buffer *result_buffer,
-   unsigned long ret)
+  struct hv_24x7_data_result_buffer *result_buffer,
+  unsigned long ret)
 {
struct hv_24x7_request *req;
 
@@ -1026,7 +1026,7 @@ static void log_24x7_hcall(struct hv_24x7_request_buffer 
*request_buffer,
  * Start the process for a new H_GET_24x7_DATA hcall.
  */
 static void init_24x7_request(struct hv_24x7_request_buffer *request_buffer,
-   struct hv_24x7_data_result_buffer *result_buffer)
+ struct hv_24x7_data_result_buffer *result_buffer)
 {
 
memset(request_buffer, 0, 4096);
@@ -1041,7 +1041,7 @@ static void init_24x7_request(struct 
hv_24x7_request_buffer *request_buffer,
  * by 'init_24x7_request()' and 'add_event_to_24x7_request()'.
  */
 static int make_24x7_request(struct hv_24x7_request_buffer *request_buffer,
-   struct hv_24x7_data_result_buffer *result_buffer)
+struct hv_24x7_data_result_buffer *result_buffer)
 {
unsigned long ret;
 
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v3 5/8] perf: Split perf_event_read_value()

2015-07-14 Thread Sukadev Bhattiprolu
Move the part of perf_event_read_value() that computes the event
counts and event times into a new function, perf_event_compute().

This would allow us to call perf_event_compute() independently.

Signed-off-by: Sukadev Bhattiprolu 

Changelog[v3]
Rather than move perf_event_read() into callers and then
rename, just move the computations into a separate function
(redesign to address comment from Peter Zijlstra).
---
 kernel/events/core.c |   37 -
 1 file changed, 24 insertions(+), 13 deletions(-)

diff --git a/kernel/events/core.c b/kernel/events/core.c
index 44fb89d..b1e9a42 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -3704,6 +3704,29 @@ static int perf_release(struct inode *inode, struct file 
*file)
return 0;
 }
 
+static u64 perf_event_compute(struct perf_event *event, u64 *enabled,
+ u64 *running)
+{
+   struct perf_event *child;
+   u64 total;
+
+   total = perf_event_count(event);
+
+   *enabled += event->total_time_enabled +
+   atomic64_read(>child_total_time_enabled);
+   *running += event->total_time_running +
+   atomic64_read(>child_total_time_running);
+
+   list_for_each_entry(child, >child_list, child_list) {
+   perf_event_read(child);
+   total += perf_event_count(child);
+   *enabled += child->total_time_enabled;
+   *running += child->total_time_running;
+   }
+
+   return total;
+}
+
 /*
  * Remove all orphanes events from the context.
  */
@@ -3742,7 +3765,6 @@ static void orphans_remove_work(struct work_struct *work)
 
 u64 perf_event_read_value(struct perf_event *event, u64 *enabled, u64 *running)
 {
-   struct perf_event *child;
u64 total = 0;
 
*enabled = 0;
@@ -3751,19 +3773,8 @@ u64 perf_event_read_value(struct perf_event *event, u64 
*enabled, u64 *running)
mutex_lock(>child_mutex);
 
perf_event_read(event);
-   total += perf_event_count(event);
+   total = perf_event_compute(event, enabled, running);
 
-   *enabled += event->total_time_enabled +
-   atomic64_read(>child_total_time_enabled);
-   *running += event->total_time_running +
-   atomic64_read(>child_total_time_running);
-
-   list_for_each_entry(child, >child_list, child_list) {
-   perf_event_read(child);
-   total += perf_event_count(child);
-   *enabled += child->total_time_enabled;
-   *running += child->total_time_running;
-   }
mutex_unlock(>child_mutex);
 
return total;
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v3 6/8] perf: Rename perf_event_read_{one,group}, perf_read_hw

2015-07-14 Thread Sukadev Bhattiprolu
From: "Peter Zijlstra (Intel)" 

In order to free up the perf_event_read_group() name:

 s/perf_event_read_\(one\|group\)/perf_read_\1/g
 s/perf_read_hw/__perf_read/g

Signed-off-by: Peter Zijlstra (Intel) 
---
 kernel/events/core.c |   14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/kernel/events/core.c b/kernel/events/core.c
index b1e9a42..a83d45c 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -3675,7 +3675,7 @@ static void put_event(struct perf_event *event)
 * see the comment there.
 *
 *  2) there is a lock-inversion with mmap_sem through
-* perf_event_read_group(), which takes faults while
+* perf_read_group(), which takes faults while
 * holding ctx->mutex, however this is called after
 * the last filedesc died, so there is no possibility
 * to trigger the AB-BA case.
@@ -3781,7 +3781,7 @@ u64 perf_event_read_value(struct perf_event *event, u64 
*enabled, u64 *running)
 }
 EXPORT_SYMBOL_GPL(perf_event_read_value);
 
-static int perf_event_read_group(struct perf_event *event,
+static int perf_read_group(struct perf_event *event,
   u64 read_format, char __user *buf)
 {
struct perf_event *leader = event->group_leader, *sub;
@@ -3829,7 +3829,7 @@ static int perf_event_read_group(struct perf_event *event,
return ret;
 }
 
-static int perf_event_read_one(struct perf_event *event,
+static int perf_read_one(struct perf_event *event,
 u64 read_format, char __user *buf)
 {
u64 enabled, running;
@@ -3867,7 +3867,7 @@ static bool is_event_hup(struct perf_event *event)
  * Read the performance event - simple non blocking version for now
  */
 static ssize_t
-perf_read_hw(struct perf_event *event, char __user *buf, size_t count)
+__perf_read(struct perf_event *event, char __user *buf, size_t count)
 {
u64 read_format = event->attr.read_format;
int ret;
@@ -3885,9 +3885,9 @@ perf_read_hw(struct perf_event *event, char __user *buf, 
size_t count)
 
WARN_ON_ONCE(event->ctx->parent_ctx);
if (read_format & PERF_FORMAT_GROUP)
-   ret = perf_event_read_group(event, read_format, buf);
+   ret = perf_read_group(event, read_format, buf);
else
-   ret = perf_event_read_one(event, read_format, buf);
+   ret = perf_read_one(event, read_format, buf);
 
return ret;
 }
@@ -3900,7 +3900,7 @@ perf_read(struct file *file, char __user *buf, size_t 
count, loff_t *ppos)
int ret;
 
ctx = perf_event_ctx_lock(event);
-   ret = perf_read_hw(event, buf, count);
+   ret = __perf_read(event, buf, count);
perf_event_ctx_unlock(event, ctx);
 
return ret;
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v3 8/8] powerpc/perf/hv-24x7: Use PMU_TXN_READ interface

2015-07-14 Thread Sukadev Bhattiprolu
The 24x7 counters in Powerpc allow monitoring a large number of counters
simultaneously. They also allow reading several counters in a single
HCALL so we can get a more consistent snapshot of the system.

Use the PMU's transaction interface to monitor and read several event
counters at once. The idea is that users can group several 24x7 events
into a single group of events. We use the following logic to submit
the group of events to the PMU and read the values:

pmu->start_txn()// Initialize before first event

for each event in group
pmu->read(event);   // Queue each event to be read

pmu->commit_txn()   // Read/update all queuedcounters

The ->commit_txn() also updates the event counts in the respective
perf_event objects.  The perf subsystem can then directly get the
event counts from the perf_event and can avoid submitting a new
->read() request to the PMU.

Thanks to input from Peter Zijlstra.

Signed-off-by: Sukadev Bhattiprolu 

Changelog[v3]
[Peter Zijlstra] Save the transaction state in ->start_txn() and
drop the flags parameter from ->commit_txn() and ->cancel_txn().
[Peter Zijlstra] The nop txn interfaces don't need to disable/enable
PMU for PERF_PMU_TXN_READ transactions.
---
 arch/powerpc/perf/hv-24x7.c |  160 ++-
 1 file changed, 157 insertions(+), 3 deletions(-)

diff --git a/arch/powerpc/perf/hv-24x7.c b/arch/powerpc/perf/hv-24x7.c
index 4d1a8d1..c28ef3f 100644
--- a/arch/powerpc/perf/hv-24x7.c
+++ b/arch/powerpc/perf/hv-24x7.c
@@ -142,8 +142,24 @@ static struct attribute_group event_long_desc_group = {
 
 static struct kmem_cache *hv_page_cache;
 
+struct h_24x7_hw {
+   int txn_err;
+   int txn_flags;
+   struct perf_event *events[255];
+} h24x7hw;
+
 /*
- * request_buffer and result_buffer are not required to be 4k aligned,
+ * The request and result buffers are also used in interrupt context
+ * (eg: we read/update the event counts in h_24x7_event_stop()). Rather
+ * than allocating buffers in interrupt context (i.e before each HCALL),
+ * pre-allocate per-CPU request and result buffers.
+ *
+ * However, for the transaction interface, the ->start_txn(), where the
+ * buffers are initialized and the ->read() operations (where the buffers
+ * are used) are not guaranteed to be on the same CPU. Hence, we cannot
+ * use the per-CPU buffers. Use PMU-wide request and result buffers instead.
+ *
+ * Note that request and result buffers are not required to be 4k aligned,
  * but are not allowed to cross any 4k boundary. Aligning them to 4k is
  * the simplest way to ensure that.
  */
@@ -151,6 +167,9 @@ static struct kmem_cache *hv_page_cache;
 DEFINE_PER_CPU(char, hv_24x7_reqb[H24x7_DATA_BUFFER_SIZE]) __aligned(4096);
 DEFINE_PER_CPU(char, hv_24x7_resb[H24x7_DATA_BUFFER_SIZE]) __aligned(4096);
 
+char hv_24x7_txn_reqb[H24x7_DATA_BUFFER_SIZE] __aligned(4096);
+char hv_24x7_txn_resb[H24x7_DATA_BUFFER_SIZE] __aligned(4096);
+
 static char *event_name(struct hv_24x7_event_data *ev, int *len)
 {
*len = be16_to_cpu(ev->event_name_len) - 2;
@@ -1233,9 +1252,42 @@ static void update_event_count(struct perf_event *event, 
u64 now)
 static void h_24x7_event_read(struct perf_event *event)
 {
u64 now;
+   struct hv_24x7_request_buffer *request_buffer;
+
+   /*
+* If in a READ transaction, add this counter to the list of
+* counters to read during the next HCALL (i.e commit_txn()).
+* If not in a READ transaction, go ahead and make the HCALL
+* to read this counter by itself.
+*/
+
+   if (h24x7hw.txn_flags & PERF_PMU_TXN_READ) {
+   int i;
+   int ret;
+
+   if (h24x7hw.txn_err)
+   return;
+
+   request_buffer = (void *)_24x7_txn_reqb[0];
+
+   ret = add_event_to_24x7_request(event, request_buffer);
+   if (ret) {
+   h24x7hw.txn_err = ret;
+   } else {
+   /*
+* Assoicate the event with the HCALL request index,
+* so ->commit_txn() can quickly find/update count.
+*/
+   i = request_buffer->num_requests - 1;
+   h24x7hw.events[i] = event;
+   }
+
+   put_cpu_var(hv_24x7_reqb);
+   } else {
+   now = h_24x7_get_value(event);
+   update_event_count(event, now);
+   }
 
-   now = h_24x7_get_value(event);
-   update_event_count(event, now);
 }
 
 static void h_24x7_event_start(struct perf_event *event, int flags)
@@ -1257,6 +1309,105 @@ static int h_24x7_event_add(struct perf_event *event, 
int flags)
return 0;
 }
 
+/*
+ * 24x7 counters only support READ transactions. They are
+ * always counting and dont need/support ADD transactions.
+ * Cache the flags, but 

[PATCH v3 0/8] Implement group-read of events using txn interface

2015-07-14 Thread Sukadev Bhattiprolu
Unlike normal hardware PMCs, the 24x7 counters in Power8 are stored in
memory and accessed via a hypervisor call(HCALL).  A major aspect of the
HCALL is that it allows retireving _several_ counters at once (unlike
regular PMCs, which are read one at a time). By reading several counters
at once, we can get a more consistent snapshot of the system.

This patchset extends the transaction interface to accomplish submitting
several events to the PMU and have the PMU read them all at once. User is
expected to submit the set of events they want to read as an "event group".

In the kernel, we submit each event to the PMU using the following logic
(from Peter Zijlstra).

pmu->start_txn(pmu, PMU_TXN_READ);

leader->read();
for_each_sibling()
sibling->read();
pmu->commit_txn();

where:
- the ->read()s queue events to be submitted to the hypervisor, and,
- the ->commit_txn() issues the HCALL, retrieves the result and
  updates the event count.

Architectures/PMUs that don't need/implement PMU_TXN_READ type of transactions,
simply ignore the ->start_txn() and ->commit_txn() and continue to read the
counters one at a time in the ->read() call.

Compile/touch tested on x86. Need help testing on s390 and Sparc.

Thanks to Peter Zijlstra for his input.

Changelog [v3]
- Simple changes/reorg of patchset to split/rename functions
- [Peter Zijlstra] Save the transaction flags in ->start_txn() and
  drop the flags parameter from ->commit_txn() and ->cancel_txn().
- [Peter Zijlstra] The nop txn interfaces don't need to disable/enable
  PMU for PERF_PMU_TXN_READ transactions.

Changelog [v2]
- Use the transaction interface unconditionally to avoid special-case
  code. Architectures/PMUs that don't need the READ transaction types
  simply ignore the ->start_txn() and ->commit_txn() calls.

Peter Zijlstra (Intel) (1):
  perf: Rename perf_event_read_{one,group}, perf_read_hw

Sukadev Bhattiprolu (7):
  powerpc/perf/hv-24x7: Whitespace - fix parameter alignment
  powerpc/perf/hv-24x7: Simplify extracting counter from result buffer
  perf: Add a flags parameter to pmu txn interfaces
  perf: Split perf_event_read() and perf_event_count()
  perf: Split perf_event_read_value()
  perf: Define PMU_TXN_READ interface
  powerpc/perf/hv-24x7: Use PMU_TXN_READ interface

 arch/powerpc/perf/core-book3s.c  |   25 -
 arch/powerpc/perf/hv-24x7.c  |  186 ++
 arch/s390/kernel/perf_cpum_cf.c  |   24 -
 arch/sparc/kernel/perf_event.c   |   19 +++-
 arch/x86/kernel/cpu/perf_event.c |   27 +-
 arch/x86/kernel/cpu/perf_event.h |1 +
 include/linux/perf_event.h   |   15 ++-
 kernel/events/core.c |  143 +++--
 8 files changed, 389 insertions(+), 51 deletions(-)

-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v3 2/8] powerpc/perf/hv-24x7: Simplify extracting counter from result buffer

2015-07-14 Thread Sukadev Bhattiprolu
Simplify code that extracts a 24x7 counter from the HCALL's result buffer.

Suggested-by: Joe Perches 
Signed-off-by: Sukadev Bhattiprolu 
---
 arch/powerpc/perf/hv-24x7.c |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/powerpc/perf/hv-24x7.c b/arch/powerpc/perf/hv-24x7.c
index 9d73c69..4d1a8d1 100644
--- a/arch/powerpc/perf/hv-24x7.c
+++ b/arch/powerpc/perf/hv-24x7.c
@@ -1104,7 +1104,7 @@ static unsigned long single_24x7_request(struct 
perf_event *event, u64 *count)
unsigned long ret;
struct hv_24x7_request_buffer *request_buffer;
struct hv_24x7_data_result_buffer *result_buffer;
-   struct hv_24x7_result *resb;
+   __be64 val;
 
BUILD_BUG_ON(sizeof(*request_buffer) > 4096);
BUILD_BUG_ON(sizeof(*result_buffer) > 4096);
@@ -1125,8 +1125,8 @@ static unsigned long single_24x7_request(struct 
perf_event *event, u64 *count)
}
 
/* process result from hcall */
-   resb = _buffer->results[0];
-   *count = be64_to_cpu(resb->elements[0].element_data[0]);
+   val = result_buffer->results[0].elements[0].element_data[0];
+   *count = be64_to_cpu(val);
 
 out:
put_cpu_var(hv_24x7_reqb);
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v3 3/8] perf: Add a flags parameter to pmu txn interfaces

2015-07-14 Thread Sukadev Bhattiprolu
Currently, the PMU interface allows reading only one counter at a time.
But some PMUs like the 24x7 counters in Power, support reading several
counters at once. To leveage this functionality, extend the transaction
interface to support a "transaction type".

The first type, PERF_PMU_TXN_ADD, refers to the existing transactions,
i.e. used to _schedule_ all the events on the PMU as a group. A second
transaction type, PERF_PMU_TXN_READ, will be used in a follow-on patch,
by the 24x7 counters to read several counters at once.

Extend the transaction interfaces to the PMU to accept a 'txn_flags'
parameter and use this parameter to ignore any transactions that are
not of type PERF_PMU_TXN_ADD.

Thanks to Peter Zijlstra for his input.

Signed-off-by: Sukadev Bhattiprolu 

Changelog[v3]
- [Peter Zijlstra] Ensure the nop_txn interfaces disable/enable
  PMU only for TXN_ADD transactions.
- [Peter Zijlstra] Cache the flags parameter in ->start_txn() and
  drop the flags parameter from ->commit_txn() and ->cancel_txn().
---
 arch/powerpc/perf/core-book3s.c  |   25 ++-
 arch/s390/kernel/perf_cpum_cf.c  |   24 +-
 arch/sparc/kernel/perf_event.c   |   19 +-
 arch/x86/kernel/cpu/perf_event.c |   27 ++--
 arch/x86/kernel/cpu/perf_event.h |1 +
 include/linux/perf_event.h   |   14 ---
 kernel/events/core.c |   51 +++---
 7 files changed, 150 insertions(+), 11 deletions(-)

diff --git a/arch/powerpc/perf/core-book3s.c b/arch/powerpc/perf/core-book3s.c
index d90893b..b92084b 100644
--- a/arch/powerpc/perf/core-book3s.c
+++ b/arch/powerpc/perf/core-book3s.c
@@ -50,6 +50,7 @@ struct cpu_hw_events {
 
unsigned int group_flag;
int n_txn_start;
+   int txn_flags;
 
/* BHRB bits */
u64 bhrb_filter;/* BHRB HW branch 
filter */
@@ -1586,11 +1587,19 @@ static void power_pmu_stop(struct perf_event *event, 
int ef_flags)
  * Start group events scheduling transaction
  * Set the flag to make pmu::enable() not perform the
  * schedulability test, it will be performed at commit time
+ *
+ * We only support PERF_PMU_TXN_ADD transactions. Save the
+ * transaction flags but otherwise ignore non-PERF_PMU_TXN_ADD
+ * transactions.
  */
-static void power_pmu_start_txn(struct pmu *pmu)
+static void power_pmu_start_txn(struct pmu *pmu, int txn_flags)
 {
struct cpu_hw_events *cpuhw = this_cpu_ptr(_hw_events);
 
+   cpuhw->txn_flags = txn_flags;
+   if (txn_flags & ~PERF_PMU_TXN_ADD)
+   return;
+
perf_pmu_disable(pmu);
cpuhw->group_flag |= PERF_EVENT_TXN;
cpuhw->n_txn_start = cpuhw->n_events;
@@ -1604,6 +1613,12 @@ static void power_pmu_start_txn(struct pmu *pmu)
 static void power_pmu_cancel_txn(struct pmu *pmu)
 {
struct cpu_hw_events *cpuhw = this_cpu_ptr(_hw_events);
+   int txn_flags;
+
+   txn_flags = cpuhw->txn_flags;
+   cpuhw->txn_flags = 0;
+   if (cpuhw->txn_flags & ~PERF_PMU_TXN_ADD)
+   return;
 
cpuhw->group_flag &= ~PERF_EVENT_TXN;
perf_pmu_enable(pmu);
@@ -1618,10 +1633,18 @@ static int power_pmu_commit_txn(struct pmu *pmu)
 {
struct cpu_hw_events *cpuhw;
long i, n;
+   int txn_flags;
 
if (!ppmu)
return -EAGAIN;
+
cpuhw = this_cpu_ptr(_hw_events);
+
+   txn_flags = cpuhw->txn_flags;
+   cpuhw->txn_flags = 0;
+   if (cpuhw->txn_flags & ~PERF_PMU_TXN_ADD)
+   return 0;
+
n = cpuhw->n_events;
if (check_excludes(cpuhw->event, cpuhw->flags, 0, n))
return -EAGAIN;
diff --git a/arch/s390/kernel/perf_cpum_cf.c b/arch/s390/kernel/perf_cpum_cf.c
index 56fdad4..a6f9e7b 100644
--- a/arch/s390/kernel/perf_cpum_cf.c
+++ b/arch/s390/kernel/perf_cpum_cf.c
@@ -72,6 +72,7 @@ struct cpu_hw_events {
atomic_tctr_set[CPUMF_CTR_SET_MAX];
u64 state, tx_state;
unsigned intflags;
+   int txn_flags;
 };
 static DEFINE_PER_CPU(struct cpu_hw_events, cpu_hw_events) = {
.ctr_set = {
@@ -82,6 +83,7 @@ static DEFINE_PER_CPU(struct cpu_hw_events, cpu_hw_events) = {
},
.state = 0,
.flags = 0,
+   .txn_flags = 0,
 };
 
 static int get_counter_set(u64 event)
@@ -572,11 +574,19 @@ static void cpumf_pmu_del(struct perf_event *event, int 
flags)
 /*
  * Start group events scheduling transaction.
  * Set flags to perform a single test at commit time.
+ *
+ * We only support PERF_PMU_TXN_ADD transactions. Save the
+ * transaction flags but otherwise ignore non-PERF_PMU_TXN_ADD
+ * transactions.
  */
-static void cpumf_pmu_start_txn(struct pmu *pmu)
+static void cpumf_pmu_start_txn(struct pmu *pmu, int txn_flags)
 {
struct cpu_hw_events *cpuhw = this_cpu_ptr(_hw_events);
 
+   cpuhw->txn_flags = txn_flags;
+ 

[PATCH v3 7/8] perf: Define PMU_TXN_READ interface

2015-07-14 Thread Sukadev Bhattiprolu
Define a new PERF_PMU_TXN_READ interface to read a group of counters
at once. Note that we use this interface with all PMUs.

PMUs that implement this interface use the ->read() operation to _queue_
the counters to be read and use ->commit_txn() to actually read all the
queued counters at once.

PMUs that don't implement PERF_PMU_TXN_READ ignore ->start_txn() and
->commit_txn() and continue to read counters one at a time.

Thanks to input from Peter Zijlstra.

Signed-off-by: Sukadev Bhattiprolu 
---
 include/linux/perf_event.h |1 +
 kernel/events/core.c   |   35 +--
 2 files changed, 34 insertions(+), 2 deletions(-)

diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
index 44bf05f..da307ad 100644
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -169,6 +169,7 @@ struct perf_event;
 #define PERF_EVENT_TXN 0x1
 
 #define PERF_PMU_TXN_ADD  0x1  /* txn to add/schedule event on PMU */
+#define PERF_PMU_TXN_READ 0x2  /* txn to read event group from PMU */
 
 /**
  * pmu::capabilities flags
diff --git a/kernel/events/core.c b/kernel/events/core.c
index a83d45c..2ea06c4 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -3763,6 +3763,33 @@ static void orphans_remove_work(struct work_struct *work)
put_ctx(ctx);
 }
 
+/*
+ * Use the transaction interface to read the group of events in @leader.
+ * PMUs like the 24x7 counters in Power, can use this to queue the events
+ * in the ->read() operation and perform the actual read in ->commit_txn.
+ *
+ * Other PMUs can ignore the ->start_txn and ->commit_txn and read each
+ * PMU directly in the ->read() operation.
+ */
+static int perf_event_read_group(struct perf_event *leader)
+{
+   int ret;
+   struct perf_event *sub;
+   struct pmu *pmu;
+
+   pmu = leader->pmu;
+
+   pmu->start_txn(pmu, PERF_PMU_TXN_READ);
+
+   perf_event_read(leader);
+   list_for_each_entry(sub, >sibling_list, group_entry)
+   perf_event_read(sub);
+
+   ret = pmu->commit_txn(pmu);
+
+   return ret;
+}
+
 u64 perf_event_read_value(struct perf_event *event, u64 *enabled, u64 *running)
 {
u64 total = 0;
@@ -3792,7 +3819,11 @@ static int perf_read_group(struct perf_event *event,
 
lockdep_assert_held(>mutex);
 
-   count = perf_event_read_value(leader, , );
+   ret = perf_event_read_group(leader);
+   if (ret)
+   return ret;
+
+   count = perf_event_compute(leader, , );
 
values[n++] = 1 + leader->nr_siblings;
if (read_format & PERF_FORMAT_TOTAL_TIME_ENABLED)
@@ -3813,7 +3844,7 @@ static int perf_read_group(struct perf_event *event,
list_for_each_entry(sub, >sibling_list, group_entry) {
n = 0;
 
-   values[n++] = perf_event_read_value(sub, , );
+   values[n++] = perf_event_compute(sub, , );
if (read_format & PERF_FORMAT_ID)
values[n++] = primary_event_id(sub);
 
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v3 4/8] perf: Split perf_event_read() and perf_event_count()

2015-07-14 Thread Sukadev Bhattiprolu
perf_event_read() does two things:

- call the PMU to read/update the counter value, and
- compute the total count of the event and its children

Not all callers need both. perf_event_reset() for instance needs the
first piece but doesn't need the second.  Similarly, when we implement
the ability to read a group of events using the transaction interface,
we would need the two pieces done independently.

Break up perf_event_read() and have it just read/update the counter
and have the callers compute the total count if necessary.

Signed-off-by: Sukadev Bhattiprolu 
---
 kernel/events/core.c |   14 --
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/kernel/events/core.c b/kernel/events/core.c
index b79aad2..44fb89d 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -3212,7 +3212,7 @@ static inline u64 perf_event_count(struct perf_event 
*event)
return __perf_event_count(event);
 }
 
-static u64 perf_event_read(struct perf_event *event)
+static void perf_event_read(struct perf_event *event)
 {
/*
 * If event is enabled and currently active on a CPU, update the
@@ -3238,8 +3238,6 @@ static u64 perf_event_read(struct perf_event *event)
update_event_times(event);
raw_spin_unlock_irqrestore(>lock, flags);
}
-
-   return perf_event_count(event);
 }
 
 /*
@@ -3751,14 +3749,18 @@ u64 perf_event_read_value(struct perf_event *event, u64 
*enabled, u64 *running)
*running = 0;
 
mutex_lock(>child_mutex);
-   total += perf_event_read(event);
+
+   perf_event_read(event);
+   total += perf_event_count(event);
+
*enabled += event->total_time_enabled +
atomic64_read(>child_total_time_enabled);
*running += event->total_time_running +
atomic64_read(>child_total_time_running);
 
list_for_each_entry(child, >child_list, child_list) {
-   total += perf_event_read(child);
+   perf_event_read(child);
+   total += perf_event_count(child);
*enabled += child->total_time_enabled;
*running += child->total_time_running;
}
@@ -3918,7 +3920,7 @@ static unsigned int perf_poll(struct file *file, 
poll_table *wait)
 
 static void _perf_event_reset(struct perf_event *event)
 {
-   (void)perf_event_read(event);
+   perf_event_read(event);
local64_set(>count, 0);
perf_event_update_userpage(event);
 }
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 2/2] staging: speakup: else is not useful after a return

2015-07-14 Thread Greg Kroah-Hartman
On Thu, Jun 25, 2015 at 02:56:52PM +0200, Luis de Bethencourt wrote:
> Correct a checkpatch.pl warning regarding
> WARNING: else is not generally useful after a break or return
> drivers/staging/speakup/keyhelp.c:185:
> 
> Changing the order of the if blocks, but not the logic, to avoid this
> warning. The block after else will run if the blocks KT_CUR or KT_LATIN
> set cur_item instead of returning.

Don't do things just because checkpatch tells you, especially when it
doesn't make much sense to do so.

For example, this patch :)

> 
> Signed-off-by: Luis de Bethencourt 
> ---
>  drivers/staging/speakup/keyhelp.c | 32 
>  1 file changed, 16 insertions(+), 16 deletions(-)
> 
> diff --git a/drivers/staging/speakup/keyhelp.c 
> b/drivers/staging/speakup/keyhelp.c
> index 02d5c70..8133b6e 100644
> --- a/drivers/staging/speakup/keyhelp.c
> +++ b/drivers/staging/speakup/keyhelp.c
> @@ -151,22 +151,7 @@ int spk_handle_help(struct vc_data *vc, u_char type, 
> u_char ch, u_short key)
>  
>   if (letter_offsets[0] == -1)
>   help_init();
> - if (type == KT_LATIN) {
> - if (ch == SPACE) {
> - spk_special_handler = NULL;
> - synth_printf("%s\n", spk_msg_get(MSG_LEAVING_HELP));
> - return 1;
> - }
> - ch |= 32; /* lower case */
> - if (ch < 'a' || ch > 'z')
> - return -1;
> - if (letter_offsets[ch-'a'] == -1) {
> - synth_printf(spk_msg_get(MSG_NO_COMMAND), ch);
> - synth_printf("\n");
> - return 1;
> - }
> - cur_item = letter_offsets[ch-'a'];
> - } else if (type == KT_CUR) {
> + if (type == KT_CUR) {
>   if (ch == 0
>   && (MSG_FUNCNAMES_START + cur_item + 1) <=
>   MSG_FUNCNAMES_END)
> @@ -182,6 +167,21 @@ int spk_handle_help(struct vc_data *vc, u_char type, 
> u_char ch, u_short key)
>   synth_printf("%s\n", spk_msg_get(MSG_HELP_INFO));
>   build_key_data(); /* rebuild each time in case new mapping */
>   return 1;
> + } else if (type == KT_LATIN) {

One thing, this else isn't needed.

Or switch this to a case statement instead?  That might make it more
obvious as to what is going on, try that and see if it looks better.

thanks,

greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [Intel-gfx] [-next] WARNING at i915_gem_track_fb

2015-07-14 Thread Michel Dänzer
On 14.07.2015 22:41, Sergey Senozhatsky wrote:
> 
> sometimes `xset dpms force off' just turns off the panel for a second,
> sometimes -- until I generate a `wakeup' event (key press, etc.)

FWIW, the former case is because releasing the enter key generates an
input event, which changes the DPMS state to on again. You can avoid
that with something like "sleep 1 && xset dpms force off".


-- 
Earthling Michel Dänzer   |   http://www.amd.com
Libre software enthusiast | Mesa and X developer
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [RFC 2/3] arm64: refactor save_stack_trace()

2015-07-14 Thread Steven Rostedt
On Wed, 15 Jul 2015 09:20:42 +0900
AKASHI Takahiro  wrote:

> On 07/14/2015 10:31 PM, Steven Rostedt wrote:
> > On Tue, 14 Jul 2015 21:47:10 +0900
> > Jungseok Lee  wrote:
> >
> >> Is the below example an unexpected result?
> >> Entry 17 and 18 are ftrace_call and ftrace_ops_no_ops, respectively.
> 
> [snip]
> 
> > Note, function tracing does not disable interrupts. This looks to be
> > that an interrupt came in while __aloc_skb() was being traced.
> 
> Yeah, I think so, too. But if my insight is correct, it's not __alloc_skb()
> but one of functions that it calls. As I said in the commit log message
> of patch[1/3], the exact traced function will not be listed by
> save_stack_trace() because we don't create a stack frame at mcount().
> I think this is a flaw in the current implementation (on x86).
> 
> what do you think, Steve?
> 

mcount (well ftrace_call actually) does indeed create a stack frame for
itself *and* for what called it. At least on x86_64. See mcount_64.S.

With -pg -mfentry, it creates a stack frame. Without -mfentry, mcount
is called after the current function's frame is made so we don't need
to do much.

Here's what the -mfentry version does:

pushq %rbp
pushq 8*2(%rsp)  /* this is the parent pointer */
pushq %rbp
movq %rsp, %rbp
pushq 8*3(%rsp)   /* Return address to ftrace_call */
pushq %rbp
movq %rsp, %rbp


Thus the stack looks like this:

 <---+
|  | |
+--+ |
| return address for func  | |
| return address for func_call | |
| original %rbp| |
+--+ |
| return address for func  | |
| ptr to parent frame (%rbp)   | +
+--| <-+
| return address for func_call |   |
| ptr to next frame (%rbp) | --+
+--+ <---+
 |
 |
 Current %rbp points to func_call frame -+

 The first box isn't used as a frame, but is used by ftrace_call to save
 information to restore everything properly.

Thus, __alloc_skb() is what is currently being traced.


-- Steve
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] Staging:rtl8192u: fixed coding style issues

2015-07-14 Thread Greg KH
On Wed, Jun 24, 2015 at 09:05:04PM +0300, Aldo Iljazi wrote:
> Fixed the following coding style issues:
> r819xU_firmware.c:72: ERROR: space required after that ',' (ctx:VxO)
> r819xU_firmware.c:72: ERROR: space required before that '&' (ctx:OxV)
> r819xU_firmware.c:72: ERROR: space required after that ',' (ctx:VxV)
> r819xU_firmware.c:97: ERROR: space required after that ',' (ctx:VxV)
> r819xU_firmware.c:248: ERROR: space required after that ',' (ctx:VxO)
> r819xU_firmware.c:248: ERROR: space required before that '&' (ctx:OxV)
> r819xU_firmware.c:260: ERROR: space required after that ',' (ctx:VxV)
> r819xU_firmware.c:260: ERROR: space required after that ',' (ctx:VxV)
> r819xU_firmware.c:265: ERROR: space required after that ',' (ctx:VxV)
> r819xU_firmware.c:265: ERROR: space required after that ',' (ctx:VxV)
> r819xU_firmware.c:325: ERROR: space required after that ',' (ctx:VxV)
> 
> Signed-off-by: Aldo Iljazi 
> ---
>  drivers/staging/rtl8192u/r819xU_firmware.c | 12 ++--
>  1 file changed, 6 insertions(+), 6 deletions(-)

Someone send this patch just before you did, sorry :(
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] ACPI: Fix indent for variable declaration

2015-07-14 Thread Zhouyi Zhou
In function acpi_ns_one_complete_parse, the variable declaration
aml_length is not correctly indented.

Signed-off-by: Zhouyi Zhou 
---
 drivers/acpi/acpica/nsparse.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/acpi/acpica/nsparse.c b/drivers/acpi/acpica/nsparse.c
index 57a4cfe..802afdc 100644
--- a/drivers/acpi/acpica/nsparse.c
+++ b/drivers/acpi/acpica/nsparse.c
@@ -70,7 +70,7 @@ acpi_ns_one_complete_parse(u32 pass_number,
 {
union acpi_parse_object *parse_root;
acpi_status status;
-   u32 aml_length;
+   u32 aml_length;
u8 *aml_start;
struct acpi_walk_state *walk_state;
struct acpi_table_header *table;
--
2.4.5






--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v2] staging: rtl8192u: bool tests don't need comparisons

2015-07-14 Thread Greg Kroah-Hartman
On Tue, Jun 23, 2015 at 03:12:06PM +0200, Luis de Bethencourt wrote:
> Remove explicit true/false comparations to bool variables.
> 
> Signed-off-by: Luis de Bethencourt 
> ---
>  drivers/staging/rtl8192u/r8192U_core.c | 13 -
>  drivers/staging/rtl8192u/r8192U_dm.c   | 21 +++--
>  2 files changed, 15 insertions(+), 19 deletions(-)

You've sent multiple patches for this driver, and different versions,
yet I don't know which to apply, so I'm going to just drop them all.
Please resend the latest versions of your patches, and properly number
them as to which gets applied in which order.

thanks,

greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] drivers: staging: rtl8192u: Fix "space required before the open parenthesis '('" errors

2015-07-14 Thread Greg Kroah-Hartman
On Sat, Jun 20, 2015 at 03:56:08PM -0500, Greg Donald wrote:
> Fix checkpatch.pl "space required before the open parenthesis '('" errors
> 
> Signed-off-by: Greg Donald 
> ---
>  .../staging/rtl8192u/ieee80211/rtl819x_HTProc.c| 97 
> ++
>  1 file changed, 44 insertions(+), 53 deletions(-)
> 
> diff --git a/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c 
> b/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
> index c2588f8..df20979 100644
> --- a/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
> +++ b/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
> @@ -66,7 +66,7 @@ void HTUpdateDefaultSetting(struct ieee80211_device *ieee)
>   pHTInfo->bRegBW40MHz = 1;
>  
>   // CCK rate support in 40MHz channel
> - if(pHTInfo->bRegBW40MHz)
> + if (pHTInfo->bRegBW40MHz)
>   pHTInfo->bRegSuppCCK = 1;
>   else
>   pHTInfo->bRegSuppCCK = true;
> @@ -82,7 +82,7 @@ void HTUpdateDefaultSetting(struct ieee80211_device *ieee)
>  
>   // MIMO Power Save
>   pHTInfo->SelfMimoPs = 3;// 0: Static Mimo Ps, 1: Dynamic Mimo Ps, 3: No 
> Limitation, 2: Reserved(Set to 3 automatically.)
> - if(pHTInfo->SelfMimoPs == 2)
> + if (pHTInfo->SelfMimoPs == 2)
>   pHTInfo->SelfMimoPs = 3;
>   // 8190 only. Assign rate operation mode to firmware
>   ieee->bTxDisableRateFallBack = 0;
> @@ -127,8 +127,7 @@ void HTDebugHTCapability(u8 *CapIE, u8 *TitleString )
>   static u8   EWC11NHTCap[] = {0x00, 0x90, 0x4c, 0x33};   // For 
> 11n EWC definition, 2007.07.17, by Emily
>   PHT_CAPABILITY_ELE  pCapELE;
>  
> - if(!memcmp(CapIE, EWC11NHTCap, sizeof(EWC11NHTCap)))
> - {
> + if (!memcmp(CapIE, EWC11NHTCap, sizeof(EWC11NHTCap))) {

Like others have pointed out, this is something different than what you
are saying you are doing, please break this up into different patches.

thanks,

greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCHv2] regulator: s2mps11: Added shutdown function to poweroff

2015-07-14 Thread Anand Moon
hi Krzysztof,

On 15 July 2015 at 06:33, Krzysztof Kozlowski  wrote:
> On 15.07.2015 00:41, Anand Moon wrote:
>> Added .shutdown function to s2mps11 to help poweroff the board successfully.
>
> Which board does not poweroff? The PMIC is used on multiple boards, did
> you observed this on all of them?
>
>>
>> s2mps11-pmic: S2MPS11_REG_CTRL1 reg value 16:0001
>>
>> The device driver clears the register to turn off the PMIC.
>
> This is not sufficient explanation for commit message.
>
> I already raised concerns that this does not look to me as a proper way
> of doing poweroff. Unfortunately you did not resolved these concerns.
>
> The main questions are unanswered: Why you have to do this and why
> "standard" way does not work?
> How can you properly fix some problem if you don't know the cause of
> problem? It is blind shooting which may hurt other boards.
>
>
>>
>> Signed-off-by: Anand Moon 
>>
>> ---
>> Console log for improper shutdown.
>> root@odroidxu3:~# poweroff
>> ...
>>   * Unmounting temporary filesystems...   [ 
>> OK ]
>>   * Deactivating swap...  [ 
>> OK ]
>>   * Unmounting local filesystems...   [ 
>> OK ]
>>   * Will now halt
>>   [  209.020280] reboot: Power down
>>   [  209.122039] Power down failed, please power off system manually.
>>
>> Console log for proper shutdown.
>> root@odroidxu3:~# poweroff
>> ...
>>   * Unmounting temporary filesystems...   [ 
>> OK ]
>>   * Deactivating swap...  [ 
>> OK ]
>>   * Unmounting local filesystems...   [ 
>> OK ]
>>   * Will now halt
>>   [  476.283071] reboo
>> ---
>>  drivers/regulator/s2mps11.c | 26 ++
>>  1 file changed, 26 insertions(+)
>>
>> diff --git a/drivers/regulator/s2mps11.c b/drivers/regulator/s2mps11.c
>> index 326ffb5..823180e 100644
>> --- a/drivers/regulator/s2mps11.c
>> +++ b/drivers/regulator/s2mps11.c
>> @@ -1060,6 +1060,31 @@ out:
>>   return ret;
>>  }
>>
>> +static void s2mps11_pmic_shutdown(struct platform_device *pdev)
>> +{
>> + struct sec_pmic_dev *iodev = dev_get_drvdata(pdev->dev.parent);
>> + unsigned int reg_val, ret;
>> +
>> + ret = regmap_read(iodev->regmap_pmic, S2MPS11_REG_CTRL1, _val);
>> + if (ret < 0) {
>
> regmap_read() returns an int which you assign to an unsigned int which
> then you compare against <0? This does not look good.
>
>> + dev_crit(>dev, "could not read S2MPS11_REG_CTRL1 
>> value\n");
>> + } else {
>> + /*
>> +  * s2mps11-pmic: S2MPS11_REG_CTRL1 reg value
>> +  * is 0001
>> +  * clear the S2MPS11_REG_CTRL1 0x10 value to shutdown.
>> +  */
>> + if (reg_val & BIT(4)) {
>> + ret = regmap_update_bits(iodev->regmap_pmic,
>> +  S2MPS11_REG_CTRL1,
>> +  BIT(4), BIT(0));
>
> I don't understand. You want to update BIT(4) but the value is BIT(0)?
> This will clear BIT(4) but is totally unreadable.
>
>> + if (ret)
>> + dev_crit(>dev,
>> +  "could not write S2MPS11_REG_CTRL1 
>> value\n");
>> + }
>> + }
>
> The code is not readable, to many unnecessary indentations.
>
>> +}
>> +
>>  static const struct platform_device_id s2mps11_pmic_id[] = {
>>   { "s2mps11-pmic", S2MPS11X},
>>   { "s2mps13-pmic", S2MPS13X},
>> @@ -1074,6 +1099,7 @@ static struct platform_driver s2mps11_pmic_driver = {
>>   .name = "s2mps11-pmic",
>>   },
>>   .probe = s2mps11_pmic_probe,
>> + .shutdown = s2mps11_pmic_shutdown,
>
> The purpose of shutdown function is not to shutdown the system but to
> prepare the system for shutdown.
>
> The patch is just wrong and you did not answered the major question -
> WHY you have to do this? Don't fix the problem blindly (or because some
> hardkernel tree for some of the boards use such patch).
>
> Best regards,
> Krzysztof
>
>>   .id_table = s2mps11_pmic_id,
>>  };
>>
>>
>

I might me missing the bigger picture. So drop it.

-Anand Moon
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] ALSA: hda/realtek: Enable HP amp and mute LED on HP Folio 9480m

2015-07-14 Thread Keith Packard
Takashi Iwai  writes:

> Thanks for the patch.  But this looks suboptimal, unfortunately, since
> it keeps the amp always on, and more badly, it would block the power
> save of the widget root node.

Thanks very much for your feedback; I wasn't sure precisely how this
code worked and tried to make a change that was as close as I could
manage to existing examples.

> Can just using gpio_mute_led_mask=0x18 and gpio_led=0 (also drop
> AC_VERB_SET_GPIO_DATA in gpio_init[]) work instead?  If GPIO4 is the
> the amp, we can associate it with the master mute control together
> with the mute LED.  The only concern would be the possible click
> noise, but it doesn't happen on most machines.

It's not quite that simple; the GPIO4 value is inverted from the mute
LED value (the amp is powered up when GPIO4 is set).

What I've done is to make the amp powered only when a headphone is
plugged in, and then removed the code which was disabling power saving,
which lets everything (including the amp) get turned back off when the
device goes idle.

Here's a second version of the patch.

From 60e2c02d651b0ca6e4b72aa1cab21660400fe2eb Mon Sep 17 00:00:00 2001
From: Keith Packard 
Date: Tue, 14 Jul 2015 09:30:33 -0700
Subject: [PATCH] ALSA: hda/realtek: Enable HP amp and mute LED on HP Folio
 9480m [v2]

This laptop needs GPIO4 pulled high to enable the headphone amplifier,
and has a mute LED on GPIO3. I modelled the patch on the existing
GPIO4 code which pulls the line low for the same purpose; this time,
the HP amp line is pulled high.

v2: Disable the headphone amplifier when no headphone is connected.
Don't disable power savings to preserve the LED state.

Signed-off-by: Keith Packard 
---
 sound/pci/hda/patch_realtek.c | 112 ++
 1 file changed, 112 insertions(+)

diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 6d01045..621c195 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -99,6 +99,7 @@ struct alc_spec {
 	unsigned int gpio_led; /* used for alc269_fixup_hp_gpio_led() */
 	unsigned int gpio_mute_led_mask;
 	unsigned int gpio_mic_led_mask;
+	unsigned int gpio_hp_amp_mask;
 
 	hda_nid_t headset_mic_pin;
 	hda_nid_t headphone_mic_pin;
@@ -4435,6 +4436,111 @@ static void alc290_fixup_mono_speakers(struct hda_codec *codec,
 	}
 }
 
+/* Set headphone amp power via a GPIO depending on whether the
+ * headphones are plugged in or not
+ */
+static void alc280_set_hp_amp_power(struct hda_codec *codec)
+{
+	struct alc_spec *spec = codec->spec;
+	unsigned int oldval = spec->gpio_led;
+
+	/* Headphone amp enable when headphone present */
+	if (spec->gen.hp_jack_present)
+		spec->gpio_led |= spec->gpio_hp_amp_mask;
+	else
+		spec->gpio_led &= ~spec->gpio_hp_amp_mask;
+
+	codec_dbg(codec,
+		  "set_hp_amp_power present %d oldval %02x current %02x\n",
+		  spec->gen.hp_jack_present,
+		  oldval, spec->gpio_led);
+
+	if (spec->gpio_led != oldval)
+		snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA,
+spec->gpio_led);
+}
+
+/* Detect headphone connection, then go update the headphone amp
+ * GPIO */
+static void alc280_update_headset_mode(struct hda_codec *codec)
+{
+	alc_update_headset_mode(codec);
+	alc280_set_hp_amp_power(codec);
+}
+
+/* Hook to update headphone amp GPIO on config changes */
+static void
+alc280_update_headset_mode_hook(struct hda_codec *codec,
+struct snd_kcontrol *kcontrol,
+struct snd_ctl_elem_value *ucontrol)
+{
+	alc280_update_headset_mode(codec);
+}
+
+/* Hook to update amp GPIO for automute */
+static void alc280_update_headset_jack_cb(struct hda_codec *codec,
+	  struct hda_jack_callback *jack)
+{
+	alc_update_headset_jack_cb(codec, jack);
+	alc280_set_hp_amp_power(codec);
+}
+
+/* Manage GPIOs for HP EliteBook Folio 9480m.
+ *
+ * GPIO4 is the headphone amplifier power control
+ * GPIO3 is the audio output mute indicator LED
+ */
+
+static void alc280_fixup_hp_9480m(struct hda_codec *codec,
+  const struct hda_fixup *fix,
+  int action)
+{
+	struct alc_spec *spec = codec->spec;
+	static const struct hda_verb gpio_init[] = {
+		{ 0x01, AC_VERB_SET_GPIO_MASK, 0x18 },
+		{ 0x01, AC_VERB_SET_GPIO_DIRECTION, 0x18 },
+		{}
+	};
+
+	switch (action) {
+	case HDA_FIXUP_ACT_PRE_PROBE:
+
+		/* Set the hooks to turn the headphone amp on/off
+		 * as needed
+		 */
+		spec->gen.vmaster_mute.hook = alc_fixup_gpio_mute_hook;
+		spec->gen.cap_sync_hook = alc280_update_headset_mode_hook;
+		spec->gen.automute_hook = alc280_update_headset_mode;
+		spec->gen.hp_automute_hook = alc280_update_headset_jack_cb;
+
+		/* The GPIOs are currently off */
+		spec->gpio_led = 0;
+
+		/* GPIO4 controls the headphone amp,
+		 * high is on, low is off
+		 */
+		spec->gpio_hp_amp_mask = 0x10;
+
+		/* GPIO3 is connected to the output mute LED,
+		 * high is on, low is off
+		 */
+		spec->mute_led_polarity = 0;
+		spec->gpio_mute_led_mask = 0x08;
+
+		/* Initialize GPIO configuration */
+		

Re: [PATCH 2/7] staging: clocking-wizard: Include clk.h

2015-07-14 Thread Greg Kroah-Hartman
On Fri, Jul 10, 2015 at 04:03:24PM -0700, Stephen Boyd wrote:
> This clock provider uses the consumer API, so include clk.h
> explicitly.
> 
> Cc: Sören Brinkmann 
> Cc: Greg Kroah-Hartman 
> Signed-off-by: Stephen Boyd 
> ---
> 
> Please ack so this can go through the clk-tree.
> 
>  drivers/staging/clocking-wizard/clk-xlnx-clock-wizard.c | 1 +
>  1 file changed, 1 insertion(+)
> 
Acked-by: Greg Kroah-Hartman 

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 1/1] suspend: make sync() on suspend-to-RAM optional

2015-07-14 Thread Len Brown
From: Len Brown 

The Linux kernel suspend path has traditionally invoked sys_sync().

But sys_sync() can be expensive, and some systems do not want
to pay the cost of sys_sync() on every suspend.

So make sys_sync on suspend optional.

Create sysfs attribute /sys/power/pm_suspend_do_sync.
When set to 1, the kernel will sys_sync() on suspend,
When set to 0, it will not.

This attribute can be changed by root at run-time.
Kernel build parameter CONFIG_PM_SUSPEND_DO_SYNC_DEFAULT.
As this is 1, by default, this patch does not change
default behavior.

Signed-off-by: Len Brown 
---
 Documentation/ABI/testing/sysfs-power | 10 ++
 kernel/power/Kconfig  | 10 ++
 kernel/power/main.c   | 31 +++
 kernel/power/power.h  |  1 +
 kernel/power/suspend.c| 12 +++-
 5 files changed, 59 insertions(+), 5 deletions(-)

diff --git a/Documentation/ABI/testing/sysfs-power 
b/Documentation/ABI/testing/sysfs-power
index f455181..37df98d 100644
--- a/Documentation/ABI/testing/sysfs-power
+++ b/Documentation/ABI/testing/sysfs-power
@@ -256,3 +256,13 @@ Description:
Writing a "1" enables this printing while writing a "0"
disables it.  The default value is "0".  Reading from this file
will display the current value.
+
+What:  /sys/power/pm_suspend_do_sync
+Date:  July, 2015
+Contact:   Len Brown 
+Description:
+   The /sys/power/pm_suspend_do_sync file controls whether the 
kernel
+   will invoke sys_sync() on entry to the suspend to RAM path.
+   Yes if 1, no if 0.  The default is set by build option
+   CONFIG_PM_SUSPEND_DO_SYNC_DEFAULT.
+
diff --git a/kernel/power/Kconfig b/kernel/power/Kconfig
index 7e01f78..28976ed 100644
--- a/kernel/power/Kconfig
+++ b/kernel/power/Kconfig
@@ -103,6 +103,16 @@ config PM_SLEEP_SMP
depends on PM_SLEEP
select HOTPLUG_CPU
 
+config PM_SUSPEND_DO_SYNC_DEFAULT
+   int "Default value for /sys/power/suspend_do_sync"
+   range 0 1
+   default "1"
+   depends on SUSPEND
+   ---help---
+   Set default value for /sys/power/suspend_sync,
+   which controls whether kernel invokes sys_sync() on suspend to RAM.
+   Value 1 will do the sys_sync(), 0 will not.
+
 config PM_AUTOSLEEP
bool "Opportunistic sleep"
depends on PM_SLEEP
diff --git a/kernel/power/main.c b/kernel/power/main.c
index 86e8157..a16d369 100644
--- a/kernel/power/main.c
+++ b/kernel/power/main.c
@@ -71,6 +71,34 @@ static ssize_t pm_async_store(struct kobject *kobj, struct 
kobj_attribute *attr,
 
 power_attr(pm_async);
 
+#ifdef CONFIG_SUSPEND
+/* Execute sys_sync() in suspend to RAM path */
+int pm_suspend_do_sync  = CONFIG_PM_SUSPEND_DO_SYNC_DEFAULT;
+
+static ssize_t pm_suspend_do_sync_show(struct kobject *kobj,
+   struct kobj_attribute *attr, char *buf)
+{
+   return sprintf(buf, "%d\n", pm_suspend_do_sync);
+}
+
+static ssize_t pm_suspend_do_sync_store(struct kobject *kobj,
+   struct kobj_attribute *attr, const char *buf, size_t n)
+{
+   unsigned long val;
+
+   if (kstrtoul(buf, 10, ))
+   return -EINVAL;
+
+   if (val > 1)
+   return -EINVAL;
+
+   pm_suspend_do_sync  = val;
+   return n;
+}
+
+power_attr(pm_suspend_do_sync);
+#endif
+
 #ifdef CONFIG_PM_DEBUG
 int pm_test_level = TEST_NONE;
 
@@ -592,6 +620,9 @@ static struct attribute * g[] = {
 #ifdef CONFIG_PM_SLEEP
_async_attr.attr,
_count_attr.attr,
+#ifdef CONFIG_SUSPEND
+   _suspend_do_sync_attr.attr,
+#endif
 #ifdef CONFIG_PM_AUTOSLEEP
_attr.attr,
 #endif
diff --git a/kernel/power/power.h b/kernel/power/power.h
index ce9b832..a6120b9 100644
--- a/kernel/power/power.h
+++ b/kernel/power/power.h
@@ -201,6 +201,7 @@ static inline void suspend_test_finish(const char *label) {}
 #ifdef CONFIG_PM_SLEEP
 /* kernel/power/main.c */
 extern int pm_notifier_call_chain(unsigned long val);
+extern int pm_suspend_do_sync;
 #endif
 
 #ifdef CONFIG_HIGHMEM
diff --git a/kernel/power/suspend.c b/kernel/power/suspend.c
index 8d7a1ef..aab5dca 100644
--- a/kernel/power/suspend.c
+++ b/kernel/power/suspend.c
@@ -482,11 +482,13 @@ static int enter_state(suspend_state_t state)
if (state == PM_SUSPEND_FREEZE)
freeze_begin();
 
-   trace_suspend_resume(TPS("sync_filesystems"), 0, true);
-   printk(KERN_INFO "PM: Syncing filesystems ... ");
-   sys_sync();
-   printk("done.\n");
-   trace_suspend_resume(TPS("sync_filesystems"), 0, false);
+   if (pm_suspend_do_sync) {
+   trace_suspend_resume(TPS("sync_filesystems"), 0, true);
+   printk(KERN_INFO "PM: Syncing filesystems ... ");
+   sys_sync();
+   printk("done.\n");
+   trace_suspend_resume(TPS("sync_filesystems"), 0, false);
+   }
 

[PATCH v4 0/1] suspend: make sync() on suspend-to-RAM optional

2015-07-14 Thread Len Brown
Based on discussion resulting from...
https://lkml.org/lkml/2015/5/8/82 [PATCH 1/1] suspend: delete sys_sync(),
this patch makes sys_sync() optional, rather than deleting it entirely.

This is an update to the original patch for this issue from Jan, 2014:
patch https://lkml.org/lkml/2014/1/23/73
[PATCH v3] suspend: make sync() on suspend-to-RAM optional

Aside from applying to Linux 4.1, rather than 3.13...
the change is that suspend always checks the flag from the
sysfs attribute before invoking sys_sync(); and the config option
just sets the default value.  Before the config option deleted all code.
Also, the config dependency is corrected, and some varialbes re-named.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: make -jN (n>1) ineffective in 4.2.0-rc on AMD Phenom

2015-07-14 Thread Jeff Epler
GNU Make 4.1 has a problem that causes it to be unable to use the
desired level of parallelism.  Two people have reported that reverting a
commit which changes from fork to vfork "fixes" it. (i'm one of them,
unfortunately posting as anonymous in the tracker).

Hoewver, if you are also seeing the linux kernel version as relevant to
producing the problem, that's quite interesting, and the underlying
cause may be different.  We reproduced the problem on a range of older
kernels, from 3.2 to 3.18.

http://savannah.gnu.org/bugs/?44555

Jeff
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


RE: [PATCH] rtc/ds3232: fix ds3232 get a WARNING trace in resume function

2015-07-14 Thread Wang Dongsheng
Thanks Belloni. :)

Regards,
-Dongsheng

> -Original Message-
> From: Alexandre Belloni [mailto:alexandre.bell...@free-electrons.com]
> Sent: Wednesday, July 15, 2015 6:51 AM
> To: Wang Dongsheng-B40534
> Cc: a.zu...@towertech.it; rtc-li...@googlegroups.com; linux-
> ker...@vger.kernel.org
> Subject: Re: [PATCH] rtc/ds3232: fix ds3232 get a WARNING trace in resume
> function
> 
> Hi,
> 
> This seems ok, one small nitpick:
> 
> On 07/07/2015 at 14:12:56 +0800, Dongsheng Wang wrote :
> > From: Wang Dongsheng  diff --git
> > a/drivers/rtc/rtc-ds3232.c b/drivers/rtc/rtc-ds3232.c index
> > 7e48e53..2081155 100644
> > --- a/drivers/rtc/rtc-ds3232.c
> > +++ b/drivers/rtc/rtc-ds3232.c
> > @@ -463,7 +463,10 @@ static int ds3232_suspend(struct device *dev)
> >
> > if (device_can_wakeup(dev)) {
> > ds3232->suspended = true;
> > -   irq_set_irq_wake(client->irq, 1);
> > +   if (irq_set_irq_wake(client->irq, 1)) {
> > +   dev_info(dev, "Cannot serve as a wakeup source\n");
> 
> I would use dev_warn_once or dev_info_once here to avoid spamming the log each
> time the machine is suspended.
> 
> --
> Alexandre Belloni, Free Electrons
> Embedded Linux, Kernel and Android engineering http://free-electrons.com
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[rfc] mm, thp: allow khugepaged to periodically compact memory synchronously

2015-07-14 Thread David Rientjes
We have seen a large benefit in the amount of hugepages that can be
allocated at fault and by khugepaged when memory is periodically
compacted in the background.

We trigger synchronous memory compaction over all memory every 15 minutes
to keep fragmentation low and to offset the lightweight compaction that
is done at page fault to keep latency low.

compact_sleep_millisecs controls how often khugepaged will compact all
memory.  Each scan_sleep_millisecs wakeup after this value has expired, a
node is synchronously compacted until all memory has been scanned.  Then,
khugepaged will restart the process compact_sleep_millisecs later.

This defaults to 0, which means no memory compaction is done.

Signed-off-by: David Rientjes 
---
 RFC: this is for initial comment on whether it's appropriate to do this
 in khugepaged.  We already do to the background compaction for the
 benefit of thp, but others may feel like this belongs in a new per-node
 kcompactd thread as proposed by Vlastimil.

 Regardless, it appears there is a substantial need for periodic memory
 compaction in the background to reduce the latency of thp page faults
 and still have a reasonable chance of having the allocation succeed.

 We could also speed up this process in the case of alloc_sleep_millisecs
 timeout since allocation recently failed for khugepaged.

 Documentation/vm/transhuge.txt | 10 +++
 mm/huge_memory.c   | 65 ++
 2 files changed, 75 insertions(+)

diff --git a/Documentation/vm/transhuge.txt b/Documentation/vm/transhuge.txt
--- a/Documentation/vm/transhuge.txt
+++ b/Documentation/vm/transhuge.txt
@@ -170,6 +170,16 @@ A lower value leads to gain less thp performance. Value of
 max_ptes_none can waste cpu time very little, you can
 ignore it.
 
+/sys/kernel/mm/transparent_hugepage/khugepaged/compact_sleep_millisecs
+
+controls how often khugepaged will utilize memory compaction to defragment
+memory.  This makes it easier to allocate hugepages both at page fault and
+by khugepaged since this compaction can be synchronous.
+
+This only occurs if scan_sleep_millisecs is configured.  One node per
+scan_sleep_millisecs wakeup is compacted when compact_sleep_millisecs
+expires until all memory has been compacted.
+
 == Boot parameter ==
 
 You can change the sysfs boot time defaults of Transparent Hugepage
diff --git a/mm/huge_memory.c b/mm/huge_memory.c
--- a/mm/huge_memory.c
+++ b/mm/huge_memory.c
@@ -23,6 +23,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -65,6 +66,16 @@ static DECLARE_WAIT_QUEUE_HEAD(khugepaged_wait);
  */
 static unsigned int khugepaged_max_ptes_none __read_mostly = HPAGE_PMD_NR-1;
 
+/*
+ * Khugepaged may memory compaction over all memory at regular intervals.
+ * It round-robins through all nodes, compacting one at a time each
+ * scan_sleep_millisecs wakeup when triggered.
+ * May be set with compact_sleep_millisecs, which is disabled by default.
+ */
+static unsigned long khugepaged_compact_sleep_millisecs __read_mostly;
+static unsigned long khugepaged_compact_jiffies;
+static int next_compact_node = MAX_NUMNODES;
+
 static int khugepaged(void *none);
 static int khugepaged_slab_init(void);
 static void khugepaged_slab_exit(void);
@@ -463,6 +474,34 @@ static struct kobj_attribute alloc_sleep_millisecs_attr =
__ATTR(alloc_sleep_millisecs, 0644, alloc_sleep_millisecs_show,
   alloc_sleep_millisecs_store);
 
+static ssize_t compact_sleep_millisecs_show(struct kobject *kobj,
+   struct kobj_attribute *attr,
+   char *buf)
+{
+   return sprintf(buf, "%lu\n", khugepaged_compact_sleep_millisecs);
+}
+
+static ssize_t compact_sleep_millisecs_store(struct kobject *kobj,
+struct kobj_attribute *attr,
+const char *buf, size_t count)
+{
+   unsigned long msecs;
+   int err;
+
+   err = kstrtoul(buf, 10, );
+   if (err || msecs > ULONG_MAX)
+   return -EINVAL;
+
+   khugepaged_compact_sleep_millisecs = msecs;
+   khugepaged_compact_jiffies = jiffies + msecs_to_jiffies(msecs);
+   wake_up_interruptible(_wait);
+
+   return count;
+}
+static struct kobj_attribute compact_sleep_millisecs_attr =
+   __ATTR(compact_sleep_millisecs, 0644, compact_sleep_millisecs_show,
+  compact_sleep_millisecs_store);
+
 static ssize_t pages_to_scan_show(struct kobject *kobj,
  struct kobj_attribute *attr,
  char *buf)
@@ -564,6 +603,7 @@ static struct attribute *khugepaged_attr[] = {
_scans_attr.attr,
_sleep_millisecs_attr.attr,
_sleep_millisecs_attr.attr,
+   _sleep_millisecs_attr.attr,
NULL,
 };
 
@@ -652,6 +692,10 @@ static int __init hugepage_init(void)
return 0;
}
 
+   if 

[PATCH v2 1/6] locking/pvqspinlock: Unconditional PV kick with _Q_SLOW_VAL

2015-07-14 Thread Waiman Long
The smp_store_release() is not a full barrier. In order to avoid missed
wakeup, we may need to add memory barrier around locked and cpu state
variables adding to complexity. As the chance of spurious wakeup is very
low, it is easier and safer to just do an unconditional kick at unlock
time.

Signed-off-by: Waiman Long 
---
 kernel/locking/qspinlock_paravirt.h |4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)

diff --git a/kernel/locking/qspinlock_paravirt.h 
b/kernel/locking/qspinlock_paravirt.h
index 04ab181..f2f4807 100644
--- a/kernel/locking/qspinlock_paravirt.h
+++ b/kernel/locking/qspinlock_paravirt.h
@@ -239,7 +239,6 @@ static void pv_wait_head(struct qspinlock *lock, struct 
mcs_spinlock *node)
cpu_relax();
}
 
-   WRITE_ONCE(pn->state, vcpu_halted);
if (!lp) { /* ONCE */
lp = pv_hash(lock, pn);
/*
@@ -311,8 +310,7 @@ __visible void __pv_queued_spin_unlock(struct qspinlock 
*lock)
 * At this point the memory pointed at by lock can be freed/reused,
 * however we can still use the pv_node to kick the CPU.
 */
-   if (READ_ONCE(node->state) == vcpu_halted)
-   pv_kick(node->cpu);
+   pv_kick(node->cpu);
 }
 /*
  * Include the architecture specific callee-save thunk of the
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 0/6 v2] locking/qspinlock: Enhance pvqspinlock performance

2015-07-14 Thread Waiman Long
v1->v2:
 - Take out the queued unfair lock patches
 - Add a patch to simplify the PV unlock code
 - Move pending bit and statistics collection patches to the front
 - Keep vCPU kicking in pv_kick_node(), but defer it to unlock time
   when appropriate.
 - Change the wait-early patch to use adaptive spinning to better
   balance the difference effect on normal and over-committed guests.
 - Add patch-to-patch performance changes in the patch commit logs.

This patchset tries to improve the performance of both normal and
over-commmitted VM guests. The kick-ahead and adaptive spinning
patches are inspired by the "Do Virtual Machines Really Scale?" blog
from Sanidhya Kashyap.

Patch 1 simplifies the unlock code by doing unconditional vCPU kick
when _Q_SLOW_VAL is set as the chance of spurious wakeup showing
up in the statistical data that I collected was very low (1 or 2
occasionally).

Patch 2 adds pending bit support to pvqspinlock improving performance
at light load.

Patch 3 allows the collection of various count data that are useful
to see what is happening in the system. They do add a bit of overhead
when enabled. This will slow the system a little bit.

Patch 4 enables multiple vCPU kicks at unlock time, outside of the
critical section. Coupled with patch 5 which defers kicking to unlock
time, this will improve system performance in overcommitted guests
and sometime even in normal guests.

Patch 6 enables adaptive spinning in the queue nodes. This patch can lead
to pretty big performance increase in over-committed guest at the expense
of a slight performance hit in normal guests.

Waiman Long (6):
  locking/pvqspinlock: Unconditional PV kick with _Q_SLOW_VAL
  locking/pvqspinlock: Add pending bit support
  locking/pvqspinlock: Collect slowpath lock statistics
  locking/pvqspinlock: Allow vCPUs kick-ahead
  locking/pvqspinlock: Opportunistically defer kicking to unlock time
  locking/pvqspinlock: Queue node adaptive spinning

 arch/x86/Kconfig|7 +
 kernel/locking/qspinlock.c  |   38 +++-
 kernel/locking/qspinlock_paravirt.h |  452 +--
 3 files changed, 473 insertions(+), 24 deletions(-)

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v2 3/6] locking/pvqspinlock: Collect slowpath lock statistics

2015-07-14 Thread Waiman Long
This patch enables the accumulation of kicking and waiting related
PV qspinlock statistics when the new QUEUED_LOCK_STAT configuration
option is selected. It also enables the collection of kicking and
wakeup latencies which have a heavy dependency on the CPUs being used.

The measured latencies for different CPUs are:

CPU Wakeup  Kicking
--- --  ---
Haswell-EX  89.8us   7.4us
Westmere-EX 67.6us   9.3us

The measured latencies varied a bit from run-to-run. The wakeup
latency is much higher than the kicking latency.

A sample of statistics counts after a kernel build (no CPU overcommit)
was:

hash_count=93
hash_hops_count=93
kick_latencies=6997535456
kick_time_count=755426
lock_kick_count=755354
pending_fail_count=10619
pending_lock_count=2912098
spurious_wakeup=8
unlock_kick_count=87
wait_head_count=91
wait_node_count=755359
wake_latencies=51052626984

Signed-off-by: Waiman Long 
---
 arch/x86/Kconfig|7 ++
 kernel/locking/qspinlock_paravirt.h |  165 ++-
 2 files changed, 170 insertions(+), 2 deletions(-)

diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 55bced1..299a1c4 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -679,6 +679,13 @@ config PARAVIRT_SPINLOCKS
 
  If you are unsure how to answer this question, answer Y.
 
+config QUEUED_LOCK_STAT
+   bool "Paravirt queued lock statistics"
+   depends on PARAVIRT && DEBUG_FS && QUEUED_SPINLOCKS
+   ---help---
+ Enable the collection of statistical data on the behavior of
+ paravirtualized queued spinlocks and report them on debugfs.
+
 source "arch/x86/xen/Kconfig"
 
 config KVM_GUEST
diff --git a/kernel/locking/qspinlock_paravirt.h 
b/kernel/locking/qspinlock_paravirt.h
index c43dec7..c8485c4 100644
--- a/kernel/locking/qspinlock_paravirt.h
+++ b/kernel/locking/qspinlock_paravirt.h
@@ -43,6 +43,153 @@ struct pv_node {
 };
 
 /*
+ * PV qspinlock statistics
+ */
+enum pv_qlock_stat {
+   pvstat_wait_head,
+   pvstat_wait_node,
+   pvstat_kick_time,
+   pvstat_lock_kick,
+   pvstat_unlock_kick,
+   pvstat_pend_lock,
+   pvstat_pend_fail,
+   pvstat_spurious,
+   pvstat_hash,
+   pvstat_hops,
+   pvstat_num  /* Total number of statistics counts */
+};
+
+#ifdef CONFIG_QUEUED_LOCK_STAT
+/*
+ * Collect pvqspinlock statiatics
+ */
+#include 
+#include 
+
+static const char * const stat_fsnames[pvstat_num] = {
+   [pvstat_wait_head]   = "wait_head_count",
+   [pvstat_wait_node]   = "wait_node_count",
+   [pvstat_kick_time]   = "kick_time_count",
+   [pvstat_lock_kick]   = "lock_kick_count",
+   [pvstat_unlock_kick] = "unlock_kick_count",
+   [pvstat_pend_lock]   = "pending_lock_count",
+   [pvstat_pend_fail]   = "pending_fail_count",
+   [pvstat_spurious]= "spurious_wakeup",
+   [pvstat_hash]= "hash_count",
+   [pvstat_hops]= "hash_hops_count",
+};
+
+static atomic_t pvstats[pvstat_num];
+
+/*
+ * pv_kick_latencies = sum of all pv_kick latencies in ns
+ * pv_wake_latencies = sum of all wakeup latencies in ns
+ *
+ * Avg kick latency = pv_kick_latencies/(lock_kick_count + unlock_kick_count)
+ * Avg wake latency = pv_wake_latencies/kick_time_count
+ */
+static atomic64_t pv_kick_latencies, pv_wake_latencies;
+static DEFINE_PER_CPU(u64, pv_kick_time);
+
+/*
+ * Reset all the statistics counts if set
+ */
+static bool reset_cnts __read_mostly;
+
+/*
+ * Initialize debugfs for the PV qspinlock statistics
+ */
+static int __init pv_qspinlock_debugfs(void)
+{
+   struct dentry *d_pvqlock = debugfs_create_dir("pv-qspinlock", NULL);
+   int i;
+
+   if (!d_pvqlock)
+   pr_warn("Could not create 'pv-qspinlock' debugfs directory\n");
+
+   for (i = 0; i < pvstat_num; i++)
+   debugfs_create_u32(stat_fsnames[i], 0444, d_pvqlock,
+ (u32 *)[i]);
+   debugfs_create_u64("kick_latencies", 0444, d_pvqlock,
+  (u64 *)_kick_latencies);
+   debugfs_create_u64("wake_latencies", 0444, d_pvqlock,
+  (u64 *)_wake_latencies);
+   debugfs_create_bool("reset_cnts", 0644, d_pvqlock, (u32 *)_cnts);
+   return 0;
+}
+fs_initcall(pv_qspinlock_debugfs);
+
+/*
+ * Reset all the counts
+ */
+static noinline void pvstat_reset(void)
+{
+   int i;
+
+   for (i = 0; i < pvstat_num; i++)
+   atomic_set([i], 0);
+   atomic64_set(_kick_latencies, 0);
+   atomic64_set(_wake_latencies, 0);
+   reset_cnts = 0;
+}
+
+/*
+ * Increment the PV qspinlock statistics counts
+ */
+static inline void pvstat_inc(enum pv_qlock_stat stat)
+{
+   atomic_inc([stat]);
+   if (unlikely(reset_cnts))
+   pvstat_reset();
+}
+
+/*
+ * PV hash hop count
+ */
+static inline void pvstat_hop(int hopcnt)
+{
+   

[PATCH v2 4/6] locking/pvqspinlock: Allow vCPUs kick-ahead

2015-07-14 Thread Waiman Long
Frequent CPU halting (vmexit) and CPU kicking (vmenter) lengthens
critical section and block forward progress.  This patch implements
a kick-ahead mechanism where the unlocker will kick the queue head
vCPUs as well as up to four additional vCPUs next to the queue head
if they were halted.  The kickings are done after exiting the critical
section to improve parallelism.

The amount of kick-ahead allowed depends on the number of vCPUs
in the VM guest.  This patch, by itself, won't do much as most of
the kickings are currently done at lock time. Coupled with the next
patch that defers lock time kicking to unlock time, it should improve
overall system performance in a busy overcommitted guest.

Linux kernel builds were run in KVM guest on an 8-socket, 4
cores/socket Westmere-EX system and a 4-socket, 8 cores/socket
Haswell-EX system. Both systems are configured to have 32 physical
CPUs. The kernel build times before and after the patch were:

WestmereHaswell
  Patch 32 vCPUs48 vCPUs32 vCPUs48 vCPUs
  - 
  Before patch   3m25.0s10m34.1s 2m02.0s15m35.9s
  After patch3m27.4s10m32.0s 2m00.8s14m52.5s

There wasn't too much difference before and after the patch.

Signed-off-by: Waiman Long 
---
 kernel/locking/qspinlock_paravirt.h |   77 +-
 1 files changed, 74 insertions(+), 3 deletions(-)

diff --git a/kernel/locking/qspinlock_paravirt.h 
b/kernel/locking/qspinlock_paravirt.h
index c8485c4..f3ceeff 100644
--- a/kernel/locking/qspinlock_paravirt.h
+++ b/kernel/locking/qspinlock_paravirt.h
@@ -51,6 +51,7 @@ enum pv_qlock_stat {
pvstat_kick_time,
pvstat_lock_kick,
pvstat_unlock_kick,
+   pvstat_kick_ahead,
pvstat_pend_lock,
pvstat_pend_fail,
pvstat_spurious,
@@ -72,6 +73,7 @@ static const char * const stat_fsnames[pvstat_num] = {
[pvstat_kick_time]   = "kick_time_count",
[pvstat_lock_kick]   = "lock_kick_count",
[pvstat_unlock_kick] = "unlock_kick_count",
+   [pvstat_kick_ahead]  = "kick_ahead_count",
[pvstat_pend_lock]   = "pending_lock_count",
[pvstat_pend_fail]   = "pending_fail_count",
[pvstat_spurious]= "spurious_wakeup",
@@ -85,7 +87,8 @@ static atomic_t pvstats[pvstat_num];
  * pv_kick_latencies = sum of all pv_kick latencies in ns
  * pv_wake_latencies = sum of all wakeup latencies in ns
  *
- * Avg kick latency = pv_kick_latencies/(lock_kick_count + unlock_kick_count)
+ * Avg kick latency = pv_kick_latencies/
+ *  (lock_kick_count + unlock_kick_count + kick_ahead_count)
  * Avg wake latency = pv_wake_latencies/kick_time_count
  */
 static atomic64_t pv_kick_latencies, pv_wake_latencies;
@@ -217,6 +220,12 @@ static struct pv_hash_entry *pv_lock_hash;
 static unsigned int pv_lock_hash_bits __read_mostly;
 
 /*
+ * Allow kick-ahead of vCPUs at unlock time
+ */
+#define PV_KICK_AHEAD_MAX  4
+static int pv_kick_ahead __read_mostly;
+
+/*
  * Allocate memory for the PV qspinlock hash buckets
  *
  * This function should be called from the paravirt spinlock initialization
@@ -224,7 +233,16 @@ static unsigned int pv_lock_hash_bits __read_mostly;
  */
 void __init __pv_init_lock_hash(void)
 {
-   int pv_hash_size = ALIGN(4 * num_possible_cpus(), PV_HE_PER_LINE);
+   int ncpus = num_possible_cpus();
+   int pv_hash_size = ALIGN(4 * ncpus, PV_HE_PER_LINE);
+   int i;
+
+   /*
+* The minimum number of vCPUs required in each kick-ahead level
+*/
+   static const u8 kick_ahead_threshold[PV_KICK_AHEAD_MAX] = {
+   4, 8, 16, 32
+   };
 
if (pv_hash_size < PV_HE_MIN)
pv_hash_size = PV_HE_MIN;
@@ -238,6 +256,18 @@ void __init __pv_init_lock_hash(void)
   pv_hash_size, 0, HASH_EARLY,
   _lock_hash_bits, NULL,
   pv_hash_size, pv_hash_size);
+   /*
+* Enable the unlock kick ahead mode according to the number of
+* vCPUs available.
+*/
+   for (i = PV_KICK_AHEAD_MAX; i > 0; i--)
+   if (ncpus >= kick_ahead_threshold[i - 1]) {
+   pv_kick_ahead = i;
+   break;
+   }
+   if (pv_kick_ahead)
+   pr_info("PV unlock kick ahead level %d enabled\n",
+   pv_kick_ahead);
 }
 
 #define for_each_hash_entry(he, offset, hash)  
\
@@ -424,6 +454,25 @@ static void pv_wait_node(struct mcs_spinlock *node)
 }
 
 /*
+ * Helper to get the address of the next kickable node
+ * The node has to be in the halted state and is being transitioned to
+ * running state by this function. Otherwise, NULL will be returned.
+ */
+static inline struct pv_node *pv_get_kick_node(struct 

[PATCH v2 2/6] locking/pvqspinlock: Add pending bit support

2015-07-14 Thread Waiman Long
Like the native qspinlock, using the pending bit when it is lightly
loaded to acquire the lock is faster than going through the PV queuing
process which is even slower than the native queuing process. It also
avoids loading two additional cachelines (the MCS and PV nodes).

This patch adds the pending bit support for PV qspinlock. The pending
bit code has a smaller spin threshold (1<<10). It will default back
to the queuing method if it cannot acquired the lock within a certain
time limit.

On a VM with 32 vCPUs on a 32-core Westmere-EX box, the kernel
build times on 4.2-rc1 based kernels were:

  KernelBuild Time  Sys Time
  ----  
  w/o patch   3m28.5s   28m17.5s
  with patch  3m19.3s   23m55.7s

Using a locking microbenchmark on the same system, the locking
rates in (kops/s) were:

  Threads   Rate w/o patch  Rate with patch
  ---   --  ---
  2 (same socket) 6,515,265   7,077,476
  2 (diff sockets)2,967,145   4,353,851

Signed-off-by: Waiman Long 
---
 kernel/locking/qspinlock.c  |   27 ++-
 kernel/locking/qspinlock_paravirt.h |   66 +++
 2 files changed, 92 insertions(+), 1 deletions(-)

diff --git a/kernel/locking/qspinlock.c b/kernel/locking/qspinlock.c
index 38c4920..6518ee9 100644
--- a/kernel/locking/qspinlock.c
+++ b/kernel/locking/qspinlock.c
@@ -162,6 +162,17 @@ static __always_inline void 
clear_pending_set_locked(struct qspinlock *lock)
WRITE_ONCE(l->locked_pending, _Q_LOCKED_VAL);
 }
 
+/**
+ * clear_pending - clear the pending bit.
+ * @lock: Pointer to queued spinlock structure
+ */
+static __always_inline void clear_pending(struct qspinlock *lock)
+{
+   struct __qspinlock *l = (void *)lock;
+
+   WRITE_ONCE(l->pending, 0);
+}
+
 /*
  * xchg_tail - Put in the new queue tail code word & retrieve previous one
  * @lock : Pointer to queued spinlock structure
@@ -193,6 +204,15 @@ static __always_inline void 
clear_pending_set_locked(struct qspinlock *lock)
 }
 
 /**
+ * clear_pending - clear the pending bit.
+ * @lock: Pointer to queued spinlock structure
+ */
+static __always_inline void clear_pending(struct qspinlock *lock)
+{
+   atomic_add(-_Q_PENDING_VAL, >val);
+}
+
+/**
  * xchg_tail - Put in the new queue tail code word & retrieve previous one
  * @lock : Pointer to queued spinlock structure
  * @tail : The new queue tail code word
@@ -245,6 +265,7 @@ static __always_inline void __pv_wait_head(struct qspinlock 
*lock,
   struct mcs_spinlock *node) { }
 
 #define pv_enabled()   false
+#define pv_pending_lock(l, v)  false
 
 #define pv_init_node   __pv_init_node
 #define pv_wait_node   __pv_wait_node
@@ -286,8 +307,11 @@ void queued_spin_lock_slowpath(struct qspinlock *lock, u32 
val)
 
BUILD_BUG_ON(CONFIG_NR_CPUS >= (1U << _Q_TAIL_CPU_BITS));
 
-   if (pv_enabled())
+   if (pv_enabled()) {
+   if (pv_pending_lock(lock, val))
+   return; /* Got the lock via pending bit */
goto queue;
+   }
 
if (virt_queued_spin_lock(lock))
return;
@@ -463,6 +487,7 @@ EXPORT_SYMBOL(queued_spin_lock_slowpath);
 #undef pv_wait_node
 #undef pv_kick_node
 #undef pv_wait_head
+#undef pv_pending_lock
 
 #undef  queued_spin_lock_slowpath
 #define queued_spin_lock_slowpath  __pv_queued_spin_lock_slowpath
diff --git a/kernel/locking/qspinlock_paravirt.h 
b/kernel/locking/qspinlock_paravirt.h
index f2f4807..c43dec7 100644
--- a/kernel/locking/qspinlock_paravirt.h
+++ b/kernel/locking/qspinlock_paravirt.h
@@ -21,6 +21,14 @@
 
 #define _Q_SLOW_VAL(3U << _Q_LOCKED_OFFSET)
 
+/*
+ * Queued Spinlock Spin Threshold
+ *
+ * The vCPU will spin a relatively short time in pending mode before falling
+ * back to queuing.
+ */
+#define PENDING_SPIN_THRESHOLD (SPIN_THRESHOLD >> 5)
+
 enum vcpu_state {
vcpu_running = 0,
vcpu_halted,
@@ -151,6 +159,64 @@ static void pv_init_node(struct mcs_spinlock *node)
 }
 
 /*
+ * Try to acquire the lock and wait using the pending bit
+ */
+static int pv_pending_lock(struct qspinlock *lock, u32 val)
+{
+   int loop = PENDING_SPIN_THRESHOLD;
+   u32 new, old;
+
+   /*
+* wait for in-progress pending->locked hand-overs
+*/
+   if (val == _Q_PENDING_VAL) {
+   while (((val = atomic_read(>val)) == _Q_PENDING_VAL) &&
+   loop--)
+   cpu_relax();
+   }
+
+   /*
+* trylock || pending
+*/
+   for (;;) {
+   if (val & ~_Q_LOCKED_MASK)
+   goto queue;
+   new = _Q_LOCKED_VAL;
+   if (val == new)
+   new |= _Q_PENDING_VAL;
+   old = atomic_cmpxchg(>val, val, new);
+   if (old == val)
+   

[PATCH v2 6/6] locking/pvqspinlock: Queue node adaptive spinning

2015-07-14 Thread Waiman Long
In an overcommitted guest where some vCPUs have to be halted to make
forward progress in other areas, it is highly likely that a vCPU later
in the spinlock queue will be spinning while the ones earlier in the
queue would have been halted. The spinning in the later vCPUs is then
just a waste of precious CPU cycles because they are not going to
get the lock soon as the earlier ones have to be woken up and take
their turn to get the lock.

Reducing the spinning threshold is found to improve performance in
an overcommitted VM guest, but decrease performance when there is
no overcommittment.

This patch implements an adaptive spinning mechanism where the vCPU
will call pv_wait() earlier under the following 3 conditions:
 1) the previous vCPU is in the halted state;
 2) the current vCPU is at least 2 nodes away from the lock holder;
 3) there are a lot of pv_wait() for the current vCPU recently.

If all the conditions are true, it will spin less before calling
pv_wait().

Linux kernel builds were run in KVM guest on an 8-socket, 4
cores/socket Westmere-EX system and a 4-socket, 8 cores/socket
Haswell-EX system. Both systems are configured to have 32 physical
CPUs. The kernel build times before and after the patch were:

WestmereHaswell
  Patch 32 vCPUs48 vCPUs32 vCPUs48 vCPUs
  - 
  Before patch   3m01.3s 9m50.9s 2m00.5s13m28.1s
  After patch3m06.2s 9m38.0s 2m01.8s 9m06.9s

This patch seemed to cause a little bit of performance degraduation
for 32 vCPUs. For 48 vCPUs, there was some performance for Westmere and
a big performance jump for Haswell.

Signed-off-by: Waiman Long 
---
 kernel/locking/qspinlock.c  |5 +-
 kernel/locking/qspinlock_paravirt.h |   93 --
 2 files changed, 90 insertions(+), 8 deletions(-)

diff --git a/kernel/locking/qspinlock.c b/kernel/locking/qspinlock.c
index 94fdd27..da39d43 100644
--- a/kernel/locking/qspinlock.c
+++ b/kernel/locking/qspinlock.c
@@ -258,7 +258,8 @@ static __always_inline void set_locked(struct qspinlock 
*lock)
  */
 
 static __always_inline void __pv_init_node(struct mcs_spinlock *node) { }
-static __always_inline void __pv_wait_node(struct mcs_spinlock *node) { }
+static __always_inline void __pv_wait_node(struct mcs_spinlock *node,
+  struct mcs_spinlock *prev) { }
 static __always_inline void __pv_kick_node(struct qspinlock *lock,
   struct mcs_spinlock *node) { }
 static __always_inline void __pv_wait_head(struct qspinlock *lock,
@@ -415,7 +416,7 @@ queue:
prev = decode_tail(old);
WRITE_ONCE(prev->next, node);
 
-   pv_wait_node(node);
+   pv_wait_node(node, prev);
arch_mcs_spin_lock_contended(>locked);
}
 
diff --git a/kernel/locking/qspinlock_paravirt.h 
b/kernel/locking/qspinlock_paravirt.h
index 1f0485c..5f97058 100644
--- a/kernel/locking/qspinlock_paravirt.h
+++ b/kernel/locking/qspinlock_paravirt.h
@@ -22,12 +22,37 @@
 #define _Q_SLOW_VAL(3U << _Q_LOCKED_OFFSET)
 
 /*
- * Queued Spinlock Spin Threshold
+ * Queued Spinlock Spin Thresholds
  *
  * The vCPU will spin a relatively short time in pending mode before falling
  * back to queuing.
+ *
+ * Queue Node Adaptive Spinning
+ *
+ * A queue node vCPU will spin less if the following conditions are true:
+ * 1) vCPU in the previous node is halted
+ * 2) it is at least 2 nodes away from the lock holder
+ * 3) there is a lot of pv_wait() in the curent vCPU recently
+ *
+ * The last condition is being monitored by the waithist field in the pv_node
+ * structure which tracks the history of pv_wait() relative to slowpath calls.
+ * Each pv_wait will increment this field by PV_WAIT_INC until it exceeds
+ * PV_WAITHIST_MAX. Each slowpath lock call will decrement it by 1 until it
+ * reaches PV_WAITHIST_MIN. If its value is higher than PV_WAITHIST_THRESHOLD,
+ * the vCPU will spin less. The reason for this adaptive spinning is to try
+ * to enable wait-early when overcommitted, but don't use it when it is not.
+ *
+ * The queue node vCPU will monitor the state of the previous node
+ * periodically to see if there is any change.
  */
-#define PENDING_SPIN_THRESHOLD (SPIN_THRESHOLD >> 5)
+#define PENDING_SPIN_THRESHOLD (SPIN_THRESHOLD >> 5)
+#define QNODE_SPIN_THRESHOLD   SPIN_THRESHOLD
+#define QNODE_SPIN_THRESHOLD_SHORT (QNODE_SPIN_THRESHOLD >> 5)
+#define QNODE_SPIN_CHECK_MASK  0xff
+#define PV_WAIT_INC2
+#define PV_WAITHIST_MIN1
+#define PV_WAITHIST_MAX30
+#define PV_WAITHIST_THRESHOLD  15
 
 enum vcpu_state {
vcpu_running = 0,
@@ -41,6 +66,7 @@ struct pv_node {
int cpu;
u8  state;
u8 

Re: [PATCH 05/10] Staging: fbtft: Set bus specific ops using separate functions

2015-07-14 Thread Greg KH
On Tue, Jun 30, 2015 at 08:43:12AM +0200, Fabio Falzoi wrote:
> Use two separate functions for spi and platform bus
> (flexfb_set_spi_bus_func and flexfb_set_platform_bus_func,
> respectively) to set the appropriate write operations.
> 
> This patch corrects the following checkpatch errors:
> WARNING:LONG_LiINE at lines 446, 450, 466, 476, 489 and 495.
> CHECK:PARENTHESIS_ALIGNMENT at line 459.
> 
> Signed-off-by: Fabio Falzoi 

Can't you fix the line lengths without having to move to separate
functions?

thanks,

greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v2 5/6] locking/pvqspinlock: Opportunistically defer kicking to unlock time

2015-07-14 Thread Waiman Long
Performing CPU kicking at lock time can be a bit faster if there
is no kick-ahead. On the other hand, deferring it to unlock time is
preferrable when kick-ahead can be performed or when the VM guest is
having too few vCPUs that a vCPU may be kicked twice before getting
the lock. This patch implements the deferring kicking when either
one of the above 2 conditions is true.

Linux kernel builds were run in KVM guest on an 8-socket, 4
cores/socket Westmere-EX system and a 4-socket, 8 cores/socket
Haswell-EX system. Both systems are configured to have 32 physical
CPUs. The kernel build times before and after the patch were:

WestmereHaswell
  Patch 32 vCPUs48 vCPUs32 vCPUs48 vCPUs
  - 
  Before patch   3m27.4s10m32.0s 2m00.8s14m52.5s
  After patch3m01.3s 9m50.9s 2m00.5s13m28.1s

On Westmere, both 32/48 vCPUs case showed some sizeable increase
in performance. For Haswell, there was some improvement in the
overcommitted (48 vCPUs) case.

Signed-off-by: Waiman Long 
---
 kernel/locking/qspinlock.c  |6 +-
 kernel/locking/qspinlock_paravirt.h |   71 +++
 2 files changed, 58 insertions(+), 19 deletions(-)

diff --git a/kernel/locking/qspinlock.c b/kernel/locking/qspinlock.c
index 6518ee9..94fdd27 100644
--- a/kernel/locking/qspinlock.c
+++ b/kernel/locking/qspinlock.c
@@ -259,8 +259,8 @@ static __always_inline void set_locked(struct qspinlock 
*lock)
 
 static __always_inline void __pv_init_node(struct mcs_spinlock *node) { }
 static __always_inline void __pv_wait_node(struct mcs_spinlock *node) { }
-static __always_inline void __pv_kick_node(struct mcs_spinlock *node) { }
-
+static __always_inline void __pv_kick_node(struct qspinlock *lock,
+  struct mcs_spinlock *node) { }
 static __always_inline void __pv_wait_head(struct qspinlock *lock,
   struct mcs_spinlock *node) { }
 
@@ -464,7 +464,7 @@ queue:
cpu_relax();
 
arch_mcs_spin_unlock_contended(>locked);
-   pv_kick_node(next);
+   pv_kick_node(lock, next);
 
 release:
/*
diff --git a/kernel/locking/qspinlock_paravirt.h 
b/kernel/locking/qspinlock_paravirt.h
index f3ceeff..1f0485c 100644
--- a/kernel/locking/qspinlock_paravirt.h
+++ b/kernel/locking/qspinlock_paravirt.h
@@ -40,6 +40,7 @@ struct pv_node {
 
int cpu;
u8  state;
+   u8  hashed; /* Set if in hashed table */
 };
 
 /*
@@ -336,6 +337,7 @@ static void pv_init_node(struct mcs_spinlock *node)
 
pn->cpu = smp_processor_id();
pn->state = vcpu_running;
+   pn->hashed = 0;
 }
 
 /*
@@ -455,18 +457,21 @@ static void pv_wait_node(struct mcs_spinlock *node)
 
 /*
  * Helper to get the address of the next kickable node
- * The node has to be in the halted state and is being transitioned to
- * running state by this function. Otherwise, NULL will be returned.
+ *
+ * The node has to be in the halted state. If the chkonly flag is set,
+ * the CPU state won't be changed. Otherwise, it will be transitioned to
+ * running state by this function. If no kickable node is found, NULL
+ * will be returned.
  */
-static inline struct pv_node *pv_get_kick_node(struct pv_node *node)
+static inline struct pv_node *
+pv_get_kick_node(struct pv_node *node, int chkonly)
 {
struct pv_node *next = (struct pv_node *)READ_ONCE(node->mcs.next);
 
-   if (!next)
+   if (!next || (READ_ONCE(next->state) != vcpu_halted))
return NULL;
 
-   if ((READ_ONCE(next->state) != vcpu_halted) ||
-   (xchg(>state, vcpu_running) != vcpu_halted))
+   if (!chkonly && (xchg(>state, vcpu_running) != vcpu_halted))
next = NULL;/* No kicking is needed */
 
return next;
@@ -476,23 +481,50 @@ static inline struct pv_node *pv_get_kick_node(struct 
pv_node *node)
  * Called after setting next->locked = 1, used to wake those stuck in
  * pv_wait_node().
  */
-static void pv_kick_node(struct mcs_spinlock *node)
+static void pv_kick_node(struct qspinlock *lock, struct mcs_spinlock *node)
 {
struct pv_node *pn = (struct pv_node *)node;
 
+   if (xchg(>state, vcpu_running) == vcpu_running)
+   return;
+
/*
-* Note that because node->locked is already set, this actual
-* mcs_spinlock entry could be re-used already.
+* Kicking the next node at lock time can actually be a bit faster
+* than doing it at unlock time because the critical section time
+* overlaps with the wakeup latency of the next node. However, if the
+* VM is too overcommmitted, it can happen that we need to kick the
+* CPU again at unlock time (double-kick). To avoid that and also to
+* fully utilize the kick-ahead functionality 

Re: [PATCH 06/10] Staging: fbtft: Use a helper function to set set_addr_win op

2015-07-14 Thread Greg KH
On Tue, Jun 30, 2015 at 08:43:13AM +0200, Fabio Falzoi wrote:
> Use a helper function to choose which set_addr_win implementation to
> use, based on the value of the setaddrwin module parameter.
> 
> Signed-off-by: Fabio Falzoi 
> ---
>  drivers/staging/fbtft/flexfb.c | 47 
> +-
>  1 file changed, 28 insertions(+), 19 deletions(-)

Again, why?

I need a maintainer of the code to ack any of these...

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 03/10] Staging: fbtft: Use a struct to describe each LCD controller

2015-07-14 Thread Greg KH
On Tue, Jun 30, 2015 at 08:43:10AM +0200, Fabio Falzoi wrote:
> Use a struct flexfb_lcd_controller to holds chip properties, instead of
> relying on a long 'if - else if' chain.
> This allows to:
> - use a simple linear search to verify if a certain LCD controller
> model is supported or not.
> - add support for a new LCD chip controller simply defining a new
> flexfb_lcd_controller struct.
> 
> Signed-off-by: Fabio Falzoi 
> ---
>  drivers/staging/fbtft/fbtft.h  |  20 
>  drivers/staging/fbtft/flexfb.c | 212 
> ++---
>  2 files changed, 136 insertions(+), 96 deletions(-)

I need the maintainers to sign off on this before I can take it, as it's
not just a "simple" coding style fix.

thanks,

greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 04/10] Staging: fbtft: Use a helper function to set write_register op

2015-07-14 Thread Greg KH
On Tue, Jun 30, 2015 at 08:43:11AM +0200, Fabio Falzoi wrote:
> Use a helper function to set the correct write_register function, based
> on the width of the registers.
> 
> Signed-off-by: Fabio Falzoi 
> ---
>  drivers/staging/fbtft/flexfb.c | 36 ++--
>  1 file changed, 22 insertions(+), 14 deletions(-)
> 
> diff --git a/drivers/staging/fbtft/flexfb.c b/drivers/staging/fbtft/flexfb.c
> index 25b394d..dae092a 100644
> --- a/drivers/staging/fbtft/flexfb.c
> +++ b/drivers/staging/fbtft/flexfb.c
> @@ -363,6 +363,25 @@ static int flexfb_chip_init(const struct device *dev)
>   return -EINVAL;
>  }
>  
> +static int flexfb_set_regwrite_func(const struct device *dev,
> + struct fbtft_par *par)
> +{
> + switch (regwidth) {
> + case 8:
> + par->fbtftops.write_register = fbtft_write_reg8_bus8;
> + break;
> + case 16:
> + par->fbtftops.write_register = fbtft_write_reg16_bus8;
> + break;
> + default:
> + dev_err(dev, "argument 'regwidth': %d is not supported.\n",
> + regwidth);
> + return -EINVAL;
> + }
> +
> + return 0;
> +}
> +
>  static int flexfb_probe_common(struct spi_device *sdev,
>  struct platform_device *pdev)
>  {
> @@ -413,20 +432,9 @@ static int flexfb_probe_common(struct spi_device *sdev,
>   par->init_sequence = initp;
>   par->fbtftops.init_display = fbtft_init_display;
>  
> - /* registerwrite functions */
> - switch (regwidth) {
> - case 8:
> - par->fbtftops.write_register = fbtft_write_reg8_bus8;
> - break;
> - case 16:
> - par->fbtftops.write_register = fbtft_write_reg16_bus8;
> - break;
> - default:
> - dev_err(dev,
> - "argument 'regwidth': %d is not supported.\n",
> - regwidth);
> - return -EINVAL;
> - }
> + ret = flexfb_set_regwrite_func(dev, par);
> + if (ret)
> + goto out_release;
>  
>   /* bus functions */
>   if (sdev) {

Why?  You aren't calling this function anywhere else, so why move it?

thanks,

greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/2] Define find_symbol_in_section_t as function type to simplify the code

2015-07-14 Thread Minfei Huang
On 07/15/15 at 07:22am, Rusty Russell wrote:
> Minfei Huang  writes:
> > From: Minfei Huang 
> >
> > It is not elegance, if we use function directly as the argument, like
> > following:
> >
> > bool each_symbol_section(bool (*fn)(const struct symsearch *arr,
> >struct module *owner,
> >void *data), void *data);
> >
> > Here introduce a type defined function find_symbol_in_section_t. Now
> > we can use these type defined function directly, if we want to pass
> > the function as the argument.
> >
> > bool each_symbol_section(find_symbol_in_section_t fn, void *data);
> 
> I disagree.
> 
> It's shorter, but it's less clear.  typedefs on functions are not very
> useful:
> 1) They require readers to look in two places to see how to use the
>function (ie each_symbol_section).
> 2) They can't use the typedef to declare their function, since that
>doesn't work in C.
> 
> If the function were being used many times, it makes sense.  But
> it's only used twice, once static inside module.c.
> 
> So I won't be applying these.
> 
> Cheers,
> Rusty.
> 

Hi, Rusty.

The main reason why I posted these patch is the function has too much
parameters which may be confused with readers at the first glance. 

So it is better define a typedef function, although the readers shall
dig out what find_symbol_in_section_t is.

Thanks
Minfei

> > Signed-off-by: Minfei Huang 
> > ---
> >  include/linux/module.h | 6 +++---
> >  kernel/module.c| 9 ++---
> >  2 files changed, 5 insertions(+), 10 deletions(-)
> >
> > diff --git a/include/linux/module.h b/include/linux/module.h
> > index d67b193..1e125b1 100644
> > --- a/include/linux/module.h
> > +++ b/include/linux/module.h
> > @@ -462,14 +462,14 @@ const struct kernel_symbol *find_symbol(const char 
> > *name,
> > bool gplok,
> > bool warn);
> >  
> > +typedef bool (*find_symbol_in_section_t)(const struct symsearch *arr,
> > +   struct module *owner, void *data);
> >  /*
> >   * Walk the exported symbol table
> >   *
> >   * Must be called with module_mutex held or preemption disabled.
> >   */
> > -bool each_symbol_section(bool (*fn)(const struct symsearch *arr,
> > -   struct module *owner,
> > -   void *data), void *data);
> > +bool each_symbol_section(find_symbol_in_section_t fn, void *data);
> >  
> >  /* Returns 0 and fills in value, defined and namebuf, or -ERANGE if
> > symnum out of range. */
> > diff --git a/kernel/module.c b/kernel/module.c
> > index 4d2b82e..1400c0b 100644
> > --- a/kernel/module.c
> > +++ b/kernel/module.c
> > @@ -426,9 +426,7 @@ extern const unsigned long 
> > __start___kcrctab_unused_gpl[];
> >  static bool each_symbol_in_section(const struct symsearch *arr,
> >unsigned int arrsize,
> >struct module *owner,
> > -  bool (*fn)(const struct symsearch *syms,
> > - struct module *owner,
> > - void *data),
> > +  find_symbol_in_section_t fn,
> >void *data)
> >  {
> > unsigned int j;
> > @@ -442,10 +440,7 @@ static bool each_symbol_in_section(const struct 
> > symsearch *arr,
> >  }
> >  
> >  /* Returns true as soon as fn returns true, otherwise false. */
> > -bool each_symbol_section(bool (*fn)(const struct symsearch *arr,
> > -   struct module *owner,
> > -   void *data),
> > -void *data)
> > +bool each_symbol_section(find_symbol_in_section_t fn, void *data)
> >  {
> > struct module *mod;
> > static const struct symsearch arr[] = {
> > -- 
> > 2.2.2
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


  1   2   3   4   5   6   7   8   9   10   >