linux-2.6-microblaze.git
9 years agostaging: comedi: comedi_fops: always clear events
Ian Abbott [Fri, 27 Mar 2015 15:13:04 +0000 (15:13 +0000)]
staging: comedi: comedi_fops: always clear events

`comedi_event()` is called from low-level drivers to handle asynchronous
command event flags that are stored in `s->async->events` for subdevice
`s`.  It normally clears the event flags as well.  As a safety check, it
does nothing if no asynchronous command is running, but it leaves
`s->async->events` unchanged in this case.  For additional safety,
change it to always clear the event flags to avoid leaving stale event
flags set when another asynchronous command is set up.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: comedi: comedi_fops: remove unnecessary s->async use
Ian Abbott [Fri, 27 Mar 2015 15:13:03 +0000 (15:13 +0000)]
staging: comedi: comedi_fops: remove unnecessary s->async use

In places where the `s->async` value has been stored in a local
variable, use the variable instead of repeating `s->async`.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: comedi: comedi_fops: simplify comedi_is_subdevice_idle()
Ian Abbott [Fri, 27 Mar 2015 15:13:02 +0000 (15:13 +0000)]
staging: comedi: comedi_fops: simplify comedi_is_subdevice_idle()

Don't use a conditional operator when a simple "not" will do.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: comedi: comedi_fops: eliminate a use of subdevice spin-lock
Ian Abbott [Fri, 27 Mar 2015 15:13:01 +0000 (15:13 +0000)]
staging: comedi: comedi_fops: eliminate a use of subdevice spin-lock

`comedi_is_subdevice_in_error()` is only used by `comedi_read()` and
`comedi_write()` and is only called (soon) after
`comedi_is_subdevice_running()` returns `false` (with extra conditions
in the case of `comedi_write()`).  `comedi_is_subdevice_running()` and
`comedi_get_subdevice_runflags()` both call
`comedi_get_subdevice_runflags()` which uses the subdevice's spin-lock.

Eliminate one use of the subdevice's spin-lock in `comedi_read()` and
`comedi_write()` by calling `comedi_get_subdevice_runflags()` and
checking the runflags directly.  Add a couple of inline functions to
check the runflags: `comedi_is_runflags_running()` and
`comedi_is_runflags_in_error()`.  These do the same test on runflags as
`comedi_is_subdevice_running()` and `comedi_is_subdevice_in_error()` but
get passed the runflags value directly.

`comedi_is_subdevice_in_error()` is no longer used, so remove it.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: comedi: comedi_fops: rename comedi_set_subdevice_runflags()
Ian Abbott [Fri, 27 Mar 2015 15:13:00 +0000 (15:13 +0000)]
staging: comedi: comedi_fops: rename comedi_set_subdevice_runflags()

`comedi_set_subdevice_runflags()` changes the comedi subdevice's
`runflags` member according to a bit-mask and new bit values.  It's name
might suggest that it only "sets", not "clears".  Rename it to
`comedi_update_subdevice_runflags()` to avoid confusion.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoMerge lustre patches based on 4.0-rc5 into staging-testing
Greg Kroah-Hartman [Fri, 3 Apr 2015 10:56:05 +0000 (12:56 +0200)]
Merge lustre patches based on 4.0-rc5 into staging-testing

This is done to handle some lustre patches that were made against the
wrong kernel branch, which was my fault, as I gave a lecture where I
messed things up for the students, it wasn't their fault.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoStaging: lustre: o2iblnd.c: Finished cleaning code style
Guillaume Matheron [Thu, 2 Apr 2015 17:52:07 +0000 (19:52 +0200)]
Staging: lustre: o2iblnd.c: Finished cleaning code style

I fixed lines over 80 characters and unnecessary returns

Signed-off-by: Guillaume Matheron <guillaume.matheron@ens.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoStaging: lustre: o2iblnd_cb.c: Removed the rest of unnecessary spaces before parenthesis
Guillaume Matheron [Thu, 2 Apr 2015 15:04:55 +0000 (17:04 +0200)]
Staging: lustre: o2iblnd_cb.c: Removed the rest of unnecessary spaces before parenthesis

I removed all the 'unneeded space' warnings given by checkpatch.pl

Signed-off-by: Guillaume Matheron <guillaume.matheron@ens.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoStaging: lustre: o2iblnd.c: Started fixing coding style
Guillaume Matheron [Thu, 2 Apr 2015 17:35:45 +0000 (19:35 +0200)]
Staging: lustre: o2iblnd.c: Started fixing coding style

I focused on function declarations (placed return type on the same line
as function name), and spaces between function name and parenthesis

Signed-off-by: Guillaume Matheron <guillaume.matheron@ens.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoStaging: Lustre: rw26.c: include according to checkpatch.pl
Georges-Axel Jaloyan [Thu, 2 Apr 2015 14:10:31 +0000 (16:10 +0200)]
Staging: Lustre: rw26.c: include according to checkpatch.pl

Signed-off-by: Georges-Axel Jaloyan <georges-axel.jaloyan@ens.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoStaging: lustre: dir.c: adding a blank after a declaration.
Cyrille Ruggero [Thu, 2 Apr 2015 14:09:14 +0000 (16:09 +0200)]
Staging: lustre: dir.c: adding a blank after a declaration.

Adding a blank in this file after a declaration as reported by checkpatch.pl.

Signed-off-by: Cyrille Ruggero <cyrille.ruggero@ens.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoStaging: lustre: lov_io.c: remove useless unary pluses
Luca Wehrstedt [Thu, 2 Apr 2015 14:33:34 +0000 (16:33 +0200)]
Staging: lustre: lov_io.c: remove useless unary pluses

Replace two occurrences of "+1" with simply "1".

Signed-off-by: Luca Wehrstedt <luca.wehrstedt@ens.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoStaging: lustre: o2iblnd_modparam.c: remove unneeded space
Gwendoline Chouasne-Guillon [Thu, 2 Apr 2015 14:11:04 +0000 (16:11 +0200)]
Staging: lustre: o2iblnd_modparam.c: remove unneeded space

 before the arguments of a function

Remove unneeded space before the arguments of a function

Signed_off_by: Gwendoline Chouasne-guillon <chouasne@ens.fr>

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoStaging: lustre: o2iblnd_cb.c: Removed a bunch of spaces before parenthesis
Guillaume Matheron [Thu, 2 Apr 2015 14:10:15 +0000 (16:10 +0200)]
Staging: lustre: o2iblnd_cb.c: Removed a bunch of spaces before parenthesis

