Commit graph

746 commits

Author SHA1 Message Date
Darshana Padmadas d009f0d7ae staging: rtl8192e: Replace min with min_t
This patch replaces min with min_t and eliminates the
following warnings found by checkpatch.pl:

WARNING: min() should probably be min_t

Signed-off-by: Darshana Padmadas <darshanapadmadas@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-03-09 13:30:40 +01:00
Matteo Semenzato ad22d55c4b Staging: rtl8192e: remove assignment of function parameter
This patch removes the assignment of a function parameter that has no
effect.

Signed-off-by: Matteo Semenzato <mattew8898@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-03-06 16:59:53 -08:00
Quentin Lambert b6b0012c2d staging: rtl8192e: Remove unnecessary OOM message
This patch reduces the kernel size by removing error messages that duplicate
the normal OOM message.

A simplified version of the semantic patch that finds this problem is as
follows: (http://coccinelle.lip6.fr)

@@
identifier f,print,l;
expression e;
constant char[] c;
@@

e = \(kzalloc\|kmalloc\|devm_kzalloc\|devm_kmalloc\)(...);
if (e == NULL) {
  <+...
-  print(...,c,...);
  ... when any
(
  goto l;
|
  return ...;
)
  ...+> }

Signed-off-by: Quentin Lambert <lambert.quentin@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-03-06 16:59:53 -08:00
Joe Perches d08c028c75 staging: rtl8192x: Remove use of seq_printf return value
The seq_printf return value, because it's frequently misused,
will eventually be converted to void.

See: commit 1f33c41c03 ("seq_file: Rename seq_overflow() to
     seq_has_overflowed() and make public")

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-03-06 16:59:53 -08:00
Navya Sri Nizamkari a568dc1f37 staging: rtl8192e: Remove if conditions.
This patch removes if conditions with no exececutable
statements in the bodies of those ifs and also no variable
assignments in the if conditional checks. The call to
rtllib_act_scanning in the condition doesn't have any side
effects as it too performs conditional checks without changing
any values. Hence, it's safe to remove the if condition.

Signed-off-by: Navya Sri Nizamkari <navyasri.tech@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-03-06 15:30:07 -08:00
Aya Mahfouz 0c401c1dc9 staging: rtl8192e: 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
,...);

Some coding style issues were handled manually to avoid
checkpatch warnings and errors.

Signed-off-by: Aya Mahfouz <mahfouz.saif.elyazal@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-03-06 15:22:42 -08:00
Aya Mahfouz 76f73693ca staging: rtl8192e: replace memset(x,0,ETH_ALEN) by eth_zero_addr(x)
eth_zero_addr() is a wrapper function for memset if 0 is going to
be assigned to a mac address. The replacement was done by 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 09:54:34 -08:00
Aya Mahfouz cdbaf3f672 staging: rtl8192e: replace memset(x,0,ETH_ALEN) by eth_zero_addr(x)
eth_zero_addr() is a wrapper function for memset if 0 is going to
be assigned to a mac address. The replacement was done by 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 09:54:34 -08:00
Vaishali Thakkar 5dc42962e1 Staging: rtl8192e: Eliminate use of macro IS_NIC_DOWN
This patch eliminates use of unnecessory macro IS_NIC_DOWN
and replaces it with standard code.

Signed-off-by: Vaishali Thakkar <vthakkar1994@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-03-06 09:54:33 -08:00
Hatice ERTÜRK 0994899598 Staging: rtl8192e: rtl8192e: fix space prohibited before that ','
This patch fixes the following checkpatch.pl error:
space prohibited before that ','

Signed-off-by: Hatice ERTURK <haticeerturk27@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-03-01 17:09:15 -08:00
Vatika Harlalka 9f491da91f Staging: rtl8192e: Remove unneeded brackets.
These were detected with this Coccinelle script:
@@
identifier f1, f2, f3;
constant c;
@@

f1 =
(
- (f2 << f3)
+ f2 << f3
|
- (f2 >> f3)
+ f2 >> f3
|
- (f2 << c)
+ f2 << c
|
- (f2 >> c)
+ f2 >> c
)

Signed-off-by: Vatika Harlalka <vatikaharlalka@gmail.com>
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-03-01 17:09:15 -08:00
Ksenija Stanojevic a3ed22eabd Staging: rtl8192e: Fix line over 80 characters
This patch fixes line to fit 80 characters.
Issue found by checkpatch.pl

Signed-off-by: Ksenija Stanojevic <ksenija.stanojevic@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-03-01 17:07:43 -08:00
Ksenija Stanojevic c63eee5460 Staging: rtl8192e: Use ether_addr_copy() instead of memcpy()
This patch replaces memcpy with ether_addr_copy.
Also pathole was used to make sure that arguments passed to ether_addr_copy
are aligned to u16.
First argument is iwe.u.ap_addr.sa_data i output of pahole is:
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 */
};
and inside union iwreq_data u is sa_data:
struct sockaddr {
/* typedef sa_family_t -> __kernel_sa_family_t */ short unsigned int sa_family; /*     8     2 */
char       sa_data[14];                                          /*    10    14 */
} ap_addr; /*          16 */

