1
0
Fork 0
Commit Graph

39226 Commits (04e1e70afec6bb2940aea0ac2e9cbaf7d643d5f4)

Author SHA1 Message Date
EunTaik Lee 9590232bb4 staging/android/ion : fix a race condition in the ion driver
There is a use-after-free problem in the ion driver.
This is caused by a race condition in the ion_ioctl()
function.

A handle has ref count of 1 and two tasks on different
cpus calls ION_IOC_FREE simultaneously.

cpu 0                                   cpu 1
-------------------------------------------------------
ion_handle_get_by_id()
(ref == 2)
                            ion_handle_get_by_id()
                            (ref == 3)

ion_free()
(ref == 2)

ion_handle_put()
(ref == 1)

                            ion_free()
                            (ref == 0 so ion_handle_destroy() is
                            called
                            and the handle is freed.)

                            ion_handle_put() is called and it
                            decreases the slub's next free pointer

The problem is detected as an unaligned access in the
spin lock functions since it uses load exclusive
 instruction. In some cases it corrupts the slub's
free pointer which causes a mis-aligned access to the
next free pointer.(kmalloc returns a pointer like
ffffc0745b4580aa). And it causes lots of other
hard-to-debug problems.

This symptom is caused since the first member in the
ion_handle structure is the reference count and the
ion driver decrements the reference after it has been
freed.

To fix this problem client->lock mutex is extended
to protect all the codes that uses the handle.

Signed-off-by: Eun Taik Lee <eun.taik.lee@samsung.com>
Reviewed-by: Laura Abbott <labbott@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-11 22:09:09 -08:00
Sandhya Bankar 5a20df724f Staging: emxx_udc: Return NULL instead of 0.
Return NULL instead of 0 from nbu2ss_ep_alloc_request(),if req pointer is NULL.

Signed-off-by: Sandhya Bankar <bankarsandhya512@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-11 22:09:09 -08:00
Amitoj Kaur Chawla 0430988693 staging: netlogic: Replace pr_* with netdev_*
Replace generic pr_info and pr_err with netdev_info and netdev_err
respectively for net devices.

Found using Coccinelle. The semantic patch used to find this is as
follows:
//<smpl>
@@
expression e;
identifier f,i;
position p;
@@
f(...,struct net_device *i,...) {
...
(
-  pr_debug@p (e)
+  netdev_dbg(i, e)
|
- pr_err@p (e)
+ netdev_err(i, e)
|
- pr_info@p (e)
+ netdev_info(i, e)
)
...
}
@@
expression e;
identifier f,i;
position p;
@@

f(...) {
...
struct net_device *n;
...
(
-  pr_debug@p (e)
+  netdev_dbg(n, e)
|
- pr_err@p (e)
+ netdev_err(n, e)
|
- pr_info@p (e)
+ netdev_info(n, e)
)
...
}
@a@
identifier s,x;
@@
struct s {
 ...
struct net_device *x;
 ...
};

@b depends on a@
expression e;
identifier f,i,a.s,a.x;
position p;
@@

f ( ..., struct s *i, ...) {
  ...
(
-  pr_debug@p (e)
+  netdev_dbg(i->x, e)
|
- pr_err@p (e)
+ netdev_err(i->x, e)
|
- pr_info@p (e)
+ netdev_info(i->x, e)
)
  ...
}

@c depends on a@
expression e;
identifier f,i,a.s,a.x;
position p;
@@

f (...) {
  ...
struct s *i = ...;
  ...
(
-  pr_debug@p (e)
+  netdev_dbg(i->x, e)
|
- pr_err@p (e)
+ netdev_err(i->x, e)
|
- pr_info@p (e)
+ netdev_info(i->x, e)
)
  ...
}
//</smpl>

Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-11 22:09:09 -08:00
Janani Ravichandran 62e259ed54 staging: netlogic: Drop unneeded void pointer cast
Void pointers need not be cast to other pointer types.
Semantic patch used:

@r@
expression x;
void* e;
type T;
identifier f;
@@

(
  *((T *)e)
|
  ((T *)x) [...]
|
  ((T *)x)->f
|
- (T *)
  e
)

Signed-off-by: Janani Ravichandran <janani.rvchndrn@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-11 22:09:09 -08:00
Amitoj Kaur Chawla b6725b058d staging: netlogic: Simplify use of devm_ioremap_resource
Remove unneeded error handling on the result of a call to
platform_get_resource when the value is passed to
devm_ioremap_resource.

The Coccinelle semantic patch that makes this change is as follows:

// <smpl>
@@
expression pdev,res,n,e,e1;
expression ret != 0;
identifier l;
@@

- res = platform_get_resource(pdev, IORESOURCE_MEM, n);
  ... when != res
- if (res == NULL) { ... \(goto l;\|return ret;\) }
  ... when != res
+ res = platform_get_resource(pdev, IORESOURCE_MEM, n);
  e = devm_ioremap_resource(e1, res);
// </smpl>

Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-11 22:09:09 -08:00
Shraddha Barke 3765dc92cb Staging: gdm72xx: Remove gdm72xx driver
Remove support for gdm72xx driver from the kernel since Wimax is dead.
[1] http://www.networkworld.com/article/2220370/4g/wimax-is-dead.html
[2] http://www.androidcentral.com/sprint-confirms-wimax-shutdown-november-6-2015

Chrome OS can distribute this driver alongside their library.

Signed-off-by: Shraddha Barke <shraddha.6596@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-11 22:09:09 -08:00
Joe Perches e0a2d503a9 staging: skein: threefish_block: Use rol64
Use the inline instead of direct code to improve readability
and shorten the code a little.

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-11 22:09:09 -08:00
Ben Marsh 5ed316d27f Staging: xgifb: remove useless blank lines
This is a patch to XGI_main_26.c that removes useless blanklines as
flagged by checkpatch.pl

Signed-off-by: Ben Marsh <bmarsh94@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-11 22:09:09 -08:00
Rehas Sachdeva c7437f342d staging: xgifb: Avoid multiple blank lines
This patch removes the checkpatch.pl warnings regarding multiple blank
lines as single blank line is the preferred coding style.

Signed-off-by: Rehas Sachdeva <aquannie@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-11 22:09:09 -08:00
Sandhya Bankar 9512349356 Staging: wlan-ng: Do not print message if kzalloc() failed.
Do not print message if kzalloc() failed.
kzalloc() has its own messages. So no need to add extra one.

Signed-off-by: Sandhya Bankar <bankarsandhya512@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-11 22:09:09 -08:00
Sandhya Bankar c631cb07b4 Staging: wlan-ng: Handle error condition.
Handle error condition.

Signed-off-by: Sandhya Bankar <bankarsandhya512@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-11 22:09:09 -08:00
Eva Rachel Retuya e2e77528a7 staging: wlan-ng: simplify NULL tests
Replace direct comparisons to NULL i.e. 'x == NULL' with '!x' for
consistency. Coccinelle semantic patch used:

@@
identifier func;
expression x;
statement Z;
@@

x = func(...);

if (
(
+	!
	x
-	== NULL
|
+	!
-	NULL ==
	x
)
   ) Z

Signed-off-by: Eva Rachel Retuya <eraretuya@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-11 22:09:09 -08:00
Janani Ravichandran 94889150a1 staging: wlan-ng: prism2sta.c: Drop unneeded void pointer cast
Void pointers need not be cast to other pointer types.
Semantic patch used:

@r@
expression x;
void *e;
type T;
identifier f;
@@

(
  *((T *)e)
|
  ((T *)x) [...]
|
  ((T *)x)->f
|
- (T *)
  e
)

Signed-off-by: Janani Ravichandran <janani.rvchndrn@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-11 22:09:09 -08:00
Janani Ravichandran 3cfcb95c72 staging: wlan-ng: prism2mgmt.c: Drop void pointer cast
Void pointers don't need to be cast to other pointer types.
Semantic patch used:

@r@
expression x;
void* e;
type T;
identifier f;
@@

(
  *((T *)e)
|
  ((T *)x) [...]
|
  ((T *)x)->f
|
- (T *)
  e
)

Signed-off-by: Janani Ravichandran <janani.rvchndrn@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-11 22:09:09 -08:00
Janani Ravichandran 3e83b0ab50 staging: wlan-ng: prism2mib.c: Drop void pointer cast
Void pointers don't need to be cast to other pointer types.
Semantic patch used:

@r@
expression x;
void* e;
type T;
identifier f;
@@

(
  *((T *)e)
|
  ((T *)x) [...]
|
  ((T *)x)->f
|
- (T *)
  e
)

Signed-off-by: Janani Ravichandran <janani.rvchndrn@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-11 22:09:09 -08:00
Janani Ravichandran 0440107039 staging: wlan-ng: Drop void pointer cast
Void pointers need not be cast to other pointer types.
Semantic patch used:

@r@
expression x;
void* e;
type T;
identifier f;
@@

(
  *((T *)e)
|
  ((T *)x) [...]
|
  ((T *)x)->f
|
- (T *)
  e
)

Signed-off-by: Janani Ravichandran <janani.rvchndrn@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-11 22:09:09 -08:00
Amitoj Kaur Chawla 5850c251fa staging: wlan-ng: Remove unnecessary macro
Remove unnecessary macro SUBMIT_URB by replacing it with a direct call
to usb_submit_urb()

This change was made with the help of the following Coccinelle semantic
patch:

//<smpl>
@@
identifier f,g;
@@
* #define f(...) g(...)
// </smpl>

Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-11 22:09:09 -08:00
Eva Rachel Retuya bbbdc23e30 staging: gs_fpgaboot: drop wrapper function 'finish_driver'
Remove the function 'finish_driver' since a direct call to
platform_device_unregister() is intuitive enough to signify the original
intention of the function being removed. Coccinelle semantic patch used to
detect this:

@@
identifier wrapper, func;
type T;
@@

*T wrapper(...)
{
(
	return func(...);
|
	func(...);
)
}

Signed-off-by: Eva Rachel Retuya <eraretuya@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-11 22:09:09 -08:00
Sudip Mukherjee 18f038e6bf staging: dgnc: cleanup properly
dgnc_cleanup_module() was called when the module unloaded to do a total
cleanup and it was also called if pci_register_driver() fails. But
dgnc_cleanup_module() will try dgnc_remove_driver_sysfiles() but the
sysfiles will be created only if pci_register_driver() succeeds.
So if pci_register_driver() fails and we try dgnc_cleanup_module() then we
were getting:

[  942.001479] BUG: unable to handle kernel NULL pointer dereference at 00000018
[  942.001482] IP: [<c122c7a8>] sysfs_remove_file_ns+0x8/0x20