Fixed warnings as reported by checkpatch.pl
Also fixed padding before function arguments when needed

Signed-off-by: Guillaume Matheron <guillaume.matheron@ens.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoStaging: lustre: config.c: fix a "do not add new typedefs" warning reported by checkp...
Rafaël Bocquet [Thu, 2 Apr 2015 15:12:34 +0000 (17:12 +0200)]
Staging: lustre: config.c: fix a "do not add new typedefs" warning reported by checkpatch.pl

Signed-off-by: Rafaël Bocquet <rafael.bocquet@ens.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoStaging: lustre: config.c: fix lines exceeding 80 characters reported by checkpatch.pl
Rafaël Bocquet [Thu, 2 Apr 2015 15:12:33 +0000 (17:12 +0200)]
Staging: lustre: config.c: fix lines exceeding 80 characters reported by checkpatch.pl

Signed-off-by: Rafaël Bocquet <rafael.bocquet@ens.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoStaging: lustre: lib-md.c format line too long
Martin Vassor [Thu, 2 Apr 2015 14:47:39 +0000 (16:47 +0200)]
Staging: lustre: lib-md.c format line too long

Format comment such that it is under 80 chars

Signed-off-by: Martin Vassor <martin.vassor@epfl.ch>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: lustre: include: remove unused macros
Aya Mahfouz [Thu, 2 Apr 2015 18:01:15 +0000 (20:01 +0200)]
staging: lustre: include: remove unused macros

OBD_CHECK_DEV and OBD_CHECK_DEV_ACTIVE have been replaced by static
inline functions. They are removed since they are not used anymore.

Signed-off-by: Aya Mahfouz <mahfouz.saif.elyazal@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: lustre: include: replace OBD_CHECK_DEV_ACTIVE by obd_check_dev_active
Aya Mahfouz [Thu, 2 Apr 2015 18:00:24 +0000 (20:00 +0200)]
staging: lustre: include: replace OBD_CHECK_DEV_ACTIVE by obd_check_dev_active

Static inline functions are preferred over macros. The inline function
obd_check_dev_active is introduced to replace OBD_CHECK_DEV_ACTIVE.
All functions that call obd_check_dev_active store the return values
and return them if they represent an error code.

Some of the changes were carried out manually while others were done
using coccinelle.

Signed-off-by: Aya Mahfouz <mahfouz.saif.elyazal@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: lustre: include: replace OBD_CHECK_DEV by obd_check_dev
Aya Mahfouz [Thu, 2 Apr 2015 17:59:15 +0000 (19:59 +0200)]
staging: lustre: include: replace OBD_CHECK_DEV by obd_check_dev

Static inline functions are preferred over macros. Hence, the function
obd_check_dev was introduced. obd_check_dev replaces the macro
OBD_CHECK_DEV. All functions that call obd_check_dev store the return
values and return them if they represent an error code.

Some of the changes were carried out manually while others were done
using coccinelle.

Signed-off-by: Aya Mahfouz <mahfouz.saif.elyazal@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoStaging: lustre: lnet: selftest: lconctl.c: fixed indentation of the switch
Théotime Grohens [Thu, 2 Apr 2015 14:24:36 +0000 (16:24 +0200)]
Staging: lustre: lnet: selftest: lconctl.c: fixed indentation of the switch

Signed-off-by: Théotime Grohens <theotime.grohens@ens.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoStaging: lustre: module.c: remove unneeded return statement
Greg Kroah-Hartman [Thu, 2 Apr 2015 14:28:12 +0000 (16:28 +0200)]
Staging: lustre: module.c: remove unneeded return statement

Remove an unneeded return statement in this file as reported by
checkpatch.pl.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoStaging: sm750fb: Remove zero testing pointer typed value
Amitoj Kaur Chawla [Thu, 2 Apr 2015 17:31:04 +0000 (23:01 +0530)]
Staging: sm750fb: Remove zero testing pointer typed value

Removes variable comparison with 0.
Done using following coccinelle script.

@ disable is_zero,isnt_zero @
expression *E;
expression E1,f;
@@

E = f(...)
<...
(
- E == 0
+ !E
|
- E != 0
+ E
|
- 0 == E
+ !E
|
- 0 != E
+ E
)
...>
?E = E1

@ disable is_zero,isnt_zero @
expression *E;
@@

(
  E ==
- 0
+ NULL
|
  E !=
- 0
+ NULL
|
- 0
+ NULL
  == E
|
- 0
+ NULL
  != E
)

Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoStaging: sm750fb: Fixed indent of switch-case
Amitoj Kaur Chawla [Thu, 2 Apr 2015 17:27:55 +0000 (22:57 +0530)]
Staging: sm750fb: Fixed indent of switch-case

Fixed indent of switch-case by adding space using tabs.
Problem found using checkpatch.pl
ERROR: space required after that ';' (ctx:VxV)

Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoStaging: sm750fb: Fix C99 Comments
Amitoj Kaur Chawla [Thu, 2 Apr 2015 17:25:18 +0000 (22:55 +0530)]
Staging: sm750fb: Fix C99 Comments

Used C89 instead of C99 Comment and removed C99 comments performing prints only.
Problem found using checkpatch.pl
ERROR: do not use C99 // comments

Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoStaging: comedi: addi_apci_1564: Delete a tap
Charlie Wong Super [Thu, 2 Apr 2015 10:10:04 +0000 (18:10 +0800)]
Staging: comedi: addi_apci_1564: Delete a tap

Fix the checkpatch.pl WARNING: line over 80 characters

Signed-off-by: Charlie Wong Super <1213charlie@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: lustre: prevent underflows in lnet_parse_reply()
Dan Carpenter [Wed, 1 Apr 2015 08:13:03 +0000 (11:13 +0300)]
staging: lustre: prevent underflows in lnet_parse_reply()

I don't know if "hdr->payload_length;" can really be negative, but if so
then we shouldn't allow it.  Do the comparison as an unsigned.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoStaging: lustre: integer overflow in ioctl
Dan Carpenter [Wed, 1 Apr 2015 08:12:15 +0000 (11:12 +0300)]
Staging: lustre: integer overflow in ioctl

hdr->ioc_len is a user controlled u32 so the addition can overflow,
especially on 32 bit systems.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoStaging: lustre: brw_test.c: remove unneeded return statement
Achille Aknin [Thu, 2 Apr 2015 14:12:04 +0000 (16:12 +0200)]
Staging: lustre: brw_test.c: remove unneeded return statement

Remove an unneeded return statement in this file