sa_data is a char array of size 14, and the number of bytes copied using
ether_addr_copy() is 6.

Second argument is network->bssid and output of pahole is:
struct rtllib_network {
	u8                         bssid[6];             /*     0     6 */
	u8                         channel;              /*     6     1 */
	u8                         ssid[33];             /*     7    33 */
	u8                         ssid_len;             /*    40     1 */
	u8                         hidden_ssid[33];      /*    41    33 */
	/* --- cacheline 1 boundary (64 bytes) was 10 bytes ago --- */
	u8                         hidden_ssid_len;      /*    74     1 */

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

	struct rtllib_qos_data     qos_data;             /*    76    48 */
	bool                       bWithAironetIE;       /*   124     1 */
	bool                       bCkipSupported;       /*   125     1 */
	bool                       bCcxRmEnable;         /*   126     1 */

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

	/* --- cacheline 2 boundary (128 bytes) --- */
	u16                        CcxRmState[2];        /*   128     4 */
	bool                       bMBssidValid;         /*   132     1 */
	u8                         MBssidMask;           /*   133     1 */
	u8                         MBssid[6];            /*   134     6 */
	bool                       bWithCcxVerNum;       /*   140     1 */
	u8                         BssCcxVerNumber;      /*   141     1 */

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

	struct rtllib_rx_stats     stats;                /*   144   120 */
	/* --- cacheline 4 boundary (256 bytes) was 8 bytes ago --- */
	u16                        capability;           /*   264     2 */
	u8                         rates[12];            /*   266    12 */
	u8                         rates_len;            /*   278     1 */
	u8                         rates_ex[16];         /*   279    16 */
	u8                         rates_ex_len;         /*   295     1 */
	long unsigned int          last_scanned;         /*   296     8 */
	u8                         mode;                 /*   304     1 */

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

	u32                        flags;                /*   308     4 */
	u32                        last_associate;       /*   312     4 */
	u32                        time_stamp[2];        /*   316     8 */
	/* --- cacheline 5 boundary (320 bytes) was 4 bytes ago --- */
	u16                        beacon_interval;      /*   324     2 */
	u16                        listen_interval;      /*   326     2 */
	u16                        atim_window;          /*   328     2 */
	u8                         erp_value;            /*   330     1 */
	u8                         wpa_ie[64];           /*   331    64 */

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

	/* --- cacheline 6 boundary (384 bytes) was 16 bytes ago --- */
	size_t                     wpa_ie_len;           /*   400     8 */
	u8                         rsn_ie[64];           /*   408    64 */
	/* --- cacheline 7 boundary (448 bytes) was 24 bytes ago --- */
	size_t                     rsn_ie_len;           /*   472     8 */
	u8                         wzc_ie[256];          /*   480   256 */
	/* --- cacheline 11 boundary (704 bytes) was 32 bytes ago --- */
	size_t                     wzc_ie_len;           /*   736     8 */
	struct rtllib_tim_parameters tim;                /*   744     2 */
	u8                         dtim_period;          /*   746     1 */
	u8                         dtim_data;            /*   747     1 */

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

	u64                        last_dtim_sta_time;   /*   752     8 */
	u8                         wmm_info;             /*   760     1 */

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

	struct rtllib_wmm_ac_param wmm_param[4];         /*   762    16 */
	/* --- cacheline 12 boundary (768 bytes) was 10 bytes ago --- */
	u8                         Turbo_Enable;         /*   778     1 */

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

	u16                        CountryIeLen;         /*   780     2 */
	u8                         CountryIeBuf[255];    /*   782   255 */

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

