firefly-linux-kernel-4.4.55.git
11 years agostaging: zcache: using strlcpy instead of strncpy
Chen Gang [Fri, 8 Mar 2013 00:47:50 +0000 (08:47 +0800)]
staging: zcache: using strlcpy instead of strncpy

  for NUL terminated string, need alway set '\0' in the end.

Signed-off-by: Chen Gang <gang.chen@asianux.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: csr: csr_time.c: Fix coding style
SeongJae Park [Sat, 2 Mar 2013 01:45:17 +0000 (10:45 +0900)]
staging: csr: csr_time.c: Fix coding style

Signed-off-by: SeongJae Park <sj38.park@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: dgrp: Drop unnecessary typecast
Guenter Roeck [Thu, 28 Feb 2013 19:46:57 +0000 (11:46 -0800)]
staging: dgrp: Drop unnecessary typecast

An unnecessary typecast in dgrp_net_ops.c causes the following build error
if compiled with W=1.

In function ‘copy_from_user’, inlined from ‘dgrp_net_ioctl’ at
    drivers/staging/dgrp/dgrp_net_ops.c:3408:21:
    arch/x86/include/asm/uaccess_32.h:211:26: error: call to
    ‘copy_from_user_overflow’ declared with attribute error: copy_from_user()
    buffer size is not provably correct

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agortl8712: remove redundant if statement
Niklas Söderlund [Wed, 27 Feb 2013 19:40:06 +0000 (20:40 +0100)]
rtl8712: remove redundant if statement

Same result no matter what path is taken.

Signed-off-by: Niklas Söderlund <niso@kth.se>
Acked-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agortl8712: remove unused definitions from rtl871x_recv.h
Niklas Söderlund [Thu, 28 Feb 2013 19:04:03 +0000 (20:04 +0100)]
rtl8712: remove unused definitions from rtl871x_recv.h

Signed-off-by: Niklas Söderlund <niso@kth.se>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agortl8712: remove dead function prototypes from rtl871x_recv.h
Niklas Söderlund [Thu, 28 Feb 2013 19:04:02 +0000 (20:04 +0100)]
rtl8712: remove dead function prototypes from rtl871x_recv.h

There is no implementation of these functions anywhere in the code.

Signed-off-by: Niklas Söderlund <niso@kth.se>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agortl8712: remove unused functions from rtl871x_recv.h
Niklas Söderlund [Thu, 28 Feb 2013 19:04:01 +0000 (20:04 +0100)]
rtl8712: remove unused functions from rtl871x_recv.h

Signed-off-by: Niklas Söderlund <niso@kth.se>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: omap-thermal: update clock prepare count
Eduardo Valentin [Tue, 26 Feb 2013 22:53:38 +0000 (18:53 -0400)]
staging: omap-thermal: update clock prepare count

This patch changes the clock management code to also update
the clock prepare counter, this way we won't skip the enable/disable
operation due to prepare dependencies.

Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: omap-thermal: name data files accordingly
Eduardo Valentin [Tue, 26 Feb 2013 22:53:37 +0000 (18:53 -0400)]
staging: omap-thermal: name data files accordingly

This patch simply changes the name of files containing data structure definition.

Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: omap-thermal: Remove double conv_table reference
Eduardo Valentin [Tue, 26 Feb 2013 22:53:36 +0000 (18:53 -0400)]
staging: omap-thermal: Remove double conv_table reference

This patch removes from data structure the double reference of
the conversion table. It keeps the reference coming from bandgap
data definition. The patch also adapts the code accordingly.

Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: omap-thermal: add DT example for OMAP54xx devices
Eduardo Valentin [Tue, 26 Feb 2013 22:53:35 +0000 (18:53 -0400)]
staging: omap-thermal: add DT example for OMAP54xx devices

Update documentation with DT example for OMAP54xx devices.

Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: omap-thermal: update DT entry documentation
Eduardo Valentin [Tue, 26 Feb 2013 22:53:34 +0000 (18:53 -0400)]
staging: omap-thermal: update DT entry documentation

Simple update on documentation file for DT. This patch
also adds an example for OMAP4430 and 0MAP4470, and also updated
OMAP4460's example.

Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: omap-thermal: introduze FREEZE_BIT feature
Eduardo Valentin [Tue, 26 Feb 2013 22:53:33 +0000 (18:53 -0400)]
staging: omap-thermal: introduze FREEZE_BIT feature

For ES2.0 devices, it is not guaranteed that current DTEMP
or DTEMP0 from the history buffer are going to contain
correct values, due to desynchronization between BG clk
and OCP clk.

For this reason, this patch changes the driver to first:
a. consider a feature flag, FREEZE_BIT, in order to check
it is possible to freeze the history buffer or not.
b. whenever reading the temperature, it will fetch from
DTEMP1 instead of DTEMP or DTEMP0.

This WA is applicable only for OMAP5430 ES2.0.

Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: omap-thermal: remove dedicated counter register for OMAP5
Eduardo Valentin [Tue, 26 Feb 2013 22:53:32 +0000 (18:53 -0400)]
staging: omap-thermal: remove dedicated counter register for OMAP5

On OMAP54xx there is only one counter register. For this reason,
each domain must use the same counter register. This patch changes
the data definition to coupe with this.

Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: omap-thermal: update feature bitfield for OMAP54xx
Eduardo Valentin [Tue, 26 Feb 2013 22:53:31 +0000 (18:53 -0400)]
staging: omap-thermal: update feature bitfield for OMAP54xx

This patch removes from OMAP54xx the features:
. CLK_CTRL
. COUNTER
. MODE_CONFIG

Because these features are not present in OMAP54xx ES2.0

Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: omap-thermal: update OMAP54xx clock sources
Eduardo Valentin [Tue, 26 Feb 2013 22:53:30 +0000 (18:53 -0400)]
staging: omap-thermal: update OMAP54xx clock sources

This patch updates the OMAP54xx data structure to use
the right clock source name for ES2.0.

Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: omap-thermal: introduce new features of OMAP54xx
Eduardo Valentin [Tue, 26 Feb 2013 22:53:29 +0000 (18:53 -0400)]
staging: omap-thermal: introduce new features of OMAP54xx

On OMAP54xx ES2.0 there are new features inside the bandgap
device. This patch introduces the registers definition
to access these features and adapts the data structures
to map these new registers. The new features are:

