ARM: make kernel oops easier to read

We don't need the offset for the first function name in each backtrace
entry; this needlessly consumes screen space.  This is virtually always
the first or second instruction in the called function.

Also, recognise stmfd instructions which include r10 as a valid stack
saving instruction, and when dumping the registers, dump six registers
per line rather than five, and fix the wrapping.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
initramfs: remove "compression mode" choice

Commit ("initramfs: read CONFIG_RD_ variables for initramfs compression")
removed the users of the various INITRAMFS_COMPRESSION_*
Kconfig symbols.  So since v3.13 the entire "Built-in initramfs
compression mode" choice is a set of knobs connected to nothing.  The
entire choice can safely be removed.

Signed-off-by: Paul Bolle <pebolle@tiscali.nl>
Cc: P J P <ppandit@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
kconfig: update compression algorithm info

There have been new compression algorithms added without updating nearby
relevant descriptive text that refers to (a) the number of compression
algorithms and (b) the most recent one.  Fix these inconsistencies.

Signed-off-by: Randy Dunlap <rdunlap@xenotime.net>
Reported-by: <qasdfgtyuiop@gmail.com>
Cc: Lasse Collin <lasse.collin@tukaani.org>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Markus Trippelsdorf <markus@trippelsdorf.de>
Cc: Alain Knaff <alain@knaff.lu>
Cc: Albin Tonnerre <albin.tonnerre@free-electrons.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
scripts/gen_initramfs_list.sh: fix flags for initramfs LZ4 compression

LZ4 as implemented in the kernel differs from the default method now
used by the reference implementation of LZ4.  Until the in-kernel method
is updated to support the new default, passing the legacy flag (-l) to
the compressor is necessary.  Without this flag the kernel-generated,
LZ4-compressed initramfs is junk.

Kyungsik said:

: It seems that lz4 supports legacy format with the same option as lz4c
: does.  Just looking at the first few bytes of lz4 compressed image, we can
: see whether it is new format or not.
:
: It shows new format magic number without this patch.  New format magic
: number is 0x184d2204.
:
: $ hexdump -C ./initramfs_data.cpio.lz4 |more
: 00000000  04 22 4d 18 64 70 b9 69 (Little Endian)
: ...
:
: Currently kernel supports legacy format only.

Signed-off-by: Daniel M. Weeks <dan@danweeks.net>
Cc: Michal Marek <mmarek@suse.cz>
Acked-by: Kyungsik Lee <kyungsik.lee@lge.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
gen_init_cpio: remove redundant empty line

Just a completely trivial patch to remove a completely redundant blank
line from usr/gen_init_cpio.c

Signed-off-by: Jesper Juhl <jj@codesealer.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
getenv() may return NULL if given environment variable does not exist which leads to NULL dereference when calling strncat.

Besides that, the environment variable name was copied to a temporary
env_var buffer, but this copying can be avoided by simply using the input
string.

Lastly, the whole loop can be greatly simplified by using the snprintf
function instead of the playing with strncat.

 By the way, the current implementation allows a recursive variable
 expansion, as in:

   $ echo 'out ${A} out ' | A='a ${B} a' B=b /tmp/a
   out a b a out

 I'm assuming this is just a side effect and not a conscious decision
 (especially as this may lead to infinite loop), but I didn't want to
 change this behaviour without consulting.

 If the current behaviour is deamed incorrect, I'll be happy to send
 a patch without recursive processing.

Signed-off-by: Michal Nazarewicz <mina86@mina86.com>
Cc: Kees Cook <keescook@chromium.org>
Cc: Jiri Kosina <jkosina@suse.cz>
Cc: Jesper Juhl <jj@codesealer.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
ARM: 7583/1: decompressor: Enable unaligned memory access for v6 and above

Modern GCC can generate code which makes use of the CPU's native
unaligned memory access capabilities.  This is useful for the C
decompressor implementations used for unpacking compressed kernels.

This patch disables alignment faults and enables the v6 unaligned
access model on CPUs which support these features (i.e., v6 and
later), allowing full unaligned access support for C code in the
decompressor.

The decompressor C code must not be built to assume that unaligned
access works if support for v5 or older platforms is included in
the kernel.

For correct code generation, C decompressor code must always use
the get_unaligned and put_unaligned accessors when dealing with
unaligned pointers, regardless of this patch.

Signed-off-by: Dave Martin <dave.martin@linaro.org>
Acked-by: Nicolas Pitre <nico@linaro.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
ASoC: wcd9320: Check denominator for zero before division

Check denominator for zero before performing division
operation to preven division by zero error.

Signed-off-by: Phani Kumar Uppalapati <phaniu@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
ASoC: wcd9320: Update condition to disable HPH PA after impedance detection

For headsets with threshold on mic, the flag hph_pa_dac_state gets
cleared once they are re-inserted into headphone jack with hph pas
are still ON. This causes impedance detection to disable the PA after
impedance computations. This will result into audio mute. Avoid the audio
mute by updating the condition to disable PAs.

Signed-off-by: Phani Kumar Uppalapati <phaniu@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
ASoC: msm: qdsp6v2: avoid null pointer dereference