	/* --- cacheline 16 boundary (1024 bytes) was 16 bytes ago --- */
	struct bss_ht              bssht;                /*  1040    84 */
	/* --- cacheline 17 boundary (1088 bytes) was 36 bytes ago --- */
	bool                       broadcom_cap_exist;   /*  1124     1 */
	bool                       realtek_cap_exit;     /*  1125     1 */
	bool                       marvell_cap_exist;    /*  1126     1 */
	bool                       ralink_cap_exist;     /*  1127     1 */
	bool                       atheros_cap_exist;    /*  1128     1 */
	bool                       cisco_cap_exist;      /*  1129     1 */
	bool                       airgo_cap_exist;      /*  1130     1 */
	bool                       unknown_cap_exist;    /*  1131     1 */
	bool                       berp_info_valid;      /*  1132     1 */
	bool                       buseprotection;       /*  1133     1 */
	bool                       bIsNetgear854T;       /*  1134     1 */
	u8                         SignalStrength;       /*  1135     1 */
	u8                         RSSI;                 /*  1136     1 */

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

	struct list_head           list;                 /*  1144    16 */
	/* --- cacheline 18 boundary (1152 bytes) was 8 bytes ago --- */

	/* size: 1160, cachelines: 19, members: 61 */
	/* sum members: 1132, holes: 10, sum holes: 28 */
	/* last cacheline: 8 bytes */
};

network->bssid is char array of size 6.

Issue found by checkpatch.pl

Signed-off-by: Ksenija Stanojevic <ksenija.stanojevic@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-03-01 17:07:43 -08:00
Ksenija Stanojevic c60cfc8e3b Staging: rtl8192e: Replace printk with netdev_dbg, netdev_info, or netdev_warn
For network systems netdev_dbg, netdev_info or netdev_warn is preferred over
printk. Issue found by checkpatch.pl