. SIDLE mode
. Cumulative register
. History buffer.
. Buffer freeze bit
. Buffer clear bit

Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: omap-thermal: remove from register map soc and mode on OMAP5
Eduardo Valentin [Tue, 26 Feb 2013 22:53:28 +0000 (18:53 -0400)]
staging: omap-thermal: remove from register map soc and mode on OMAP5

On OMAP54xx ES2.0 there is no single read and only one mode: continuous
mode. For this reason, there is no point in defining register fields
for these operations.

Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: omap-thermal: standardize register nomenclature to use 'GPU'
Eduardo Valentin [Tue, 26 Feb 2013 22:53:27 +0000 (18:53 -0400)]
staging: omap-thermal: standardize register nomenclature to use 'GPU'

In order to keep same nomenclature across the register definition,
this change will make all 'MM' suffixes to be named 'GPU'.

Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: omap-thermal: update OMAP54xx conv_table
Radhesh Fadnis [Tue, 26 Feb 2013 22:53:26 +0000 (18:53 -0400)]
staging: omap-thermal: update OMAP54xx conv_table

This patch updates the ADC conversion table for OMAP5430 ES2.0 devices.

Signed-off-by: Radhesh Fadnis <radhesh.fadnis@ti.com>
Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: omap-thermal: introduce clock feature flag
Radhesh Fadnis [Tue, 26 Feb 2013 22:53:25 +0000 (18:53 -0400)]
staging: omap-thermal: introduce clock feature flag

The clock to Bandgap module is SW controlled on some version of
OMAP silicon (OMAP44xx). But on OMAP54xx ES2.0
onwards this is HW-Auto controlled. Hence introduce a feature flag
to use/not-to-use SW enable/disable of BG clock.

Signed-off-by: Radhesh Fadnis <radhesh.fadnis@ti.com>
Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: omap-thermal: Add print when TSHUT temperature reached
Ruslan Ruslichenko [Tue, 26 Feb 2013 22:53:24 +0000 (18:53 -0400)]
staging: omap-thermal: Add print when TSHUT temperature reached

To indicate that board was shut down due to TSHUT temperature reached
it is good to print some information message before shutting down.

Signed-off-by: Ruslan Ruslichenko <x0191366@ti.com>
Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agowlan-ng: add a bounds check
Dan Carpenter [Wed, 27 Feb 2013 05:13:45 +0000 (08:13 +0300)]
wlan-ng: add a bounds check

I'm not sure where these results come from, but it can't hurt to
add a sanity check the array offset.  The .results[] array on the
next line has HFA384x_CHINFORESULT_MAX (16) elements.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agowlan-ng: clean up prism2sta_inf_chinforesults()
Dan Carpenter [Wed, 27 Feb 2013 05:12:06 +0000 (08:12 +0300)]
wlan-ng: clean up prism2sta_inf_chinforesults()

This function is ugly because it hits against the 80 character
limit.  This patch does several things to clean it up.

1) Introduces "result" instead of inf->info.chinforesult.result[n].
2) Reverses the ".scanchannels & (1 << i)" so everthing can be
   pulled in one indent level.
3) Use "chan" instead of "channel".
4) Tweaks the line breaks to the call to pr_debug().

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: line6: pod.c: fix checkpatch warning
Laurent Navet [Mon, 25 Feb 2013 13:08:49 +0000 (14:08 +0100)]
staging: line6: pod.c: fix checkpatch warning

 - WARNING: braces {} are not necessary for single statement blocks

Signed-off-by: Laurent Navet <laurent.navet@gmail.com>
Reviewed-by: Stefan Hajnoczi <stefanha@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: usbip: removed lines over 80 characters
Kurt Kanzenbach [Fri, 22 Feb 2013 11:13:34 +0000 (12:13 +0100)]
staging: usbip: removed lines over 80 characters

This patch fixes the following checkpatch warning:
-WARNING: line over 80 characters

Signed-off-by: Kurt Kanzenbach <ly80toro@cip.cs.fau.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: usbip: userspace: fix whitespace errors
Stefan Reif [Fri, 22 Feb 2013 11:13:33 +0000 (12:13 +0100)]
staging: usbip: userspace: fix whitespace errors

This patch fixes the following checkpatch errors:
-ERROR: space required after that ','
-ERROR: spaces required around that '='
-ERROR: space prohibited before that close parenthesis
-WARNING: please, no space before tabs

Signed-off-by: Stefan Reif <ke42caxa@cip.cs.fau.de>
Signed-off-by: Kurt Kanzenbach <ly80toro@cip.cs.fau.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: usbip: remove unnecessary braces
Stefan Reif [Fri, 22 Feb 2013 11:13:32 +0000 (12:13 +0100)]
staging: usbip: remove unnecessary braces

This patch fixes the following checkpatch warning:
-WARNING: braces {} are not necessary for any arm of this statement

Signed-off-by: Stefan Reif <ke42caxa@cip.cs.fau.de>
Signed-off-by: Kurt Kanzenbach <ly80toro@cip.cs.fau.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: usbip: userspace: libsrc: added missing space
Kurt Kanzenbach [Fri, 22 Feb 2013 11:13:31 +0000 (12:13 +0100)]
staging: usbip: userspace: libsrc: added missing space

This patch fixes the following checkpatch warning:
-WARNING: missing space after enum definition

Signed-off-by: Kurt Kanzenbach <ly80toro@cip.cs.fau.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: usbip: userspace: libsrc: removed assignments in if conditions
Kurt Kanzenbach [Fri, 22 Feb 2013 11:13:30 +0000 (12:13 +0100)]
staging: usbip: userspace: libsrc: removed assignments in if conditions

This patch fixes the following checkpatch error:
-ERROR: do not use assignment in if condition

Signed-off-by: Kurt Kanzenbach <ly80toro@cip.cs.fau.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: usbip: userspace: libsrc: replaced lines over 80 characters
Kurt Kanzenbach [Fri, 22 Feb 2013 11:13:29 +0000 (12:13 +0100)]
staging: usbip: userspace: libsrc: replaced lines over 80 characters

This patch fixes some of the following checkpatch warnings:
-WARNING: line over 80 characters

We did not split format strings for readability.

Signed-off-by: Kurt Kanzenbach <ly80toro@cip.cs.fau.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: usbip: userspace: libsrc: (foo*) should be (foo *)
Kurt Kanzenbach [Fri, 22 Feb 2013 11:13:28 +0000 (12:13 +0100)]
staging: usbip: userspace: libsrc: (foo*) should be (foo *)

This patch fixes the following checkpatch error:
-ERROR: "(foo*)" should be "(foo *)"

