firefly-linux-kernel-4.4.55.git
10 years agostaging: unisys: fix ULTRA_SPAR_CHANNEL_CLIENT_CHK_TRANSITION macro
Benjamin Romer [Thu, 23 Oct 2014 18:29:58 +0000 (14:29 -0400)]
staging: unisys: fix ULTRA_SPAR_CHANNEL_CLIENT_CHK_TRANSITION macro

Rename the macro to SPAR_CHANNEL_CLIENT_CHK_TRANSITION, and rename
CamelCase parameters to:

chanId => id
logCtx => log

Signed-off-by: Benjamin Romer <benjamin.romer@unisys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: unisys: clean up ULTRA_CHANNEL_SERVER_READY macro
Benjamin Romer [Thu, 23 Oct 2014 18:29:57 +0000 (14:29 -0400)]
staging: unisys: clean up ULTRA_CHANNEL_SERVER_READY macro

Simplify this macro so it is only one macro, rename it to
SPAR_CHANNEL_SERVER_READY, and get rid of the CamelCase parameter name.

Signed-off-by: Benjamin Romer <benjamin.romer@unisys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: unisys: fix CamelCase names in struct channel_header
Benjamin Romer [Thu, 23 Oct 2014 18:29:56 +0000 (14:29 -0400)]
staging: unisys: fix CamelCase names in struct channel_header

Fix CamelCase names:
Signature => signature
LegacySignature => legacy_signature
HeaderSize => header_size
Size => size
Features => features
Type => chtype
PartitionHandle => partition_handle
Handle => handle
oChannelSpace => ch_space_offset
VersionId => version_id
PartitionIndex => partition_index
ZoneGuid => zone_uuid
oClientString => cli_str_offset
CliStateBoot => cli_state_boot
CmdStateCli => cmd_state_cli
CliStateOs => cli_state_os
ChannelCharacteristics => ch_characteristic
CmdStateSrv => cmd_state_srv
srvState => srv_state
CliErrorBoot => cli_error_boot
CliErrorOs => cli_error_os
Filler => filler
RecoverChannel => recover_channel

Signed-off-by: Benjamin Romer <benjamin.romer@unisys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: unisys: remove typedef for CHANNEL_HEADER
Benjamin Romer [Thu, 23 Oct 2014 18:29:55 +0000 (14:29 -0400)]
staging: unisys: remove typedef for CHANNEL_HEADER

Switch everywhere that CHANNEL_HEADER, pCHANNEL_HEADER, or
ULTRA_CHANNEL_PROTOCOL was used, to struct channel_header.

Signed-off-by: Benjamin Romer <benjamin.romer@unisys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: unisys: fix spacing in ULTRA_CHANNELCLI_STRING
Benjamin Romer [Thu, 23 Oct 2014 18:29:54 +0000 (14:29 -0400)]
staging: unisys: fix spacing in ULTRA_CHANNELCLI_STRING

Remove all the extraneous spaces in typecasts in
ULTRA_CHANNELCLI_STRING().

Signed-off-by: Benjamin Romer <benjamin.romer@unisys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: unisys: fix missing blank line after enum channel_clientstate
Benjamin Romer [Thu, 23 Oct 2014 18:29:53 +0000 (14:29 -0400)]
staging: unisys: fix missing blank line after enum channel_clientstate

The enumeration needs to have a blank line after it.

Signed-off-by: Benjamin Romer <benjamin.romer@unisys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: unisys: get rid of typedef for CHANNEL_CLIENTSTATE
Benjamin Romer [Thu, 23 Oct 2014 18:29:52 +0000 (14:29 -0400)]
staging: unisys: get rid of typedef for CHANNEL_CLIENTSTATE

Remove the typedef for CHANNEL_CLIENTSTATE and just use enum
channel_clientstate instead.

Signed-off-by: Benjamin Romer <benjamin.romer@unisys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: unisys: remove typedef for CHANNEL_SERVERSTATE
Benjamin Romer [Thu, 23 Oct 2014 18:29:51 +0000 (14:29 -0400)]
staging: unisys: remove typedef for CHANNEL_SERVERSTATE

Remove the typedef for CHANNEL_SERVERSTATE and use enum
channel_serverstate instead.

Signed-off-by: Benjamin Romer <benjamin.romer@unisys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: unisys: get rid of UltraLogEvent macro
Benjamin Romer [Thu, 23 Oct 2014 18:29:50 +0000 (14:29 -0400)]
staging: unisys: get rid of UltraLogEvent macro

Remove the UltraLogEvent macro from channel.h, and fix all references so
they call pr_info directly. CamelCase names used by functions that
called UltraLogEvent will be fixed in later patches.

Signed-off-by: Benjamin Romer <benjamin.romer@unisys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: unisys: remove channel mismatch macros
Benjamin Romer [Thu, 23 Oct 2014 18:29:49 +0000 (14:29 -0400)]
staging: unisys: remove channel mismatch macros

Simplify the code in channel.h by removing CHANNEL_GUID_MISMATCH,
CHANNEL_u64_MISMATCH, and CHANNEL_U32_MISMATCH, and printing the
messages directly instead.

The CamelCase names in the functions that used to use these macros will
be fixed in a later patch.

Signed-off-by: Benjamin Romer <benjamin.romer@unisys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: unisys: clean up stray blank lines in channel_guid.h
Benjamin Romer [Thu, 23 Oct 2014 18:29:48 +0000 (14:29 -0400)]
staging: unisys: clean up stray blank lines in channel_guid.h

Just remove extra blank lines in channel_guid.h.

Signed-off-by: Benjamin Romer <benjamin.romer@unisys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: unisys: fix CamelCase channel constants
Benjamin Romer [Thu, 23 Oct 2014 18:29:47 +0000 (14:29 -0400)]
staging: unisys: fix CamelCase channel constants

The channel definitions in channel_guid.h contain several CamelCase
constants. Fix these so they are no longer incorrectly cased, and use
the name spar instead of the old "ultra" reference. Also, rename the
corresponding UUID macros to match. Update all references to constants
or UUID macros that were changed.

Fix CamelCase names:
UltraVhbaChannelProtocolGuid => spar_vhba_channel_protocol_uuid
UltraVnicChannelProtocolGuid => spar_vnic_channel_protocol_uuid
UltraSIOVMGuid => spar_siovm_uuid
UltraControlDirectorChannelProtocolGuid =>
spar_controldirector_channel_protocol_uuid

Signed-off-by: Benjamin Romer <benjamin.romer@unisys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: unisys: get rid of IO_DATA_STRUCTURE typedef
Benjamin Romer [Thu, 23 Oct 2014 18:29:46 +0000 (14:29 -0400)]
staging: unisys: get rid of IO_DATA_STRUCTURE typedef

Nobody was using this, so just remove it.

Signed-off-by: Benjamin Romer <benjamin.romer@unisys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: unisys: fix CamelCase in ISSUE_IO_VMCALL macros
Benjamin Romer [Thu, 23 Oct 2014 18:29:45 +0000 (14:29 -0400)]
staging: unisys: fix CamelCase in ISSUE_IO_VMCALL macros

Fix the parameter name in ISSUE_IO_VMCALL and ISSUE_IO_EXTENDED_VMCALL.

Fix CamelCase names:
InterfaceMethod => method

Signed-off-by: Benjamin Romer <benjamin.romer@unisys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: unisys: fix typedef for VMCALL_MONITOR_INTERFACE_METHOD_TUPLE
Benjamin Romer [Thu, 23 Oct 2014 18:29:44 +0000 (14:29 -0400)]
staging: unisys: fix typedef for VMCALL_MONITOR_INTERFACE_METHOD_TUPLE

Get rid of the typedef for VMCALL_MONITOR_INTERFACE_METHOD_TUPLE in
favor of enum vmcall_monitor_interface_method_tuple.

Signed-off-by: Benjamin Romer <benjamin.romer@unisys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: unisys: delete extra space character in vbuschannel_itoa()
Benjamin Romer [Thu, 23 Oct 2014 18:29:43 +0000 (14:29 -0400)]
staging: unisys: delete extra space character in vbuschannel_itoa()

There's no need for that extra space in the typecast in
vbuschannel_itoa(), so just delete it.

Signed-off-by: Benjamin Romer <benjamin.romer@unisys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: unisys: clean up extra parens in vbuschannel_devinfo_to_string
Benjamin Romer [Thu, 23 Oct 2014 18:29:42 +0000 (14:29 -0400)]
staging: unisys: clean up extra parens in vbuschannel_devinfo_to_string

Get rid of the unnecessary parenthesis in several assignments in
vbuschannel_devinfo_to_string().

Signed-off-by: Benjamin Romer <benjamin.romer@unisys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: unisys: fix indentation on vbuschannel_devinfo_to_string()
Benjamin Romer [Thu, 23 Oct 2014 18:29:41 +0000 (14:29 -0400)]
staging: unisys: fix indentation on vbuschannel_devinfo_to_string()

Fix the parameter indentation for vbuschannel_devinfo_to_string(), in
vbusdeviceinfo.h.

Signed-off-by: Benjamin Romer <benjamin.romer@unisys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: unisys: clean up bracing in vbuschannel_sanitize_buffer()
Benjamin Romer [Thu, 23 Oct 2014 18:29:40 +0000 (14:29 -0400)]
staging: unisys: clean up bracing in vbuschannel_sanitize_buffer()

The bracing in vbuschannel_sanitize_buffer() in vbusdeviceinfo.h is
messy. Clean these up.

Signed-off-by: Benjamin Romer <benjamin.romer@unisys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agoStaging: unisys: visorutil: easyproc: fixed a line over 80 characters coding style...
Shrikrishna Khare [Sat, 18 Oct 2014 22:57:37 +0000 (15:57 -0700)]
Staging: unisys: visorutil: easyproc: fixed a line over 80 characters coding style issue

Fixed a coding style issue.

Signed-off-by: Shrikrishna Khare <shrikrishna.khare@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging, unisys: remove leftover function kmalloc_kernel()
WANG Chao [Tue, 14 Oct 2014 08:58:37 +0000 (16:58 +0800)]
staging, unisys: remove leftover function kmalloc_kernel()