Signed-off-by: Ksenija Stanojevic <ksenija.stanojevic@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-03-01 17:07:05 -08:00
Aya Mahfouz 0dbffe07b1 staging: rtl8192e: 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 be31fed4f9 staging: rtl8192e: 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
Melike Yurtoglu 1f3aefb5df Staging: rtl8192e: 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 net_device {
        char                       name[16];             /*     0    16*/
        struct hlist_node          name_hlist;           /*    16    16*/
        char *                     ifalias;              /*    32     8*/
        long unsigned int          mem_end;              /*    40     8*/
        long unsigned int          mem_start;            /*    48     8*/
        long unsigned int          base_addr;            /*    56     8*/
        /* --- cacheline 1 boundary (64 bytes) --- */
        int                        irq;                  /*    64     4*/

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

        long unsigned int          state;                /*    72     8*/
        struct list_head           dev_list;             /*    80    16*/
        struct list_head           napi_list;            /*    96    16*/
        struct list_head           unreg_list;           /*   112    16*/
        /* --- cacheline 2 boundary (128 bytes) --- */
        struct list_head           close_list;           /*   128    16*/
        struct {
                struct list_head   upper;                /*   144    16*/
                struct list_head   lower;                /*   160    16*/
        } adj_list;                                      /*   144    32*/
        struct {
                struct list_head   upper;                /*   176    16*/
                struct list_head   lower;                /*   192    16*/
        } all_adj_list;                                  /*   176    32*/
        /* --- cacheline 3 boundary (192 bytes) was 16 bytes ago --- */
        netdev_features_t          features;             /*   208     8*/
        netdev_features_t          hw_features;          /*   216     8*/
        netdev_features_t          wanted_features;      /*   224     8*/
        netdev_features_t          vlan_features;        /*   232     8*/
        netdev_features_t          hw_enc_features;      /*   240     8*/
        netdev_features_t          mpls_features;        /*   248     8*/
        /* --- cacheline 4 boundary (256 bytes) --- */
	int                        ifindex;              /*   256     4*/
        int                        iflink;               /*   260     4*/
        struct net_device_stats    stats;                /*   264   184*/
        /* --- cacheline 7 boundary (448 bytes) --- */
        atomic_long_t              rx_dropped;           /*   448     8*/
        atomic_long_t              tx_dropped;           /*   456     8*/
        atomic_t                   carrier_changes;      /*   464     4*/

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

        const struct iw_handler_def  * wireless_handlers; /*   472     8*/
        struct iw_public_data *    wireless_data;        /*   480     8*/
        const struct net_device_ops  * netdev_ops;       /*   488     8*/
        const struct ethtool_ops  * ethtool_ops;         /*   496     8*/
        const struct forwarding_accel_ops  * fwd_ops;    /*   504     8*/
        /* --- cacheline 8 boundary (512 bytes) --- */
        const struct header_ops  * header_ops;           /*   512     8*/
        unsigned int               flags;                /*   520     4*/
        unsigned int               priv_flags;           /*   524     4*/
        short unsigned int         gflags;               /*   528     2*/
        short unsigned int         padded;               /*   530     2*/
        unsigned char              operstate;            /*   532     1*/
        unsigned char              link_mode;            /*   533     1*/
        unsigned char              if_port;              /*   534     1*/
        unsigned char              dma;                  /*   535     1*/
        unsigned int               mtu;                  /*   536     4*/
        short unsigned int         type;                 /*   540     2*/
        short unsigned int         hard_header_len;      /*   542     2*/
        short unsigned int         needed_headroom;      /*   544     2*/
        short unsigned int         needed_tailroom;      /*   546     2*/
        unsigned char              perm_addr[32];        /*   548    32*/
        /* --- cacheline 9 boundary (576 bytes) was 4 bytes ago --- */
        unsigned char              addr_assign_type;     /*   580     1*/
        unsigned char              addr_len;             /*   581     1*/
        short unsigned int         neigh_priv_len;       /*   582     2*/
        short unsigned int         dev_id;               /*   584     2*/
        short unsigned int         dev_port;             /*   586     2*/
        spinlock_t                 addr_list_lock;       /*   588     4*/
	struct netdev_hw_addr_list uc;                   /*   592    24*/
        struct netdev_hw_addr_list mc;                   /*   616    24*/
        /* --- cacheline 10 boundary (640 bytes) --- */
        struct netdev_hw_addr_list dev_addrs;            /*   640    24*/
        struct kset *              queues_kset;          /*   664     8*/
        unsigned char              name_assign_type;     /*   672     1*/
        bool                       uc_promisc;           /*   673     1*/

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

        unsigned int               promiscuity;          /*   676     4*/
        unsigned int               allmulti;             /*   680     4*/

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

        struct vlan_info *         vlan_info;            /*   688     8*/
        struct dsa_switch_tree *   dsa_ptr;              /*   696     8*/
        /* --- cacheline 11 boundary (704 bytes) --- */
        struct tipc_bearer *       tipc_ptr;             /*   704     8*/
        void *                     atalk_ptr;            /*   712     8*/
        struct in_device *         ip_ptr;               /*   720     8*/
        struct dn_dev *            dn_ptr;               /*   728     8*/
        struct inet6_dev *         ip6_ptr;              /*   736     8*/
        void *                     ax25_ptr;             /*   744     8*/
        struct wireless_dev *      ieee80211_ptr;        /*   752     8*/
        struct wpan_dev *          ieee802154_ptr;       /*   760     8*/
        /* --- cacheline 12 boundary (768 bytes) --- */
        long unsigned int          last_rx;              /*   768     8*/
        unsigned char *            dev_addr;             /*   776     8*/
        struct netdev_rx_queue *   _rx;                  /*   784     8*/
        unsigned int               num_rx_queues;        /*   792     4*/
        unsigned int               real_num_rx_queues;   /*   796     4*/
        long unsigned int          gro_flush_timeout;    /*   800     8*/
        rx_handler_func_t *        rx_handler;           /*   808     8*/
        void *                     rx_handler_data;      /*   816     8*/
        struct netdev_queue *      ingress_queue;        /*   824     8*/
        /* --- cacheline 13 boundary (832 bytes) --- */
	unsigned char              broadcast[32];        /*   832    32*/

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

        /* --- cacheline 14 boundary (896 bytes) --- */
        struct netdev_queue *      _tx;                  /*   896     8*/
        unsigned int               num_tx_queues;        /*   904     4*/
        unsigned int               real_num_tx_queues;   /*   908     4*/
        struct Qdisc *             qdisc;                /*   912     8*/
        long unsigned int          tx_queue_len;         /*   920     8*/
        spinlock_t                 tx_global_lock;       /*   928     4*/

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

        struct xps_dev_maps *      xps_maps;             /*   936     8*/
        struct cpu_rmap *          rx_cpu_rmap;          /*   944     8*/
        long unsigned int          trans_start;          /*   952     8*/
        /* --- cacheline 15 boundary (960 bytes) --- */
        int                        watchdog_timeo;       /*   960     4*/

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

        struct timer_list          watchdog_timer;       /*   968    80*/
        /* --- cacheline 16 boundary (1024 bytes) was 24 bytes ago ---* */
        int *                      pcpu_refcnt;          /*  1048     8*/
        struct list_head           todo_list;            /*  1056    16*/
        struct hlist_node          index_hlist;          /*  1072    16*/
        /* --- cacheline 17 boundary (1088 bytes) --- */
        struct list_head           link_watch_list;      /*  1088    16*/
        enum {
                NETREG_UNINITIALIZED = 0,
                NETREG_REGISTERED = 1,
                NETREG_UNREGISTERING = 2,
                NETREG_UNREGISTERED = 3,
                NETREG_RELEASED = 4,
                NETREG_DUMMY = 5,
        } reg_state:8;                                     /*  1104 4 */
	/* Bitfield combined with next fields */

        bool                       dismantle;            /*  1105     1*/

        /* Bitfield combined with previous fields */

        enum {
                RTNL_LINK_INITIALIZED = 0,
                RTNL_LINK_INITIALIZING = 1,
        } rtnl_link_state:16;                               /*  1104 4 */

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

        void                       (*destructor)(struct net_device *);/*  1112     8 */
        struct netpoll_info *      npinfo;               /*  1120     8*/
        struct net *               nd_net;               /*  1128     8*/
        union {
                void *             ml_priv;              /*           8*/
                struct pcpu_lstats * lstats;             /*           8*/
                struct pcpu_sw_netstats * tstats;        /*           8*/
                struct pcpu_dstats * dstats;             /*           8*/
                struct pcpu_vstats * vstats;             /*           8*/
        };                                               /*  1136     8*/
        struct garp_port *         garp_port;            /*  1144     8*/
        /* --- cacheline 18 boundary (1152 bytes) was 4 bytes ago --- */
        struct mrp_port *          mrp_port;             /*  1152     8*/
        struct device              dev;                  /*  1160   696*/

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

        /* --- cacheline 29 boundary (1856 bytes) was 4 bytes ago --- */
        const struct attribute_group  * sysfs_groups[4]; /*  1856    32*/
        const struct attribute_group  * sysfs_rx_queue_group; /*  18888 */
        const struct rtnl_link_ops  * rtnl_link_ops;     /*  1896     8*/
        unsigned int               gso_max_size;         /*  1904     4*/
        u16                        gso_max_segs;         /*  1908     2*/
        u16                        gso_min_segs;         /*  1910     2*/
	const struct dcbnl_rtnl_ops  * dcbnl_ops;        /*  1912     8*/
        /* --- cacheline 30 boundary (1920 bytes) was 4 bytes ago --- */
        u8                         num_tc;               /*  1920     1*/

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

        struct netdev_tc_txq       tc_to_txq[16];        /*  1922    64*/
        /* --- cacheline 31 boundary (1984 bytes) was 6 bytes ago --- */
        u8                         prio_tc_map[16];      /*  1986    16*/

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

        unsigned int               fcoe_ddp_xid;         /*  2004     4*/
        struct phy_device *        phydev;               /*  2008     8*/
        struct lock_class_key *    qdisc_tx_busylock;    /*  2016     8*/
        int                        group;                /*  2024     4*/

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

        struct pm_qos_request      pm_qos_req;           /*  2032   176*/
        /* --- cacheline 34 boundary (2176 bytes) was 36 bytes ago --- * */

        /* size: 2240, cachelines: 35, members: 120 */
        /* sum members: 2147, holes: 11, sum holes: 65 */
        /* padding: 32 */
        /* paddings: 1, sum paddings: 7 */

        /* BRAIN FART ALERT! 2240 != 2147 + 65(holes), diff = 28 */

};