Signed-off-by: Kurt Kanzenbach <ly80toro@cip.cs.fau.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: usbip: userspace: libsrc: spaces required around that '='
Kurt Kanzenbach [Fri, 22 Feb 2013 11:13:27 +0000 (12:13 +0100)]
staging: usbip: userspace: libsrc: spaces required around that '='

This patch fixes the following checkpatch error:
-ERROR: spaces required around that '='

Signed-off-by: Kurt Kanzenbach <ly80toro@cip.cs.fau.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: usbip: userspace: libsrc: do not init static/globals to 0
Kurt Kanzenbach [Fri, 22 Feb 2013 11:13:26 +0000 (12:13 +0100)]
staging: usbip: userspace: libsrc: do not init static/globals to 0

This patch fixes the following checkpatch errors:
-ERROR: do not initialise statics to 0 or NULL
-ERROR: do not initialise globals to 0 or NULL

Signed-off-by: Kurt Kanzenbach <ly80toro@cip.cs.fau.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: usbip: userspace: libsrc: fix indention
Kurt Kanzenbach [Fri, 22 Feb 2013 11:13:25 +0000 (12:13 +0100)]
staging: usbip: userspace: libsrc: fix indention

This patch fixes the following checkpatch warning:
-ERROR: code indent should use tabs where possible
-WARNING: suspect code indent for conditional statements

Signed-off-by: Kurt Kanzenbach <ly80toro@cip.cs.fau.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: silicom: Remove redundant NULL check before kfree
Syam Sidhardhan [Wed, 6 Mar 2013 20:14:54 +0000 (01:44 +0530)]
staging: silicom: Remove redundant NULL check before kfree

kfree on NULL pointer is a no-op.

Signed-off-by: Syam Sidhardhan <s.syam@samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agoStaging: silicom: bp_mod: Removed trailing whitespaces
Alexandru Gheorghiu [Tue, 26 Feb 2013 14:53:16 +0000 (16:53 +0200)]
Staging: silicom: bp_mod: Removed trailing whitespaces

Fixed coding style issue.

Signed-off-by: Alexandru Gheorghiu <gheorghiuandru@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: fix all sparse warnings in silicom/bypasslib/
Randy Dunlap [Thu, 21 Feb 2013 02:32:28 +0000 (18:32 -0800)]
staging: fix all sparse warnings in silicom/bypasslib/

Fix all sparse warning in drivers/staging/silicom/bypasslib/,
e.g.:

drivers/staging/silicom/bypasslib/bypass.c:471:21: warning: non-ANSI function declaration of function 'init_lib_module'
drivers/staging/silicom/bypasslib/bypass.c:478:25: warning: non-ANSI function declaration of function 'cleanup_lib_module'
drivers/staging/silicom/bypasslib/bypass.c:137:5: warning: symbol 'is_bypass_dev' was not declared. Should it be static?
drivers/staging/silicom/bypasslib/bypass.c:182:5: warning: symbol 'is_bypass' was not declared. Should it be static?
drivers/staging/silicom/bypasslib/bypass.c:192:5: warning: symbol 'get_bypass_slave' was not declared. Should it be static?
drivers/staging/silicom/bypasslib/bypass.c:197:5: warning: symbol 'get_bypass_caps' was not declared. Should it be static?
drivers/staging/silicom/bypasslib/bypass.c:202:5: warning: symbol 'get_wd_set_caps' was not declared. Should it be static?
etc.

Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging/gdm72xx: Remove duplicated code in gdm_qos.c
Peter Huewe [Tue, 19 Feb 2013 17:50:20 +0000 (18:50 +0100)]
staging/gdm72xx: Remove duplicated code in gdm_qos.c

The first branch of the if statement is ended with a return thus there
is no need for an else if, and thus we can move the duplicated code to
the top and use it for the other two branches.

Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging/gdm72xx: Remove unused variable in gdm_qos.c
Peter Huewe [Tue, 19 Feb 2013 17:50:19 +0000 (18:50 +0100)]
staging/gdm72xx: Remove unused variable in gdm_qos.c

len is never read after assignment, thus can be removed.

Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging/gdm72xx: Include corresponding header file (fix sparse warning)
Peter Huewe [Tue, 19 Feb 2013 17:50:18 +0000 (18:50 +0100)]
staging/gdm72xx: Include corresponding header file (fix sparse warning)

sdio_boot.c and netlink_k.c both have a corresponding header file with
their function prototypes but fail to include them, which leads to the
following sparse warnings:
sdio_boot.c:135:5: warning: symbol 'sdio_boot' was not declared. Should it be static?
netlink_k.c:89:13: warning: symbol 'netlink_init' was not declared. Should it be static?
netlink_k.c:109:6: warning: symbol 'netlink_exit' was not declared. Should it be static?
netlink_k.c:114:5: warning: symbol 'netlink_send' was not declared. Should it be static?

-> Add the include files and silence the warning

Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: slicoss: Remove dma_addr_t cast compilation warnings
Joe Perches [Wed, 27 Feb 2013 00:33:11 +0000 (16:33 -0800)]
staging: slicoss: Remove dma_addr_t cast compilation warnings

Eliminate some warnings by casting to unsigned long before
casting a dma_addr_t value to a pointer.

btw:

Does slicoss always work on x86-32?
Is a pshmem guaranteed to be accessible
by a 32 bit address?

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging/sm7xxfb: Convert to SIMPLE_DEV_PM_OPS
Peter Huewe [Mon, 18 Feb 2013 23:12:48 +0000 (00:12 +0100)]
staging/sm7xxfb: Convert to SIMPLE_DEV_PM_OPS

Instead of assigning the pm_ops fields individually we can simply use
SIMPLE_DEV_PM_OPS.

Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Acked-by: Javier Muñoz <jmunhoz@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging/slicoss: Use ether_crc for mac hash calculation
Peter Huewe [Tue, 19 Feb 2013 04:18:52 +0000 (05:18 +0100)]
staging/slicoss: Use ether_crc for mac hash calculation

Instead of performing the hash calculation for the mac address by ourself, we
can simply reuse ether_crc and shift only the result according to our
needs.
The code was tested against the previous implementation by verifying both
implementations against each other in userspace for 16200000000 different
mac addresses, changing the vendor bits of the mac address first.

Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging/slicoss: Fix buffer possible overflow in slic_card_locate
Peter Huewe [Tue, 19 Feb 2013 04:18:51 +0000 (05:18 +0100)]
staging/slicoss: Fix buffer possible overflow in slic_card_locate

