openwrt/staging/blogic.git
11 years agostaging/lustre/lnet: Fix assert on empty group in selftest module
Amir Shehata [Thu, 21 Nov 2013 14:24:50 +0000 (22:24 +0800)]
staging/lustre/lnet: Fix assert on empty group in selftest module

The core of the issue is that the selftest module doesn't sanitize its
own API, but it depends on lst utility to do such checks.  As a result
this issue manifests itself in this particular LU through an assert
on an empty group.  If the NID is misspelled then an empty group is
added.  An error output is provided, but if that's never checked in a
batch script, as is the case with this issue, then the script will try
to add an empty group to a test to run in a batch, and that will cause
an assert

The fix is two fold.  Ensure that lst utility checks that a group is
added with at least one node.  If not the group is subsequently
deleted.  And the add_test command would fail, since the group no
longer exists.

The second fix is to ensure that the kernel module itself sanitizes
its own API in this particular case, so that if a different utility is
used other than lst to communicate with the selftest kernel module
then this error would be caught.  This fix looks up the batch and the
groups, src and dst, in the ioctl handle and sanitizes that input at
this point.  If the group looked up either doesn't exist or doesn't
have at least one ACTIVE node, then the command fails.

NOTE:there are many other cases in the code where the selftest kernel
module doesn't check for sanity of the input, but depends totally on
the lst module to do such checks.  Particularly around length of
strings passed in.  Thus it is possible to crash the selftest module
if someone tries to create another userspace app to communicate with
the selftest kernel module without ensuring sanity of the params sent
to the kernel module.  In effect, it's always assumed that lst is the
front end for selftest and no other front end is to be used.

Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3093
Lustre-change: http://review.whamcloud.com/6092
Signed-off-by: Amir Shehata <amir.shehata@intel.com>
Reviewed-by: Isaac Huang <he.huang@intel.com>
Reviewed-by: Liang Zhen <liang.zhen@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
[coding style fix of the original patch is splitted into a new one -- PengTao]
Signed-off-by: Peng Tao <bergwolf@gmail.com>
Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging/lustre/ldlm: fix resource/fid check, use DLDLMRES
Andreas Dilger [Thu, 21 Nov 2013 14:24:49 +0000 (22:24 +0800)]
staging/lustre/ldlm: fix resource/fid check, use DLDLMRES

In ll_md_blocking_ast() the FID/resource comparison is incorrectly
checking for fid_ver() stored in res_id.name[2] instead of name[1]
changed since http://review.whamcloud.com/2271 (commit 4f91d5161d00)
landed.  This does not impact current clients, since name[2] and
fid_ver() are always zero, but it could cause problems in the future.

In ldlm_cli_enqueue_fini() use ldlm_res_eq() instead of comparing
each of the resource fields separately.

Use DLDLMRES/PLDLMRES when printing resource names everywhere.

Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-2901
Lustre-change: http://review.whamcloud.com/6592
Signed-off-by: Lai Siyao <lai.siyao@intel.com>
Reviewed-by: Johann Lombardi <johann.lombardi@intel.com>
Signed-off-by: Peng Tao <bergwolf@gmail.com>
Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging/lustre/llite: Access to released file triggers a restore
JC Lafoucriere [Thu, 21 Nov 2013 14:24:48 +0000 (22:24 +0800)]
staging/lustre/llite: Access to released file triggers a restore

When a client accesses data in a released file,
or truncate it, client must trig a restore request.
During this restore, the client must not glimpse and
must use size from MDT. To bring the "restore is running"
information on the client we add a new t_state bit field
to mdt_info which will be used to carry transient file state.
To memorise this information in the inode we add a new flag
LLIF_FILE_RESTORING.

Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3432
Lustre-change: http://review.whamcloud.com/6537
Signed-off-by: JC Lafoucriere <jacques-charles.lafoucriere@cea.fr>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Tested-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: Peng Tao <bergwolf@gmail.com>
Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agoDrivers: staging: ft1000-usb: ft1000_proc.c: fixed a few styling issues.
Aldo Iljazi [Sat, 16 Nov 2013 14:17:55 +0000 (16:17 +0200)]
Drivers: staging: ft1000-usb: ft1000_proc.c: fixed a few styling issues.

Fixed a few styling issues, particularly:

Lines 36,42: Inserted a space before the open paranthesis.
Line 50: Removed space between function name and open parenthesis.
Lines 56,57: Removed trailing whitespace.
lines: 130, 133: Replaced spaces with tabs for identation.

Signed-off-by: Aldo Iljazi <mail@aldo.io>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agomfd: staging: Constify struct mfd_cell where possible
Geert Uytterhoeven [Mon, 18 Nov 2013 13:33:05 +0000 (14:33 +0100)]
mfd: staging: Constify struct mfd_cell where possible