Signed-off-by: Melike Yurtoglu <aysemelikeyurtoglu@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-02-26 15:12:10 -08:00
Kolbeinn Karlsson 98ab6ff914 Staging: rtl8192e: Fixed unnecessary line continuation.
Fixed a coding style issue.

Signed-off-by: Kolbeinn Karlsson <kolbeinnkarls@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-02-07 17:25:43 +08:00
Alexander Kuleshov e77e19ac0f staging: rtl8192e: Fix duplicated conditional branch
Signed-off-by: Alexander Kuleshov <kuleshovmail@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-01-17 14:21:59 -08:00
Gangadhar Vukkesala 31f1c464bd staging: rtl8192e: fixed a space coding style issue
Fixed a space coding style issue in 3-dimensional array initialization
which was found when running checkpatch.pl script on rtl819x_HTProc.c.

Signed-off-by: Gangadhar Vukkesala <gangs.freelancer@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-01-17 14:13:33 -08:00
Rickard Strandqvist b5133fde1b staging: rtl8192e: rtllib_rx.c: Remove some unused functions
Removes some functions that are not used anywhere:
update_ibss_network() rtllib_SignalStrengthTranslate()

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:13:31 -08:00
Rickard Strandqvist 366de3a08c staging: rtl8192e: rtl8192e: rtl_pm.c: Remove some unused functions
Removes some functions that are not used anywhere:
rtl8192E_save_state() rtl8192E_enable_wake()

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:11:39 -08:00
Rickard Strandqvist ad6f87d016 staging: rtl8192e: rtl8192e: rtl_cam.c: Remove unused function
Remove the function CAM_read_entry() 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-17 14:06:03 -08:00
Jonathan Jin 6d6163c3bc staging: rtl8192e: rejoin split quoted strings
Fix a checkpatch.pl warning regarding quoted string splits across lines.
While each join of these quoted strings results in a new checkpatch.pl
"lines over 80 characters" warning, the regained ability to grep for
these log strings in the codebase is, I would argue, well worth the
trade-off.