smatch complains about a possible buffer overflow
slicoss.c:3651 slic_card_locate() error: buffer overflow
'physcard->adapter' 4 <= 4

If the for loop is not exited prematurely i++ is executed after the last
iteration and thus i can be 4, which is out of bounds for
physcard->adapter.

-> Add check for this condition and simplify the if statement by
inverting the condition.

Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging/slicoss: Fix operation may be undefined warning
Peter Huewe [Tue, 19 Feb 2013 04:18:50 +0000 (05:18 +0100)]
staging/slicoss: Fix operation may be undefined warning

gcc complains about an undefined operation:
slicoss.c:1417:19: warning: operation on 'rspq->pageindex' may be
undefined [-Wsequence-point]

The intended operation was (probably) to retrieve the pageindex + 1 and let
it wrap around if it reaches the num_pages.

Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging/slicoss: Remove always true if statement
Peter Huewe [Tue, 19 Feb 2013 04:18:49 +0000 (05:18 +0100)]
staging/slicoss: Remove always true if statement

skbtype is assigned once to NORMAL_ETHFRAME and then checked if it is
NORMAL_ETHFRAME -> remove the checks.

This also gets rid of the (false positive) smatch warning:
slicoss.c:2829 slic_xmit_start() error: potential NULL dereference
'hcmd'.

Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging/slicoss: Check pointer before dereferencing
Peter Huewe [Tue, 19 Feb 2013 04:13:50 +0000 (05:13 +0100)]
staging/slicoss: Check pointer before dereferencing

Smatch complains that the variable adapter is dereferenced before it is
checked:
slicoss.c:906 slic_timer_load_check() warn: variable dereferenced before
check 'adapter' (see line 904)

-> move the assignment after the check.

Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: vt6656: removed no longer useful ttype.h file
Andres More [Tue, 26 Feb 2013 01:32:55 +0000 (20:32 -0500)]
staging: vt6656: removed no longer useful ttype.h file

Removed includes and added linux/types.h instead when needed.

Signed-off-by: Andres More <more.andres@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: vt6656: removed custom pointer definitions
Andres More [Tue, 26 Feb 2013 01:32:54 +0000 (20:32 -0500)]
staging: vt6656: removed custom pointer definitions

No checkpatch findings were resolved.

sed -i 's/\bULONG_PTR\b/u32/g' drivers/staging/vt6656/*.[ch]
sed -i 's/\bDWORD_PTR\b/u32/g' drivers/staging/vt6656/*.[ch]

Signed-off-by: Andres More <more.andres@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: vt6656: replaced custom DWORD definition with u32
Andres More [Tue, 26 Feb 2013 01:32:53 +0000 (20:32 -0500)]
staging: vt6656: replaced custom DWORD definition with u32

Checkpatch findings were not resolved.

sed -i 's/\bDWORD\b/u32/g' drivers/staging/vt6656/*.[ch]
sed -i 's/\bPDWORD\b/u32 */g' drivers/staging/vt6656/*.[ch]

Signed-off-by: Andres More <more.andres@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: vt6656: replaced custom WORD definition with u16
Andres More [Tue, 26 Feb 2013 01:32:52 +0000 (20:32 -0500)]
staging: vt6656: replaced custom WORD definition with u16

Checkpatch findings were not resolved.

sed -i 's/\bWORD\b/u16/g' drivers/staging/vt6656/*.[ch]
sed -i 's/\bPWORD\b/u16 */g' drivers/staging/vt6656/*.[ch]

Signed-off-by: Andres More <more.andres@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: vt6656: replaced custom BYTE definition with u8
Andres More [Tue, 26 Feb 2013 01:32:51 +0000 (20:32 -0500)]
staging: vt6656: replaced custom BYTE definition with u8

Checkpatch findings were not resolved, only direct replacement.

sed -i 's/\bBYTE\b/u8/g' drivers/staging/vt6656/*.[ch]
sed -i 's/\bPBYTE\b/u8 */g' drivers/staging/vt6656/*.[ch]

Signed-off-by: Andres More <more.andres@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agoStaging: bcm: Fix spelling error in PHSModule.c
Kevin McKinney [Thu, 21 Feb 2013 04:25:30 +0000 (23:25 -0500)]
Staging: bcm: Fix spelling error in PHSModule.c

This patch fixes a spelling error in PHSModule.c

Signed-off-by: Kevin McKinney <klmckinney1@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agoStaging: bcm: Properly format comments in PHSModule.c
Kevin McKinney [Thu, 21 Feb 2013 04:25:29 +0000 (23:25 -0500)]
Staging: bcm: Properly format comments in PHSModule.c

This patch properly formats comments, and removes
them as needed in PHSModule.c.

Signed-off-by: Kevin McKinney <klmckinney1@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agoStaging: bcm: Properly format braces in PHSModule.c
Kevin McKinney [Thu, 21 Feb 2013 04:25:28 +0000 (23:25 -0500)]
Staging: bcm: Properly format braces in PHSModule.c

This patch formats braces in PHSModule.c as reported
by checkpatch.pl.

Signed-off-by: Kevin McKinney <klmckinney1@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agoStaging: bcm: Fix all white space issues in PHSModule.c
Kevin McKinney [Thu, 21 Feb 2013 04:25:27 +0000 (23:25 -0500)]
Staging: bcm: Fix all white space issues in PHSModule.c

This patch fixes all white space issues in
PHSModule.c as reported by checkpatch.pl.

Signed-off-by: Kevin McKinney <klmckinney1@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: sep: using strlcpy instead of strncpy
Chen Gang [Sun, 17 Feb 2013 03:53:15 +0000 (11:53 +0800)]
staging: sep: using strlcpy instead of strncpy

  set '\0' at tail for NUL terminated string, or TP_printk may cause issue.

Signed-off-by: Chen Gang <gang.chen@asianux.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: bcm: don't cast kzalloc() return value
Mihnea Dobrescu-Balaur [Sun, 10 Mar 2013 12:48:27 +0000 (14:48 +0200)]
staging: bcm: don't cast kzalloc() return value

Signed-off-by: Mihnea Dobrescu-Balaur <mihneadb@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agoStaging: bcm: potential forever loop verifying firmware
Dan Carpenter [Fri, 1 Mar 2013 20:28:06 +0000 (23:28 +0300)]
Staging: bcm: potential forever loop verifying firmware

There is an ioctl() to write data to the firmware.  After the data
is written, it reads the databack from the firmware and compares
against what the user wanted to write and prints an error message
if it doesn't match.

