[PATCH 1/3] powerpc/dt_cpu_ftrs: Remove unused macro ISA_V2_07B

2020-06-10 Thread Murilo Opsfelder Araujo
Macro ISA_V2_07B is defined but not used anywhere else in the code.

Signed-off-by: Murilo Opsfelder Araujo 
---
 arch/powerpc/kernel/dt_cpu_ftrs.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/arch/powerpc/kernel/dt_cpu_ftrs.c 
b/arch/powerpc/kernel/dt_cpu_ftrs.c
index 3a409517c031..1b7da8b5ce0d 100644
--- a/arch/powerpc/kernel/dt_cpu_ftrs.c
+++ b/arch/powerpc/kernel/dt_cpu_ftrs.c
@@ -24,7 +24,6 @@
 
 
 /* Device-tree visible constants follow */
-#define ISA_V2_07B  2070
 #define ISA_V3_0B   3000
 #define ISA_V3_13100
 
-- 
2.25.4



[PATCH 0/3] powerpc/dt_cpu_ftrs: Make use of ISA_V3_* macros

2020-06-10 Thread Murilo Opsfelder Araujo
The first patch removes unused macro ISA_V2_07B.  The second and third
patches make use of macros ISA_V3_0B and ISA_V3_1, respectively,
instead their corresponding literals.

Murilo Opsfelder Araujo (3):
  powerpc/dt_cpu_ftrs: Remove unused macro ISA_V2_07B
  powerpc/dt_cpu_ftrs: Make use of macro ISA_V3_0B
  powerpc/dt_cpu_ftrs: Make use of macro ISA_V3_1

 arch/powerpc/kernel/dt_cpu_ftrs.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

--
2.25.4


[PATCH 3/3] powerpc/dt_cpu_ftrs: Make use of macro ISA_V3_1

2020-06-10 Thread Murilo Opsfelder Araujo
Macro ISA_V3_1 was defined but never used.  Use it instead of literal.

Signed-off-by: Murilo Opsfelder Araujo 
---
 arch/powerpc/kernel/dt_cpu_ftrs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/powerpc/kernel/dt_cpu_ftrs.c 
b/arch/powerpc/kernel/dt_cpu_ftrs.c
index 9d6e833da2bd..a0edeb391e3e 100644
--- a/arch/powerpc/kernel/dt_cpu_ftrs.c
+++ b/arch/powerpc/kernel/dt_cpu_ftrs.c
@@ -678,7 +678,7 @@ static void __init cpufeatures_setup_start(u32 isa)
cur_cpu_spec->cpu_user_features2 |= PPC_FEATURE2_ARCH_3_00;
}
 