Signed-off-by: Jonathan Jin <jjin082693@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-01-17 14:02:57 -08:00
Chen Gang 3ec16e93d8 drivers: staging: rtl8192e: Include "asm/unaligned.h" instead of "access_ok.h" in "rtl819x_BAProc.c"
"asm/unaligned.h" is more generic than "access_ok.h", and it may include
"access_ok.h", so need use it instead of "access_ok.h".

During building, "rtllib.h" has already include "asm/unaligned.h", so
will cause building issue. The related error (with allmodconfig under
parisc):

    CC [M]  drivers/staging/rtl8192e/rtl819x_BAProc.o
  In file included from ./arch/parisc/include/asm/unaligned.h:4:0,
                   from include/linux/ieee80211.h:22,
                   from include/net/lib80211.h:31,
                   from drivers/staging/rtl8192e/rtllib.h:45,
                   from drivers/staging/rtl8192e/rtl819x_BAProc.c:20:
  include/linux/unaligned/be_struct.h:6:19: error: redefinition of 'get_unaligned_be16'
   static inline u16 get_unaligned_be16(const void *p)
                   ^
  In file included from drivers/staging/rtl8192e/rtl819x_BAProc.c:19:0:
  include/linux/unaligned/access_ok.h:22:19: note: previous definition of 'get_unaligned_be16' was here
   static inline u16 get_unaligned_be16(const void *p)
                   ^
  ...

For independent from other include files, still suggest it includes
"asm/unaligned.h" too. And also include "asm/byteorder.h" since it is
the first include file".

Signed-off-by: Chen Gang <gang.chen.5i5j@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-12-02 16:47:11 -08:00
Athira Lekshmi 73df998683 Drivers:staging:rtl8192e: Fixed checkpatch warning
Fixed checkpatch warning:
WARNING: space prohibited before semicolon

Signed-off-by: Athira Lekshmi <andnlnbn18@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-12-02 16:47:11 -08:00
Devendra Naga 876e20d333 staging: rtl8192e: add missing tasklet_kill on remove path
The powersave tasklet is created in rtllib_softmac_init and
it is not removed while unloading the module.

Cc: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Devendra Naga <devendra.aaru@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-26 14:03:06 -08:00
Vaishali Thakkar 0f24cd7062 Staging: rtl8192e: Use put_unaligned_le16
This patch introduces the use of function put_unaligned_le16.

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

@@ identifier tmp; expression ptr; expression y,e; type T; @@

- tmp = cpu_to_le16(y);

  <+... when != tmp
- memcpy(ptr, (T)&tmp, ...);
+ put_unaligned_le16(y,ptr);
  ...+>
? tmp = e

@@ type T; identifier tmp; @@

- T tmp;
...when != tmp

Here, to be compatible with the change header file is added too.

Signed-off-by: Vaishali Thakkar <vthakkar1994@gmail.com>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-03 16:09:27 -08:00
Behan Webster 16fc54ee26 staging, rtl8192e, LLVMLinux: Make static local in inline function const
rtllib_association_req is a (large) inline function which defines 2 constant
static arrays which aren't labelled as const. As a result clang complains with:

non-constant static local variable in inline function may be different in
different files
[-Wstatic-local-in-inline]
  static u8       AironetIeOui[] = {0x00, 0x01, 0x66};
  ^
The solution is making them "static const".

However doing so requires dropping const when being used with struct
octet_string. However the value is used in a const fashion thereafter, so no
harm done.

