Commit graph

484 commits

Author SHA1 Message Date
Amitoj Kaur Chawla
f99ca86646 staging: rtl8712: Declare function as static
Declare rtl871x_intf_resume() function static since it is defined and called
in this file only.

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

Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-20 15:18:33 -08:00
Joseph Bisch
af09054958 staging: rtl8712: Remove unnecessary ret variable
Since the variable ret is set at the beginning of the function and
never changes its value, we can just return the value it was set to.

Found using coccinelle with misc/returnvar.cocci.

Signed-off-by: Joseph Bisch <joseph.bisch@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-14 16:49:09 -08:00
Rakhi Sharma
f7099ad7bd staging: rtl8712: Fixed a comparision coding style warning.
WARNING: Comparisons should place the constant on the right side of the test
Fixed this warning by placing the constant on right side.

Signed-off-by: Rakhi Sharma <rakhish1994@gmail.com>-
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-14 16:49:09 -08:00
Geliang Tang
818ff7b28b staging: rtl8712: use list_first_entry_or_null()
Use list_first_entry_or_null() instead of list_empty() + LIST_CONTAINOR()
to simplify the code.

Signed-off-by: Geliang Tang <geliangtang@163.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-07 19:53:04 -08:00
Rakhi Sharma
97e2ba90fc Staging: rtl8712: rtl8712_cmd: Fixed a warning.
Warning:Comparisons should place the constant on the right side of the test
Fixed by placing the comparisions constant on right side of the test.

Signed-off-by: Rakhi Sharma <rakhish1994@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-07 19:53:04 -08:00
Dan Carpenter
aea48157ce staging: rtl8712: memory corruption in wpa_set_encryption()
->KeyMaterial is declared as a 16 byte array, but we only ever allocate
either 5 or 13 bytes of it.  The problem is that we memset() all 16
bytes to zero so we're memsetting past the end of the allocated memory.

I fixed this in slightly lazy way, by just allocating 16 bytes.  This
works but there is a lot more cleanup you could do to this code if you
wanted.  Which is why this code is in staging.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-07 19:52:30 -08:00
Lucas Tanure
eaf0e7966d Staging: rtl8712: Remove unnecessary cast on void pointer
The conversion from void pointer to any other pointer type is guaranteed
by the C programming language.

The semantic patch used to find this:

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

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

Signed-off-by: Lucas Tanure <tanure@linux.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-07 19:52:30 -08:00
Nicholas Mc Guire
7c2a2017e5 staging: rtl8712: consolidate kmalloc + memset 0 to kzalloc
This is an API consolidation only. The use of kmalloc + memset to 0
here is equivalent to kzalloc.

Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-07 19:52:30 -08:00
Hemmo Nieminen
39e9526cec staging: rtl8712: Improve suspend/resume functionality.
Cancel pending URBs during suspend operation to avoid receiving ESHUTDOWN
in read/write completion callbacks while the device is suspended.

Receiving ESHUTDOWN in read/write completion callbacks will cause the
driver to enter a non-functioning "stopped" state from which the driver is
unable to recover without reloading the module.

Signed-off-by: Hemmo Nieminen <hemmo.nieminen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-07 19:52:30 -08:00
Mauro Dreissig
549d33d278 staging: rtl8712: Cleanup _io_ops wrappers
This removes ugly and unnecessary declarations.

Signed-off-by: Mauro Dreissig <mukadr@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-07 19:50:09 -08:00
Michael Hornung
1d282c3100 staging: rtl8712: Remove unused CamelCase define
* Remove unused CamelCase in order to get rid of the corresponding
  checkpatch.pl "CHECK: Avoid CamelCase: <IEEE80211_QoS_DATAGRP>"

Signed-off-by: Michael Hornung <mhornung.linux@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-07 19:50:09 -08:00
Michael Hornung
b18025a841 staging: rtl8712: Coding style: Fix alignment
* Fix alignment which did not match open parenthesis

Signed-off-by: Michael Hornung <mhornung.linux@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-07 19:50:09 -08:00
Michael Hornung
da20958454 staging: rtl8712: Replace FSF mailing address by URL
* Fix checkpatch.pl output about not including the paragraph
  about writing to the Free Software Foundation's mailing address

Signed-off-by: Michael Hornung <mhornung.linux@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-07 19:50:09 -08:00
Michael Hornung
7e68f50a9b staging: rtl8712: Coding style: Fix missing spaces
* Add missing spaces around bitwise OR operation in order to get
  rid of checkpatch.pl's "CHECK: spaces preferred around that '|'"

Signed-off-by: Michael Hornung <mhornung.linux@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-07 19:50:09 -08:00
Michael Hornung
364cdb3f57 staging: rtl8712: Coding style: Make use of BIT macro
* Replace all occurences of (1<<x) by BIT(x) in order to get rid
  of checkpatch.pl "CHECK" output "Prefer using the BIT macro"

Signed-off-by: Michael Hornung <mhornung.linux@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-07 19:50:09 -08:00
Michael Hornung
3ce780f004 staging: rtl8712: Coding style: Remove multiple blank lines
* Remove multiple blank lines in order to get rid of checkpatch.pl
  "CHECK" output

Signed-off-by: Michael Hornung <mhornung.linux@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-07 19:50:09 -08:00
Amitoj Kaur Chawla
ec85e8c47b staging: rtl8712: rtl871x_sta_mgt: Remove wrapper function
Remove wrapper function mfree_sta_priv_lock() that can be replaced by a
direct call to mfree_all_stainfo().

Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-07 19:50:09 -08:00
Amitoj Kaur Chawla
d48df5b37e staging: rtl8712: rtl871x_mlme: Remove wrapper function
Remove wrapper function free_network_nolock() that can be replaced by a single line of code.

This patch renames _free_network_nolock() function to free_network_nolock().

Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-11-15 20:02:47 -08:00
Amitoj Kaur Chawla
657ff36ff5 staging: rtl8712: rtl871x_io: Remove unused function
Drop function that is declared but not called anywhere.

Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-29 07:55:17 +09:00
Amitoj Kaur Chawla
d743db9f05 staging: rtl8712: rtl871x_mp: Remove unused function
Drop unused function that is defined but is not called anywhere.

Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-27 16:58:00 +09:00
Amitoj Kaur Chawla
b85f3d4e58 staging: rtl8712: Remove unnecessary variables
Remove unnecessary variables that can be replaced with a single line of code.

The semantic patch used to find this is:

// <smpl>
@@
expression ret;
@@
- if (ret) return ret;
- return 0;
+ return ret;

@@
local idexpression ret;
expression e;
@@
- ret = e;
- return ret;
+ return e;

@@
type T;
identifier i;
expression E;
@@
- T i = E;
 ... when != i

@@
type T;
identifier i;
@@
- T i;
 ... when != i
// </smpl>

Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-27 16:58:00 +09:00
Cristina Moraru
ada40ba4e5 staging: rtl8712: Replace kmalloc with kmalloc_array
Replace kmalloc with specialized function kmalloc_array
when the size is a multiplication of:
	number_of_elements * size_of_element

Signed-off-by: Cristina Moraru <cristina.moraru09@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-24 19:38:48 -07:00
Luis de Bethencourt
4ef2de5ae0 staging: rtl8712: spaces preferred around operands
Clean up all instances of checkpatch.pl checks:
CHECK: spaces preferred around that '+'
(and other operands)

Signed-off-by: Luis de Bethencourt <luisbg@osg.samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-24 19:26:59 -07:00
Luis de Bethencourt
168a2c1028 staging: rtl8712: braces should be used on all arms
Fix all instances of the following checkpatch.pl check:
CHECK: braces {} should be used on all arms of this statement

Signed-off-by: Luis de Bethencourt <luisbg@osg.samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-24 19:26:59 -07:00
Luis de Bethencourt
1ca96884b1 staging: rtl8712: Remove boolean comparisons
Boolean tests do not need explicit comparison to true or false.

Signed-off-by: Luis de Bethencourt <luisbg@osg.samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-24 19:26:59 -07:00
Larry Finger
1e6e632836 staging: rtl8712: Add device ID for Sitecom WLA2100
This adds the USB ID for the Sitecom WLA2100. The Windows 10 inf file
was checked to verify that the addition is correct.

Reported-by: Frans van de Wiel <fvdw@fvdw.eu>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Frans van de Wiel <fvdw@fvdw.eu>
Cc: Stable <stable@vger.kernel.org> [All stable versions]
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-24 19:12:48 -07:00
Punit Vara
d32c16d2fc Staging: rtl8712: Coding style warnings fix for block comments
This patch is to the rtl871x_ioctl_linux.c file that fixes up following
warnings reported by checkpatch.pl :

-Block comments use * on subsequent lines
-Block comments use a trailing */ on a separate line

Signed-off-by: Punit Vara <punitvara@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-16 22:15:57 -07:00
Punit Vara
a1b42bef0a Staging: rtl8712: Use ether_addr_equal() over memcmp()
This patch is to the rtl871x_ioctl_linux.c file that fixes up following
warning reported by checkpatch.pl :

-Prefer ether_addr_equal() or ether_addr_equal_unaligned() over memcmp()

bssid and pnetwork->network.MacAddress both are 6 byte
array which aligned with u16

Signed-off-by: Punit Vara <punitvara@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-16 22:15:57 -07:00
Punit Vara
e904cc8f57 Staging: rtl8712: Fix warning prefer eth_broadcast_addr() over memset()
This patch is to the rtl871x_ioctl_linux.c that fixes up following
warning by checkpatch.pl:

-Prefer eth_broadcast_addr() over memset()

Signed-off-by: Punit Vara <punitvara@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-16 22:15:57 -07:00
Amitoj Kaur Chawla
a90391e4c1 staging: rtl8712: rtl8712_recv: Remove useless intialisation
Remove intialisation of a variable that is immediately reassigned.

The semantic patch used to find this is:

// <smpl>
@@
type T;
identifier x;
constant C;
expression e;
@@

T x
- = C
 ;
x = e;
// </smpl>

Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-16 22:15:57 -07:00
Shivani Bhardwaj
28aba50013 Staging: rtl8712: usb_ops_linux: Remove useless cast
Explicit type conversion is not required and should be removed.
Semantic patch used:
@@
type T;
T e;
identifier x;
@@

* T x = (T)e;

Signed-off-by: Shivani Bhardwaj <shivanib134@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-16 22:12:30 -07:00
Shivani Bhardwaj
0b2ea2c7ad Staging: rtl8712: rtl871x_io: Remove explicit cast
Explicit typecasting is not required and should be removed.
Semantic patch used:
@@
type T;
T e;
identifier x;
@@

* T x = (T)e;

Signed-off-by: Shivani Bhardwaj <shivanib134@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-16 22:12:30 -07:00
Shivani Bhardwaj
993c307eb4 Staging: rtl8712: rtl8712_xmit: Remove useless cast
Explicit typecasting of variables is not required and should be removed.
Semantic patch used:
@@
type T;
T e;
identifier x;
@@

* T x = (T)e;

Signed-off-by: Shivani Bhardwaj <shivanib134@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-16 22:12:30 -07:00
Shivani Bhardwaj
7074ed3df1 Staging: rtl8712: rtl8712_io: Remove unnecessary cast
Typecasting should be removed from variables as it is not required.
Semantic patch used:
@@
type T;
T e;
identifier x;
@@