The problem is that verify process has a forever loop if the
firmware size is not a multiple of 4.  I've fixed it by replacing
the bcm compare function with memcmp().

I have chopped out some debugging code in the process.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agoStaging: bcm: avoid use-after-free in bcm_char_ioctl()
Xi Wang [Wed, 6 Mar 2013 21:32:25 +0000 (16:32 -0500)]
Staging: bcm: avoid use-after-free in bcm_char_ioctl()

Free pBulkBuffer (pvBuffer) after pBulkBuffer->Register.

Signed-off-by: Xi Wang <xi.wang@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging/sep: Check pointers before dereferencing (fix smatch warning)
Peter Huewe [Tue, 19 Feb 2013 12:07:28 +0000 (13:07 +0100)]
staging/sep: Check pointers before dereferencing (fix smatch warning)

smatch complains about two dereferenced before check issues:

sep_main.c:2898 sep_free_dma_tables_and_dcb() warn: variable dereferenced before check
'dma_ctx' (see line 2885)
sep_main.c:2898 sep_free_dma_tables_and_dcb() warn: variable dereferenced before check
'*dma_ctx' (see line 2885)

-> Move the checks to the top, but keep the semantics.

Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging/sep: Fix smatch false positive about potential NULL dereference in sep_main.c
Peter Huewe [Tue, 19 Feb 2013 12:07:27 +0000 (13:07 +0100)]
staging/sep: Fix smatch false positive about potential NULL dereference in sep_main.c

Smatch complains about a potential NULL pointer dereference:

sep_main.c:2312 sep_construct_dma_tables_from_lli() error: potential
NULL dereference 'info_out_entry_ptr'.