Signed-off-by: Behan Webster <behanw@converseincode.com>
Suggested-by: Arnd Bergmann <arnd@arndb.de>
Cc: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-10-29 16:33:05 -07:00
Behan Webster d82f0029e0 staging, rtl8192e, LLVMLinux: Remove unused prototype
MgntQuery_MgntFrameTxRate is only used within rtllib_softmac.c, so it really
should be static instead of extern.

Since it is currently extern a warning is generated because a different
function of the same name is defined staticlly in ieee80211_softmac.c

Removing the incorrect extern declaration and defining the rtllib_softmac
version of this routine static fixes the warning.

Signed-off-by: Behan Webster <behanw@converseincode.com>
Suggested-by: Arnd Bergmann <arnd@arndb.de>
Cc: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-10-29 16:33:05 -07:00
Behan Webster 62ec95f86d staging, rtl8192e, LLVMLinux: Remove unused inline prototype
rtllib_probe_req is defined as "static inline" in rtllib_softmac.c however it
is declared differently as "extern inline" in rtllib_softmac.h. Since it isn't
used outside of the scope of rtllib_softmac, it makes sense to remove the
incorrect declaration.

Signed-off-by: Behan Webster <behanw@converseincode.com>
Suggested-by: Arnd Bergmann <arnd@arndb.de>
Cc: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-10-29 16:33:05 -07:00
Behan Webster 6d91857d48 staging, rtl8192e, LLVMLinux: Change extern inline to static inline
With compilers which follow the C99 standard (like modern versions of gcc and
clang), "extern inline" does the opposite thing from older versions of gcc
(emits code for an externally linkable version of the inline function).

"static inline" does the intended behavior in all cases instead.

Signed-off-by: Behan Webster <behanw@converseincode.com>
Suggested-by: Arnd Bergmann <arnd@arndb.de>
Cc: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-10-29 16:33:05 -07:00
Vaishali Thakkar b32af401fc Staging: rtl8192e: Change variable type from u16 to __le16
This patch changes declaration of variable tmp from u16 to
__le16 in order to remove following sparse warning at number
of places:

warning: incorrect type in assignment (different base types)
         expected unsigned short [unsigned] [usertype] tmp
         got restricted __le16 [usertype] <noident>