As of commit 03e361b25ee8dfb1fd9b890072c23c4aae01c6c7 ("mfd: Stop setting
refcounting pointers in original mfd_cell arrays"), the "cell" parameter of
mfd_add_devices() is "const" again. Hence make all cell data passed to
mfd_add_devices() const where possible.

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: devel@driverdev.osuosl.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: vt6656: removed the trailing statement should be on next line error
Nandini Hanumanthagowda [Tue, 12 Nov 2013 17:35:40 +0000 (23:05 +0530)]
staging: vt6656: removed the trailing statement should be on next line error

as per linux coding style trailing statments should not be there
at the end of line, instead it should be placed in next line.
hence removed that error by moving trailing statement to next
line

Signed-off-by: Nandini Hanumanthagowda <nandu.hgowda@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: vt6656: added space after coma operator in funtion call
Nandini Hanumanthagowda [Tue, 12 Nov 2013 17:35:39 +0000 (23:05 +0530)]
staging: vt6656: added space after coma operator in funtion call

as per coding style a space is required after ',' operator
in function calls, hence added the missing space after ','
operator in a function call

Signed-off-by: Nandini Hanumanthagowda <nandu.hgowda@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: vt6656: removed all whitespace errors
Nandini Hanumanthagowda [Tue, 12 Nov 2013 17:35:38 +0000 (23:05 +0530)]
staging: vt6656: removed all whitespace errors

removed all whitespace errors from the code like no
space at the start of line and indent the code
wherever possible

Signed-off-by: Nandini Hanumanthagowda <nandu.hgowda@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: vt6656: removed parenthesis from return statement
Nandini Hanumanthagowda [Tue, 12 Nov 2013 17:35:37 +0000 (23:05 +0530)]
staging: vt6656: removed parenthesis from return statement

parenthesis is not required in return statement since its
not a fucntion, hence remove parentheses to comply with
linux coding style

Signed-off-by: Nandini Hanumanthagowda <nandu.hgowda@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: vt6656: indented the code under all function blocks
Nandini Hanumanthagowda [Tue, 12 Nov 2013 17:35:36 +0000 (23:05 +0530)]
staging: vt6656: indented the code under all function blocks

indented the code under all functions to remove unnecessary space
at start of a line and indent code wherver possible errors
thrown from checkpatch script

Signed-off-by: Nandini Hanumanthagowda <nandu.hgowda@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: vt6656: indented all if-else statement blocks
Nandini Hanumanthagowda [Tue, 12 Nov 2013 17:35:35 +0000 (23:05 +0530)]
staging: vt6656: indented all if-else statement blocks

indented all if-else statement blocks to remove checkpatch
warnings and errors like indent code wherever possible and
no spaces at the start of line

Signed-off-by: Nandini Hanumanthagowda <nandu.hgowda@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: vt6656: fixed the switch case indentation level error
Nandini Hanumanthagowda [Tue, 12 Nov 2013 17:35:34 +0000 (23:05 +0530)]
staging: vt6656: fixed the switch case indentation level error

aligned the case statements of 'switch' so that the switch and
case are on same indentation level to fix the following error.
ERROR: switch and case should be at the same indent

Signed-off-by: Nandini Hanumanthagowda <nandu.hgowda@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: vt6656: fixed unnecessary whitespace warning
Nandini Hanumanthagowda [Tue, 12 Nov 2013 17:35:33 +0000 (23:05 +0530)]
staging: vt6656: fixed unnecessary whitespace warning

removed the "unnecessary whitespace before quoted new line"
warning reported by checkpatch script

Signed-off-by: Nandini Hanumanthagowda <nandu.hgowda@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: vt6656: fixed checkpatch errors related to close brace
Nandini Hanumanthagowda [Tue, 12 Nov 2013 17:35:32 +0000 (23:05 +0530)]
staging: vt6656: fixed checkpatch errors related to close brace

fixed following checkpatch error:
ERROR: else should follow close brace '}'

Signed-off-by: Nandini Hanumanthagowda <nandu.hgowda@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: vt6656: fixed open brace placement related error
Nandini Hanumanthagowda [Tue, 12 Nov 2013 17:35:31 +0000 (23:05 +0530)]
staging: vt6656: fixed open brace placement related error

fixed the following checkpatch error:
ERROR: that open brace { should be on the previous line

Signed-off-by: Nandini Hanumanthagowda <nandu.hgowda@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: vt6656: removed unnecessary braces around if-else statements
Nandini Hanumanthagowda [Tue, 12 Nov 2013 17:35:30 +0000 (23:05 +0530)]
staging: vt6656: removed unnecessary braces around if-else statements

removed unnecessary braces around if-else statement whenever
the if-else construct was followed by just single line of code
to comply with linux coding style

Signed-off-by: Nandini Hanumanthagowda <nandu.hgowda@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: rtl8187se: fix coding style in function declarations
Ana Rey [Tue, 12 Nov 2013 14:22:50 +0000 (15:22 +0100)]
staging: rtl8187se: fix coding style in function declarations

Removed innecessary spaces and indentation errors in function definition
(including some curly braces wrongly placed and broke up at 80-chars per line).

I still see some errors if I run the checkpatch.pl script, but those are not
my fault. I'll address them in follow up patches.

Signed-off-by: Ana Rey <anarey@gmail.com>
Acked-by: Pablo Neira Ayuso <pablo@gnumonks.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agoDrivers: Staging: cxt1e1: stbeid: Fixed whitespace between function and parameters
Eric Skoglund [Tue, 12 Nov 2013 09:42:23 +0000 (10:42 +0100)]
Drivers: Staging: cxt1e1: stbeid: Fixed whitespace between function and parameters

This patch fixes whitespace coding style errors: func () --> func()

Signed-of-by: Eric Skoglund <eric@pagefault.se>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agoDrivers: Staging: cxt1e1: sbeid: Fixed braces coding style issue
Eric Skoglund [Tue, 12 Nov 2013 09:42:22 +0000 (10:42 +0100)]
Drivers: Staging: cxt1e1: sbeid: Fixed braces coding style issue

This patch fixes a brace coding style issue.

Signed-off-by: Eric Skoglund <eric@pagefault.se>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agoDrivers: Staging: cxt1e1: sbeid: Fixed coding style issue - space -> tabs
Eric Skoglund [Tue, 12 Nov 2013 09:42:21 +0000 (10:42 +0100)]
Drivers: Staging: cxt1e1: sbeid: Fixed coding style issue - space -> tabs

This patch converts spaces to tabs to conform to the coding style standards.

Signed-off-by: Eric Skoglund <eric@pagefault.se>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: alarm-dev: Seperate functions with one blank line
SeongJae Park [Thu, 14 Nov 2013 12:15:12 +0000 (21:15 +0900)]
staging: alarm-dev: Seperate functions with one blank line

Signed-off-by: SeongJae Park <sj38.park@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: alarm-dev: Remove unnecessary blank lines
SeongJae Park [Thu, 14 Nov 2013 12:15:11 +0000 (21:15 +0900)]
staging: alarm-dev: Remove unnecessary blank lines

Signed-off-by: SeongJae Park <sj38.park@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: alarm-dev: Remove unnecessary parenthesis
SeongJae Park [Thu, 14 Nov 2013 12:15:10 +0000 (21:15 +0900)]
staging: alarm-dev: Remove unnecessary parenthesis

Signed-off-by: SeongJae Park <sj38.park@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: Clean up whitespace warnings in staging/winbond
Eddie Kovsky [Tue, 19 Nov 2013 03:57:45 +0000 (20:57 -0700)]
staging: Clean up whitespace warnings in staging/winbond

Reduced checkpatch.pl warnings from 46 to 17
Long strings on lines over 80 characters remain untouched

Signed-off-by: Eddie Kovsky <ewk@edkovsky.org>
Acked-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: usbip: Remove superfluous name cast
Geert Uytterhoeven [Tue, 12 Nov 2013 19:07:21 +0000 (20:07 +0100)]
staging: usbip: Remove superfluous name cast

platform_device.name is "const char *"

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: r8188eu: Remove superfluous name cast
Geert Uytterhoeven [Tue, 12 Nov 2013 19:07:20 +0000 (20:07 +0100)]
staging: r8188eu: Remove superfluous name cast

usb_driver.name is "const char *"

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: Remove superfluous name casts
Geert Uytterhoeven [Tue, 12 Nov 2013 19:07:19 +0000 (20:07 +0100)]
staging: Remove superfluous name casts

device_driver.name is "const char *"

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging/lustre: remove INIT_STRATEGY
Peng Tao [Tue, 19 Nov 2013 14:38:47 +0000 (22:38 +0800)]
staging/lustre: remove INIT_STRATEGY

legacy code used to support kernel where struct ctl_table
has strategy member.

Cc: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: Peng Tao <bergwolf@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging/lustre: remove INIT_CTL_NAME
Peng Tao [Tue, 19 Nov 2013 14:38:46 +0000 (22:38 +0800)]
staging/lustre: remove INIT_CTL_NAME

legacy code used to support kernel where struct ctl_table
has ctl_name member.

Cc: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: Peng Tao <bergwolf@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging/lustre: get_cpu is always defined
Peng Tao [Tue, 19 Nov 2013 14:38:45 +0000 (22:38 +0800)]
staging/lustre: get_cpu is always defined

Cc: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: Peng Tao <bergwolf@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging/lustre: remove _LWORDSIZE
Peng Tao [Tue, 19 Nov 2013 14:38:44 +0000 (22:38 +0800)]
staging/lustre: remove _LWORDSIZE

Cc: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: Peng Tao <bergwolf@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging/lustre: remove __CYGWIN__
Peng Tao [Tue, 19 Nov 2013 14:38:43 +0000 (22:38 +0800)]
staging/lustre: remove __CYGWIN__

Cc: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: Peng Tao <bergwolf@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging/lustre/libcfs: remove IOCTL_LIBCFS_TYPE
Peng Tao [Tue, 19 Nov 2013 14:38:42 +0000 (22:38 +0800)]
staging/lustre/libcfs: remove IOCTL_LIBCFS_TYPE

Cc: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: Peng Tao <bergwolf@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging/lustre: remove CFS_SYSFS_MODULE_PARM
Peng Tao [Tue, 19 Nov 2013 14:38:41 +0000 (22:38 +0800)]
staging/lustre: remove CFS_SYSFS_MODULE_PARM

No more references to it.

Cc: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: Peng Tao <bergwolf@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging/lustre/socklnd: remove ksnd_sysctl
Peng Tao [Tue, 19 Nov 2013 14:38:40 +0000 (22:38 +0800)]
staging/lustre/socklnd: remove ksnd_sysctl

It is dead code because we defined CFS_SYSFS_MODULE_PARM.

Cc: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: Peng Tao <bergwolf@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging/lustre/o2iblnd: remove kib_sysctl
Peng Tao [Tue, 19 Nov 2013 14:38:39 +0000 (22:38 +0800)]
staging/lustre/o2iblnd: remove kib_sysctl

we have #define CFS_SYSFS_MODULE_PARM  1
so it is indeed dead code.

Cc: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: Peng Tao <bergwolf@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging/lustre: remove fsfilt_ext3.c
Peng Tao [Tue, 19 Nov 2013 14:38:38 +0000 (22:38 +0800)]
staging/lustre: remove fsfilt_ext3.c

It is only used by server.

Cc: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: Peng Tao <bergwolf@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging/lustre: remove lustreapi.h
Peng Tao [Tue, 19 Nov 2013 14:38:37 +0000 (22:38 +0800)]
staging/lustre: remove lustreapi.h

It is only used by user space.

Cc: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: Peng Tao <bergwolf@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging/lustre: remove liblustreapi.h
Peng Tao [Tue, 19 Nov 2013 14:38:36 +0000 (22:38 +0800)]
staging/lustre: remove liblustreapi.h

It is only used by user space.

Cc: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: Peng Tao <bergwolf@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging/lustre/libcfs: remove HAVE_MM_INLINE
Peng Tao [Tue, 19 Nov 2013 14:38:35 +0000 (22:38 +0800)]
staging/lustre/libcfs: remove HAVE_MM_INLINE

Cc: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: Peng Tao <bergwolf@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging/lustre/lnet: coding style fix for lstcon_test_add
Amir Shehata [Tue, 19 Nov 2013 13:23:47 +0000 (21:23 +0800)]
staging/lustre/lnet: coding style fix for lstcon_test_add

To make the function a bit easier to read.

This is coding style fix part of original Lustre commit in external tree.

Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3093
Lustre-change: http://review.whamcloud.com/6092
Signed-off-by: Amir Shehata <amir.shehata@intel.com>
Reviewed-by: Isaac Huang <he.huang@intel.com>
Reviewed-by: Liang Zhen <liang.zhen@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: Peng Tao <bergwolf@gmail.com>
Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging/lustre/lnet: constify name argument of lstcon_group_find/lstcon_batch_find
Amir Shehata [Tue, 19 Nov 2013 13:23:46 +0000 (21:23 +0800)]
staging/lustre/lnet: constify name argument of lstcon_group_find/lstcon_batch_find

This is part of original Lustre commit in external tree.

Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3093
Lustre-change: http://review.whamcloud.com/6092
Signed-off-by: Amir Shehata <amir.shehata@intel.com>
Reviewed-by: Isaac Huang <he.huang@intel.com>
Reviewed-by: Liang Zhen <liang.zhen@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: Peng Tao <bergwolf@gmail.com>
Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging/lustre/lnet: remove extra space in lstcon_rpc_trans_abort
Amir Shehata [Tue, 19 Nov 2013 13:23:45 +0000 (21:23 +0800)]
staging/lustre/lnet: remove extra space in lstcon_rpc_trans_abort

This is coding style fix part of original Lustre commit in external tree.

Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3093
Lustre-change: http://review.whamcloud.com/6092
Signed-off-by: Amir Shehata <amir.shehata@intel.com>
Reviewed-by: Isaac Huang <he.huang@intel.com>
Reviewed-by: Liang Zhen <liang.zhen@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: Peng Tao <bergwolf@gmail.com>
Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging/lustre/lnet: coding style fix for lst_test_add_ioctl
Amir Shehata [Tue, 19 Nov 2013 13:23:44 +0000 (21:23 +0800)]
staging/lustre/lnet: coding style fix for lst_test_add_ioctl

To make the function a bit easier to read.

This is coding style fix part of original Lustre commit in external tree.

Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3093
Lustre-change: http://review.whamcloud.com/6092
Signed-off-by: Amir Shehata <amir.shehata@intel.com>
Reviewed-by: Isaac Huang <he.huang@intel.com>
Reviewed-by: Liang Zhen <liang.zhen@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: Peng Tao <bergwolf@gmail.com>
Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agodrivers/staging/lustre: indent lustre_ldlm_flags_vals
Peng Tao [Tue, 19 Nov 2013 13:23:42 +0000 (21:23 +0800)]
drivers/staging/lustre: indent lustre_ldlm_flags_vals

To follow kernel's "no spaces at the start of a line" rule.

Signed-off-by: Peng Tao <bergwolf@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging/lustre/hsm: Implementation of exclusive open
Jinshan Xiong [Tue, 19 Nov 2013 13:23:41 +0000 (21:23 +0800)]
staging/lustre/hsm: Implementation of exclusive open

Proposed way to do exclusive open:

0. First of all, we have to perform most of the work in kernel space;

1. Client exclusively opens the file with IT_RELEASE_OPEN.
1.1 exclusive open means the open will fail if the file is being opened by somebody else;

2. the MDT will handle IT_RELEASE as follows:
2.1 Revoke OPEN_LOCK on this file, just request EX mode of MDS_INODELOCK_OPEN lock and
release it;
2.2 Acquire a rwsem, say open_rwsem, with write mode before trying to the file; for the
normal open, it should acquire read mode of open_rwsem;
2.3 Check if the file is already being opened by others, if not return with -EBUSY;
2.4 Check if the file can be released;
2.5 Set a special flag in struct mdt_file_data to mark this open is exclusive;
2.5 Release open rwsem.

>From now on, if the file is opened by others, it will mark mdt_file_data that the
exclusive open is broken.

3. Client: if IT_RELEASE_OPEN is finished successfully, and do followings:
3.1 Acquire full PW or EX extent lock to flush dirty cache;
3.2 Pack the handle of layout lock, data version and other attars;
3.3 Close the file with IT_RELEASE_CLOSE.

4. Back to MDT to handle IT_RELEASE CLOSE:
4.1 Grab the open_rwsem
4.2 Check if the exclusive open has ever been broken, in that case, the RELEASE process
will fail;
4.3 Verify the data version matches archive;
4.4 Grab EX layout lock
4.5 Swap the layout
4.6 Release EX layout lock
4.7 Close the exclusive open

Basically we avoid granting EX layout lock back to client and introduce exclusive open so
that we know it if the file has ever being accessed. I hope this can simplify things
a little bit. Also, exclusive open can be used to implement file lease.

In this patch, a framework of lease is implemented. However,
only exclusive lease is supported right now.

To apply a lease, MDS_OPEN_LEASE must be set to open the file, EX
mode open lock is returned to the client side to hold a lease. From
that time on, if this file is opened again by other processes, the
open lock will be revoked so the client who holds the lease will
know the lease is already broken by checking that open lock.

To release a lease, normal close is used. The client will revoke the
open lock before sending CLOSE request.

Lease can be applied in two ways. ll_lease_open()/close() can be
called directly if the lease holder is in kernel space; or if the
lease holder lives in user space, it has to open the file first and
then use ioctl() with command LL_IOC_SET_LEASE to apply a lease. The
lease holder has to poll the lease status itself.

Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-2919
Lustre-change: http://review.whamcloud.com/6730
Signed-off-by: Jinshan Xiong <jinshan.xiong@intel.com>
Signed-off-by: John L. Hammond <john.hammond@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: Peng Tao <bergwolf@gmail.com>
Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging:dwc2:hcd_queue.c : cleanups to the microframe scheduler code
Himangi Saraogi [Sat, 2 Nov 2013 04:35:30 +0000 (10:05 +0530)]
staging:dwc2:hcd_queue.c : cleanups to the microframe scheduler code

This patch takes up the task mentioned in the TODO file of dwc2 to
cleanup the microframe scheduler code. The while(!done) loops have been
replaced with appropriate for loops and unnecessary variables
like done and ret have been removed.

Signed-off-by: Himangi Saraogi <himangi774@gmail.com>
Acked-by: Paul Zimmerman <paulz@synopsys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging/lustre/lov: convert magic to host-endian in lov_dump_lmm()
John L. Hammond [Thu, 14 Nov 2013 16:13:18 +0000 (00:13 +0800)]
staging/lustre/lov: convert magic to host-endian in lov_dump_lmm()

In lov_dump_lmm(), convert the lmm_magic from little-endian to
host-endian byte order before the switch statement, as the other
lov_dump_xxx() and lov_verify_xxx() functions already do.  Remove the
unused macro LMM_ASSERT().

Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3297
Lustre-change: http://review.whamcloud.com/6290
Signed-off-by: John L. Hammond <john.hammond@intel.com>
Reviewed-by: Li Wei <wei.g.li@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: Peng Tao <bergwolf@gmail.com>
Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging/lustre/llog: fix return value of llog_alloc_handle
Li Xi [Thu, 14 Nov 2013 16:13:17 +0000 (00:13 +0800)]
staging/lustre/llog: fix return value of llog_alloc_handle

llog_open() calls llog_alloc_handle() taking NULL as the error return
value. But llog_alloc_handle() returns ERR_PTR(-ENOMEM) instead when
error.

Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3470
Lustre-change: http://review.whamcloud.com/6644
Signed-off-by: Li Xi <pkuelelixi@gmail.com>
Reviewed-by: Mike Pershin <mike.pershin@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: Peng Tao <bergwolf@gmail.com>
Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging/lustre/autoconf: remove LIBCFS_HAVE_IS_COMPAT_TASK test
James Simmons [Thu, 14 Nov 2013 16:13:16 +0000 (00:13 +0800)]
staging/lustre/autoconf: remove LIBCFS_HAVE_IS_COMPAT_TASK test

is_compat_task has been defined on all arches since v2.6.29.
We can remove the test and dead code.

Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-2800
Lustre-change: http://review.whamcloud.com/5393
Signed-off-by: Jeff Mahoney <jeffm@suse.com>
Signed-off-by: James Simmons <uja.ornl@gmail.com>
Reviewed-by: Bob Glossman <bob.glossman@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: Peng Tao <bergwolf@gmail.com>
Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging/lustre/autoconf: remove vectored fops tests
James Simmons [Thu, 14 Nov 2013 16:13:15 +0000 (00:13 +0800)]
staging/lustre/autoconf: remove vectored fops tests

file_operations.readv/writev have been removed since v2.6.19
We can remove the test and the dead code.

Lustre-change: http://review.whamcloud.com/5343
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-2800
Signed-off-by: Jeff Mahoney <jeffm@suse.com>
Signed-off-by: James Simmons <uja.ornl@gmail.com>
Reviewed-by: Bob Glossman <bob.glossman@intel.com>
Reviewed-by: Christopher J. Morrone <chris.morrone.llnl@gmail.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: Peng Tao <bergwolf@gmail.com>
Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging/lustre/llite: use correct FID in ll_och_fill()
John L. Hammond [Thu, 14 Nov 2013 16:13:08 +0000 (00:13 +0800)]
staging/lustre/llite: use correct FID in ll_och_fill()

When ll_intent_file_open() is called on a file with a stale dentry,
ll_och_fill() may incorrectly use the FID from the struct
ll_inode_info rather than the FID from the response body (which is the
correct FID for the close). Fix this, remove the ll_inode_info
parameter from ll_och_fill(), and move the call to ll_ioepoch_open()
from ll_och_fill() to ll_local_open().

Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3233
Lustre-change: http://review.whamcloud.com/6695
Signed-off-by: John L. Hammond <john.hammond@intel.com>
Reviewed-by: Fan Yong <fan.yong@intel.com>
Reviewed-by: Mike Pershin <mike.pershin@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: Peng Tao <bergwolf@gmail.com>
Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging/lustre: remove llog_server.c
Peng Tao [Thu, 14 Nov 2013 16:13:05 +0000 (00:13 +0800)]
staging/lustre: remove llog_server.c

It is only used by server.

Signed-off-by: Peng Tao <bergwolf@gmail.com>
Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging/lustre: remove lu_target.h
Peng Tao [Thu, 14 Nov 2013 16:13:04 +0000 (00:13 +0800)]
staging/lustre: remove lu_target.h

It is only needed by server code.

Signed-off-by: Peng Tao <bergwolf@gmail.com>
Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging/lustre/llite: restore ll_fiemap
Peng Tao [Thu, 14 Nov 2013 16:13:03 +0000 (00:13 +0800)]
staging/lustre/llite: restore ll_fiemap

It was removed by coan by mistake when first porting the code.

Signed-off-by: Peng Tao <bergwolf@gmail.com>
Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: lustre: fix checkpatch issue regarding pointer coding style
Kristina Martsenko [Mon, 11 Nov 2013 20:42:32 +0000 (22:42 +0200)]
staging: lustre: fix checkpatch issue regarding pointer coding style

Fix the following checkpatch error:
ERROR: "(foo*)" should be "(foo *)"

Signed-off-by: Kristina Martsenko <kristina.martsenko@gmail.com>
Reviewed-by: Peter P Waskiewicz Jr <peter.p.waskiewicz.jr@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: lustre: ptlrpc: fix label indentation
Kristina Martsenko [Mon, 11 Nov 2013 19:35:04 +0000 (21:35 +0200)]
staging: lustre: ptlrpc: fix label indentation

Fix the following type of checkpatch warning to comply with coding
style:
WARNING: labels should not be indented

Signed-off-by: Kristina Martsenko <kristina.martsenko@gmail.com>
Reviewed-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: lustre: ptlrpc: fix indentation
Kristina Martsenko [Mon, 11 Nov 2013 19:35:03 +0000 (21:35 +0200)]
staging: lustre: ptlrpc: fix indentation

Fix the following type of checkpatch warning to comply with coding
style:
WARNING: suspect code indent for conditional statements

Also join a debug string split across lines, as it was on the same lines
as the other changes anyway. And reformat some comments in the kernel
coding style for the same reason.

Signed-off-by: Kristina Martsenko <kristina.martsenko@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: lustre: ptlrpc: remove whitespace before a newline
Kristina Martsenko [Mon, 11 Nov 2013 19:35:02 +0000 (21:35 +0200)]
staging: lustre: ptlrpc: remove whitespace before a newline

Fix the following type of checkpatch warning:
WARNING: unnecessary whitespace before a quoted newline

Signed-off-by: Kristina Martsenko <kristina.martsenko@gmail.com>
Reviewed-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: lustre: ptlrpc: convert spaces to tabs
Kristina Martsenko [Mon, 11 Nov 2013 19:35:01 +0000 (21:35 +0200)]
staging: lustre: ptlrpc: convert spaces to tabs

Fix the following type of checkpatch warning to comply with coding
style:
WARNING: please, no spaces at the start of a line

Signed-off-by: Kristina Martsenko <kristina.martsenko@gmail.com>
Reviewed-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: lustre: ptlrpc: remove an unnecessary semicolon
Kristina Martsenko [Mon, 11 Nov 2013 19:35:00 +0000 (21:35 +0200)]
staging: lustre: ptlrpc: remove an unnecessary semicolon

Remove an unnecessary semicolon and remove a space before another one to
comply with coding style.

Fix the following type of checkpatch warning:
WARNING: space prohibited before semicolon

Signed-off-by: Kristina Martsenko <kristina.martsenko@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: lustre: ptlrpc: clean up whitespace around braces
Kristina Martsenko [Mon, 11 Nov 2013 19:34:59 +0000 (21:34 +0200)]
staging: lustre: ptlrpc: clean up whitespace around braces

Fix the following types of checkpatch errors to comply with coding
style:

ERROR: space required after that close brace '}'
ERROR: space required before the open brace '{'

Also change "if (x == 0)" into "if (!x)" on one line, to avoid
introducing new checkpatch issues.

Signed-off-by: Kristina Martsenko <kristina.martsenko@gmail.com>
Reviewed-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: lustre: ptlrpc: clean up whitespace around parentheses
Kristina Martsenko [Mon, 11 Nov 2013 19:34:58 +0000 (21:34 +0200)]
staging: lustre: ptlrpc: clean up whitespace around parentheses

Fix the following types of checkpatch errors and warnings to comply with
coding style:

ERROR: space required before the open parenthesis '('
ERROR: space prohibited after that open parenthesis '('
ERROR: space prohibited before that close parenthesis ')'
WARNING: space prohibited between function name and open parenthesis '('

Signed-off-by: Kristina Martsenko <kristina.martsenko@gmail.com>
Reviewed-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: lustre: ptlrpc: pack_generic: clean up whitespace around parentheses
Kristina Martsenko [Mon, 11 Nov 2013 19:34:57 +0000 (21:34 +0200)]
staging: lustre: ptlrpc: pack_generic: clean up whitespace around parentheses

Fix the following types of checkpatch errors and warnings in
pack_generic.c to comply with coding style:

ERROR: space required before the open parenthesis '('
ERROR: space prohibited before that close parenthesis ')'
WARNING: space prohibited between function name and open parenthesis '('

Signed-off-by: Kristina Martsenko <kristina.martsenko@gmail.com>
Reviewed-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: ced401: ced_ioc: fix a blank/tab codingstyle issue.
Joachim Adi Schuetz [Sun, 10 Nov 2013 14:15:06 +0000 (15:15 +0100)]
staging: ced401: ced_ioc: fix a blank/tab codingstyle issue.

Fixed a coding style issue - removed a blank before a tab.

Signed-off-by: Joachim Adolf Schuetz <jas@catbull.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agomm/staging: remove unnecessary inclusion of bootmem.h
Grygorii Strashko [Fri, 8 Nov 2013 23:41:42 +0000 (18:41 -0500)]
mm/staging: remove unnecessary inclusion of bootmem.h

Clean-up to remove depedency with bootmem headers.

Cc: Yinghai Lu <yinghai@kernel.org>
Cc: Tejun Heo <tj@kernel.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: William Hubbs <w.d.hubbs@gmail.com>
Cc: Chris Brannon <chris@the-brannons.com>
Cc: Kirk Reiser <kirk@reisers.ca>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
Signed-off-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agoStaging: silicom: Remove unnecessary variable from get_bypass_info()
Rupert Muchembled [Fri, 8 Nov 2013 06:01:49 +0000 (06:01 +0000)]
Staging: silicom: Remove unnecessary variable from get_bypass_info()

Remove unnecessary variable ioctl from get_bypass_info().

As a consequence, this patch removes an assignment to ioctl in an if condition,
reported by checkpatch.pl.

Signed-off-by: Rupert Muchembled <rupert@rmuch.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agoStaging: silicom: Remove unnecessary variable from do_cmd()
Rupert Muchembled [Fri, 8 Nov 2013 06:01:48 +0000 (06:01 +0000)]
Staging: silicom: Remove unnecessary variable from do_cmd()

Remove unnecessary variable ioctl from do_cmd().

As a consequence, this patch removes an assignment to ioctl in an if condition,
reported by checkpatch.pl.

Signed-off-by: Rupert Muchembled <rupert@rmuch.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: vt6656: main_usb.c ether_crc use kernel code
Malcolm Priestley [Sun, 3 Nov 2013 19:02:41 +0000 (19:02 +0000)]
staging: vt6656: main_usb.c ether_crc use kernel code

use ether_crc already in kernel and remove local version.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: vt6656: cleanup device_init_registers
Malcolm Priestley [Sun, 3 Nov 2013 17:52:15 +0000 (17:52 +0000)]
staging: vt6656: cleanup device_init_registers

White space and formatting clean up.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging; vt6656: device_init_registers Change vnt_cmd_card_int and vnt_rsp_card_int...
Malcolm Priestley [Sun, 3 Nov 2013 17:49:32 +0000 (17:49 +0000)]
staging; vt6656: device_init_registers Change vnt_cmd_card_int and vnt_rsp_card_int to off stack

Move structures to vnt_private and convert to pointers in
device_init_registers.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: vt6656: Replace typedef struct _RSP_CARD_INIT.
Malcolm Priestley [Sun, 3 Nov 2013 17:45:06 +0000 (17:45 +0000)]
staging: vt6656: Replace typedef struct _RSP_CARD_INIT.

Replace with struct vnt_rsp_card_rsp init_rsp in device_init_registers.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: vt6656: Replace typedef struct _CMD_CARD_INIT
Malcolm Priestley [Sun, 3 Nov 2013 17:43:23 +0000 (17:43 +0000)]
staging: vt6656: Replace typedef struct _CMD_CARD_INIT

Replace with struct vnt_cmd_card_init init_cmd in
device_init_registers.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: vt6656: device.h Remove typedef enum __device_init_type.
Malcolm Priestley [Sun, 3 Nov 2013 17:40:51 +0000 (17:40 +0000)]
staging: vt6656: device.h Remove typedef enum __device_init_type.

Since typedef enum __device_init_type is only ever called
in one state.

Remove the typedef from main_usb.c:device_init_registers and
replace with macro values. The other values may be needed later.

Apply cold value to sInitCmd.byInitClass.

Remove if braces and correct formatting within.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agodrm/imx: directly call drm_put_dev in ->remove
Daniel Vetter [Sun, 3 Nov 2013 13:31:09 +0000 (14:31 +0100)]
drm/imx: directly call drm_put_dev in ->remove

Again no apparent user of the driver data field.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Acked-by: Sascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging/olpc_docn: reorder the lock sequence to avoid potential dead lock
Gu Zheng [Thu, 31 Oct 2013 10:33:01 +0000 (18:33 +0800)]
staging/olpc_docn: reorder the lock sequence to avoid potential dead lock

The lock sequence of dcon_blank_fb(fb_info->lock ---> console_lock) is against
with the one of console_callback(console_lock ---> fb_info->lock), it'll
lead to a potential dead lock, so reorder the lock sequence of dcon_blank_fb
to avoid the potential dead lock.

Signed-off-by: Gu Zheng <guz.fnst@cn.fujitsu.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: ozwpan: remove unneeded __GFP_ZERO to kzalloc() at oz_elt_stream_create()
Jie Liu [Fri, 1 Nov 2013 14:22:08 +0000 (22:22 +0800)]
staging: ozwpan: remove unneeded __GFP_ZERO to kzalloc() at oz_elt_stream_create()

Get rid of the needless __GFP_ZERO flag for kzalloc() at oz_elt_stream_create().

Signed-off-by: Jie Liu <jeff.liu@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agoStaging: ft1000: ft1000_download: fixed coding style issues
Aldo Iljazi [Sun, 10 Nov 2013 13:44:20 +0000 (15:44 +0200)]
Staging: ft1000: ft1000_download: fixed coding style issues

Fixed the following coding style issues:

Lines 84-91,99-106,275,514: Replaced spaces at the start of the lines
with tabs.

Lines 205,271: Inserted spaces after the commas.
Lines 275,1060,1065: Indented the code with tabs instead of spaces.

Line 275: Inserted spaces around '=' and '<', also moved the trailing
statement on the next line.

Line 512: Removed space between function name and open parenthesis.
Line 839: Removed space after '&'.
Line 853: Removed space after '&'.

Signed-off-by: Aldo Iljazi <mail@aldo.io>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agoStaging: ft1000: boot.h: fixed a few styling issues
Aldo Iljazi [Mon, 4 Nov 2013 12:15:22 +0000 (14:15 +0200)]
Staging: ft1000: boot.h: fixed a few styling issues

Fixed the following styling issues:

Line 30:
Removed space before open square bracket '['

Lines 31 to 155:
Moved the commas that were in the start of the lines, to the end of the lines.
Inserted spaces after the commas.
Inserted a one tab indentation to each line.

Signed-off-by: Aldo Iljazi <mail@aldo.io>
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: android: Fix typo in android/sync.h
Masanari Iida [Thu, 31 Oct 2013 05:20:25 +0000 (14:20 +0900)]
staging: android: Fix typo in android/sync.h

Correct spelling typo in android/sync.h

Signed-off-by: Masanari Iida <standby24x7@gmail.com>
Acked-by: Randy Dunlap <rdunlap@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agodrivers: staging: speakup: serialio: only use platform specific SERIAL_PORT_DFNS.
Chen Gang [Thu, 31 Oct 2013 07:27:37 +0000 (15:27 +0800)]
drivers: staging: speakup: serialio: only use platform specific SERIAL_PORT_DFNS.

If SERIAL_PORT_DFNS isn't present by platform, it need be defined to
"nothing", like the 8250 serial driver does it.

All related macros also need be removed: IRQF_SHARED is defined in
"linux/interrupt.h", others will be defined when related architecture
has SERIAL_PORT_DFNS.

Or it will cause issue (for arc, with allmodconfig):

    CC [M]  drivers/staging/speakup/serialio.o
  drivers/staging/speakup/serialio.c:12:2: error: initializer element is not constant
    SERIAL_PORT_DFNS
    ^
  drivers/staging/speakup/serialio.c:12:2: error: (near initialization for 'rs_table[0].baud_base')
  drivers/staging/speakup/serialio.c:12:2: error: initializer element is not constant
  drivers/staging/speakup/serialio.c:12:2: error: (near initialization for 'rs_table[1].baud_base')
  drivers/staging/speakup/serialio.c:12:2: error: initializer element is not constant
  drivers/staging/speakup/serialio.c:12:2: error: (near initialization for 'rs_table[2].baud_base')
  drivers/staging/speakup/serialio.c:12:2: error: initializer element is not constant
  drivers/staging/speakup/serialio.c:12:2: error: (near initialization for 'rs_table[3].baud_base')

Signed-off-by: Chen Gang <gang.chen@asianux.com>
Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agolustre/fld: replace IS_ERR and PTR_ERR with PTR_ERR_OR_ZERO
Duan Jiong [Wed, 6 Nov 2013 07:55:31 +0000 (15:55 +0800)]
lustre/fld: replace IS_ERR and PTR_ERR with PTR_ERR_OR_ZERO

This patch fixes coccinelle error regarding usage of IS_ERR and
PTR_ERR instead of PTR_ERR_OR_ZERO.

Signed-off-by: Duan Jiong <duanj.fnst@cn.fujitsu.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: protect buffer from being freed while mmapped
Ian Abbott [Fri, 8 Nov 2013 15:03:43 +0000 (15:03 +0000)]
staging: comedi: protect buffer from being freed while mmapped

If a comedi device is automatically detached by `comedi_auto_unconfig()`
any data buffers associated with subdevices that support asynchronous
commands will be freed.  If the buffer is mmapped at the time, bad
things are likely to happen!  Prevent this by moving some of the buffer
details from `struct comedi_async` into a new, dynamically allocated,
and kref-counted `struct comedi_buf_map`.  This holds a list of pages, a
reference count, and enough information to free the pages.  The new
member `buf_map` of `struct comedi_async` points to a `struct
comedi_buf_map` when the buffer size is non-zero.

Provide a new helper function `comedi_buf_is_mapped()` to check whether
an a buffer is mmapped.  If it is mmapped, the buffer is not allowed to
be resized and the device is not allowed to be manually detached by the
`COMEDI_DEVCONFIG` ioctl.  Provide helper functions
`comedi_buf_map_get()` and `comedi_buf_map_put()` to manipulate the
reference count of the `struct comedi_buf_map`, which will be freed
along with its contents via the 'release' callback of the `kref_put()`
call.  The reference count is manipulated by the vma operations and the
mmap file operation.

Now, when the comedi device is automatically detached, the buffer will
be effectively freed by calling `comedi_buf_alloc()` with a new buffer
size of 0.  That calls local function `__comedi_buf_free()` which calls
`comedi_buf_map_put()` on the `buf_map` member to free it.  It won't
actually be freed until the final 'put'.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: make determination of read or write subdevice safer
Ian Abbott [Fri, 8 Nov 2013 15:03:42 +0000 (15:03 +0000)]
staging: comedi: make determination of read or write subdevice safer

`comedi_read_subdevice()` and `comedi_write_subdevice()` respectively
determine the read and write subdevice to use for a comedi device,
depending on a minor device number passed in.  The comedi device has a
main "board" minor device number and may also have dynamically assigned,
subdevice-specific minor device numbers, in a range of numbers shared by
all comedi devices.  If the minor device number is within the range of
subdevice-specific minor device numbers, both functions call
`comedi_subdevice_from_minor()` to determine what subdevice is
associated with the minor device number (if any) and then check the
subdevice belongs to the comedi device.  Since the subdevice might
belong to a different comedi device, the check is not protected against
the subdevice being freed.  Perform the check in
`comedi_subdevice_from_minor()` instead, where it is protected against
the subdevice being freed.  Make it return `NULL` if the subdevice does
not belong to the device.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: remove comedi_dev_from_minor()
Ian Abbott [Fri, 8 Nov 2013 15:03:41 +0000 (15:03 +0000)]
staging: comedi: remove comedi_dev_from_minor()

The `comedi_dev_from_minor()` function is no longer used, so remove it.
Calls to it have either been replaced by calls to
`comedi_dev_get_from_minor()` or by using the `private_data` member of
the open file object.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: use file->private_data in file operations
Ian Abbott [Fri, 8 Nov 2013 15:03:40 +0000 (15:03 +0000)]
staging: comedi: use file->private_data in file operations

Since the `struct comedi_device` should now be protected from being
freed while an open file object is using it, use the `private_data`
member of the `struct file` to point to it.  Set it in `comedi_open()`
and use it in the other file operation handlers instead of calling
`comedi_dev_from_minor()` and checking the result.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: kcomedilib: protect against device detachment
Ian Abbott [Fri, 8 Nov 2013 15:03:39 +0000 (15:03 +0000)]
staging: comedi: kcomedilib: protect against device detachment

The functions in "kcomedilib" need to prevent the comedi device being
detached during their operation.  This can be done by acquiring either
the main mutex or the "attach lock" semaphore in the `struct
comedi_device`.  Use the attach lock when merely checking whether the
device is attached.  Use the mutex when processing a comedi instruction.

Also, don't bother trying to manipulate the module use count of
low-level comedi driver in `comedi_open()` and `comedi_close()`.  If the
device gets detached while it is "open", we wouldn't be able to
decrement the module use count anyway.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: kcomedilib: increment reference while device in use
Ian Abbott [Fri, 8 Nov 2013 15:03:38 +0000 (15:03 +0000)]
staging: comedi: kcomedilib: increment reference while device in use

Low-level comedi drivers that use the "kcomedilib" module (currently only
the "comedi_bond" driver) call `comedi_open()` to "open" another comedi
device (not as a file) and `comedi_close()` to "close" it.  (Note: these
are the functions exported by the "kcomedilib" module, not the
identically named, statically linked functions in the core "comedi"
module.)

In `comedi_open()`, call `comedi_dev_get_from_minor()` instead of
`comedi_dev_from_minor()` to get the pointer to the `struct
comedi_device` being "opened".  This increments its reference count to
prevent it being freed.  Call `comedi_dev_put()` if `comedi_open()`
returns `NULL`, and also call it from `comedi_close()`.  This decrements
the reference count.

Note that although we now protect against the `struct comedi_device`
being freed, we do not yet protect against it being "detached" while it
is being used.  This will be addressed by a later patch.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: use refcount in sysfs attribute handlers
Ian Abbott [Fri, 8 Nov 2013 15:03:37 +0000 (15:03 +0000)]
staging: comedi: use refcount in sysfs attribute handlers

Call `comedi_dev_get_from_minor()` instead of `comedi_dev_from_minor()`
in the sysfs attribute handler functions to increment the reference of
the `struct comedi_device` during the operation.  Call
`comedi_dev_put()` to decrement the reference afterwards.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: use refcount while reading /proc/comedi
Ian Abbott [Fri, 8 Nov 2013 15:03:36 +0000 (15:03 +0000)]
staging: comedi: use refcount while reading /proc/comedi

In the seq_file 'show' handler for "/proc/comedi" - `comedi_read()` in
"comedi/proc.c",  call `comedi_dev_get_from_minor()` instead of
`comedi_dev_from_minor()` to increment the reference counter for the
`struct comedi_device` while it is being examined.  Call
`comedi_dev_put()` to decrement the reference afterwards.  Also acquire
the `attach_lock` rwsem while checking whether the device is attached.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: use refcount in comedi_driver_unregister()
Ian Abbott [Fri, 8 Nov 2013 15:03:35 +0000 (15:03 +0000)]
staging: comedi: use refcount in comedi_driver_unregister()

Change `comedi_driver_unregister()` to call
`comedi_dev_get_from_minor()` instead of `comedi_dev_from_minor()` when
finding devices using the driver.  This increments the reference count
to prevent the device being removed while it is being checked to see if
it is attached to the driver.  Call `comedi_dev_put()` to decrement the
reference afterwards.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: increment reference while file open
Ian Abbott [Fri, 8 Nov 2013 15:03:34 +0000 (15:03 +0000)]
staging: comedi: increment reference while file open

In the 'open' file operation handler `comedi_open()` in "comedi_fops.c",
call `comedi_dev_get_from_minor()` instead of `comedi_dev_from_minor()`
to get the pointer to the `struct comedi_device`.  This increments the
reference to prevent it being freed.  Call `comedi_dev_put()` to
decrement the reference  on failure, and also call it from the 'release'
file operation handler `comedi_close()`.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: add comedi_dev_get_from_minor()
Ian Abbott [Fri, 8 Nov 2013 15:03:33 +0000 (15:03 +0000)]
staging: comedi: add comedi_dev_get_from_minor()

Add function `struct comedi_device *comedi_dev_get_from_minor(unsigned
minor)`.  This behaves like the existing `comedi_dev_from_minor()`
except that it also increments the `struct kref refcount` member (via
new helper function `comedi_dev_get()`) to prevent it being freed.  If
it returns a valid pointer, the caller is responsible for calling
`comedi_dev_put()` to decrement the reference count.

Export `comedi_dev_get_from_minor()` and `comedi_dev_put()` as they will
be used by the "kcomedilib" module in addition to the "comedi" module
itself.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: add a kref to comedi device
Ian Abbott [Fri, 8 Nov 2013 15:03:32 +0000 (15:03 +0000)]
staging: comedi: add a kref to comedi device

Add a `struct kref refcount` member to `struct comedi_device` to allow
safe destruction of the comedi device.  Only free the comedi device via
the 'release' callback `kref_put()`.  Currently, nothing calls
`kref_put()`, so the safe destruction is ineffective, but this will be
addressed by later patches.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: protect against detach during read operation
Ian Abbott [Fri, 8 Nov 2013 15:03:31 +0000 (15:03 +0000)]
staging: comedi: protect against detach during read operation

The 'read' file operation for comedi devices does not use the main mutex
in the `struct comedi_device` to avoid contention with some ioctls that
may take a while to complete.  Use the `attach_lock` semaphore to
protect against detachment while the 'read' operation is in progress.
This is a `struct rw_semaphore` and we read-lock it to protect against
device detachment.

Note that `comedi_device_cancel_all()` is called during device
detachment, which cancels any ongoing asynchronous commands.  This will
wake up any blocked readers which will then release the `attach_lock`
semaphore and complete the 'read' operation early.

The only time the 'read' file operation does use the main mutex is at
the end of the command when it has to call `do_become_nonbusy()` to mark
the subdevice as no longer busy handling an asynchronous command.  To
avoid deadlock, it has to remove the task from the wait queue and
release the `attach_lock` semaphore before acquiring the main mutex.  It
then needs to confirm the device is still attached.  Unfortunately, we
do not yet protect against a dynamically allocated `struct
comedi_device` being deleted during the operation.  This will be
addressed by a later patch.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: protect against detach during write operation
Ian Abbott [Fri, 8 Nov 2013 15:03:30 +0000 (15:03 +0000)]
staging: comedi: protect against detach during write operation

The 'write' file operation for comedi devices does not use the main
mutex in the `struct comedi_device` to avoid contention with some ioctls
that may take a while to complete.  Use the `attach_lock` semaphore to
protect against detachment while the 'write' operation is in progress.
This is a `struct rw_semaphore` and we read-lock it to protect against
device detachment.

Note that `comedi_device_cancel_all()` is called during device
detachment, which cancels any ongoing asynchronous commands.  This will
wake up any blocked writers which will then release the `attach_lock`
semaphore and complete the 'write' operation early.

The only time the 'write' file operation does use the main mutex is at
the end of the command when it has to call `do_become_nonbusy()` to mark
the subdevice as no longer busy handling an asynchronous command.  To
avoid deadlock, it has to remove the task from the wait queue and
release the `attach_lock` semaphore before acquiring the main mutex.  It
then needs to confirm that the device is still attached.  Unfortunately,
we do not yet protect against a dynamically allocated `struct
comedi_device` being deleted during the operation.  This will be
addressed by a later patch.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: add detachment counter for validity checks
Ian Abbott [Fri, 8 Nov 2013 15:03:29 +0000 (15:03 +0000)]
staging: comedi: add detachment counter for validity checks

Add a member `detach_count` to `struct comedi_device` that is
incremented every time the device gets detached.  This will be used in
some validity checks in the 'read' and 'write' file operations to make
sure the attachment remains valid.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: cancel commands before detaching device
Ian Abbott [Fri, 8 Nov 2013 15:03:28 +0000 (15:03 +0000)]
staging: comedi: cancel commands before detaching device

The comedi core module's handling of the `COMEDI_DEVCONFIG` ioctl will
not allow a device to be detached if it is busy.  However, comedi
devices can also be auto-detached due to a removal of a hardware device.
One of the things we should do in that case is cancel any asynchronous
commands that are running.  Add a new function
`comedi_device_cancel_all()` to do that and call it from
`comedi_device_detach()`.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: wake up async waiters when become non-busy
Ian Abbott [Fri, 8 Nov 2013 15:03:27 +0000 (15:03 +0000)]
staging: comedi: wake up async waiters when become non-busy

Wake up all waiters on the comedi subdevice's async wait queue whenever
the subdevice is marked "non-busy".  This happens when an asynchronous
command is cancelled or when a command is terminated and all data has
been read or written.  Note: use `wake_up_interruptible_all()` as we
only use interruptible waits.

Remove the call to `wake_up_interruptible()` from `do_cancel_ioctl()` as
it will call `wake_up_interruptible_all()` indirectly via `do_cancel()`
and `do_become_nonbusy()`.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: cleanup_device() -> comedi_device_detach_cleanup()
Ian Abbott [Fri, 8 Nov 2013 15:03:26 +0000 (15:03 +0000)]
staging: comedi: cleanup_device() -> comedi_device_detach_cleanup()

Rename the local function `cleanup_device()` to
`comedi_device_detach_cleanup()`.  It is only called from the
`comedi_device_detach()` function and that is called from
`comedi_device_cleanup()` and other places.  The more specific function
name seems less confusing.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>