with part of the call trace as:

[  942.001544] Call Trace:
[  942.001555]  [<c149acc6>] driver_remove_file+0x16/0x20
[  942.001571]  [<f864a708>] dgnc_remove_driver_sysfiles+0x18/0x40 [dgnc]
[  942.001575]  [<f8643ac7>] dgnc_cleanup_module+0x47/0x260 [dgnc]
[  942.001577]  [<f86cb000>] ? 0xf86cb000
[  942.001580]  [<f86cb1e6>] dgnc_init_module+0x1e6/0x1000 [dgnc]

Lets have a separate cleanup function which will execute
dgnc_remove_driver_sysfiles() depending on the argument passed to it.

Reported-by: Navy Cheng <navych@126.com>
Signed-off-by: Sudip Mukherjee <sudip.mukherjee@codethink.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-11 22:09:09 -08:00
Sudip Mukherjee b3ca2e08e7 staging: dgnc: unregister pci driver
We may choose to load the module without the hardware present. That will
register the pci driver but since probe will not succeed so
dgnc_NumBoards will be 0. Now if we unload the module then the pci
driver stays registered as dgnc_NumBoards is 0. And if we try to load
the module again it fails with the error:
"Driver 'dgnc' is already registered."

Signed-off-by: Sudip Mukherjee <sudip.mukherjee@codethink.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-11 22:09:09 -08:00
Sudip Mukherjee e9961fc16f staging: dgnc: remove pci_unregister_driver
If pci_register_driver() fails then dgnc_NumBoards can never be more
than zero. dgnc_NumBoards is incremented only at the end of a successful
probe. And moreover if the pci driver has failed to register then we
never need to unregister it. Lets just print the warning, perform the
cleanup and exit with the error code.

Signed-off-by: Sudip Mukherjee <sudip.mukherjee@codethink.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-11 22:09:09 -08:00
Sudip Mukherjee 757b816e40 staging: dgnc: remove unneeded else
If pci_enable_device() fails then we can return directly.

Signed-off-by: Sudip Mukherjee <sudip.mukherjee@codethink.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-11 22:09:09 -08:00
Rehas Sachdeva 8d0d4cc5a4 staging: dgnc: Break line after boolean operator
The preferred way to break up long math lines is to break after an arthimetic
or boolean operator. This patch fixes the checkpatch.pl warning:
Logical continuations should be on the previous line.

Signed-off-by: Rehas Sachdeva <aquannie@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-11 22:09:09 -08:00
Rehas Sachdeva 8e8d27f7d5 staging: dgnc: Fix block comment style
This patch fixes the block comment style.
1. The checkpatch.pl warning:
Block comments use a trailing */ on a separate line.
2. '====' separator is unnecessary and should not be used.

Signed-off-by: Rehas Sachdeva <aquannie@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-11 22:09:09 -08:00
Rehas Sachdeva 05b30f4999 staging: dgnc: Avoid multiple blank lines
This patch fixes the checkpatch.pl warnings regarding multiple blank
lines as single blank line is the preferred coding style.

Signed-off-by: Rehas Sachdeva <aquannie@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-11 22:09:09 -08:00
Rehas Sachdeva adcb56f92e staging: dgnc: Add spaces around '|' and '<<'
One space on either side of binary and ternary operators is preferred.
This patch fixes the related checkpatch.pl warnings.

Signed-off-by: Rehas Sachdeva <aquannie@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-11 22:09:09 -08:00
Eva Rachel Retuya 0b7ceaa665 staging: dgnc: delete parentheses around right hand side of assignment
Eliminate unneeded parentheses around the right hand side of an
assignment. Coccinelle semantic patch used:
@@
expression e1, e2;
identifier v;
@@

(
 v = (e1 == e2)
|
 v = (e1 != e2)
|
 v = (e1 <= e2)
|
 v = (e1 >= e2)
|
 v =
- (
	e1
- )
)

Signed-off-by: Eva Rachel Retuya <eraretuya@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-11 22:09:09 -08:00
Amitoj Kaur Chawla 0c56665923 staging: vme: devices: Replace kzalloc with devm_kzalloc
Devm_ functions allocate memory that is released when a driver
detaches. Replace kzalloc with devm_kzalloc and remove corresponding
kfrees from probe and remove functions of a platform
device.

Also, unnecessary labels have been removed.

Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-11 22:09:09 -08:00
Janani Ravichandran 5084d7c662 staging: fbtft: fb_uc1611.c: Drop void pointer cast
Void pointers need not be cast to other pointer types.
Semantic patch used:

@r@
expression x;
void* e;
type T;
identifier f;
@@

(
  *((T *)e)
|
  ((T *)x) [...]
|
  ((T *)x)->f
|
- (T *)
  e
)

Signed-off-by: Janani Ravichandran <janani.rvchndrn@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-11 22:09:09 -08:00
Janani Ravichandran 264cd1d1c2 staging: fbtft: fb_ra8875.c: Remove unneeded void pointer cast
Void pointers need not be cast to other pointer types.
Semantic patch used:

@r@
expression x;
void* e;
type T;
identifier f;
@@

(
  *((T *)e)
|
  ((T *)x) [...]
|
  ((T *)x)->f
|
- (T *)
  e
)

Signed-off-by: Janani Ravichandran <janani.rvchndrn@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-11 22:09:09 -08:00
Janani Ravichandran 64f93e1724 staging: fbtft: fbtft-bus.c: Drop unneeded void pointer cast
Remove unneeded cast on the void pointer par->txbuf.buf .
Semantic patch used:

@r@
expression x;
void* e;
type T;
identifier f;
@@

(
  *((T *)e)
|
  ((T *)x) [...]
|
  ((T *)x)->f
|
- (T *)
  e
)

Signed-off-by: Janani Ravichandran <janani.rvchndrn@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-11 22:09:09 -08:00
Amitoj Kaur Chawla 0c9ab986e2 staging: fbtft: Use devm_kcalloc instead of devm_kzalloc
Replace devm_kzalloc with devm_kcalloc to ensure there are no integer
overflows from the multiplication of a number * sizeof

The following Coccinelle semantic patch was used to make this change:
//<smpl>
@@
expression dev,E1,E2,E3,E4;
@@

- devm_kzalloc(dev,E1*E2*sizeof(E3),E4)
+ devm_kcalloc(dev,E1*E2,sizeof(E3),E4)
//</smpl>

Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-11 22:09:09 -08:00
Amitoj Kaur Chawla 71e03f1038 staging: fbtft: Remove unnecessary spi_set_drvdata()
Unnecessary spi_set_drvdata() has been removed since the driver
core clears the driver data to NULL after device release or on
probe failure. There is no need to manually clear the device
driver data to NULL.

The Coccinelle semantic patch used to make this change is as follows:
@@
struct spi_device *spi;
@@
- spi_set_drvdata(spi, NULL);
// </smpl>

Due to this removal, variable `spi` was unused so dropped `spi`

Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-11 22:09:09 -08:00
Alison Schofield 3589d3c9e3 staging: fbtft: replace ternary operator with min macro
Use macro min() to get the minimum of two values for
brevity and readability.

Found using Coccinelle:
@@ type T; T x; T y; @@
(
- x < y ? x : y
+ min(x,y)
|
- x > y ? x : y
+ max(x,y)
)

Signed-off-by: Alison Schofield <amsfield22@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-11 22:09:09 -08:00
Bhaktipriya Shridhar 7ce1b3d3ca staging: fbtft: Use kmalloc_array
Use kmalloc_array instead of kmalloc for arrays to prevent integer
overflows.
This was done using Coccinelle:

@@
expression e1, e2;
constant C;
type t;
@@
(
- kmalloc(
+ kmalloc_array(
e2
- *
+ ,
sizeof(e1), C)
|
- kmalloc(
+ kmalloc_array(
e1
- *
+ ,
sizeof(t), C)
|
- kmalloc(
+ kmalloc_array(
- sizeof(e1)
- *
e2
+ ,
+ sizeof(e1)
, C)
|
- kmalloc(
+ kmalloc_array(
- sizeof(t)
- *
e1
+ ,
+ sizeof(t)
, C)
)

Signed-off-by: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-11 22:09:09 -08:00
Ben Marsh 0df8f51eed Staging: nvec: removes an unnecessary cast on a void pointer
Patch to nvec_ps2.c to remove an unnecessary cast on a void pointer.

Signed-off-by: Ben Marsh <bmarsh94@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-11 22:09:09 -08:00
Janani Ravichandran 60d0ed1c42 staging: nvec: nvec.c: Drop void pointer cast
Void pointers need not be cast to other pointer types.
Semantic patch used:

@r@
expression x;
void *e;
type T;
identifier f;
@@

(
  *((T *)e)
|
  ((T *)x) [...]
|
  ((T *)x)->f
|
- (T *)
  e
)

Signed-off-by: Janani Ravichandran <janani.rvchndrn@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-11 22:09:09 -08:00
Laura Garcia Liebana 350698f6ef staging: nvec: Avoid the use of BUG_ON
Prevent a kernel panic by avoiding the use of the BUG_ON macro.
Checkpatch detected this issue.

The BUG_ON macro is not needed as such cases shouldn't happen and they
were introduced for debugging purposes.

Signed-off-by: Laura Garcia Liebana <nevola@gmail.com>
Acked-by: Marc Dietrich <marvin24@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-11 22:09:09 -08:00
Laura Garcia Liebana aaa657312a staging: nvec: Remove blank lines before a close brace
Blank lines aren't necessary before a close brace '}'. Checkpatch
detected this issue.

Signed-off-by: Laura Garcia Liebana <nevola@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-11 22:09:09 -08:00
Bhumika Goyal 78a729ff16 Staging: rtl8188eu: Remove function rtw_freq2ch
Remove function rtw_freq2ch as it is never used anywhere in the kernel.
Also, remove the function prototype.

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-11 22:09:09 -08:00
Claudiu Beznea eb8329c6b3 Staging: rtl8188eu: removed unnecessary check in core/rtw_ap.c
This patch removes unnecessary "if (true)" check in update_BCNTIM()
from core/rtw_ap.c file. After this remove the code alignment was
necessary.

Signed-off-by: Claudiu Beznea <claudiu.beznea@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-11 22:09:09 -08:00
Bhaktipriya Shridhar 61a95c8d71 staging: rtl8188eu: os_dep: Remove unnecessary else after return
This patch fixes the checkpatch warning that else is not generally
useful after a break or return.

This was done using Coccinelle:
@@
expression e2;
statement s1;
@@
if(e2) { ... return ...; }
-else
         s1

Signed-off-by: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-11 22:09:09 -08:00
Sandhya Bankar e59b76cfca Staging: rtl8188eu: Use !x instead of x==NULL.
Use !x instead of x==NULL.

Signed-off-by: Sandhya Bankar <bankarsandhya512@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-11 22:09:09 -08:00
Sandhya Bankar b08e0fc0d4 Staging: rtl8188eu: rtw_efuse: Do not print message if kzalloc() failed.
Do not print message if kzalloc() failed.
kzalloc() has its own messages. So no need to add extra one.

Signed-off-by: Sandhya Bankar <bankarsandhya512@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-11 22:09:09 -08:00
Sandhya Bankar d4ff4e2967 Staging: rtl8188eu: Do not print message if kzalloc() failed.
Do not print message if kzalloc() failed.
kzalloc() has its own messages. So no need to add extra one.

Signed-off-by: Sandhya Bankar <bankarsandhya512@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-11 22:09:09 -08:00
Kyle Kuffermann 7a1586353b rtl8188eu: Add spaces around arithmetic operators
This fixes the checkpatch.pl issue: CHECK: spaces preferred around that '+'

Signed-off-by: Kyle Kuffermann <kyle.kuffermann@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-11 22:09:09 -08:00
Ivan Safonov 0f94b0afcd staging: rtl8188eu: remove PWR_BASEADDR_* macro definitions and "base" member of wl_pwr_cfg structure
These macros and "base" member of wl_pwr_cfg structure
are used only to produce debug output.

Signed-off-by: Ivan Safonov <insafonov@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-11 22:09:09 -08:00
Ivan Safonov 0e54dbd4c7 staging: rtl8188eu: remove PWR_INTF_*_MSK macro definitions and interface_mask of wl_pwr_cfg structure
This driver is intended only for usb devices.

Signed-off-by: Ivan Safonov <insafonov@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-11 22:09:09 -08:00
Ivan Safonov 3f1599e886 staging: rtl8188eu: remove PWR_FAB_*_MSK macro definitions and fab_msk of wl_pwr_cfg structure
fab_msk used for marking commands
for devices of a certain manufacturer.

However, always used only PWR_FAB_ALL_MSK value of fab_msk.

Most likely, such mark is useless.

Signed-off-by: Ivan Safonov <insafonov@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-11 22:09:09 -08:00
Ivan Safonov fd50e119e6 staging: rtl8188eu: remove FabVersion member of odm_dm_struct struct
Value of this variable is hardcoded
and used only to produce debug output.
Probably, FabVersion is useless.

Signed-off-by: Ivan Safonov <insafonov@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-11 22:09:09 -08:00
Ivan Safonov 29b9e16884 staging: rtl8188eu: remove chip_type of the adapter structure
chip_type variable is unnecessary here,
because this driver is only for one chip
and it is not used after initialization.

Signed-off-by: Ivan Safonov <insafonov@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-11 22:09:09 -08:00
Ivan Safonov 2e48f0df5c staging: rtl8188eu: replace (a == NULL) to (!a) in rtw_drv_init
It is a checkpatch cleanups:
CHECK: Comparasion to NULL could be written ...

Signed-off-by: Ivan Safonov <insafonov@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-11 22:09:09 -08:00
Ivan Safonov 43e02454d7 staging: rtl8188eu: remove unnecessary debug output from os_dep/usb_intf.c
Debug output in rtw_drw_init is excess

Signed-off-by: Ivan Safonov <insafonov@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-11 22:09:09 -08:00
Ivan Safonov 02295b7f24 staging: rtl8188eu: remove unused macros from include/basic_types.h
FIELD_OFFSET, READEF1BYTE, READEF2BYTE, READEF4BYTE
WRITEEF1BYTE, WRITEEF2BYTE, WRITEEF4BYTE are removed.

Signed-off-by: Ivan Safonov <insafonov@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-11 22:09:09 -08:00
Ivan Safonov e2d5d10dea staging: rtl8188eu: remove unused include/ieee80211_ext.h
This file is not used for the driver compiling

Signed-off-by: Ivan Safonov <insafonov@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-11 22:09:09 -08:00
Ivan Safonov 5e3027b653 staging: rtl8188eu: FIELD_OFFSET macro replaced by offsetof macro
FIELD_OFFSET and offsetof macro are equal

Signed-off-by: Ivan Safonov <insafonov@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-11 22:09:09 -08:00
Bhaktipriya Shridhar 2c10efbd07 staging: rtl8188eu: os_dep: Remove NULL test before vfree
vfree frees the virtually continuous memory area starting at addr.
If addr is NULL, no operation is performed. So NULL test is not needed
before vfree.

This was done using Coccinelle:

@@
expression x;
@@
-if (x != NULL)
    vfree(x);

@@
expression x;
@@

-if (x != NULL) {
vfree(x);
x = NULL;
-}

Signed-off-by: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-11 22:09:09 -08:00
Bhaktipriya Shridhar 7570ad9104 staging: rtl8188eu: core: Remove NULL test before vfree
vfree frees the virtually continuous memory area starting at addr.
If addr is NULL, no operation is performed. So NULL test is not needed
before vfree.

This was done using Coccinelle:

@@
expression x;
@@
-if (x != NULL)
    vfree(x);

@@
expression x;
@@

-if (x != NULL) {
vfree(x);
x = NULL;
-}

Signed-off-by: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-11 22:09:09 -08:00
Bhaktipriya Shridhar 235a010362 staging: rtl8188eu: core: Remove useless return variables
This patch removes unnecessary return variables and compresses the
return logic.
The coccinelle script that finds and fixes this issue is:

@@ type T; identifier i,f; constant C; @@
- T i;
...when != i
when strict
( return -C;
|
- i =
+ return
f(...);
- return i;
)

Signed-off-by: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-11 22:09:09 -08:00
Bhaktipriya Shridhar 92098c1f0b staging: rtl8188eu: os_dep: Remove useless return variables
This patch removes unnecessary return variables and compresses the
return logic.
The coccinelle script that finds and fixes this issue is:
@@ type T; identifier i,f; constant C; @@
- T i;
...when != i
when strict
( return -C;
|
- i =
+ return
f(...);
- return i;
)

Signed-off-by: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-11 22:09:09 -08:00
Bhaktipriya Shridhar bd37c43c8d staging: rtl8188eu: core: Remove casts of pointer to same type
Casting a pointer to a pointer of the same type is unnecessary, so remove
these unnecessary casts.

This was done with Coccinelle:

@@
type T;
T *ptr;
@@
- (T *)ptr
+ ptr

Signed-off-by: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-11 22:09:09 -08:00
Bhaktipriya Shridhar 3edd192bb8 staging: rtl8188eu: hal: Drop Useless Initialization
Removed initialisation of a varible if it is immediately reassigned.
Changes were made using Coccinelle.
@bad@
identifier i;
position p;
@@

i =@p <+...i...+>;

@@
type T;
constant C;
expression e;
identifier i;
position p != bad.p;
@@
T i
- = C
;
i =@p e;

Signed-off-by: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-11 22:09:09 -08:00
Bhaktipriya Shridhar 47b67704a1 staging: rtl8188eu: Remove unnecessary parantheses
Removed parantheses on the right hand side of assignments as they are
not needed.

This was done with Coccinelle:

@@ expression a, b; @@

a =
- (
b
- )
;

Signed-off-by: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-11 22:09:09 -08:00
Bhumika Goyal ce7e581e6b Staging: sm750fb: Remove unused functions
The functions dviGetDeviceID and dviGetVendorID are not used anywhere in
the kernel so remove them. Also, remove their function prototypes.
Grepped to find occurences.

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-11 22:09:09 -08:00
Sandhya Bankar 69988ba2c5 Staging: sm750fb: Remove leading and trailing whitespace.
Remove leading and trailing whitespace.

Signed-off-by: Sandhya Bankar <bankarsandhya512@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-11 22:09:09 -08:00
Eva Rachel Retuya 6504b9bdf6 staging: sm750fb: convert pr_err() to dev_err()
Replace pr_err() calls with respective dev_err() counterpart.
Change is safe since pdev is not NULL, this was identified by hand.
Semantic patch used to detect and apply the transformation:

@r exists@
identifier f,s,i;
position p;
@@

f(...,struct s *i,...) {
  <+...
  pr_err@p(...)
  ...+>
}

@s@
identifier r.s, dev;
@@

struct s {
	...
	struct device dev;
	...
};

@t@
identifier r.i, s.dev;
expression fmt;
position r.p;
@@

- pr_err@p(
+ dev_err(&i->dev,
			fmt, ...);

Signed-off-by: Eva Rachel Retuya <eraretuya@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-11 22:09:09 -08:00
Bhaktipriya Shridhar fcf59a7c61 staging: sm750fb: Remove Unused macro
The macro PEEK32 is used nowhere in the file. Hence,removed.

Signed-off-by: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-11 22:09:09 -08:00
Amitoj Kaur Chawla 13b79a0d88 staging: sm750fb: Use pcim_enable_device()
Devm_ functions allocate memory that is released when a driver
detaches.
Replace pci_enable_device with the managed pcim_enable_device
and remove corresponding pci_disable_device from probe and
suspend functions of a pci_dev.

Also, an unnecessary label has been removed by replacing it
with a direct return statement.

Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-11 22:09:09 -08:00
Amitoj Kaur Chawla 677c507211 staging: sm750fb: Replace kzalloc with devm_kzalloc
Devm_ functions allocate memory that is released when a driver
detaches.
Replace kzalloc with devm_kzalloc and remove corresponding
kfrees from probe and remove functions of a pci_dev.

Also, an unnecessary label has been removed by replacing it
with a direct return statement.

Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-11 22:09:09 -08:00
Amitoj Kaur Chawla fad2564eaa staging: sm750fb: Remove unnecessary pci_set_drvdata()
Unnecessary pci_set_drvdata() has been removed since the driver
core clears the driver data to NULL after device release or on
probe failure. There is no need to manually clear the device
driver data to NULL.

The Coccinelle semantic patch used to make this change is as follows:
//<smpl>
@@
struct pci_dev *pci;
@@
- pci_set_drvdata(pci, NULL);
//</smpl>

Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-11 22:09:09 -08:00
Amitoj Kaur Chawla 732053a0a0 staging: sm750fb: Remove parentheses from return arguments
Remove unnecessary parentheses from return arguments.

The Coccinelle semantic patch that makes this change is as follows:

// <smpl>
@@
identifier i;
constant c;
@@

return
- (
    \(i\|-i\|i(...)\|c\)
- )
  ;
// </smpl>

Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-11 22:09:09 -08:00
Amitoj Kaur Chawla 720f7a7850 staging: most: hdm-usb: Remove invalid reference error
commit e3479f77("staging: most: hdm-usb: Remove create_workqueue()")
cancel_work_sync(&anchor->clear_work_obj) is introduced after freeing
`anchor` causing a invalid reference error. This patch removes this
error by shifting the call to cancel_work_sync before freeing
`anchor`.

Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-11 22:09:09 -08:00
Bhaktipriya Shridhar e6e1d57e08 staging: rts5208: Change form of NULL comparisons
Change null comparisons of the form x == NULL to !x.
This was done using Coccinelle.

@@
expression e;
@@
- e == NULL
+ !e

Signed-off-by: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-11 22:09:09 -08:00
Bhaktipriya Shridhar b242d05fa3 staging: rts5208: Remove NULL test before vfree
vfree frees the virtually continuous memory area starting at addr.
If addr is NULL, no operation is performed. So NULL test is not needed
before vfree.

This was done using Coccinelle:

@@
expression x;
@@
-if (x != NULL)
    vfree(x);

@@
expression x;
@@

-if (x != NULL) {
vfree(x);
x = NULL;
-}

Signed-off-by: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-11 22:09:09 -08:00
Eva Rachel Retuya 7586170c84 staging: rts5208: simplify NULL tests
Replace direct comparisons to NULL i.e. 'x == NULL' with '!x' for
consistency. Coccinelle semantic patch used:

@@
identifier func;
expression x;
statement Z;
@@

x = func(...);

if (
(
+	!
	x
-	== NULL
|
+	!
-	NULL ==
	x
)
   ) Z

Signed-off-by: Eva Rachel Retuya <eraretuya@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-11 22:09:09 -08:00
Bhumika Goyal eff8bf8243 Staging: rts5208: Use min instead of ternary operator
This patch replaces ternary operator with macro min as it shorter and
thus increases code readability. Macro min returns the minimum of the
two compared values.
Made a semantic patch for changes:

@@
type T;
T x;
T y;
@@
(
- x < y ? x : y
+ min(x,y)
|
- x > y ? x : y
+ max(x,y)
)

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-11 22:09:09 -08:00
Janani Ravichandran 51a4731133 staging: rts5208: rtsx_transport.c: Drop void pointer cast
Void pointers need not be cast to other pointer types.
Semantic patch used:

@r@
expression x;
void *e;
type T;
identifier f;
@@

(
  *((T *)e)
|
  ((T *)x) [...]
|
  ((T *)x)->f
|
- (T *)
  e
)

Signed-off-by: Janani Ravichandran <janani.rvchndrn@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-11 22:09:09 -08:00
Janani Ravichandran 86790d33da staging: rts5208: rtsx.c: Drop unneeded void pointer cast
Void pointers need not be cast to other pointer types.
Semantic patch used:

@r@
expression x;
void *e;
type T;
identifier f;
@@

(
  *((T *)e)
|
  ((T *)x) [...]
|
  ((T *)x)->f
|
- (T *)
  e
)

Signed-off-by: Janani Ravichandran <janani.rvchndrn@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-11 22:09:09 -08:00
Amitoj Kaur Chawla b7a22f8d0a staging: rts5208: Remove unnecessary pci_set_drvdata()
Unnecessary pci_set_drvdata() has been removed since the driver
core clears the driver data to NULL after device release or on
probe failure. There is no need to manually clear the device
driver data to NULL.

The Coccinelle semantic patch used to make this change is as follows:
//<smpl>
@@
struct pci_dev *pci;
@@
- pci_set_drvdata(pci, NULL);
//</smpl>

Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-11 22:09:09 -08:00
Dilek Uzulmez d1af6476e6 Staging: rts5208: Remove unnecessary parentheses
Problem found using checkpatch.pl
CHECK: Unnecessary parentheses around chip->ms_card

Signed-off-by: Dilek Uzulmez <dilekuzulmez@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-11 22:09:09 -08:00
Bhaktipriya Shridhar 040fa2217c staging: rts5208: Prefer using BIT macro
Replace all instances of bit shifting on 1 with the BIT(x) macro.
This was done using Coccinelle.

@@ int c; @@
- (1 << c)
+ BIT(c)

Signed-off-by: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-11 22:09:09 -08:00
Bhaktipriya Shridhar fdb78b64a7 staging: rts5208: Removed unnecessary return variable
This patch removes unnecessary return variables in switch statements.
This was done with Coccinelle:

@@ local idexpression ret; expression e1,e2; identifier label;
@@
switch ( ... ) {
case label : ...
- ret = e1;
- break;
+ return e1;
... default: ...
- ret = e2;
+ return e2;
... }
... when != ret
- return ret;
@@ type T; identifier x; @@
- T x;
... when != x

Signed-off-by: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-11 22:09:09 -08:00
Bhaktipriya Shridhar 22d2666b7c staging: media: davinci_vpfe: Remove unnecessary else after return
This patch fixes the checkpatch warning that else is not generally
useful after a break or return.

This was done using Coccinelle:
@@
expression e2;
statement s1;
@@
if(e2) { ... return ...; }
-else
         s1

Signed-off-by: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-11 22:09:09 -08:00
Bhaktipriya Shridhar fec6925030 staging: media: davinci_vpfe: dm365_ipipe_hw: Remove unnecessary else after return
This patch fixes the checkpatch warning that else is not generally
useful after a break or return.

This was done using Coccinelle:
@@
expression e2;
statement s1;
@@
if(e2) { ... return ...; }
-else
         s1

Signed-off-by: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-11 22:09:09 -08:00
Sandhya Bankar 58f31812b0 Staging: media: Remove unnecessary goto.
Remove unnecessary goto.

Signed-off-by: Sandhya Bankar <bankarsandhya512@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-11 22:09:09 -08:00
Eva Rachel Retuya 4a1e81bc5d staging: [media] mn88472: simplify NULL tests
Replace direct comparisons to NULL i.e. 'x == NULL' with '!x' for
consistency. Coccinelle semantic patch used:

@@
identifier func;
expression x;
statement Z;
@@

x = func(...);

if (
(
+	!
	x
-	== NULL
|
+	!
-	NULL ==
	x
)
   ) Z

Signed-off-by: Eva Rachel Retuya <eraretuya@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-11 22:09:09 -08:00
Amitoj Kaur Chawla 3b7a3dac92 staging: media: omap4iss: Remove unnecessary platform_set_drvdata()
Unnecessary platform_set_drvdata() has been removed since the driver
core clears the driver data to NULL after device release or on
probe failure. There is no need to manually clear the device
driver data to NULL.

The Coccinelle semantic patch used to make this change is as follows:
//<smpl>
@@
struct platform_device *pdev;
@@
- platform_set_drvdata(pdev, NULL);
//</smpl>

Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-11 22:09:09 -08:00
Bhumika Goyal 0df56d78d2 Staging: rtl8712: Remove function r8712_setptm_cmd and r8712_gettssi_cmd
The function r8712_setptm_cmd and r8712_gettssi_cmd are not used
anywhere in the kernel so remove them. Also, remove their function
prototypes.

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-11 22:09:09 -08:00
Bhaktipriya Shridhar 336e8320e9 staging: rtl8712: Remove unnecessary else after return
This patch fixes the checkpatch warning that else is not generally
useful after a break or return.

This was done using Coccinelle:
@@
expression e2;
statement s1;
@@
if(e2) { ... return ...; }
-else
         s1

Signed-off-by: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-11 22:09:09 -08:00
Sandhya Bankar 8558ace8b7 Staging: rtl8712: Avoid multiple assignments.
Avoid multiple assignments.This isssue is found by checkpatch.pl script.

Signed-off-by: Sandhya Bankar <bankarsandhya512@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-11 22:09:09 -08:00
G Pooja Shamili 1d1b7e87a3 staging: rtl8712: Remove the unnecessary parantheses
The unnecessary parantheses on the right side of assignments were removed,
as in most cases (expect for ==, >=, <=, !=), they are futile.

This was done using Coccinelle, the semantic patch being:

@@
expression E1,E2,E3;
binary operator bin_op = {==,>=,<=,!=};
@@

E1 =
(
  (
   E2 bin_op E3
  )
|
-(
E2
-)
)
;

Signed-off-by: G Pooja Shamili <poojashamili@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-11 22:09:09 -08:00
Amitoj Kaur Chawla bce2fc58b7 staging: rtl8712: rtl871x_mp_ioctl: Remove exceptional & on function name
In this file, function names are otherwise used as pointers without
&.

The Coccinelle semantic patch that is used to make this change is as
follows:

// <smpl>
@r@
identifier f;
@@
f(...) { ... }
@@
identifier r.f;
@@
- &f
+ f
@m@
type T;
identifier f;
@@
T f(...);
@@
identifier m.f;
@@
- &f
+ f
// </smpl>

Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-11 22:09:09 -08:00
Bhaktipriya Shridhar 6806be3184 drivers: staging: rtl8712: Change form of NULL comparisons
Change null comparisons of the form x == NULL to !x.
This was done using Coccinelle.

@@
expression e;
@@
- e == NULL
+ !e

Signed-off-by: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-11 22:09:09 -08:00
Bhaktipriya Shridhar 40430f0ce2 staging: rtl8712: Make return of 0 explicit
Delete unnecessary local variable whose value is always 0 and
return 0 as the result.

The following Coccinelle script was used:

@@
identifier ret; expression E;
type T;
@@
(
- T ret;
|
- T ret = 0;
)

... when != \(ret=E
\|ret--\|ret++\|--ret\|++ret\|ret-=E\|ret+=E\|ret|=E\|ret&=E\)
(
?-ret = 0;
)
... when != \(ret=E
\|ret--\|ret++\|--ret\|++ret\|ret-=E\|ret+=E\|ret|=E\|ret&=E\)
(
return
- ret
+ 0
;
)

Signed-off-by: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-11 22:09:09 -08:00
Bhumika Goyal 9155c92463 Staging: rtl8712: Clean up tests if NULL returned on failure
Some functions like kmalloc/usb_alloc_urb/kmalloc_array returns NULL as
their return value on failure. !x is generally preferred over x==NULL
or NULL==x so make use of !x if the value returned on failure
by these functions is NULL.
Done using coccinelle:

@@
expression e;
statement S;
@@
e = \(kmalloc\|devm_kzalloc\|kmalloc_array
     \|devm_ioremap\|usb_alloc_urb\|alloc_netdev\)(...);
- if(e==NULL)
+ if(!e)
  S

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-11 22:09:09 -08:00
Bhaktipriya Shridhar bb106dc0e2 staging: rtl8712: Remove unnecessary parantheses
Removed parantheses on the right hand side of assignments as they are
not needed.

This was done with Coccinelle:

@@ expression a, b; @@

a =
- (
b
- )
;

Signed-off-by: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-11 22:09:09 -08:00
Bhaktipriya Shridhar 6e4eb86913 staging: rtl8712: Simplify return
Simplified the multiline check to a single return statement.

Signed-off-by: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>
Acked-by: Daniel Baluta <daniel.baluta@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-11 22:09:09 -08:00
Amitoj Kaur Chawla ecf2e02cd4 staging: rtl8712: Remove exceptional & on function name
Remove exceptional '&' operator in front of a function name.

The Coccinelle semantic patch that is used to make this change is as
follows:

// <smpl>
@r@
identifier f;
@@
f(...) { ... }
@@
identifier r.f;
@@
- &f
+ f
@m@
type T;
identifier f;
@@
T f(...);
@@
identifier m.f;
@@
- &f
+ f
// </smpl>

Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-11 22:09:09 -08:00
Bhaktipriya Shridhar fe5e5e3a16 staging: rtl8712: Remove unnecessary cast on void pointer
The following Coccinelle script was used to detect this:
@r@
expression x;
void* e;
type T;
identifier f;
@@
(
  *((T *)e)
|
  ((T *)x)[...]
|
  ((T*)x)->f
|
- (T*)
  e
)

Signed-off-by: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-11 22:09:09 -08:00
Bhaktipriya Shridhar 56238e456c staging: rtl8712: Remove cast on void pointer
The following Coccinelle script was used to detect this:
@r@
expression x;
void* e;
type T;
identifier f;
@@
(
  *((T *)e)
|
  ((T *)x)[...]
|
  ((T *)x)->f
|
- (T *)
  e
)

Signed-off-by: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-11 22:09:09 -08:00
Eva Rachel Retuya 1f4e270652 staging: ste_rmi4: simplify NULL tests
Replace direct comparisons to NULL i.e. 'x == NULL' with '!x' for
consistency. Coccinelle semantic patch used:

@@
identifier func;
expression x;
statement Z;
@@

x = func(...);

if (
(
+	!
	x
-	== NULL
|
+	!
-	NULL ==
	x
)
   ) Z

Signed-off-by: Eva Rachel Retuya <eraretuya@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-11 22:09:09 -08:00
Dilek Uzulmez eea04b072d Staging: ste_rmi4: Add space around '/'
Add space around operator '/'. Problem found using checkpatch.pl
CHECK: spaces preferred around that '/' (ctx:VxV)

Signed-off-by: Dilek Uzulmez <dilekuzulmez@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-11 22:09:09 -08:00
Laura Garcia Liebana 32680d9319 staging: octeon: Fix braces in condition statement
Braces should be used on all arms of the if statement. Checkpatch
detected this issue.

Signed-off-by: Laura Garcia Liebana <nevola@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-11 22:09:09 -08:00
Laura Garcia Liebana 3f4a565a91 staging: octeon: Remove multiple blank lines
Avoid the use of multiple blank lines. Checkpatch detected these issues.

Signed-off-by: Laura Garcia Liebana <nevola@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-11 22:09:09 -08:00
Laura Garcia Liebana 18f6970b63 staging: octeon: Fix lines over 80 characters
The lines should be adjusted to 80 characters. Checkpatch detected these
issues.

Signed-off-by: Laura Garcia Liebana <nevola@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-11 22:09:09 -08:00
Laura Garcia Liebana 7ba18e852d staging: octeon: Remove blank lines after open brace
Blank lines are not necessary after an open brace. Checkpatch detected
these issues.

Signed-off-by: Laura Garcia Liebana <nevola@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-11 22:09:09 -08:00
Laura Garcia Liebana b4ede7922e staging: octeon: Fix block comments
Remove commented source code. Checkpatch detected these issues.

Signed-off-by: Laura Garcia Liebana <nevola@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-11 22:09:09 -08:00
Laura Garcia Liebana e8a4e572c4 staging: octeon: Remove comparison to NULL
Comparison to NULL should be avoided in conditions. Chackpatch detected
these issues.

Signed-off-by: Laura Garcia Liebana <nevola@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-11 22:09:09 -08:00
Laura Garcia Liebana 0e350e17b9 staging: octeon: Insert blank line after struct declaration
Blank line is inserted after a struct declaration. Checkpatch detected
these issues.

Signed-off-by: Laura Garcia Liebana <nevola@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-11 22:09:09 -08:00
Laura Garcia Liebana 7636941eb3 staging: octeon: Move logical operators on the correct line
Logical continuations should be on the previous line. Checkpatch detected this issue.

Signed-off-by: Laura Garcia Liebana <nevola@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-11 22:09:09 -08:00
Bhaktipriya Shridhar 6fe5efa141 staging: octeon: Convert create_singlethread_workqueue()
With conccurency managed workqueues, use of dedicated workqueues can
be replaced by system_wq. Drop cvm_oct_poll_queue by using system_wq.

There are multiple work items per cvm_oct_poll_queue (viz.
cvm_oct_rx_refill_work, port_periodic_work) and different
cvm_oct_poll_queues need not be be ordered. Hence, concurrency
can be increased by switching to system_wq.

All work items are sync canceled in cvm_oct_remove() so it
is guaranteed that no work is in flight by the time exit path runs.

Signed-off-by: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>
Acked-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-11 22:09:09 -08:00
Ben Marsh 2d5f6feca9 Staging: slicoss: changes comparisons to NULL in slicoss.c
This is a patch to slicoss.c to change the style of NULL comparisons in
order to remove checkpatch.pl warnings.

Signed-off-by: Ben Marsh <bmarsh94@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-11 22:09:09 -08:00
Ben Marsh 98589c419d Staging: slicoss: removes unnecessary blank lines in slicoss.c
This is a patch to slicoss.c to remove unnecessary blank lines as found
by checkpatch.pl

Signed-off-by: Ben Marsh <bmarsh94@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-11 22:09:09 -08:00
Ben Marsh 82554c2ffb Staging: slicoss: change memory allocation style in slicoss.c
This is a patch to slicoss.c to change the memory allocation style in
slicoss.c as found by checkpatch.pl

Signed-off-by: Ben Marsh <bmarsh94@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-11 22:09:09 -08:00
Ben Marsh e4a34826d1 Staging: slicoss: changes the style of memory allocation in slicoss.c
This is a patch to slicoss.c to change the memory allocation style as
identified by checkpatch.pl

Signed-off-by: Ben Marsh <bmarsh94@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-11 22:09:09 -08:00
Ben Marsh 5d7a3876ca Staging: slicoss: changes memory allocation style in slicoss.c
This is a patch to slicoss.c that changes the memory allocation style as
identified by checkpatch.pl

Signed-off-by: Ben Marsh <bmarsh94@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-11 22:09:09 -08:00
Ben Marsh 4374849e1e Staging: slicoss: memory allocation style change in slicoss.c
This is a patch to slicoss.c to change the memory allocation style as
identified by checkpatch.pl

Signed-off-by: Ben Marsh <bmarsh94@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-11 22:09:09 -08:00
Janani Ravichandran 3e0a66d016 staging: slicoss: Eliminate commented out code
Remove commented out code to reduce code clutter.

Signed-off-by: Janani Ravichandran <janani.rvchndrn@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-11 22:09:09 -08:00
Bhaktipriya Shridhar db7425b130 staging: rtl8192u: ieee80211_crypt: Remove unnecessary else after return
This patch fixes the checkpatch warning that else is not generally
useful after a break or return.

This was done using Coccinelle:
@@
expression e2;
statement s1;
@@
if(e2) { ... return ...; }
-else
         s1

Signed-off-by: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-11 22:09:09 -08:00
Bhumika Goyal 0834ffac90 Staging: rtl8192u: Replace random_ether_addr with eth_random_addr
The macro random_ether_addr is calling the function eth_random_addr.
Therefore, the call to random_ether_addr can be replaced with
eth_random_addr.
Remove the wrapper function ieee80211_randomize_cell and replace its
call with eth_random_addr as it is wrapping random_ether_addr.
Done using coccinelle:

@@
expression addr;
@@
- random_ether_addr(addr);
+ eth_random_addr(addr);

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-11 22:09:09 -08:00
Bhumika Goyal f80c1d5763 Staging: rtl8192u: Replace memset with eth_broadcast_addr
Use eth_broadcast_addr to assign the broadcast address to the given
address array instead of memset when the second argument is a broacast
address 0xff. ETH_ALEN is a macro with value 6, so 6 is treated as
ETH_ALEN if it is the third argument of memset.

Done using coccinelle.
@@
expression e;
@@
- memset(e,\(0xff\|0xFF\|255\),\(ETH_ALEN\|6\));
+ eth_broadcast_addr(e);

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-11 22:09:09 -08:00
Bhaktipriya Shridhar 7288cadc19 staging: rtl8192u: ieee80211: Remove unused variables
The pointer *skb2 is declared 'globally' inside  ifdef NOT_YET.
It's used nowhere in the directory.
Another pointer *skb2 is declared 'locally', again inside another ifdef NOT_YET
in the function ieee80211_rx_frame_mgmt.
Hence, skb2 stays unused and has been removed.

This was done using Coccinelle:

@@ type T; identifier i; constant c; @@
-T i;
<... when != i
-i = c;
...>

Signed-off-by: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-11 22:09:09 -08:00
Bhumika Goyal 5a95f073b6 Staging: rtl8192u: Remove debug messages
As kmalloc generates a backtrace on failure so there is no need of
these debug messages when kmalloc fails. Also remove unwanted {} around if
block after removal of these messages.

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-11 22:09:09 -08:00
Bhumika Goyal 61645cc312 Staging: rtl8192u: Clean up tests if NULL returned on failure
Some functions return Null as their return value on failure. !x is
generally preferred over x==NULL or NULL==x. So make use of !x if
the value returned on failure is NULL.
Done using coccinelle:
@@
expression e;
statement S;
@@
e = \(kmalloc\|devm_kzalloc\|kmalloc_array
     \|devm_ioremap\|usb_alloc_urb\|alloc_netdev\)(...);
- if(e==NULL)
+ if(!e)
  S

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-11 22:09:09 -08:00
Bhaktipriya Shridhar f705a2dddd staging: rtl8192u: ieee802111: Drop Useless Initialization
Removed initialisation of a varible if it is immediately reassigned.
Changes were made using Coccinelle.
@bad@
identifier i;
position p;
@@

i =@p <+...i...+>;

@@
type T;
constant C;
expression e;
identifier i;
position p != bad.p;
@@
T i
- = C
;
i =@p e;

Signed-off-by: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-11 22:09:09 -08:00
Bhaktipriya Shridhar b1b20e7155 staging: rtl8192u: ieee80211: Use macro DIV_ROUND_UP
The macro DIV_ROUND_UP performs the computation
(((n) + (d) - 1) /(d)). It clarifies the divisor calculations.
This was done using the coccinelle script:
@@
expression e1;
expression e2;
@@
(
- ((e1) + e2 - 1) / (e2)
+ DIV_ROUND_UP(e1,e2)
|
- ((e1) + (e2 - 1)) / (e2)
+ DIV_ROUND_UP(e1,e2)
)

Signed-off-by: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-11 22:09:09 -08:00
Greg Hackmann 4532150762 staging: goldfish: audio: fix compiliation on arm
We do actually need slab.h, by luck we get it on other platforms but not
always on ARM. Include it properly.

Signed-off-by: Greg Hackmann <ghackmann@google.com>
Signed-off-by: Jin Qian <jinqian@android.com>
Signed-off-by: Alan <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-11 22:09:09 -08:00
Greg Hackmann 283ded1031 staging: goldfish: audio: add devicetree bindings
Introduce devicetree bindings to the Goldfish staging audio driver.

Signed-off-by: Greg Hackmann <ghackmann@google.com>
Signed-off-by: Jin Qian <jinqian@android.com>
Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-11 22:09:09 -08:00
Bhaktipriya Shridhar 76134b3f19 staging: rtl8192e: rtllib_crypt_tkip: Remove unnecessary else after return
This patch fixes the checkpatch warning that else is not generally
useful after a break or return.

This was done using Coccinelle:
@@
expression e2;
statement s1;
@@
if(e2) { ... return ...; }
-else
         s1

Signed-off-by: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-11 22:09:09 -08:00
Bhumika Goyal 372419776a Staging: rtl8192e: Replace random_ether_addr with eth_random_addr
The macro random_ether_addr is calling the function eth_random_addr.
Therefore, the call to random_ether_addr can be replaced with
eth_random_addr.
Remove the wrapper function rtllib_randomize_cell and replace its
call with eth_random_addr as it is wrapping random_ether_addr.

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-11 22:09:09 -08:00
Janani Ravichandran 314e4be76e staging: rtl8192e: Drop cast on void pointer
Void pointers need not be cast to other pointer types.
Semantic patch used:

@r@
expression x;
void *e;
type T;
identifier f;
@@

(
  *((T *)e)
|
  ((T *)x) [...]
|
  ((T *)x)->f
|
- (T *)
  e
)

Signed-off-by: Janani Ravichandran <janani.rvchndrn@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-11 22:09:09 -08:00
Amitoj Kaur Chawla ecfdd3a010 staging: rtl8192e: rtl8192e: Remove create_workqueue()
With conccurency managed workqueues, use of dedicated workqueues can
be replaced by system_wq. Drop priv_wq by using system_wq.

Since there are multiple work items per priv but they do not need
to be ordered, increase of concurrency by switching to system_wq
should not break anything.

All work items are sync canceled on so it is guaranteed that
no work is running when rtl92e_suspend function is called.

Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-11 22:09:09 -08:00
Tapan Prakash T 138bdc6de2 drivers: staging: rtl8192e: rtllib_rx.c: Fix blank lines before a close brace
Fixed checkpatch.pl issue 'Blank lines aren't necessary before a close
brace'

Signed-off-by: Tapan Prakash T <tapanprakasht@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-11 22:09:09 -08:00
Tapan Prakash T 3d15286201 drivers: staging: rtl8192e: rtllib_rx.c: Fix code indent for conditional statement
Fixed checkpatch.pl warning 'suspect code indent for conditional
statements'

Signed-off-by: Tapan Prakash T <tapanprakasht@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-11 22:09:09 -08:00
Bhaktipriya Shridhar fdd3836442 staging: rtl8192e: Prefer using macro DIV_ROUND_UP
The macro DIV_ROUND_UP performs the computation
(((n) + (d) - 1) /(d)). It clarifies the divisor calculations.
This was done using the coccinelle script:
@@
expression e1;
expression e2;
@@
(
- ((e1) + e2 - 1) / (e2)
+ DIV_ROUND_UP(e1,e2)
|
- ((e1) + (e2 - 1)) / (e2)
+ DIV_ROUND_UP(e1,e2)
)

Signed-off-by: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-11 22:09:09 -08:00
Amitoj Kaur Chawla 354605f4e6 staging: rtl8192e: Remove create_workqueue()
With conccurency managed workqueues, use of dedicated workqueues can
be replaced by system_wq. Drop wq by using system_wq.

Since there are multiple work items per rtllib but they do not need to
be ordered, increase of concurrency by switching to system_wq should
not break anything.

All work items are sync canceled on rtllib_stop_protocol() so it is
guaranteed that no work is running when rtl92e_disable/reset/restart
functions are called.

Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
Acked-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-11 22:09:09 -08:00
Anchal Jain e27604efde staging: wilc1000: Possible unnecessary 'out of memory' message
Remove unnnecessary debug message.
Problem detected by checkpatch.

Signed-off-by: Anchal Jain <anchalj109@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-11 22:09:09 -08:00
Chaehyun Lim 1f12f14807 staging: wilc1000: use mutex instead of semaphore sem_cfg_values
This patch replaces struct semaphore sem_cfg_values with struct mutex
cfg_values_lock. It is better to use mutex than semaphore.

Signed-off-by: Chaehyun Lim <chaehyun.lim@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-11 22:09:09 -08:00
Bhumika Goyal 8f5b1435a1 Staging: lustre: Use list_{next/prev}_entry instead of list_entry
This patch replace list_entry with list_{next/prev}_entry as it makes
the code more clear to read.
Done using coccinelle:

@@
expression e1;
identifier e3;
type t;
@@
(
- list_entry(e1->e3.next,t,e3)
+ list_next_entry(e1,e3)
|
- list_entry(e1->e3.prev,t,e3)
+ list_prev_entry(e1,e3)
)

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-11 22:09:09 -08:00
Bhumika Goyal 2d513ef6c3 Staging: lustre: lnet: Use list_first_entry_or_null
This patch replaces list_empty and list_entry with
list_first_entry_or_null.
Done using coccinelle:

@@
expression e1,e2;
statement S;
@@
- if(!list_empty(...)){
  e2=
- list_entry(e1.next,
+ list_first_entry_or_null(&e1,
  ...);
+ if(e2){
...
}

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-11 22:09:09 -08:00
Bhaktipriya Shridhar 19cc827b6c staging: rtl8723au: hal: Remove useless return variables
This patch removes unnecessary return variables and compresses the
return logic.
The coccinelle script that finds and fixes this issue is:
@@ type T; identifier i,f; constant C; @@
- T i;
...when != i
when strict
( return -C;
|
- i =
+ return
f(...);
- return i;
)

Signed-off-by: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-10 19:44:34 -08:00
Bhumika Goyal b29f8096d8 Staging: rtl8723au: Remove debug messages
As kmalloc generates a backtrace on failure so there is no need of these
debug messages when kmalloc fails. Also remove unwanted {} around if block
after removal of these messages.

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-10 19:44:34 -08:00
Bhumika Goyal 28f5caa167 Staging: rtl8723au: Clean up tests if NULL returned on failure
Some functions like kmalloc/usb_alloc_urb returns Null as their return
value on failure. !x is generally preferred over x==NULL or NULL==x. So
make use of !x if the value returned on failure by these functions is NULL.
Done using coccinelle:

@@
expression e;
statement S;
@@
e = \(kmalloc\|devm_kzalloc\|kmalloc_array
     \|devm_ioremap\|usb_alloc_urb\|alloc_netdev\)(...);
- if(e==NULL)
+ if(!e)
  S

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-10 19:44:34 -08:00
Bhaktipriya Shridhar 4e7c855eae staging: rtl8723au: Remove unnecessary parantheses
Removed parantheses on the right hand side of assignments as they are
not needed.

This was done with Coccinelle:

@@ expression a, b; @@

a =
- (
b
- )
;

Signed-off-by: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-10 19:44:34 -08:00
Geliang Tang 4b279420ac staging: rtl8723au: core: rtw_recv: use list_first_entry()
Use list_first_entry() instead of container_of() to simplify the code.

Signed-off-by: Geliang Tang <geliangtang@163.com>
Acked-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-10 19:44:34 -08:00
Geliang Tang 2cb5780a41 staging: rtl8723au: core: rtw_xmit: use list_first_entry_or_null()
Use list_first_entry_or_null() instead of list_empty() + container_of()
to simplify the code.

Signed-off-by: Geliang Tang <geliangtang@163.com>
Acked-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-10 19:44:34 -08:00
Geliang Tang 8584394bdf staging: rtl8723au: core: rtw_recv: use list_first_entry_or_null()
Use list_first_entry_or_null() instead of list_empty() + container_of()
to simplify the code.

Signed-off-by: Geliang Tang <geliangtang@163.com>
Acked-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-10 19:44:34 -08:00
Greg Kroah-Hartman 7bf777fbfe Revert "staging: comedi: drivers: Remove unneeded NULL check before kfree()"
This reverts commit 3545bee9b8.

It's not correct.

Reported-by: Hartley Sweeten <HartleyS@visionengravers.com>
Cc: Janani Ravichandran <janani.rvchndrn@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-10 19:35:54 -08:00
Bhaktipriya Shridhar b44483e7be staging: comedi: ni_pcidio.c: Prefer using macro DIV_ROUND_UP
The macro DIV_ROUND_UP performs the computation
(((n) + (d) - 1) /(d)). It clarifies the divisor calculations.
This was done using the coccinelle script:
@@
expression e1;
expression e2;
@@
(
- ((e1) + e2 - 1) / (e2)
+ DIV_ROUND_UP(e1,e2)
|
- ((e1) + (e2 - 1)) / (e2)
+ DIV_ROUND_UP(e1,e2)
)

Signed-off-by: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-10 19:34:22 -08:00
Bhaktipriya Shridhar 621ab40df9 staging: comedi: dt282x: Prefer using macro DIV_ROUND_UP
The macro DIV_ROUND_UP performs the computation
(((n) + (d) - 1) /(d)). It clarifies the divisor calculations.
This was done using the coccinelle script:
@@
expression e1;
expression e2;
@@
(
- ((e1) + e2 - 1) / (e2)
+ DIV_ROUND_UP(e1,e2)
|
- ((e1) + (e2 - 1)) / (e2)
+ DIV_ROUND_UP(e1,e2)
)

Signed-off-by: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-10 19:34:22 -08:00
Bhaktipriya Shridhar 0116317636 staging: comedi: rtd520: Prefer using macro DIV_ROUND_UP
The macro DIV_ROUND_UP performs the computation
(((n) + (d) - 1) /(d)). It clarifies the divisor calculations.
This was done using the coccinelle script:
@@
expression e1;
expression e2;
@@
(
- ((e1) + e2 - 1) / (e2)
+ DIV_ROUND_UP(e1,e2)
|
- ((e1) + (e2 - 1)) / (e2)
+ DIV_ROUND_UP(e1,e2)
)

Signed-off-by: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-10 19:34:22 -08:00
Bhaktipriya Shridhar 7f9d2b1ce5 staging: comedi: drivers: ni_mio_common: Prefer using macro DIV_ROUND_UP
The macro DIV_ROUND_UP performs the computation
(((n) + (d) - 1) /(d)). It clarifies the divisor calculations.
This was done using the coccinelle script:
@@
expression e1;
expression e2;
@@
(
- ((e1) + e2 - 1) / (e2)
+ DIV_ROUND_UP(e1,e2)
|
- ((e1) + (e2 - 1)) / (e2)
+ DIV_ROUND_UP(e1,e2)
)

Signed-off-by: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-10 19:34:22 -08:00
Bhaktipriya Shridhar df6ba4f161 staging: comedi: drivers: amplc_pci230: Prefer using macro DIV_ROUND_UP
The macro DIV_ROUND_UP performs the computation
(((n) + (d) - 1) /(d)). It clarifies the divisor calculations.
This was done using the coccinelle script:
@@
expression e1;
expression e2;
@@
(
- ((e1) + e2 - 1) / (e2)
+ DIV_ROUND_UP(e1,e2)
|
- ((e1) + (e2 - 1)) / (e2)
+ DIV_ROUND_UP(e1,e2)
)

Signed-off-by: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-10 19:34:22 -08:00
Sandhya Bankar 44b8c793fc Staging: comedi: Use predefined macro offset_in_page() instead of (addr & ~PAGE_MASK).
Use predefined macro offset_in_page() instead of (addr & ~PAGE_MASK).

Signed-off-by: Sandhya Bankar <bankarsandhya512@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-10 19:34:22 -08:00
Amitoj Kaur Chawla f3b1e4db82 staging: comedi: drivers: gsc_hpdi: Remove use of deprecated pci API
Replace pci_[alloc|free]_consistent occurences with
dma_[alloc|free]_coherent.

The Coccinelle semantic patch that was used to make some of these
changes is as follows:
@deprecated@
idexpression id;
position p;
@@

(
  pci_dma_supported@p ( id, ...)
|
  pci_alloc_consistent@p ( id, ...)
)

@bad1@
idexpression id;
position deprecated.p;
@@
...when != &id->dev
   when != pci_get_drvdata ( id )
   when != pci_enable_device ( id )
(
  pci_dma_supported@p ( id, ...)
|
  pci_alloc_consistent@p ( id, ...)
)

@depends on !bad1@
idexpression id;
expression direction;
position deprecated.p;
@@

(
- pci_dma_supported@p ( id,
+ dma_supported ( &id->dev,
...
+ , GFP_KERNEL
  )
|
- pci_alloc_consistent@p ( id,
+ dma_alloc_coherent ( &id->dev,
...
+ , GFP_KERNEL
  )
)

gsc_hpdi_auto_attach does not affect interrupt status but contains a
call to comedi_alloc_devpriv() which calls kzalloc with GFP_KERNEL flag.
Thus, there seems to be no danger that dma_alloc_coherent can be called
with interrupts turned off, and GFP_KERNEL can be used.

Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-10 19:34:22 -08:00
Bhaktipriya Shridhar 6e1edc0f8b staging: unisys: visornic: Remove unnecessary else after return
This patch fixes the checkpatch warning that else is not generally
useful after a break or return.

This was done using Coccinelle:
@@
expression e2;
statement s1;
@@
if(e2) { ... return ...; }
-else
         s

Signed-off-by: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-10 19:29:45 -08:00
David Kershner d342c06043 staging: unisys: visorbus: clean up visorchannel_clear
Goto label was ambiguous change to out_free_page to signify that
we will always go through the path even on success.

Signed-off-by: David Kershner <david.kershner@unisys.com>
Signed-off-by: Timothy Sell <timothy.sell@unisys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-10 19:27:39 -08:00
David Kershner 5bf49a6c74 staging: unisys: visorbus: cleanup gotos in visorchannel_create_guts
Away label is ambiguous change to it err_destroy_channel to make it
clear this is an error path.

Signed-off-by: David Kershner <david.kershner@unisys.com>
Signed-off-by: Timothy Sell <timothy.sell@unisys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-10 19:27:39 -08:00
Sandhya Bankar afd14cef01 Staging: most: Use usb_endpoint_dir_in(endpoint) instead of (endpoint->bEndpointAddress & USB_DIR_IN).
Use usb_endpoint_dir_in(endpoint) instead of (endpoint->bEndpointAddress & USB_DIR_IN) to check if the endpoint has IN direction.
This correction is based on following semantic patch,

@@
struct usb_endpoint_descriptor *endpoint;
expression E;
@@

(
- endpoint->bEndpointAddress & USB_DIR_IN
+ usb_endpoint_dir_in(endpoint)
|
- endpoint->bEndpointAddress == USB_DIR_IN
+ usb_endpoint_dir_in(endpoint)
|
- (endpoint->bEndpointAddress & E) == USB_DIR_IN
+ usb_endpoint_dir_in(endpoint)
)

Signed-off-by: Sandhya Bankar <bankarsandhya512@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-10 19:26:05 -08:00
Bhumika Goyal d93f27b732 Staging: most: Use list_first_entry instead of list_entry
This patch replaces list_entry with list_first_entry as it makes the
code more clear.
Done using coccinelle:

@@
expression e;
@@
(
- list_entry(e->next,
+ list_first_entry(e,
  ...)
|
- list_entry(e->prev,
+ list_last_entry(e,
  ...)
)

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-10 19:26:05 -08:00
Eva Rachel Retuya 7b50908a5e staging: unisys: visorinput: convert pr_err() to dev_err()
Replace pr_err() calls with respective dev_err() counterpart.
Semantic patch used to detect and apply the transformation:

@r exists@
identifier f,s,i;
position p;
@@

f(...,struct s *i,...) {
  <+...
  pr_err@p(...)
  ...+>
}

@s@
identifier r.s, dev;
@@

struct s {
	...
	struct device dev;
	...
};

@t@
identifier r.i, s.dev;
expression fmt;
position r.p;
@@

- pr_err@p(
+ dev_err(&i->dev,
			fmt, ...);

Signed-off-by: Eva Rachel Retuya <eraretuya@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-10 19:26:05 -08:00
Bhumika Goyal 9d521ca71d Staging: most: Replace pr_err with dev_err
All devm functions has a device structure as the first argument which is
required by dev_{err,info,dbg} printing functions.
This patch converts pr_err to dev_err as dev_* is preferred after calls
to devm functions.

Done using coccinelle:

@r1 exists@
expression e,e1;
identifier f =~ "^devm_";
identifier g =~ "^pcim_";
identifier h =~ "^dmam_";
@@
e=\(f\|g\|h\)(e1,...);
<+...
(
- pr_info(
+ dev_info(e1,
   ...);
|
- pr_err(
+ dev_err(e1,
  ...);
|
- pr_debug(
+ dev_dbg(e1,
  ...);
)
...+>

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-10 19:26:05 -08:00
David Kershner 2500276efe staging: unisys: visorbus: variable adjustment should be a u64
This patch fixes the smatch error:

drivers/staging/unisys/visorbus/visorchipset.c:2217 visorchipset_ioctl()
warn: user controlled 'adjustment' cast to postive rl = 's64min-s64max'

This is because we read a s64 and pass it to a function as u64.

Signed-off-by: David Kershner <david.kershner@unisys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-10 19:26:05 -08:00
Sandhya Bankar 50aefc19c7 Staging: vt6655: Remove & from function name.
Remove & from function name,when function name passed as an argument to another function.
Function name is used as pointer without &.

Signed-off-by: Sandhya Bankar <bankarsandhya512@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-10 19:21:18 -08:00
Ben Marsh e9097b1c3f Staging: vt6655: remove unnecessary blank lines from card.c
This a patch to card.c to remove unnecessary blank lines in order to
remove a checkpatch.pl warning.

Signed-off-by: Ben Marsh <bmarsh94@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-10 19:21:18 -08:00
Rehas Sachdeva dcf8343d54 staging: vt6656: Remove unnecessary parentheses
This patch removes the following checkpatch.pl warnings:
Unnecessary parentheses around al7230_init_table_amode[0][0]
Unnecessary parentheses around al7230_channel_table2[0][0]

Signed-off-by: Rehas Sachdeva <aquannie@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-10 19:21:18 -08:00
Malcolm Priestley efa21f9d0d staging: vt6655: mac.c replace dwData with data.
Removing camel case and type prefix.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-10 19:19:16 -08:00
Malcolm Priestley 0e7997c18f staging: vt6655: mac.c replace wOffset with offset.
Removing camel case and type prefix.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-10 19:19:16 -08:00
Malcolm Priestley ebc9bd832f staging: vt6655: mac.c replace byOrgDMACtl with org_dma_ctl
Removing camel case and type prefix.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-10 19:19:16 -08:00
Malcolm Priestley 28029472aa staging: vt6655: mac Replace dwCurrDescAddr with curr_desc_addr.
Removing camel case and type prefix.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-10 19:19:16 -08:00
Malcolm Priestley 17c4c51e03 staging: vt6655: mac.c replace VNSvInPortB with ioread8
Removing the macro from functions.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-10 19:19:16 -08:00
Malcolm Priestley 58fe2702c4 staging: vt6655: MACvSetLoopbackMode replace byOrgValue with ioread8
Removing VNSvInPortB and nesting inside iowrite8.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-10 19:19:16 -08:00
Malcolm Priestley e206939f99 staging: vt6655: MACbPSWakeup replace VNSvInPortB byOrgValue with ioread8
removing byOrgValue variable.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-10 19:19:16 -08:00
Malcolm Priestley 3b8eb64c1b staging: vt6655: mac.c replace VNSvOutPortB with iowrite8
removing macro from functions

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-10 19:19:16 -08:00
Malcolm Priestley 54a14e62f4 staging: vt6655: mac.c replace VNSvOutPortW with iowrite16
removig macro from functions.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-10 19:19:16 -08:00
Malcolm Priestley e2ad8e23ae staging: vt6655: mac.c replace VNSvOutPortD with iowrite32.
Removing the macro from functions.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-10 19:19:16 -08:00
Malcolm Priestley e984c758ec staging: vt6655: mac.c/h resize all unsigned long to u32
All addressing is limited to 32 bits match this to all
functions and port out functions.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-10 19:19:16 -08:00
Malcolm Priestley 4633195295 staging: vt6655: MACvRestoreContext replace for loops with memcpy_toio.
Removing the need for variable ii.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-10 19:19:16 -08:00
Malcolm Priestley 7071501744 staging: vt6655: mac.c rename pbyCxtBuf to cxt_buf
Removing camel case and type prefix.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-10 19:19:16 -08:00
Malcolm Priestley 7e5120e949 staging: vt6655: MACvSaveContext use memcpy_fromio to read context.
Use memcpy_fromio to store data removing the need for local count.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-10 19:17:17 -08:00
Malcolm Priestley e52ab0ecb2 staging: vt6655: replace VNSvInPortD dwData reads with ioread32
Removing dwData variable altogether.

The reads are always 32 bit insize.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-10 19:17:17 -08:00
Malcolm Priestley f205e8d129 staging: vt6655: mac.c Replace VNSvInPortB byData reads with ioread8.
Removing byData variable altogether.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-10 19:17:17 -08:00
Malcolm Priestley c2d845de8f staging: vt6655: mac.c rename dwIoBase to io_base
Removing camel case.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-10 19:17:17 -08:00
James Simmons b08bb6bb5a staging: lustre: make lustre dependent on LNet
In the case of lustre routers you only need a functioning
LNet stack. Especially since often the routers are very
light weight and want to avoid any addition software that
would create additional pressures on the system.

Signed-off-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-10 17:48:53 -08:00
James Simmons b2b60cddb5 staging: lustre: add help section of Kconfig config LNET
Include a help section for Kconfig LNET.

Signed-off-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-10 17:48:53 -08:00
James Simmons 78ed9534df staging: lustre: fixup kernel Kconfig option LNET_MAX_PAYLOAD
A few errors exist for the Kconfig option LNET_MAX_PAYLOAD. First
mistake is the default size is 1MB not 2MB as it is shown to the
person configuring the kernel. Second the LNET_MAX_PAYLOAD option
is more closely related to LNET than the LUSTRE_FS option.

Signed-off-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-10 17:48:53 -08:00
James Simmons 71bf3883ae staging: lustre: move libcfs to lnet layer
The lustre file system has a layered architecture with
libcfs as the lowest layer and LNet layered on top. Then
on top of LNet we run the lustre client. This patch moves
the libcfs module code out of lustre into the lnet tree.
This fits into the long term goal of eventually merging
libcfs into LNet.

Signed-off-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-10 17:48:53 -08:00
Jubin John 79d0c08880 staging/rdma/hfi1: Fix memory leaks
Fix 3 memory leaks reported by the LeakCheck tool in the KEDR framework.

The following resources were allocated memory during their respective
initializations but not freed during cleanup:
1. SDMA map elements
2. PIO map elements
3. HW send context to SW index map

This patch fixes the memory leaks by freeing the allocated memory in the
cleanup path.

Reviewed-by: Dean Luick <dean.luick@intel.com>
Reviewed-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
Reviewed-by: Mike Marciniszyn <mike.marciniszyn@intel.com>
Signed-off-by: Jubin John <jubin.john@intel.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
2016-03-10 20:45:47 -05:00
Easwar Hariharan 409b146225 staging/rdma/hfi1: Fix reporting of LED status in Get(LedInfo) and Get(PortInfo)
The LedInfo SMA attribute is redefined to control the LED beaconing
state machine instead of the LED directly. In accordance, we now
return the state of LED beaconing, represented by whether the beaconing
timer is active, instead of the state of the LED itself for SMA queries
Get(LedInfo) and Get(PortInfo). While we are at it, we fix the beaconing
timer control code so that the state of the timer is accurately updated.

Reviewed-by: Ira Weiny <ira.weiny@intel.com>
Reviewed-by: Mike Marciniszyn <mike.marciniszyn@intel.com>
Signed-off-by: Easwar Hariharan <easwar.hariharan@intel.com>
Signed-off-by: Jubin John <jubin.john@intel.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
2016-03-10 20:45:46 -05:00
Kaike Wan 24487dd39c staging/rdma/hfi1: Check interrupt registers mapping
This patch tests the interrupt registers when the driver has no access to
its upstream component. In this case, it is highly likely that it is
running in a virtual machine (eg, Qemu-kvm guest). If the interrupt
registers are not mapped properly by the virtual machine monitor, an
error message will be printed and the probing will be terminated. This
will help the user identify the issue. On the other hand, if the driver
is running in a host or has access to its upstream component in some
other VM, it will do nothing.

Reviewed-by: Mike Marciniszyn <mike.marciniszyn@intel.com>
Reviewed-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
Signed-off-by: Kaike Wan <kaike.wan@intel.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
2016-03-10 20:45:46 -05:00
Kaike Wan bf400235f3 staging/rdma/hfi1: Avoid using upstream component if it is not accessible
When the hfi1 device is assigned to a VM (eg KVM), the hfi1 driver has
no access to the upstream component and therefore cannot use it to perform
some operations, such as secondary bus reset. As a result, the hfi1 driver
cannot perform the pcie Gen3 transition. Instead, those operation should
be done in the host environment, preferrably done during the Option ROM
initialization. Similarly, the hfi1 driver cannot support ASPM and tune
the pcie capability under this circumstance.

Reviewed-by: Mike Marciniszyn <mike.marciniszyn@intel.com>
Reviewed-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
Signed-off-by: Kaike Wan <kaike.wan@intel.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
2016-03-10 20:45:46 -05:00
Jianxin Xiong aa0ad411e5 staging/rdma/hfi1: Fix header size calculation for RC/UC QPs with GRH enabled
There is a header size counter in both the QP struture and the txreq
structure. The counter in the txreq structure is not updated properly
for RC and UC queue pairs with GRH enabled, and thus causing SDMA
send to fail. This patch fixes the RC and UC path.

Reviewed-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
Reviewed-by: Dean Luick <dean.luick@intel.com>
Reviewed-by: Mike Marciniszyn <mike.marciniszyn@intel.com>
Signed-off-by: Jianxin Xiong <jianxin.xiong@intel.com>
Signed-off-by: Jubin John <jubin.john@intel.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
2016-03-10 20:45:45 -05:00
Dean Luick 582e05c3de staging/rdma/hfi1: Fix counter read for cp
A cp or cat of /sys/kernel/debug/hfi1/hfi1_0/port1counters
produces the following message:

hfi1 0000:81:00.0: hfi1_0: index not supported
hfi1 0000:81:00.0: hfi1_0: read_cntrs does not support indexing

Fix by removing the file position logic and the associated messages
and make the file positioning the responsibility of the caller.

The port counter read function argument is changed to the per port
data structure since the counters are relative to the port and not
the device.

Reviewed-by: Sebastian Sanchez <sebastian.sanchez@intel.com>
Signed-off-by: Dean Luick <dean.luick@intel.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
2016-03-10 20:45:45 -05:00
Dean Luick 7b47622d78 staging/rdma/hfi1: Guard i2c access against cp
An attempt to cp or cat /sys/kernel/debug/hfi1/hfi1_0/i2c1
produces this message:

hfi1 0000:81:00.0: hfi1_0: IB0:1 I2C failed even retrying

Fix the issue by explicitly rejecting a simple cat/cp with an
-EINVAL error return.

Reviewed-by: Easwar Hariharan <easwar.hariharan@intel.com>
Signed-off-by: Dean Luick <dean.luick@intel.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
2016-03-10 20:45:45 -05:00
Dean Luick 354d9c952d staging/rdma/hfi1: Disclose more information when i2c fails
Improve logging messages when there are i2c failures.
Clean i2c read error handling.

Reviewed-by: Easwar Hariharan <easwar.hariharan@intel.com>
Signed-off-by: Dean Luick <dean.luick@intel.com>
Signed-off-by: Jubin John <jubin.john@intel.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
2016-03-10 20:45:44 -05:00
Dean Luick ed6f653fe4 staging/rdma/hfi1: Fix debugfs access race
Debugfs access races with the driver being ready.  Make sure the
driver is ready before debugfs files appear and debufs files are
gone before the driver starts tearing down.

Reviewed-by: Mike Marciniszyn <mike.marciniszyn@intel.com>
Signed-off-by: Dean Luick <dean.luick@intel.com>
Signed-off-by: Jubin John <jubin.john@intel.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
2016-03-10 20:45:44 -05:00
Easwar Hariharan e8aa284ba0 staging/rdma/hfi1: Cleanup comments and logs in PHY code
This is a set of minor fixes including comment and log message cleanups
and improvements to the PHY layer code.

Reviewed-by: Dean Luick <dean.luick@intel.com>
Signed-off-by: Easwar Hariharan <easwar.hariharan@intel.com>
Signed-off-by: Jubin John <jubin.john@intel.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
2016-03-10 20:45:43 -05:00
Dean Luick 4c9e7aacb6 staging/rdma/hfi1: Fix xmit discard error weight
Count only the errors that apply to xmit discards.  Update
the comment to better explain the limitations of the count.

Reviewed-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
Signed-off-by: Dean Luick <dean.luick@intel.com>
Signed-off-by: Jubin John <jubin.john@intel.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
2016-03-10 20:45:43 -05:00
Mike Marciniszyn 6b5c5213e5 staging/rdma/hfi1: fix 0-day syntax error
Setting CONFIG_HFI1_DEBUG_SDMA_ORDER causes a syntax error:
sdma.c: In function ‘complete_tx’:
sdma.c:370: error: ‘txp’ undeclared (first use in
this function)
sdma.c:370: error: (Each undeclared identifier is reported only once
sdma.c:370: error: for each function it appears in.)

Adjust code under ifdef to reference the tx properly.

Reviewed-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
Signed-off-by: Mike Marciniszyn <mike.marciniszyn@intel.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
2016-03-10 20:45:43 -05:00
Jubin John 05d6ac1d82 staging/rdma/hfi1: Fix header
Fix the header by moving the copyright notice out of the license text
and to the top of the header. Also, update the copyright date.

Reviewed-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
Signed-off-by: Jubin John <jubin.john@intel.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
2016-03-10 20:45:42 -05:00