Signed-off-by: Achille Aknin <achille.aknin@ens.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: lustre: ping_test.c : remove space after function names
Auguste Olivry [Thu, 2 Apr 2015 14:07:17 +0000 (16:07 +0200)]
staging: lustre: ping_test.c : remove space after function names

remove space between function names and open parentheses as reported by
checkpatch.pl.

Signed-off-by: Auguste Olivry <auguste.olivry@ens.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoStaging: lustre: lov_io.c: remove useless unary pluses
Luca Wehrstedt [Thu, 2 Apr 2015 14:33:34 +0000 (16:33 +0200)]
Staging: lustre: lov_io.c: remove useless unary pluses

Replace two occurrences of "+1" with simply "1".

Signed-off-by: Luca Wehrstedt <luca.wehrstedt@ens.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoiio: light: ltr501: Powerdown device on error
Cristina Opriceana [Wed, 1 Apr 2015 15:50:17 +0000 (18:50 +0300)]
iio: light: ltr501: Powerdown device on error

Power down device when an error occurs  in order to avoid wasting
power. Move powerdown function up to be seen by the new call and
align parameters for the ltr501_write_contr() call.

Signed-off-by: Cristina Opriceana <cristina.opriceana@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: dgnc_sysfs: Replace printk(KERN_ERR ) with pr_err()
Ioana Ciornei [Mon, 30 Mar 2015 23:29:35 +0000 (02:29 +0300)]
staging: dgnc_sysfs: Replace printk(KERN_ERR ) with pr_err()