If memory allocation fails or allocation of extremely
large buffer is attempted causing kmalloc to return a
NULL, the present code goes ahead and dereferences the
NULL pointer.
The change returns from the function immediately if
kmalloc returns NULL.

Signed-off-by: Aravind Kumar <akumark@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
net/l2tp: don't fall back on UDP [get|set]sockopt

The l2tp [get|set]sockopt() code has fallen back to the UDP functions
for socket option levels != SOL_PPPOL2TP since day one, but that has
never actually worked, since the l2tp socket isn't an inet socket.

As David Miller points out:

  "If we wanted this to work, it'd have to look up the tunnel and then
   use tunnel->sk, but I wonder how useful that would be"

Since this can never have worked so nobody could possibly have depended
on that functionality, just remove the broken code and return -EINVAL.

Reported-by: Sasha Levin <sasha.levin@oracle.com>
Acked-by: James Chapman <jchapman@katalix.com>
Acked-by: David Miller <davem@davemloft.net>
Cc: Phil Turnbull <phil.turnbull@oracle.com>
Cc: Vegard Nossum <vegard.nossum@oracle.com>
Cc: Willy Tarreau <w@1wt.eu>
Cc: stable@vger.kernel.org
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
msm: mdss: primary intf and panel config

Devicetree contains properties that specify the preferred
primary panel interface for MDP. Parse this information from
MDP and provide it to the individual controller.
Each controller driver reads devicetree property
to initialize the preferred panel.

Add bindings for property, under MDSS-MDP, to indicate
the panel interface such as dsi, hdmi, edp etc.
Panel interfaces are configured independently based on
msm board type. Add property that informs MDSS about
the panel interface to be used.

This facilitates the ability to use different panel
interfaces irrespective of the board or SoC.
Add bindings for property under DSI controller node to
indicate the preferred primary panel.
This allows to implement the ability to use different panel
irrespective of the board or SoC

Signed-off-by: Manoj Rao <manojraj@codeaurora.org>
Signed-off-by: Jayant Shekhar <jshekhar@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
msm: mdss: Fix export of mdss_is_ready()

Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
arm/dts: hammerhead: Add JDI 1080p command mode panel config

Use a seperate config file. Move some stuff around an apply
a cleanup.

Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
msm: mdss: primary panel config from boot param

Add ability to read kernel's boot parameters to
check for primary panel interface and panel
configuration. The parameter passes three
fields of information which are parsed by the MDP
driver as a part of the device probe.

Format for cmdline param expected is:
"mdss_mdp.panel=<lk_cfg>:<pan_intf>:<dt_node_name_panel>"
where <lk_cfg> is "1" - lk/gcdb config or "0" non-lk/non-gcdb
config;
<pan_intf> is one of "dsi:<ctrl_id>", "hdmi", "edp";
and <dt_node_name_panel> is the string identical to panel's
device node name from the DT.

Change-Id: Ib9e7e4b69c62537f551aaf9ccaf0dd69eddd6889
Signed-off-by: Manoj Rao <manojraj@codeaurora.org>
Signed-off-by: Jayant Shekhar <jshekhar@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
msm: mdss: remove dsi panel device probe

Remove dsi panel's device probe since the
dsi controller initializes the panel through
the phandle from device tree. dsi panels are
moved under mdss mdp device and are no longer
treated as devices themselves. This enables the
implementation of dsi panel detection.

Change-Id: I3a9966027042fe4f05ba26115079d89ec5a765eb
Signed-off-by: Manoj Rao <manojraj@codeaurora.org>
Signed-off-by: Jayant Shekhar <jshekhar@codeaurora.org>
Signed-off-by: Pawan Kumar <pavaku@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
msm: mdss: Sanitize post processing inputs

Sanitize the inputs to histogram, assertive display, and calibration buffer
so that invalid values cannot be used as feature configuration.

CRs-Fixed: 516710
Change-Id: Ifb585174b1baadbac628f53fe67f3c3b3ae61a54
Signed-off-by: Carl Vanderlip <carlv@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
msm: mdss: Prevent AD on out of range displays

Prevent array out of bounds error when displays fall out of range for AD
support.

Change-Id: Iffebee5ed78bf256c8dd7c6f62587ac27cb2241e
Signed-off-by: Carl Vanderlip <carlv@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
msm: mdss: Make sure MDP clocks are voted for while AD is stabilizing

MDP clocks were not voted for while AD stabilization was in progress,
which could result in unclocked register access in certain use cases.

Make sure MDP clocks are voted for as long as AD is stabilizing.

Change-Id: I5598beee152585a9a9bf9aefd1121f3561dbc0b8
Signed-off-by: Pravin Tamkhane <pravint@codeaurora.org>
Signed-off-by: Ping Li <quicpingli@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
msm: mdss: Correction in cyclical reading of histogram bins

The iteration condition in loop for reading histogram bin has an
error. We are essentially missing out on the value of one bin.

Change-Id: I713ad6c580374173b38cd1a1f4f8120f55cf1452
Signed-off-by: Krishna Chaitanya Parimi <cparimi@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>