* T x = (T)e;

Signed-off-by: Shivani Bhardwaj <shivanib134@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-16 22:12:30 -07:00
Shivani Bhardwaj
adc08cc4c9 Staging: rtl8712: rtl8712_cmd: Remove useless cast
Explicit type conversions are not required so, remove them.
Semantic patch used:
@@
type T;
T e;
identifier x;
@@

* T x = (T)e;

Signed-off-by: Shivani Bhardwaj <shivanib134@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-16 22:12:30 -07:00
Shivani Bhardwaj
adc6b375aa Staging: rtl8712: os_intfs: Remove unnecessary cast
Explicit type conversions are not required and so, they should be
removed.
Semantic patch used:
@@
type T;
T e;
identifier x;
@@

* T x = (T)e;

Signed-off-by: Shivani Bhardwaj <shivanib134@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-16 22:12:30 -07:00
Luis de Bethencourt
681cd988d3 staging: rtl8712: fix negative level value
range->avg_qual.level is of type uint8, so it shouldn't be assigned a
negative number. Assigning it 0x100 - 78, which is the equivalent
to (20 + -98) dBm when IW_QUAL_DBM is set.

Signed-off-by: Luis de Bethencourt <luisbg@osg.samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-12 20:43:20 -07:00
Amitoj Kaur Chawla
942eaa867f staging: rtl8712: usleep_range is preferred over udelay
Fix checkpatch.pl issue: "CHECK: usleep_range is preferred over
udelay;
see Documentation/timers/timers-howto.txt".
Replace `udelay()` with a call to `usleep_range()` with a reasonable
upper limit determined by the other sleeping functions present.

Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-12 20:43:20 -07:00
Amitoj Kaur Chawla
b33fc72291 staging: rtl8712: Replace GFP_ATOMIC with GFP_KERNEL
Replace GFP_ATOMIC with GFP_KERNEL since GFP_ATOMIC is used in
atomic context and only needed when functions are not allowed to sleep
whereas the function is later calling msleep().

Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-12 20:43:20 -07:00
Shraddha Barke
eef6c808d3 Staging: rtl8712: Use ARRAY_SIZE macro
ARRAY_SIZE is more concise to use when the size of an array is divided
by the size of its type

Changes made using Coccinelle-

@@
type T;
T[] E;
@@

- (sizeof(E)/sizeof(T))
+ ARRAY_SIZE(E)

Signed-off-by: Shraddha Barke <shraddha.6596@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-12 20:43:20 -07:00
Punit Vara
cbe396fbac Staging: rtl8712: rtl8712_hal.h: Coding style warnings fix for block comments
This is patch to the rtl8712_hal.h file that fixes up following warning
reported by checkpatch.pl :

-Block comments use a trailing */ on a separate line

Signed-off-by: Punit Vara <punitvara@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-08 10:34:50 +01:00
Punit Vara
3d228d87fc Staging: rtl8712: rtl8712_gp_bitdef.h: Coding style warning fix for block comment
This is patch to the rtl8712_gp_bitdef.h file that fixes up following
 warning reported by checkpatch.pl :

-Block comments use a trailing */ on a separate line

Signed-off-by: Punit Vara <punitvara@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-08 10:34:50 +01:00
Punit Vara
602cac56dd Staging: rtl8712: rtl8712_cmdctrl_bitdef.h: Coding style warning fix for block comment
This is patch to the rtl8712_cmdctrl_bitdef.h file that fixes up following
 warning reported by checkpatch.pl :

-Block comments use a trailing */ on a separate line

Signed-off-by: Punit Vara <punitvara@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-08 10:34:50 +01:00
Punit Vara
ed9c838a5d Staging: rtl8712: rtl8712_cmd.c: Coding style warnings fix for block comments
This is patch to the rtl8712_cmd.c file that fixes up following warning
reported by checkpatch.pl :

-Block comments use a trailing */ on a separate line

Signed-off-by: Punit Vara <punitvara@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-08 10:34:50 +01:00
Punit Vara
61172e0c88 Staging: rtl8712: recv_linux.c: Coding style warning fix for block comment
This is patch to the recv_linux.c file that fixes up following warning
reported by checkpatch.pl :

-Block comments use a trailing */ on a separate line

Signed-off-by: Punit Vara <punitvara@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-08 10:34:50 +01:00
Punit Vara
852681eb4a Staging: rtl8712: os_intfs.c : Coding style warning fix for block comment
This is patch to the os_intfs.c file that fixes up following warning
reported by checkpatch.pl :

-Block comments use a trailing */ on a separate line

Signed-off-by: Punit Vara <punitvara@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-08 10:34:50 +01:00
Punit Vara
652199cc28 Staging: rtl8712: ieee80211.h: Coding style warnings fix for block comments
This is patch to the ieee80211.h file that fixes up following warning
reported by checkpatch.pl :

-Block comments use * on subsequent lines
-Block comments use a trailing */ on a separate line

Signed-off-by: Punit Vara <punitvara@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-08 10:34:50 +01:00
Punit Vara
4fd8cba140 Staging: rtl8712: ieee80211.c: Coding style warnings fix for block comments
This is patch to the ieee80211.c file that fixes up following warning
reported by checkpatch.pl :

-Block comments use * on subsequent lines
-Block comments use a trailing */ on a separate line

Signed-off-by: Punit Vara <punitvara@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-08 10:34:50 +01:00
Punit Vara
0c9968ef9b Staging: rtl8712: drv_types.h:Coding style warnings fix for block comments
This is patch to the drv_types.h file that fixes up following warning
reported by checkpatch.pl :

-Block comments use * on subsequent lines
-Block comments use a trailing */ on a separate line

Signed-off-by: Punit Vara <punitvara@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-08 10:34:46 +01:00
Amitoj Kaur Chawla
8d2884ace7 staging: rtl8712: Remove NULL comparison
Remove NULL comparison by using '!' operator. Problem found using
checkpatch.pl
CHECK: Comparison to NULL could be written "!padapter->halpriv.hal_bus_init"

Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-08 10:25:32 +01:00
Amitoj Kaur Chawla
2a1283606f staging: rtl8712: Remove NULL comparison
Remove NULL comparison by using '!' operator. Problem found
using checkpatch.pl
CHECK: Comparison to NULL could be written "!ptmpchar"

Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-08 10:25:32 +01:00
Alison Schofield
29b1b61435 staging: rtl8712: Move constant to right of test or replace with "!"
Move constant to the right side of comparison operator or replace
equality operator (==) with the unary negation operator (!) if the
comparison is to zero.

Addesses multiple instances of the checkpatch.pl warning:
WARNING: Comparisons should place the constant on the right side of the
test

Signed-off-by: Alison Schofield <amsfield22@gmail.com>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-08 10:25:32 +01:00
Amitoj Kaur Chawla
335b9efa72 staging: rtl8712: Add space around '&'
Add space around operator '&'. Problem found using
checkpatch.pl
CHECK: spaces preferred around that '&' (ctx:VxV)

Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-08 10:25:32 +01:00
Amitoj Kaur Chawla
7ab4609a5d staging: rtl8712: Add spaces around '|'
Add space around operator '|'. Problem found using
checkpatch.pl
CHECK: spaces preferred around that '|' (ctx:VxV)

Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-08 10:25:32 +01:00
Amitoj Kaur Chawla
b3845d0239 staging: rtl8712: Add space around '+'
Add space around operator '+'. Problem found using
checkpatch.pl
CHECK: spaces preferred around that '+' (ctx:VxV)

Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-08 10:25:32 +01:00
Andy Shevchenko
3fe1be87ab staging: rtl8712: re-use mac_pton()
...instead of custom approach

Cc: Joshua Clayton <stillcompiling@gmail.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-02 11:48:15 +02:00
Luis de Bethencourt
96a384a7ed staging: rtl8712: remove dead code
The while() loop will only exit in a return or a goto ask_for_joinbss,
which means it will never break and execute the return after it.
Removing return _FAIL since it is dead code.

Signed-off-by: Luis de Bethencourt <luisbg@osg.samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-09-29 04:30:07 +02:00
Punit Vara
98a5248316 Staging: rtl8712: Coding style warning fix for block comment
This is a patch to mlme_linux.c that fixes up following warning
reported by checkpatch.pl :

-Block comments use a trailing */ on a separate line

Signed-off-by: Punit Vara <punitvara@gmailc.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-09-20 19:16:13 -07:00
Samuel Dominguez Lorenzo
4579ec9af0 staging: rtl8712: usb_ops_linux: fixed a comparison coding style issue
Fixed a coding style issue where a comparison had the constant on the
left side of the test instead of being on the right side of it.

Signed-off-by: Samuel Dominguez Lorenzo <yysamueldominguez@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-09-14 08:50:44 -07:00
Anish Bhatt
4c021dc0b8 staging/rtl8712 : Remove duplicated BIT() definitions
The BIT() macro is already defined in bitops.h,
remove duplicate definitions.

Signed-off-by: Anish Bhatt <anish@chelsio.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-09-12 18:24:56 -07:00
Anish Bhatt
27934f362a staging/rtl8712 : Remove unused macro definitions.
WLAN_ETHHDR_LEN/WLAN_ETHADDR_LEN/WLAN_ADDR_LEN
 are unused, duplicate or unnecessary, remove.

Signed-off-by: Anish Bhatt <anish@chelsio.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-09-12 18:24:56 -07:00
Joe Perches
a5ee4695ec staging: rtl8712: Remove unnecessary externs
Using 'extern' is not necessary for function prototypes.

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-08-14 18:51:56 -07:00
Joshua Clayton
7fb539eda2 staging: rtl8712: change SupportedRates to rates
Change the value to a name that conforms to Linux coding style.

"rates" is equally expressive in this context, and I have left alone
a comment and function name that describe the rates as supported rates.

Signed-off-by: Joshua Clayton <stillcompiling@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-08-07 15:14:04 -07:00
Joshua Clayton
db55b1652e staging: rtl8712: remove typedefs
Coding style fix.
Get rid of typedefs NDIS_802_11_RATES and NDIS_802_11_RATES_EX
Undo any casting that was done as a result of the typedef.

Signed-off-by: Joshua Clayton <stillcompiling@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-08-07 15:14:04 -07:00
Joshua Clayton
986fc8e741 staging: rtl8712: rename function
Rename r8712_get_ndis_wlan_bssid_ex_sz() to r8712_get_wlan_bssid_ex_sz(),
which corresponds to the struct whose size it measures.

Signed-off-by: Joshua Clayton <stillcompiling@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-08-07 15:14:03 -07:00
Joshua Clayton
44367877c6 staging: rtl8712: remove duplicate struct
struct ndis_wlan_bssid_ex is a doppelganger of struct wlan_bssid_ex,
and is used about a third as often.

Switch all instances to wlan_bssid_ex, and remove ndis_wlan_bssid_ex

This also gets rid of a use of typedef NDIS_802_11_RATES_EX

Signed-off-by: Joshua Clayton <stillcompiling@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-08-07 15:14:03 -07:00
Joshua Clayton
ebe92393ca staging: rtl8712: removed unused wrapper structs
Remove wrapper structs that just wrap struct ndis_wlan_bssid_ex,
and are unused.