Signed-off-by: Vaishali Thakkar <vthakkar1994@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-10-29 16:05:16 -07:00
Vaishali Thakkar c65a5a562e Staging: rtl8192e: Revert one previous commit
This patch reverts commit  450246465a ("Staging: rtl8192e:
Fix incorrect type in assignment in rtl819x_BAProc.c") as it is
changing code and introducing bug to skip the endian conversion.
Here, tmp variable is used to hold the endian-corrected values
and network-data requires fixed endianness.

Signed-off-by: Vaishali Thakkar <vthakkar1994@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-10-29 16:05:16 -07:00
Jiayi Ye 427eed0244 staging: rtl8192e: delete successive assignments to the same location
Successive assignments to the same location is meaningless and can be
deleted. The Coccinelle semantic patch was used to find cases.

@@
expression e1,e2,e3;
@@

(
 (<+...e1++...+>)=e2;
|
 (<+...e1--...+>)=e2;
|
 (<+...++e1...+>)=e2;
|
 (<+...--e1...+>)=e2;
|
e1=e2;
e1 = <+...e1...+>;
|
*e1=e2;
*e1=e3;
)

Signed-off-by: Jiayi Ye <yejiayily@gmail.com>
Reviewed-by: Josh Triplett <josh@joshtriplett.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-10-28 15:53:25 +08:00
Tapasweni Pathak f14557f936 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>
2014-10-27 10:33:06 +08:00
John Ledbetter 3f8ddea02c 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>
2014-10-20 10:30:13 +08:00
Andy Shevchenko 50d5e53ddf staging: rtl8192e: use %*pEn to escape buffer
Let's use kernel's native specifier to escape a buffer.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: "John W . Linville" <linville@tuxdriver.com>
Cc: Johannes Berg <johannes@sipsolutions.net>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Joe Perches <joe@perches.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2014-10-14 02:18:27 +02:00
Feyza Yavuz 9f654a7f25 staging: rtl8192e: rtl8192e: Remove spaces before the semicolons
Patch the following checkpatch.pl warnings

drivers/staging/rtl8192e/rtl8192e/r8190P_rtl8256.c:232: warning:
space prohibited before semicolon
drivers/staging/rtl8192e/rtl8192e/r8190P_rtl8256.c:236: warning:
space prohibited before semicolon

Signed-off-by: Feyza Yavuz <feyzaayavuz@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-10-02 11:56:43 -07:00
Feyza Yavuz c2e191ebfe staging: rtl8192e: rtl8192e: Remove unnecessary return statements
Patch the following checkpatch.pl warnings

drivers/staging/rtl8192e/rtl8192e/r8190P_rtl8256.c:304: warning:
void function return statements are not generally useful
drivers/staging/rtl8192e/rtl8192e/r8190P_rtl8256.c:83: warning:
void function return statements are not generally useful

Signed-off-by: Feyza Yavuz <feyzaayavuz@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-10-02 11:56:43 -07:00
Melike Yurtoglu 66abf01f1d staging: rtl8192e: Remove unneeded void return
Fixes "void function return statements are not generally
useful"checkpatch.pl warning

Signed-off-by: Melike Yurtoglu <aysemelikeyurtoglu@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-10-02 11:56:43 -07:00
Melike Yurtoglu 4dc5afdeff staging: rtl8192e: Fix void function return statements style
Fixes "void function return statements are not generally
useful"checkpatch.pl warning in rtl819x_HTProc.c

Signed-off-by: Melike Yurtoglu <aysemelikeyurtoglu@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-10-02 11:56:43 -07:00
Melike Yurtoglu 042b623cf5 staging: rtl8192e: Fix unnecessary space before function pointer arguments
This patch fixes these warning messages found by checkpatch.pl:
WARNING: Unnecessary space before function pointer arguments

Signed-off-by: Melike Yurtoglu <aysemelikeyurtoglu@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-10-02 10:15:12 -07:00
Melike Yurtoglu 84780ecdf6 staging: rtl8192e: Array was made static const char * const
This patch fixes checkpatch.pl error in file rtllib.h
WARNING: static const char * array should probably be static
const char * const

Signed-off-by: Melike Yurtoglu <aysemelikeyurtoglu@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-10-02 10:15:12 -07:00
Mahati Chamarthy f1cd53ecca Staging: rtl8192e: Remove unused variable
This patch removes a variable which has never been used. The following
Coccinelle semantic patch was used to make this transformation:

@@
type T;
identifier i;
constant C;
@@

- T i;
  <... when != i
- i = C;
  ...>

Signed-off-by: Mahati Chamarthy <mahati.chamarthy@gmail.com>
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-09-28 23:39:27 -04:00
Mahati Chamarthy 6ab8609b92 Staging: rtl8192e: rtl8192e: Remove assigned unused variable
This patch removes an initialized variable which has never been used.
The following Coccinelle semantic patch was used to make this transformation:

@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;
  ...+>

The braces around if and else which become unnecessary after the transformation
were also removed.

Signed-off-by: Mahati Chamarthy <mahati.chamarthy@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-09-28 23:36:24 -04:00
Mahati Chamarthy d8e186cebc Staging: rtl8192e: rtl8192e: Merge two lines and remove unused variable
This patch merges an assignment with an immediately following return of
the assigned variable. It also removes variables that became unused due to this transformation.
The following Coccinelle semantic patch was used to make this transformation:

@r@
identifier ret;
identifier f;
@@

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

@@
identifier r.ret;
expression e1;
type t;
@@

(
-t ret = e1;
|
-t ret;
)
 ... when != ret
     when strict

Signed-off-by: Mahati Chamarthy <mahati.chamarthy@gmail.com>
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-09-23 20:32:43 -07:00
Mahati Chamarthy 92db2a276c Staging: rtl8192e: Fix else is not useful warning style
This fixes the following checkpatch.pl warnings:
WARNING: else is not generally useful after a break or return

Signed-off-by: Mahati Chamarthy <mahati.chamarthy@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-09-23 13:51:45 -07:00
Mahati Chamarthy a5310dc669 Staging: rtl8192e: rtl8192e: Merges two lines of code and removes unused variable
This patch merges an assignment with an immediately following return of
the assigned variable. It also removes a variable that becomes unused due to this transformation.
The following Coccinelle semantic patch was used to make this transformation:

@@
expression ret;
identifier f;
@@

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

@@
identifier ret;
type t;
identifier c;
@@

-t ret = c;
 ... when != ret
     when strict

Signed-off-by: Mahati Chamarthy <mahati.chamarthy@gmail.com>
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-09-23 13:51:03 -07:00
Mahati Chamarthy 3f76a4ea53 Staging: rtl8192e: Fix __constant_htons to htons style warning
This fixes the following checkpatch.pl warning:
WARNING: __constant_htons should be htons

Signed-off-by: Mahati Chamarthy <mahati.chamarthy@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-09-19 17:54:04 -07:00