-   if (isa >= 3100) {
+   if (isa >= ISA_V3_1) {
cur_cpu_spec->cpu_features |= CPU_FTR_ARCH_31;
cur_cpu_spec->cpu_user_features2 |= PPC_FEATURE2_ARCH_3_1;
}
-- 
2.25.4



[PATCH 2/3] powerpc/dt_cpu_ftrs: Make use of macro ISA_V3_0B

2020-06-10 Thread Murilo Opsfelder Araujo
Macro ISA_V3_0B was defined but never used.  Use it instead of
literal.

Signed-off-by: Murilo Opsfelder Araujo 
---
 arch/powerpc/kernel/dt_cpu_ftrs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/powerpc/kernel/dt_cpu_ftrs.c 
b/arch/powerpc/kernel/dt_cpu_ftrs.c
index 1b7da8b5ce0d..9d6e833da2bd 100644
--- a/arch/powerpc/kernel/dt_cpu_ftrs.c
+++ b/arch/powerpc/kernel/dt_cpu_ftrs.c
@@ -673,7 +673,7 @@ static void __init cpufeatures_setup_start(u32 isa)
 {
pr_info("setup for ISA %d\n", isa);
 
-   if (isa >= 3000) {
+   if (isa >= ISA_V3_0B) {
cur_cpu_spec->cpu_features |= CPU_FTR_ARCH_300;
cur_cpu_spec->cpu_user_features2 |= PPC_FEATURE2_ARCH_3_00;
}
-- 
2.25.4



Re: [PATCH v3 1/2] mm: add probe_user_read()

2019-02-05 Thread Murilo Opsfelder Araujo
Hi, Christophe.

On Wed, Jan 16, 2019 at 04:59:27PM +, Christophe Leroy wrote:
> In powerpc code, there are several places implementing safe
> access to user data. This is sometimes implemented using
> probe_kernel_address() with additional access_ok() verification,
> sometimes with get_user() enclosed in a pagefault_disable()/enable()
> pair, etc. :
> show_user_instructions()
> bad_stack_expansion()
> p9_hmi_special_emu()
> fsl_pci_mcheck_exception()
> read_user_stack_64()
> read_user_stack_32() on PPC64
> read_user_stack_32() on PPC32
> power_pmu_bhrb_to()
>
> In the same spirit as probe_kernel_read(), this patch adds
> probe_user_read().
>
> probe_user_read() does the same as probe_kernel_read() but
> first checks that it is really a user address.
>
> The patch defines this function as a static inline so the "size"
> variable can be examined for const-ness by the check_object_size()
> in __copy_from_user_inatomic()
>
> Signed-off-by: Christophe Leroy 
> ---
>  v3: Moved 'Returns:" comment after description.
>  Explained in the commit log why the function is defined static inline
>
>  v2: Added "Returns:" comment and removed probe_user_address()
>
>  include/linux/uaccess.h | 34 ++
>  1 file changed, 34 insertions(+)
>
> diff --git a/include/linux/uaccess.h b/include/linux/uaccess.h
> index 37b226e8df13..ef99edd63da3 100644
> --- a/include/linux/uaccess.h
> +++ b/include/linux/uaccess.h
> @@ -263,6 +263,40 @@ extern long strncpy_from_unsafe(char *dst, const void 
> *unsafe_addr, long count);
>  #define probe_kernel_address(addr, retval)   \
>   probe_kernel_read(&retval, addr, sizeof(retval))
>
> +/**
> + * probe_user_read(): safely attempt to read from a user location
> + * @dst: pointer to the buffer that shall take the data
> + * @src: address to read from
> + * @size: size of the data chunk
> + *
> + * Safely read from address @src to the buffer at @dst.  If a kernel fault
> + * happens, handle that and return -EFAULT.
> + *
> + * We ensure that the copy_from_user is executed in atomic context so that
> + * do_page_fault() doesn't attempt to take mmap_sem.  This makes
> + * probe_user_read() suitable for use within regions where the caller
> + * already holds mmap_sem, or other locks which nest inside mmap_sem.
> + *
> + * Returns: 0 on success, -EFAULT on error.
> + */
> +
> +#ifndef probe_user_read
> +static __always_inline long probe_user_read(void *dst, const void __user 
> *src,
> + size_t size)
> +{
> + long ret;
> +
> + if (!access_ok(src, size))
> + return -EFAULT;

Hopefully, there is still time for a minor comment.

Do we need to differentiate the returned error here, e.g.: return
-EACCES?

I wonder if there will be situations where callers need to know why
probe_user_read() failed.

Besides that:

Acked-by: Murilo Opsfelder Araujo 

> +
> + pagefault_disable();
> + ret = __copy_from_user_inatomic(dst, src, size);
> + pagefault_enable();
> +
> + return ret ? -EFAULT : 0;
> +}
> +#endif
> +
>  #ifndef user_access_begin
>  #define user_access_begin(ptr,len) access_ok(ptr, len)
>  #define user_access_end() do { } while (0)
> --
> 2.13.3
>

--
Murilo



Re: [PATCH kernel v7 20/20] vfio_pci: Add NVIDIA GV100GL [Tesla V100 SXM2] subdriver

2018-12-20 Thread Murilo Opsfelder Araujo
On Thu, Dec 20, 2018 at 07:23:50PM +1100, Alexey Kardashevskiy wrote:
> POWER9 Witherspoon machines come with 4 or 6 V100 GPUs which are not
> pluggable PCIe devices but still have PCIe links which are used
> for config space and MMIO. In addition to that the GPUs have 6 NVLinks
> which are connected to other GPUs and the POWER9 CPU. POWER9 chips
> have a special unit on a die called an NPU which is an NVLink2 host bus
> adapter with p2p connections to 2 to 3 GPUs, 3 or 2 NVLinks to each.
> These systems also support ATS (address translation services) which is
> a part of the NVLink2 protocol. Such GPUs also share on-board RAM
> (16GB or 32GB) to the system via the same NVLink2 so a CPU has
> cache-coherent access to a GPU RAM.
> 
> This exports GPU RAM to the userspace as a new VFIO device region. This
> preregisters the new memory as device memory as it might be used for DMA.
> This inserts pfns from the fault handler as the GPU memory is not onlined
> until the vendor driver is loaded and trained the NVLinks so doing this
> earlier causes low level errors which we fence in the firmware so
> it does not hurt the host system but still better be avoided; for the same
> reason this does not map GPU RAM into the host kernel (usual thing for
> emulated access otherwise).
> 
> This exports an ATSD (Address Translation Shootdown) register of NPU which
> allows TLB invalidations inside GPU for an operating system. The register
> conveniently occupies a single 64k page. It is also presented to
> the userspace as a new VFIO device region. One NPU has 8 ATSD registers,
> each of them can be used for TLB invalidation in a GPU linked to this NPU.
> This allocates one ATSD register per an NVLink bridge allowing passing
> up to 6 registers. Due to the host firmware bug (just recently fixed),
> only 1 ATSD register per NPU was actually advertised to the host system
> so this passes that alone register via the first NVLink bridge device in
> the group which is still enough as QEMU collects them all back and
> presents to the guest via vPHB to mimic the emulated NPU PHB on the host.
> 
> In order to provide the userspace with the information about GPU-to-NVLink
> connections, this exports an additional capability called "tgt"
> (which is an abbreviated host system bus address). The "tgt" property
> tells the GPU its own system address and allows the guest driver to
> conglomerate the routing information so each GPU knows how to get directly
> to the other GPUs.
> 
> For ATS to work, the nest MMU (an NVIDIA block in a P9 CPU) needs to
> know LPID (a logical partition ID or a KVM guest hardware ID in other
> words) and PID (a memory context ID of a userspace process, not to be
> confused with a linux pid). This assigns a GPU to LPID in the NPU and
> this is why this adds a listener for KVM on an IOMMU group. A PID comes
> via NVLink from a GPU and NPU uses a PID wildcard to pass it through.
> 
> This requires coherent memory and ATSD to be available on the host as
> the GPU vendor only supports configurations with both features enabled
> and other configurations are known not to work. Because of this and
> because of the ways the features are advertised to the host system
> (which is a device tree with very platform specific properties),
> this requires enabled POWERNV platform.
> 
> The V100 GPUs do not advertise any of these capabilities via the config
> space and there are more than just one device ID so this relies on
> the platform to tell whether these GPUs have special abilities such as
> NVLinks.
> 
> Signed-off-by: Alexey Kardashevskiy 
> ---
> Changes:
> v6.1:
> * fixed outdated comment about VFIO_REGION_INFO_CAP_NVLINK2_LNKSPD
> 
> v6:
> * reworked capabilities - tgt for nvlink and gpu and link-speed
> for nvlink only
> 
> v5:
> * do not memremap GPU RAM for emulation, map it only when it is needed
> * allocate 1 ATSD register per NVLink bridge, if none left, then expose
> the region with a zero size
> * separate caps per device type
> * addressed AW review comments
> 
> v4:
> * added nvlink-speed to the NPU bridge capability as this turned out to
> be not a constant value
> * instead of looking at the exact device ID (which also changes from system
> to system), now this (indirectly) looks at the device tree to know
> if GPU and NPU support NVLink
> 
> v3:
> * reworded the commit log about tgt
> * added tracepoints (do we want them enabled for entire vfio-pci?)
> * added code comments
> * added write|mmap flags to the new regions
> * auto enabled VFIO_PCI_NVLINK2 config option
> * added 'tgt' capability to a GPU so QEMU can recreate ibm,npu and ibm,gpu
> references; there are required by the NVIDIA driver
> * keep notifier registered only for short time
> ---
>  drivers/vfio/pci/Makefile   |   1 +
>  drivers/vfio/pci/trace.h| 102 ++
>  drivers/vfio/pci/vfio_pci_private.h |  14 +
>  include/uapi/linux/vfio.h   |  37 +++
>  drivers/vfio/pci/vfio_pci.c |  27 +-
>  drivers/vfi

[PATCH v3 9/9] powerpc/traps: Add line prefix in show_instructions()

2018-07-31 Thread Murilo Opsfelder Araujo
Remove "Instruction dump:" line by adding a prefix to display current->comm
and current->pid, along with the instructions dump.

The prefix can serve as a glue that links the instructions dump to its
originator, allowing messages to be interleaved in the logs.

Before this patch, a page fault looked like:

  pandafault[10524]: segfault (11) at 17d0 nip 161c lr 7fffbd295100 
code 2 in pandafault[1000+1]
  Instruction dump:
  4bfffeec 4bfffee8 3c401002 38427f00 fbe1fff8 f821ffc1 7c3f0b78 3d22fffe
  392988d0 f93f0020 e93f0020 39400048 <9949> 3920 7d234b78 383f0040

After this patch, it looks like:

  pandafault[10850]: segfault (11) at 17d0 nip 161c lr 7fff9f3e5100 
code 2 in pandafault[1000+1]
  pandafault[10850]: code: 4bfffeec 4bfffee8 3c401002 38427f00 fbe1fff8 
f821ffc1 7c3f0b78 3d22fffe
  pandafault[10850]: code: 392988d0 f93f0020 e93f0020 39400048 <9949> 
3920 7d234b78 383f0040

Signed-off-by: Murilo Opsfelder Araujo 
---
 arch/powerpc/kernel/process.c | 7 +--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c
index e78799a8855a..d12143e7d8f9 100644
--- a/arch/powerpc/kernel/process.c
+++ b/arch/powerpc/kernel/process.c
@@ -1265,16 +1265,19 @@ static int instructions_to_print = 16;
 void show_instructions(struct pt_regs *regs)
 {
int i;
+   const char *prefix = KERN_INFO "%s[%d]: code: ";
unsigned long pc = regs->nip - (instructions_to_print * 3 / 4 *
sizeof(int));
 
-   printk("Instruction dump:");
+   printk(prefix, current->comm, current->pid);
 
for (i = 0; i < instructions_to_print; i++) {
int instr;
 
-   if (!(i % 8))
+   if (!(i % 8) && (i > 0)) {
pr_cont("\n");
+   printk(prefix, current->comm, current->pid);
+   }
 
 #if !defined(CONFIG_BOOKE)
/* If executing with the IMMU off, adjust pc rather
-- 
2.17.1



[PATCH v3 5/9] powerpc/traps: Print signal name for unhandled signals

2018-07-31 Thread Murilo Opsfelder Araujo
This adds a human-readable name in the unhandled signal message.

Before this patch, a page fault looked like:

  pandafault[6303]: unhandled signal 11 at 17d0 nip 161c lr 
7fff93c55100 code 2 in pandafault[1000+1]

After this patch, a page fault looks like:

  pandafault[6352]: segfault (11) at 13a2a09f8 nip 13a2a086c lr 7fffb63e5100 
code 2 in pandafault[13a2a+1]

Signed-off-by: Murilo Opsfelder Araujo 
---
 arch/powerpc/kernel/traps.c | 39 +++--
 1 file changed, 37 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/kernel/traps.c b/arch/powerpc/kernel/traps.c
index 1c4f06fca370..e71f12bca146 100644
--- a/arch/powerpc/kernel/traps.c
+++ b/arch/powerpc/kernel/traps.c
@@ -96,6 +96,41 @@ EXPORT_SYMBOL(__debugger_fault_handler);
 #define TM_DEBUG(x...) do { } while(0)
 #endif
 
+static const char *signames[SIGRTMIN + 1] = {
+   "UNKNOWN",
+   "SIGHUP",   // 1
+   "SIGINT",   // 2
+   "SIGQUIT",  // 3
+   "SIGILL",   // 4
+   "unhandled trap",   // 5 = SIGTRAP
+   "SIGABRT",  // 6 = SIGIOT
+   "bus error",// 7 = SIGBUS
+   "floating point exception", // 8 = SIGFPE
+   "illegal instruction",  // 9 = SIGILL
+   "SIGUSR1",  // 10
+   "segfault", // 11 = SIGSEGV
+   "SIGUSR2",  // 12
+   "SIGPIPE",  // 13
+   "SIGALRM",  // 14
+   "SIGTERM",  // 15
+   "SIGSTKFLT",// 16
+   "SIGCHLD",  // 17
+   "SIGCONT",  // 18
+   "SIGSTOP",  // 19
+   "SIGTSTP",  // 20
+   "SIGTTIN",  // 21
+   "SIGTTOU",  // 22
+   "SIGURG",   // 23
+   "SIGXCPU",  // 24
+   "SIGXFSZ",  // 25
+   "SIGVTALRM",// 26
+   "SIGPROF",  // 27
+   "SIGWINCH", // 28
+   "SIGIO",// 29 = SIGPOLL = SIGLOST
+   "SIGPWR",   // 30
+   "SIGSYS",   // 31 = SIGUNUSED
+};
+
 /*
  * Trap & Exception support
  */
@@ -314,8 +349,8 @@ static void show_signal_msg(int signr, struct pt_regs 
*regs, int code,
if (!unhandled_signal(current, signr))
return;
 
-   pr_info("%s[%d]: unhandled signal %d at %lx nip %lx lr %lx code %x",
-   current->comm, current->pid, signr,
+   pr_info("%s[%d]: %s (%d) at %lx nip %lx lr %lx code %x",
+   current->comm, current->pid, signames[signr], signr,
addr, regs->nip, regs->link, code);
 
print_vma_addr(KERN_CONT " in ", regs->nip);
-- 
2.17.1



[PATCH v3 7/9] powerpc: Add stacktrace.h header

2018-07-31 Thread Murilo Opsfelder Araujo
Move show_instructions() declaration to
arch/powerpc/include/asm/stacktrace.h and include asm/stracktrace.h in
arch/powerpc/kernel/process.c, which contains the implementation.

This allows show_instructions() to be called on, for example,
show_signal_msg().

Signed-off-by: Murilo Opsfelder Araujo 
---
 arch/powerpc/include/asm/stacktrace.h | 13 +
 arch/powerpc/kernel/process.c |  3 ++-
 2 files changed, 15 insertions(+), 1 deletion(-)
 create mode 100644 arch/powerpc/include/asm/stacktrace.h

diff --git a/arch/powerpc/include/asm/stacktrace.h 
b/arch/powerpc/include/asm/stacktrace.h
new file mode 100644
index ..217ebc52ff97
--- /dev/null
+++ b/arch/powerpc/include/asm/stacktrace.h
@@ -0,0 +1,13 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Stack trace functions.
+ *
+ * Copyright 2018, Murilo Opsfelder Araujo, IBM Corporation.
+ */
+
+#ifndef _ASM_POWERPC_STACKTRACE_H
+#define _ASM_POWERPC_STACKTRACE_H
+
+void show_instructions(struct pt_regs *regs);
+
+#endif /* _ASM_POWERPC_STACKTRACE_H */
diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c
index 50094c44bf79..e78799a8855a 100644
--- a/arch/powerpc/kernel/process.c
+++ b/arch/powerpc/kernel/process.c
@@ -52,6 +52,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -1261,7 +1262,7 @@ struct task_struct *__switch_to(struct task_struct *prev,
 
 static int instructions_to_print = 16;
 
-static void show_instructions(struct pt_regs *regs)
+void show_instructions(struct pt_regs *regs)
 {
int i;
unsigned long pc = regs->nip - (instructions_to_print * 3 / 4 *
-- 
2.17.1



Re: [PATCH 7/7] powerpc/traps: Show instructions on exceptions

2018-07-25 Thread Murilo Opsfelder Araujo
Hi, Christophe.

On Wed, Jul 25, 2018 at 06:01:34PM +0200, LEROY Christophe wrote:
> Murilo Opsfelder Araujo  a écrit :
> 
> > Move show_instructions() declaration to 
> > arch/powerpc/include/asm/stacktrace.h
> > and include asm/stracktrace.h in arch/powerpc/kernel/process.c, which
> > contains
> > the implementation.
> > 
> > Modify show_instructions() not to call __kernel_text_address(), allowing
> > userspace instruction dump.  probe_kernel_address(), which returns -EFAULT 
> > if
> > something goes wrong, is still being called.
> > 
> > Call show_instructions() in arch/powerpc/kernel/traps.c to dump
> > instructions at
> > faulty location, useful to debugging.
> 
> Shouldn't this part be in a second patch ?

Makes sense.  Perhaps I should split this patch in two: one to remove
__kernel_text_address() check in show_instructions(), and another to
call show_instructions() in show_signal_msg().

> Wouldn't it be better to also see regs in addition if we want to use this to
> understand what happened ?
> So you could call show_regs() instead of show_instructions() ?

I see that show_regs() prints more information and calls
show_instructions() at the end if in privileged state.

I'm not sure about which situations we might want to call show_regs() -
and display a bunch of information - or just dump instructions for some
signals.

Isn't calling show_regs() in this case considered overkill?

Cheers
Murilo



Re: [PATCH 2/7] powerpc/traps: Return early in show_signal_msg()

2018-07-25 Thread Murilo Opsfelder Araujo
Hi, Christophe.

On Wed, Jul 25, 2018 at 05:42:28PM +0200, LEROY Christophe wrote:
> Murilo Opsfelder Araujo  a écrit :
> 
> > Modify logic of show_signal_msg() to return early, if possible.  Replace
> > printk_ratelimited() by printk() and a default rate limit burst to limit
> > displaying unhandled signals messages.
> 
> Can you explain more the benefits of this change ?

Mainly is to improve readability of the function.

The conditions to display the message were coupled together in one
single `if` statement.

Besides that, patch 5/7 adds a call to print_vma_addr(), which is not
aware of any rate limit - it simply calls printk().

So splitting out the rate limit check outside show_signal_msg() makes it
easier to the caller decide if it wants to respect a printk rate limit
or not.

Cheers
Murilo



Re: [PATCH 6/7] powerpc/traps: Print signal name for unhandled signals

2018-07-25 Thread Murilo Opsfelder Araujo
Hi, Christophe.

On Wed, Jul 25, 2018 at 05:49:27PM +0200, LEROY Christophe wrote:
> Murilo Opsfelder Araujo  a écrit :
>
> > This adds a human-readable name in the unhandled signal message.
> >
> > Before this patch, a page fault looked like:
> >
> > Jul 11 16:04:11 localhost kernel: pandafault[6303]: unhandled signal
> > 11 at 17d0 nip 161c lr 7fff93c55100 code 2
> > in pandafault[1000+1]
> >
> > After this patch, a page fault looks like:
> >
> > Jul 11 18:14:48 localhost kernel: pandafault[6352]: segfault (11) at
> > 00013a2a09f8 nip 00013a2a086c lr 7fffb63e5100 code 2 in
> > pandafault[13a2a+1]
> >
> > Signed-off-by: Murilo Opsfelder Araujo 
> > ---
> >  arch/powerpc/kernel/traps.c | 43 +
> >  1 file changed, 39 insertions(+), 4 deletions(-)
> >
> > diff --git a/arch/powerpc/kernel/traps.c b/arch/powerpc/kernel/traps.c
> > index e6c43ef9fb50..e55ee639d010 100644
> > --- a/arch/powerpc/kernel/traps.c
> > +++ b/arch/powerpc/kernel/traps.c
> > @@ -96,6 +96,41 @@ EXPORT_SYMBOL(__debugger_fault_handler);
> >  #define TM_DEBUG(x...) do { } while(0)
> >  #endif
> >
> > +static const char *signames[SIGRTMIN + 1] = {
> > +   "UNKNOWN",
> > +   "SIGHUP",   // 1
> > +   "SIGINT",   // 2
> > +   "SIGQUIT",  // 3
> > +   "SIGILL",   // 4
> > +   "unhandled trap",   // 5 = SIGTRAP
> > +   "SIGABRT",  // 6 = SIGIOT
> > +   "bus error",// 7 = SIGBUS
> > +   "floating point exception", // 8 = SIGFPE
> > +   "illegal instruction",  // 9 = SIGILL
> > +   "SIGUSR1",  // 10
> > +   "segfault", // 11 = SIGSEGV
> > +   "SIGUSR2",  // 12
> > +   "SIGPIPE",  // 13
> > +   "SIGALRM",  // 14
> > +   "SIGTERM",  // 15
> > +   "SIGSTKFLT",// 16
> > +   "SIGCHLD",  // 17
> > +   "SIGCONT",  // 18
> > +   "SIGSTOP",  // 19
> > +   "SIGTSTP",  // 20
> > +   "SIGTTIN",  // 21
> > +   "SIGTTOU",  // 22
> > +   "SIGURG",   // 23
> > +   "SIGXCPU",  // 24
> > +   "SIGXFSZ",  // 25
> > +   "SIGVTALRM",// 26
> > +   "SIGPROF",  // 27
> > +   "SIGWINCH", // 28
> > +   "SIGIO",// 29 = SIGPOLL = SIGLOST
> > +   "SIGPWR",   // 30
> > +   "SIGSYS",   // 31 = SIGUNUSED
> > +};
> > +
> >  /*
> >   * Trap & Exception support
> >   */
> > @@ -314,10 +349,10 @@ static void show_signal_msg(int signr, struct
> > pt_regs *regs, int code,
> > if (!unhandled_signal(current, signr))
> > return;
> >
> > -   pr_info("%s[%d]: unhandled signal %d at "REG_FMT \
> > -   " nip "REG_FMT" lr "REG_FMT" code %x",
> > -   current->comm, current->pid, signr, addr,
> > -   regs->nip, regs->link, code);
> > +   pr_info("%s[%d]: %s (%d) at "REG_FMT" nip "REG_FMT \
> > +   " lr "REG_FMT" code %x",
> > +   current->comm, current->pid, signames[signr],
> > +   signr, addr, regs->nip, regs->link, code);
>
> Are we sure that signr is always within the limits of the table ?

Looking at the code, we only pass the following signals:

SIGBUS
SIGFPE
SIGILL
SIGSEGV
SIGTRAP

All of them are within the limits of the table.  We've added other
signals for completeness.

Cheers
Murilo



Re: [PATCH 6/7] powerpc/traps: Print signal name for unhandled signals

2018-07-25 Thread Murilo Opsfelder Araujo
Hi, Gustavo.

On Wed, Jul 25, 2018 at 12:19:00PM -0300, Gustavo Romero wrote:
> Hi Murilo,
> 
> LGTM.
> 
> Just a comment:
> 
> On 07/24/2018 04:27 PM, Murilo Opsfelder Araujo wrote:
> > This adds a human-readable name in the unhandled signal message.
> > 
> > Before this patch, a page fault looked like:
> > 
> >  Jul 11 16:04:11 localhost kernel: pandafault[6303]: unhandled signal 
> > 11 at 17d0 nip 161c lr 7fff93c55100 code 2 in 
> > pandafault[1000+1]
> > 
> > After this patch, a page fault looks like:
> > 
> >  Jul 11 18:14:48 localhost kernel: pandafault[6352]: segfault (11) at 
> > 00013a2a09f8 nip 00013a2a086c lr 7fffb63e5100 code 2 in 
> > pandafault[13a2a+1]
> 
> I _really_ don't want to bikeshed here, but I vouch for keeping the
> "unhandled" word before the signal name, like:
> 
> [...] pandafault[6352]: unhandled segfault (11) at 00013a2a09f8 nip [...]
> 
> because the issue reported here is really that we got a segfault _and_
> there was no handler to catch it.

Either way works for me.

> But feel free to wait for additional comments to decide it.

Sure.  I intend to wait a couple of weeks to respin the series based on
community feedback.

Cheers
Murilo



Re: [PATCH 0/7] powerpc: Modernize unhandled signals message

2018-07-25 Thread Murilo Opsfelder Araujo
Hi, Mikey.

On Wed, Jul 25, 2018 at 05:00:21PM +1000, Michael Neuling wrote:
>  On Tue, 2018-07-24 at 16:27 -0300, Murilo Opsfelder Araujo wrote:
> > Hi, everyone.
> > 
> > This series was inspired by the need to modernize and display more
> > informative messages about unhandled signals.
> > 
> > The "unhandled signal NN" is not very informative.  We thought it would
> > be helpful adding a human-readable message describing what the signal
> > number means, printing the VMA address, and dumping the instructions.
> > 
> > We can add more informative messages, like informing what each code of a
> > SIGSEGV signal means.  We are open to suggestions.
> > 
> > I have collected some early feedback from Michael Ellerman about this
> > series and would love to hear more feedback from you all.
> 
> Nice.. the instruction dump would have been very handy when debugging the PCR
> init issue I had a month or so back.
> 
> > Before this series:
> > 
> > Jul 24 13:01:07 localhost kernel: pandafault[5989]: unhandled signal 11 
> > at 17d0 nip 161c lr 3fff85a75100 code 2
> > 
> > After this series:
> > 
> > Jul 24 13:08:01 localhost kernel: pandafault[10758]: segfault (11) at 
> > 17d0 nip 161c lr 7fffabc85100 code 2 in 
> > pandafault[1000+1]
> > Jul 24 13:08:01 localhost kernel: Instruction dump:
> > Jul 24 13:08:01 localhost kernel: 4bfffeec 4bfffee8 3c401002 38427f00 
> > fbe1fff8 f821ffc1 7c3f0b78 3d22fffe
> > Jul 24 13:08:01 localhost kernel: 392988d0 f93f0020 e93f0020 39400048 
> > <9949> 3920 7d234b78 383f0040
> 
> What happens if we get a sudden flood of these from different processes that
> overlap their output? Are we going to be able to match up the process with
> instruction dump?

As to the flood of messages, ___ratelimit() makes me think that we'll
likely see some warn messages informing how many show_signal_msg()
callbacks were suppressed, instead of interleaved messages and
instruction dumps.

As to matching process with instruction dump, I believe we'd need more
information to glue them together.

What if we modify show_instructions() to accept a string prefix to be
printed along with each line?

> Should we prefix every line with the PID to avoid this?

That's possible.  An alternative would be prefixing each line with the
process name and its PID, as in the first line.  For example:

pandafault[10758]: segfault (11) at 17d0 nip 161c 
lr 7fffabc85100 code 2 in pandafault[1000+1]
pandafault[10758]: Instruction dump:
pandafault[10758]: 4bfffeec 4bfffee8 3c401002 38427f00 fbe1fff8 f821ffc1 
7c3f0b78 3d22fffe
pandafault[10758]: 392988d0 f93f0020 e93f0020 39400048 <9949> 3920 
7d234b78 383f0040

The above can be interleaved with other messages and we'll still be able
to match process and its corresponding instruction dump.

Cheers
Murilo



Re: [v2 PATCH 2/2] powerpc: Enable CPU_FTR_ASYM_SMT for interleaved big-cores

2018-07-04 Thread Murilo Opsfelder Araujo
On Wed, Jul 04, 2018 at 01:45:05PM +0530, Gautham R Shenoy wrote:
> Hi Murilo,
> 
> Thanks for the review.
> 
> On Tue, Jul 03, 2018 at 02:53:46PM -0300, Murilo Opsfelder Araujo wrote:
> [..snip..]
> 
> > > -/* Initialize CPU <=> thread mapping/
> > > + if (has_interleaved_big_core) {
> > > + int key = __builtin_ctzl(CPU_FTR_ASYM_SMT);
> > > +
> > > + cur_cpu_spec->cpu_features |= CPU_FTR_ASYM_SMT;
> > > + static_branch_enable(&cpu_feature_keys[key]);
> > > + pr_info("Detected interleaved big-cores\n");
> > > + }
> > 
> > Shouldn't we use cpu_has_feature(CPU_FTR_ASYM_SMT) before setting
> > > it?
> 
> 
> Are you suggesting that we do the following?
> 
> if (has_interleaved_big_core &&
> !cpu_has_feature(CPU_FTR_ASYM_SMT)) {
>   ...
> }
> 
> Currently CPU_FTR_ASYM_SMT is set at compile time for only POWER7
> where running the tasks on lower numbered threads give us the benefit
> of SMT thread folding. Interleaved big core is a feature introduced
> only on POWER9. Thus, we know that CPU_FTR_ASYM_SMT is not set in
> cpu_features at this point.

Since we're setting CPU_FTR_ASYM_SMT, it doesn't make sense to use
cpu_has_feature(CPU_FTR_ASYM_SMT).  I thought cpu_has_feature() held all
available features (not necessarily enabled) that we could check before
setting or enabling such feature.  I think I misread it.  Sorry.

> 
> > 
> > > +
> > > + /* Initialize CPU <=> thread mapping/
> > >*
> > >* WARNING: We assume that the number of threads is the same for
> > >* every CPU in the system. If that is not the case, then some code
> > > -- 
> > > 1.9.4
> > > 
> > 
> > -- 
> > Murilo
> 
> --
> Thanks and Regards
> gautham.
> 

-- 
Murilo



Re: [PATCH] perf session: Fix undeclared 'oe'

2018-04-30 Thread Murilo Opsfelder Araujo
On 04/30/2018 02:49 PM, Greg Kroah-Hartman wrote:
> On Mon, Apr 30, 2018 at 10:20:08AM -0700, Greg Kroah-Hartman wrote:
>> On Mon, Apr 30, 2018 at 02:11:55PM -0300, Murilo Opsfelder Araujo wrote:
>>> On 04/11/2018 05:21 PM, Murilo Opsfelder Araújo wrote:
>>>> On 04/11/2018 04:33 PM, Greg Kroah-Hartman wrote:
>>>>> On Wed, Apr 11, 2018 at 03:41:35PM -0300, Murilo Opsfelder Araujo wrote:
>>>>>> Using linux-3.18.y branch, perf build fails with the following:
>>>>>>
>>>>>> $ make -s -j16 -C tools/perf V=1 WERROR=0 NO_LIBUNWIND=1 
>>>>>> HAVE_CPLUS_DEMANGLE=1 NO_GTK2=1 NO_LIBNUMA=1 NO_STRLCPY=1 NO_BIONIC=1 
>>>>>> prefix=/usr DESTDIR=/tmp/builddir/build all
>>>>>> [...]
>>>>>> util/session.c: In function ‘__perf_session__process_pipe_events’:
>>>>>> util/session.c:1093:36: error: ‘oe’ undeclared (first use in this 
>>>>>> function)
>>>>>>   ordered_events__set_copy_on_queue(oe, true);
>>>>>> ^
>>>>>> util/session.c:1093:36: note: each undeclared identifier is reported 
>>>>>> only once for each function it appears in
>>>>>>
>>>>>> This patch fixes it for linux-3.18.y branch.
>>>>>
>>>>> Why is this failing now?  Has it always been broken?  Is there an
>>>>> upstream patch that fixed this instead?
>>>>>
>>>>
>>>> Hi, Greg.
>>>>
>>>> We've caught this build issue this week. I'm not sure since when it's
>>>> failing.
>>>>
>>>> The upstream patch that fixes this is:
>>>>
>>>> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=fa713a4eb9cebe5dec71b1bd11429603e17d841d
>>>>
>>>> commit fa713a4eb9cebe5dec71b1bd11429603e17d841d
>>>> Author: Arnaldo Carvalho de Melo 
>>>> Date:   Tue Mar 3 11:48:12 2015 -0300
>>>>
>>>> perf ordered_events: Untangle from perf_session
>>>>
>>>> But it doesn't apply straightforwardly.  At
>>>> fa713a4eb9cebe5dec71b1bd11429603e17d841d, perf API and perf_evlist
>>>> struct are slightly different from linux-3.18.y.
>>>>
>>>> A list of upstream patches for a clean backport (I think) would be:
>>>>
>>>> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=54245fdc357613633954bfd38cffb71cb9def067
>>>>
>>>> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=75be989a7a18e9666efd92b846ee48bed79e8086
>>>>
>>>> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=313e53b08e99b1dacf9ea2b0fbe97890db1ea95f
>>>>
>>>> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=9fa8727aa4d98d35ca50ef9cd8a50c6468af921d
>>>>
>>>> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=fa713a4eb9cebe5dec71b1bd11429603e17d841d
>>>>
>>>> Do you prefer all above patches backported to linux-3.18.y or just the
>>>> one-line fix I sent?
>>>>
>>>>>> Fixes: 95b33b99cdd6 ("perf inject: Copy events when reordering events in 
>>>>>> pipe mode")
>>>>>
>>>>> Was this just a bad backport?
>>>>
>>>> Some patches were left behind, I guess.
>>>>
>>>>>
>>>>> thanks,
>>>>>
>>>>> greg k-h
>>>
>>> Hi, Greg.
>>>
>>> I've realized that perf build on v3.18.107 is still broken, actually, it
>>> got a bit worse than v3.18.104.
>>>
>>> After applying my patch to fix the undeclared 'oe', perf build fails
>>> with the following errors:
>>>
>>> $ make -s -j16 -C tools/perf V=1 WERROR=0 NO_LIBUNWIND=1
>>> HAVE_CPLUS_DEMANGLE=1 NO_GTK2=1 NO_LIBNUMA=1 NO_STRLCPY=1 NO_BIONIC=1
>>> prefix=/usr DESTDIR=/tmp/builddir/build all
>>> [...]
>>> tests/code-reading.c: In function ‘read_object_code’:
>>> tests/code-reading.c:145:19: error: ‘KMOD_DECOMP_LEN’ undeclared (first
>>> use in this function)
>>>   char decomp_name[KMOD_DECOMP_LEN];
>>>^
>>> tests/code-reading.c:145:19: note: each undeclared identifier is
>>> reported only once for each function it appear

Re: [PATCH] perf session: Fix undeclared 'oe'

2018-04-30 Thread Murilo Opsfelder Araujo
On 04/11/2018 05:21 PM, Murilo Opsfelder Araújo wrote:
> On 04/11/2018 04:33 PM, Greg Kroah-Hartman wrote:
>> On Wed, Apr 11, 2018 at 03:41:35PM -0300, Murilo Opsfelder Araujo wrote:
>>> Using linux-3.18.y branch, perf build fails with the following:
>>>
>>> $ make -s -j16 -C tools/perf V=1 WERROR=0 NO_LIBUNWIND=1 
>>> HAVE_CPLUS_DEMANGLE=1 NO_GTK2=1 NO_LIBNUMA=1 NO_STRLCPY=1 NO_BIONIC=1 
>>> prefix=/usr DESTDIR=/tmp/builddir/build all
>>> [...]
>>> util/session.c: In function ‘__perf_session__process_pipe_events’:
>>> util/session.c:1093:36: error: ‘oe’ undeclared (first use in this 
>>> function)
>>>   ordered_events__set_copy_on_queue(oe, true);
>>> ^
>>> util/session.c:1093:36: note: each undeclared identifier is reported 
>>> only once for each function it appears in
>>>
>>> This patch fixes it for linux-3.18.y branch.
>>
>> Why is this failing now?  Has it always been broken?  Is there an
>> upstream patch that fixed this instead?
>>
> 
> Hi, Greg.
> 
> We've caught this build issue this week. I'm not sure since when it's
> failing.
> 
> The upstream patch that fixes this is:
> 
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=fa713a4eb9cebe5dec71b1bd11429603e17d841d
> 
> commit fa713a4eb9cebe5dec71b1bd11429603e17d841d
> Author: Arnaldo Carvalho de Melo 
> Date:   Tue Mar 3 11:48:12 2015 -0300
> 
> perf ordered_events: Untangle from perf_session
> 
> But it doesn't apply straightforwardly.  At
> fa713a4eb9cebe5dec71b1bd11429603e17d841d, perf API and perf_evlist
> struct are slightly different from linux-3.18.y.
> 
> A list of upstream patches for a clean backport (I think) would be:
> 
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=54245fdc357613633954bfd38cffb71cb9def067
> 
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=75be989a7a18e9666efd92b846ee48bed79e8086
> 
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=313e53b08e99b1dacf9ea2b0fbe97890db1ea95f
> 
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=9fa8727aa4d98d35ca50ef9cd8a50c6468af921d
> 
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=fa713a4eb9cebe5dec71b1bd11429603e17d841d
> 
> Do you prefer all above patches backported to linux-3.18.y or just the
> one-line fix I sent?
> 
>>> Fixes: 95b33b99cdd6 ("perf inject: Copy events when reordering events in 
>>> pipe mode")
>>
>> Was this just a bad backport?
> 
> Some patches were left behind, I guess.
> 
>>
>> thanks,
>>
>> greg k-h

Hi, Greg.

I've realized that perf build on v3.18.107 is still broken, actually, it
got a bit worse than v3.18.104.

After applying my patch to fix the undeclared 'oe', perf build fails
with the following errors:

$ make -s -j16 -C tools/perf V=1 WERROR=0 NO_LIBUNWIND=1
HAVE_CPLUS_DEMANGLE=1 NO_GTK2=1 NO_LIBNUMA=1 NO_STRLCPY=1 NO_BIONIC=1
prefix=/usr DESTDIR=/tmp/builddir/build all
[...]
tests/code-reading.c: In function ‘read_object_code’:
tests/code-reading.c:145:19: error: ‘KMOD_DECOMP_LEN’ undeclared (first
use in this function)
  char decomp_name[KMOD_DECOMP_LEN];
   ^
tests/code-reading.c:145:19: note: each undeclared identifier is
reported only once for each function it appears in
tests/code-reading.c:208:2: warning: implicit declaration of function
‘dso__needs_decompress’ [-Wimplicit-function-declaration]
  if (dso__needs_decompress(al.map->dso)) {
  ^
tests/code-reading.c:208:2: warning: nested extern declaration of
‘dso__needs_decompress’ [-Wnested-externs]
tests/code-reading.c:209:3: warning: implicit declaration of function
‘dso__decompress_kmodule_path’ [-Wimplicit-function-declaration]
   if (dso__decompress_kmodule_path(al.map->dso, objdump_name,
   ^
tests/code-reading.c:209:3: warning: nested extern declaration of
‘dso__decompress_kmodule_path’ [-Wnested-externs]
tests/code-reading.c:145:7: warning: unused variable ‘decomp_name’
[-Wunused-variable]
  char decomp_name[KMOD_DECOMP_LEN];
   ^

Apparently, this was introduced by commit
091b3b4ba55daf8b28f40794aefdaa0bdb5af7a1:

commit 091b3b4ba55daf8b28f40794aefdaa0bdb5af7a1
Author: Namhyung Kim 
Date:   Thu Jun 8 16:31:07 2017 +0900

perf tests: Decompress kernel module before objdump


Namhyung, are you fixing this?

Cheers
Murilo



[PATCH] perf session: Fix undeclared 'oe'

2018-04-11 Thread Murilo Opsfelder Araujo
Using linux-3.18.y branch, perf build fails with the following:

$ make -s -j16 -C tools/perf V=1 WERROR=0 NO_LIBUNWIND=1 
HAVE_CPLUS_DEMANGLE=1 NO_GTK2=1 NO_LIBNUMA=1 NO_STRLCPY=1 NO_BIONIC=1 
prefix=/usr DESTDIR=/tmp/builddir/build all
[...]
util/session.c: In function ‘__perf_session__process_pipe_events’:
util/session.c:1093:36: error: ‘oe’ undeclared (first use in this function)
  ordered_events__set_copy_on_queue(oe, true);
^
util/session.c:1093:36: note: each undeclared identifier is reported only 
once for each function it appears in

This patch fixes it for linux-3.18.y branch.

Fixes: 95b33b99cdd6 ("perf inject: Copy events when reordering events in pipe 
mode")
Cc:  # 3.18.x
Cc: Alexander Shishkin 
Cc: Andi Kleen 
Cc: Arnaldo Carvalho de Melo 
Cc: David Carrillo-Cisneros 
Cc: Greg Kroah-Hartman 
Cc: He Kuang 
Cc: Ingo Molnar 
Cc: Jiri Olsa 
Cc: Masami Hiramatsu 
Cc: Paul Mackerras 
Cc: Paul Turner 
Cc: Peter Zijlstra 
Cc: Sasha Levin 
Cc: Simon Que 
Cc: Stephane Eranian 
Cc: Wang Nan 
Signed-off-by: Murilo Opsfelder Araujo 
---
 tools/perf/util/session.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c
index dc3d3b1b813e..c2d4a7ec40df 100644
--- a/tools/perf/util/session.c
+++ b/tools/perf/util/session.c
@@ -1073,6 +1073,7 @@ volatile int session_done;
 static int __perf_session__process_pipe_events(struct perf_session *session,
   struct perf_tool *tool)
 {
+   struct ordered_events *oe = &session->ordered_events;
int fd = perf_data_file__fd(session->file);
union perf_event *event;
uint32_t size, cur_size = 0;
-- 
2.14.3



[PATCH v2] include/linux/vfio.h: Guard powerpc-specific functions with CONFIG_VFIO_SPAPR_EEH

2017-07-18 Thread Murilo Opsfelder Araujo
When CONFIG_EEH=y and CONFIG_VFIO_SPAPR_EEH=n, build fails with the
following:

drivers/vfio/pci/vfio_pci.o: In function `.vfio_pci_release':
vfio_pci.c:(.text+0xa98): undefined reference to 
`.vfio_spapr_pci_eeh_release'
drivers/vfio/pci/vfio_pci.o: In function `.vfio_pci_open':
vfio_pci.c:(.text+0x1420): undefined reference to `.vfio_spapr_pci_eeh_open'

In this case, vfio_pci.c should use the empty definitions of
vfio_spapr_pci_eeh_open and vfio_spapr_pci_eeh_release functions.

This patch fixes it by guarding these function definitions with
CONFIG_VFIO_SPAPR_EEH, the symbol that controls whether vfio_spapr_eeh.c is
built, which is where the non-empty versions of these functions are. We need to
make use of IS_ENABLED() macro because CONFIG_VFIO_SPAPR_EEH is a tristate
option.

This issue was found during a randconfig build. Logs are here:

http://kisskb.ellerman.id.au/kisskb/buildresult/12982362/

Signed-off-by: Murilo Opsfelder Araujo 
---

Changes from v1:
- Rebased on top of next-20170718.

 include/linux/vfio.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/linux/vfio.h b/include/linux/vfio.h
index 586809a..a47b985 100644
--- a/include/linux/vfio.h
+++ b/include/linux/vfio.h
@@ -152,7 +152,7 @@ extern int vfio_set_irqs_validate_and_prepare(struct 
vfio_irq_set *hdr,
  size_t *data_size);

 struct pci_dev;
-#ifdef CONFIG_EEH
+#if IS_ENABLED(CONFIG_VFIO_SPAPR_EEH)
 extern void vfio_spapr_pci_eeh_open(struct pci_dev *pdev);
 extern void vfio_spapr_pci_eeh_release(struct pci_dev *pdev);
 extern long vfio_spapr_iommu_eeh_ioctl(struct iommu_group *group,
@@ -173,7 +173,7 @@ static inline long vfio_spapr_iommu_eeh_ioctl(struct 
iommu_group *group,
 {
return -ENOTTY;
 }
-#endif /* CONFIG_EEH */
+#endif /* CONFIG_VFIO_SPAPR_EEH */

 /*
  * IRQfd - generic
--
2.9.4


[PATCH v2] include/linux/vfio.h: Guard powerpc-specific functions with CONFIG_VFIO_SPAPR_EEH

2017-06-07 Thread Murilo Opsfelder Araujo
When CONFIG_EEH=y and CONFIG_VFIO_SPAPR_EEH=n, build fails with the
following:

drivers/vfio/pci/vfio_pci.o: In function `.vfio_pci_release':
vfio_pci.c:(.text+0xa98): undefined reference to 
`.vfio_spapr_pci_eeh_release'
drivers/vfio/pci/vfio_pci.o: In function `.vfio_pci_open':
vfio_pci.c:(.text+0x1420): undefined reference to `.vfio_spapr_pci_eeh_open'

In this case, vfio_pci.c should use the empty definitions of
vfio_spapr_pci_eeh_open and vfio_spapr_pci_eeh_release functions.

This patch fixes it by guarding these function definitions with
CONFIG_VFIO_SPAPR_EEH, the symbol that controls whether vfio_spapr_eeh.c is
built, which is where the non-empty versions of these functions are. We need to
make use of IS_ENABLED() macro because CONFIG_VFIO_SPAPR_EEH is a tristate
option.

This issue was found during a randconfig build. Logs are here:

http://kisskb.ellerman.id.au/kisskb/buildresult/12982362/

Signed-off-by: Murilo Opsfelder Araujo 
---
v1..v2:
- Make use of IS_ENABLED() macro because CONFIG_VFIO_SPAPR_EEH is a tristate
  option (fix http://www.spinics.net/lists/kvm/msg151032.html).

 include/linux/vfio.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/linux/vfio.h b/include/linux/vfio.h
index edf9b2c..92232f73 100644
--- a/include/linux/vfio.h
+++ b/include/linux/vfio.h
@@ -150,7 +150,7 @@ extern int vfio_set_irqs_validate_and_prepare(struct 
vfio_irq_set *hdr,
  size_t *data_size);
 
 struct pci_dev;
-#ifdef CONFIG_EEH
+#if IS_ENABLED(CONFIG_VFIO_SPAPR_EEH)
 extern void vfio_spapr_pci_eeh_open(struct pci_dev *pdev);
 extern void vfio_spapr_pci_eeh_release(struct pci_dev *pdev);
 extern long vfio_spapr_iommu_eeh_ioctl(struct iommu_group *group,
@@ -171,7 +171,7 @@ static inline long vfio_spapr_iommu_eeh_ioctl(struct 
iommu_group *group,
 {
return -ENOTTY;
 }
-#endif /* CONFIG_EEH */
+#endif /* CONFIG_VFIO_SPAPR_EEH */
 
 /*
  * IRQfd - generic
-- 
2.9.4



[PATCH] include/linux/vfio.h: Guard powerpc-specific functions with CONFIG_VFIO_SPAPR_EEH

2017-06-06 Thread Murilo Opsfelder Araujo
When CONFIG_EEH=y and CONFIG_VFIO_SPAPR_EEH=n, build fails with the
following:

drivers/vfio/pci/vfio_pci.o: In function `.vfio_pci_release':
vfio_pci.c:(.text+0xa98): undefined reference to 
`.vfio_spapr_pci_eeh_release'
drivers/vfio/pci/vfio_pci.o: In function `.vfio_pci_open':
vfio_pci.c:(.text+0x1420): undefined reference to `.vfio_spapr_pci_eeh_open'

In this case, vfio_pci.c should use the empty definitions of
vfio_spapr_pci_eeh_open and vfio_spapr_pci_eeh_release functions.

This patch fixes it by guarding these function definitions with
CONFIG_VFIO_SPAPR_EEH, the symbol that controls whether vfio_spapr_eeh.c is
built, which is where the non-empty versions of these functions are.

This issue was found during a randconfig build. Logs are here:

http://kisskb.ellerman.id.au/kisskb/buildresult/12982362/

Signed-off-by: Murilo Opsfelder Araujo 
---
 include/linux/vfio.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/linux/vfio.h b/include/linux/vfio.h
index edf9b2c..0a05d57 100644
--- a/include/linux/vfio.h
+++ b/include/linux/vfio.h
@@ -150,7 +150,7 @@ extern int vfio_set_irqs_validate_and_prepare(struct 
vfio_irq_set *hdr,
  size_t *data_size);
 
 struct pci_dev;
-#ifdef CONFIG_EEH
+#ifdef CONFIG_VFIO_SPAPR_EEH
 extern void vfio_spapr_pci_eeh_open(struct pci_dev *pdev);
 extern void vfio_spapr_pci_eeh_release(struct pci_dev *pdev);
 extern long vfio_spapr_iommu_eeh_ioctl(struct iommu_group *group,
@@ -171,7 +171,7 @@ static inline long vfio_spapr_iommu_eeh_ioctl(struct 
iommu_group *group,
 {
return -ENOTTY;
 }
-#endif /* CONFIG_EEH */
+#endif /* CONFIG_VFIO_SPAPR_EEH */
 
 /*
  * IRQfd - generic
-- 
2.9.4



[PATCH] Update MAINTAINERS

2017-06-01 Thread Murilo Opsfelder Araujo
drivers/watchdog/wdrtas.c is of insterest of linuxppc maintainers.

Signed-off-by: Murilo Opsfelder Araujo 
---
 MAINTAINERS | 1 +
 1 file changed, 1 insertion(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index 9609ca6..3f05927 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -7670,6 +7670,7 @@ F:drivers/pci/hotplug/rpa*
 F: drivers/rtc/rtc-opal.c
 F: drivers/scsi/ibmvscsi/
 F: drivers/tty/hvc/hvc_opal.c
+F: drivers/watchdog/wdrtas.c
 F: tools/testing/selftests/powerpc
 N: /pmac
 N: powermac
-- 
2.9.4



[PATCH v2] drivers/watchdog/Kconfig: Update CONFIG_WATCHDOG_RTAS dependencies

2017-05-29 Thread Murilo Opsfelder Araujo
drivers/watchdog/wdrtas.c uses symbols defined in arch/powerpc/kernel/rtas.c,
which are exported iff CONFIG_PPC_RTAS is selected. Building wdrtas.c without
setting CONFIG_PPC_RTAS throws the following errors:

ERROR: ".rtas_token" [drivers/watchdog/wdrtas.ko] undefined!
ERROR: "rtas_data_buf" [drivers/watchdog/wdrtas.ko] undefined!
ERROR: "rtas_data_buf_lock" [drivers/watchdog/wdrtas.ko] undefined!
ERROR: ".rtas_get_sensor" [drivers/watchdog/wdrtas.ko] undefined!
ERROR: ".rtas_call" [drivers/watchdog/wdrtas.ko] undefined!

This was identified during a randconfig build where CONFIG_WATCHDOG_RTAS=m and
CONFIG_PPC_RTAS was not set. Logs are here:

http://kisskb.ellerman.id.au/kisskb/buildresult/12982152/

This patch fixes the issue by updating CONFIG_WATCHDOG_RTAS to depend on just
CONFIG_PPC_RTAS, removing COMPILE_TEST entirely.

Signed-off-by: Murilo Opsfelder Araujo 
---
 drivers/watchdog/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig
index 8b9049d..e6e31a1 100644
--- a/drivers/watchdog/Kconfig
+++ b/drivers/watchdog/Kconfig
@@ -1688,7 +1688,7 @@ config MEN_A21_WDT
 
 config WATCHDOG_RTAS
tristate "RTAS watchdog"
-   depends on PPC_RTAS || (PPC64 && COMPILE_TEST)
+   depends on PPC_RTAS
help
  This driver adds watchdog support for the RTAS watchdog.
 
-- 
2.9.4



[PATCH] drivers/watchdog/Kconfig: Update CONFIG_WATCHDOG_RTAS dependencies

2017-05-26 Thread Murilo Opsfelder Araujo
drivers/watchdog/wdrtas.c uses symbols defined in arch/powerpc/kernel/rtas.c,
which are exported iff CONFIG_PPC_RTAS is selected. Building wdrtas.c without
setting CONFIG_PPC_RTAS throws the following errors:

ERROR: ".rtas_token" [drivers/watchdog/wdrtas.ko] undefined!
ERROR: "rtas_data_buf" [drivers/watchdog/wdrtas.ko] undefined!
ERROR: "rtas_data_buf_lock" [drivers/watchdog/wdrtas.ko] undefined!
ERROR: ".rtas_get_sensor" [drivers/watchdog/wdrtas.ko] undefined!
ERROR: ".rtas_call" [drivers/watchdog/wdrtas.ko] undefined!

This was identified during a randconfig build where CONFIG_WATCHDOG_RTAS=m and
CONFIG_PPC_RTAS was not set. Logs are here:

http://kisskb.ellerman.id.au/kisskb/buildresult/12982152/

This patch fixes the issue by selecting CONFIG_PPC_RTAS when
CONFIG_WATCHDOG_RTAS is set.

Signed-off-by: Murilo Opsfelder Araujo 
---
 drivers/watchdog/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig
index 8b9049d..5d872145 100644
--- a/drivers/watchdog/Kconfig
+++ b/drivers/watchdog/Kconfig
@@ -1689,6 +1689,7 @@ config MEN_A21_WDT
 config WATCHDOG_RTAS
tristate "RTAS watchdog"
depends on PPC_RTAS || (PPC64 && COMPILE_TEST)
+   select PPC_RTAS
help
  This driver adds watchdog support for the RTAS watchdog.
 
-- 
2.9.4



[PATCH] xen/tmem: Pass page instead of pfn to xen_tmem_get_page()

2015-08-19 Thread Murilo Opsfelder Araujo
The commit 091208a676dfdabb2b8fe86ee155c6fc80081b69 "xen/tmem: Use
xen_page_to_gfn rather than pfn_to_gfn" left behind a call to
xen_tmem_get_page() receiving pfn instead of page.

This change also fixes the following build warning:

drivers/xen/tmem.c: In function ‘tmem_cleancache_get_page’:
drivers/xen/tmem.c:194:47: warning: passing argument 4 of ‘xen_tmem_get_page’ 
makes pointer from integer without a cast
  ret = xen_tmem_get_page((u32)pool, oid, ind, pfn);
   ^
drivers/xen/tmem.c:138:12: note: expected ‘struct page *’ but argument is of 
type ‘long unsigned int’
 static int xen_tmem_get_page(u32 pool_id, struct tmem_oid oid,
^

Signed-off-by: Murilo Opsfelder Araujo 
---
 drivers/xen/tmem.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/xen/tmem.c b/drivers/xen/tmem.c
index b0c895e..945fc43 100644
--- a/drivers/xen/tmem.c
+++ b/drivers/xen/tmem.c
@@ -183,7 +183,6 @@ static int tmem_cleancache_get_page(int pool, struct 
cleancache_filekey key,
 {
u32 ind = (u32) index;
struct tmem_oid oid = *(struct tmem_oid *)&key;
-   unsigned long pfn = page_to_pfn(page);
int ret;
 
/* translate return values to linux semantics */
@@ -191,7 +190,7 @@ static int tmem_cleancache_get_page(int pool, struct 
cleancache_filekey key,
return -1;
if (ind != index)
return -1;
-   ret = xen_tmem_get_page((u32)pool, oid, ind, pfn);
+   ret = xen_tmem_get_page((u32)pool, oid, ind, page);
if (ret == 1)
return 0;
else
-- 
2.1.4

--
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] security/smack/smack_lsm.c: Fix build error when CONFIG_SECURITY_SMACK_BRINGUP is not defined

2015-08-13 Thread Murilo Opsfelder Araujo
This change fixes the following build error when
CONFIG_SECURITY_SMACK_BRINGUP is not defined:

security/smack/smack_lsm.c: In function ‘smack_parse_opts_str’:
security/smack/smack_lsm.c:618:26: error: ‘tokens’ undeclared (first use in 
this function)
   token = match_token(p, tokens, args);
  ^
security/smack/smack_lsm.c:618:26: note: each undeclared identifier is reported 
only once for each function it appears in

The above has been introduced by commit
3bf2789cad9e6573dc19a6c3d123c2c049f2d90f "smack: allow mount opts setting over 
filesystems with binary mount data".

Signed-off-by: Murilo Opsfelder Araujo 
---
 security/smack/smack_lsm.c | 16 
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/security/smack/smack_lsm.c b/security/smack/smack_lsm.c
index 54fb3a1..6201907 100644
--- a/security/smack/smack_lsm.c
+++ b/security/smack/smack_lsm.c
@@ -57,14 +57,6 @@ LIST_HEAD(smk_ipv6_port_list);
 static struct kmem_cache *smack_inode_cache;
 int smack_enabled;
 
-#ifdef CONFIG_SECURITY_SMACK_BRINGUP
-static char *smk_bu_mess[] = {
-   "Bringup Error",/* Unused */
-   "Bringup",  /* SMACK_BRINGUP_ALLOW */
-   "Unconfined Subject",   /* SMACK_UNCONFINED_SUBJECT */
-   "Unconfined Object",/* SMACK_UNCONFINED_OBJECT */
-};
-
 static const match_table_t tokens = {
{Opt_fsdefault, SMK_FSDEFAULT "%s"},
{Opt_fsfloor, SMK_FSFLOOR "%s"},
@@ -74,6 +66,14 @@ static const match_table_t tokens = {
{Opt_error, NULL},
 };
 
+#ifdef CONFIG_SECURITY_SMACK_BRINGUP
+static char *smk_bu_mess[] = {
+   "Bringup Error",/* Unused */
+   "Bringup",  /* SMACK_BRINGUP_ALLOW */
+   "Unconfined Subject",   /* SMACK_UNCONFINED_SUBJECT */
+   "Unconfined Object",/* SMACK_UNCONFINED_OBJECT */
+};
+
 static void smk_bu_mode(int mode, char *s)
 {
int i = 0;
-- 
2.1.4

--
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] drivers: clk: clk.c: Add comments indicating the matching #ifdef blocks

2015-05-06 Thread Murilo Opsfelder Araujo
Signed-off-by: Murilo Opsfelder Araujo 
---
 drivers/clk/clk.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
index 087a092..a961eb6 100644
--- a/drivers/clk/clk.c
+++ b/drivers/clk/clk.c
@@ -2226,7 +2226,7 @@ static inline void clk_debug_reparent(struct clk_core 
*core,
 static inline void clk_debug_unregister(struct clk_core *core)
 {
 }
-#endif
+#endif /* CONFIG_DEBUG_FS */
 
 static bool clk_is_orphan(const struct clk *clk)
 {
@@ -3144,4 +3144,4 @@ void __init of_clk_init(const struct of_device_id 
*matches)
force = true;
}
 }
-#endif
+#endif /* CONFIG_OF */
-- 
2.1.4

--
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/2] Small adjustments in drivers/clk/clk.c

2015-05-06 Thread Murilo Opsfelder Araujo
The first patch just improves code readability by addig comments after
#endif statements; the second one gets rid of a warning message during
kernel build.

Murilo Opsfelder Araujo (2):
  drivers: clk: clk.c: Add comments indicating the matching #ifdef
blocks
  drivers: clk: clk.c: Make clk_is_orphan() dependent of CONFIG_OF

 drivers/clk/clk.c | 20 ++--
 1 file changed, 10 insertions(+), 10 deletions(-)

--
2.1.4
--
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] drivers: clk: clk.c: Make clk_is_orphan() dependent of CONFIG_OF

2015-05-06 Thread Murilo Opsfelder Araujo
The function clk_is_orphan() is called only by
__of_clk_get_from_provider(), which depends on CONFIG_OF, so it does
make sense the move.

This change also gets rid of the following build message when CONFIG_OF
is not set:

drivers/clk/clk.c:2231:13: warning: ‘clk_is_orphan’ defined but not used 
[-Wunused-function]

Signed-off-by: Murilo Opsfelder Araujo 
---
 drivers/clk/clk.c | 16 
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
index a961eb6..d748aa2 100644
--- a/drivers/clk/clk.c
+++ b/drivers/clk/clk.c
@@ -2228,14 +2228,6 @@ static inline void clk_debug_unregister(struct clk_core 
*core)
 }
 #endif /* CONFIG_DEBUG_FS */
 
-static bool clk_is_orphan(const struct clk *clk)
-{
-   if (!clk)
-   return false;
-
-   return clk->core->orphan;
-}
-
 /**
  * __clk_init - initialize the data structures in a struct clk
  * @dev:   device initializing this clk, placeholder for now
@@ -2950,6 +2942,14 @@ void of_clk_del_provider(struct device_node *np)
 }
 EXPORT_SYMBOL_GPL(of_clk_del_provider);
 
+static bool clk_is_orphan(const struct clk *clk)
+{
+   if (!clk)
+   return false;
+
+   return clk->core->orphan;
+}
+
 struct clk *__of_clk_get_from_provider(struct of_phandle_args *clkspec,
   const char *dev_id, const char *con_id)
 {
-- 
2.1.4

--
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] staging: rtl8192u: r8192U_core: Fix compile issue when CONFIG_WIRELESS_EXT is not defined

2015-01-24 Thread Murilo Opsfelder Araujo
This patch gets rid of the following error when compiling r8192U_core.c
and CONFIG_WIRELESS_EXT is not defined:

drivers/staging/rtl8192u/r8192U_core.c: In function ‘rtl8192_usb_probe’:
drivers/staging/rtl8192u/r8192U_core.c:4697:5: error: ‘struct net_device’ has 
no member named ‘wireless_handlers’
  dev->wireless_handlers = (struct iw_handler_def *) &r8192_wx_handlers_def;
 ^

Signed-off-by: Murilo Opsfelder Araujo 
---
 drivers/staging/rtl8192u/r8192U_core.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/staging/rtl8192u/r8192U_core.c 
b/drivers/staging/rtl8192u/r8192U_core.c
index e031a25..396a11f 100644
--- a/drivers/staging/rtl8192u/r8192U_core.c
+++ b/drivers/staging/rtl8192u/r8192U_core.c
@@ -4694,7 +4694,9 @@ static int rtl8192_usb_probe(struct usb_interface *intf,
 
dev->netdev_ops = &rtl8192_netdev_ops;
 
+#ifdef CONFIG_WIRELESS_EXT
dev->wireless_handlers = (struct iw_handler_def *) 
&r8192_wx_handlers_def;
+#endif
 
dev->type = ARPHRD_ETHER;
 
-- 
2.1.0

--
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] gpio: sx150x: Fix compile issue when CONFIG_OF_GPIO is not defined

2015-01-22 Thread Murilo Opsfelder Araujo
Without this patch, the compilation of gpio-sx150x.c fails because
struct gpio_chip members 'of_node' and 'of_gpio_n_cells' do not exist
when CONFIG_OF_GPIO is not defined:

drivers/gpio/gpio-sx150x.c: In function ‘sx150x_init_chip’:
drivers/gpio/gpio-sx150x.c:487:17: error: ‘struct gpio_chip’ has no member 
named ‘of_node’
  chip->gpio_chip.of_node  = client->dev.of_node;
 ^
drivers/gpio/gpio-sx150x.c:488:17: error: ‘struct gpio_chip’ has no member 
named ‘of_gpio_n_cells’
  chip->gpio_chip.of_gpio_n_cells  = 2;
 ^

This issue was introduced by the commit
04d2264c3bf07f5c3d18165ba78de0a93360c6c0 "gpio: sx150x: add dts support for 
sx150x driver".

Signed-off-by: Murilo Opsfelder Araujo 
---
 drivers/gpio/gpio-sx150x.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/gpio/gpio-sx150x.c b/drivers/gpio/gpio-sx150x.c
index 88012e2..b1e2f1c 100644
--- a/drivers/gpio/gpio-sx150x.c
+++ b/drivers/gpio/gpio-sx150x.c
@@ -484,8 +484,10 @@ static void sx150x_init_chip(struct sx150x_chip *chip,
chip->gpio_chip.base = pdata->gpio_base;
chip->gpio_chip.can_sleep= true;
chip->gpio_chip.ngpio= chip->dev_cfg->ngpios;
+#ifdef CONFIG_OF_GPIO
chip->gpio_chip.of_node  = client->dev.of_node;
chip->gpio_chip.of_gpio_n_cells  = 2;
+#endif
if (pdata->oscio_is_gpo)
++chip->gpio_chip.ngpio;
 
-- 
2.1.0

--
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] staging: olpc_dcon: fix sparse symbol not declared warning

2015-01-15 Thread Murilo Opsfelder Araujo
This patch gets rid of the following sparse warning:

drivers/staging/olpc_dcon/olpc_dcon.c:787:19: warning: symbol 'dcon_driver' was 
not declared. Should it be static?

Signed-off-by: Murilo Opsfelder Araujo 
---
 drivers/staging/olpc_dcon/olpc_dcon.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/olpc_dcon/olpc_dcon.c 
b/drivers/staging/olpc_dcon/olpc_dcon.c
index 3708f1e..4ec2a9c 100644
--- a/drivers/staging/olpc_dcon/olpc_dcon.c
+++ b/drivers/staging/olpc_dcon/olpc_dcon.c
@@ -784,7 +784,7 @@ static const struct i2c_device_id dcon_idtable[] = {
 };
 MODULE_DEVICE_TABLE(i2c, dcon_idtable);
 
-struct i2c_driver dcon_driver = {
+static struct i2c_driver dcon_driver = {
.driver = {
.name   = "olpc_dcon",
.pm = &dcon_pm_ops,
-- 
2.1.0

--
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/2] staging: olpc_dcon: fix sparse warnings and compile errors

2015-01-15 Thread Murilo Opsfelder Araujo
These two patches fix sparse warnings and make olpc_dcon.c build again
when CONFIG_OLPC is not set.

Murilo Opsfelder Araujo (2):
  staging: olpc_dcon: check for CONFIG_OLPC before calling
olpc_board_at_least()
  staging: olpc_dcon: fix sparse symbol not declared warning

 drivers/staging/olpc_dcon/olpc_dcon.c | 9 -
 1 file changed, 8 insertions(+), 1 deletion(-)

--
2.1.0
--
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] staging: olpc_dcon: check for CONFIG_OLPC before calling olpc_board_at_least()

2015-01-15 Thread Murilo Opsfelder Araujo
The following error messages are thrown by sparse when CONFIG_OLPC is
not defined:

drivers/staging/olpc_dcon/olpc_dcon.c:147:17: error: undefined identifier 
'olpc_board_at_least'
drivers/staging/olpc_dcon/olpc_dcon.c:208:14: error: undefined identifier 
'olpc_board_at_least'

This patch fixes these errors.

Signed-off-by: Murilo Opsfelder Araujo 
---
 drivers/staging/olpc_dcon/olpc_dcon.c | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/drivers/staging/olpc_dcon/olpc_dcon.c 
b/drivers/staging/olpc_dcon/olpc_dcon.c
index 6a9a881..3708f1e 100644
--- a/drivers/staging/olpc_dcon/olpc_dcon.c
+++ b/drivers/staging/olpc_dcon/olpc_dcon.c
@@ -144,7 +144,9 @@ power_up:
}
if (x < 0) {
pr_err("unable to stabilize dcon's smbus, reasserting power and 
praying.\n");
+#ifdef CONFIG_OLPC
BUG_ON(olpc_board_at_least(olpc_board(0xc2)));
+#endif
pm = 0;
olpc_ec_cmd(EC_DCON_POWER_MODE, &pm, 1, NULL, 0);
msleep(100);
@@ -205,8 +207,10 @@ static void dcon_sleep(struct dcon_priv *dcon, bool sleep)
if (dcon->asleep == sleep)
return;
 
+#ifdef CONFIG_OLPC
if (!olpc_board_at_least(olpc_board(0xc2)))
return;
+#endif
 
if (sleep) {
u8 pm = 0;
@@ -795,11 +799,14 @@ struct i2c_driver dcon_driver = {
 
 static int __init olpc_dcon_init(void)
 {
+#ifdef CONFIG_OLPC
 #ifdef CONFIG_FB_OLPC_DCON_1_5
/* XO-1.5 */
if (olpc_board_at_least(olpc_board(0xd0)))
pdata = &dcon_pdata_xo_1_5;
 #endif
+#endif
+
 #ifdef CONFIG_FB_OLPC_DCON_1
if (!pdata)
pdata = &dcon_pdata_xo_1;
-- 
2.1.0

--
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: next-20141204 crashing on ext4_fill_super()

2014-12-07 Thread Murilo Opsfelder Araujo
On Saturday, December 06, 2014 05:16:21 PM Theodore Ts'o wrote:
> Please revert fdfe07398761 and that should the crashes; this will be
> fixed in the next linux-next release.  My apologies for the inconvenience.
> 
>   - Ted
Hello, Ted.

Reverting that commit worked.  No need to apologize.

Thanks a lot for the quick reply.

-- 
Murilo
--
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/


next-20141204 crashing on ext4_fill_super()

2014-12-06 Thread Murilo Opsfelder Araujo
Hello, everyone.

next-20141204 started crashing on my laptop with the following error right 
after I enter my disk encryption password:

http://opsfelder.com/~murilo/lkml/next-20141204_crash.jpg

The previous version next-20141203 was working just fine.  next-20141205 is 
also crashing.

Git-bisect pointed me to the commit [1] 
d0079b903022160fee1d673a3c1f3154c84385eb "ext4: 
ext4_da_convert_inline_data_to_extent drop locked page after error".

I tried reverting it from next-20141204 but got no luck.

I'd be happy if someone can help me getting this fixed.

Thanks in advance.

[1]
commit d0079b903022160fee1d673a3c1f3154c84385eb
Author: Dmitry Monakhov 
Date:   Tue Dec 2 18:46:20 2014 -0500

ext4: ext4_da_convert_inline_data_to_extent drop locked page after error

Testcase:
xfstests generic/270
MKFS_OPTIONS="-q -I 256 -O inline_data,64bit"

Call Trace:
 [] lock_page+0x35/0x39 ---> DEADLOCK
 [] pagecache_get_page+0x65/0x15a
 [] truncate_inode_pages_range+0x1db/0x45c
 [] ? ext4_da_get_block_prep+0x439/0x4b6
 [] ? __block_write_begin+0x284/0x29c
 [] ? ext4_change_inode_journal_flag+0x16b/0x16b
 [] truncate_inode_pages+0x12/0x14
 [] ext4_truncate_failed_write+0x19/0x25
 [] ext4_da_write_inline_data_begin+0x196/0x31c
 [] ext4_da_write_begin+0x189/0x302
 [] ? trace_hardirqs_on+0xd/0xf
 [] ? read_seqcount_begin.clone.1+0x9f/0xcc
 [] generic_perform_write+0xc7/0x1c6
 [] ? mark_held_locks+0x59/0x77
 [] __generic_file_write_iter+0x17f/0x1c5
 [] ext4_file_write_iter+0x2a5/0x354
 [] ? file_start_write+0x2a/0x2c
 [] ? bad_area_nosemaphore+0x13/0x15
 [] new_sync_write+0x8a/0xb2
 [] vfs_write+0xb5/0x14d
 [] SyS_write+0x5c/0x8c
 [] system_call_fastpath+0x12/0x17

Signed-off-by: Dmitry Monakhov 
Signed-off-by: Theodore Ts'o 

-- 
Murilo
--
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] rtlwifi: Add more checks for get_btc_status callback

2014-11-06 Thread Murilo Opsfelder Araujo
On 11/06/2014 09:40 AM, Murilo Opsfelder Araujo wrote:
> On 11/05/2014 04:12 PM, Larry Finger wrote:
>> On 11/05/2014 03:16 AM, Mike Galbraith wrote:
>>> On Wed, 2014-10-29 at 23:30 -0500, Larry Finger wrote:
>>>> On 10/29/2014 06:28 PM, Murilo Opsfelder Araujo wrote:
>>>>> This is a complement of commit 08054200117a95afc14c3d2ed3a38bf4e345bf78
>>>>> "rtlwifi: Add check for get_btc_status callback".
>>>>>
>>>>> With this patch, next-20141029 at least does not panic with rtl8192se
>>>>> device.
>>>>>
>>>>
>>>> This patch is OK, but as noted it is not complete.
>>>>
>>>> I have patches to fix all the kernel panics for rtl8192se AND
>>>> rtl8192ce. There
>>>> are missing parts, but I would prefer submitting mine, which would
>>>> conflict with
>>>> this one. For that reason, NACK for this one, and please apply the
>>>> set I am
>>>> submitting now.
>>>
>>> It's all in there now, but my RTL8191SEvB is still dead.  Squabbling
>>> with it isn't going all that well either.
>>>
>>> As soon as 38506ece rtlwifi: rtl_pci: Start modification for new drivers
>>> is applied, explosions appear.  Subsequently applying...
>>>
>>> 08054200 rtlwifi: Add check for get_btc_status callback
>>> c0386f15 rtlwifi: rtl8192ce: rtl8192de: rtl8192se: Fix handling for
>>> missing get_btc_status
>>> 50147969 rtlwifi: rtl8192se: Fix duplicate calls to
>>> ieee80211_register_hw()
>>> 30c5ccc6 rtlwifi: rtl8192se: Add missing section to read descriptor
>>> setting
>>> 75a916e1 rtlwifi: rtl8192se: Fix firmware loading
>>>
>>> ...fixes that mess up, but leaves the interface dead in the same manner
>>> as if nothing has been reverted.  So it _seems_ the bustage lurks in
>>> 38506ece somewhere.  Too bad it's non-dinky, and written in wifi-ese :)
>>
>> Yes, I am aware that rtl8192se is failing, and now that I am back from
>> vacation, I am working on the problem. If you want to use the driver
>> with kernel 3.18, clone the repo at
>> http://github.com/lwfinger/rtlwifi_new.git and build and install either
>> the master or kernel_version branches. Both work.
>>
>> I am in the process of trying to find what the crucial difference is
>> between that repo and the kernel version.
>>
>> Larry
>>
>>
> I'm sending to everyone so others can jump in as well.
> 
> Here are the steps I've followed.
> 
> Installed and booted my kernel:
> 
> $ sudo dpkg -i 
> linux-image-3.18.0-rc3-next-20141105-panda_3.18.0-rc3-next-20141105-panda-1_amd64.deb
>  
> linux-headers-3.18.0-rc3-next-20141105-panda_3.18.0-rc3-next-20141105-panda-1_amd64.deb
> 
> Built modules from Larry's github repository.
> 
> $ cd rtlwifi_new
> $ make
> $ sudo make install
> 
> $ sudo modprobe -rv rtl8192se
> rmmod rtl8192se
> rmmod rtl_pci
> rmmod rtlwifi
> rmmod mac80211
> rmmod cfg80211
> 
> The module does not load:
> 
> $ sudo modprobe -v rtl8192se
> insmod 
> /lib/modules/3.18.0-rc3-next-20141105-panda/kernel/net/wireless/cfg80211.ko
> insmod 
> /lib/modules/3.18.0-rc3-next-20141105-panda/kernel/net/mac80211/mac80211.ko
> insmod 
> /lib/modules/3.18.0-rc3-next-20141105-panda/kernel/drivers/net/wireless/rtlwifi/rtlwifi.ko
> insmod 
> /lib/modules/3.18.0-rc3-next-20141105-panda/kernel/drivers/net/wireless/rtlwifi/rtl_pci.ko
> insmod /lib/modules/3.18.0-rc3-next-20141105-panda/extra/rtl8192se.ko
> ERROR: could not insert 'rtl8192se': Invalid argument
> 
> And /var/log/messages showed:
> 
> Nov  5 22:28:01 laptop kernel: [  301.276806] rtl8192se: disagrees about 
> version of symbol rtl_process_phyinfo
> Nov  5 22:28:01 laptop kernel: [  301.276812] rtl8192se: Unknown symbol 
> rtl_process_phyinfo (err -22)
> Nov  5 22:28:01 laptop kernel: [  301.276864] rtl8192se: disagrees about 
> version of symbol rtl_get_tcb_desc
> Nov  5 22:28:01 laptop kernel: [  301.276866] rtl8192se: Unknown symbol 
> rtl_get_tcb_desc (err -22)
> 

Here is what I did in order to get the rtl8192se from Larry's repo to
work:

$ cd rtlwifi_new
$ make

$ sudo modprobe -rv rtl8192se
rmmod rtl8192se
rmmod rtl_pci
rmmod rtlwifi
rmmod mac80211
rmmod cfg80211

$ sudo modprobe -v cfg80211
insmod 
/lib/modules/3.18.0-rc3-next-20141106-panda/kernel/net/wireless/cfg80211.ko

$ sudo modprobe -v mac80211
insmod 
/lib/modules/3.18.0-rc3-next-20141106-panda/kernel/net/mac80211/mac80211.ko

$ sudo insmod ./rtlwifi.ko
$ sudo insmod ./rtl_pci.ko
$ sudo insm

Re: [PATCH] rtlwifi: Add more checks for get_btc_status callback

2014-11-06 Thread Murilo Opsfelder Araujo
On 11/05/2014 04:12 PM, Larry Finger wrote:
> On 11/05/2014 03:16 AM, Mike Galbraith wrote:
>> On Wed, 2014-10-29 at 23:30 -0500, Larry Finger wrote:
>>> On 10/29/2014 06:28 PM, Murilo Opsfelder Araujo wrote:
>>>> This is a complement of commit 08054200117a95afc14c3d2ed3a38bf4e345bf78
>>>> "rtlwifi: Add check for get_btc_status callback".
>>>>
>>>> With this patch, next-20141029 at least does not panic with rtl8192se
>>>> device.
>>>>
>>>
>>> This patch is OK, but as noted it is not complete.
>>>
>>> I have patches to fix all the kernel panics for rtl8192se AND
>>> rtl8192ce. There
>>> are missing parts, but I would prefer submitting mine, which would
>>> conflict with
>>> this one. For that reason, NACK for this one, and please apply the
>>> set I am
>>> submitting now.
>>
>> It's all in there now, but my RTL8191SEvB is still dead.  Squabbling
>> with it isn't going all that well either.
>>
>> As soon as 38506ece rtlwifi: rtl_pci: Start modification for new drivers
>> is applied, explosions appear.  Subsequently applying...
>>
>> 08054200 rtlwifi: Add check for get_btc_status callback
>> c0386f15 rtlwifi: rtl8192ce: rtl8192de: rtl8192se: Fix handling for
>> missing get_btc_status
>> 50147969 rtlwifi: rtl8192se: Fix duplicate calls to
>> ieee80211_register_hw()
>> 30c5ccc6 rtlwifi: rtl8192se: Add missing section to read descriptor
>> setting
>> 75a916e1 rtlwifi: rtl8192se: Fix firmware loading
>>
>> ...fixes that mess up, but leaves the interface dead in the same manner
>> as if nothing has been reverted.  So it _seems_ the bustage lurks in
>> 38506ece somewhere.  Too bad it's non-dinky, and written in wifi-ese :)
> 
> Yes, I am aware that rtl8192se is failing, and now that I am back from
> vacation, I am working on the problem. If you want to use the driver
> with kernel 3.18, clone the repo at
> http://github.com/lwfinger/rtlwifi_new.git and build and install either
> the master or kernel_version branches. Both work.
> 
> I am in the process of trying to find what the crucial difference is
> between that repo and the kernel version.
> 
> Larry
> 
> 
I'm sending to everyone so others can jump in as well.

Here are the steps I've followed.

Installed and booted my kernel:

$ sudo dpkg -i 
linux-image-3.18.0-rc3-next-20141105-panda_3.18.0-rc3-next-20141105-panda-1_amd64.deb
 
linux-headers-3.18.0-rc3-next-20141105-panda_3.18.0-rc3-next-20141105-panda-1_amd64.deb

Built modules from Larry's github repository.

$ cd rtlwifi_new
$ make
$ sudo make install

$ sudo modprobe -rv rtl8192se
rmmod rtl8192se
rmmod rtl_pci
rmmod rtlwifi
rmmod mac80211
rmmod cfg80211

The module does not load:

$ sudo modprobe -v rtl8192se
insmod 
/lib/modules/3.18.0-rc3-next-20141105-panda/kernel/net/wireless/cfg80211.ko
insmod 
/lib/modules/3.18.0-rc3-next-20141105-panda/kernel/net/mac80211/mac80211.ko
insmod 
/lib/modules/3.18.0-rc3-next-20141105-panda/kernel/drivers/net/wireless/rtlwifi/rtlwifi.ko
insmod 
/lib/modules/3.18.0-rc3-next-20141105-panda/kernel/drivers/net/wireless/rtlwifi/rtl_pci.ko
insmod /lib/modules/3.18.0-rc3-next-20141105-panda/extra/rtl8192se.ko
ERROR: could not insert 'rtl8192se': Invalid argument

And /var/log/messages showed:

Nov  5 22:28:01 laptop kernel: [  301.276806] rtl8192se: disagrees about 
version of symbol rtl_process_phyinfo
Nov  5 22:28:01 laptop kernel: [  301.276812] rtl8192se: Unknown symbol 
rtl_process_phyinfo (err -22)
Nov  5 22:28:01 laptop kernel: [  301.276864] rtl8192se: disagrees about 
version of symbol rtl_get_tcb_desc
Nov  5 22:28:01 laptop kernel: [  301.276866] rtl8192se: Unknown symbol 
rtl_get_tcb_desc (err -22)

-- 
Murilo
--
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] rtlwifi: Add more checks for get_btc_status callback

2014-10-29 Thread Murilo Opsfelder Araujo
This is a complement of commit 08054200117a95afc14c3d2ed3a38bf4e345bf78
"rtlwifi: Add check for get_btc_status callback".

With this patch, next-20141029 at least does not panic with rtl8192se
device.

Signed-off-by: Murilo Opsfelder Araujo 
---

Hello, everyone.

Some days ago, I reported [1] that next-20140930 introduced an issue
with rtl8192se devices.

Later on, Larry Finger proposed [2] a fix that did not solve the
problem thoroughly.

This patch is based on Larry's one [3].  It also does not solve the
rtl8192se issue completely but I can at least boot next-20141029
without a panic.

The remaining issue is that the rtl8192se device does not associate.
It does not even show any wifi network available.  The device is shown
by iwconfig, but I cannot do anything with it.

I need help from someone out there that could provide me guidance or
possibly investigate the issue (I'm not a kernel expert yet).

I'd not like to see this regression landing on v3.18.

[1] http://marc.info/?l=linux-wireless&m=141403434929612
[2] http://marc.info/?l=linux-wireless&m=141408165513255
[3] http://marc.info/?l=linux-wireless&m=141416876810127

 drivers/net/wireless/rtlwifi/base.c |  6 --
 drivers/net/wireless/rtlwifi/core.c |  9 ++---
 drivers/net/wireless/rtlwifi/pci.c  |  3 ++-
 drivers/net/wireless/rtlwifi/ps.c   | 12 
 4 files changed, 20 insertions(+), 10 deletions(-)

diff --git a/drivers/net/wireless/rtlwifi/base.c 
b/drivers/net/wireless/rtlwifi/base.c
index 40b6d1d..1a51577 100644
--- a/drivers/net/wireless/rtlwifi/base.c
+++ b/drivers/net/wireless/rtlwifi/base.c
@@ -1234,7 +1234,8 @@ EXPORT_SYMBOL_GPL(rtl_action_proc);
 static void setup_arp_tx(struct rtl_priv *rtlpriv, struct rtl_ps_ctl *ppsc)
 {
rtlpriv->ra.is_special_data = true;
-   if (rtlpriv->cfg->ops->get_btc_status())
+   if (rtlpriv->cfg->ops->get_btc_status &&
+   rtlpriv->cfg->ops->get_btc_status())
rtlpriv->btcoexist.btc_ops->btc_special_packet_notify(
rtlpriv, 1);
rtlpriv->enter_ps = false;
@@ -1629,7 +1630,8 @@ void rtl_watchdog_wq_callback(void *data)
}
}

-   if (rtlpriv->cfg->ops->get_btc_status())
+   if (rtlpriv->cfg->ops->get_btc_status &&
+   rtlpriv->cfg->ops->get_btc_status())
rtlpriv->btcoexist.btc_ops->btc_periodical(rtlpriv);

rtlpriv->link_info.bcn_rx_inperiod = 0;
diff --git a/drivers/net/wireless/rtlwifi/core.c 
b/drivers/net/wireless/rtlwifi/core.c
index f6179bc..686d256 100644
--- a/drivers/net/wireless/rtlwifi/core.c
+++ b/drivers/net/wireless/rtlwifi/core.c
@@ -1133,7 +1133,8 @@ static void rtl_op_bss_info_changed(struct ieee80211_hw 
*hw,
ppsc->report_linked = (mstatus == RT_MEDIA_CONNECT) ?
  true : false;

-   if (rtlpriv->cfg->ops->get_btc_status())
+   if (rtlpriv->cfg->ops->get_btc_status &&
+   rtlpriv->cfg->ops->get_btc_status())
rtlpriv->btcoexist.btc_ops->btc_mediastatus_notify(
rtlpriv, mstatus);
}
@@ -1373,7 +1374,8 @@ static void rtl_op_sw_scan_start(struct ieee80211_hw *hw)
return;
}

-   if (rtlpriv->cfg->ops->get_btc_status())
+   if (rtlpriv->cfg->ops->get_btc_status &&
+   rtlpriv->cfg->ops->get_btc_status())
rtlpriv->btcoexist.btc_ops->btc_scan_notify(rtlpriv, 1);

if (rtlpriv->dm.supp_phymode_switch) {
@@ -1425,7 +1427,8 @@ static void rtl_op_sw_scan_complete(struct ieee80211_hw 
*hw)
}

rtlpriv->cfg->ops->scan_operation_backup(hw, SCAN_OPT_RESTORE);
-   if (rtlpriv->cfg->ops->get_btc_status())
+   if (rtlpriv->cfg->ops->get_btc_status &&
+   rtlpriv->cfg->ops->get_btc_status())
rtlpriv->btcoexist.btc_ops->btc_scan_notify(rtlpriv, 0);
 }

diff --git a/drivers/net/wireless/rtlwifi/pci.c 
b/drivers/net/wireless/rtlwifi/pci.c
index 25daa87..ed3364d 100644
--- a/drivers/net/wireless/rtlwifi/pci.c
+++ b/drivers/net/wireless/rtlwifi/pci.c
@@ -1833,7 +1833,8 @@ static void rtl_pci_stop(struct ieee80211_hw *hw)
unsigned long flags;
u8 RFInProgressTimeOut = 0;

-   if (rtlpriv->cfg->ops->get_btc_status())
+   if (rtlpriv->cfg->ops->get_btc_status &&
+   rtlpriv->cfg->ops->get_btc_status())
rtlpriv->btcoexist.btc_ops->btc_halt_notify();

/*
diff --git a/drivers/net/wireless/rtlwifi/ps.c 
b/drivers/net/wireless/rtlwifi/ps.c
index b69321d..2278af9 100644
--- a/drivers/net/wireless/rtlwifi/ps.c
+++ b/drivers

Re: Possible wireless issue introduced in next-20140930

2014-10-23 Thread Murilo Opsfelder Araujo

On 10/23/2014 03:23 AM, Mike Galbraith wrote:

On Thu, 2014-10-23 at 01:17 -0200, Murilo Opsfelder Araujo wrote:

Hello, everyone.

With next-20140930 my laptop does not work, i.e. after I enter my login
and password in KDM, the entire system becomes unresponsive and I need
to reset it in order to reboot (it does not even show the KDE splash
screen).

It was working pretty fine with next-20140926.

I've also tested with next-20141022 and v3.18-rc1 and no luck.

git bisect pointed me to the commit below [1].  My wireless card is a
RTL8191SEvA [2].


Mine is RTL8191SEvB.

I was going to bisect RTL8191SE regression when I got a chance, but you
beat me to it.


commit 38506ecefab911785d5e1aa5889f6eeb462e0954
Author: Larry Finger 
Date:   Mon Sep 22 09:39:19 2014 -0500

  rtlwifi: rtl_pci: Start modification for new drivers


Did you confirm that bisection result, ie revert it at HEAD of whichever
tree you bisected?

The revert (master) removed some warnings on the way to kaboom here, but
the drivers is still toxic.  My log follows in case it's the same thing.
I can't go hunting atm, maybe during the weekend if the problem hasn't
evaporate by then.


next-20141023 does not work as well.

With commit 38506ecefab911785d5e1aa5889f6eeb462e0954 reverted, kernel 
blows up very early in boot.


Cascardo (CC:) helped me to investigate and it seems that when 
rtlpriv->cfg->ops->get_btc_status() is called, it is pointing to a NULL 
function.


With the changes below, written by Cascardo, I could get rid of 
oops/panic and system booted normally.  But there was no wifi network 
available (like if wifi card was disabled).


diff --git a/drivers/net/wireless/rtlwifi/rtl8192se/sw.c 
b/drivers/net/wireless/rtlwifi/rtl8192se/sw.c

index 1bff2a0..807f0f7 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192se/sw.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192se/sw.c
@@ -253,6 +253,11 @@ static void rtl92s_deinit_sw_vars(struct 
ieee80211_hw *hw)

}
 }

+static bool rtl92s_get_btc_status(void)
+{
+   return false;
+}
+
 static struct rtl_hal_ops rtl8192se_hal_ops = {
.init_sw_vars = rtl92s_init_sw_vars,
.deinit_sw_vars = rtl92s_deinit_sw_vars,
@@ -294,6 +299,7 @@ static struct rtl_hal_ops rtl8192se_hal_ops = {
.set_bbreg = rtl92s_phy_set_bb_reg,
.get_rfreg = rtl92s_phy_query_rf_reg,
.set_rfreg = rtl92s_phy_set_rf_reg,
+   .get_btc_status = rtl92s_get_btc_status,
 };

 static struct rtl_mod_params rtl92se_mod_params = {

--
Murilo
--
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/


Possible wireless issue introduced in next-20140930

2014-10-22 Thread Murilo Opsfelder Araujo

Hello, everyone.

With next-20140930 my laptop does not work, i.e. after I enter my login 
and password in KDM, the entire system becomes unresponsive and I need 
to reset it in order to reboot (it does not even show the KDE splash 
screen).


It was working pretty fine with next-20140926.

I've also tested with next-20141022 and v3.18-rc1 and no luck.

git bisect pointed me to the commit below [1].  My wireless card is a 
RTL8191SEvA [2].


I need your help to troubleshoot this.

Thanks in advance.

[1]
commit 38506ecefab911785d5e1aa5889f6eeb462e0954
Author: Larry Finger 
Date:   Mon Sep 22 09:39:19 2014 -0500

rtlwifi: rtl_pci: Start modification for new drivers

Future patches will move the drivers for RTL8192EE and RTL8821AE
from staging to the regular wireless tree. Here, the necessary features
are added to the PCI driver. Other files are touched due to changes
in the various data structs.

Signed-off-by: Larry Finger 
Signed-off-by: John W. Linville 

[2]
$ lspci -vvv
02:00.0 Network controller: Realtek Semiconductor Co., Ltd. RTL8191SEvA 
Wireless LAN Controller (rev 10)

Subsystem: Hewlett-Packard Company Device 1467
Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- 
ParErr- Stepping- SERR- FastB2B- DisINTx-
Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- 
SERR- 
Latency: 0, Cache Line Size: 64 bytes
Interrupt: pin A routed to IRQ 16
Region 0: I/O ports at 3000 [size=256]
Region 1: Memory at d340 (32-bit, non-prefetchable) [size=16K]
Capabilities: 
Kernel driver in use: rtl8192se

--
Murilo
--
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] fs: Initialize mountpoint list head in new_mountpoint()

2014-08-18 Thread Murilo Opsfelder Araujo
The commit 89f7ca1af15bdfe7a6aed343032a84af2a69f736 makes next-20140818
to panic because mountpoint list head was not initialized.  Initializing
it with NULL fixes the problem.

commit 89f7ca1af15bdfe7a6aed343032a84af2a69f736
Author: Eric W. Biederman 
Date:   Sun Sep 22 19:37:01 2013 -0700

vfs: Keep a list of mounts on a mount point

To spot any possible problems call BUG if a mountpoint
is put when it's list of mounts is not empty.

AV: use hlist instead of list_head

Signed-off-by: Murilo Opsfelder Araujo 
---
 fs/namespace.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/fs/namespace.c b/fs/namespace.c
index 1a2bbef..1a00bac 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -736,6 +736,7 @@ static struct mountpoint *new_mountpoint(struct dentry 
*dentry)
return ERR_PTR(ret);
}
 
+   INIT_HLIST_HEAD(&mp->m_list);
mp->m_dentry = dentry;
mp->m_count = 1;
hlist_add_head(&mp->m_hash, chain);
-- 
2.1.0.rc2.234.ge4c5f60

--
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] mm: ksm: Remove unused function process_timeout()

2014-08-11 Thread Murilo Opsfelder Araujo
This patch fixes compilation warning:

mm/ksm.c:1711:13: warning: ‘process_timeout’ defined but not used 
[-Wunused-function]

Signed-off-by: Murilo Opsfelder Araujo 
---
 mm/ksm.c | 5 -
 1 file changed, 5 deletions(-)

diff --git a/mm/ksm.c b/mm/ksm.c
index f7de4c0..434a50a 100644
--- a/mm/ksm.c
+++ b/mm/ksm.c
@@ -1708,11 +1708,6 @@ static void ksm_do_scan(unsigned int scan_npages)
}
 }
 
-static void process_timeout(unsigned long __data)
-{
-   wake_up_process((struct task_struct *)__data);
-}
-
 static int ksmd_should_run(void)
 {
return (ksm_run & KSM_RUN_MERGE) && !list_empty(&ksm_mm_head.mm_list);
-- 
2.1.0.rc1.204.gae8bc8d

--
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/2] staging: iio: accel: Add blank lines between declarations and code

2014-08-06 Thread Murilo Opsfelder Araujo
This patch adds missing blank lines between declarations and code and
fixes lines starting by spaces, satisfying checkpatch.pl.

Signed-off-by: Murilo Opsfelder Araujo 
---
 drivers/staging/iio/accel/adis16201_core.c | 5 +++--
 drivers/staging/iio/accel/adis16203_core.c | 2 ++
 drivers/staging/iio/accel/adis16204_core.c | 1 +
 drivers/staging/iio/accel/adis16209_core.c | 1 +
 drivers/staging/iio/accel/adis16240_core.c | 1 +
 drivers/staging/iio/accel/lis3l02dq_core.c | 4 
 drivers/staging/iio/accel/lis3l02dq_ring.c | 1 +
 drivers/staging/iio/accel/sca3000_core.c   | 1 +
 8 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/iio/accel/adis16201_core.c 
b/drivers/staging/iio/accel/adis16201_core.c
index 50ba1fa..7eae5fd 100644
--- a/drivers/staging/iio/accel/adis16201_core.c
+++ b/drivers/staging/iio/accel/adis16201_core.c
@@ -111,6 +111,7 @@ static int adis16201_write_raw(struct iio_dev *indio_dev,
int bits;
s16 val16;
u8 addr;
+
switch (mask) {
case IIO_CHAN_INFO_CALIBBIAS:
switch (chan->type) {
@@ -131,8 +132,8 @@ static int adis16201_write_raw(struct iio_dev *indio_dev,
 }
 
 static const struct iio_chan_spec adis16201_channels[] = {
-  ADIS_SUPPLY_CHAN(ADIS16201_SUPPLY_OUT, ADIS16201_SCAN_SUPPLY, 0, 12),
-  ADIS_TEMP_CHAN(ADIS16201_TEMP_OUT, ADIS16201_SCAN_TEMP, 0, 12),
+   ADIS_SUPPLY_CHAN(ADIS16201_SUPPLY_OUT, ADIS16201_SCAN_SUPPLY, 0, 12),
+   ADIS_TEMP_CHAN(ADIS16201_TEMP_OUT, ADIS16201_SCAN_TEMP, 0, 12),
ADIS_ACCEL_CHAN(X, ADIS16201_XACCL_OUT, ADIS16201_SCAN_ACC_X,
BIT(IIO_CHAN_INFO_CALIBBIAS), 0, 14),
ADIS_ACCEL_CHAN(Y, ADIS16201_YACCL_OUT, ADIS16201_SCAN_ACC_Y,
diff --git a/drivers/staging/iio/accel/adis16203_core.c 
b/drivers/staging/iio/accel/adis16203_core.c
index f472137..fbbe93f 100644
--- a/drivers/staging/iio/accel/adis16203_core.c
+++ b/drivers/staging/iio/accel/adis16203_core.c
@@ -37,6 +37,7 @@ static int adis16203_write_raw(struct iio_dev *indio_dev,
struct adis *st = iio_priv(indio_dev);
/* currently only one writable parameter which keeps this simple */
u8 addr = adis16203_addresses[chan->scan_index];
+
return adis_write_reg_16(st, addr, val & 0x3FFF);
 }
 
@@ -50,6 +51,7 @@ static int adis16203_read_raw(struct iio_dev *indio_dev,
int bits;
u8 addr;
s16 val16;
+
switch (mask) {
case IIO_CHAN_INFO_RAW:
return adis_single_conversion(indio_dev, chan,
diff --git a/drivers/staging/iio/accel/adis16204_core.c 
b/drivers/staging/iio/accel/adis16204_core.c
index 19eaebc..4c8acbc 100644
--- a/drivers/staging/iio/accel/adis16204_core.c
+++ b/drivers/staging/iio/accel/adis16204_core.c
@@ -119,6 +119,7 @@ static int adis16204_write_raw(struct iio_dev *indio_dev,
int bits;
s16 val16;
u8 addr;
+
switch (mask) {
case IIO_CHAN_INFO_CALIBBIAS:
switch (chan->type) {
diff --git a/drivers/staging/iio/accel/adis16209_core.c 
b/drivers/staging/iio/accel/adis16209_core.c
index 374dc6e..b2c7aed 100644
--- a/drivers/staging/iio/accel/adis16209_core.c
+++ b/drivers/staging/iio/accel/adis16209_core.c
@@ -44,6 +44,7 @@ static int adis16209_write_raw(struct iio_dev *indio_dev,
int bits;
s16 val16;
u8 addr;
+
switch (mask) {
case IIO_CHAN_INFO_CALIBBIAS:
switch (chan->type) {
diff --git a/drivers/staging/iio/accel/adis16240_core.c 
b/drivers/staging/iio/accel/adis16240_core.c
index 74ace2a..205d6d0 100644
--- a/drivers/staging/iio/accel/adis16240_core.c
+++ b/drivers/staging/iio/accel/adis16240_core.c
@@ -163,6 +163,7 @@ static int adis16240_write_raw(struct iio_dev *indio_dev,
int bits = 10;
s16 val16;
u8 addr;
+
switch (mask) {
case IIO_CHAN_INFO_CALIBBIAS:
val16 = val & ((1 << bits) - 1);
diff --git a/drivers/staging/iio/accel/lis3l02dq_core.c 
b/drivers/staging/iio/accel/lis3l02dq_core.c
index 898653c..f5e145c 100644
--- a/drivers/staging/iio/accel/lis3l02dq_core.c
+++ b/drivers/staging/iio/accel/lis3l02dq_core.c
@@ -212,6 +212,7 @@ static int lis3l02dq_write_thresh(struct iio_dev *indio_dev,
  int val, int val2)
 {
u16 value = val;
+
return lis3l02dq_spi_write_reg_s16(indio_dev,
   LIS3L02DQ_REG_THS_L_ADDR,
   value);
@@ -226,6 +227,7 @@ static int lis3l02dq_write_raw(struct iio_dev *indio_dev,
int ret = -EINVAL, reg;
u8 uval;
s8 sval;
+
switch (mask) {
case IIO_CHAN_INFO_CALIBBIAS:
if (val > 255 || val < -256)
@@ -302,6 +304,7 @@ static ssize_t lis3l02dq_read_frequency(struct device *dev,
struct iio_dev *indio_dev = dev_to_iio_dev(dev);
int ret, len = 0;
s8 t;
+
ret = li

[PATCH v3 2/2] staging: iio: accel: sca3000_core.c: Adjust code to fit 80-chars limit

2014-08-06 Thread Murilo Opsfelder Araujo
Signed-off-by: Murilo Opsfelder Araujo 
---
 drivers/staging/iio/accel/sca3000_core.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/iio/accel/sca3000_core.c 
b/drivers/staging/iio/accel/sca3000_core.c
index bc53fedb..e4e5639 100644
--- a/drivers/staging/iio/accel/sca3000_core.c
+++ b/drivers/staging/iio/accel/sca3000_core.c
@@ -506,7 +506,8 @@ static int sca3000_read_raw(struct iio_dev *indio_dev,
mutex_unlock(&st->lock);
return ret;
}
-   *val = ((st->rx[0] & 0x3F) << 3) | ((st->rx[1] & 0xE0) 
>> 5);
+   *val = ((st->rx[0] & 0x3F) << 3) |
+  ((st->rx[1] & 0xE0) >> 5);
}
mutex_unlock(&st->lock);
return IIO_VAL_INT;
-- 
2.1.0.rc1.204.gae8bc8d

--
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 0/2] staging: iio: accel: Multiple coding style fixes

2014-08-06 Thread Murilo Opsfelder Araujo
The following patches fix almost all warnings reported by
checkpatch.pl.

v2 -> v3 changes:
- Folded blank line patches into a single patch.
- Fit code in 80-chars limit and still be human-readable.

Murilo Opsfelder Araujo (2):
  staging: iio: accel: Add blank lines between declarations and code
  staging: iio: accel: sca3000_core.c: Adjust code to fit 80-chars limit

 drivers/staging/iio/accel/adis16201_core.c | 5 +++--
 drivers/staging/iio/accel/adis16203_core.c | 2 ++
 drivers/staging/iio/accel/adis16204_core.c | 1 +
 drivers/staging/iio/accel/adis16209_core.c | 1 +
 drivers/staging/iio/accel/adis16240_core.c | 1 +
 drivers/staging/iio/accel/lis3l02dq_core.c | 4 
 drivers/staging/iio/accel/lis3l02dq_ring.c | 1 +
 drivers/staging/iio/accel/sca3000_core.c   | 4 +++-
 8 files changed, 16 insertions(+), 3 deletions(-)

--
2.1.0.rc1.204.gae8bc8d
--
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/8] staging: iio: accel: Multiple coding style fixes

2014-08-04 Thread Murilo Opsfelder Araujo
The following patches fix almost all warnings reported by
checkpatch.pl.

Changes from v1:
- Updated commit messages to better reflect changes.

Murilo Opsfelder Araujo (8):
  staging: iio: accel: adis16203_core.c: Add blank lines between
declarations and code
  staging: iio: accel: adis16201_core.c: Add blank line between
declarations and code
  staging: iio: accel: adis16204_core.c: Add blank line between
declarations and code
  staging: iio: accel: adis16209_core.c: Add blank line between
declarations and code
  staging: iio: accel: adis16240_core.c: Add blank line between
declarations and code
  staging: iio: accel: lis3l02dq_core.c: Add blank lines between
declarations and code
  staging: iio: accel: lis3l02dq_ring.c: Add blank line between
declarations and code
  staging: iio: accel: sca3000_core.c: Add blank line between
declarations and code

 drivers/staging/iio/accel/adis16201_core.c | 5 +++--
 drivers/staging/iio/accel/adis16203_core.c | 2 ++
 drivers/staging/iio/accel/adis16204_core.c | 1 +
 drivers/staging/iio/accel/adis16209_core.c | 1 +
 drivers/staging/iio/accel/adis16240_core.c | 1 +
 drivers/staging/iio/accel/lis3l02dq_core.c | 4 
 drivers/staging/iio/accel/lis3l02dq_ring.c | 1 +
 drivers/staging/iio/accel/sca3000_core.c   | 4 +++-
 8 files changed, 16 insertions(+), 3 deletions(-)

--
2.1.0.rc1.204.gae8bc8d
--
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 6/8] staging: iio: accel: lis3l02dq_core.c: Add blank lines between declarations and code

2014-08-04 Thread Murilo Opsfelder Araujo
This patch adds missing blank line between declarations and code,
satisfying checkpatch.pl.

Signed-off-by: Murilo Opsfelder Araujo 
---
 drivers/staging/iio/accel/lis3l02dq_core.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/drivers/staging/iio/accel/lis3l02dq_core.c 
b/drivers/staging/iio/accel/lis3l02dq_core.c
index 898653c..f5e145c 100644
--- a/drivers/staging/iio/accel/lis3l02dq_core.c
+++ b/drivers/staging/iio/accel/lis3l02dq_core.c
@@ -212,6 +212,7 @@ static int lis3l02dq_write_thresh(struct iio_dev *indio_dev,
  int val, int val2)
 {
u16 value = val;
+
return lis3l02dq_spi_write_reg_s16(indio_dev,
   LIS3L02DQ_REG_THS_L_ADDR,
   value);
@@ -226,6 +227,7 @@ static int lis3l02dq_write_raw(struct iio_dev *indio_dev,
int ret = -EINVAL, reg;
u8 uval;
s8 sval;
+
switch (mask) {
case IIO_CHAN_INFO_CALIBBIAS:
if (val > 255 || val < -256)
@@ -302,6 +304,7 @@ static ssize_t lis3l02dq_read_frequency(struct device *dev,
struct iio_dev *indio_dev = dev_to_iio_dev(dev);
int ret, len = 0;
s8 t;
+
ret = lis3l02dq_spi_read_reg_8(indio_dev,
   LIS3L02DQ_REG_CTRL_1_ADDR,
   (u8 *)&t);
@@ -565,6 +568,7 @@ static int lis3l02dq_read_event_config(struct iio_dev 
*indio_dev,
u8 val;
int ret;
u8 mask = (1 << (chan->channel2*2 + (dir == IIO_EV_DIR_RISING)));
+
ret = lis3l02dq_spi_read_reg_8(indio_dev,
   LIS3L02DQ_REG_WAKE_UP_CFG_ADDR,
   &val);
-- 
2.1.0.rc1.204.gae8bc8d

--
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/8] staging: iio: accel: adis16240_core.c: Add blank line between declarations and code

2014-08-04 Thread Murilo Opsfelder Araujo
This patch adds missing blank line between declarations and code,
satisfying checkpatch.pl.

Signed-off-by: Murilo Opsfelder Araujo 
---
 drivers/staging/iio/accel/adis16240_core.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/staging/iio/accel/adis16240_core.c 
b/drivers/staging/iio/accel/adis16240_core.c
index 74ace2a..205d6d0 100644
--- a/drivers/staging/iio/accel/adis16240_core.c
+++ b/drivers/staging/iio/accel/adis16240_core.c
@@ -163,6 +163,7 @@ static int adis16240_write_raw(struct iio_dev *indio_dev,
int bits = 10;
s16 val16;
u8 addr;
+
switch (mask) {
case IIO_CHAN_INFO_CALIBBIAS:
val16 = val & ((1 << bits) - 1);
-- 
2.1.0.rc1.204.gae8bc8d

--
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/8] staging: iio: accel: adis16204_core.c: Add blank line between declarations and code

2014-08-04 Thread Murilo Opsfelder Araujo
This patch adds missing blank line between declarations and code,
satisfying checkpatch.pl.

Signed-off-by: Murilo Opsfelder Araujo 
---
 drivers/staging/iio/accel/adis16204_core.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/staging/iio/accel/adis16204_core.c 
b/drivers/staging/iio/accel/adis16204_core.c
index 19eaebc..4c8acbc 100644
--- a/drivers/staging/iio/accel/adis16204_core.c
+++ b/drivers/staging/iio/accel/adis16204_core.c
@@ -119,6 +119,7 @@ static int adis16204_write_raw(struct iio_dev *indio_dev,
int bits;
s16 val16;
u8 addr;
+
switch (mask) {
case IIO_CHAN_INFO_CALIBBIAS:
switch (chan->type) {
-- 
2.1.0.rc1.204.gae8bc8d

--
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/8] staging: iio: accel: adis16209_core.c: Add blank line between declarations and code

2014-08-04 Thread Murilo Opsfelder Araujo
This patch adds missing blank line between declarations and code,
satisfying checkpatch.pl.

Signed-off-by: Murilo Opsfelder Araujo 
---
 drivers/staging/iio/accel/adis16209_core.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/staging/iio/accel/adis16209_core.c 
b/drivers/staging/iio/accel/adis16209_core.c
index 374dc6e..b2c7aed 100644
--- a/drivers/staging/iio/accel/adis16209_core.c
+++ b/drivers/staging/iio/accel/adis16209_core.c
@@ -44,6 +44,7 @@ static int adis16209_write_raw(struct iio_dev *indio_dev,
int bits;
s16 val16;
u8 addr;
+
switch (mask) {
case IIO_CHAN_INFO_CALIBBIAS:
switch (chan->type) {
-- 
2.1.0.rc1.204.gae8bc8d

--
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/8] staging: iio: accel: adis16201_core.c: Add blank line between declarations and code

2014-08-04 Thread Murilo Opsfelder Araujo
This patch adds missing blank line between declarations and code, and
also fixes lines starting by space, satisfying checkpatch.pl.

Signed-off-by: Murilo Opsfelder Araujo 
---
 drivers/staging/iio/accel/adis16201_core.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/iio/accel/adis16201_core.c 
b/drivers/staging/iio/accel/adis16201_core.c
index 50ba1fa..7eae5fd 100644
--- a/drivers/staging/iio/accel/adis16201_core.c
+++ b/drivers/staging/iio/accel/adis16201_core.c
@@ -111,6 +111,7 @@ static int adis16201_write_raw(struct iio_dev *indio_dev,
int bits;
s16 val16;
u8 addr;
+
switch (mask) {
case IIO_CHAN_INFO_CALIBBIAS:
switch (chan->type) {
@@ -131,8 +132,8 @@ static int adis16201_write_raw(struct iio_dev *indio_dev,
 }
 
 static const struct iio_chan_spec adis16201_channels[] = {
-  ADIS_SUPPLY_CHAN(ADIS16201_SUPPLY_OUT, ADIS16201_SCAN_SUPPLY, 0, 12),
-  ADIS_TEMP_CHAN(ADIS16201_TEMP_OUT, ADIS16201_SCAN_TEMP, 0, 12),
+   ADIS_SUPPLY_CHAN(ADIS16201_SUPPLY_OUT, ADIS16201_SCAN_SUPPLY, 0, 12),
+   ADIS_TEMP_CHAN(ADIS16201_TEMP_OUT, ADIS16201_SCAN_TEMP, 0, 12),
ADIS_ACCEL_CHAN(X, ADIS16201_XACCL_OUT, ADIS16201_SCAN_ACC_X,
BIT(IIO_CHAN_INFO_CALIBBIAS), 0, 14),
ADIS_ACCEL_CHAN(Y, ADIS16201_YACCL_OUT, ADIS16201_SCAN_ACC_Y,
-- 
2.1.0.rc1.204.gae8bc8d

--
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 8/8] staging: iio: accel: sca3000_core.c: Add blank line between declarations and code

2014-08-04 Thread Murilo Opsfelder Araujo
This patch adds missing blank line between declarations and code, and
ajust code to fit 80-chars limit.

Signed-off-by: Murilo Opsfelder Araujo 
---
 drivers/staging/iio/accel/sca3000_core.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/iio/accel/sca3000_core.c 
b/drivers/staging/iio/accel/sca3000_core.c
index ed30e32..1ff299f 100644
--- a/drivers/staging/iio/accel/sca3000_core.c
+++ b/drivers/staging/iio/accel/sca3000_core.c
@@ -506,7 +506,8 @@ static int sca3000_read_raw(struct iio_dev *indio_dev,
mutex_unlock(&st->lock);
return ret;
}
-   *val = ((st->rx[0] & 0x3F) << 3) | ((st->rx[1] & 0xE0) 
>> 5);
+   *val = ((st->rx[0] & 0x3F) << 3)
+   | ((st->rx[1] & 0xE0) >> 5);
}
mutex_unlock(&st->lock);
return IIO_VAL_INT;
@@ -713,6 +714,7 @@ static int sca3000_read_thresh(struct iio_dev *indio_dev,
int ret, i;
struct sca3000_state *st = iio_priv(indio_dev);
int num = chan->channel2;
+
mutex_lock(&st->lock);
ret = sca3000_read_ctrl_reg(st, sca3000_addresses[num][1]);
mutex_unlock(&st->lock);
-- 
2.1.0.rc1.204.gae8bc8d

--
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 7/8] staging: iio: accel: lis3l02dq_ring.c: Add blank line between declarations and code

2014-08-04 Thread Murilo Opsfelder Araujo
This patch adds missing blank line between declarations and code,
satisfying checkpatch.pl.

Signed-off-by: Murilo Opsfelder Araujo 
---
 drivers/staging/iio/accel/lis3l02dq_ring.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/staging/iio/accel/lis3l02dq_ring.c 
b/drivers/staging/iio/accel/lis3l02dq_ring.c
index bf33fde..1d934ee 100644
--- a/drivers/staging/iio/accel/lis3l02dq_ring.c
+++ b/drivers/staging/iio/accel/lis3l02dq_ring.c
@@ -19,6 +19,7 @@ static inline u16 combine_8_to_16(u8 lower, u8 upper)
 {
u16 _lower = lower;
u16 _upper = upper;
+
return _lower | (_upper << 8);
 }
 
-- 
2.1.0.rc1.204.gae8bc8d

--
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/8] staging: iio: accel: adis16203_core.c: Add blank lines between declarations and code

2014-08-04 Thread Murilo Opsfelder Araujo
This patch adds missing blank lines between declarations and code,
satisfying checkpatch.pl.

Signed-off-by: Murilo Opsfelder Araujo 
---
 drivers/staging/iio/accel/adis16203_core.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/staging/iio/accel/adis16203_core.c 
b/drivers/staging/iio/accel/adis16203_core.c
index f472137..fbbe93f 100644
--- a/drivers/staging/iio/accel/adis16203_core.c
+++ b/drivers/staging/iio/accel/adis16203_core.c
@@ -37,6 +37,7 @@ static int adis16203_write_raw(struct iio_dev *indio_dev,
struct adis *st = iio_priv(indio_dev);
/* currently only one writable parameter which keeps this simple */
u8 addr = adis16203_addresses[chan->scan_index];
+
return adis_write_reg_16(st, addr, val & 0x3FFF);
 }
 
@@ -50,6 +51,7 @@ static int adis16203_read_raw(struct iio_dev *indio_dev,
int bits;
u8 addr;
s16 val16;
+
switch (mask) {
case IIO_CHAN_INFO_RAW:
return adis_single_conversion(indio_dev, chan,
-- 
2.1.0.rc1.204.gae8bc8d

--
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/8] staging: iio: accel: adis16203_core.c: fix coding style

2014-07-31 Thread Murilo Opsfelder Araujo
This patch adds missing blank line after declarations.

Signed-off-by: Murilo Opsfelder Araujo 
---
 drivers/staging/iio/accel/adis16203_core.c |2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/staging/iio/accel/adis16203_core.c 
b/drivers/staging/iio/accel/adis16203_core.c
index f472137..fbbe93f 100644
--- a/drivers/staging/iio/accel/adis16203_core.c
+++ b/drivers/staging/iio/accel/adis16203_core.c
@@ -37,6 +37,7 @@ static int adis16203_write_raw(struct iio_dev *indio_dev,
struct adis *st = iio_priv(indio_dev);
/* currently only one writable parameter which keeps this simple */
u8 addr = adis16203_addresses[chan->scan_index];
+
return adis_write_reg_16(st, addr, val & 0x3FFF);
 }
 
@@ -50,6 +51,7 @@ static int adis16203_read_raw(struct iio_dev *indio_dev,
int bits;
u8 addr;
s16 val16;
+
switch (mask) {
case IIO_CHAN_INFO_RAW:
return adis_single_conversion(indio_dev, chan,
-- 
1.7.10.4

--
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/8] staging: iio: accel: adis16201_core.c: fix coding style

2014-07-31 Thread Murilo Opsfelder Araujo
This patch adds missing blank line after declaration and fixes lines
starting by space.

Signed-off-by: Murilo Opsfelder Araujo 
---
 drivers/staging/iio/accel/adis16201_core.c |5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/iio/accel/adis16201_core.c 
b/drivers/staging/iio/accel/adis16201_core.c
index 50ba1fa..7eae5fd 100644
--- a/drivers/staging/iio/accel/adis16201_core.c
+++ b/drivers/staging/iio/accel/adis16201_core.c
@@ -111,6 +111,7 @@ static int adis16201_write_raw(struct iio_dev *indio_dev,
int bits;
s16 val16;
u8 addr;
+
switch (mask) {
case IIO_CHAN_INFO_CALIBBIAS:
switch (chan->type) {
@@ -131,8 +132,8 @@ static int adis16201_write_raw(struct iio_dev *indio_dev,
 }
 
 static const struct iio_chan_spec adis16201_channels[] = {
-  ADIS_SUPPLY_CHAN(ADIS16201_SUPPLY_OUT, ADIS16201_SCAN_SUPPLY, 0, 12),
-  ADIS_TEMP_CHAN(ADIS16201_TEMP_OUT, ADIS16201_SCAN_TEMP, 0, 12),
+   ADIS_SUPPLY_CHAN(ADIS16201_SUPPLY_OUT, ADIS16201_SCAN_SUPPLY, 0, 12),
+   ADIS_TEMP_CHAN(ADIS16201_TEMP_OUT, ADIS16201_SCAN_TEMP, 0, 12),
ADIS_ACCEL_CHAN(X, ADIS16201_XACCL_OUT, ADIS16201_SCAN_ACC_X,
BIT(IIO_CHAN_INFO_CALIBBIAS), 0, 14),
ADIS_ACCEL_CHAN(Y, ADIS16201_YACCL_OUT, ADIS16201_SCAN_ACC_Y,
-- 
1.7.10.4

--
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 5/8] staging: iio: accel: adis16240_core.c: fix coding style

2014-07-31 Thread Murilo Opsfelder Araujo
This patch adds missing blank line after declaration.

Signed-off-by: Murilo Opsfelder Araujo 
---
 drivers/staging/iio/accel/adis16240_core.c |1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/staging/iio/accel/adis16240_core.c 
b/drivers/staging/iio/accel/adis16240_core.c
index 74ace2a..205d6d0 100644
--- a/drivers/staging/iio/accel/adis16240_core.c
+++ b/drivers/staging/iio/accel/adis16240_core.c
@@ -163,6 +163,7 @@ static int adis16240_write_raw(struct iio_dev *indio_dev,
int bits = 10;
s16 val16;
u8 addr;
+
switch (mask) {
case IIO_CHAN_INFO_CALIBBIAS:
val16 = val & ((1 << bits) - 1);
-- 
1.7.10.4

--
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 3/8] staging: iio: accel: adis16204_core.c: fix coding style

2014-07-31 Thread Murilo Opsfelder Araujo
This patch adds missing blank line after declaration.

Signed-off-by: Murilo Opsfelder Araujo 
---
 drivers/staging/iio/accel/adis16204_core.c |1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/staging/iio/accel/adis16204_core.c 
b/drivers/staging/iio/accel/adis16204_core.c
index 19eaebc..4c8acbc 100644
--- a/drivers/staging/iio/accel/adis16204_core.c
+++ b/drivers/staging/iio/accel/adis16204_core.c
@@ -119,6 +119,7 @@ static int adis16204_write_raw(struct iio_dev *indio_dev,
int bits;
s16 val16;
u8 addr;
+
switch (mask) {
case IIO_CHAN_INFO_CALIBBIAS:
switch (chan->type) {
-- 
1.7.10.4

--
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 8/8] staging: iio: accel: sca3000_core.c: fix coding style

2014-07-31 Thread Murilo Opsfelder Araujo
This patch adds missing blank line after declaration and keep line in
80-chars limit.

Signed-off-by: Murilo Opsfelder Araujo 
---
 drivers/staging/iio/accel/sca3000_core.c |4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/iio/accel/sca3000_core.c 
b/drivers/staging/iio/accel/sca3000_core.c
index ed30e32..1ff299f 100644
--- a/drivers/staging/iio/accel/sca3000_core.c
+++ b/drivers/staging/iio/accel/sca3000_core.c
@@ -506,7 +506,8 @@ static int sca3000_read_raw(struct iio_dev *indio_dev,
mutex_unlock(&st->lock);
return ret;
}
-   *val = ((st->rx[0] & 0x3F) << 3) | ((st->rx[1] & 0xE0) 
>> 5);
+   *val = ((st->rx[0] & 0x3F) << 3)
+   | ((st->rx[1] & 0xE0) >> 5);
}
mutex_unlock(&st->lock);
return IIO_VAL_INT;
@@ -713,6 +714,7 @@ static int sca3000_read_thresh(struct iio_dev *indio_dev,
int ret, i;
struct sca3000_state *st = iio_priv(indio_dev);
int num = chan->channel2;
+
mutex_lock(&st->lock);
ret = sca3000_read_ctrl_reg(st, sca3000_addresses[num][1]);
mutex_unlock(&st->lock);
-- 
1.7.10.4

--
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 7/8] staging: iio: accel: lis3l02dq_ring.c: fix coding style

2014-07-31 Thread Murilo Opsfelder Araujo
This patch adds missing blank lines after declarations.

Signed-off-by: Murilo Opsfelder Araujo 
---
 drivers/staging/iio/accel/lis3l02dq_ring.c |1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/staging/iio/accel/lis3l02dq_ring.c 
b/drivers/staging/iio/accel/lis3l02dq_ring.c
index bf33fde..1d934ee 100644
--- a/drivers/staging/iio/accel/lis3l02dq_ring.c
+++ b/drivers/staging/iio/accel/lis3l02dq_ring.c
@@ -19,6 +19,7 @@ static inline u16 combine_8_to_16(u8 lower, u8 upper)
 {
u16 _lower = lower;
u16 _upper = upper;
+
return _lower | (_upper << 8);
 }
 
-- 
1.7.10.4

--
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 4/8] staging: iio: accel: adis16209_core.c: fix coding style

2014-07-31 Thread Murilo Opsfelder Araujo
This patch adds missing blank line after declaration.

Signed-off-by: Murilo Opsfelder Araujo 
---
 drivers/staging/iio/accel/adis16209_core.c |1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/staging/iio/accel/adis16209_core.c 
b/drivers/staging/iio/accel/adis16209_core.c
index 374dc6e..b2c7aed 100644
--- a/drivers/staging/iio/accel/adis16209_core.c
+++ b/drivers/staging/iio/accel/adis16209_core.c
@@ -44,6 +44,7 @@ static int adis16209_write_raw(struct iio_dev *indio_dev,
int bits;
s16 val16;
u8 addr;
+
switch (mask) {
case IIO_CHAN_INFO_CALIBBIAS:
switch (chan->type) {
-- 
1.7.10.4

--
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 6/8] staging: iio: accel: lis3l02dq_core.c: fix coding style

2014-07-31 Thread Murilo Opsfelder Araujo
This patch adds missing blank line after declarations.

Signed-off-by: Murilo Opsfelder Araujo 
---
 drivers/staging/iio/accel/lis3l02dq_core.c |4 
 1 file changed, 4 insertions(+)

diff --git a/drivers/staging/iio/accel/lis3l02dq_core.c 
b/drivers/staging/iio/accel/lis3l02dq_core.c
index 898653c..f5e145c 100644
--- a/drivers/staging/iio/accel/lis3l02dq_core.c
+++ b/drivers/staging/iio/accel/lis3l02dq_core.c
@@ -212,6 +212,7 @@ static int lis3l02dq_write_thresh(struct iio_dev *indio_dev,
  int val, int val2)
 {
u16 value = val;
+
return lis3l02dq_spi_write_reg_s16(indio_dev,
   LIS3L02DQ_REG_THS_L_ADDR,
   value);
@@ -226,6 +227,7 @@ static int lis3l02dq_write_raw(struct iio_dev *indio_dev,
int ret = -EINVAL, reg;
u8 uval;
s8 sval;
+
switch (mask) {
case IIO_CHAN_INFO_CALIBBIAS:
if (val > 255 || val < -256)
@@ -302,6 +304,7 @@ static ssize_t lis3l02dq_read_frequency(struct device *dev,
struct iio_dev *indio_dev = dev_to_iio_dev(dev);
int ret, len = 0;
s8 t;
+
ret = lis3l02dq_spi_read_reg_8(indio_dev,
   LIS3L02DQ_REG_CTRL_1_ADDR,
   (u8 *)&t);
@@ -565,6 +568,7 @@ static int lis3l02dq_read_event_config(struct iio_dev 
*indio_dev,
u8 val;
int ret;
u8 mask = (1 << (chan->channel2*2 + (dir == IIO_EV_DIR_RISING)));
+
ret = lis3l02dq_spi_read_reg_8(indio_dev,
   LIS3L02DQ_REG_WAKE_UP_CFG_ADDR,
   &val);
-- 
1.7.10.4

--
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/8] staging: iio: accel: multiple coding style fixes

2014-07-31 Thread Murilo Opsfelder Araujo
The following patches fix (almost) all warnings reported by
checkpatch.pl.

Murilo Opsfelder Araujo (8):
  staging: iio: accel: adis16203_core.c: fix coding style
  staging: iio: accel: adis16201_core.c: fix coding style
  staging: iio: accel: adis16204_core.c: fix coding style
  staging: iio: accel: adis16209_core.c: fix coding style
  staging: iio: accel: adis16240_core.c: fix coding style
  staging: iio: accel: lis3l02dq_core.c: fix coding style
  staging: iio: accel: lis3l02dq_ring.c: fix coding style
  staging: iio: accel: sca3000_core.c: fix coding style

 drivers/staging/iio/accel/adis16201_core.c |5 +++--
 drivers/staging/iio/accel/adis16203_core.c |2 ++
 drivers/staging/iio/accel/adis16204_core.c |1 +
 drivers/staging/iio/accel/adis16209_core.c |1 +
 drivers/staging/iio/accel/adis16240_core.c |1 +
 drivers/staging/iio/accel/lis3l02dq_core.c |4 
 drivers/staging/iio/accel/lis3l02dq_ring.c |1 +
 drivers/staging/iio/accel/sca3000_core.c   |4 +++-
 8 files changed, 16 insertions(+), 3 deletions(-)

--
1.7.10.4
--
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: android: sync.c: fix missing blank line after declaration

2014-07-31 Thread Murilo Opsfelder Araujo

On 07/30/2014 09:17 PM, Greg KH wrote:

Also doesn't apply, are you sure you are using the staging-next branch
of staging.git on git.kernel.org?


I was using linux-next, not staging-next.  sync.c has no checkpatch.pl 
warnings in staging-next.


Sorry for the false alarm, guys.

--
Murilo
--
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: android: sw_sync.c: fix missing blank line after declaration

2014-07-31 Thread Murilo Opsfelder Araujo

On 07/30/2014 09:17 PM, Greg KH wrote:

Does not apply to my tree at all :(


I was using linux-next.  No checkpatch.pl warnings for sw_sync.c in 
staging-next.


--
Murilo
--
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] Staging: android: timed_gpio.c: improved logic of gpio_get_time()

2014-07-31 Thread Murilo Opsfelder Araujo
This patch improves the logic of gpio_get_time() and, thereafter,
makes checkpatch.pl happy.

Signed-off-by: Murilo Opsfelder Araujo 
---

Thanks for reviweing my patch, Dan.  I think I got the proper way
without using option --scissors in git-am.

What about this new commit message?

 drivers/staging/android/timed_gpio.c |   15 ---
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/android/timed_gpio.c 
b/drivers/staging/android/timed_gpio.c
index 180c209..8fa4758 100644
--- a/drivers/staging/android/timed_gpio.c
+++ b/drivers/staging/android/timed_gpio.c
@@ -45,16 +45,17 @@ static enum hrtimer_restart gpio_timer_func(struct hrtimer 
*timer)

 static int gpio_get_time(struct timed_output_dev *dev)
 {
-   struct timed_gpio_data  *data =
-   container_of(dev, struct timed_gpio_data, dev);
+   struct timed_gpio_data *data;
+   struct timeval t;

-   if (hrtimer_active(&data->timer)) {
-   ktime_t r = hrtimer_get_remaining(&data->timer);
-   struct timeval t = ktime_to_timeval(r);
+   data = container_of(dev, struct timed_gpio_data, dev);

-   return t.tv_sec * 1000 + t.tv_usec / 1000;
-   } else
+   if (!hrtimer_active(&data->timer))
return 0;
+
+   t = ktime_to_timeval(hrtimer_get_remaining(&data->timer));
+
+   return t.tv_sec * 1000 + t.tv_usec / 1000;
 }

 static void gpio_enable(struct timed_output_dev *dev, int value)
--
1.7.10.4
--
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] Staging: android: timed_gpio.c: improved logic of gpio_get_time()

2014-07-30 Thread Murilo Opsfelder Araujo
Thanks for reviewing my first patch, Joe.  How about this new one,
guys?

-- >8 --
Consequently, made checkpatch.pl happy.

Signed-off-by: Murilo Opsfelder Araujo 
---
 drivers/staging/android/timed_gpio.c |   15 ---
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/android/timed_gpio.c 
b/drivers/staging/android/timed_gpio.c
index 180c209..8fa4758 100644
--- a/drivers/staging/android/timed_gpio.c
+++ b/drivers/staging/android/timed_gpio.c
@@ -45,16 +45,17 @@ static enum hrtimer_restart gpio_timer_func(struct hrtimer 
*timer)

 static int gpio_get_time(struct timed_output_dev *dev)
 {
-   struct timed_gpio_data  *data =
-   container_of(dev, struct timed_gpio_data, dev);
+   struct timed_gpio_data *data;
+   struct timeval t;

-   if (hrtimer_active(&data->timer)) {
-   ktime_t r = hrtimer_get_remaining(&data->timer);
-   struct timeval t = ktime_to_timeval(r);
+   data = container_of(dev, struct timed_gpio_data, dev);

-   return t.tv_sec * 1000 + t.tv_usec / 1000;
-   } else
+   if (!hrtimer_active(&data->timer))
return 0;
+
+   t = ktime_to_timeval(hrtimer_get_remaining(&data->timer));
+
+   return t.tv_sec * 1000 + t.tv_usec / 1000;
 }

 static void gpio_enable(struct timed_output_dev *dev, int value)
--
1.7.10.4
--
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] Staging: bcm: Bcmchar.c: remove else statement after return

2014-07-28 Thread Murilo Opsfelder Araujo
This patch makes checkpatch.pl script happier by fixing all warnings
related to else statement after break or return.

Signed-off-by: Murilo Opsfelder Araujo 
---
 drivers/staging/bcm/Bcmchar.c |   21 ++---
 1 file changed, 10 insertions(+), 11 deletions(-)

diff --git a/drivers/staging/bcm/Bcmchar.c b/drivers/staging/bcm/Bcmchar.c
index c1e01f7..5790627 100644
--- a/drivers/staging/bcm/Bcmchar.c
+++ b/drivers/staging/bcm/Bcmchar.c
@@ -561,10 +561,10 @@ static int bcm_char_ioctl_gpio_set_request(void __user 
*argp,
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, OSAL_DBG, DBG_LVL_ALL,
"GPIO_MODE_REGISTER read failed");
return Status;
-   } else {
-   Status = STATUS_SUCCESS;
}
 
+   Status = STATUS_SUCCESS;
+
/* Set the gpio mode register to output */
*(UINT *)ucResetValue |= (1<fw_download_sema);
up(&Adapter->NVMRdmWrmLock);
return Status;
-   } else {
-   BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, OSAL_DBG,
-   DBG_LVL_ALL, "Firm Download Over...\n");
}
 
+   BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, OSAL_DBG,
+   DBG_LVL_ALL, "Firm Download Over...\n");
+
mdelay(10);
 
/* Wait for MailBox Interrupt */
@@ -2649,4 +2649,3 @@ void unregister_control_device_interface(struct 
bcm_mini_adapter *Adapter)
unregister_chrdev(Adapter->major, DEV_NAME);
}
 }
-
-- 
1.7.10.4

--
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] Staging: android: timed_output.c: use kstrtoint() instead of sscanf()

2014-07-28 Thread Murilo Opsfelder Araujo
This patch makes checkpatch.pl happy by fixing the following warning:

WARNING: Prefer kstrto to single variable sscanf

Signed-off-by: Murilo Opsfelder Araujo 
---
 drivers/staging/android/timed_output.c |4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/android/timed_output.c 
b/drivers/staging/android/timed_output.c
index c341ac1..b41429f 100644
--- a/drivers/staging/android/timed_output.c
+++ b/drivers/staging/android/timed_output.c
@@ -41,8 +41,10 @@ static ssize_t enable_store(struct device *dev, struct 
device_attribute *attr,
 {
struct timed_output_dev *tdev = dev_get_drvdata(dev);
int value;
+   int rc;
 
-   if (sscanf(buf, "%d", &value) != 1)
+   rc = kstrtoint(buf, 0, &value);
+   if (rc != 0)
return -EINVAL;
 
tdev->enable(tdev, value);
-- 
1.7.10.4

--
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] Staging: android: timed_gpio.c: remove else statement after return

2014-07-28 Thread Murilo Opsfelder Araujo
This patch makes checkpatch.pl script happy by fixing the following
warning:

WARNING: else is not generally useful after a break or return

Signed-off-by: Murilo Opsfelder Araujo 
---
 drivers/staging/android/timed_gpio.c |5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/android/timed_gpio.c 
b/drivers/staging/android/timed_gpio.c
index 180c209..05cb578 100644
--- a/drivers/staging/android/timed_gpio.c
+++ b/drivers/staging/android/timed_gpio.c
@@ -53,8 +53,9 @@ static int gpio_get_time(struct timed_output_dev *dev)
struct timeval t = ktime_to_timeval(r);
 
return t.tv_sec * 1000 + t.tv_usec / 1000;
-   } else
-   return 0;
+   }
+
+   return 0;
 }
 
 static void gpio_enable(struct timed_output_dev *dev, int value)
-- 
1.7.10.4

--
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] Staging: android: sync.c: fix missing blank line after declaration

2014-07-28 Thread Murilo Opsfelder Araujo
Fix coding style issue.

Signed-off-by: Murilo Opsfelder Araujo 
---
 drivers/staging/android/sync.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/android/sync.c b/drivers/staging/android/sync.c
index e7b2e02..69c16cb 100644
--- a/drivers/staging/android/sync.c
+++ b/drivers/staging/android/sync.c
@@ -705,6 +705,7 @@ static long sync_fence_ioctl(struct file *file, unsigned 
int cmd,
 unsigned long arg)
 {
struct sync_fence *fence = file->private_data;
+
switch (cmd) {
case SYNC_IOC_WAIT:
return sync_fence_ioctl_wait(fence, arg);
@@ -726,4 +727,3 @@ static const struct file_operations sync_fence_fops = {
.unlocked_ioctl = sync_fence_ioctl,
.compat_ioctl = sync_fence_ioctl,
 };
-
-- 
1.7.10.4

--
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] Staging: android: sw_sync.c: fix missing blank line after declaration

2014-07-28 Thread Murilo Opsfelder Araujo
Fix coding style issue.

Signed-off-by: Murilo Opsfelder Araujo 
---
 drivers/staging/android/sw_sync.c |2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/staging/android/sw_sync.c 
b/drivers/staging/android/sw_sync.c
index a76db3f..863d4b1 100644
--- a/drivers/staging/android/sw_sync.c
+++ b/drivers/staging/android/sw_sync.c
@@ -97,6 +97,7 @@ static void sw_sync_pt_value_str(struct sync_pt *sync_pt,
   char *str, int size)
 {
struct sw_sync_pt *pt = (struct sw_sync_pt *)sync_pt;
+
snprintf(str, size, "%d", pt->value);
 }
 
@@ -156,6 +157,7 @@ static int sw_sync_open(struct inode *inode, struct file 
*file)
 static int sw_sync_release(struct inode *inode, struct file *file)
 {
struct sw_sync_timeline *obj = file->private_data;
+
sync_timeline_destroy(&obj->obj);
return 0;
 }
-- 
1.7.10.4

--
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] trivial: fix a typo in Documentation/00-INDEX

2013-08-20 Thread Murilo Opsfelder Araujo
Signed-off-by: Murilo Opsfelder Araujo 
---
 Documentation/00-INDEX | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Documentation/00-INDEX b/Documentation/00-INDEX
index 0c4cc68..38f8444 100644
--- a/Documentation/00-INDEX
+++ b/Documentation/00-INDEX
@@ -40,7 +40,7 @@ IPMI.txt
 IRQ-affinity.txt
- how to select which CPU(s) handle which interrupt events on SMP.
 IRQ-domain.txt
-   - info on inerrupt numbering and setting up IRQ domains.
+   - info on interrupt numbering and setting up IRQ domains.
 IRQ.txt
- description of what an IRQ is.
 Intel-IOMMU.txt
--
1.8.3.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] trivial: fix a typo in Documentation/00-INDEX

2013-08-19 Thread Murilo Opsfelder Araujo
---
 Documentation/00-INDEX | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Documentation/00-INDEX b/Documentation/00-INDEX
index 0c4cc68..38f8444 100644
--- a/Documentation/00-INDEX
+++ b/Documentation/00-INDEX
@@ -40,7 +40,7 @@ IPMI.txt
 IRQ-affinity.txt
- how to select which CPU(s) handle which interrupt events on SMP.
 IRQ-domain.txt
-   - info on inerrupt numbering and setting up IRQ domains.
+   - info on interrupt numbering and setting up IRQ domains.
 IRQ.txt
- description of what an IRQ is.
 Intel-IOMMU.txt
-- 
1.8.3.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/