Signed-off-by: Joshua Clayton <stillcompiling@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-08-07 15:14:03 -07:00
Joshua Clayton
9bdb70ecdd staging: rtl8712: fix comment
The old comment refers to a typedef name which is being removed,
and to a style of calculation which is no longer being used.
It falsely states that IELength is variable length, instead of IEs.

Change comment to simply state that the IEs field is a buffer of
variable size and that IELength refers to the current size.

Signed-off-by: Joshua Clayton <stillcompiling@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-08-07 15:14:03 -07:00
Joshua Clayton
881edf67b2 staging: rtl8712: simplify size calculation
replace item-by-item  size calculation of a struct
with the size of the struct.

This gets rid of a use of typedef NDIS_802_11_RATES_EX

Signed-off-by: Joshua Clayton <stillcompiling@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-08-07 15:14:03 -07:00
Joshua Clayton
5dab10f444 staging: rtl8712: fix buggy size calculation
r8712_get_ndis_wlan_bssid_ex_sz has a "6 * sizeof(unsigned long)"
where the underlying struct has a 6 * unsigned char.
Simplify the calculation by just subtracting the variable part from
the size of the struct.

This also gets rid of a use of typedef NDIS_802_11_RATES_EX

Signed-off-by: Joshua Clayton <stillcompiling@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-08-07 15:12:40 -07:00
Ravi Teja Darbha
5eafbb0c52 rtl8712:Fix checkpatch warning
Fix line over 80 characters warning.

Signed-off-by: Ravi Teja Darbha <ravi2j@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-07-14 19:54:37 -07:00
Sunil Shahu
a732152c76 staging: rtl8712: rtl871x_security.c: remove unnecessary variable initialization
Variable "u32 c" always re-initialize in for loop.
Initialized value of "u32 c" is not used in function
and is redundant, hence removed.

Suggested-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Sunil Shahu <shshahu@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-07-14 19:54:37 -07:00
Sunil Shahu
8027b33321 drivers: staging: rtl8712: remove unnecessary else statement
"else" statement after "if" is unnecessary, hence removed.

Signed-off-by: Sunil Shahu <shshahu@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-07-14 19:54:37 -07:00
Dogukan Ergun
07e9e619db staging: rtl8712: fix else after break or return warning
This patch fixes checkpatch.pl warning.
WARNING: else is not generally useful after a break or return

Signed-off-by: Dogukan Ergun <dogukan.ergun@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-06-13 14:45:51 -07:00
Fabian Frederick
8781d5b349 staging: rtl8712: use swap() in dequeue_xframe_ex()
Use kernel.h macro definition.

Thanks to Julia Lawall for Coccinelle scripting support.

Signed-off-by: Fabian Frederick <fabf@skynet.be>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-06-12 17:19:47 -07:00
Prasanna Karthik
05871f994e staging:rtl8712:Fix compressed return statement
Fix reported by coccinelle compressing last two lines with single return
call

Signed-off-by: Prasanna Karthik <mkarthi3@visteon.com>
Acked-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-06-08 13:38:56 -07:00
Hari Prasath Gujulan Elango
7eea766ad7 staging: rtl8712: fix indentation issue
Fixed indentation issue in few lines

Signed-off-by: Hari Prasath Gujulan Elango <hgujulan@visteon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-06-08 13:33:40 -07:00
Luca Ceresoli
73b4276365 staging: rtl8712: remove useless return value
The loadparam() function cannot fail, it's called only once and its return
value is ignored there.

Signed-off-by: Luca Ceresoli <luca@lucaceresoli.net>
Cc: Greg Kroah-Hartman <greg@kroah.com>
Cc: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Florian Schilhabel <florian.c.schilhabel@googlemail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-05-31 11:49:58 +09:00
Luca Ceresoli
a0825db8d1 staging: rtl8712: remove unneeded forward declaration
Signed-off-by: Luca Ceresoli <luca@lucaceresoli.net>
Cc: Greg Kroah-Hartman <greg@kroah.com>
Cc: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Florian Schilhabel <florian.c.schilhabel@googlemail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-05-31 11:49:57 +09:00
Luca Ceresoli
2ede90f996 staging: rtl8712: remove useless comment
"step 2" does mean much as there is no "step 1" stated anywhere...

Signed-off-by: Luca Ceresoli <luca@lucaceresoli.net>
Cc: Greg Kroah-Hartman <greg@kroah.com>
Cc: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Florian Schilhabel <florian.c.schilhabel@googlemail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-05-31 11:49:57 +09:00
Haggai Eran
cab462140f staging: rtl8712: prevent buffer overrun in recvbuf2recvframe
With an RTL8191SU USB adaptor, sometimes the hints for a fragmented
packet are set, but the packet length is too large. Allocate enough
space to prevent memory corruption and a resulting kernel panic [1].

[1] http://www.spinics.net/lists/linux-wireless/msg136546.html

Cc: <stable@vger.kernel.org>
Signed-off-by: Haggai Eran <haggai.eran@gmail.com>
ACKed-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-05-31 11:49:57 +09:00
Sudip Mukherjee
a1471eb9da staging: rtl8712: fix stack dump
del_timer_sync() is not to be called in the interrupt context unless
the timer is irqsafe. but most of the functions where commits
6501c8e7d8 and 382d020f44 touched were called in interrupt
context. And as a result the WARN_ON was getting triggered. Changed
to del_timer() in places which were called from interrupt.