info_out_entry_ptr is initialized with NULL and if info_in_entry_ptr is
not NULL it gets derefenced.
However info_out_entry_ptr is only NULL in the first iteration of the
while loop and in this case info_in_entry_ptr is also NULL (as indicated
by the comment /* If info entry is null - this is the first table built */
-> this is a false positive.

Nevertheless we add a check for info_out_entry_ptr to silence this
warning and make it more robust in regard to code changes.

Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: zcache/debug: compiler failure on PPC64 and revert commit.
Konrad Rzeszutek Wilk [Thu, 7 Mar 2013 18:50:47 +0000 (13:50 -0500)]
staging: zcache/debug: compiler failure on PPC64 and revert commit.

On PPC64 we get this:
In file included from drivers/staging/zcache/debug.c:2:
drivers/staging/zcache/debug.h: In function 'dec_zcache_obj_count':
drivers/staging/zcache/debug.h:16: error: implicit declaration of function 'BUG_ON'

This simple patch adds the appropiate header file to finish
the compile and reverts
"staging: zcache: disable ZCACHE_DEBUG due to build error"
(5db5a20a50cfd078c78b13a988f237cca81aedc5)

Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: android: ashmem: Add support for 32bit ashmem calls in a 64bit kernel
Serban Constantinescu [Tue, 5 Mar 2013 15:27:38 +0000 (15:27 +0000)]
staging: android: ashmem: Add support for 32bit ashmem calls in a 64bit kernel

Android's shared memory subsystem, Ashmem, does not support calls from a
32bit userspace in a 64 bit kernel. This patch adds support for syscalls
coming from a 32bit userspace in a 64bit kernel.

The patch has been successfully tested on ARMv8 AEM(64bit
platform model) and Versatile Express A9(32bit platform).

v2: Fix missing compat.h include.

Signed-off-by: Serban Constantinescu <serban.constantinescu@arm.com>
Acked-by: Arve Hjønnevåg <arve@android.com>
Acked-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: zcache: disable ZCACHE_DEBUG due to build error
Stephen Rothwell [Wed, 6 Mar 2013 00:31:06 +0000 (11:31 +1100)]
staging: zcache: disable ZCACHE_DEBUG due to build error

In file included from drivers/staging/zcache/debug.c:2:0:
drivers/staging/zcache/debug.h: In function 'dec_zcache_obj_count':
drivers/staging/zcache/debug.h:16:2: error: implicit declaration of function 'BUG_ON' [-Werror=implicit-function-declaration]

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agozcache/debug: Coalesce all debug under CONFIG_ZCACHE_DEBUG
Konrad Rzeszutek Wilk [Mon, 4 Mar 2013 18:18:20 +0000 (13:18 -0500)]
zcache/debug: Coalesce all debug under CONFIG_ZCACHE_DEBUG

and also define this extra attribute in the Kconfig entry.

Acked-by: Dan Magenheimer <dan.magenheimer@oracle.com>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agozcache: Module license is defined twice.
Konrad Rzeszutek Wilk [Mon, 4 Mar 2013 18:18:19 +0000 (13:18 -0500)]
zcache: Module license is defined twice.

The other (same license) is at the end of the file.

Acked-by: Dan Magenheimer <dan.magenheimer@oracle.com>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agozcache: Move the last of the debugfs counters out
Konrad Rzeszutek Wilk [Mon, 4 Mar 2013 18:18:18 +0000 (13:18 -0500)]
zcache: Move the last of the debugfs counters out

We now have in zcache-main only the counters that are
are not debugfs related.

Acked-by: Dan Magenheimer <dan.magenheimer@oracle.com>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agozcache/debug: Use an array to initialize/use debugfs attributes.
Konrad Rzeszutek Wilk [Mon, 4 Mar 2013 18:18:17 +0000 (13:18 -0500)]
zcache/debug: Use an array to initialize/use debugfs attributes.

It makes it neater and also allows us to piggyback on that
in the zcache_dump function.

Acked-by: Dan Magenheimer <dan.magenheimer@oracle.com>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agozcache: Move debugfs code out of zcache-main.c file.
Konrad Rzeszutek Wilk [Mon, 4 Mar 2013 18:18:16 +0000 (13:18 -0500)]
zcache: Move debugfs code out of zcache-main.c file.

Note that at this point there is no CONFIG_ZCACHE_DEBUG
option in the Kconfig. So in effect all of the counters
are nop until that option gets re-introduced in:
zcache/debug: Coalesce all debug under CONFIG_ZCACHE_DEBUG

Acked-by: Dan Magenheimer <dan.magenheimer@oracle.com>
[v1: Fixed conflicts due to rebase]
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agozcache: Make the debug code use pr_debug
Konrad Rzeszutek Wilk [Mon, 4 Mar 2013 18:18:15 +0000 (13:18 -0500)]
zcache: Make the debug code use pr_debug

as if you are debugging this driver you would be using 'debug'
on the command line anyhow - and this would dump the debug
data on the proper loglevel.

While at it also remove the unconditional #define ZCACHE_DEBUG.

Acked-by: Dan Magenheimer <dan.magenheimer@oracle.com>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agozcache: The last of the atomic reads has now an accessory function.
Konrad Rzeszutek Wilk [Mon, 4 Mar 2013 18:18:14 +0000 (13:18 -0500)]
zcache: The last of the atomic reads has now an accessory function.

And now we can move the code ([inc|dec]_zcache_[*]) to their own file
with a header to make them nops or feed in debugfs.

Acked-by: Dan Magenheimer <dan.magenheimer@oracle.com>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agozcache: Provide accessory functions for counter decrease.
Konrad Rzeszutek Wilk [Mon, 4 Mar 2013 18:18:13 +0000 (13:18 -0500)]
zcache: Provide accessory functions for counter decrease.

This way we can have all wrapped with these functions and
can disable/enable this with CONFIG_DEBUG_FS.

Acked-by: Dan Magenheimer <dan.magenheimer@oracle.com>
[v2: Rebase on top of staging/zcache: Fix/improve zcache writeback code, tie to a config option]
[v3: Rebase on top of zcache: Fix compile warnings due to usage of debugfs_create_size_t]
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agozcache: Provide accessory functions for counter increase
Konrad Rzeszutek Wilk [Mon, 4 Mar 2013 18:18:12 +0000 (13:18 -0500)]
zcache: Provide accessory functions for counter increase

This is the first step in moving the debugfs code out of the
main file in-to another file. And also allow the code to run
without CONFIG_DEBUG_FS defined.

Acked-by: Dan Magenheimer <dan.magenheimer@oracle.com>
[v2: Rebase on top staging/zcache: Fix/improve zcache writeback code, tie to a config option]
[v3: Rebase on top of zcache: Fix compile warnings due to usage of debugfs_create_size_t]
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agozcache: s/int/bool/ on the various options.
Konrad Rzeszutek Wilk [Mon, 4 Mar 2013 18:18:11 +0000 (13:18 -0500)]
zcache: s/int/bool/ on the various options.

There are so many, but this allows us to at least have them
right in as bool.

Acked-by: Dan Magenheimer <dan.magenheimer@oracle.com>
[v1: Rebase on ramster->zcache move]
[v2: Rebase on staging/zcache: Fix/improve zcache writeback code, tie to a config option]
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: android: logger: enforce GID and CAP check on log flush
Charndeep Grewal [Wed, 27 Feb 2013 06:07:38 +0000 (22:07 -0800)]
staging: android: logger: enforce GID and CAP check on log flush

Restrict log flushing to those in the logs group, or
anyone with CAP_SYSLOG.

Cc: Android Kernel Team <kernel-team@android.com>
Cc: Charndeep Grewal <csgrewa@tycho.ncsc.mil>
Signed-off-by: Charndeep Grewal <csgrewa@tycho.ncsc.mil>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: android: logger: Allow a UID to read it's own log entries
Nick Kralevich [Wed, 27 Feb 2013 06:07:37 +0000 (22:07 -0800)]
staging: android: logger: Allow a UID to read it's own log entries

Modify the kernel logger to record the UID associated with
the log entries. Always allow the same UID which generated a
log message to read the log message.

Allow anyone in the logs group, or anyone with CAP_SYSLOG, to
read all log entries.

In addition, allow the client to upgrade log formats, so they
can get additional information from the kernel.

Cc: Android Kernel Team <kernel-team@android.com>
Cc: Nick Kralevich <nnk@google.com>
Signed-off-by: Nick Kralevich <nnk@google.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: android: lowmemorykiller: Change default debug_level to 1
Arve Hjønnevåg [Wed, 27 Feb 2013 06:07:36 +0000 (22:07 -0800)]
staging: android: lowmemorykiller: Change default debug_level to 1

The select...to kill messages are not very useful when not debugging
the lowmemorykiller itself. After the change to check TIF_MEMDIE
instead of using a task notifer this message can also get very
noisy.

Cc: Android Kernel Team <kernel-team@android.com>
Cc: Arve Hjønnevåg <arve@android.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Arve Hjønnevåg <arve@android.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: android: lowmemorykiller: Don't count reserved free memory
Arve Hjønnevåg [Wed, 27 Feb 2013 06:07:35 +0000 (22:07 -0800)]
staging: android: lowmemorykiller: Don't count reserved free memory

The amount of reserved memory varies between devices. Subtract it
here to reduce the amount of devices specific tuning needed for the
minfree values.

Cc: Android Kernel Team <kernel-team@android.com>
Cc: Arve Hjønnevåg <arve@android.com>
Signed-off-by: Arve Hjønnevåg <arve@android.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Acked-by: David Rientjes <rientjes@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: android: ashmem: get_name,set_name not to hold ashmem_mutex
Shankar Brahadeeswaran [Wed, 20 Feb 2013 18:11:26 +0000 (23:41 +0530)]
staging: android: ashmem: get_name,set_name not to hold ashmem_mutex

Problem:
There exists a path in ashmem driver that could lead to acquistion
of mm->mmap_sem, ashmem_mutex in reverse order. This could lead
to deadlock in the system.
For Example, assume that mmap is called on a ashmem region
in the context of a thread say T1.
 sys_mmap_pgoff (1. acquires mm->mmap_sem)
  |
   --> mmap_region
  |
         ----> ashmem_mmap (2. acquires asmem_mutex)
 Now if there is a context switch after 1 and before 2,
 and if another thread T2 (that shares the mm struct) invokes an
 ioctl say ASHMEM_GET_NAME, this can lead to the following path

ashmem_ioctl
  |
  -->get_name (3. acquires ashmem_mutex)
|
---> copy_to_user (4. acquires the mm->mmap_sem)
Note that the copy_to_user could lead to a valid fault if no
physical page is allocated yet for the user address passed.
Now T1 has mmap_sem and is waiting for ashmem_mutex.
and T2 has the ashmem_mutex and is waiting for mmap_sem
Thus leading to deadlock.

Solution:
Do not call copy_to_user or copy_from_user while holding the
ahsmem_mutex. Instead copy this to a local buffer that lives
in the stack while holding this lock. This will maintain data
integrity as well never reverse the lock order.

Testing:
Created a unit test case to reproduce the problem.
Used the same to test this fix on kernel version 3.4.0
Ported the same patch to 3.8

Signed-off-by: Shankar Brahadeeswaran <shankoo77@gmail.com>
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: sync: Fix timeout = 0 wait behavior
Jamie Gennis [Fri, 1 Mar 2013 00:43:26 +0000 (16:43 -0800)]
staging: sync: Fix timeout = 0 wait behavior

Fix wait behavior on timeout == 0 case

Cc: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Cc: Erik Gilling <konkers@android.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Rob Clark <robclark@gmail.com>
Cc: Sumit Semwal <sumit.semwal@linaro.org>
Cc: dri-devel@lists.freedesktop.org
Cc: Android Kernel Team <kernel-team@android.com>
Signed-off-by: Jamie Gennis <jgennis@google.com>
[jstultz: Added commit message]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: sync: Don't log wait timeouts when timeout = 0
Erik Gilling [Fri, 1 Mar 2013 00:43:25 +0000 (16:43 -0800)]
staging: sync: Don't log wait timeouts when timeout = 0

If the timeout is zero, don't trip the timeout debugging

Cc: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Cc: Erik Gilling <konkers@android.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Rob Clark <robclark@gmail.com>
Cc: Sumit Semwal <sumit.semwal@linaro.org>
Cc: dri-devel@lists.freedesktop.org
Cc: Android Kernel Team <kernel-team@android.com>
Signed-off-by: Erik Gilling <konkers@android.com>
[jstultz: Added commit message]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: sync: Fix race condition between merge and signal
Ørjan Eide [Fri, 1 Mar 2013 00:43:24 +0000 (16:43 -0800)]
staging: sync: Fix race condition between merge and signal

The copied sync_pt was activated immediately. If the sync_pt was
signaled before the entire merge was completed, the new fence's pt_list
could be iterated over while it is still in the process of being
created.

Moving the the sync_pt_activate call for all new sync_pts to after both
the sync_fence_copy_pts and the sync_fence_merge_pts calls ensure that
the pt_list is complete and immutable before it can be reached from the
timeline's active list.

Cc: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Cc: Erik Gilling <konkers@android.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Rob Clark <robclark@gmail.com>
Cc: Sumit Semwal <sumit.semwal@linaro.org>
Cc: dri-devel@lists.freedesktop.org
Cc: Android Kernel Team <kernel-team@android.com>
Signed-off-by: Erik Gilling <konkers@android.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: sync: Add tracepoint support
Erik Gilling [Fri, 1 Mar 2013 00:43:23 +0000 (16:43 -0800)]
staging: sync: Add tracepoint support

Add support for tracepoints

Cc: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Cc: Erik Gilling <konkers@android.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Rob Clark <robclark@gmail.com>
Cc: Sumit Semwal <sumit.semwal@linaro.org>
Cc: dri-devel@lists.freedesktop.org
Cc: Android Kernel Team <kernel-team@android.com>
Signed-off-by: Erik Gilling <konkers@android.com>
[jstultz: Whitespace changes, add commit message, move to staging]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: sw_sync: Convert to use new value_str debug ops
Erik Gilling [Fri, 1 Mar 2013 00:43:22 +0000 (16:43 -0800)]
staging: sw_sync: Convert to use new value_str debug ops

Switch from print_obj/print_pt to the new
timeline_value_str and pt_value_str ops.

Cc: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Cc: Erik Gilling <konkers@android.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Rob Clark <robclark@gmail.com>
Cc: Sumit Semwal <sumit.semwal@linaro.org>
Cc: dri-devel@lists.freedesktop.org
Cc: Android Kernel Team <kernel-team@android.com>
Signed-off-by: Erik Gilling <konkers@android.com>
[jstultz: Add commit message]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: sync: Refactor sync debug printing
Erik Gilling [Fri, 1 Mar 2013 00:43:21 +0000 (16:43 -0800)]
staging: sync: Refactor sync debug printing

Move driver callbacks to fill strings instead of using seq_files.  This
will allow those values to be used in a future tracepoint patch.

Cc: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Cc: Erik Gilling <konkers@android.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Rob Clark <robclark@gmail.com>
Cc: Sumit Semwal <sumit.semwal@linaro.org>
Cc: dri-devel@lists.freedesktop.org
Cc: Android Kernel Team <kernel-team@android.com>
Signed-off-by: Erik Gilling <konkers@android.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: sync: Use proper barriers when waiting indefinitely
Erik Gilling [Fri, 1 Mar 2013 00:43:20 +0000 (16:43 -0800)]
staging: sync: Use proper barriers when waiting indefinitely

The previous fix only addressed waiting with a timeout.

Cc: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Cc: Erik Gilling <konkers@android.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Rob Clark <robclark@gmail.com>
Cc: Sumit Semwal <sumit.semwal@linaro.org>
Cc: dri-devel@lists.freedesktop.org
Cc: Android Kernel Team <kernel-team@android.com>
Signed-off-by: Erik Gilling <konkers@android.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: sync: Update new fence status with sync_fence_signal_pt
Erik Gilling [Fri, 1 Mar 2013 00:43:19 +0000 (16:43 -0800)]
staging: sync: Update new fence status with sync_fence_signal_pt

If a fence's pt is signaled before sync_fence_create is called, the fence
will never transition into the signaled state.  This also address a tiny
race if a merged fence's pt after sync_fence_get_status checks it's status
and before fence->status is updated.

Cc: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Cc: Erik Gilling <konkers@android.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Rob Clark <robclark@gmail.com>
Cc: Sumit Semwal <sumit.semwal@linaro.org>
Cc: dri-devel@lists.freedesktop.org
Cc: Android Kernel Team <kernel-team@android.com>
Signed-off-by: Erik Gilling <konkers@android.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: sync: Protect unlocked access to fence status
Erik Gilling [Fri, 1 Mar 2013 00:43:18 +0000 (16:43 -0800)]
staging: sync: Protect unlocked access to fence status

Fence status is checked outside of locks in both sync_fence_wait and
sync_fence_poll.  This patch adds propper barrier protection in these
cases to avoid seeing stale status.

Cc: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Cc: Erik Gilling <konkers@android.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Rob Clark <robclark@gmail.com>
Cc: Sumit Semwal <sumit.semwal@linaro.org>
Cc: dri-devel@lists.freedesktop.org
Cc: Android Kernel Team <kernel-team@android.com>
Signed-off-by: Erik Gilling <konkers@android.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: sync: Dump sync state on fence errors
Erik Gilling [Fri, 1 Mar 2013 00:43:17 +0000 (16:43 -0800)]
staging: sync: Dump sync state on fence errors

When we get a bad status, dump sync state

Cc: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Cc: Erik Gilling <konkers@android.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Rob Clark <robclark@gmail.com>
Cc: Sumit Semwal <sumit.semwal@linaro.org>
Cc: dri-devel@lists.freedesktop.org
Cc: Android Kernel Team <kernel-team@android.com>
Signed-off-by: Erik Gilling <konkers@android.com>
[jstultz: Added commit message]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: sync: Improve timeout dump messages
Erik Gilling [Fri, 1 Mar 2013 00:43:16 +0000 (16:43 -0800)]
staging: sync: Improve timeout dump messages

Improve the output of the timeout dumps, including
the fence pointer.

Cc: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Cc: Erik Gilling <konkers@android.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Rob Clark <robclark@gmail.com>
Cc: Sumit Semwal <sumit.semwal@linaro.org>
Cc: dri-devel@lists.freedesktop.org
Cc: Android Kernel Team <kernel-team@android.com>
Signed-off-by: Erik Gilling <konkers@android.com>
[jstultz: Added commit message]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: sync: Dump sync state to console on timeout
Erik Gilling [Fri, 1 Mar 2013 00:43:15 +0000 (16:43 -0800)]
staging: sync: Dump sync state to console on timeout

If we hit a timeout, dump sync state to console

Cc: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Cc: Erik Gilling <konkers@android.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Rob Clark <robclark@gmail.com>
Cc: Sumit Semwal <sumit.semwal@linaro.org>
Cc: dri-devel@lists.freedesktop.org
Cc: Android Kernel Team <kernel-team@android.com>
Signed-off-by: Erik Gilling <konkers@android.com>
[jstultz: Add commit message, whitespace fixups]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: sync: Change wait timeout to mirror poll semantics
Erik Gilling [Fri, 1 Mar 2013 00:43:14 +0000 (16:43 -0800)]
staging: sync: Change wait timeout to mirror poll semantics

Change wait timeout to act like poll

Cc: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Cc: Erik Gilling <konkers@android.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Rob Clark <robclark@gmail.com>
Cc: Sumit Semwal <sumit.semwal@linaro.org>
Cc: dri-devel@lists.freedesktop.org
Cc: Android Kernel Team <kernel-team@android.com>
Signed-off-by: Erik Gilling <konkers@android.com>
[jstultz: Added commit message, squished typo-fix]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: sw_sync: Fix error paths
Rebecca Schultz Zavin [Fri, 1 Mar 2013 00:43:13 +0000 (16:43 -0800)]
staging: sw_sync: Fix error paths

Check the return value of get_unused_fd to make sure a valid
file descriptor is returned.

Make sure to call put_unused_fd even if an error occurs before
the fd can be used.

Cc: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Cc: Erik Gilling <konkers@android.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Rob Clark <robclark@gmail.com>
Cc: Sumit Semwal <sumit.semwal@linaro.org>
Cc: dri-devel@lists.freedesktop.org
Cc: Android Kernel Team <kernel-team@android.com>
Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: sync: Fix error paths
Rebecca Schultz Zavin [Fri, 1 Mar 2013 00:43:12 +0000 (16:43 -0800)]
staging: sync: Fix error paths

Check the return value of get_unused_fd to make sure a valid
file descriptor is returned.

Make sure to call put_unused_fd even if an error occurs before
the fd can be used.

Cc: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Cc: Erik Gilling <konkers@android.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Rob Clark <robclark@gmail.com>
Cc: Sumit Semwal <sumit.semwal@linaro.org>
Cc: dri-devel@lists.freedesktop.org
Cc: Android Kernel Team <kernel-team@android.com>
Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: sync: Add reference counting to timelines
Erik Gilling [Fri, 1 Mar 2013 00:43:11 +0000 (16:43 -0800)]
staging: sync: Add reference counting to timelines

If a timeline is destroyed while fences still hold pts on it, the reworked
fence release handler can cause the timeline to be freed before all it's points
are freed.

Cc: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Cc: Erik Gilling <konkers@android.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Rob Clark <robclark@gmail.com>
Cc: Sumit Semwal <sumit.semwal@linaro.org>
Cc: dri-devel@lists.freedesktop.org
Cc: Android Kernel Team <kernel-team@android.com>
Signed-off-by: Erik Gilling <konkers@android.com>
[jstultz: Squished in compiler warning fix]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: sync: Add internal refcounting to fences
Erik Gilling [Fri, 1 Mar 2013 00:43:10 +0000 (16:43 -0800)]
staging: sync: Add internal refcounting to fences

If a fence is released while a timeline that one of it's pts is on is being
signaled, it is possible for that fence to be deleted before it is signaled.
This patch adds a refcount for internal references such as signaled pt
processing.

Cc: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Cc: Erik Gilling <konkers@android.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Rob Clark <robclark@gmail.com>
Cc: Sumit Semwal <sumit.semwal@linaro.org>
Cc: dri-devel@lists.freedesktop.org
Cc: Android Kernel Team <kernel-team@android.com>
Signed-off-by: Erik Gilling <konkers@android.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: sync: Optimize fence merges
Erik Gilling [Fri, 1 Mar 2013 00:43:09 +0000 (16:43 -0800)]
staging: sync: Optimize fence merges

If the two fences being merged contain sync_pts from the same timeline,
those two pts will be collapsed into a single pt representing the latter
of the two.

Cc: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Cc: Erik Gilling <konkers@android.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Rob Clark <robclark@gmail.com>
Cc: Sumit Semwal <sumit.semwal@linaro.org>
Cc: dri-devel@lists.freedesktop.org
Cc: Android Kernel Team <kernel-team@android.com>
Signed-off-by: Erik Gilling <konkers@android.com>
[jstultz: Whitespace fixes]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: sync: Reorder sync_fence_release
Erik Gilling [Fri, 1 Mar 2013 00:43:08 +0000 (16:43 -0800)]
staging: sync: Reorder sync_fence_release

Previously fence's pts were freed before the were the fence was removed from the
global fence list.  This led to a race with the debugfs support where it would
iterate over sync_pts that had been freed.

Cc: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Cc: Erik Gilling <konkers@android.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Rob Clark <robclark@gmail.com>
Cc: Sumit Semwal <sumit.semwal@linaro.org>
Cc: dri-devel@lists.freedesktop.org
Cc: Android Kernel Team <kernel-team@android.com>
Signed-off-by: Erik Gilling <konkers@android.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>