Fix the following checkpatch warning:
WARNING: Prefer [subsystem eg: netdev]_err([subsystem]dev, ...
then dev_err(dev, ... then pr_err(...  to printk(KERN_ERR ...

Signed-off-by: Ioana Ciornei <ciorneiioana@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoStaging: lustre: Mark internal functions static in llog_cat.c
Darshana Padmadas [Sat, 28 Mar 2015 18:25:04 +0000 (23:55 +0530)]
Staging: lustre: Mark internal functions static in llog_cat.c

This patch marks functions llog_cat_set_first_idx and cat_cancel_cb
static as these are used only within this file. Also since cat_cancel_cb
is made static do not export it.

This eliminates the following sparse warning:
warning: symbol * was not declared. Should it be static?

Signed-off-by: Darshana Padmadas <darshanapadmadas@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoStaging: lustre: Mark internal functions as static
Darshana Padmadas [Sat, 28 Mar 2015 17:43:56 +0000 (23:13 +0530)]
Staging: lustre: Mark internal functions as static

This patch makes functions mgc_logname2resid, mgc_set_info_async
and mgc_init static as these are only used internally.

This also eliminates sparse warnings of the type:
warning: symbol * was not declared. Should it be static?

Signed-off-by: Darshana Padmadas <darshanapadmadas@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoStaging: lustre: Include header file that declares lprocfs_mdc_init_vars
Darshana Padmadas [Sat, 28 Mar 2015 17:43:55 +0000 (23:13 +0530)]
Staging: lustre: Include header file that declares lprocfs_mdc_init_vars

This patch includes the header file mdc_internal.h that declares the
function lprocfs_mdc_init_vars.

This also eliminates the sparse warning:
warning: symbol 'lprocfs_mdc_init_vars' was not declared. Should it be static?

Signed-off-by: Darshana Padmadas <darshanapadmadas@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoStaging: lustre: Include header for functions prototypes
Darshana Padmadas [Sat, 28 Mar 2015 17:43:54 +0000 (23:13 +0530)]
Staging: lustre: Include header for functions prototypes

This patch includes the header lustre/include/lclient.h that declares
the functions lov_lsm_put and lov_read_and_clear_async_rc defined in
lov_object.c.

This eliminates warnings reported by sparse:
warning: symbol was not declared. Should it be static?

Signed-off-by: Darshana Padmadas <darshanapadmadas@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoStaging: lustre: Add header that declares function lprocfs_lmv_init_vars
Darshana Padmadas [Sat, 28 Mar 2015 17:43:53 +0000 (23:13 +0530)]
Staging: lustre: Add header that declares function lprocfs_lmv_init_vars

This patch includes the header file lmv_internal.h that declares
the function lprocfs_lmv_init_vars defined in lproc_lmv.c.

This eliminates the sparse warning:
warning: symbol 'lprocfs_lmv_init_vars' was not declared. Should it be static?

Signed-off-by: Darshana Padmadas <darshanapadmadas@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoStaging: lustre: Make obd_proc_version_seq_show static
Darshana Padmadas [Sat, 28 Mar 2015 17:43:52 +0000 (23:13 +0530)]
Staging: lustre: Make obd_proc_version_seq_show static

The function obd_proc_version_seq_show is only used in this
file, so make it static.

This eliminates the following sparse warning:
warning: symbol 'obd_proc_version_seq_show' was not declared. Should it be static?

Signed-off-by: Darshana Padmadas <darshanapadmadas@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoStaging: lustre: Add function prototypes in console.h
Darshana Padmadas [Sat, 28 Mar 2015 11:42:53 +0000 (17:12 +0530)]
Staging: lustre: Add function prototypes in console.h

Sparse reported the following warnings:
warning: symbol 'lstcon_console_init' was not declared. Should it be static?
warning: symbol 'lstcon_console_fini' was not declared. Should it be static?
warning: symbol 'lstcon_ioctl_entry' was not declared. Should it be static?

However since these functions are used in other files,
they cannot be made static, so add protoypes for the same in console.h.

Signed-off-by: Darshana Padmadas <darshanapadmadas@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoStaging: rtl8712: Remove zero-testing pointer typed value
Amitoj Kaur Chawla [Tue, 31 Mar 2015 19:22:18 +0000 (00:52 +0530)]
Staging: rtl8712: Remove zero-testing pointer typed value

Removes variable comparison with 0 by using !. Done using following
coccinelle script.

@ disable is_zero,isnt_zero @
expression *E;
expression E1,f;
@@

E = f(...)
<...
(
- E == 0
+ !E
|
- E != 0
+ E
|
- 0 == E
+ !E
|
- 0 != E
+ E
)
...>
?E = E1

@ disable is_zero,isnt_zero @
expression *E;
@@

(
  E ==
- 0
+ NULL
|
  E !=
- 0
+ NULL
|
- 0
+ NULL
  == E
|
- 0
+ NULL
  != E
)

Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoStaging: rtl8712: Remove duplicated argument to |
Cristina Opriceana [Sat, 28 Mar 2015 01:30:12 +0000 (03:30 +0200)]
Staging: rtl8712: Remove duplicated argument to |

Delete duplicated argument to | for the state argument in
the _clr_fwstate_() function call as it is redundant.
Detected with coccinelle.

Signed-off-by: Cristina Opriceana <cristina.opriceana@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoStaging: rtl8712: Use memdup_user() instead of copy_from_user()
Cristina Opriceana [Sat, 28 Mar 2015 00:57:34 +0000 (02:57 +0200)]
Staging: rtl8712: Use memdup_user() instead of copy_from_user()

Use memdup_user() to avoid its duplicated implementation and simplify
code. memdup_user() uses GFP_KERNEL instead of GFP_ATOMIC,
which is valid because copy_from_user() might sleep and it's useless
to make the allocation atomic. Found with coccinelle.

Signed-off-by: Cristina Opriceana <cristina.opriceana@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoiio: magnetometer: mag3110: Place driver on standby on error
Cristina Opriceana [Wed, 1 Apr 2015 11:01:11 +0000 (14:01 +0300)]
iio: magnetometer: mag3110: Place driver on standby on error

Place driver on standby mode on error in order to prevent wasting
power. Move standby function above to be seen by the new call.

Signed-off-by: Cristina Opriceana <cristina.opriceana@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoStaging: iio: accel: Remove explicit NULL comparison
Cristina Opriceana [Tue, 31 Mar 2015 10:04:29 +0000 (13:04 +0300)]
Staging: iio: accel: Remove explicit NULL comparison

This patch removes explicit NULL comparison and writes it in its
equivalent shorter form. Done with coccinelle.

@replace_rule@
expression e;
@@

-e == NULL
+ !e

Signed-off-by: Cristina Opriceana <cristina.opriceana@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoStaging: iio: adc: Remove explicit NULL comparison
Cristina Opriceana [Tue, 31 Mar 2015 10:04:07 +0000 (13:04 +0300)]
Staging: iio: adc: Remove explicit NULL comparison

This patch removes explicit NULL comparison and writes it in its
shorter form. Detected with coccinelle.

Signed-off-by: Cristina Opriceana <cristina.opriceana@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoStaging: iio: impedance-analyzer: Remove explicit NULL comparison
Cristina Opriceana [Tue, 31 Mar 2015 10:03:38 +0000 (13:03 +0300)]
Staging: iio: impedance-analyzer: Remove explicit NULL comparison

This patch removes explicit NULL comparison and replaces it with
its shorter form. Detected with coccinelle.

Signed-off-by: Cristina Opriceana <cristina.opriceana@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoStaging: iio: trigger: Remove explicit NULL comparison
Cristina Opriceana [Tue, 31 Mar 2015 10:03:12 +0000 (13:03 +0300)]
Staging: iio: trigger: Remove explicit NULL comparison

This patch removes explicit NULL comparison and replaces it
with its shorter form. Detected with coccinelle.

Signed-off-by: Cristina Opriceana <cristina.opriceana@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoStaging: iio: meter: Remove explicit NULL comparison
Cristina Opriceana [Tue, 31 Mar 2015 10:01:18 +0000 (13:01 +0300)]
Staging: iio: meter: Remove explicit NULL comparison

This patch removes explicit NULL comparison and replaces it with
its shorter form. Detected with coccinelle.

@replace_rule@
expression e;
@@

-e == NULL
+ !e

Signed-off-by: Cristina Opriceana <cristina.opriceana@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoStaging: iio: iio_simple_dummy: Remove explicit NULL comparison
Cristina Opriceana [Tue, 31 Mar 2015 09:51:38 +0000 (12:51 +0300)]
Staging: iio: iio_simple_dummy: Remove explicit NULL comparison

This patch removes explicit NULL comparison and writes it in its
simpler form. Done with coccinelle:

@replace_rule@
expression e;
@@

-e == NULL
+ !e

Signed-off-by: Cristina Opriceana <cristina.opriceana@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoStaging: iio: iio_dummy_evgen: Simplify NULL comparison
Cristina Opriceana [Tue, 31 Mar 2015 09:51:10 +0000 (12:51 +0300)]
Staging: iio: iio_dummy_evgen: Simplify NULL comparison

Remove explicit NULL comparison and write it in its simpler form.
Replacement done with coccinelle:

@replace_rule@
expression e;
@@

-e == NULL
+ !e

Signed-off-by: Cristina Opriceana <cristina.opriceana@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoStaging: iio: Add error check on iio_register_device()
Cristina Opriceana [Sun, 29 Mar 2015 13:14:39 +0000 (16:14 +0300)]
Staging: iio: Add error check on iio_register_device()

This patch checks if an error occurred on probe and stops the
device in order to avoid wasting power.

Signed-off-by: Cristina Opriceana <cristina.opriceana@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoMerge tag 'iio-for-4.1b' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio...
Greg Kroah-Hartman [Wed, 1 Apr 2015 11:43:39 +0000 (13:43 +0200)]
Merge tag 'iio-for-4.1b' of git://git./linux/kernel/git/jic23/iio into staging-next

Jonathan writes:

Second set of new devices, functionality and cleanup for IIO in the 4.1 cycle.

New Functionality
* Watermark logic for buffers.  Allows for blocking reads to block until
  their requested amount is available - previously they only blocked until
  a single scan of data was available.  Also allows for polling for a
  watermark amount of data to be available.  This feature was first proposed
  some time ago to good responses, but not taken further by the original author
  Octavian has picked up the gauntlet and taken it through
  to merging (along with the hardware fifo support that follows).
* New approach to hardware fifo handling - in particular handling the
  interaction of a hardware fifo feeding into a software fifo and their
  watershed events.  We don't have every possible case well covered yet,
  but this is certainly a good, flexible starting point.  This will replace
  the previous approach used in ancient drivers (sca3000) where we just
  exposed the hardware buffer directly to userspace.  Very few pieces of
  hardware have sufficiently long buffers for that to be an adequate solution.
* bmc150_accel - hardware fifo support.
* mlx90614 - support dual IR sensor devices + some refactoring to clean up the
  code and allow some other functionality currently under review.
* L3GD20H gyroscope support added to the st_gyro driver.
* lis3lv02d accelerometer added to the st_gyro driver. Note this part is
  also supported by the older lis3 driver under misc.  A lengthy discussion
  took place and concluded that holding parts out on the basis that whole
  driver would be subsumed into this one was counter productive.  Better
  to add part support and add additional features as people need them.
  Basically there was not advantage in not merging the support.
* max517 driver gains support for MAX520 and MAX521 DACs.

Documentation
* 3.20 -> 4.0 renaming for recent docs. Whilst technically a fix, I think
  people will cope until the next merge merge window.
* An ABI typo hat -> What:  More ABIs should have hats.
* Document in_rot_offset, illuminance_raw and illuminance_scale.

Cleanups
* Fix a scale extraction bug in generic_buffer.c example.
* Constify a load of device tree related structures.

9 years agoiio: Documentation: fix kernel version for 4.0 new ABI
Irina Tirdea [Mon, 30 Mar 2015 11:22:13 +0000 (14:22 +0300)]
iio: Documentation: fix kernel version for 4.0 new ABI

Kernel version for new ABI in 4.0 has been documented
as 3.20, since the changes have been merged before the kernel
version number change.

Change kernel version from 3.20 to 4.0.

Signed-off-by: Irina Tirdea <irina.tirdea@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
9 years agoDocumentation/ABI:iio:fix typo
Martin Kepplinger [Sun, 29 Mar 2015 00:59:49 +0000 (01:59 +0100)]
Documentation/ABI:iio:fix typo

Signed-off-by: Martin Kepplinger <martink@posteo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
9 years agoiio: mlx90614: Support devices with dual IR sensor
Vianney le Clément de Saint-Marcq [Tue, 24 Mar 2015 15:54:15 +0000 (16:54 +0100)]
iio: mlx90614: Support devices with dual IR sensor

The model is detected by reading the EEPROM configuration during
probing.

Signed-off-by: Vianney le Clément de Saint-Marcq <vianney.leclement@essensium.com>
Cc: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
9 years agoiio: mlx90614: Add symbols for accessible registers
Vianney le Clément de Saint-Marcq [Tue, 24 Mar 2015 15:54:14 +0000 (16:54 +0100)]
iio: mlx90614: Add symbols for accessible registers

Add symbols for all accessible RAM and EEPROM registers, as well as the
sleep command and timings defined in the datasheet.

Signed-off-by: Vianney le Clément de Saint-Marcq <vianney.leclement@essensium.com>
Cc: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
9 years agoiio: bmc150_accel: add support for hardware fifo
Octavian Purdila [Sun, 22 Mar 2015 18:33:40 +0000 (20:33 +0200)]
iio: bmc150_accel: add support for hardware fifo

We only advertise hardware fifo support if the I2C bus supports full
I2C or smbus I2C block data reads since it is mandatory to read the
full frame in one read (otherwise the rest of the frame is discarded).

The hardware fifo is enabled only when triggers are not active because:

(a) when using the any-motion trigger the user expects to see samples
based on ROC events, but the fifo stores samples based on the sample
frequency

(b) the data-ready trigger is waking the CPU for for every sample, so
using the hardware fifo does not have any benefit

Signed-off-by: Octavian Purdila <octavian.purdila@intel.com>
Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
9 years agoiio: add support for hardware fifo
Octavian Purdila [Sun, 22 Mar 2015 18:33:39 +0000 (20:33 +0200)]
iio: add support for hardware fifo

Some devices have hardware buffers that can store a number of samples
for later consumption. Hardware usually provides interrupts to notify
the processor when the FIFO is full or when it has reached a certain
watermark level. This helps with reducing the number of interrupts to
the host processor and thus it helps decreasing the power consumption.

This patch enables usage of hardware FIFOs for IIO devices in
conjunction with software device buffers. When the hardware FIFO is
enabled the samples are stored in the hardware FIFO. The samples are
later flushed to the device software buffer when the number of entries
in the hardware FIFO reaches the hardware watermark or when a flush
operation is triggered by the user when doing a non-blocking read
on an empty software device buffer.

In order to implement hardware FIFO support the device drivers must
implement the following new operations: setting and getting the
hardware FIFO watermark level, flushing the hardware FIFO to the
software device buffer. The device must also expose information about
the hardware FIFO such it's minimum and maximum watermark and if
necessary a list of supported watermark values. Finally, the device
driver must activate the hardware FIFO when the device buffer is
enabled, if the current device settings allows it.

The software device buffer watermark is passed by the IIO core to the
device driver as a hint for the hardware FIFO watermark. The device
driver can adjust this value to allow for hardware limitations (such
as capping it to the maximum hardware watermark or adjust it to a
value that is supported by the hardware). It can also disable the
hardware watermark (and implicitly the hardware FIFO) it this value is
below the minimum hardware watermark.

Since a driver may support hardware FIFO only when not in triggered
buffer mode (due to different semantics of hardware FIFO sampling and
triggered sampling) this patch changes the IIO core code to allow
falling back to non-triggered buffered mode if no trigger is enabled.

Signed-off-by: Octavian Purdila <octavian.purdila@intel.com>
Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
9 years agoiio: add watermark logic to iio read and poll
Josselin Costanzi [Sun, 22 Mar 2015 18:33:38 +0000 (20:33 +0200)]
iio: add watermark logic to iio read and poll

Currently the IIO buffer blocking read only wait until at least one
data element is available.
This patch makes the reader sleep until enough data is collected before
returning to userspace. This should limit the read() calls count when
trying to get data in batches.

Co-author: Yannick Bedhomme <yannick.bedhomme@mobile-devices.fr>
Signed-off-by: Josselin Costanzi <josselin.costanzi@mobile-devices.fr>
[rebased and remove buffer timeout]
Signed-off-by: Octavian Purdila <octavian.purdila@intel.com>
Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
9 years agoIIO: Add support for L3GD20H gyroscope
Robert Dolca [Mon, 23 Mar 2015 13:40:25 +0000 (15:40 +0200)]
IIO: Add support for L3GD20H gyroscope

It can be used exactly like L3GD20 but it has a different WhoAmI
register value.

Signed-off-by: Robert Dolca <robert.dolca@intel.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
9 years agotools: iio: generic_buffer: Fix generic scale extraction
Irina Tirdea [Fri, 27 Mar 2015 11:53:00 +0000 (13:53 +0200)]
tools: iio: generic_buffer: Fix generic scale extraction

When using generic_buffer to read data, the scale is not properly
detected for scale shared by type. This is caused by a problem
with the generation of generic name out of the full name.
E.g.: for current->name in_accel_z, the extracted generic name
is "in" (when it should be "in_accel"). This is used in generic_buffer
to generate scale and offset paths (in_accel_scale).

Consider the in_ or out_ prefix when extracting the generic name
from the full name.

Signed-off-by: Irina Tirdea <irina.tirdea@intel.com>
Reviewed-by: Daniel Baluta <daniel.baluta@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
9 years agoiio: Add ABI documentation for in_rot offset value
Haneen Mohammed [Sat, 28 Mar 2015 00:02:39 +0000 (03:02 +0300)]
iio: Add ABI documentation for in_rot offset value

This patch adds ABI documentation entries for in_rot_offset.
At least one user for these is present that is the  HID Sensors Driver.

Signed-off-by: Haneen Mohammed <hamohammed.sa@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
9 years agoiio: max517: Add support for MAX520 and MAX521 chips.
Antonio Fiol [Sat, 28 Mar 2015 08:07:14 +0000 (09:07 +0100)]
iio: max517: Add support for MAX520 and MAX521 chips.

MAX520 and MAX521 are protocol-compatible with the already supported
chips, just have more channels.

Signed-off-by: Antonio Fiol <antonio@fiol.es>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
9 years agoiio: constify of_device_id array
Fabian Frederick [Mon, 16 Mar 2015 19:17:15 +0000 (20:17 +0100)]
iio: constify of_device_id array

of_device_id is always used as const.
(See driver.of_match_table and open firmware functions)

Signed-off-by: Fabian Frederick <fabf@skynet.be>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
9 years agoiio: Add ABI documentation for illuminance raw and scale values in light
Darshana Padmadas [Mon, 16 Mar 2015 11:48:20 +0000 (17:18 +0530)]
iio: Add ABI documentation for illuminance raw and scale values in light

This patchset adds ABI documentation for the following attributes:

in_illuminance_scale, used atleast once in al3320a staging/iio/light/
in_illuminance_calibscale, used atleast once in cm32181
in_illuminance_input, used in cm3232 at least once
in_illuminance_raw used atleast once in al3320a
in_illuminance_clear_raw and in_illuminance_ir_raw exposed by
gp2ap020a00f with modifiers IIO_MOD_LIGHT_CLEAR and
IIO_MOD_LIGHT_IR respectively.

Signed-off-by: Darshana Padmadas <darshanapadmadas@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
9 years agoiio: st-sensors: add support for lis3lv02d accelerometer
Linus Walleij [Wed, 18 Mar 2015 09:52:06 +0000 (10:52 +0100)]
iio: st-sensors: add support for lis3lv02d accelerometer

This adds support for the LIS3LV02 accelerometer found in the
ST Microelectronics Nomadik board series.

Cc: devicetree@vger.kernel.org
Cc: Denis CIOCCA <denis.ciocca@st.com>
Acked-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
9 years agostaging: sm750fb: Change "foo * bar" style to "foo *bar"
Helen Fornazier [Thu, 26 Mar 2015 17:09:20 +0000 (14:09 -0300)]
staging: sm750fb: Change "foo * bar" style to "foo *bar"

This patch fixes the checkpatch.pl error:

ERROR: "foo * bar" should be "foo *bar"
+int ddk750_initHw(initchip_param_t * pInitParam)

Signed-off-by: Helen Fornazier <helen.fornazier@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: sm750fb: Move switch case trailing statment
Helen Fornazier [Thu, 26 Mar 2015 17:09:19 +0000 (14:09 -0300)]
staging: sm750fb: Move switch case trailing statment

This patch fixes the checkpatch.pl error:

ERROR: trailing statements should be on next line

Signed-off-by: Helen Fornazier <helen.fornazier@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: sm750fb: Add spaces after ','
Helen Fornazier [Thu, 26 Mar 2015 17:09:18 +0000 (14:09 -0300)]
staging: sm750fb: Add spaces after ','

This patch fixes the checkpatch.pl error:

ERROR: space required after that ',' (ctx:VxV)

Signed-off-by: Helen Fornazier <helen.fornazier@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: sm750fb: Add space before switch statement
Helen Fornazier [Thu, 26 Mar 2015 17:09:17 +0000 (14:09 -0300)]
staging: sm750fb: Add space before switch statement

This patch fixes the checkpatch.pl warnings:

ERROR: space required before the open parenthesis '('
+               switch(divisor) {

ERROR: space required before the open parenthesis '('
+               switch(divisor) {

ERROR: space required before the open parenthesis '('
+       switch(reg) {

Signed-off-by: Helen Fornazier <helen.fornazier@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: sm750fb: Add space before if statement
Helen Fornazier [Thu, 26 Mar 2015 17:09:16 +0000 (14:09 -0300)]
staging: sm750fb: Add space before if statement

This patch fix the checkpatch.pl warning:

ERROR: space required before the open parenthesis '('

Signed-off-by: Helen Fornazier <helen.fornazier@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: sm750fb: Fix for statement style
Helen Fornazier [Thu, 26 Mar 2015 17:09:15 +0000 (14:09 -0300)]
staging: sm750fb: Fix for statement style

This patch fixes the checkpatch.pl warnings:

ERROR: spaces required around that '=' (ctx:VxV)
ERROR: spaces required around that '<=' (ctx:VxV)
ERROR: spaces required around that '>' (ctx:VxV)
ERROR: space required before the open parenthesis '('
ERROR: space required after that ';' (ctx:VxV)

Signed-off-by: Helen Fornazier <helen.fornazier@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: sm750fb: Fix if/else/for/switch braces style
Helen Fornazier [Thu, 26 Mar 2015 17:09:14 +0000 (14:09 -0300)]
staging: sm750fb: Fix if/else/for/switch braces style

This patch fixes the checkpatch.pl errors:

ERROR: that open brace { should be on the previous line
ERROR: else should follow close brace '}'
WARNING: braces {} are not necessary for single statement blocks
ERROR: space required before the open brace '{'

Signed-off-by: Helen Fornazier <helen.fornazier@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: sm750fb: Add space after struct definition
Helen Fornazier [Thu, 26 Mar 2015 17:09:13 +0000 (14:09 -0300)]
staging: sm750fb: Add space after struct definition

This patch fixes checkpatch.pl warning:

WARNING: missing space after struct definition
+typedef struct _pllcalparam{

Signed-off-by: Helen Fornazier <helen.fornazier@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoStaging: slicoss: Remove redundant and disabled code block
Niranjan Dighe [Thu, 26 Mar 2015 18:21:58 +0000 (23:51 +0530)]
Staging: slicoss: Remove redundant and disabled code block

Removing code guarded by undefined macro SLIC_TRACE_DUMP_ENABLED

Signed-off-by: Niranjan Dighe <niranjan.dighe@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: unisys: remove comparison
Sudip Mukherjee [Tue, 24 Mar 2015 15:17:30 +0000 (20:47 +0530)]
staging: unisys: remove comparison

the comparison is always true as the dev_t has been initialized in the
init function and we are sending that initialized dev_t to the
cleanup().

Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Benjamin Romer <benjamin.romer@unisys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: unisys: remove global dev_t
Sudip Mukherjee [Tue, 24 Mar 2015 15:17:29 +0000 (20:47 +0530)]
staging: unisys: remove global dev_t

the global variable majordev is no longer required, as it is not being
used anywhere.

Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Benjamin Romer <benjamin.romer@unisys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: unisys: use local variable in cleanup
Sudip Mukherjee [Tue, 24 Mar 2015 15:17:28 +0000 (20:47 +0530)]
staging: unisys: use local variable in cleanup

the dev_t was being stored in visorchipset_platform_device.dev.devt
while initializing the module. so pass that value as an argument to
cleanup() so that it can use this local variable instead of the global
variable.

Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Benjamin Romer <benjamin.romer@unisys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: unisys: use local variable
Sudip Mukherjee [Tue, 24 Mar 2015 15:17:27 +0000 (20:47 +0530)]
staging: unisys: use local variable

we are getting dev_t as an argument in the function, so use the local
variable instead of the global variable "majordev".
this global variable will be removed in one of the next patch of the
series.

Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Benjamin Romer <benjamin.romer@unisys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: unisys: remove redundant variable
Sudip Mukherjee [Tue, 24 Mar 2015 15:17:26 +0000 (20:47 +0530)]
staging: unisys: remove redundant variable

remove the variable "registered", which was used in the cleanup() to
detect if the driver has successfully initialized. the cleanup()
is called from module_exit, so its obvious that the module has
successfully initialized. if the initialization had failed, then
we will never be in the cleanup().

Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Benjamin Romer <benjamin.romer@unisys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: rts5208: Remove RTSX_READ_REG and RTSX_WRITE_REG macros
Joe Perches [Wed, 25 Mar 2015 19:54:26 +0000 (12:54 -0700)]
staging: rts5208: Remove RTSX_READ_REG and RTSX_WRITE_REG macros

Macros with hidden flow control are bad form as the code path
taken can be unexpected for the reader.

Expand these in-place and remove the macros.

Done with coccinelle script:

@@
expression chip;
expression arg1;
expression arg2;
expression arg3;
@@

- RTSX_WRITE_REG(chip, arg1, arg2, arg3);
+ retval = rtsx_write_register(chip, arg1, arg2, arg3);
+ if (retval) {
+ rtsx_trace(chip);
+ return retval;
+ }

@@
expression chip;
expression arg1;
expression arg2;
@@

- RTSX_READ_REG(chip, arg1, arg2);
+ retval = rtsx_read_register(chip, arg1, arg2);
+ if (retval) {
+ rtsx_trace(chip);
+ return retval;
+ }

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: rts5208: Remove TRACE_RET and TRACE_GOTO macros
Joe Perches [Wed, 25 Mar 2015 19:54:25 +0000 (12:54 -0700)]
staging: rts5208: Remove TRACE_RET and TRACE_GOTO macros

Remove these flow hiding macros.

Miscellanea:

o Add a macro and function to replace a large inline
o Simplify #includes
o Add trace.c and update Makefile
o Remove static inline filename function and use kbasename instead

This reduces object size quite a lot: ~350KB (x86-64 allyesconfig)

$ size drivers/staging/rts5208/built-in.o*
   text    data     bss     dec     hex filename
 248385   36728   77888  363001   589f9 drivers/staging/rts5208/built-in.o.new
 506691   83352  115896  705939   ac593 drivers/staging/rts5208/built-in.o.old

Done via coccinelle script and some typing.

@@
expression chip;
expression ret;
@@

- TRACE_RET(chip, ret);
+ rtsx_trace(chip);
+ return ret;

@@
expression chip;
identifier label;
@@

- TRACE_GOTO(chip, label);
+ rtsx_trace(chip);
+ goto label;

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoStaging: rtl8188eu: replace kzalloc and memcpy by kmemdup
Niranjan Dighe [Tue, 24 Mar 2015 19:16:33 +0000 (00:46 +0530)]
Staging: rtl8188eu: replace kzalloc and memcpy by kmemdup

This was generated by 'make coccicheck' using scripts at
scripts/coccinelle/api/memdup.cocci.

Signed-off-by: Niranjan Dighe <niranjan.dighe@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: rtl8723au: Update RT_TRACE macro and uses
Joe Perches [Tue, 24 Mar 2015 23:06:44 +0000 (16:06 -0700)]
staging: rtl8723au: Update RT_TRACE macro and uses

Create an rt_trace function using %pV to reduce overall code size.
Update the macro uses to remove unnecessary and now harmful parentheses.

Miscellanea around these changes:

o Coalesce formats
o Realign arguments
o Remove commented-out RT_TRACE uses
o Spelling fixes in formats
o Add missing newlines to formats
o Remove multiple newlines from formats
o Neaten formats where noticed
o Use %pM in one instance

Reduces code size ~20KB

Signed-off-by: Joe Perches <joe@perches.com>
Acked-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoStaging: rtl8192 Clean up function definition
Eddie Kovsky [Thu, 26 Mar 2015 04:16:11 +0000 (22:16 -0600)]
Staging: rtl8192 Clean up function definition

Change function definition to match its prototype declaration. This
fixes the following warning generated by sparse:

drivers/staging/rtl8192u/r8192U_core.c:1970:6: warning: symbol
'rtl8192_update_ratr_table' was not declared. Should it be static?

Signed-off-by: Eddie Kovsky <ewk@edkovsky.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: rtl8192u: Fix static decleration sparse warning.
Cihangir Akturk [Tue, 24 Mar 2015 19:53:53 +0000 (21:53 +0200)]
staging: rtl8192u: Fix static decleration sparse warning.

The function 'ieee80211_check_auth_response' is used only in this
file, so make it static. This patch fixes the following sparse
warning.

'ieee80211_check_auth_response' was not declared. Should it be static?

Signed-off-by: Cihangir Akturk <cakturk@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: ozwpan: implement error handling in ozwpan_init()
Alexey Khoroshilov [Fri, 20 Mar 2015 23:15:32 +0000 (02:15 +0300)]
staging: ozwpan: implement error handling in ozwpan_init()

Errors are correctly handled in oz_cdev_register() and oz_protocol_init(),
but then they are ignored in ozwpan_init().

Found by Linux Driver Verification project (linuxtesting.org).

Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoStaging: rtl8188eu: remove dead code
Matteo Semenzato [Fri, 20 Mar 2015 19:41:45 +0000 (20:41 +0100)]
Staging: rtl8188eu: remove dead code

The condition pxmitpriv->hwxmit_entry == 5 is always false because
HWXMIT_ENTRY is always 4.

Signed-off-by: Matteo Semenzato <mattew8898@gmail.com>
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: rtl8723au: Remove uses of MAC_FMT and MAC_ARG
Joe Perches [Tue, 24 Mar 2015 18:10:09 +0000 (11:10 -0700)]
staging: rtl8723au: Remove uses of MAC_FMT and MAC_ARG

Use the standard vsprintf kernel extension to format
mac addresses.

This reduces object code size a bit.

Miscellanea:

o Coalesce formats
o Realign arguments
o Remove the now unused MAC_FMT and MAC_ARG #defines

Signed-off-by: Joe Perches <joe@perches.com>
Acked-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: fbtft: Fix typo in fbtft
Masanari Iida [Sat, 21 Mar 2015 02:48:37 +0000 (11:48 +0900)]
staging: fbtft: Fix typo in fbtft

This patch fix spelling typo in comment and printk within fbtft

Signed-off-by: Masanari Iida <standby24x7@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoStaging: fbtft: fb_pcd8544: Fix comments style
Cláudio Maia [Fri, 20 Mar 2015 16:31:46 +0000 (16:31 +0000)]
Staging: fbtft: fb_pcd8544: Fix comments style

This patch fixes the following errors by refactoring the comments'
style:

WARNING: line over 80 characters
ERROR: code indent should use tabs where possible

Signed-off-by: Cláudio Maia <crrm@isep.ipp.pt>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoStaging: fbtft: fb_pcd8544: Fix warning line over 80 characters
Cláudio Maia [Fri, 20 Mar 2015 16:31:45 +0000 (16:31 +0000)]
Staging: fbtft: fb_pcd8544: Fix warning line over 80 characters

This patch fixes the following checkpatch warning:

WARNING: line over 80 characters

Signed-off-by: Cláudio Maia <crrm@isep.ipp.pt>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: fbtft: Add support for ili9163 controller
Kozhevnikov Anatoly [Fri, 20 Mar 2015 15:37:54 +0000 (18:37 +0300)]
staging: fbtft: Add support for ili9163 controller

Driver for ili9163-based displays (for example: Nokia 5110)

Signed-off-by: Kozhevnikov Anatoly <shilo.xyz@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: sm750fb: Remove spinlock helper function
Lorenzo Stoakes [Fri, 20 Mar 2015 15:22:15 +0000 (15:22 +0000)]
staging: sm750fb: Remove spinlock helper function

This patch removes the unnecessary spinlock helper function and instead
calls spin_lock and spin_unlock directly.

This does *not* resolve sparse warnings about context imbalances but these are
spurious.

Signed-off-by: Lorenzo Stoakes <lstoakes@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: sm750fb: Fix __iomem pointer types
Lorenzo Stoakes [Fri, 20 Mar 2015 15:22:14 +0000 (15:22 +0000)]
staging: sm750fb: Fix __iomem pointer types

This patch annotates pointers as referring to I/O mapped memory where they ought
to be, removes now unnecessary ugly casts, eliminates an incorrect deref on I/O
mapped memory by using iowrite16 instead, and updates the pointer arithmetic
accordingly to take into account that the pointers are now byte-sized. This
fixes the following sparse warnings:-

drivers/staging/sm750fb/sm750_cursor.c:113:19: warning: cast removes address space of expression
drivers/staging/sm750fb/sm750_cursor.c:204:19: warning: cast removes address space of expression

Signed-off-by: Lorenzo Stoakes <lstoakes@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: sm750fb: Remove unused function
Lorenzo Stoakes [Fri, 20 Mar 2015 15:22:13 +0000 (15:22 +0000)]
staging: sm750fb: Remove unused function

This patch removes the unused hw712_fillrect function. This patch fixes
the following sparse warning:-

drivers/staging/sm750fb/sm750_accel.c:95:5: warning: symbol 'hw712_fillrect' was not declared. Should it be static?

Signed-off-by: Lorenzo Stoakes <lstoakes@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: sm750fb: Make internal functions static
Lorenzo Stoakes [Fri, 20 Mar 2015 15:22:12 +0000 (15:22 +0000)]
staging: sm750fb: Make internal functions static

This patch declares externally unavailable functions static. This fixes
the following sparse warnings:-

drivers/staging/sm750fb/ddk750_hwi2c.c:63:6: warning: symbol 'hwI2CWaitTXDone' was not declared. Should it be static?
drivers/staging/sm750fb/ddk750_hwi2c.c:93:14: warning: symbol 'hwI2CWriteData' was not declared. Should it be static?
drivers/staging/sm750fb/ddk750_hwi2c.c:160:14: warning: symbol 'hwI2CReadData' was not declared. Should it be static?

Signed-off-by: Lorenzo Stoakes <lstoakes@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: sm750fb: Use memset_io instead of memset
Lorenzo Stoakes [Fri, 20 Mar 2015 15:22:11 +0000 (15:22 +0000)]
staging: sm750fb: Use memset_io instead of memset

This patch takes into account that cursor->vstart, crtc->vScreen and
share->pvMem are pointers to memory-mapped I/O and thus we should use memset_io
to make this explicit. In addition, some architectures require special treatment
of memory-mapped I/O so the previous code could actually break without this
change.

This fixes the following sparse warnings:-

drivers/staging/sm750fb/sm750.c:489:17: warning: incorrect type in argument 1 (different address spaces)
drivers/staging/sm750fb/sm750.c:490:17: warning: incorrect type in argument 1 (different address spaces)
drivers/staging/sm750fb/sm750.c:501:17: warning: incorrect type in argument 1 (different address spaces)
drivers/staging/sm750fb/sm750.c:502:17: warning: incorrect type in argument 1 (different address spaces)
drivers/staging/sm750fb/sm750.c:833:5: warning: incorrect type in argument 1 (different address spaces)
drivers/staging/sm750fb/sm750.c:1154:9: warning: incorrect type in argument 1 (different address spaces)

Signed-off-by: Lorenzo Stoakes <lstoakes@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: sm7xxfb: add MODULE_DEVICE_TABLE
Sudip Mukherjee [Tue, 24 Mar 2015 10:52:24 +0000 (16:22 +0530)]
staging: sm7xxfb: add MODULE_DEVICE_TABLE

add MODULE_DEVICE_TABLE to support hot-plugging.

Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>