kmalloc_kernel() previously declared in timskmodutils.h which recently got
removed. Now also remove kmalloc_kernel(), because it's not used anywhere.

Signed-off-by: WANG Chao <wangchao19890207@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agoStaging: comedi: ni_tiocmd: fixed a brace coding style issue
tssurya [Fri, 24 Oct 2014 19:07:33 +0000 (00:37 +0530)]
Staging: comedi: ni_tiocmd: fixed a brace coding style issue

Removed unneeded braces with the help of checkpatch.pl tool.

Signed-off-by: Surya Seetharaman <suryaseetharaman.9@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: rtl8188eu: os_dep: Remove null check before kfree
Tapasweni Pathak [Fri, 24 Oct 2014 16:15:11 +0000 (21:45 +0530)]
staging: rtl8188eu: os_dep: Remove null check before kfree

This patch is generated by the following semantic patch

// <smpl>
@@ expression E; @@
- if (E != NULL) { kfree(E); }
+ kfree(E);
@@ expression E; @@
- if (E != NULL) { kfree(E); E = NULL; }
+ kfree(E);
+ E = NULL;
// </smpl>

Signed-off-by: Tapasweni Pathak <tapaswenipathak@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: rtl8192e: Remove unnecessary code
Tapasweni Pathak [Fri, 24 Oct 2014 16:15:26 +0000 (21:45 +0530)]
staging: rtl8192e: Remove unnecessary code

kfree on NULL pointer is a no-op.

This used the following semantic patch to identify such a instance

// <smpl>
@@ expression E; @@
- if (E != NULL) { kfree(E); }
+ kfree(E);
@@ expression E; @@
- if (E != NULL) { kfree(E); E = NULL; }
+ kfree(E);
+ E = NULL;
// </smpl>

As rxb is always null at this point, so the code to kfree it and intializing
it to NULL is removed completely.

Suggested by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Tapasweni Pathak <tapaswenipathak@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agoStaging: comedi: ni_mio_common.c: fixed brace coding style issue in two places
Surya Seetharaman [Fri, 24 Oct 2014 20:12:09 +0000 (01:42 +0530)]
Staging: comedi: ni_mio_common.c: fixed brace coding style issue in two places

Removed unnecessary braces with the help of  checkpatch.pl tool.

Signed-off-by: Surya Seetharaman <suryaseetharaman.9@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: remove unneeded parentheses around the right hand side of an assignment
Jiayi Ye [Sat, 25 Oct 2014 02:58:28 +0000 (10:58 +0800)]
staging: remove unneeded parentheses around the right hand side of an assignment

In assignments such as value = (FLASH_CMD_STATUS_REG_READ << 24);, parentheses
are not needed. The Coccinelle semantic patch was used to find cases.

@r@
identifier x;
expression e1, e2;
@@

- x = (e1 << e2);
+ x = e1 << e2;

Signed-off-by: Jiayi Ye <yejiayily@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agoStaging: rtl8723au: core: Fix switch-case indent
Tina Ruchandani [Fri, 24 Oct 2014 03:17:48 +0000 (20:17 -0700)]
Staging: rtl8723au: core: Fix switch-case indent

This patch fixes the following checkpatch errors
in rtw_cmd.c :
ERROR: switch and case should be at the same indent