Fixes: 382d020f44 ("Staging: rtl8712: Eliminate use of _cancel_timer"
Fixes: 6501c8e7d8 ("Staging: rtl8712: Eliminate use of _cancel_timer_ex")
Fixes: https://bugzilla.kernel.org/show_bug.cgi?id=97711
Reported-by: Arek Rusniak <arek.rusi@gmail.com>
Tested-by: Arek Rusniak <arek.rusi@gmail.com>
Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-05-31 11:49:57 +09:00
Jagan Teki
71d667b800 staging: rtl8712: Use ether_addr_copy() instead of memcpy()
Fixes Warning encounter this by applying checkpatch.pl against this file:
Prefer ether_addr_copy() over memcpy() if the Ethernet addresses
are __aligned(2)

pahole output for respective structures:
- addr->sa_data
struct sockaddr {
	sa_family_t                sa_family;            /*     0     2 */
	char                       sa_data[14];          /*     2    14 */

	/* size: 16, cachelines: 1, members: 2 */
	/* last cacheline: 16 bytes */
};

- pnetdev->dev_addr
dev_addr is interface address infor from generic net_device structure
which is properly aligned and have some patches with this change as well.
"staging: rtl8712: fix Prefer ether_addr_copy() over memcpy()"
(sha1: 36e4d8826b)

Signed-off-by: Jagan Teki <jteki@openedev.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Florian Schilhabel <florian.c.schilhabel@googlemail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-05-31 11:47:56 +09:00
Greg Kroah-Hartman
936a0cd52a Merge 4.1-rc4 into staging-next
We want the fixes in here for testing and merge issues.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-05-18 13:52:44 -07:00
Paul Gortmaker
f9c40f143c rtl8712: don't duplicate ieee80211 constants for status/reason
These are all defined as a part of the standard and should not be
duplicated on a per-driver basis.  Use the global ones and delete the
local ones.

It seems that ieee80211 was already included everywhere it was needed,
since no explicit include <...> were needed to be added in order to
preserve getting a successful compile.

This isn't the totality of duplicated data removed, but it is a start.

Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-05-08 09:24:13 +02:00
Carlos E. Garcia
69e98df782 Staging: fixed multiple spelling errors.
Fixed multiple spelling errors.

Signed-off-by: Carlos E. Garcia <carlos@cgarcia.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-05-08 09:23:58 +02:00
Dan Carpenter
b5eed730bd staging: rtl8712: freeing an ERR_PTR
If memdup_user() fails then "pparmbuf" is an error pointer and we can't
pass it to kfree().  I changed the "goto _r871x_mp_ioctl_hdl_exit" to a
direct return.

I changed the earlier goto to a direct return as well for consistency
and removed the "pparmbuf = NULL" initializer since it's no longer
needed.

Fixes: 45de432775 ('Staging: rtl8712: Use memdup_user() instead of copy_from_user()')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-05-08 01:58:04 +02:00
Julia Lawall
8f47c28b5a staging: rtl8712: Drop unneeded cast on netdev_priv
The result of netdev_priv is already implicitly cast to the type of the
left side of the assignment.

The semantic patch that fixes this problem is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@@
type T;
T *x;
@@

x =
- (T *)
  netdev_priv(...)
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-04-03 15:15:40 +02:00
Amitoj Kaur Chawla
5c7d08c32d 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>
2015-04-01 17:26:58 +02:00
Cristina Opriceana
b6955a8f43 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>
2015-04-01 17:26:58 +02:00
Cristina Opriceana
45de432775 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>
2015-04-01 17:26:58 +02:00
Haneen Mohammed
e0e982b436 Staging: rtl8712: replace memcpy with ether_addr_copy
This patch replace memcpy with ethe_addr_copy to address the following
warning generated by checkpatch.pl: ""Prefer ether_addr_copy over memcpy
if the Ethernet addresses are __aligned(2)"

Follwoing is the output of pahole for the relevant datastructures:
1- for  "iwe.u.ap_addr.sa_data" and "wrqu->ap_addr.sa_data"

struct sockaddr {
        sa_family_t                sa_family;            /*     0     2 */
        char                       sa_data[14];          /*     2    14 */

        /* size: 16, cachelines: 1, members: 2 */
        /* last cacheline: 16 bytes */
};

struct iw_event {
        __u16                      len;                  /*     0     2 */
        __u16                      cmd;                  /*     2     2 */

        /* XXX 4 bytes hole, try to pack */

        union iwreq_data           u;                    /*     8    16 */

        /* size: 24, cachelines: 1, members: 3 */
        /* sum members: 20, holes: 1, sum holes: 4 */
        /* last cacheline: 24 bytes */
};

2- for  "pnetwork->network.MacAddress" and "pcur_bss->MacAddress"

struct wlan_network {
        struct list_head           list;                 /*     0    16 */
        int                        network_type;         /*    16     4 */
        int                        fixed;                /*    20     4 */
        unsigned int               last_scanned;         /*    24     4 */
        int                        aid;                  /*    28     4 */
        int                        join_res;             /*    32     4 */
        struct ndis_wlan_bssid_ex  network;              /*    36   884 */
        /* --- cacheline 14 boundary (896 bytes) was 24 bytes ago ---   */

        /* size: 920, cachelines: 15, members: 7 */
        /* last cacheline: 24 bytes */
};

struct ndis_wlan_bssid_ex {
        u32                        Length;               /*     0     4 */
        unsigned char              MacAddress[6];        /*     4     6 */
        u8                         Reserved[2];          /*    10     2 */
        struct ndis_802_11_ssid    Ssid;                 /*    12    36 */
        u32                        Privacy;              /*    48     4 */
        s32                        Rssi;                 /*    52     4 */
        enum NDIS_802_11_NETWORK_TYPE NetworkTypeInUse;  /*    56     4 */
        struct NDIS_802_11_CONFIGURATION Configuration;  /*    60    32 */
        /* --- cacheline 1 boundary (64 bytes) was 28 bytes ago --- */
        enum NDIS_802_11_NETWORK_INFRASTRUCTURE InfrastructureMode; /* 92     4 */
        NDIS_802_11_RATES_EX       SupportedRates;       /*    96    16 */
        u32                        IELength;             /*   112     4 */
        u8                         IEs[768];             /*   116   768 */
        /* --- cacheline 13 boundary (832 bytes) was 52 bytes ago --- */

        /* size: 884, cachelines: 14, members: 12 */
        /* last cacheline: 52 bytes */
};

Signed-off-by: Haneen Mohammed <hamohammed.sa@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-03-18 10:32:39 +01:00
Dilek Uzulmez
58662d9f1e Staging: rtl8712: Replace __constant_cpu_to_le16
This fixes the following checkpatch.pl warning:
WARNING: __constant_cpu_to_le16 should be cpu_to_le16

Signed-off-by: Dilek Uzulmez <dilekuzulmez@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-03-16 15:48:20 +01:00
Matteo Semenzato
66faa441a6 Staging: rtl8712: fix potential null pointer dereference
Check if kmalloc succeded before using the pointer in memcpy.

Signed-off-by: Matteo Semenzato <mattew8898@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-03-16 15:48:20 +01:00
Haneen Mohammed
819ef63815 Staging: rtl8712: remove else after return statement
else after return generally is not useful. This patch removes else after return
statement. Issue addressed by checkpatch.pl.

Signed-off-by: Haneen Mohammed <hamohammed.sa@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-03-16 15:48:20 +01:00
Vaishali Thakkar
382d020f44 Staging: rtl8712: Eliminate use of _cancel_timer
Use timer API function del_timer_sync instead of driver
specific function _cancel_timer as besides deactivating
a timer, it also ensures that the timer is stopped on all
CPUs before the driver exists. Also, variables
timer_cancelled and bool are removed as they are no longer
needed.

@a@
expression x;
identifier y;
@@

- _cancel_timer (&x, &y);
+ del_timer_sync (&x);

@@type T; identifier a.y;@@

- T y;
...when != y

Signed-off-by: Vaishali Thakkar <vthakkar1994@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-03-16 15:46:07 +01:00
Vaishali Thakkar
6501c8e7d8 Staging: rtl8712: Eliminate use of _cancel_timer_ex
Use timer API function del_timer_sync instead of driver
specific function _cancel_timer_ex as besides deactivating
a timer, it ensures that the timer is stopped on all
CPUs before the driver exists. Also, definition of function
_cancel_timer_ex is removed as it is no longer needed after
this change.

This is done using Coccinelle and semantic patch used for
this is as follows:

@@ expression x; @@

- _cancel_timer_ex (&x);
+ del_timer_sync (&x);

Signed-off-by: Vaishali Thakkar <vthakkar1994@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-03-16 15:46:07 +01:00
Vatika Harlalka
8d0514d563 Staging rtl8172: Remove unnecessary typecast
Using addressof and then casting to the original type is unneeded.
So these casts can be removed.
Issue detected via Coccinelle script.

Signed-off-by: Vatika Harlalka <vatikaharlalka@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-03-09 13:37:22 +01:00
Tina Johnson
69e2b47fa0 drivers: staging: rtl8712: Removed unnecessary parentheses
Parentheses around the right side of an assignment statement are
unnecessary and hence removed. Coccinelle was used to produce the
patch:

@rule1@
identifier x,y;
constant c;
@@

(

 x =
-(
 y << c
-)
 ;
|
 x =
-(
 y >> c
-)
 ;
|
 x =
-(
 y + c
-)
 ;
|
 x =
-(
 y - c
-)
 ;

)

Signed-off-by: Tina Johnson <tinajohnson.1234@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-03-09 13:37:22 +01:00
Aya Mahfouz
22905b8594 staging: rtl8712: replace memset(x,0,ETH_ALEN)
eth_zero_addr() is a wrapper function for memset if 0 is going to
be assigned to a mac address. The aforementioned function replaces
memset. In addition, linux/etherdevice.h was included as a header
since it is the file that defines the inline function eth_zero_addr().
The changes were carried out using the following coccinelle script:

@header@
@@

#include <linux/etherdevice.h>

@eth_zero_addr@
expression e;
@@

-memset(e,0,ETH_ALEN);
+eth_zero_addr(e);

@eth_broadcast_addr@
identifier e;
@@

-memset(e,\(0xff\|0xFF\|255\),ETH_ALEN);
+eth_broadcast_addr(e);

@linux_header depends on !header && (eth_zero_addr || eth_broadcast_addr) @
@@

+ #include <linux/etherdevice.h>
+

@special_header depends on !header && !linux_header && (eth_zero_addr || eth_broadcast_addr) @
@@

+
+ #include <linux/etherdevice.h>
+

@custom_header depends on !header && !linux_header && !special_header && (eth_zero_addr || eth_broadcast_addr) @
@@

+
+ #include <linux/etherdevice.h>

Signed-off-by: Aya Mahfouz <mahfouz.saif.elyazal@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-03-06 15:30:07 -08:00
Aya Mahfouz
2597864233 staging: rtl8712: remove extra parentheses around right bit shift operation
Removes extra parentheses around bitwise right shift operation.
The cases handled are  when the resultant value is assigned to
a variable or when a shift operation is carried out for a function
argument. The issues were detected and resolved using the following
coccinelle script:

@@
expression e, e1;
constant c;
@@

e =
-(e1
+e1
>>
-c);
+c;

@@
identifier i;
constant c;
type t;
expression e;
@@

t i =
-(e
+e
>>
-c);
+c;

@@
expression e, e1;
identifier f;
constant c;
@@

e1 = f(...,
-(e
+e
>>
-c)
+c
,...);

Signed-off-by: Aya Mahfouz <mahfouz.saif.elyazal@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-03-06 15:22:43 -08:00
Vaishali Thakkar
e922df7d3e Staging: rtl8712: Eliminate use of _init_timer
This patch introduces the use of API function setup_timer
instead of driver specific function _init_timer as it is
the preferred and standard way to setup and set the timer.
To be compatible with the change, argument types of
referenced functions are changed. Also, definition of
function _init_timer is removed as it is no longer needed
after this change.

This is done using Coccinelle and semantic patch used for
this is as follows:

@@ expression x, y; identifier a, b;@@

- _init_timer (&x, y, a, b);
+ setup_timer (&x, a, (unsigned long)b);

Signed-off-by: Vaishali Thakkar <vthakkar1994@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-03-06 09:54:34 -08:00
Vaishali Thakkar
4eef520d24 Staging: rtl8712: Use del_timer
Use timer API function del_timer instead of driver
specific function _cancel_timer_ex as it is a standard
way for deactivating a timer.

This is done using Coccinelle and semantic patch used for
this is as follows:

@@ expression x; @@
- _cancel_timer_ex (&x);
+ del_timer (&x);

Signed-off-by: Vaishali Thakkar <vthakkar1994@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-03-01 17:07:05 -08:00
Vaishali Thakkar
c703c750cc Staging: rtl8712: Eliminate use of _set_timer
This patch introduces the use of API function mod_timer
instead of driver specific function _set_timer as it is
a more efficient and standard way to update the expire
field of an active timer. Also, definition of function
_set_timer is removed as it is no longer needed after
this change.

Here, these cases are handled using Coccinelle and
semantic patch used for this is as follows:

@@ expression x; expression y;@@

- _set_timer (&x, y);
+ mod_timer (&x, jiffies + msecs_to_jiffies (y));

Signed-off-by: Vaishali Thakkar <vthakkar1994@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-03-01 17:02:11 -08:00
Aya Mahfouz
ae52e527c9 staging: rtl8712: rewrite the right hand side of an assignment
This patch rewrites the right hand side of an assignment for
expressions of the form:
a = (a <op> b);
to be:
a <op>= b;
where <op> = << | >>.

This issue was detected and resolved using the following
coccinelle script:

@@
identifier i;
expression e;
@@

-i = (i >> e);
+i >>= e;

@@
identifier i;
expression e;
@@

-i = (i << e);
+i <<= e;

Signed-off-by: Aya Mahfouz <mahfouz.saif.elyazal@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-02-26 15:23:47 -08:00
Aya Mahfouz
5c7c5d800e staging: rtl8712: rewrite the right hand side of an assignment
This patch rewrites the right hand side of an assignment for
expressions of the form:
a = (a <op> b);
to be:
a <op>= b;
where <op> = << | >>.

This issue was detected and resolved using the following
coccinelle script:

@@
identifier i;
expression e;
@@

-i = (i >> e);
+i >>= e;

@@
identifier i;
expression e;
@@

-i = (i << e);
+i <<= e;

Signed-off-by: Aya Mahfouz <mahfouz.saif.elyazal@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-02-26 15:23:47 -08:00
Aya Mahfouz
bc5b749a46 staging: rtl8712: rewrite the right hand side of an assignment
This patch rewrites the right hand side of an assignment for
expressions of the form:
a = (a <op> b);
to be:
a <op>= b;
where <op> = << | >>.

This issue was detected and resolved using the following
coccinelle script:

@@
identifier i;
expression e;
@@

-i = (i >> e);
+i >>= e;

@@
identifier i;
expression e;
@@

-i = (i << e);
+i <<= e;

Signed-off-by: Aya Mahfouz <mahfouz.saif.elyazal@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-02-26 15:23:47 -08:00
Aya Mahfouz
cb329d837d staging: rtl8712: rewrite the right hand side of an assignment
This patch rewrites the right hand side of an assignment for
expressions of the form:
a = (a <op> b);
to be:
a <op>= b;
where <op> = << | >>.

This issue was detected and resolved using the following
coccinelle script:

@@
identifier i;
expression e;
@@

-i = (i >> e);
+i >>= e;

@@
identifier i;
expression e;
@@

-i = (i << e);
+i <<= e;

Signed-off-by: Aya Mahfouz <mahfouz.saif.elyazal@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-02-26 15:23:47 -08:00
Vaishali Thakkar
875b7dec47 Staging: rtl8712: Use mod_timer
This patch introduces the use of API function mod_timer
instead of driver specific function as it is a more
efficient and standard way to update the expire field of
an active timer.

Signed-off-by: Vaishali Thakkar <vthakkar1994@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-02-26 15:11:22 -08:00
Katie Dunne
a6c6e29817 Staging: rtl8712: Remove unused macros
Removes several macro definitions that are unused
Patch 2 will remove the same definitions in rtl8188eu/include/wifi.h

Signed-off-by: Katie Dunne <kdunne@mail.ccsf.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-02-26 15:11:22 -08:00
Melike Yurtoglu
d55519ab9b Staging: rtl8712: replace memcpy() by ether_addr_copy() using coccinelle and pack variable
This patch focuses on fixing the following warning generated
by checkpatch.pl for the file rtl871x_cmd.c

Prefer ether_addr_copy() over memcpy() if the Ethernet addresses
are __aligned(2)

@@ expression e1, e2; @@

- memcpy(e1, e2, ETH_ALEN);
+ ether_addr_copy(e1, e2);

struct _adapter {
        struct dvobj_priv          dvobjpriv;            /*     0    40*/
        struct mlme_priv           mlmepriv;             /*    40  1560*/
        /* --- cacheline 25 boundary (1600 bytes) --- */
        struct cmd_priv            cmdpriv;              /*  1600   136*/
        /* --- cacheline 27 boundary (1728 bytes) was 8 bytes ago --- */
        struct evt_priv            evtpriv;              /*  1736    96*/
        /* --- cacheline 28 boundary (1792 bytes) was 40 bytes ago --- * */
        struct io_queue *          pio_queue;            /*  1832     8*/
        struct xmit_priv           xmitpriv;             /*  1840   912*/
        /* --- cacheline 43 boundary (2752 bytes) --- */
        struct recv_priv           recvpriv;             /*  2752  1088*/
        /* --- cacheline 60 boundary (3840 bytes) --- */
        struct sta_priv            stapriv;              /*  3840   672*/
        /* --- cacheline 70 boundary (4480 bytes) was 32 bytes ago --- * */
        struct security_priv       securitypriv;         /*  4512  4816*/
        /* --- cacheline 145 boundary (9280 bytes) was 48 bytes ago --- * */
        struct registry_priv       registrypriv;         /*  9328   968*/
        /* --- cacheline 160 boundary (10240 bytes) was 56 bytes ago --- * */
        struct wlan_acl_pool       acl_list;             /* 10296  1536*/
        /* --- cacheline 184 boundary (11776 bytes) was 56 bytes ago --- * */
        struct pwrctrl_priv        pwrctrlpriv;          /* 11832   224*/
        /* --- cacheline 188 boundary (12032 bytes) was 24 bytes ago --- * */
        struct eeprom_priv         eeprompriv;           /* 12056   508*/

        /* XXX 4 bytes hole, try to pack */

        /* --- cacheline 196 boundary (12544 bytes) was 24 bytes ago --- * */
        struct hal_priv            halpriv;              /* 12568    88*/
        /* --- cacheline 197 boundary (12608 bytes) was 48 bytes ago --- * */
        struct led_priv            ledpriv;              /* 12656   304*/
        /* --- cacheline 202 boundary (12928 bytes) was 32 bytes ago --- * */
        struct mp_priv             mppriv;               /* 12960  1080*/
	 /* --- cacheline 219 boundary (14016 bytes) was 24 bytes ago * --- */
        s32                        bDriverStopped;       /* 14040     4*/
        s32                        bSurpriseRemoved;     /* 14044     4*/
        u32                        IsrContent;           /* 14048     4*/
        u32                        ImrContent;           /* 14052     4*/
        u8                         EepromAddressSize;    /* 14056     1*/
        u8                         hw_init_completed;    /* 14057     1*/

        /* XXX 6 bytes hole, try to pack */

        struct task_struct *       cmdThread;            /* 14064     8*/
        pid_t                      evtThread;            /* 14072     4*/

        /* XXX 4 bytes hole, try to pack */

        /* --- cacheline 220 boundary (14080 bytes) --- */
        struct task_struct *       xmitThread;           /* 14080     8*/
        pid_t                      recvThread;           /* 14088     4*/

        /* XXX 4 bytes hole, try to pack */

        uint                       (*dvobj_init)(struct _adapter *); /*14096     8 */
        void                       (*dvobj_deinit)(struct _adapter *);/* 14104     8 */
        struct net_device *        pnetdev;              /* 14112     8*/
        int                        bup;                  /* 14120     4*/

        /* XXX 4 bytes hole, try to pack */

        struct net_device_stats    stats;                /* 14128   184*/
        /* --- cacheline 223 boundary (14272 bytes) was 40 bytes ago --- * */
	 struct iw_statistics       iwstats;              /* 14312    32*/
        /* --- cacheline 224 boundary (14336 bytes) was 8 bytes ago --- * */
        int                        pid;                  /* 14344     4*/

        /* XXX 4 bytes hole, try to pack */

        struct work_struct         wkFilterRxFF0;        /* 14352    32*/
        u8                         blnEnableRxFF0Filter; /* 14384     1*/

        /* XXX 3 bytes hole, try to pack */

        spinlock_t                 lockRxFF0Filter;      /* 14388     4*/
        const struct firmware  *   fw;                   /* 14392     8*/
        /* --- cacheline 225 boundary (14400 bytes) --- */
        struct usb_interface *     pusb_intf;            /* 14400     8*/
        struct mutex               mutex_start;          /* 14408    40*/

        /* XXX last struct has 4 bytes of padding */

        struct completion          rtl8712_fw_ready;     /* 14448    32*/
        /* --- cacheline 226 boundary (14464 bytes) was 16 bytes ago --- * */

        /* size: 14480, cachelines: 227, members: 40 */
        /* sum members: 14451, holes: 7, sum holes: 29 */
        /* paddings: 1, sum paddings: 4 */
        /* last cacheline: 16 bytes */
};

Signed-off-by: Melike Yurtoglu <aysemelikeyurtoglu@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-02-26 15:08:36 -08:00
Melike Yurtoglu
c7c42826f9 Staging: rtl8712: replace memcpy() by ether_addr_copy() using coccinelle and pack variable
This patch focuses on fixing the following warning generated
by checkpatch.pl for the file rxtx.c

Prefer ether_addr_copy() over memcpy() if the Ethernet addresses
are __aligned(2)

@@ expression e1, e2; @@

- memcpy(e1, e2, ETH_ALEN);
+ ether_addr_copy(e1, e2);

struct _adapter {
        struct dvobj_priv          dvobjpriv;            /*     0    40*/
        struct mlme_priv           mlmepriv;             /*    40  1560*/
        /* --- cacheline 25 boundary (1600 bytes) --- */
        struct cmd_priv            cmdpriv;              /*  1600   136*/
        /* --- cacheline 27 boundary (1728 bytes) was 8 bytes ago --- */
        struct evt_priv            evtpriv;              /*  1736    96*/
        /* --- cacheline 28 boundary (1792 bytes) was 40 bytes ago --- * */
        struct io_queue *          pio_queue;            /*  1832     8*/
        struct xmit_priv           xmitpriv;             /*  1840   912*/
        /* --- cacheline 43 boundary (2752 bytes) --- */
        struct recv_priv           recvpriv;             /*  2752  1088*/
        /* --- cacheline 60 boundary (3840 bytes) --- */
        struct sta_priv            stapriv;              /*  3840   672*/
        /* --- cacheline 70 boundary (4480 bytes) was 32 bytes ago --- * */
        struct security_priv       securitypriv;         /*  4512  4816*/
        /* --- cacheline 145 boundary (9280 bytes) was 48 bytes ago --- * */
        struct registry_priv       registrypriv;         /*  9328   968*/
        /* --- cacheline 160 boundary (10240 bytes) was 56 bytes ago --- * */
        struct wlan_acl_pool       acl_list;             /* 10296  1536*/
        /* --- cacheline 184 boundary (11776 bytes) was 56 bytes ago --- * */
        struct pwrctrl_priv        pwrctrlpriv;          /* 11832   224*/
        /* --- cacheline 188 boundary (12032 bytes) was 24 bytes ago --- * */
        struct eeprom_priv         eeprompriv;           /* 12056   508*/

        /* XXX 4 bytes hole, try to pack */

        /* --- cacheline 196 boundary (12544 bytes) was 24 bytes ago --- * */
        struct hal_priv            halpriv;              /* 12568    88*/
        /* --- cacheline 197 boundary (12608 bytes) was 48 bytes ago --- * */
        struct led_priv            ledpriv;              /* 12656   304*/
        /* --- cacheline 202 boundary (12928 bytes) was 32 bytes ago --- * */
        struct mp_priv             mppriv;               /* 12960  1080*/
        /* --- cacheline 219 boundary (14016 bytes) was 24 bytes ago --- * */
        s32                        bDriverStopped;       /* 14040     4*/
        s32                        bSurpriseRemoved;     /* 14044     4*/
        u32                        IsrContent;           /* 14048     4*/
        u32                        ImrContent;           /* 14052     4*/
	 u8                         EepromAddressSize;    /* 14056     1*/
        u8                         hw_init_completed;    /* 14057     1*/

        /* XXX 6 bytes hole, try to pack */

        struct task_struct *       cmdThread;            /* 14064     8*/
        pid_t                      evtThread;            /* 14072     4*/

        /* XXX 4 bytes hole, try to pack */

        /* --- cacheline 220 boundary (14080 bytes) --- */
        struct task_struct *       xmitThread;           /* 14080     8*/
        pid_t                      recvThread;           /* 14088     4*/

        /* XXX 4 bytes hole, try to pack */

        uint                       (*dvobj_init)(struct _adapter *); /*14096     8 */
        void                       (*dvobj_deinit)(struct _adapter *);/* 14104     8 */
        struct net_device *        pnetdev;              /* 14112     8*/
        int                        bup;                  /* 14120     4*/

        /* XXX 4 bytes hole, try to pack */

        struct net_device_stats    stats;                /* 14128   184*/
        /* --- cacheline 223 boundary (14272 bytes) was 40 bytes ago --- * */
        struct iw_statistics       iwstats;              /* 14312    32*/
        /* --- cacheline 224 boundary (14336 bytes) was 8 bytes ago --- * */
        int                        pid;                  /* 14344     4*/

        /* XXX 4 bytes hole, try to pack */

        struct work_struct         wkFilterRxFF0;        /* 14352    32*/
        u8                         blnEnableRxFF0Filter; /* 14384     1*/

        /* XXX 3 bytes hole, try to pack */

        spinlock_t                 lockRxFF0Filter;      /* 14388     4*/
        const struct firmware  *   fw;                   /* 14392     8*/
	 u8                         EepromAddressSize;    /* 14056     1*/
        u8                         hw_init_completed;    /* 14057     1*/

        /* XXX 6 bytes hole, try to pack */

        struct task_struct *       cmdThread;            /* 14064     8*/
        pid_t                      evtThread;            /* 14072     4*/

        /* XXX 4 bytes hole, try to pack */

        /* --- cacheline 220 boundary (14080 bytes) --- */
        struct task_struct *       xmitThread;           /* 14080     8*/
        pid_t                      recvThread;           /* 14088     4*/

        /* XXX 4 bytes hole, try to pack */

        uint                       (*dvobj_init)(struct _adapter *); /*14096     8 */
        void                       (*dvobj_deinit)(struct _adapter *);/* 14104     8 */
        struct net_device *        pnetdev;              /* 14112     8*/
        int                        bup;                  /* 14120     4*/

        /* XXX 4 bytes hole, try to pack */

        struct net_device_stats    stats;                /* 14128   184*/
        /* --- cacheline 223 boundary (14272 bytes) was 40 bytes ago --- * */
        struct iw_statistics       iwstats;              /* 14312    32*/
        /* --- cacheline 224 boundary (14336 bytes) was 8 bytes ago --- * */
        int                        pid;                  /* 14344     4*/

        /* XXX 4 bytes hole, try to pack */

        struct work_struct         wkFilterRxFF0;        /* 14352    32*/
        u8                         blnEnableRxFF0Filter; /* 14384     1*/

        /* XXX 3 bytes hole, try to pack */

        spinlock_t                 lockRxFF0Filter;      /* 14388     4*/
        const struct firmware  *   fw;                   /* 14392     8*/
	/* --- cacheline 225 boundary (14400 bytes) --- */
        struct usb_interface *     pusb_intf;            /* 14400     8*/
        struct mutex               mutex_start;          /* 14408    40*/

        /* XXX last struct has 4 bytes of padding */

        struct completion          rtl8712_fw_ready;     /* 14448    32*/
        /* --- cacheline 226 boundary (14464 bytes) was 16 bytes ago --- * */

        /* size: 14480, cachelines: 227, members: 40 */
        /* sum members: 14451, holes: 7, sum holes: 29 */
        /* paddings: 1, sum paddings: 4 */
        /* last cacheline: 16 bytes */
};

Signed-off-by: Melike Yurtoglu <aysemelikeyurtoglu@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-02-26 15:08:36 -08:00
Gamze POLAT
da07768909 staing: rtl8712: else after return or break warning
This patch fixes checkpatch.pl warning.
WARNING: else is not generally useful after a break or return

Signed-off-by: Gamze POLAT <gamzepolat94@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-02-26 15:08:36 -08:00
Michael Hornung
21fa7be013 staging: rtl8712: Do coding style cleanup
* Fix checkpatch.pl warnings "Fix missing space after return type warning".

Signed-off-by: Michael Hornung <mhornung.linux@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-02-07 17:39:50 +08:00
Nicholas Mc Guire
1ba2c5a808 staging: rtl8712: condition with no effect removed
The check for return of schedule_timeout() has no effect on the
effective control flow of sleep_schedulable() so it can be dropped.

Signed-off-by: Nicholas Mc Guire <der.herr@hofr.at>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-02-07 17:24:59 +08:00
Nicholas Mc Guire
7dfb6d2ec4 staging: rtl8712: cleanup of timeout conversions
This is only an API consolidation to make things more readable.
Instances of  var * HZ / 1000  are replaced by  msecs_to_jiffies(var).
As msecs_to_jiffies will return > 0 if it is passed a value > 0 the
== 0 check is not needed.

Signed-off-by: Nicholas Mc Guire <der.herr@hofr.at>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-02-07 17:24:11 +08:00
Heba Aamer
36e4d8826b staging: rtl8712: fix Prefer ether_addr_copy() over memcpy()
This patch fixes the following checkpatch.pl warning:
Prefer ether_addr_copy() over memcpy()
if the Ethernet addresses are __aligned(2)

pahole showed that the struct used pnetdev->dev_addr
is aligned to u16.

Moreover mac is a simple array, pdata is a pointer that
starts from an even offset.

Signed-off-by: Heba Aamer <heba93aamer@gmail.com>
Acked-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-02-07 17:15:43 +08:00
Heba Aamer
1007c69226 staging: rtl8712: remove useless printing line
This patch removes an unneeded call to printk.

Signed-off-by: Heba Aamer <heba93aamer@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-01-28 10:56:49 -08:00
Sudip Mukherjee
7046808627 staging: rtl8712: remove unused function
mp_query_drv_var() was only being used by
oid_rt_pro_query_dr_variable_hdl() but after commit
<f4f5a59ff2e746885be3c1c06c1d0e8861a10ce8> mp_query_drv_var() became
unused. so it is safe to remove it.

Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-01-25 19:59:19 +08:00
Rickard Strandqvist
b086d02b44 staging: rtl8712: recv_linux: Remove unused function
Remove the function r8712_os_read_port() that is not used anywhere.

This was partially found by using a static code analysis program called cppcheck.

Signed-off-by: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-01-25 19:59:18 +08:00
Max Perepelitsyn
0636b4603f staging: rtl8712: remove spaces before commas
checkpatch.pl fix for
ERROR: space prohibited before that ',' (ctx:WxE)

Signed-off-by: Max Perepelitsyn <mperepelitsyn@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-01-17 14:20:25 -08:00
Rickard Strandqvist
f4f5a59ff2 staging: rtl8712: rtl871x_mp_ioctl.c: Remove some unused functions
Removes some functions that are not used anywhere:
oid_rt_pro_h2c_get_rate_table_hdl() oid_rt_pro_h2c_set_rate_table_hdl()
oid_rt_pro_set_pwrstate_hdl() oid_rt_pro_qry_pwrstate_hdl()
oid_rt_pro_set_basic_rate_hdl() oid_rt_pro_set_power_tracking_hdl()
oid_rt_pro_set_data_rate_ex_hdl() oid_rt_pro_cfg_debug_message_hdl()
oid_rt_poll_rx_status_hdl() oid_rt_pro_set_rf_intfs_hdl()
oid_rt_wr_attrib_mem_hdl() oid_rt_rd_attrib_mem_hdl()
oid_rt_pro8711_pkt_loss_hdl() oid_rt_pro8711_wi_poll_hdl()
oid_rt_pro_write16_eeprom_hdl() oid_rt_pro_read16_eeprom_hdl()
oid_rt_pro_write_txcmd_hdl() oid_rt_pro_burst_write_register_hdl()
oid_rt_pro_burst_read_register_hdl() oid_rt_pro8711_join_bss_hdl()
oid_rt_pro_set_pkt_test_mode_hdl() oid_rt_pro_set_tx_agc_offset_hdl()
oid_rt_set_crystal_cap_hdl() oid_rt_pro_rw_efuse_pgpkt_hdl()
oid_rt_pro_rx_packet_type_hdl() oid_rt_pro_query_dr_variable_hdl()
oid_rt_pro_dele_sta_info_hdl() oid_rt_pro_add_sta_info_hdl()
oid_rt_pro_encryption_ctrl_hdl()

This was partially found by using a static code analysis program called cppcheck.

Signed-off-by: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-01-17 14:10:03 -08:00
Paul Hedman
3002b1a601 Staging: rtl8712: Fixes brace coding style in rtl871x_sta_mgt.c
This patch fixes a brace warning in rtl871x_sta_mgt.c found
by the checkpatch.pl tool.

Signed-off-by: Paul Hedman <paul@mybb.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-01-12 19:54:17 -08:00
Mike Krinkin
68de8d6734 staging: rtl8712: remove unnecessary else after return
Fixes checkpatch warning:
WARNING: else is not generally useful after a break or return

Signed-off-by: Mike Krinkin <krinkin.m.u@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-12-02 16:54:43 -08:00
Sudip Mukherjee
e29d3ebcda staging: rtl8712: remove unused variables
unused variables are removed. These variables were only assigned some
values and after that they were never being used. So they are safe to
be removed , and it has been build tested.

I left a call to r8712_read32(padapter, TCR) and
r8712_read8(padapter, SDIO_HCPWM) .

r8712_read32() and r8712_read8() is ultimately calling usb_read32()
and usb_read8() respectively. and they are again calling
r8712_usbctrl_vendorreq().
this r8712_usbctrl_vendorreq() is communicating through the usb bus
and is sending and receiving the control msg.

Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-10-29 17:37:26 +08:00
Rasmus Villemoes
eecc515a1b staging: rtl8712: Remove redundant cast
struct firmware::data has type const u8*, as does *ppmappedfw, so the
cast to u8* is unnecessary and slightly confusing.

Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-10-29 17:32:41 +08:00
Esra Altintas
3ad96c140d staging: rtl8712: Fix unnecessary parentheses style warning in rtl871x_xmit.c
This fixes the following checkpatch.pl warning:
WARNING: Unnecessary parentheses - maybe == should be = ?

Signed-off-by: Esra Altintas <es.altintas@gmail.com>
Reviewed-by: Josh Triplett <josh@joshtriplett.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-10-20 10:29:28 +08:00
Serguey Parkhomovsky
a15522c0a4 staging: rtl8712: fix unnecessary elses after return/break in rtl8712_efuse.c
This patch fixes two unnecessary else conditions that were found by checkpatch.pl.

Signed-off-by: Serguey Parkhomovsky <sergueyparkhomovsky@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-10-20 10:29:26 +08:00
Nitin Kuppelur
e92c3511b9 Staging: rtl8712:ieee80211 remove unnecessary else
Removed unnecessary else after return/break to solve
checkpatch.pl warning

Signed-off-by: Nitin Kuppelur <nitinkuppelur@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-10-20 10:29:26 +08:00
Tapasweni Pathak
646da830fd staging: rtl8712: Remove unnecessary cast for argument of kfree
This patch removes all occurrences of unnecessary cast on the
argument to kfree, all over in rtl8712.

There is no need of the cast on the argument to kfree.

Greped to find occurrences.

Signed-off-by: Tapasweni Pathak <tapaswenipathak@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-10-20 10:29:19 +08:00
Tapasweni Pathak
366ba42703 staging: rtl8712: Delete explicit comparison with false and NULL
This patch delete explicit comparison to false and NULL in files of
rtl8712.

Signed-off-by: Tapasweni Pathak <tapaswenipathak@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-10-20 10:29:11 +08:00
Sarah Khan
14ad732c2d staging: rtl8712: Fixed else not required after return
WARNING: else is generally not required after return
checkpatch.pl warning in osdep_service.h

Signed-off-by: Sarah Khan <sarahjmi07@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-10-20 10:29:11 +08:00
Tapasweni Pathak
f44b902adf staging: rtl8712: Replace "the the " with "the"
This patch replace "the the " with "the".
The replacement couldn't be automated because sometimes
the first "the" was meant to be another word.

Signed-off-by: Tapasweni Pathak <tapaswenipathak@gmail.com>
Acked-by: Daniel Baluta <daniel.baluta@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-10-20 10:29:11 +08:00
Sarah Khan
bc394a39cb staging: rtl8712: Fixed else not required after return
WARNING: Else generally not required after return
checkpatch.pl warning in hal_init.c
Fixed by removing else

Signed-off-by: Sarah Khan <sarahjmi07@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-10-02 11:59:40 -07:00
Melike Yurtoglu
4eaef85670 staging: rtl8712: Fix missing blank line warning
Fixes "Missing a blank line after declarations" checkpatch.pl warning in
usb_ops_linux.c

Signed-off-by: Melike Yurtoglu <aysemelikeyurtoglu@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-10-02 11:59:40 -07:00
Yeliz Taneroglu
12636551a2 staging: rtl8712: Fix unnecessary parentheses style warning
This fixes the following checkpatch.pl warning:

drivers/staging/rtl8712/rtl871x_recv.c:634 warning: Unnecessary parentheses - maybe == should be = ?

Signed-off-by: Yeliz Taneroglu <yeliztaneroglu@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-10-02 10:15:12 -07:00
Tapasweni Pathak
02a29d2d92 staging: rtl8712: add new line after declarations
This patch fixes checkpatch.pl warning in hal_init.c file
WARNING : Missing a blank line after declarations

Signed-off-by: Tapasweni Pathak <tapaswenipathak@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-09-28 22:41:23 -04:00
Sarah Khan
6a7cbc38ad staging: rtl8712: fixed missing blank line
WARNING : Missing a blank line after declaration
checkpatch.pl warning in hal_init.c

Signed-off-by: Sarah Khan <sarahjmi07@gmail.com>
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-09-23 20:33:23 -07:00
Tapasweni Pathak
ddcb81e741 staging: rtl8712: merge lines and remove unused variable for immediate return
This patch merge two lines in a single line if immediate return is found.
Unused variables in each case were removed manually as they are no longer
needed.

This is done using Coccinelle. Semantic patch used for this is as
follows :
@@
expression ret;
identifier f;
@@

-ret =
+return
     f(...);
-return ret;

Signed-off-by: Tapasweni Pathak <tapaswenipathak@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-09-23 08:14:37 -07:00
Tapasweni Pathak
a988265c61 Staging: rtl8712: Add space after return type
This patch fixes checkpatch.pl warning in file rtl871x_ioctl.h
WARNING : Missing space after return type

Signed-off-by: Tapasweni Pathak <tapaswenipathak@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-09-23 08:14:36 -07:00
Tapasweni Pathak
c08242008a Staging: rtl8712: Remove unnecessary parentheses
This patch fixes checkpatch.pl warning in files of rel8712
WARNING : Unnecessary parentheses - maybe == should be = ?

Signed-off-by: Tapasweni Pathak <tapaswenipathak@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-09-23 08:14:36 -07:00
Tapasweni Pathak
57b6686ebb Staging: rtl8712 : Fix line over 80 characters
This patch fixes checkpatch.pl warning in files of rtl8712
WARNING : line over 80 characters

Signed-off-by: Tapasweni Pathak <tapaswenipathak@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-09-23 08:14:36 -07:00
Tapasweni Pathak
9d76a7e4dc Staging: rtl8712: use kmalloc_array over kmalloc
This patch fixes checkpatch.pl warning in file rtl871x_xmit.c
WARNING : prefer kmalloc_array over kmalloc with multiply

Signed-off-by: Tapasweni Pathak <tapaswenipathak@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-09-23 08:11:56 -07:00
Tapasweni Pathak
15a4db9268 Staging: rtl8712: remove unnecessary 'out of memory' message
This patch fixes checkpatch.pl warning in file usb_ops_linux.c
WARNING : possible unecessary 'out of memory' message

Signed-off-by: Tapasweni Pathak <tapaswenipathak@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-09-23 08:08:58 -07:00
Tapasweni Pathak
b105374c51 Staging: rtl8712: fixed space prohibition
This patch fixes checkpatch.pl warning in file rtl871x_io.h
WARNING : space prohibited before semicolon

Signed-off-by: Tapasweni Pathak <tapaswenipathak@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-09-23 08:08:58 -07:00
Tapasweni Pathak
fbdba9c10b Staging: rtl8712: remove void function return; statement
This patch fixes checkpatch.pl warning in files of rtl8712
WARNING : void function return statement are not generally useful

Signed-off-by: Tapasweni Pathak <tapaswenipathak@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-09-23 08:04:57 -07:00
Tapasweni Pathak
a2955b144b Staging: rtl8712: remove semicolon after macro
This patch fixes checkpatch.pl warning in rtl871x_mp.h file
WARNING : Macro should not use a trailing semicolon

Signed-off-by: Tapasweni Pathak <tapaswenipathak@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-09-23 08:04:57 -07:00
Aybuke Ozdemir
c5861b738a Staging: rtl8712: Missing a blank line after declarations
This patch fixes these warning messages found by checkpatch.pl:
WARNING : Missing a blank line after declarations.

Signed-off-by: Aybuke Ozdemir <aybuke.147@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-09-23 08:02:31 -07:00
Aybuke Ozdemir
b631ecd70e Staging: rtl8712: Remove unnecessary parentheses.
This patch fixes checkpatch.pl warning
Unnecessary parentheses in rtl871x_xmit.c

Signed-off-by: Aybuke Ozdemir <aybuke.147@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-09-23 08:02:31 -07:00
Tapasweni Pathak
730cb373f3 Staging: rtl8712: remove break after return statement
This patch fixes checkpatch.pl warning in rtl871x_ioctl_linux.c file
WARNING : break is not useful after goto or return

Signed-off-by: Tapasweni Pathak <tapaswenipathak@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-09-23 08:02:06 -07:00
Santiago Torres
89a07bd83a staging:rtl8712:mlme_linux.c: Adds blank lines to pass checkpatch.pl
Added three newlines after variable declarations to pass checkpatch.pl.

Signed-off by: Santiago Torres-Arias <torresariass@gmail.com>

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-07-30 17:05:56 -07:00
James A Shackleford
fee51243ee staging: rtl8712: remove wrapper function thread_enter()
The inline function thread_enter() accepts a single ignored parameter and is
just a wrapper for allow_signal(SIGTERM).  Removed.

Signed-off-by: James A Shackleford <shack@linux.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-07-09 21:17:50 -07:00
James A Shackleford
143198fd31 staging: rtl8712: remove #define _workitem struct work_struct
_workitem is just a #define for work_struct.  Remove the #define and
use struct work_struct directly instead.

Signed-off-by: James A Shackleford <shack@linux.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-07-09 12:30:46 -07:00
James A Shackleford
f2355b69ef staging: rtl8712: remove wrapper function _set_workitem()
The inline function _set_workitem() simply wraps schedule_work().  Removed.

Signed-off-by: James A Shackleford <shack@linux.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-07-09 12:30:46 -07:00
James A Shackleford
9f952489fd staging: rtl8712: remove wrapper function _init_workitem()
The inline function _init_workitem() is just a wrapper around INIT_WORK().
Oddly, this wrapper accepts 3 parameters while INIT_WORK() only accepts 2.
The third parameter is unused.

Signed-off-by: James A Shackleford <shack@linux.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-07-09 12:30:46 -07:00
James A Shackleford
bbcd2d258a staging: rtl8712: remove inapplicable comment
Signed-off-by: James A Shackleford <shack@linux.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-06-26 20:33:16 -04:00
James A Shackleford
df353f61af staging: rtl8712: remove wrapper function _queue_empty
_queue_empty is an inline wrapper around list_empty.  This patch removes this
wrapper function and instead calls list_empty directly.

Signed-off-by: James A Shackleford <shack@linux.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-06-26 20:33:16 -04:00
James A Shackleford
e99a428a1d staging: rtl8712: remove function get_list_head
get_list_head is an inline that returns &list->head.  This patch removes this
inline and directly applies &list->head where applicable.

Signed-off-by: James A Shackleford <shack@linux.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-06-26 20:33:16 -04:00
James A Shackleford
849fb0a887 staging: rtl8712: remove wrapper function get_next
get_next is just an inline wrapper around return list->next.  This
patch removes the wrapper and directly uses list->next where
applicable.

Signed-off-by: James A Shackleford <shack@linux.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-06-26 20:33:16 -04:00
James A Shackleford
29197b7c45 staging: rtl8712: remove wrapper function list_delete
list_delete is just an inline wrapper around list_del_init.  This patch
removes the wrapper and directly uses list_del_init.

Signed-off-by: James A Shackleford <shack@linux.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-06-26 20:33:15 -04:00
James A Shackleford
fdfbf7890d staging: rtl8712: remove wrapper function list_insert_tail
list_insert_tail is just an inline wrapper around list_add_tail.  This
patch removes the wrapper and directly uses list_add_tail.

Signed-off-by: James A Shackleford <shack@linux.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-06-26 20:33:15 -04:00
James A Shackleford
9672b1bd83 staging: rtl8712: remove wrapper function is_list_empty
is_list_empty is just an inline wrapper around list_empty.  This patch
removes the wrapper and directly uses list_empty instead.

Signed-off-by: James A Shackleford <shack@linux.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-06-26 20:33:15 -04:00
James A Shackleford
534c4acd1d staging: rtl8712: remove wrapper function _init_listhead
_init_listhead is just an inline wrapper around INIT_LIST_HEAD.  This
patch removes the wrapper and directly uses INIT_LIST_HEAD instead.

Signed-off-by: James A Shackleford <shack@linux.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-06-26 20:33:15 -04:00
James A Shackleford
084e5d285d staging: rtl8712: remove unused inline _RND512()
Signed-off-by: James A Shackleford <shack@linux.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-06-26 20:31:02 -04:00
James A Shackleford
d6a61ba40c staging: rtl8712: remove unused inline _RND256()
Signed-off-by: James A Shackleford <shack@linux.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-06-26 20:31:02 -04:00
James A Shackleford
fa86745332 staging: rtl8712: remove inline _RND128() and use round_up()
Signed-off-by: James A Shackleford <shack@linux.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-06-26 20:31:02 -04:00
James A Shackleford
d913e54ef0 staging: rtl8712: remove inline _RND8() and use round_up()
Signed-off-by: James A Shackleford <shack@linux.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-06-26 20:31:02 -04:00
Vitaly Osipov
bd9dc62c36 staging: rtl8712: replace kmalloc(..., sizeof(T))
As suggested by Andy Shevchenko on driverdev-devel, replace
v = ... sizeof(struct type_of_v) -> sizeof(*v)

Based on a cocci patch along the lines of

@@
type T;
expression E;
identifier V;
@@

T *V;
...
- V = kmalloc(sizeof(T), E);
+ V = kmalloc(sizeof(*V), E);

@@
type T;
expression E;
identifier V;
@@

T *V;
...
- V = kzalloc(sizeof(T), E);
+ V = kzalloc(sizeof(*V), E);

Signed-off-by: Vitaly Osipov <vitaly.osipov@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-06-19 16:44:06 -07:00
Rickard Strandqvist
3ae70746d0 staging: rtl8712: rtl871x_ioctl_linux.c: Cleaning up useless if statement
The same code regardless of the outcome of the if statement.
And clean up another duplicate line of code.

Signed-off-by: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-06-19 16:44:06 -07:00
Arnd Bergmann
0c9f3a65c5 staging: rtl8712, rtl8712: avoid lots of build warnings
The rtl8712 driver has an 'extern inline' function that contains an
'if', which causes lots of warnings with CONFIG_PROFILE_ALL_BRANCHES
overriding the definition of 'if':

drivers/staging/rtl8712/ieee80211.h:759:229: warning: '______f' is static but declared in inline function 'ieee80211_get_hdrlen' which is not static [enabled by default]

This changes the driver to use 'static inline' instead, which happens
to be the correct annotation anyway.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Cc: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Florian Schilhabel <florian.c.schilhabel@googlemail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-06-19 16:44:04 -07:00
Thomas Vegas
22649bb2b6 staging: rtl8712: Remove useless variable 'fw_found'
The net device only exists when firmware is loaded successfully.
Firmware presence variable is only used through r871xu_dev_remove() and
this function already checks for net device existence.

Signed-off-by: Thomas Vegas <thomas@grouk.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-06-19 16:40:07 -07:00
Thomas Vegas
5947956bdc staging: rtl8712: Fix oops on dongle removal if firmware is not available
When firmware is not available, net device is not created. Upon
disconnect, we must check for net device existence before trying to
release net device private data.

Signed-off-by: Thomas Vegas <thomas@grouk.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-06-19 16:40:07 -07:00
Vitaly Osipov
735e33fa32 staging: rtl8712: return -ENOMEM instead of -1
After the commit 91d435f replaced _malloc with kmalloc, smatch picked up a
couple of new warnings. This fixes the warning:

warn: returning -1 instead of -ENOMEM is sloppy

Signed-off-by: Vitaly Osipov <vitaly.osipov@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-05-27 11:55:29 -07:00
Vitaly Osipov
efc273ce34 staging: rtl8712: fix kmalloc parameters
After the commit 91d435f replaced _malloc with kmalloc, smatch picked up a
couple of new warnings. This fixes warnings:

warn: struct type mismatch 'writePTM_parm vs setdig_parm'
warn: struct type mismatch 'writePTM_parm vs setra_parm'

The difference is u8 vs unsigned char.

Signed-off-by: Vitaly Osipov <vitaly.osipov@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-05-27 11:55:29 -07:00
Vitaly Osipov
91d435fe36 staging: rtl8712: remove _malloc()
This patch removes all usage of _malloc() and the function itself. Most
uses are straightforward replacements by kmalloc(..., GFP_ATOMIC),
because this was the definition of _malloc(). In a few places it
was possible to use kzalloc() or memdup_user.

A further improvement would be to replace GFP_ATOMIC with GFP_KERNEL
where possible.

Verified by compilation only.

Initial replacement done by running a Coccinelle script along the lines
of:

@@
type T;
expression E;
identifier V;
@@
- V = (T) _malloc(E);
+ V = kmalloc(E, GFP_ATOMIC);

@@
expression E, E1;
@@
- E1 = _malloc(E);
+ E1 = kmalloc(E, GFP_ATOMIC);

Signed-off-by: Vitaly Osipov <vitaly.osipov@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-05-25 11:04:44 -07:00
Peter Senna Tschudin
8ffca9eae6 staging: r8712u: Remove useless return variables
This patch remove variables that are initialized with a constant,
are never updated, and are only used as parameter of return.
Return the constant instead of using a variable.

Verified by compilation only.

The coccinelle script that find and fixes this issue is:
// <smpl>
@@
type T;
constant C;
identifier ret;
@@
- T ret = C;
... when != ret
- return ret;
+ return C;
// </smpl>

Signed-off-by: Peter Senna Tschudin <peter.senna@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-05-24 02:17:18 +09:00
Rickard Strandqvist
ac082bc52d staging: rtl8712: usb_intf.c: Fix for possible null pointer dereference
There is otherwise a risk of a possible null pointer dereference.

Was largely found by using a static code analysis program called cppcheck.

Signed-off-by: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se>
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-05-24 01:58:22 +09:00
Marcus Farkas
265b8e5f85 staging: rtl8712: fix unnecessary line continuations
This commit fixes the following checkpatch warning:

rtl8712/rtl871x_security.c
    - 1178: WARNING: Avoid unnecessary line continuations

Signed-off-by: Marcus Farkas <marcus.farkas@finitebox.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-05-24 01:57:15 +09:00
Marcus Farkas
0ac07ce022 staging: rtl8712: fix unnecessary parentheses
This commit fixes the following checkpatch warnings:

rtl8712/rtl871x_security.c
    - 1167: WARNING: Unnecessary parentheses - maybe == should be = ?
    - 1374: WARNING: Unnecessary parentheses - maybe == should be = ?

Signed-off-by: Marcus Farkas <marcus.farkas@finitebox.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-05-24 01:57:15 +09:00
Marcus Farkas
4679934a72 staging: rtl8712: fix missing blank lines after declarations
This commit fixes the following checkpatch warnings:

rtl8712/rtl871x_security.c
    - 275: WARNING: Missing a blank line after declarations
    - 768: WARNING: Missing a blank line after declarations
    - 801: WARNING: Missing a blank line after declarations

Signed-off-by: Marcus Farkas <marcus.farkas@finitebox.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-05-24 01:57:15 +09:00
Christian Engelmayer
2af9e74ae6 staging: rtl8712: fix potential leaks in r8712_set_key()
Fix potential leaks in the error paths of r8712_set_key(). In case the
algorithm specific checks fail, the function returns without enqueuing
or freeing the already allocated command and parameter structs. Use a
centralized exit path and make sure that all memory is freed correctly.
Detected by Coverity - CID 144370, 144371.

Signed-off-by: Christian Engelmayer <cengelma@gmx.at>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-05-24 01:57:14 +09:00
Christian Engelmayer
55d4f6cc4c staging: rtl8712: fix potential leak in r871x_wx_set_enc_ext()
Fix a potential leak in the error path of r871x_wx_set_enc_ext(). In case the
requested algorithm is not supported by the driver, the function returns
without freeing the already allocated 'param' struct. Move the input
verification to the beginning of the function so that the direct return is
safe. Detected by Coverity - CID 144373.

Signed-off-by: Christian Engelmayer <cengelma@gmx.at>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-05-24 01:57:14 +09:00
Larry Finger
f764cd68d9 staging: r8712u: Fix case where ethtype was never obtained and always be checked against 0
Zero-initializing ether_type masked that the ether type would never be
obtained for 8021x packets and the comparison against eapol_type
would always fail.

Reported-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Stable <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-04-16 13:07:19 -07:00
Linus Torvalds
159d8133d0 Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial
Pull trivial tree updates from Jiri Kosina:
 "Usual rocket science -- mostly documentation and comment updates"

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial:
  sparse: fix comment
  doc: fix double words
  isdn: capi: fix "CAPI_VERSION" comment
  doc: DocBook: Fix typos in xml and template file
  Bluetooth: add module name for btwilink
  driver core: unexport static function create_syslog_header
  mmc: core: typo fix in printk specifier
  ARM: spear: clean up editing mistake
  net-sysfs: fix comment typo 'CONFIG_SYFS'
  doc: Insert MODULE_ in module-signing macros
  Documentation: update URL to hfsplus Technote 1150
  gpio: update path to documentation
  ixgbe: Fix format string in ixgbe_fcoe.
  Kconfig: Remove useless "default N" lines
  user_namespace.c: Remove duplicated word in comment
  CREDITS: fix formatting
  treewide: Fix typo in Documentation/DocBook
  mm: Fix warning on make htmldocs caused by slab.c
  ata: ata-samsung_cf: cleanup in header file
  idr: remove unused prototype of idr_free()
2014-04-02 16:23:38 -07:00
Gulsah Kose
ba2ac29ed6 staging: rtl8712: Fix multiple spaces after return type
Fix checkpatch.pl issues with multiple spaces after return type in
drv_types.h

Signed-off-by: Gulsah Kose <gulsah.1004@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-03-18 12:06:31 -07:00
Aybuke Ozdemir
9ab3726b7e staging/rtl8712/osdep_service.h Fix line over 80 characters.
Fix checkpatch.pl issues with
line over 80 characters in osdep_service.h

Signed-off-by: Aybuke Ozdemir <aybuke.147@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-03-18 12:06:31 -07:00
Andreea-Cristina Bernat
774448dc60 staging: rtl8712: Delete space before semicolon
This patch solves the warning: "space prohibited before semicolon".

Signed-off-by: Andreea-Cristina Bernat <bernat.ada@gmail.com>
Acked-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Signed-off-by: Peter P Waskiewicz Jr <peter.p.waskiewicz.jr@intel.com>
2014-03-13 17:36:40 -07:00
Gulsah Kose
34a2c5fe5b staging: rtl8712: Remove unnecessary parentheses.
Remove unnecessary parentheses from rtl871x_cmd.c

Signed-off-by: Gulsah Kose <gulsah.1004@gmail.com>
Acked-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Signed-off-by: Peter P Waskiewicz Jr <peter.p.waskiewicz.jr@intel.com>
2014-03-13 16:49:16 -07:00
Himangi Saraogi
0f11b53dbc staging:rtl8712: Fix sparse warning incorrect type in assignment
This patch fixes the following sparse warnings:

drivers/staging/rtl8712/rtl871x_cmd.c:471:30: warning: incorrect type in
assignment (different base types)
drivers/staging/rtl8712/rtl871x_cmd.c:471:30:    expected unsigned int
[unsigned] [usertype] Length
drivers/staging/rtl8712/rtl871x_cmd.c:471:30:    got restricted __le32
[usertype] <noident>
drivers/staging/rtl8712/rtl871x_cmd.c:472:32: warning: incorrect type in
assignment (different base types)
drivers/staging/rtl8712/rtl871x_cmd.c:472:32:    expected unsigned int
[unsigned] [usertype] IELength
drivers/staging/rtl8712/rtl871x_cmd.c:472:32:    got restricted __le32
[usertype] <noident>
drivers/staging/rtl8712/rtl871x_cmd.c:473:39: warning: incorrect type in
assignment (different base types)
drivers/staging/rtl8712/rtl871x_cmd.c:473:39:    expected unsigned int
[unsigned] [usertype] SsidLength
drivers/staging/rtl8712/rtl871x_cmd.c:473:39:    got restricted __le32
[usertype] <noident>

Signed-off-by: Himangi Saraogi <himangi774@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-03-07 15:48:19 -08:00
Dan Carpenter
b16aad354a Staging: rtl8712: fix an error test in start_drv_threads()
Testing for "if (IS_ERR(padapter->cmdThread) < 0)" doesn't make sense.
The kthread_run() function returns error pointers on error pointers on
error so it should just be "if (IS_ERR(padapter->cmdThread))".

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-03-06 11:58:32 -08:00
Dan Carpenter
879cb0c986 staging: rtl8712: fix some confusing indenting
These set off a static checker warning about "warn: add curly braces?",
but actually the code it correct, it's just the indenting which is
wrong.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-03-06 11:58:32 -08:00
Jiri Kosina
d4263348f7 Merge branch 'master' into for-next 2014-02-20 14:54:28 +01:00
Paul Bolle
c7dcec7dd4 Kconfig: Remove useless "default N" lines
A number of Kconfig entries default to (uppercase) "N". It was clearly
intended to use "default n". But since (lowercase) "n" is the default
anyway, these lines might as well be removed.

Signed-off-by: Paul Bolle <pebolle@tiscali.nl>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2014-02-20 14:38:06 +01:00
Julia Lawall
4bb101d4f2 staging: r8712u: delete unnecessary field initialization
On success, the function netdev_alloc_skb initializes the dev field of its
result to its first argument, so this doesn't have to be done in the
calling context.

The semantic patch that fixes this problem is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@@
expression skb,privn,e;
@@

skb = netdev_alloc_skb(privn,...);
... when strict
(
-skb->dev = privn;
|
?skb = e
)
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-02-15 12:32:55 -08:00
Larry Finger
3a21f00a50 staging: r8712u: Set device type to wlan
The latest version of NetworkManager does not recognize the device as wireless
without this change.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Stable <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-01-09 10:35:25 -08:00
Paul Gortmaker
885a947e5b staging: delete non-required instances of include <linux/init.h>
None of these files are actually using any __init type directives
and hence don't need to include <linux/init.h>.  Most are just a
left over from __devinit and __cpuinit removal, or simply due to
code getting copied from one driver to the next.

Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-12-17 10:08:14 -08:00
Alexandre Demers
a762771445 staging r8712u: Remove useless netdev_info slowly polluting dmesg
Remove useless netdev_info slowly flooding dmesg.
Fixes bug https://bugzilla.kernel.org/show_bug.cgi?id=64231

Signed-off-by: Alexandre Demers <alexandre.f.demers@gmail.com>
Acked-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-11-25 11:57:53 -08:00
Thomas Cort
77e73e8c90 Staging: rtl8712: fix spaces before semicolons
Resolve all of the 'WARNING: space prohibited before semicolon'
checkpatch warnings for rtl8712.

Signed-off-by: Thomas Cort <linuxgeek@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-10-03 13:50:54 -07:00
Dan Carpenter
a376932a93 staging: rtl8712: remove unneeded NULL check
We knew "peventbuf" was a valid pointer and "peventbuf + 2" is also
non-NULL.  I have removed the check.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-09-30 18:42:06 -07:00
Andy Shevchenko
30765436fd staging: rtl8712: re-use native mac_pton() helper
There is a nice helper to parse MAC. Let's use it and remove custom
implementation.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-09-17 07:47:46 -07:00