Signed-off-by: Tina Ruchandani <ruchandani.tina@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agoStaging: rtl8723au: core: Dont have { on new line
Tina Ruchandani [Fri, 24 Oct 2014 03:17:20 +0000 (20:17 -0700)]
Staging: rtl8723au: core: Dont have { on new line

This patch fixes the following checkpatch errors:
ERROR: that open brace { should be on the previous line
ERROR: else should follow close brace '}'

Exceptions: { is left on a new line to itself when fixing
this error makes the line longer than 80 characters.

Signed-off-by: Tina Ruchandani <ruchandani.tina@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agoStaging: rtl8723au: core: Dont have { on new line
Tina Ruchandani [Fri, 24 Oct 2014 03:16:51 +0000 (20:16 -0700)]
Staging: rtl8723au: core: Dont have { on new line

This patch fixes the following checkpatch errors:
ERROR: that open brace { should be on the previous line
ERROR: else should follow close brace '}'

Exceptions: { is left on a new line to itself when fixing
this error makes the line longer than 80 characters.

Signed-off-by: Tina Ruchandani <ruchandani.tina@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: media: lirc: Use pr_* instead of printk
Aybuke Ozdemir [Thu, 23 Oct 2014 14:12:19 +0000 (17:12 +0300)]
staging: media: lirc: Use pr_* instead of printk

This patch focuses on fixing the following warning generated by
checkpatch.pl for the file lirc_sasem.c:
WARNING: Prefer [subsystem eg: netdev]_info([subsystem]dev, ... then
dev_info(dev, ... then pr_info(...  to printk(KERN_INFO ...
WARNING: Prefer [subsystem eg: netdev]_cont([subsystem]dev, ... then
dev_cont(dev, ... then pr_cont(...  to printk(KERN_CONT ...

Signed-off-by: Aybuke Ozdemir <aybuke.147@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: rtl8192u: Remove unnecessary if
Tapasweni Pathak [Fri, 24 Oct 2014 16:14:26 +0000 (21:44 +0530)]
staging: rtl8192u: Remove unnecessary if

Remove the if condition, as the code inside the if condition is
commented and does not have any FIXME or TODO comment.

Signed-off-by: Tapasweni Pathak <tapaswenipathak@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: rtl8188eu: core: fix null dereference on exit path in rtw_mlme.c
Jiayi Ye [Thu, 23 Oct 2014 14:05:10 +0000 (22:05 +0800)]
staging: rtl8188eu: core: fix null dereference on exit path in rtw_mlme.c

If adapter is null, null dereference may occur. This patch fixes it.
The following Coccinelle semantic patch was used to find the case.

@@
expression E, E1;
identifier f;
statement S1,S2,S3;
@@

* if (E == NULL)
{
 ... when != if (E == NULL) S1 else S2
     when != E = E1
* E->f
 ... when any
 return ...;
}
else S3

Signed-off-by: Jiayi Ye <yejiayily@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: vt6655: Replace C99 // comments by /* */
Sarah Khan [Thu, 23 Oct 2014 17:22:33 +0000 (22:52 +0530)]
staging: vt6655: Replace C99 // comments by /* */

Replaced C99 // comments by /* */ in wroute.c

Signed-off-by: Sarah Khan <sarahjmi07@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: xgifb: Removed an unnecessary assignment statement
Sarah Khan [Thu, 23 Oct 2014 17:48:53 +0000 (23:18 +0530)]
staging: xgifb: Removed an unnecessary assignment statement

Used coccinelle patch
@@

expression data;
identifier f;

@@

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

Signed-off-by: Sarah Khan <sarahjmi07@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: lustre: lustre: llite: Use kstrdup
Tapasweni Pathak [Fri, 24 Oct 2014 16:16:00 +0000 (21:46 +0530)]
staging: lustre: lustre: llite: Use kstrdup

Use kstrdup when the goal of an allocation is copy a string into the
allocated region.

Patch found by coccicheck.

Signed-off-by: Tapasweni Pathak <tapaswenipathak@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: slicoss: Use inplace convert with __be32 *
Ebru Akagunduz [Thu, 23 Oct 2014 13:10:16 +0000 (16:10 +0300)]
staging: slicoss: Use inplace convert with __be32 *

This patch fixes "cast to restricted __be32"
sparse warning.

remove  temporary value assignment and use inplace
__be32 conversion for ntohl function which is can
get big endian format

Signed-off-by: Ebru Akagunduz <ebru.akagunduz@gmail.com>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agoStaging: vme: devices: Use kasprintf
Vaishali Thakkar [Thu, 23 Oct 2014 07:57:46 +0000 (13:27 +0530)]
Staging: vme: devices: Use kasprintf

This patch uses kasprintf which combines kmalloc and sprintf.
kasprintf also takes care of the size calculation.

This is done using Coccinelle. Semantic patch used is as follows:

@@
expression a,flag;
expression list args;
statement S;
@@

 a =
- \(kmalloc\|kzalloc\)(...,flag)
+ kasprintf (flag,args)
  <... when != a
  if (a == NULL || ...) S
  ...>
- sprintf(a,args);

Signed-off-by: Vaishali Thakkar <vthakkar1994@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agoStaging: android: Replace timeval with ktime_t in timed_gpio.c
Somya Anand [Thu, 23 Oct 2014 19:28:38 +0000 (21:28 +0200)]
Staging: android: Replace timeval with ktime_t in timed_gpio.c

'struct timeval t' is used to return remaining time in milliseconds.

32-bit systems using 'struct timeval' will break in the year 2038,
so we have to replace that code with more appropriate types.
This patch changes the android driver to use ktime_t.

Signed-off-by: Somya Anand <somyaanand214@gmail.com>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agoStaging: comedi: replace timeval with ktime_t
Somya Anand [Thu, 23 Oct 2014 19:28:37 +0000 (21:28 +0200)]
Staging: comedi: replace timeval with ktime_t

'struct timeval last' is used for recording last time interrupt.
'struct timeval now' is used for calculating elapsed time.

32-bit systems using 'struct timeval' will break in the year 2038,
so we have to replace that code with more appropriate types.
This patch changes the comedi driver to use ktime_t.

Since this code doesn't communicate the time values
to the outside (user space, file system, network).Thus ktime_get()
is a better than using do_gettimeofday() as it uses monotonic
clock.

ktime_to_us() returns an 's64', and using the '%' operator on that requires
doing a 64-bit division which needs an expensive library function call
the specific value of usec_current does not actually matter although it might
matter that it's not always the same
which will start with the offset from the lower 32 bit of the microsecond.
Therefore:
  devpriv->usec_current = (ktime_to_us(devpriv->last) % USEC_PER_SEC)
                          % devpriv->usec_period;
is replaced by

  devpriv->usec_current = ((u32)ktime_to_us(devpriv->last))
                          % devpriv->usec_period;

Signed-off-by: Somya Anand <somyaanand214@gmail.com>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: rts5208: fix case of bitwise operator on zero in ms.c
Jiayi Ye [Mon, 20 Oct 2014 07:01:08 +0000 (15:01 +0800)]
staging: rts5208: fix case of bitwise operator on zero in ms.c

If a variable has value 0, then there is no point in combining it with other things with |, as for any
 x, 0 | x is just x. The following semantic patch finds this problem.
    @@
    expression x,e,e1;
    statement S;
    @@

    if (x == 0) {
      <... when != x = e1
          when != while(...) S
          when != for(...;...;...) S
    (
    *  x |= e
    |
    *  x | e
    )
      ...>
    }

Signed-off-by: Jiayi Ye <yejiayily@gmail.com>
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: wlan-ng: Fix restricted __be16 degrades to integer
Ebru Akagunduz [Mon, 20 Oct 2014 23:47:29 +0000 (02:47 +0300)]
staging: wlan-ng: Fix restricted __be16 degrades to integer

skb->protocol variable type is __be16 and in if condition
it is comparing with ETH_P_80211_RAW constant variable
which is not __be16 type. Using be16_to_cpu() function,
value of skb->protocol converted native processor format.
This bug was found by sparse.

Signed-off-by: Ebru Akagunduz <ebru.akagunduz@gmail.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: media: omap24xx: Use min_t instead of min
Aybuke Ozdemir [Mon, 20 Oct 2014 22:39:34 +0000 (01:39 +0300)]
staging: media: omap24xx: Use min_t instead of min

This patch focuses on fixing the following warning generated by
checkpatch.pl for the file tcm825x.c:

WARNÄ°NG: min() should probably be min_t(u32, tgt_xclk, TCM825X_XCLK_MAX)

The changes were applied using the following coccinelle rule:
@@
expression e1, e2;
typedef u32;
@@

-tgt_xclk = min(e1, (u32)e2);
+tgt_xclk = min_t(u32, e1, e2);

Signed-off-by: Aybuke Ozdemir <aybuke.147@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: unisys: visorutil: Remove null check before kfree
Tapasweni Pathak [Tue, 21 Oct 2014 04:20:03 +0000 (09:50 +0530)]
staging: unisys: visorutil: Remove null check before kfree

This patch was generated by the following semantic patch:

// <smpl>
@@ expression E; @@
- if (E != NULL) { kfree(E); }
+ kfree(E);
@@ expression E; @@
- if (E != NULL) { kfree(E); E = NULL; }
+ kfree(E);
+ E = NULL;
// </smpl>

Signed-off-by: Tapasweni Pathak <tapaswenipathak@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: rtl8723au: Remove unnecessary else if
Tapasweni Pathak [Wed, 22 Oct 2014 06:05:21 +0000 (11:35 +0530)]
staging: rtl8723au: Remove unnecessary else if

Removed the unnecessary else if condition as it has only
one comment inside it and do not have an FIXME or TODO comment near to
it too.

Signed-off-by: Tapasweni Pathak <tapaswenipathak@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: emxx_udc: Remove null check before kfree
Tapasweni Pathak [Tue, 21 Oct 2014 04:18:58 +0000 (09:48 +0530)]
staging: emxx_udc: Remove null check before kfree

This patch was generated by the following semantic patch:

// <smpl>
@@ expression E; @@
- if (E != NULL) { kfree(E); }
+ kfree(E);
@@ expression E; @@
- if (E != NULL) { kfree(E); E = NULL; }
+ kfree(E);
+ E = NULL;
// </smpl>

Signed-off-by: Tapasweni Pathak <tapaswenipathak@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: media: lirc: Delete unused function tv2int
Tapasweni Pathak [Mon, 20 Oct 2014 11:28:10 +0000 (16:58 +0530)]
staging: media: lirc: Delete unused function tv2int

The function tv2int is used to convert timeval to int.

32-bit systems using 'struct timeval' will break in the year 2038,
so we have to replace that code with more appropriate types.
This patch changes the lirc_imon.c file of media: lirc driver.

tv2int function is static and not used anywhere in this file too,
so it is removed. I also build tested it.

Signed-off-by: Tapasweni Pathak <tapaswenipathak@gmail.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: android: Assign bool to true
Tapasweni Pathak [Wed, 22 Oct 2014 05:53:57 +0000 (11:23 +0530)]
staging: android: Assign bool to true

high is a bool type variable.

bool variable should be assigned true, false not 1 or 0.

This patch assigns high to true, replacing 1.

Signed-off-by: Tapasweni Pathak <tapaswenipathak@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: ft1000: ft1000-pcmcia: removed unused variable in ft1000_hw.c
Jiayi Ye [Mon, 20 Oct 2014 11:13:56 +0000 (19:13 +0800)]
staging: ft1000: ft1000-pcmcia: removed unused variable in ft1000_hw.c

Variable whose value is initialized but never used is unnecessary. The following Coccinelle semantic patch removed the unused variable.

@e@
identifier i;
position p;
type T;
@@

extern T i@p;

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

- T i@p;
  <+... when != i
- i = C;
  ...+>

Signed-off-by: Jiayi Ye <yejiayily@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: ft1000: Remove parentheses from return arguments
Tapasweni Pathak [Mon, 20 Oct 2014 04:54:49 +0000 (10:24 +0530)]
staging: ft1000: Remove parentheses from return arguments

The sematic patch used for this is:

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

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

Signed-off-by: Tapasweni Pathak <tapaswenipathak@gmail.com>
Reviewed-by: Josh Triplett <josh@joshtriplett.org>
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: rtl8188eu: os_dep: Replaced kzalloc and memcpy with kmemdup
Tapasweni Pathak [Tue, 21 Oct 2014 04:18:20 +0000 (09:48 +0530)]
staging: rtl8188eu: os_dep: Replaced kzalloc and memcpy with kmemdup

Replaced calls to kzalloc followed by memcpy with a single call to
kmemdup.

Patch found using coccicheck.

Signed-off-by: Tapasweni Pathak <tapaswenipathak@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: rtl8188eu: os_dep: Remove useless cast on kzalloc
Tapasweni Pathak [Tue, 21 Oct 2014 04:18:01 +0000 (09:48 +0530)]
staging: rtl8188eu: os_dep: Remove useless cast on kzalloc

Casting rhe return value which is a void pointer is redundant.
The conversion from void pointer to any other pointer type is
guaranteed by the C programming language, as mentioned in
Documentation/CodingStyle, Chap 14.

Removed the cast on kzalloc return value.

Signed-off-by: Tapasweni Pathak <tapaswenipathak@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: rtl8188eu: core: fixed msleep < 20ms can sleep for up to 20ms warning in...
Jiayi Ye [Mon, 20 Oct 2014 06:04:55 +0000 (14:04 +0800)]
staging: rtl8188eu: core: fixed msleep < 20ms can sleep for up to 20ms warning in rtw_efuse.c

This patch fixes following checkpatch.pl warning:
WARNING: msleep < 20ms can sleep for up to 20ms; see Documentation/timers/timers-howto.txt

Signed-off-by: Jiayi Ye <yejiayily@gmail.comi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agoStaging: lustre: llite: Declare ptr args correctly
Tina Ruchandani [Wed, 22 Oct 2014 20:39:11 +0000 (13:39 -0700)]
Staging: lustre: llite: Declare ptr args correctly

This patch fixes the following checkpatch errors:
ERROR: "foo * bar" should be "foo *bar"

951: FILE: drivers/staging/lustre/lustre/llite/namei.c:951:
static void ll_get_child_fid(struct inode * dir, struct qstr *name,

1193: FILE: drivers/staging/lustre/lustre/llite/namei.c:1193:
static int ll_unlink(struct inode * dir, struct dentry *dentry)

Signed-off-by: Tina Ruchandani <ruchandani.tina@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agoStaging: lustre: libcfs: Fix switch-case indent
Tina Ruchandani [Wed, 22 Oct 2014 20:21:40 +0000 (13:21 -0700)]
Staging: lustre: libcfs: Fix switch-case indent

This patch fixes the following checkpatch error:j
ERROR: switch and case should be at the same indent
105: FILE: drivers/staging/lustre/lustre/libcfs/fail.c:105:

Signed-off-by: Tina Ruchandani <ruchandani.tina@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agoStaging: lustre: llite: Use () around long macro
Tina Ruchandani [Wed, 22 Oct 2014 19:28:49 +0000 (12:28 -0700)]
Staging: lustre: llite: Use () around long macro

This patch fixes the following checkpatch.pl
error: "Macros with complex values should be enclosed
in parentheses."

Signed-off-by: Tina Ruchandani <ruchandani.tina@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agoStaging: lustre: llite: Remove C99 '//' comments
Tina Ruchandani [Wed, 22 Oct 2014 19:16:04 +0000 (12:16 -0700)]
Staging: lustre: llite: Remove C99 '//' comments

This patch fixes the following checkpatch.pl errors:

ERROR: do not use C99 // comments
538: FILE: drivers/staging/lustre/lustre/llite/rw26.c:538:
// .orig_aops.readpages      = ll_readpages,
816: FILE: drivers/staging/lustre/lustre/llite/lproc_llite.c:816:
//{ "mntpt_path",   ll_rd_path,      0, 0 },
826: FILE: drivers/staging/lustre/lustre/llite/lproc_llite.c:826:
//{ "filegroups",   lprocfs_rd_filegroups,  0, 0 },

Signed-off-by: Tina Ruchandani <ruchandani.tina@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: lustre: llite: Use kcalloc not kzalloc with mult
Tina Ruchandani [Wed, 22 Oct 2014 18:29:26 +0000 (11:29 -0700)]
staging: lustre: llite: Use kcalloc not kzalloc with mult

This patch fixes the following checkpatch.pl warnings:
WARNING: Prefer kcalloc over kzalloc with multiply
166: FILE: drivers/staging/lustre/lustre/llite/dir.c:166:
page_pool = kzalloc(sizeof(page) * max_pages, GFP_NOFS);
796: FILE: drivers/staging/lustre/lustre/llite/lloop.c:796:
loop_dev = kzalloc(max_loop * sizeof(*loop_dev), GFP_KERNEL);
800: FILE: drivers/staging/lustre/lustre/llite/lloop.c:800:
disks = kzalloc(max_loop * sizeof(*disks), GFP_KERNEL);

Signed-off-by: Tina Ruchandani <ruchandani.tina@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: lustre: Fix checkpatch.pl spacing-related errors
Tina Ruchandani [Wed, 22 Oct 2014 05:13:21 +0000 (22:13 -0700)]
staging: lustre: Fix checkpatch.pl spacing-related errors

This patch fixes misc. spacing errors reported by
checkpatch.pl for lustre/llite/file.c

Signed-off-by: Tina Ruchandani <ruchandani.tina@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: lustre: lustre: obdecho: expand the GOTO macro in echo_client.c
Jiayi Ye [Mon, 20 Oct 2014 11:52:03 +0000 (19:52 +0800)]
staging: lustre: lustre: obdecho: expand the GOTO macro in echo_client.c

The GOTO macro is not standard in Linux. The following Coccinelle semantic patch was used to expand the GOTO macro.

@@
identifier lbl;
identifier rc;
constant c;
@@

- GOTO(lbl,\(rc\|c\));
+ goto lbl;
@@
identifier lbl;
expression rc;
@@

- GOTO(lbl,rc);
+ rc;
+ goto lbl;

Signed-off-by: Jiayi Ye <yejiayily@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agoStaging: lustre: Remove typedef ldlm_ns_hash_def_t
Vaishali Thakkar [Mon, 20 Oct 2014 08:28:35 +0000 (13:58 +0530)]
Staging: lustre: Remove typedef ldlm_ns_hash_def_t

The linux kernel coding style guidelines suggest not using typedefs
for structure types. This patch gets rid of the typedef for
ldlm_ns_hash_def_t. Also, the name of the struct is changed to drop
the _t, to make the name look less typedef-like.

This is done using Coccinelle. Semantic patch used to detect this
case is as follows:

@tn1@
type td;
@@

typedef struct { ... } td;

@script:python tf@
td << tn1.td;
tdres;
@@

coccinelle.tdres = td;

@@
type tn1.td;
identifier tf.tdres;
@@

-typedef
 struct
+  tdres
   { ... }
-td
 ;

@@
type tn1.td;
identifier tf.tdres;
@@
-td
+ struct tdres

Signed-off-by: Vaishali Thakkar <vthakkar1994@gmail.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agoStaging: lustre: lnet: Make functions static
Vaishali Thakkar [Mon, 20 Oct 2014 05:10:22 +0000 (10:40 +0530)]
Staging: lustre: lnet: Make functions static

This patch makes functions proc_lnet_routes, proc_lnet_routers,
proc_lnet_peers and proc_lnet_nis static in file router_proc.c
as they are used only in this file.

This problem is detected by sparse.

Signed-off-by: Vaishali Thakkar <vthakkar1994@gmail.com>
Reviewed-by: Josh Triplett <josh@joshtriplett.org>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: iio: iio_event_monitor: Add support for missing IIO modifiers
Roberta Dobrescu [Wed, 22 Oct 2014 13:50:17 +0000 (16:50 +0300)]
staging: iio: iio_event_monitor: Add support for missing IIO modifiers

This patch adds the missing IIO modifiers in event_is_known function
and iio_modifier_names vector.

Additionally, it removes duplicate name entries of IIO_MOD_LIGHT_BOTH
and IIO_MOD_LIGHT_IR in iio_modifier_names.

Signed-off-by: Roberta Dobrescu <roberta.dobrescu@gmail.com>
Reviewed-by: Daniel Baluta <daniel.baluta@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agoStaging: dgnc: Remove unused sniff code
Somya Anand [Wed, 22 Oct 2014 11:54:03 +0000 (17:24 +0530)]
Staging: dgnc: Remove unused sniff code

The output written by dgnc_sniff_nowait_nolock() is never used
anywhere since commit 35cf90459312f ("staging: dgnc: removes proc code")
deleted the code that used to copy it to user space.
dgnc_sniff_nowait_nolock() uses 'timeval' to create header timestamps for
the data dump.

32-bit systems using 'struct timeval' will break in the year 2038,
This patch removes dgnc_sniff_nowait_nolock() and all ch_sniff_* members
of struct channel_t defined in "dgnc_driver.h". It also removes their usage
from the driver files and hence y2038 issue is also resolved.

Signed-off-by: Somya Anand <somyaanand214@gmail.com>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: vt6655: wcmd.c: fix print priority warning
Aya Mahfouz [Wed, 22 Oct 2014 13:30:40 +0000 (15:30 +0200)]
staging: vt6655: wcmd.c: fix print priority warning

This patch fixes the following warning generated by checkpatch.pl
for the file wcmd.c

WARNING: printk() should include KERN_ facility level

printk was replaced by netdev_err since providing printk with the
facility level KERN_ERR generated the printing priority warning.

Signed-off-by: Aya Mahfouz <mahfouz.saif.elyazal@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: skein: File Reorg
Eric Rost [Wed, 1 Oct 2014 03:23:23 +0000 (22:23 -0500)]
staging: skein: File Reorg

Reorganizes file to remove #defines from middle of functions. Also
removes #if'd loop declarations and adds ternary if driven loops.

Signed-off-by: Eric Rost <eric.rost@mybabylon.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: skein: Whitespace cleanup
Eric Rost [Wed, 1 Oct 2014 03:22:47 +0000 (22:22 -0500)]
staging: skein: Whitespace cleanup

Pretties up multiline #defines and many other whitespace issues

Signed-off-by: Eric Rost <eric.rost@mybabylon.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agoandroid: binder: remove binder.h
Greg Kroah-Hartman [Thu, 16 Oct 2014 13:26:51 +0000 (15:26 +0200)]
android: binder: remove binder.h

binder.h isn't needed to just include a uapi file and set a single
define, so move it into binder.c to save a few lines of code.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agoandroid: uapi: binder.h
Greg Kroah-Hartman [Thu, 16 Oct 2014 13:22:30 +0000 (15:22 +0200)]
android: uapi: binder.h

add types.h to .h file to pass the checker scripts, and provide a proper
uapi .h file.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: android: binder: move to the "real" part of the kernel
Greg Kroah-Hartman [Thu, 16 Oct 2014 12:40:38 +0000 (14:40 +0200)]
staging: android: binder: move to the "real" part of the kernel

The Android binder code has been "stable" for many years now.  No matter
what comes in the future, we are going to have to support this API, so
might as well move it to the "real" part of the kernel as there's no
real work that needs to be done to the existing code.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: bcm: remove driver
Jeff Kirsher [Wed, 15 Oct 2014 22:53:27 +0000 (15:53 -0700)]
staging: bcm: remove driver

The Beceem WiMAX driver was barely function in its current state
and was non-functional on 64 bit systems.  Based on repeated
statements from Greg KH that he wanted the driver removed, I am
removing the driver.

CC: Matthias Beyer <mail@beyermatthias.de>
CC: Kevin McKinney <klmckinney1@gmail.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: vt6655: replace memcpy() by ether_addr_copy() using coccinelle and pack...
Aya Mahfouz [Sat, 11 Oct 2014 00:42:45 +0000 (02:42 +0200)]
staging: vt6655: replace memcpy() by ether_addr_copy() using coccinelle and pack variables

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)

The changes were applied using the following coccinelle rule:

@@ expression e1, e2; @@

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

After applying the rule, some referencing operations were
adjusted manually to avoid a gcc compilation warning.

According to ether_addr_copy() description and functionality,
all Ethernet addresses should align to the u16 datatype.
A check was made on the following datastructures:

        - vnt_mic_hdr
        - tagS802_11Header
        - tagSEthernetHeader
        - vnt_rts_g
        - ieee80211_rts
        - vnt_private

To maintain that the array abyCurrentNetAddr in vnt_private is aligned,
it was placed before the boolean bLinkPass in the struct definition.
The definition can be found in device.h. A couple of variables were
packed in holes detected by pahole.

Output of pahole when running it on rxtx.o after the changes:

truct tagSEthernetHeader {
        unsigned char          abyDstAddr[6];        /* 0     6 */
        unsigned char          abySrcAddr[6];        /* 6     6 */
        short unsigned int     wType;                /* 12    2 */

        /* size: 14, cachelines: 1, members: 3 */
        /* last cacheline: 14 bytes */
};
struct tagS802_11Header {
        short unsigned int     wFrameCtl;            /* 0     2 */
        short unsigned int     wDurationID;          /* 2     2 */
        unsigned char          abyAddr1[6];          /* 4     6 */
        unsigned char          abyAddr2[6];          /* 10    6 */
        unsigned char          abyAddr3[6];          /* 16    6 */
        short unsigned int     wSeqCtl;              /* 22    2 */
        unsigned char          abyAddr4[6];          /* 24    6 */

        /* size: 30, cachelines: 1, members: 7 */
        /* last cacheline: 30 bytes */
};
struct ieee80211_rts {
        __le16                 frame_control;        /* 0     2 */
        __le16                 duration;             /* 2     2 */
        u8                     ra[6];                /* 4     6 */
        u8                     ta[6];                /* 10    6 */

        /* size: 16, cachelines: 1, members: 4 */
        /* last cacheline: 16 bytes */
};
struct vnt_private {
        struct pci_dev *       pcid;                 /* 0     4 */
        struct net_device *    dev;                  /* 4     4 */
        dma_addr_t             pool_dma;             /* 8     4 */
        dma_addr_t             rd0_pool_dma;         /* 12    4 */
        dma_addr_t             rd1_pool_dma;         /* 16    4 */
        dma_addr_t             td0_pool_dma;         /* 20    4 */
        dma_addr_t             td1_pool_dma;         /* 24    4 */
        dma_addr_t             tx_bufs_dma0;         /* 28    4 */
        dma_addr_t             tx_bufs_dma1;         /* 32    4 */
        dma_addr_t             tx_beacon_dma;        /* 36    4 */
        unsigned char *        tx0_bufs;             /* 40    4 */
        unsigned char *        tx1_bufs;             /* 44    4 */
        unsigned char *        tx_beacon_bufs;       /* 48    4 */
        CHIP_TYPE              chip_id;              /* 52    4 */
        void *                 PortOffset;           /* 56    4 */
        long unsigned int      dwIsr;                /* 60    4 */
        /*--- cacheline 1 boundary (64 bytes) ---*/
        u32                    memaddr;              /* 64    4 */
        u32                    ioaddr;               /* 68    4 */
        u32                    io_size;              /* 72    4 */
        unsigned char          byRevId;              /* 76    1 */
        unsigned char          byRxMode;             /* 77    1 */
        short unsigned int     SubSystemID;          /* 78    2 */
        short unsigned int     SubVendorID;          /* 80    2 */
        spinlock_t             lock;                 /* 82    2 */
        int                    nTxQueues;            /* 84    4 */
        volatile int           iTDUsed;              /* 88    8 */
        volatile PSTxDesc      apCurrTD;             /* 96    8 */
        volatile PSTxDesc      apTailTD;             /* 104   8 */
        volatile PSTxDesc      apTD0Rings;           /* 112   4 */
        volatile PSTxDesc      apTD1Rings;           /* 116   4 */
        volatile PSRxDesc      aRD0Ring;             /* 120   4 */
        volatile PSRxDesc      aRD1Ring;             /* 124   4 */
        /*--- cacheline 2 boundary (128 bytes) ---*/
        volatile PSRxDesc      pCurrRD;              /* 128   8 */
        SCache                 sDupRxCache;          /* 136  44 */
        SDeFragControlBlock    sRxDFCB[64];          /* 180  2048 */
        /*--- cacheline 34 boundary (2176 bytes) was 52 bytes ago ---*/
        unsigned int           cbDFCB;               /* 2228  4 */
        unsigned int           cbFreeDFCB;           /* 2232  4 */
        unsigned int           uCurrentDFCBIdx;      /* 2236  4 */
        /*--- cacheline 35 boundary (2240 bytes) ---*/
        OPTIONS                sOpts;                /* 2240 52 */
        u32                    flags;                /* 2292  4 */
        u32                    rx_buf_sz;            /* 2296  4 */
        int                    multicast_limit;      /* 2300  4 */
        /*--- cacheline 36 boundary (2304 bytes) ---*/
        pid_t                  MLMEThr_pid;          /* 2304  4 */
        struct completion      notify;               /* 2308 16 */
        struct semaphore       mlme_semaphore;       /* 2324 16 */
        u32                    rx_bytes;             /* 2340  4 */
        unsigned char          byLocalID;            /* 2344  1 */
        unsigned char          byRFType;             /* 2345  1 */
        unsigned char          byMaxPwrLevel;        /* 2346  1 */
        unsigned char          byZoneType;           /* 2347  1 */
        bool                   bZoneRegExist;        /* 2348  1 */
        unsigned char          byOriginalZonetype;   /* 2349  1 */
        unsigned char          abyMacContext[384];   /* 2350  384 */
        /*--- cacheline 42 boundary (2688 bytes) was 46 bytes ago ---*/
        unsigned char          abyCurrentNetAddr[6]; /* 2734  6 */
        bool                   bLinkPass;            /* 2740  1 */

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

        SStatCounter           scStatistic;          /* 2744  776 */
        /*--- cacheline 55 boundary (3520 bytes) ---*/
        SDot11Counters         s802_11Counter;       /* 3520  172 */
        /*--- cacheline 57 boundary (3648 bytes) was 44 bytes ago ---*/
        PSMgmtObject           pMgmt;                /* 3692  4 */
        SMgmtObject            sMgmtObj;             /* 3696 95840 */
        /*--- cacheline 1555 boundary (99520 bytes) was 16 bytes ago ---*/

        /* Bitfield combined with previous fields */

        unsigned int           uCurrRSSI;            /* 0    4 */
        unsigned char          byCurrSQ;             /* 0    1 */
        long unsigned int      dwTxAntennaSel;       /* 0    4 */
        long unsigned int      dwRxAntennaSel;       /* 0    4 */
        unsigned char          byAntennaCount;       /* 0    1 */
        unsigned char          byRxAntennaMode;      /* 0    1 */
        unsigned char          byTxAntennaMode;      /* 0    1 */
        bool                   bTxRxAntInv;          /* 0    1 */
        unsigned char *        pbyTmpBuff;           /* 0    4 */
        unsigned int           uSIFS;                /* 0    4 */
        unsigned int           uDIFS;                /* 0    4 */
        unsigned int           uEIFS;                /* 0    4 */
        unsigned int           uSlot;                /* 0    4 */
        unsigned int           uCwMin;               /* 0    4 */
        unsigned int           uCwMax;               /* 0    4 */
        unsigned char          bySIFS;               /* 0    1 */
        unsigned char          byDIFS;               /* 0    1 */
        unsigned char          byEIFS;               /* 0    1 */
        unsigned char          bySlot;               /* 0    1 */
        unsigned char          byCWMaxMin;           /* 0    1 */
        CARD_PHY_TYPE          eCurrentPHYType;      /* 0    4 */
        VIA_BB_TYPE            byBBType;             /* 0    4 */
        VIA_PKT_TYPE           byPacketType;         /* 0    4 */
        short unsigned int     wBasicRate;           /* 0    2 */
        unsigned char          byACKRate;            /* 0    1 */
        unsigned char          byTopOFDMBasicRate;   /* 0    1 */
        unsigned char          byTopCCKBasicRate;    /* 0    1 */
        unsigned char          byMinChannel;         /* 0    1 */
        unsigned char          byMaxChannel;         /* 0    1 */
        unsigned int           uConnectionRate;      /* 0    4 */
        unsigned char          byPreambleType;       /* 0    1 */
        unsigned char          byShortPreamble;      /* 0    1 */
        short unsigned int     wCurrentRate;         /* 0    2 */
        short unsigned int     wRTSThreshold;        /* 0    2 */
        short unsigned int     wFragmentationThreshold; /* 0    2 */
        unsigned char          byShortRetryLimit;    /* 0    1 */
        unsigned char          byLongRetryLimit;     /* 0    1 */
        enum nl80211_iftype    op_mode;              /* 0    4 */
        unsigned char          byOpMode;             /* 0    1 */
        bool                   bBSSIDFilter;         /* 0    1 */
        short unsigned int     wMaxTransmitMSDULifetime; /* 0     2 */
        unsigned char          abyBSSID[6];          /* 0    6 */
        unsigned char          abyDesireBSSID[6];    /* 0    6 */
        short unsigned int     wACKDuration;         /* 0    2 */
        short unsigned int     wRTSTransmitLen;      /* 0    2 */
        unsigned char          byRTSServiceField;    /* 0    1 */
        unsigned char          byRTSSignalField;     /* 0    1 */
        long unsigned int      dwMaxReceiveLifetime; /* 0    4 */
        bool                   bEncryptionEnable;    /* 0    1 */
        bool                   bLongHeader;          /* 0    1 */
        bool                   bShortSlotTime;       /* 0    1 */
        bool                   bProtectMode;         /* 0    1 */
        bool                   bNonERPPresent;       /* 0    1 */
        bool                   bBarkerPreambleMd;    /* 0    1 */
        unsigned char          byERPFlag;            /* 0    1 */
        short unsigned int     wUseProtectCntDown;   /* 0    2 */
        bool                   bRadioControlOff;     /* 0    1 */
        bool                   bRadioOff;            /* 0    1 */
        bool                   bEnablePSMode;        /* 0    1 */
        short unsigned int     wListenInterval;      /* 0    2 */
        bool                   bPWBitOn;             /* 0    1 */
        WMAC_POWER_MODE        ePSMode;              /* 0    4 */
        unsigned char          byRadioCtl;           /* 0    1 */
        unsigned char          byGPIO;               /* 0    1 */
        bool                   bHWRadioOff;          /* 0    1 */
        bool                   bPrvActive4RadioOFF;  /* 0    1 */
        bool                   bGPIOBlockRead;       /* 0    1 */
        short unsigned int     wSeqCounter;          /* 0    2 */
        short unsigned int     wBCNBufLen;           /* 0    2 */
        bool                   bBeaconBufReady;      /* 0    1 */
        bool                   bBeaconSent;          /* 0    1 */
        bool                   bIsBeaconBufReadySet; /* 0    1 */
        unsigned int           cbBeaconBufReadySetCnt; /* 0     4 */
        bool                   bFixRate;             /* 0    1 */
        unsigned char          byCurrentCh;          /* 0    1 */
        unsigned int           uScanTime;            /* 0    4 */
        CMD_STATE              eCommandState;        /* 0    4 */
        CMD_CODE               eCommand;             /* 0    4 */
        bool                   bBeaconTx;            /* 0    1 */
        bool                   bStopBeacon;          /* 0    1 */
        bool                   bStopDataPkt;         /* 0    1 */
        bool                   bStopTx0Pkt;          /* 0    1 */
        unsigned int           uAutoReConnectTime;   /* 0    4 */
        CMD_ITEM               eCmdQueue[32];        /* 0  1408 */
        unsigned int           uCmdDequeueIdx;       /* 0    4 */
        unsigned int           uCmdEnqueueIdx;       /* 0    4 */
        unsigned int           cbFreeCmdQueue;       /* 0    4 */
        bool                   bCmdRunning;          /* 0    1 */
        bool                   bCmdClear;            /* 0    1 */
        bool                   bRoaming;             /* 0    1 */
        unsigned char          abyIPAddr[4];         /* 0    4 */
        long unsigned int      ulTxPower;            /* 0    4 */
        NDIS_802_11_WEP_STATUS eEncryptionStatus;    /* 0    4 */
        bool                   bTransmitKey;         /* 0    1 */
        NDIS_802_11_WEP_STATUS eOldEncryptionStatus; /* 0    4 */
        SKeyManagement         sKey;                 /* 0  3784 */
        long unsigned int      dwIVCounter;          /* 0    4 */
        u64                    qwPacketNumber;       /* 0    8 */
        unsigned int           uCurrentWEPMode;      /* 0    4 */
        RC4Ext                 SBox;                 /* 0  264 */
        unsigned char          abyPRNG[35];          /* 0   35 */
        unsigned char          byKeyIndex;           /* 0    1 */
        unsigned int           uKeyLength;           /* 0    4 */
        unsigned char          abyKey[29];           /* 0   29 */
        bool                   bAES;                 /* 0    1 */
        unsigned char          byCntMeasure;         /* 0    1 */
        unsigned int           uAssocCount;          /* 0    4 */
        bool                   bMoreData;            /* 0    1 */
        bool                   bGrpAckPolicy;        /* 0    1 */
        bool                   bAssocInfoSet;        /* 0    1 */
        unsigned char          byAutoFBCtrl;         /* 0    1 */
        bool                   bTxMICFail;           /* 0    1 */
        bool                   bRxMICFail;           /* 0    1 */
        unsigned int           uRATEIdx;             /* 0    4 */
        bool                   bUpdateBBVGA;         /* 0    1 */
        unsigned int           uBBVGADiffCount;      /* 0    4 */
        unsigned char          byBBVGANew;           /* 0    1 */
        unsigned char          byBBVGACurrent;       /* 0    1 */
        unsigned char          abyBBVGA[4];          /* 0    4 */
        long int               ldBmThreshold[4];     /* 0   16 */
        unsigned char          byBBPreEDRSSI;        /* 0    1 */
        unsigned char          byBBPreEDIndex;       /* 0    1 */
        bool                   bRadioCmd;            /* 0    1 */
        long unsigned int      dwDiagRefCount;       /* 0    4 */
        unsigned char          byFOETuning;          /* 0    1 */
        unsigned char          byAutoPwrTunning;     /* 0    1 */
        short int              sPSetPointCCK;        /* 0    2 */
        short int              sPSetPointOFDMG;      /* 0    2 */
        short int              sPSetPointOFDMA;      /* 0    2 */
        long int               lPFormulaOffset;      /* 0    4 */
        short int              sPThreshold;          /* 0    2 */
        char                   cAdjustStep;          /* 0    1 */
        char                   cMinTxAGC;            /* 0    1 */
        unsigned char          byCCKPwr;             /* 0    1 */
        unsigned char          byOFDMPwrG;           /* 0    1 */
        unsigned char          byCurPwr;             /* 0    1 */
        char                   byCurPwrdBm;          /* 0    1 */
        unsigned char          abyCCKPwrTbl[15];     /* 0   15 */
        unsigned char          abyOFDMPwrTbl[57];    /* 0   57 */
        char                   abyCCKDefaultPwr[15]; /* 0   15 */
        char                   abyOFDMDefaultPwr[57]; /* 0  57 */
        char                   abyRegPwr[57];        /* 0   57 */
        char                   abyLocalPwr[57];      /* 0   57 */
        unsigned char          byBBCR4d;             /* 0    1 */
        unsigned char          byBBCRc9;             /* 0    1 */
        unsigned char          byBBCR88;             /* 0    1 */
        unsigned char          byBBCR09;             /* 0    1 */
        struct timer_list      sTimerCommand;        /* 0   52 */
        struct timer_list      sTimerTxData;         /* 0   52 */
        long unsigned int      nTxDataTimeCout;      /* 0    4 */
        bool                   fTxDataInSleep;       /* 0    1 */
        bool                   IsTxDataTrigger;      /* 0    1 */
        bool                   fWPA_Authened;        /* 0    1 */
        unsigned char          byReAssocCount;       /* 0    1 */
        unsigned char          byLinkWaitCount;      /* 0    1 */
        unsigned char          abyNodeName[17];      /* 0   17 */
        bool                   bDiversityRegCtlON;   /* 0    1 */
        bool                   bDiversityEnable;     /* 0    1 */
        long unsigned int      ulDiversityNValue;    /* 0    4 */
        long unsigned int      ulDiversityMValue;    /* 0    4 */
        unsigned char          byTMax;               /* 0    1 */
        unsigned char          byTMax2;              /* 0    1 */
        unsigned char          byTMax3;              /* 0    1 */
        long unsigned int      ulSQ3TH;              /* 0    4 */
        long unsigned int      uDiversityCnt;        /* 0    4 */
        unsigned char          byAntennaState;       /* 0    1 */
        long unsigned int      ulRatio_State0;       /* 0    4 */
        long unsigned int      ulRatio_State1;       /* 0    4 */
        struct timer_list      TimerSQ3Tmax1;        /* 0   52 */
        struct timer_list      TimerSQ3Tmax2;        /* 0   52 */
        struct timer_list      TimerSQ3Tmax3;        /* 0   52 */
        long unsigned int      uNumSQ3[12];          /* 0   48 */
        short unsigned int     wAntDiversityMaxRate; /* 0    2 */
        SEthernetHeader        sTxEthHeader;         /* 0   14 */
        SEthernetHeader        sRxEthHeader;         /* 0   14 */
        unsigned char          abyBroadcastAddr[6];  /* 0    6 */
        unsigned char          abySNAP_RFC1042[6];   /* 0    6 */
        unsigned char          abySNAP_Bridgetunnel[6]; /* 0     6 */
        unsigned char          abyEEPROM[256];       /* 0   256 */
        SPMKID                 gsPMKID;              /* 0   360 */
        SPMKIDCandidateEvent   gsPMKIDCandidate;     /* 0    72 */
        bool                   b11hEnable;           /* 0     1 */
        unsigned char          abyCountryCode[3];    /* 0     3 */
        unsigned int           uNumOfMeasureEIDs;    /* 0     4 */
        PWLAN_IE_MEASURE_REQ   pCurrMeasureEID;      /* 0     4 */
        bool                   bMeasureInProgress;   /* 0     1 */
        unsigned char          byOrgChannel;         /* 0     1 */
        unsigned char          byOrgRCR;             /* 0     1 */
        long unsigned int      dwOrgMAR0;            /* 0     4 */
        long unsigned int      dwOrgMAR4;            /* 0     4 */
        unsigned char          byBasicMap;           /* 0     1 */
        unsigned char          byCCAFraction;        /* 0     1 */
        unsigned char          abyRPIs[8];           /* 0     8 */
        long unsigned int      dwRPIs[8];            /* 0    32 */
        bool                   bChannelSwitch;       /* 0     1 */
        unsigned char          byNewChannel;         /* 0     1 */
        unsigned char          byChannelSwitchCount; /* 0     1 */
        bool                   bQuietEnable;         /* 0     1 */
        bool                   bEnableFirstQuiet;    /* 0     1 */
        unsigned char          byQuietStartCount;    /* 0     1 */
        unsigned int           uQuietEnqueue;        /* 0     4 */
        long unsigned int      dwCurrentQuietEndTime; /* 0     4 */
        SQuietControl          sQuiet[8];            /* 0    96 */
        bool                   bCountryInfo5G;       /* 0     1 */
        bool                   bCountryInfo24G;      /* 0     1 */
        short unsigned int     wBeaconInterval;      /* 0     2 */
        struct net_device *    wpadev;               /* 0     4 */
        bool                   bWPADEVUp;            /* 0     1 */
        struct sk_buff *       skb;                  /* 0     4 */
        unsigned int           bwextcount;           /* 0     4 */
        bool                   bWPASuppWextEnabled;  /* 0     1 */
        bool                   bEnableHostapd;       /* 0     1 */
        bool                   bEnable8021x;         /* 0     1 */
        bool                   bEnableHostWEP;       /* 0     1 */
        struct net_device *    apdev;                /* 0     4 */
        int                    (*tx_80211)(struct sk_buff *,
                                 struct net_device *); /* 0     4 */
        unsigned int           uChannel;             /* 0     4 */
        bool                   bMACSuspend;          /* 0     1 */
        struct iw_statistics   wstats;               /* 0    32 */
        bool                   bCommit;              /* 0     1 */
        /*--- cacheline 1672 boundary (107008 bytes) ---*/

        /* size: 107008, cachelines: 1672, members: 279 */
        /* sum members: 107005, holes: 1, sum holes: 3 */
        /* padding: 41471 */

        /* BRAIN FART ALERT! 107008 != 107005 + 3(holes), diff = 0 */

};
struct vnt_mic_hdr {
        u8                     id;                   /* 0     1 */
        u8                     tx_priority;          /* 1     1 */
        u8                     mic_addr2[6];         /* 2     6 */
        u8                     ccmp_pn[6];           /* 8     6 */
        __be16                 payload_len;          /* 14    2 */
        __be16                 hlen;                 /* 16    2 */
        __le16                 frame_control;        /* 18    2 */
        u8                     addr1[6];             /* 20    6 */
        u8                     addr2[6];             /* 26    6 */
        u8                     addr3[6];             /* 32    6 */
        __le16                 seq_ctrl;             /* 38    2 */
        u8                     addr4[6];             /* 40    6 */
        u16                    packing;              /* 46    2 */

        /* size: 48, cachelines: 1, members: 13 */
        /* last cacheline: 48 bytes */
};
struct vnt_rts_g {
        struct vnt_phy_field   b;                    /*  0    4 */
        struct vnt_phy_field   a;                    /*  4    4 */
        __le16                 duration_ba;          /*  8    2 */
        __le16                 duration_aa;          /* 10    2 */
        __le16                 duration_bb;          /* 12    2 */
        u16                    reserved;             /* 14    2 */
        struct ieee80211_rts   data;                 /* 16   16 */

        /* size: 32, cachelines: 1, members: 7 */
        /* last cacheline: 32 bytes */
};

Signed-off-by: Aya Mahfouz <mahfouz.saif.elyazal@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: vt6655: wmgr.c and wmgr.h: replace memcpy() by ether_addr_copy() using cocci...
Aya Mahfouz [Sat, 11 Oct 2014 00:37:21 +0000 (02:37 +0200)]
staging: vt6655: wmgr.c and wmgr.h: 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 wmgr.c :

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

The changes were applied using the following coccinelle rule:

@@ expression e1, e2; @@

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

According to ether_addr_copy() description and functionality,
all Ethernet addresses should align to the u16 datatype.

To maintain that the array abyCurrBSSID in tagSMgmtObject is aligned,
it was placed after the int uCurrChannel in the struct definition.
This was done in wmgr.h

Here is the output of pahole for the relevant datastructures:

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 tagSMgmtObject {
        void *                     pAdapter;             /*     0     4 */
        unsigned char              abyMACAddr[6];        /*     4     6 */

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

        WMAC_CONFIG_MODE           eConfigMode;          /*    12     4 */
        CARD_PHY_TYPE              eCurrentPHYMode;      /*    16     4 */
        CARD_PHY_TYPE              eConfigPHYMode;       /*    20     4 */
        WMAC_CURRENT_MODE          eCurrMode;            /*    24     4 */
        WMAC_BSS_STATE             eCurrState;           /*    28     4 */
        PKnownBSS                  pCurrBSS;             /*    32     4 */
        unsigned char              byCSSGK;              /*    36     1 */
        unsigned char              byCSSPK;              /*    37     1 */

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

        unsigned int               uCurrChannel;         /*    40     4 */
        unsigned char              abyCurrBSSID[6];      /*    44     6 */
        unsigned char              abyCurrSuppRates[19]; /*    50    19 */
        /* --- cacheline 1 boundary (64 bytes) was 5 bytes ago --- */
        unsigned char              abyCurrExtSuppRates[19]; /*    69    19 */
        unsigned char              abyCurrSSID[35];      /*    88    35 */

        /* XXX 1 byte hole, try to pack */

        short unsigned int         wCurrCapInfo;         /*   124     2 */
        short unsigned int         wCurrAID;             /*   126     2 */
        /* --- cacheline 2 boundary (128 bytes) --- */
        short unsigned int         wCurrATIMWindow;      /*   128     2 */
        short unsigned int         wCurrBeaconPeriod;    /*   130     2 */
        bool                       bIsDS;                /*   132     1 */
        unsigned char              byERPContext;         /*   133     1 */

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

        CMD_STATE                  eCommandState;        /*   136     4 */
        unsigned int               uScanChannel;         /*   140     4 */
        unsigned char              abyDesireSSID[35];    /*   144    35 */
        unsigned char              abyDesireBSSID[6];    /*   179     6 */

        /* XXX 1 byte hole, try to pack */

        short unsigned int         wIBSSBeaconPeriod;    /*   186     2 */
        short unsigned int         wIBSSATIMWindow;      /*   188     2 */

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

        /* --- cacheline 3 boundary (192 bytes) --- */
        unsigned int               uIBSSChannel;         /*   192     4 */
        unsigned char              abyIBSSSuppRates[19]; /*   196    19 */
        unsigned char              byAPBBType;           /*   215     1 */
        unsigned char              abyWPAIE[64];         /*   216    64 */
        /* --- cacheline 4 boundary (256 bytes) was 24 bytes ago --- */
        short unsigned int         wWPAIELen;            /*   280     2 */

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

        unsigned int               uAssocCount;          /*   284     4 */
        bool                       bMoreData;            /*   288     1 */

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

        WMAC_SCAN_STATE            eScanState;           /*   292     4 */
        WMAC_SCAN_TYPE             eScanType;            /*   296     4 */
        unsigned int               uScanStartCh;         /*   300     4 */
        unsigned int               uScanEndCh;           /*   304     4 */
        short unsigned int         wScanSteps;           /*   308     2 */

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

        unsigned int               uScanBSSType;         /*   312     4 */
        unsigned char              abyScanSSID[35];      /*   316    35 */
        /* --- cacheline 5 boundary (320 bytes) was 31 bytes ago --- */
        unsigned char              abyScanBSSID[6];      /*   351     6 */

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

        WMAC_AUTHENTICATION_MODE   eAuthenMode;          /*   360     4 */
        WMAC_ENCRYPTION_MODE       eEncryptionMode;      /*   364     4 */
        bool                       bShareKeyAlgorithm;   /*   368     1 */
        unsigned char              abyChallenge[128];    /*   369   128 */
        /* --- cacheline 7 boundary (448 bytes) was 49 bytes ago --- */
        bool                       bPrivacyInvoked;      /*   497     1 */
        bool                       bInTIM;               /*   498     1 */
        bool                       bMulticastTIM;        /*   499     1 */
        unsigned char              byDTIMCount;          /*   500     1 */
        unsigned char              byDTIMPeriod;         /*   501     1 */

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

        WMAC_POWER_MODE            ePSMode;              /*   504     4 */
        short unsigned int         wListenInterval;      /*   508     2 */
        short unsigned int         wCountToWakeUp;       /*   510     2 */
        /* --- cacheline 8 boundary (512 bytes) --- */
        bool                       bInTIMWake;           /*   512     1 */

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

        unsigned char *            pbyPSPacketPool;      /*   516     4 */
        unsigned char              byPSPacketPool[36];   /*   520    36 */
        bool                       bRxBeaconInTBTTWake;  /*   556     1 */
        unsigned char              abyPSTxMap[65];       /*   557    65 */

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

        /* --- cacheline 9 boundary (576 bytes) was 48 bytes ago --- */
        unsigned int               uCmdBusy;             /*   624     4 */
        unsigned int               uCmdHostAPBusy;       /*   628     4 */
        unsigned char *            pbyMgmtPacketPool;    /*   632     4 */
        unsigned char              byMgmtPacketPool[2352]; /*   636  2352 */
        /* --- cacheline 46 boundary (2944 bytes) was 44 bytes ago --- */
        struct timer_list          sTimerSecondCallback; /*  2988    52 */
        /* --- cacheline 47 boundary (3008 bytes) was 32 bytes ago --- */
        SRxMgmtPacket              sRxPacket;            /*  3040    28 */
        KnownBSS                   sBSSList[42];         /*  3068 57288 */
        /* --- cacheline 943 boundary (60352 bytes) was 4 bytes ago --- */
        KnownNodeDB                sNodeDBTable[65];     /* 60356 20800 */
        /* --- cacheline 1268 boundary (81152 bytes) was 4 bytes ago --- */

        /* Bitfield combined with previous fields */

        SPMKIDCache                gsPMKIDCache;         /*     0   356 */
        bool                       bRoaming;             /*     0     1 */
        SAssocInfo                 sAssocInfo;           /*     0  7064 */
        bool                       b11hEnable;           /*     0     1 */
        bool                       bSwitchChannel;       /*     0     1 */
        unsigned char              byNewChannel;         /*     0     1 */
        PWLAN_IE_MEASURE_REP       pCurrMeasureEIDRep;   /*     0     4 */
        unsigned int               uLengthOfRepEIDs;     /*     0     4 */
        unsigned char              abyCurrentMSRReq[2352]; /*     0  2352 */
        unsigned char              abyCurrentMSRRep[2352]; /*     0  2352 */
        unsigned char              abyIECountry[2340];   /*     0  2340 */
        unsigned char              abyIBSSDFSOwner[6];   /*     0     6 */
        unsigned char              byIBSSDFSRecovery;    /*     0     1 */
        struct sk_buff             skb;                  /*     0   192 */

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

        /* --- cacheline 1497 boundary (95808 bytes) was 32 bytes ago --- */

        /* size: 95840, cachelines: 1498, members: 81 */
        /* sum members: 95813, holes: 13, sum holes: 27 */
        /* padding: 30112 */
        /* paddings: 1, sum paddings: 4 */
        /* last cacheline: 32 bytes */

        /* BRAIN FART ALERT! 95840 != 95813 + 27(holes), diff = 0 */

};
struct pmkid_candidate {
        NDIS_802_11_MAC_ADDRESS    BSSID;                /*     0     6 */

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

        long unsigned int          Flags;                /*     8     4 */

        /* size: 12, cachelines: 1, members: 2 */
        /* sum members: 10, holes: 1, sum holes: 2 */
        /* last cacheline: 12 bytes */
};

Signed-off-by: Aya Mahfouz <mahfouz.saif.elyazal@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: vt6655: dpc.c: replace memcpy() by ether_addr_copy() using coccinelle
Aya Mahfouz [Sat, 11 Oct 2014 00:34:07 +0000 (02:34 +0200)]
staging: vt6655: dpc.c: replace memcpy() by ether_addr_copy() using coccinelle

This patch focuses on fixing the following warning generated
by checkpatch.pl for the file dpc.c :

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

The changes were applied using the following coccinelle rule:

@@ expression e1, e2; @@

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

According to ether_addr_copy() description and functionality,
all Ethernet addresses should align to the u16 datatype.

Here is the output of pahole for the relevant datastructures:

struct tagS802_11Header {
        short unsigned int         wFrameCtl;            /*     0     2 */
        short unsigned int         wDurationID;          /*     2     2 */
        unsigned char              abyAddr1[6];          /*     4     6 */
        unsigned char              abyAddr2[6];          /*    10     6 */
        unsigned char              abyAddr3[6];          /*    16     6 */
        short unsigned int         wSeqCtl;              /*    22     2 */
        unsigned char              abyAddr4[6];          /*    24     6 */

        /* size: 30, cachelines: 1, members: 7 */
        /* last cacheline: 30 bytes */
};
struct iw_michaelmicfailure {
        __u32                      flags;                /*     0     4 */
        struct sockaddr            src_addr;             /*     4    16 */
        __u8                       tsc[8];               /*    20     8 */

        /* size: 28, cachelines: 1, members: 3 */
        /* last cacheline: 28 bytes */
};
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 */
};

There is one thing to note though, sa_data is a char array of size 14.
And the number of bytes copied using memcpy() or ether_addr_copy()
is 6.

Signed-off-by: Aya Mahfouz <mahfouz.saif.elyazal@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: vt6655: card.c: replace memcpy() by ether_addr_copy() using coccinelle
Aya Mahfouz [Sat, 11 Oct 2014 00:25:34 +0000 (02:25 +0200)]
staging: vt6655: card.c: replace memcpy() by ether_addr_copy() using coccinelle

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)

The changes were applied using the following coccinelle rule:

@@ expression e1, e2; @@

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

According to ether_addr_copy() description and functionality,
all Ethernet addresses should align to the u16 datatype.

Here is the output of pahole for the relevant datastructures:

struct pmkid_candidate {
        NDIS_802_11_MAC_ADDRESS    BSSID;                /*     0     6 */

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

        long unsigned int          Flags;                /*     8     4 */

        /* size: 12, cachelines: 1, members: 2 */
        /* sum members: 10, holes: 1, sum holes: 2 */
        /* last cacheline: 12 bytes */
};

Signed-off-by: Aya Mahfouz <mahfouz.saif.elyazal@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: rtl8723au: Remove a stack of write only counters
Jes Sorensen [Fri, 10 Oct 2014 19:41:34 +0000 (21:41 +0200)]
staging: rtl8723au: Remove a stack of write only counters

We don't do anything with these, so get rid of them

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: rtl8723au: Eliminate write-only struct wlan_network->aid
Jes Sorensen [Fri, 10 Oct 2014 19:41:38 +0000 (21:41 +0200)]
staging: rtl8723au: Eliminate write-only struct wlan_network->aid

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: rtl8723au: Remove unused struct ndis_802_11_key
Jes Sorensen [Fri, 10 Oct 2014 19:41:37 +0000 (21:41 +0200)]
staging: rtl8723au: Remove unused struct ndis_802_11_key

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: rtl8723au: Fold struct wlan_phy_info into struct wlan_bssid_ex
Jes Sorensen [Fri, 10 Oct 2014 19:41:36 +0000 (21:41 +0200)]
staging: rtl8723au: Fold struct wlan_phy_info into struct wlan_bssid_ex

Half the entries of struct wlan_phy_info weren't used and this makes
the code a little cleaner

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: rtl8723au: Remove unused struct zero_bulkout_content
Jes Sorensen [Fri, 10 Oct 2014 19:41:35 +0000 (21:41 +0200)]
staging: rtl8723au: Remove unused struct zero_bulkout_content

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: rtl8723au: Re-organize struct xmit_priv for better packing
Jes Sorensen [Fri, 10 Oct 2014 19:41:33 +0000 (21:41 +0200)]
staging: rtl8723au: Re-organize struct xmit_priv for better packing

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: rtl8723au: Don't read REQ_NQOS_SEQ 16 bits and write back 8 bits
Jes Sorensen [Fri, 10 Oct 2014 19:41:32 +0000 (21:41 +0200)]
staging: rtl8723au: Don't read REQ_NQOS_SEQ 16 bits and write back 8 bits

This fixes a potential endian bug

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: rtl8723au: Use register define REQ_NQOS_SEQ instead of hardcoded value
Jes Sorensen [Fri, 10 Oct 2014 19:41:31 +0000 (21:41 +0200)]
staging: rtl8723au: Use register define REQ_NQOS_SEQ instead of hardcoded value

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: rtl8723au: Eliminate write-once variable xmit_priv->vcs_setting
Jes Sorensen [Fri, 10 Oct 2014 19:41:29 +0000 (21:41 +0200)]
staging: rtl8723au: Eliminate write-once variable xmit_priv->vcs_setting

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: rtl8723au: Use enum values for vcs_type
Jes Sorensen [Fri, 10 Oct 2014 19:41:28 +0000 (21:41 +0200)]
staging: rtl8723au: Use enum values for vcs_type

Be consistent in the use of enum VCS_TYPE

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: rtl8723au: Remove write-only struct xmit_priv->vcs_type
Jes Sorensen [Fri, 10 Oct 2014 19:41:27 +0000 (21:41 +0200)]
staging: rtl8723au: Remove write-only struct xmit_priv->vcs_type

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: rtl8723au: Fix alignment of mac_addr for ether_addr_copy() usage
Jes Sorensen [Fri, 10 Oct 2014 19:41:24 +0000 (21:41 +0200)]
staging: rtl8723au: Fix alignment of mac_addr for ether_addr_copy() usage

Make sure struct eeprom_priv->mac_addr is 2 byte aligned to work with
ether_addr_copy()

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: vt6655: delete SndEvt_ToAPI code
Vladimir A. Nazarenko [Fri, 10 Oct 2014 01:27:01 +0000 (12:27 +1100)]
staging: vt6655: delete SndEvt_ToAPI code

It's never enabled, so we can safely remove it.

Signed-off-by: Vladimir A. Nazarenko <naszar@ya.ru>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: vt6655: Remove unused code inside switch case
Tapasweni Pathak [Fri, 10 Oct 2014 02:13:36 +0000 (07:43 +0530)]
staging: vt6655: Remove unused code inside switch case

This patch removes dead code in private_ioctl function and
iwctl_siwmode function, in file ioctl.c.

Inside switch, for a case no code gets executed
after break.

This was detected by smatch.

Signed-off-by: Tapasweni Pathak <tapaswenipathak@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: rtl8192e: Fix pointer type declaration style errors
John Ledbetter [Thu, 9 Oct 2014 15:05:08 +0000 (11:05 -0400)]
staging: rtl8192e: Fix pointer type declaration style errors

This fixes the following checkpatch.pl errors:

drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c:1290 error: "foo* bar"
should be "foo *bar"

drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c:1305 error: "foo * bar"
should be "foo *bar"

Signed-off-by: John Ledbetter <john@throttle.io>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agodrivers: staging: imx-drm driver cleanup
Rene Kolarik [Thu, 9 Oct 2014 18:29:32 +0000 (20:29 +0200)]
drivers: staging: imx-drm driver cleanup

Wrapping two too long lines in two files of the imx-drm driver.

Signed-off-by: Rene Kolarik <rene.kolarik@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: gs_fpgaboot: Fix "out of memory" error handling
Dzmitry Sledneu [Thu, 9 Oct 2014 07:22:43 +0000 (09:22 +0200)]
staging: gs_fpgaboot: Fix "out of memory" error handling

Fix "out of memory" error handling

Signed-off-by: Dzmitry Sledneu <dzmitry.sledneu@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: vt6655: remove useless #if 1
Vladimir A. Nazarenko [Thu, 9 Oct 2014 05:33:33 +0000 (16:33 +1100)]
staging: vt6655: remove useless #if 1

There is code encapsulated in #if 1, let's remove it.

Signed-off-by: Vladimir A. Nazarenko <naszar@ya.ru>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: dgap: introduce dgap_stop()
Daeseok Youn [Thu, 9 Oct 2014 04:40:11 +0000 (13:40 +0900)]
staging: dgap: introduce dgap_stop()

The dgap_init_module() need to unwind for cleanup variables properly.
Because dgap_init_module() calls dgap_cleanup_module() for freeing
variables but this function is possible to free variables
which are not allocated.

Signed-off-by: Daeseok Youn <daeseok.youn@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: vt6655: remove global variable wpa_Result
Vladimir A. Nazarenko [Thu, 9 Oct 2014 04:38:23 +0000 (15:38 +1100)]
staging: vt6655: remove global variable wpa_Result

This variable unused, so remove it.

Signed-off-by: Vladimir A. Nazarenko <naszar@ya.ru>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: vt6655: delete non-standard ioctl 0xFF
Vladimir A. Nazarenko [Thu, 9 Oct 2014 04:37:17 +0000 (15:37 +1100)]
staging: vt6655: delete non-standard ioctl 0xFF

Custom ioctl 0xff is legacy code that was used for
patched version of wpa_supplicant,  where function
wpa_authen_Status_transfer() called this ioctl  to
tell authentication   status to  the driver. While
from upstream  was added only driver code  to  the
kernel  but  not  patches to the wpa_supplicant we
can safely remove this unused ioctl.

Signed-off-by: Vladimir A. Nazarenko <naszar@ya.ru>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: rtl8723au: core: rtw_ap: Fix void function return statements style warning.
Yeliz Taneroglu [Thu, 9 Oct 2014 13:35:33 +0000 (16:35 +0300)]
staging: rtl8723au: core: rtw_ap: Fix void function return statements style warning.

The following patch fixes the checkpatch.pl warning:

drivers/staging/rtl8723au/core/rtw_ap.c WARNING: void function return statements are not generally useful

Signed-off-by: Yeliz Taneroglu <yeliztaneroglu@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: rtl8723au: core: rtw_security: Fix void function return statements style...
Yeliz Taneroglu [Thu, 9 Oct 2014 13:35:32 +0000 (16:35 +0300)]
staging: rtl8723au: core: rtw_security: Fix void function return statements style warning.

The following patch fixes the checkpatch.pl warning:

drivers/staging/rtl8723au/core/rtw_security.c WARNING: void function return statements are not generally useful

Signed-off-by: Yeliz Taneroglu <yeliztaneroglu@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: rtl8723au: core: rtw_wlan_util: Fix void function return statements style...
Yeliz Taneroglu [Thu, 9 Oct 2014 13:35:31 +0000 (16:35 +0300)]
staging: rtl8723au: core: rtw_wlan_util: Fix void function return statements style warning.

The following patch fixes the checkpatch.pl warning:

drivers/staging/rtl8723au/core/rtw_wlan_util.c WARNING: void function return statements are not generally useful

Signed-off-by: Yeliz Taneroglu <yeliztaneroglu@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: rtl8723au: core: rtw_pwrctrl: Fix void function return statements style...
Yeliz Taneroglu [Thu, 9 Oct 2014 13:35:30 +0000 (16:35 +0300)]
staging: rtl8723au: core: rtw_pwrctrl: Fix void function return statements style warning.

The following patch fixes the checkpatch.pl warning:

drivers/staging/rtl8723au/core/rtw_pwrctrl.c WARNING: void function return statements are not generally useful

Signed-off-by: Yeliz Taneroglu <yeliztaneroglu@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: rtl8723au: core: rtw_mlme: fix void function return statements
Yeliz Taneroglu [Thu, 9 Oct 2014 13:35:29 +0000 (16:35 +0300)]
staging: rtl8723au: core: rtw_mlme: fix void function return statements

The following patch fixes the checkpatch.pl warning:

drivers/staging/rtl8723au/core/rtw_mlme.c WARNING: void function return statements are not generally useful

Signed-off-by: Yeliz Taneroglu <yeliztaneroglu@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>