All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/10] staging: ks7010: next cleanups
@ 2018-04-27 14:05 Sergio Paracuellos
  2018-04-27 14:05 ` [PATCH 01/10] staging: ks7010: clean SME_MIC_FAILURE_REQUEST case in hostif_sme_execute Sergio Paracuellos
                   ` (10 more replies)
  0 siblings, 11 replies; 13+ messages in thread
From: Sergio Paracuellos @ 2018-04-27 14:05 UTC (permalink / raw)
  To: gregkh; +Cc: driverdev-devel, wsa

Cleanups continues with this patch series. Main changes are 
related with MIB where some preprocessor stuff has been change
in favour of an enumeration and some helper functions to increase
code readability has been included. Other changes are minor 
cleanups in different part of code.

Sergio Paracuellos (10):
  staging: ks7010: clean SME_MIC_FAILURE_REQUEST case in
    hostif_sme_execute
  staging: ks7010: convert MIB preprocessor defs into an enum
  staging: ks7010: conver MIB attributes preprocessor defs into an enum
  staging: ks7010: change some casts from uint8_t to u8 in ks_hostif
    header
  staging: ks7010: change parameter types and reorder them in
    hostif_mib_set_request
  staging: ks7010: add new helpers to achieve mib set request and
    simplify code
  staging: ks7010: use ether_addr_copy in get_current_ap
  staging: ks7010: move two preprocessor definitions to ks_wlan.h
  staging: ks7010: avoid two long lines in hostif_sme_mode_setup
  staging: ks7010: remove non sense comments in ks_hostif.c source file

 drivers/staging/ks7010/ks_hostif.c   | 320 +++++++++++++++++------------------
 drivers/staging/ks7010/ks_hostif.h   | 175 ++++++++++++-------
 drivers/staging/ks7010/ks_wlan.h     |   3 +
 drivers/staging/ks7010/ks_wlan_net.c |   4 +-
 4 files changed, 275 insertions(+), 227 deletions(-)

-- 
2.7.4

_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH 01/10] staging: ks7010: clean SME_MIC_FAILURE_REQUEST case in hostif_sme_execute
  2018-04-27 14:05 [PATCH 00/10] staging: ks7010: next cleanups Sergio Paracuellos
@ 2018-04-27 14:05 ` Sergio Paracuellos
  2018-04-27 14:05 ` [PATCH 02/10] staging: ks7010: convert MIB preprocessor defs into an enum Sergio Paracuellos
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 13+ messages in thread
From: Sergio Paracuellos @ 2018-04-27 14:05 UTC (permalink / raw)
  To: gregkh; +Cc: driverdev-devel, wsa

This commit cleans code for the event SME_MIC_FAILURE_REQUEST
changing if logic to handle invalid value first and using a
local variable.

Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
---
 drivers/staging/ks7010/ks_hostif.c | 23 ++++++++++-------------
 1 file changed, 10 insertions(+), 13 deletions(-)

diff --git a/drivers/staging/ks7010/ks_hostif.c b/drivers/staging/ks7010/ks_hostif.c
index 965a23d..5dceadc 100644
--- a/drivers/staging/ks7010/ks_hostif.c
+++ b/drivers/staging/ks7010/ks_hostif.c
@@ -2070,10 +2070,10 @@ void hostif_sme_set_pmksa(struct ks_wlan_private *priv)
 }
 
 /* execute sme */
-static
-void hostif_sme_execute(struct ks_wlan_private *priv, int event)
+static void hostif_sme_execute(struct ks_wlan_private *priv, int event)
 {
 	__le32 val;
+	u16 failure;
 
 	switch (event) {
 	case SME_START:
@@ -2099,18 +2099,15 @@ void hostif_sme_execute(struct ks_wlan_private *priv, int event)
 		hostif_phy_information_request(priv);
 		break;
 	case SME_MIC_FAILURE_REQUEST:
-		if (priv->wpa.mic_failure.failure == 1) {
-			hostif_mic_failure_request(priv,
-						   priv->wpa.mic_failure.failure - 1,
-						   0);
-		} else if (priv->wpa.mic_failure.failure == 2) {
-			hostif_mic_failure_request(priv,
-						   priv->wpa.mic_failure.failure - 1,
-						   priv->wpa.mic_failure.counter);
-		} else {
-			netdev_err(priv->net_dev, "SME_MIC_FAILURE_REQUEST: failure count=%u error?\n",
-				   priv->wpa.mic_failure.failure);
+		failure = priv->wpa.mic_failure.failure;
+		if (failure != 1 && failure != 2) {
+			netdev_err(priv->net_dev,
+				   "SME_MIC_FAILURE_REQUEST: failure count=%u error?\n",
+				   failure);
+			return;
 		}
+		hostif_mic_failure_request(priv, failure - 1, (failure == 1) ?
+					    0 : priv->wpa.mic_failure.counter);
 		break;
 	case SME_MIC_FAILURE_CONFIRM:
 		if (priv->wpa.mic_failure.failure == 2) {
-- 
2.7.4

_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 02/10] staging: ks7010: convert MIB preprocessor defs into an enum
  2018-04-27 14:05 [PATCH 00/10] staging: ks7010: next cleanups Sergio Paracuellos
  2018-04-27 14:05 ` [PATCH 01/10] staging: ks7010: clean SME_MIC_FAILURE_REQUEST case in hostif_sme_execute Sergio Paracuellos
@ 2018-04-27 14:05 ` Sergio Paracuellos
  2018-04-27 14:05 ` [PATCH 03/10] staging: ks7010: conver MIB attributes " Sergio Paracuellos
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 13+ messages in thread
From: Sergio Paracuellos @ 2018-04-27 14:05 UTC (permalink / raw)
  To: gregkh; +Cc: wsa, driverdev-devel

This commit just change some preprocessor definitions related
with MIB data types into an enumeration which is much cleaner
for this here.

Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
---
 drivers/staging/ks7010/ks_hostif.h | 21 ++++++++++++++++-----
 1 file changed, 16 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/ks7010/ks_hostif.h b/drivers/staging/ks7010/ks_hostif.h
index 974e639..a913e02 100644
--- a/drivers/staging/ks7010/ks_hostif.h
+++ b/drivers/staging/ks7010/ks_hostif.h
@@ -135,14 +135,25 @@ struct hostif_mib_get_request {
 	__le32 mib_attribute;
 } __packed;
 
+/**
+ * enum mib_data_type - Message Information Base data type.
+ * @MIB_VALUE_TYPE_NULL: NULL type
+ * @MIB_VALUE_TYPE_INT: INTEGER type
+ * @MIB_VALUE_TYPE_BOOL: BOOL type
+ * @MIB_VALUE_TYPE_COUNT32: unused
+ * @MIB_VALUE_TYPE_OSTRING: Chunk of memory
+ */
+enum mib_data_type {
+	MIB_VALUE_TYPE_NULL = 0,
+	MIB_VALUE_TYPE_INT,
+	MIB_VALUE_TYPE_BOOL,
+	MIB_VALUE_TYPE_COUNT32,
+	MIB_VALUE_TYPE_OSTRING
+};
+
 struct hostif_mib_value {
 	__le16 size;
 	__le16 type;
-#define MIB_VALUE_TYPE_NULL     0
-#define MIB_VALUE_TYPE_INT      1
-#define MIB_VALUE_TYPE_BOOL     2
-#define MIB_VALUE_TYPE_COUNT32  3
-#define MIB_VALUE_TYPE_OSTRING  4
 	u8 body[0];
 } __packed;
 
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 03/10] staging: ks7010: conver MIB attributes preprocessor defs into an enum
  2018-04-27 14:05 [PATCH 00/10] staging: ks7010: next cleanups Sergio Paracuellos
  2018-04-27 14:05 ` [PATCH 01/10] staging: ks7010: clean SME_MIC_FAILURE_REQUEST case in hostif_sme_execute Sergio Paracuellos
  2018-04-27 14:05 ` [PATCH 02/10] staging: ks7010: convert MIB preprocessor defs into an enum Sergio Paracuellos
@ 2018-04-27 14:05 ` Sergio Paracuellos
  2018-04-27 14:05 ` [PATCH 04/10] staging: ks7010: change some casts from uint8_t to u8 in ks_hostif header Sergio Paracuellos
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 13+ messages in thread
From: Sergio Paracuellos @ 2018-04-27 14:05 UTC (permalink / raw)
  To: gregkh; +Cc: wsa, driverdev-devel

This commit just change some preprocessor definitions related
with MIB attributes into an enumeration which is much cleaner
for this here. Also add kerneldoc to avoid long comment lines.

Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
---
 drivers/staging/ks7010/ks_hostif.h | 130 ++++++++++++++++++++++++-------------
 1 file changed, 85 insertions(+), 45 deletions(-)

diff --git a/drivers/staging/ks7010/ks_hostif.h b/drivers/staging/ks7010/ks_hostif.h
index a913e02..d576341 100644
--- a/drivers/staging/ks7010/ks_hostif.h
+++ b/drivers/staging/ks7010/ks_hostif.h
@@ -84,51 +84,91 @@ struct channel_list {
 	u8 pad;
 } __packed;
 
-/* MIB Attribute */
-#define DOT11_MAC_ADDRESS                 0x21010100	/* MAC Address (R) */
-#define DOT11_PRODUCT_VERSION             0x31024100	/* FirmWare Version (R) */
-#define DOT11_RTS_THRESHOLD               0x21020100	/* RTS Threshold (R/W) */
-#define DOT11_FRAGMENTATION_THRESHOLD     0x21050100	/* Fragment Threshold (R/W) */
-#define DOT11_PRIVACY_INVOKED             0x15010100	/* WEP ON/OFF (W) */
-#define DOT11_WEP_DEFAULT_KEY_ID          0x15020100	/* WEP Index (W) */
-#define DOT11_WEP_DEFAULT_KEY_VALUE1      0x13020101	/* WEP Key#1(TKIP AES: PairwiseTemporalKey) (W) */
-#define DOT11_WEP_DEFAULT_KEY_VALUE2      0x13020102	/* WEP Key#2(TKIP AES: GroupKey1) (W) */
-#define DOT11_WEP_DEFAULT_KEY_VALUE3      0x13020103	/* WEP Key#3(TKIP AES: GroupKey2) (W) */
-#define DOT11_WEP_DEFAULT_KEY_VALUE4      0x13020104	/* WEP Key#4 (W) */
-#define DOT11_WEP_LIST                    0x13020100	/* WEP LIST */
-#define	DOT11_DESIRED_SSID		  0x11090100	/* SSID */
-#define	DOT11_CURRENT_CHANNEL		  0x45010100	/* channel set */
-#define	DOT11_OPERATION_RATE_SET	  0x11110100	/* rate set */
-
-#define LOCAL_AP_SEARCH_INTEAVAL          0xF1010100	/* AP search interval (R/W) */
-#define LOCAL_CURRENTADDRESS              0xF1050100	/* MAC Address change (W) */
-#define LOCAL_MULTICAST_ADDRESS           0xF1060100	/* Multicast Address (W) */
-#define LOCAL_MULTICAST_FILTER            0xF1060200	/* Multicast Address Filter enable/disable (W) */
-#define LOCAL_SEARCHED_AP_LIST            0xF1030100	/* AP list (R) */
-#define LOCAL_LINK_AP_STATUS              0xF1040100	/* Link AP status (R) */
-#define	LOCAL_PACKET_STATISTICS		  0xF1020100	/* tx,rx packets statistics */
-#define LOCAL_AP_SCAN_LIST_TYPE_SET	  0xF1030200	/* AP_SCAN_LIST_TYPE */
-
-#define DOT11_RSN_ENABLED                 0x15070100	/* WPA enable/disable (W) */
-#define LOCAL_RSN_MODE                    0x56010100	/* RSN mode WPA/WPA2 (W) */
-#define DOT11_RSN_CONFIG_MULTICAST_CIPHER 0x51040100	/* GroupKeyCipherSuite (W) */
-#define DOT11_RSN_CONFIG_UNICAST_CIPHER   0x52020100	/* PairwiseKeyCipherSuite (W) */
-#define DOT11_RSN_CONFIG_AUTH_SUITE       0x53020100	/* AuthenticationKeyManagementSuite (W) */
-#define DOT11_RSN_CONFIG_VERSION          0x51020100	/* RSN version (W) */
-#define LOCAL_RSN_CONFIG_ALL              0x5F010100	/* RSN CONFIG ALL (W) */
-#define DOT11_PMK_TSC                     0x55010100	/* PMK_TSC (W) */
-#define DOT11_GMK1_TSC                    0x55010101	/* GMK1_TSC (W) */
-#define DOT11_GMK2_TSC                    0x55010102	/* GMK2_TSC (W) */
-#define DOT11_GMK3_TSC                    0x55010103	/* GMK3_TSC */
-#define LOCAL_PMK                         0x58010100	/* Pairwise Master Key cache (W) */
-
-#define LOCAL_REGION                      0xF10A0100	/* Region setting */
-
-#define LOCAL_WPS_ENABLE                  0xF10B0100	/* WiFi Protected Setup */
-#define LOCAL_WPS_PROBE_REQ               0xF10C0100	/* WPS Probe Request */
-
-#define LOCAL_GAIN                        0xF10D0100	/* Carrer sense threshold for demo ato show */
-#define LOCAL_EEPROM_SUM                  0xF10E0100	/* EEPROM checksum information */
+/**
+ * enum mib_attribute - Management Information Base attribute
+ * Attribute value used for accessing and updating MIB
+ *
+ * @DOT11_MAC_ADDRESS: MAC Address (R)
+ * @DOT11_PRODUCT_VERSION: FirmWare Version (R)
+ * @DOT11_RTS_THRESHOLD: RTS Threshold (R/W)
+ * @DOT11_FRAGMENTATION_THRESHOLD: Fragment Threshold (R/W)
+ * @DOT11_PRIVACY_INVOKED: WEP ON/OFF (W)
+ * @DOT11_WEP_DEFAULT_KEY_ID: WEP Index (W)
+ * @DOT11_WEP_DEFAULT_KEY_VALUE1: WEP Key#1(TKIP AES: PairwiseTemporalKey) (W)
+ * @DOT11_WEP_DEFAULT_KEY_VALUE2: WEP Key#2(TKIP AES: GroupKey1) (W)
+ * @DOT11_WEP_DEFAULT_KEY_VALUE3: WEP Key#3(TKIP AES: GroupKey2) (W)
+ * @DOT11_WEP_DEFAULT_KEY_VALUE4: WEP Key#4 (W)
+ * @DOT11_WEP_LIST: WEP LIST
+ * @DOT11_DESIRED_SSID: SSID
+ * @DOT11_CURRENT_CHANNEL: channel set
+ * @DOT11_OPERATION_RATE_SET: rate set
+ * @LOCAL_AP_SEARCH_INTERVAL: AP search interval (R/W)
+ * @LOCAL_CURRENTADDRESS: MAC Address change (W)
+ * @LOCAL_MULTICAST_ADDRESS: Multicast Address (W)
+ * @LOCAL_MULTICAST_FILTER: Multicast Address Filter enable/disable (W)
+ * @LOCAL_SEARCHED_AP_LIST: AP list (R)
+ * @LOCAL_LINK_AP_STATUS: Link AP status (R)
+ * @LOCAL_PACKET_STATISTICS: tx,rx packets statistics
+ * @LOCAL_AP_SCAN_LIST_TYPE_SET: AP_SCAN_LIST_TYPE
+ * @DOT11_RSN_ENABLED: WPA enable/disable (W)
+ * @LOCAL_RSN_MODE: RSN mode WPA/WPA2 (W)
+ * @DOT11_RSN_CONFIG_MULTICAST_CIPHER: GroupKeyCipherSuite (W)
+ * @DOT11_RSN_CONFIG_UNICAST_CIPHER: PairwiseKeyCipherSuite (W)
+ * @DOT11_RSN_CONFIG_AUTH_SUITE: AuthenticationKeyManagementSuite (W)
+ * @DOT11_RSN_CONFIG_VERSION: RSN version (W)
+ * @LOCAL_RSN_CONFIG_ALL: RSN CONFIG ALL (W)
+ * @DOT11_PMK_TSC: PMK_TSC (W)
+ * @DOT11_GMK1_TSC: GMK1_TSC (W)
+ * @DOT11_GMK2_TSC: GMK2_TSC (W)
+ * @DOT11_GMK3_TSC: GMK3_TSC
+ * @LOCAL_PMK: Pairwise Master Key cache (W)
+ * @LOCAL_REGION: Region setting
+ * @LOCAL_WPS_ENABLE: WiFi Protected Setup
+ * @LOCAL_WPS_PROBE_REQ: WPS Probe Request
+ * @LOCAL_GAIN: Carrer sense threshold for demo ato show
+ * @LOCAL_EEPROM_SUM: EEPROM checksum information
+ */
+enum mib_attribute {
+	DOT11_MAC_ADDRESS                 = 0x21010100,
+	DOT11_PRODUCT_VERSION             = 0x31024100,
+	DOT11_RTS_THRESHOLD               = 0x21020100,
+	DOT11_FRAGMENTATION_THRESHOLD     = 0x21050100,
+	DOT11_PRIVACY_INVOKED             = 0x15010100,
+	DOT11_WEP_DEFAULT_KEY_ID          = 0x15020100,
+	DOT11_WEP_DEFAULT_KEY_VALUE1      = 0x13020101,
+	DOT11_WEP_DEFAULT_KEY_VALUE2      = 0x13020102,
+	DOT11_WEP_DEFAULT_KEY_VALUE3      = 0x13020103,
+	DOT11_WEP_DEFAULT_KEY_VALUE4      = 0x13020104,
+	DOT11_WEP_LIST                    = 0x13020100,
+	DOT11_DESIRED_SSID		  = 0x11090100,
+	DOT11_CURRENT_CHANNEL		  = 0x45010100,
+	DOT11_OPERATION_RATE_SET	  = 0x11110100,
+	LOCAL_AP_SEARCH_INTERVAL          = 0xF1010100,
+	LOCAL_CURRENTADDRESS              = 0xF1050100,
+	LOCAL_MULTICAST_ADDRESS           = 0xF1060100,
+	LOCAL_MULTICAST_FILTER            = 0xF1060200,
+	LOCAL_SEARCHED_AP_LIST            = 0xF1030100,
+	LOCAL_LINK_AP_STATUS              = 0xF1040100,
+	LOCAL_PACKET_STATISTICS		  = 0xF1020100,
+	LOCAL_AP_SCAN_LIST_TYPE_SET	  = 0xF1030200,
+	DOT11_RSN_ENABLED                 = 0x15070100,
+	LOCAL_RSN_MODE                    = 0x56010100,
+	DOT11_RSN_CONFIG_MULTICAST_CIPHER = 0x51040100,
+	DOT11_RSN_CONFIG_UNICAST_CIPHER   = 0x52020100,
+	DOT11_RSN_CONFIG_AUTH_SUITE       = 0x53020100,
+	DOT11_RSN_CONFIG_VERSION          = 0x51020100,
+	LOCAL_RSN_CONFIG_ALL              = 0x5F010100,
+	DOT11_PMK_TSC                     = 0x55010100,
+	DOT11_GMK1_TSC                    = 0x55010101,
+	DOT11_GMK2_TSC                    = 0x55010102,
+	DOT11_GMK3_TSC                    = 0x55010103,
+	LOCAL_PMK                         = 0x58010100,
+	LOCAL_REGION                      = 0xF10A0100,
+	LOCAL_WPS_ENABLE                  = 0xF10B0100,
+	LOCAL_WPS_PROBE_REQ               = 0xF10C0100,
+	LOCAL_GAIN                        = 0xF10D0100,
+	LOCAL_EEPROM_SUM                  = 0xF10E0100
+};
 
 struct hostif_mib_get_request {
 	struct hostif_hdr header;
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 04/10] staging: ks7010: change some casts from uint8_t to u8 in ks_hostif header
  2018-04-27 14:05 [PATCH 00/10] staging: ks7010: next cleanups Sergio Paracuellos
                   ` (2 preceding siblings ...)
  2018-04-27 14:05 ` [PATCH 03/10] staging: ks7010: conver MIB attributes " Sergio Paracuellos
@ 2018-04-27 14:05 ` Sergio Paracuellos
  2018-04-27 14:05 ` [PATCH 05/10] staging: ks7010: change parameter types and reorder them in hostif_mib_set_request Sergio Paracuellos
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 13+ messages in thread
From: Sergio Paracuellos @ 2018-04-27 14:05 UTC (permalink / raw)
  To: gregkh; +Cc: wsa, driverdev-devel

This commit changes some type cast in rate related preprocessor
definitions included in ks_hostif header file to use preferred
u8 type.

Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
---
 drivers/staging/ks7010/ks_hostif.h | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/drivers/staging/ks7010/ks_hostif.h b/drivers/staging/ks7010/ks_hostif.h
index d576341..ca7dc8f 100644
--- a/drivers/staging/ks7010/ks_hostif.h
+++ b/drivers/staging/ks7010/ks_hostif.h
@@ -498,20 +498,20 @@ struct hostif_mic_failure_request {
 #define TX_RATE_FIXED		5
 
 /* 11b rate */
-#define TX_RATE_1M	(uint8_t)(10 / 5)	/* 11b 11g basic rate */
-#define TX_RATE_2M	(uint8_t)(20 / 5)	/* 11b 11g basic rate */
-#define TX_RATE_5M	(uint8_t)(55 / 5)	/* 11g basic rate */
-#define TX_RATE_11M	(uint8_t)(110 / 5)	/* 11g basic rate */
+#define TX_RATE_1M	(u8)(10 / 5)	/* 11b 11g basic rate */
+#define TX_RATE_2M	(u8)(20 / 5)	/* 11b 11g basic rate */
+#define TX_RATE_5M	(u8)(55 / 5)	/* 11g basic rate */
+#define TX_RATE_11M	(u8)(110 / 5)	/* 11g basic rate */
 
 /* 11g rate */
-#define TX_RATE_6M	(uint8_t)(60 / 5)	/* 11g basic rate */
-#define TX_RATE_12M	(uint8_t)(120 / 5)	/* 11g basic rate */
-#define TX_RATE_24M	(uint8_t)(240 / 5)	/* 11g basic rate */
-#define TX_RATE_9M	(uint8_t)(90 / 5)
-#define TX_RATE_18M	(uint8_t)(180 / 5)
-#define TX_RATE_36M	(uint8_t)(360 / 5)
-#define TX_RATE_48M	(uint8_t)(480 / 5)
-#define TX_RATE_54M	(uint8_t)(540 / 5)
+#define TX_RATE_6M	(u8)(60 / 5)	/* 11g basic rate */
+#define TX_RATE_12M	(u8)(120 / 5)	/* 11g basic rate */
+#define TX_RATE_24M	(u8)(240 / 5)	/* 11g basic rate */
+#define TX_RATE_9M	(u8)(90 / 5)
+#define TX_RATE_18M	(u8)(180 / 5)
+#define TX_RATE_36M	(u8)(360 / 5)
+#define TX_RATE_48M	(u8)(480 / 5)
+#define TX_RATE_54M	(u8)(540 / 5)
 
 static inline bool is_11b_rate(u8 rate)
 {
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 05/10] staging: ks7010: change parameter types and reorder them in hostif_mib_set_request
  2018-04-27 14:05 [PATCH 00/10] staging: ks7010: next cleanups Sergio Paracuellos
                   ` (3 preceding siblings ...)
  2018-04-27 14:05 ` [PATCH 04/10] staging: ks7010: change some casts from uint8_t to u8 in ks_hostif header Sergio Paracuellos
@ 2018-04-27 14:05 ` Sergio Paracuellos
  2018-04-27 14:06 ` [PATCH 06/10] staging: ks7010: add new helpers to achieve mib set request and simplify code Sergio Paracuellos
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 13+ messages in thread
From: Sergio Paracuellos @ 2018-04-27 14:05 UTC (permalink / raw)
  To: gregkh; +Cc: wsa, driverdev-devel

This commit changes parameter types to use enum mib_attribute, enum
mib_data_type and size_t for size instead of unsigned short. It also
reorder them in a more sense way. Code is updated in different
calls to use new parameters order using 'size' auxiliar local variables
in some of them to improve readability a bit.

Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
---
 drivers/staging/ks7010/ks_hostif.c | 144 +++++++++++++++++++------------------
 1 file changed, 74 insertions(+), 70 deletions(-)

diff --git a/drivers/staging/ks7010/ks_hostif.c b/drivers/staging/ks7010/ks_hostif.c
index 5dceadc..9b25221 100644
--- a/drivers/staging/ks7010/ks_hostif.c
+++ b/drivers/staging/ks7010/ks_hostif.c
@@ -1192,10 +1192,10 @@ void hostif_mib_get_request(struct ks_wlan_private *priv,
 	ks_wlan_hw_tx(priv, pp, hif_align_size(sizeof(*pp)), NULL, NULL);
 }
 
-static
-void hostif_mib_set_request(struct ks_wlan_private *priv,
-			    unsigned long mib_attribute, unsigned short size,
-			    unsigned short type, void *vp)
+static void hostif_mib_set_request(struct ks_wlan_private *priv,
+				   enum mib_attribute attr,
+				   enum mib_data_type type,
+				   void *data, size_t size)
 {
 	struct hostif_mib_set_request_t *pp;
 
@@ -1206,10 +1206,10 @@ void hostif_mib_set_request(struct ks_wlan_private *priv,
 	if (!pp)
 		return;
 
-	pp->mib_attribute = cpu_to_le32((uint32_t)mib_attribute);
-	pp->mib_value.size = cpu_to_le16((uint16_t)size);
-	pp->mib_value.type = cpu_to_le16((uint16_t)type);
-	memcpy(&pp->mib_value.body, vp, size);
+	pp->mib_attribute = cpu_to_le32(attr);
+	pp->mib_value.size = cpu_to_le16((u16)size);
+	pp->mib_value.type = cpu_to_le16(type);
+	memcpy(&pp->mib_value.body, data, size);
 
 	/* send to device request */
 	ps_confirm_wait_inc(priv);
@@ -1557,44 +1557,44 @@ void hostif_sme_set_wep(struct ks_wlan_private *priv, int type)
 	case SME_WEP_INDEX_REQUEST:
 		val = cpu_to_le32((uint32_t)(priv->reg.wep_index));
 		hostif_mib_set_request(priv, DOT11_WEP_DEFAULT_KEY_ID,
-				       sizeof(val), MIB_VALUE_TYPE_INT, &val);
+				       MIB_VALUE_TYPE_INT, &val, sizeof(val));
 		break;
 	case SME_WEP_KEY1_REQUEST:
 		if (!priv->wpa.wpa_enabled)
 			hostif_mib_set_request(priv,
 					       DOT11_WEP_DEFAULT_KEY_VALUE1,
-					       priv->reg.wep_key[0].size,
 					       MIB_VALUE_TYPE_OSTRING,
-					       &priv->reg.wep_key[0].val[0]);
+					       &priv->reg.wep_key[0].val[0],
+					       priv->reg.wep_key[0].size);
 		break;
 	case SME_WEP_KEY2_REQUEST:
 		if (!priv->wpa.wpa_enabled)
 			hostif_mib_set_request(priv,
 					       DOT11_WEP_DEFAULT_KEY_VALUE2,
-					       priv->reg.wep_key[1].size,
 					       MIB_VALUE_TYPE_OSTRING,
-					       &priv->reg.wep_key[1].val[0]);
+					       &priv->reg.wep_key[1].val[0],
+					       priv->reg.wep_key[1].size);
 		break;
 	case SME_WEP_KEY3_REQUEST:
 		if (!priv->wpa.wpa_enabled)
 			hostif_mib_set_request(priv,
 					       DOT11_WEP_DEFAULT_KEY_VALUE3,
-					       priv->reg.wep_key[2].size,
 					       MIB_VALUE_TYPE_OSTRING,
-					       &priv->reg.wep_key[2].val[0]);
+					       &priv->reg.wep_key[2].val[0],
+					       priv->reg.wep_key[2].size);
 		break;
 	case SME_WEP_KEY4_REQUEST:
 		if (!priv->wpa.wpa_enabled)
 			hostif_mib_set_request(priv,
 					       DOT11_WEP_DEFAULT_KEY_VALUE4,
-					       priv->reg.wep_key[3].size,
 					       MIB_VALUE_TYPE_OSTRING,
-					       &priv->reg.wep_key[3].val[0]);
+					       &priv->reg.wep_key[3].val[0],
+					       priv->reg.wep_key[3].size);
 		break;
 	case SME_WEP_FLAG_REQUEST:
 		val = cpu_to_le32((uint32_t)(priv->reg.privacy_invoked));
 		hostif_mib_set_request(priv, DOT11_PRIVACY_INVOKED,
-				       sizeof(val), MIB_VALUE_TYPE_BOOL, &val);
+				       MIB_VALUE_TYPE_BOOL, &val, sizeof(val));
 		break;
 	}
 }
@@ -1615,6 +1615,7 @@ void hostif_sme_set_rsn(struct ks_wlan_private *priv, int type)
 	struct wpa_suite wpa_suite;
 	struct rsn_mode rsn_mode;
 	__le32 val;
+	size_t size;
 
 	memset(&wpa_suite, 0, sizeof(wpa_suite));
 
@@ -1664,11 +1665,11 @@ void hostif_sme_set_rsn(struct ks_wlan_private *priv, int type)
 			break;
 		}
 
+		size = sizeof(wpa_suite.size) +
+		       (CIPHER_ID_LEN * le16_to_cpu(wpa_suite.size));
 		hostif_mib_set_request(priv, DOT11_RSN_CONFIG_UNICAST_CIPHER,
-				       sizeof(wpa_suite.size) +
-				       CIPHER_ID_LEN *
-				       le16_to_cpu(wpa_suite.size),
-				       MIB_VALUE_TYPE_OSTRING, &wpa_suite);
+				       MIB_VALUE_TYPE_OSTRING,
+				       &wpa_suite, size);
 		break;
 	case SME_RSN_MCAST_REQUEST:
 		switch (priv->wpa.group_suite) {
@@ -1715,8 +1716,8 @@ void hostif_sme_set_rsn(struct ks_wlan_private *priv, int type)
 		}
 
 		hostif_mib_set_request(priv, DOT11_RSN_CONFIG_MULTICAST_CIPHER,
-				       CIPHER_ID_LEN, MIB_VALUE_TYPE_OSTRING,
-				       &wpa_suite.suite[0][0]);
+				       MIB_VALUE_TYPE_OSTRING,
+				       &wpa_suite.suite[0][0], CIPHER_ID_LEN);
 		break;
 	case SME_RSN_AUTH_REQUEST:
 		wpa_suite.size = cpu_to_le16((uint16_t)1);
@@ -1757,16 +1758,16 @@ void hostif_sme_set_rsn(struct ks_wlan_private *priv, int type)
 			break;
 		}
 
+		size = sizeof(wpa_suite.size) +
+		       (KEY_MGMT_ID_LEN * le16_to_cpu(wpa_suite.size));
 		hostif_mib_set_request(priv, DOT11_RSN_CONFIG_AUTH_SUITE,
-				       sizeof(wpa_suite.size) +
-				       KEY_MGMT_ID_LEN *
-				       le16_to_cpu(wpa_suite.size),
-				       MIB_VALUE_TYPE_OSTRING, &wpa_suite);
+				       MIB_VALUE_TYPE_OSTRING, &wpa_suite,
+				       size);
 		break;
 	case SME_RSN_ENABLED_REQUEST:
 		val = cpu_to_le32((uint32_t)(priv->wpa.rsn_enabled));
 		hostif_mib_set_request(priv, DOT11_RSN_ENABLED,
-				       sizeof(val), MIB_VALUE_TYPE_BOOL, &val);
+				       MIB_VALUE_TYPE_BOOL, &val, sizeof(val));
 		break;
 	case SME_RSN_MODE_REQUEST:
 		if (priv->wpa.version == IW_AUTH_WPA_VERSION_WPA2) {
@@ -1782,8 +1783,9 @@ void hostif_sme_set_rsn(struct ks_wlan_private *priv, int type)
 			    cpu_to_le32((uint32_t)RSN_MODE_NONE);
 			rsn_mode.rsn_capability = cpu_to_le16((uint16_t)0);
 		}
-		hostif_mib_set_request(priv, LOCAL_RSN_MODE, sizeof(rsn_mode),
-				       MIB_VALUE_TYPE_OSTRING, &rsn_mode);
+		hostif_mib_set_request(priv, LOCAL_RSN_MODE,
+				       MIB_VALUE_TYPE_OSTRING, &rsn_mode,
+				       sizeof(rsn_mode));
 		break;
 	}
 }
@@ -1904,8 +1906,8 @@ void hostif_sme_multicast_set(struct ks_wlan_private *priv)
 	if (dev->flags & IFF_PROMISC) {
 		filter_type = cpu_to_le32((uint32_t)MCAST_FILTER_PROMISC);
 		hostif_mib_set_request(priv, LOCAL_MULTICAST_FILTER,
-				       sizeof(filter_type), MIB_VALUE_TYPE_BOOL,
-				       &filter_type);
+				       MIB_VALUE_TYPE_BOOL,
+				       &filter_type, sizeof(filter_type));
 		goto spin_unlock;
 	}
 
@@ -1913,8 +1915,8 @@ void hostif_sme_multicast_set(struct ks_wlan_private *priv)
 	    (dev->flags & IFF_ALLMULTI)) {
 		filter_type = cpu_to_le32((uint32_t)MCAST_FILTER_MCASTALL);
 		hostif_mib_set_request(priv, LOCAL_MULTICAST_FILTER,
-				       sizeof(filter_type), MIB_VALUE_TYPE_BOOL,
-				       &filter_type);
+				       MIB_VALUE_TYPE_BOOL,
+				       &filter_type, sizeof(filter_type));
 		goto spin_unlock;
 	}
 
@@ -1926,15 +1928,14 @@ void hostif_sme_multicast_set(struct ks_wlan_private *priv)
 		}
 		priv->sme_i.sme_flag &= ~SME_MULTICAST;
 		hostif_mib_set_request(priv, LOCAL_MULTICAST_ADDRESS,
-				       ETH_ALEN * mc_count,
 				       MIB_VALUE_TYPE_OSTRING,
-				       &set_address[0]);
+				       &set_address[0], ETH_ALEN * mc_count);
 	} else {
 		filter_type = cpu_to_le32((uint32_t)MCAST_FILTER_MCAST);
 		priv->sme_i.sme_flag |= SME_MULTICAST;
 		hostif_mib_set_request(priv, LOCAL_MULTICAST_FILTER,
-				       sizeof(filter_type), MIB_VALUE_TYPE_BOOL,
-				       &filter_type);
+				       MIB_VALUE_TYPE_BOOL,
+				       &filter_type, sizeof(filter_type));
 	}
 
 spin_unlock:
@@ -1992,51 +1993,54 @@ void hostif_sme_set_key(struct ks_wlan_private *priv, int type)
 	case SME_SET_FLAG:
 		val = cpu_to_le32((uint32_t)(priv->reg.privacy_invoked));
 		hostif_mib_set_request(priv, DOT11_PRIVACY_INVOKED,
-				       sizeof(val), MIB_VALUE_TYPE_BOOL, &val);
+				       MIB_VALUE_TYPE_BOOL, &val, sizeof(val));
 		break;
 	case SME_SET_TXKEY:
 		val = cpu_to_le32((uint32_t)(priv->wpa.txkey));
 		hostif_mib_set_request(priv, DOT11_WEP_DEFAULT_KEY_ID,
-				       sizeof(val), MIB_VALUE_TYPE_INT, &val);
+				       MIB_VALUE_TYPE_INT, &val, sizeof(val));
 		break;
 	case SME_SET_KEY1:
 		hostif_mib_set_request(priv, DOT11_WEP_DEFAULT_KEY_VALUE1,
-				       priv->wpa.key[0].key_len,
 				       MIB_VALUE_TYPE_OSTRING,
-				       &priv->wpa.key[0].key_val[0]);
+				       &priv->wpa.key[0].key_val[0],
+				       priv->wpa.key[0].key_len);
 		break;
 	case SME_SET_KEY2:
 		hostif_mib_set_request(priv, DOT11_WEP_DEFAULT_KEY_VALUE2,
-				       priv->wpa.key[1].key_len,
 				       MIB_VALUE_TYPE_OSTRING,
-				       &priv->wpa.key[1].key_val[0]);
+				       &priv->wpa.key[1].key_val[0],
+				       priv->wpa.key[1].key_len);
 		break;
 	case SME_SET_KEY3:
 		hostif_mib_set_request(priv, DOT11_WEP_DEFAULT_KEY_VALUE3,
-				       priv->wpa.key[2].key_len,
 				       MIB_VALUE_TYPE_OSTRING,
-				       &priv->wpa.key[2].key_val[0]);
+				       &priv->wpa.key[2].key_val[0],
+				       priv->wpa.key[2].key_len);
 		break;
 	case SME_SET_KEY4:
 		hostif_mib_set_request(priv, DOT11_WEP_DEFAULT_KEY_VALUE4,
-				       priv->wpa.key[3].key_len,
 				       MIB_VALUE_TYPE_OSTRING,
-				       &priv->wpa.key[3].key_val[0]);
+				       &priv->wpa.key[3].key_val[0],
+				       priv->wpa.key[3].key_len);
 		break;
 	case SME_SET_PMK_TSC:
 		hostif_mib_set_request(priv, DOT11_PMK_TSC,
-				       WPA_RX_SEQ_LEN, MIB_VALUE_TYPE_OSTRING,
-				       &priv->wpa.key[0].rx_seq[0]);
+				       MIB_VALUE_TYPE_OSTRING,
+				       &priv->wpa.key[0].rx_seq[0],
+				       WPA_RX_SEQ_LEN);
 		break;
 	case SME_SET_GMK1_TSC:
 		hostif_mib_set_request(priv, DOT11_GMK1_TSC,
-				       WPA_RX_SEQ_LEN, MIB_VALUE_TYPE_OSTRING,
-				       &priv->wpa.key[1].rx_seq[0]);
+				       MIB_VALUE_TYPE_OSTRING,
+				       &priv->wpa.key[1].rx_seq[0],
+				       WPA_RX_SEQ_LEN);
 		break;
 	case SME_SET_GMK2_TSC:
 		hostif_mib_set_request(priv, DOT11_GMK2_TSC,
-				       WPA_RX_SEQ_LEN, MIB_VALUE_TYPE_OSTRING,
-				       &priv->wpa.key[2].rx_seq[0]);
+				       MIB_VALUE_TYPE_OSTRING,
+				       &priv->wpa.key[2].rx_seq[0],
+				       WPA_RX_SEQ_LEN);
 		break;
 	}
 }
@@ -2052,6 +2056,7 @@ void hostif_sme_set_pmksa(struct ks_wlan_private *priv)
 		} __packed list[PMK_LIST_MAX];
 	} __packed pmkcache;
 	struct pmk *pmk;
+	size_t size;
 	int i = 0;
 
 	list_for_each_entry(pmk, &priv->pmklist.head, list) {
@@ -2062,11 +2067,10 @@ void hostif_sme_set_pmksa(struct ks_wlan_private *priv)
 		i++;
 	}
 	pmkcache.size = cpu_to_le16((uint16_t)(priv->pmklist.size));
+	size = sizeof(priv->pmklist.size) +
+	       ((ETH_ALEN + IW_PMKID_LEN) * priv->pmklist.size);
 	hostif_mib_set_request(priv, LOCAL_PMK,
-			       sizeof(priv->pmklist.size) + (ETH_ALEN +
-							     IW_PMKID_LEN) *
-			       (priv->pmklist.size), MIB_VALUE_TYPE_OSTRING,
-			       &pmkcache);
+			       MIB_VALUE_TYPE_OSTRING, &pmkcache, size);
 }
 
 /* execute sme */
@@ -2084,9 +2088,9 @@ static void hostif_sme_execute(struct ks_wlan_private *priv, int event)
 		hostif_sme_multicast_set(priv);
 		break;
 	case SME_MACADDRESS_SET_REQUEST:
-		hostif_mib_set_request(priv, LOCAL_CURRENTADDRESS, ETH_ALEN,
+		hostif_mib_set_request(priv, LOCAL_CURRENTADDRESS,
 				       MIB_VALUE_TYPE_OSTRING,
-				       &priv->eth_addr[0]);
+				       &priv->eth_addr[0], ETH_ALEN);
 		break;
 	case SME_BSS_SCAN_REQUEST:
 		hostif_bss_scan_request(priv, priv->reg.scan_type,
@@ -2131,12 +2135,12 @@ static void hostif_sme_execute(struct ks_wlan_private *priv, int event)
 	case SME_RTS_THRESHOLD_REQUEST:
 		val = cpu_to_le32((uint32_t)(priv->reg.rts));
 		hostif_mib_set_request(priv, DOT11_RTS_THRESHOLD,
-				       sizeof(val), MIB_VALUE_TYPE_INT, &val);
+				       MIB_VALUE_TYPE_INT, &val, sizeof(val));
 		break;
 	case SME_FRAGMENTATION_THRESHOLD_REQUEST:
 		val = cpu_to_le32((uint32_t)(priv->reg.fragment));
 		hostif_mib_set_request(priv, DOT11_FRAGMENTATION_THRESHOLD,
-				       sizeof(val), MIB_VALUE_TYPE_INT, &val);
+				       MIB_VALUE_TYPE_INT, &val, sizeof(val));
 		break;
 	case SME_WEP_INDEX_REQUEST:
 	case SME_WEP_KEY1_REQUEST:
@@ -2169,22 +2173,22 @@ static void hostif_sme_execute(struct ks_wlan_private *priv, int event)
 		break;
 	case SME_WPS_ENABLE_REQUEST:
 		hostif_mib_set_request(priv, LOCAL_WPS_ENABLE,
-				       sizeof(priv->wps.wps_enabled),
 				       MIB_VALUE_TYPE_INT,
-				       &priv->wps.wps_enabled);
+				       &priv->wps.wps_enabled,
+				       sizeof(priv->wps.wps_enabled));
 		break;
 	case SME_WPS_PROBE_REQUEST:
 		hostif_mib_set_request(priv, LOCAL_WPS_PROBE_REQ,
-				       priv->wps.ielen,
-				       MIB_VALUE_TYPE_OSTRING, priv->wps.ie);
+				       MIB_VALUE_TYPE_OSTRING, priv->wps.ie,
+				       priv->wps.ielen);
 		break;
 	case SME_MODE_SET_REQUEST:
 		hostif_sme_mode_setup(priv);
 		break;
 	case SME_SET_GAIN:
 		hostif_mib_set_request(priv, LOCAL_GAIN,
-				       sizeof(priv->gain),
-				       MIB_VALUE_TYPE_OSTRING, &priv->gain);
+				       MIB_VALUE_TYPE_OSTRING, &priv->gain,
+				       sizeof(priv->gain));
 		break;
 	case SME_GET_GAIN:
 		hostif_mib_get_request(priv, LOCAL_GAIN);
@@ -2211,7 +2215,7 @@ static void hostif_sme_execute(struct ks_wlan_private *priv, int event)
 	case SME_SET_REGION:
 		val = cpu_to_le32((uint32_t)(priv->region));
 		hostif_mib_set_request(priv, LOCAL_REGION,
-				       sizeof(val), MIB_VALUE_TYPE_INT, &val);
+				       MIB_VALUE_TYPE_INT, &val, sizeof(val));
 		break;
 	case SME_MULTICAST_CONFIRM:
 	case SME_BSS_SCAN_CONFIRM:
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 06/10] staging: ks7010: add new helpers to achieve mib set request and simplify code
  2018-04-27 14:05 [PATCH 00/10] staging: ks7010: next cleanups Sergio Paracuellos
                   ` (4 preceding siblings ...)
  2018-04-27 14:05 ` [PATCH 05/10] staging: ks7010: change parameter types and reorder them in hostif_mib_set_request Sergio Paracuellos
@ 2018-04-27 14:06 ` Sergio Paracuellos
  2018-04-27 14:06 ` [PATCH 07/10] staging: ks7010: use ether_addr_copy in get_current_ap Sergio Paracuellos
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 13+ messages in thread
From: Sergio Paracuellos @ 2018-04-27 14:06 UTC (permalink / raw)
  To: gregkh; +Cc: wsa, driverdev-devel

New three functions have been created to centralice and simplify
calls related with set MIB requests:

    - hostif_mib_set_request_int
    - hostif_mib_set_request_bool
    - hostif_mib_set_request_ostring

Using these in different calls simplify functions related with
this mainly when types are bool and int because no more conversions
are needed in the caller functions. Those conversion details are
now located in the new helpers improving a lot readability. Calls
in hostif_sme_set_wep function has change also some if's to check
invalid value first avoiding one level indentation.

Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
---
 drivers/staging/ks7010/ks_hostif.c | 225 ++++++++++++++++++-------------------
 1 file changed, 109 insertions(+), 116 deletions(-)

diff --git a/drivers/staging/ks7010/ks_hostif.c b/drivers/staging/ks7010/ks_hostif.c
index 9b25221..b22dc0c 100644
--- a/drivers/staging/ks7010/ks_hostif.c
+++ b/drivers/staging/ks7010/ks_hostif.c
@@ -1216,6 +1216,32 @@ static void hostif_mib_set_request(struct ks_wlan_private *priv,
 	ks_wlan_hw_tx(priv, pp, hif_align_size(sizeof(*pp) + size), NULL, NULL);
 }
 
+static inline void hostif_mib_set_request_int(struct ks_wlan_private *priv,
+					      enum mib_attribute attr, int val)
+{
+	__le32 v = cpu_to_le32((u32)val);
+	size_t size = sizeof(v);
+
+	hostif_mib_set_request(priv, attr, MIB_VALUE_TYPE_INT, &v, size);
+}
+
+static inline void hostif_mib_set_request_bool(struct ks_wlan_private *priv,
+					       enum mib_attribute attr,
+					       bool val)
+{
+	__le32 v = cpu_to_le32((u32)val);
+	size_t size = sizeof(v);
+
+	hostif_mib_set_request(priv, attr, MIB_VALUE_TYPE_BOOL, &v, size);
+}
+
+static inline void hostif_mib_set_request_ostring(struct ks_wlan_private *priv,
+						  enum mib_attribute attr,
+						  void *data, size_t size)
+{
+	hostif_mib_set_request(priv, attr, MIB_VALUE_TYPE_OSTRING, data, size);
+}
+
 static
 void hostif_start_request(struct ks_wlan_private *priv, unsigned char mode)
 {
@@ -1548,53 +1574,48 @@ void hostif_receive(struct ks_wlan_private *priv, unsigned char *p,
 		hostif_event_check(priv);
 }
 
-static
-void hostif_sme_set_wep(struct ks_wlan_private *priv, int type)
+static void hostif_sme_set_wep(struct ks_wlan_private *priv, int type)
 {
-	__le32 val;
-
 	switch (type) {
 	case SME_WEP_INDEX_REQUEST:
-		val = cpu_to_le32((uint32_t)(priv->reg.wep_index));
-		hostif_mib_set_request(priv, DOT11_WEP_DEFAULT_KEY_ID,
-				       MIB_VALUE_TYPE_INT, &val, sizeof(val));
+		hostif_mib_set_request_int(priv, DOT11_WEP_DEFAULT_KEY_ID,
+					   priv->reg.wep_index);
 		break;
 	case SME_WEP_KEY1_REQUEST:
-		if (!priv->wpa.wpa_enabled)
-			hostif_mib_set_request(priv,
+		if (priv->wpa.wpa_enabled)
+			return;
+		hostif_mib_set_request_ostring(priv,
 					       DOT11_WEP_DEFAULT_KEY_VALUE1,
-					       MIB_VALUE_TYPE_OSTRING,
 					       &priv->reg.wep_key[0].val[0],
 					       priv->reg.wep_key[0].size);
 		break;
 	case SME_WEP_KEY2_REQUEST:
-		if (!priv->wpa.wpa_enabled)
-			hostif_mib_set_request(priv,
+		if (priv->wpa.wpa_enabled)
+			return;
+		hostif_mib_set_request_ostring(priv,
 					       DOT11_WEP_DEFAULT_KEY_VALUE2,
-					       MIB_VALUE_TYPE_OSTRING,
 					       &priv->reg.wep_key[1].val[0],
 					       priv->reg.wep_key[1].size);
 		break;
 	case SME_WEP_KEY3_REQUEST:
-		if (!priv->wpa.wpa_enabled)
-			hostif_mib_set_request(priv,
+		if (priv->wpa.wpa_enabled)
+			return;
+		hostif_mib_set_request_ostring(priv,
 					       DOT11_WEP_DEFAULT_KEY_VALUE3,
-					       MIB_VALUE_TYPE_OSTRING,
 					       &priv->reg.wep_key[2].val[0],
 					       priv->reg.wep_key[2].size);
 		break;
 	case SME_WEP_KEY4_REQUEST:
-		if (!priv->wpa.wpa_enabled)
-			hostif_mib_set_request(priv,
+		if (priv->wpa.wpa_enabled)
+			return;
+		hostif_mib_set_request_ostring(priv,
 					       DOT11_WEP_DEFAULT_KEY_VALUE4,
-					       MIB_VALUE_TYPE_OSTRING,
 					       &priv->reg.wep_key[3].val[0],
 					       priv->reg.wep_key[3].size);
 		break;
 	case SME_WEP_FLAG_REQUEST:
-		val = cpu_to_le32((uint32_t)(priv->reg.privacy_invoked));
-		hostif_mib_set_request(priv, DOT11_PRIVACY_INVOKED,
-				       MIB_VALUE_TYPE_BOOL, &val, sizeof(val));
+		hostif_mib_set_request_bool(priv, DOT11_PRIVACY_INVOKED,
+				            priv->reg.privacy_invoked);
 		break;
 	}
 }
@@ -1614,7 +1635,6 @@ void hostif_sme_set_rsn(struct ks_wlan_private *priv, int type)
 {
 	struct wpa_suite wpa_suite;
 	struct rsn_mode rsn_mode;
-	__le32 val;
 	size_t size;
 
 	memset(&wpa_suite, 0, sizeof(wpa_suite));
@@ -1667,9 +1687,9 @@ void hostif_sme_set_rsn(struct ks_wlan_private *priv, int type)
 
 		size = sizeof(wpa_suite.size) +
 		       (CIPHER_ID_LEN * le16_to_cpu(wpa_suite.size));
-		hostif_mib_set_request(priv, DOT11_RSN_CONFIG_UNICAST_CIPHER,
-				       MIB_VALUE_TYPE_OSTRING,
-				       &wpa_suite, size);
+		hostif_mib_set_request_ostring(priv,
+					       DOT11_RSN_CONFIG_UNICAST_CIPHER,
+					       &wpa_suite, size);
 		break;
 	case SME_RSN_MCAST_REQUEST:
 		switch (priv->wpa.group_suite) {
@@ -1714,10 +1734,10 @@ void hostif_sme_set_rsn(struct ks_wlan_private *priv, int type)
 				       CIPHER_ID_WPA_WEP104, CIPHER_ID_LEN);
 			break;
 		}
-
-		hostif_mib_set_request(priv, DOT11_RSN_CONFIG_MULTICAST_CIPHER,
-				       MIB_VALUE_TYPE_OSTRING,
-				       &wpa_suite.suite[0][0], CIPHER_ID_LEN);
+		hostif_mib_set_request_ostring(priv,
+					       DOT11_RSN_CONFIG_MULTICAST_CIPHER,
+					       &wpa_suite.suite[0][0],
+					       CIPHER_ID_LEN);
 		break;
 	case SME_RSN_AUTH_REQUEST:
 		wpa_suite.size = cpu_to_le16((uint16_t)1);
@@ -1760,14 +1780,13 @@ void hostif_sme_set_rsn(struct ks_wlan_private *priv, int type)
 
 		size = sizeof(wpa_suite.size) +
 		       (KEY_MGMT_ID_LEN * le16_to_cpu(wpa_suite.size));
-		hostif_mib_set_request(priv, DOT11_RSN_CONFIG_AUTH_SUITE,
-				       MIB_VALUE_TYPE_OSTRING, &wpa_suite,
-				       size);
+		hostif_mib_set_request_ostring(priv,
+					       DOT11_RSN_CONFIG_AUTH_SUITE,
+					       &wpa_suite, size);
 		break;
 	case SME_RSN_ENABLED_REQUEST:
-		val = cpu_to_le32((uint32_t)(priv->wpa.rsn_enabled));
-		hostif_mib_set_request(priv, DOT11_RSN_ENABLED,
-				       MIB_VALUE_TYPE_BOOL, &val, sizeof(val));
+		hostif_mib_set_request_bool(priv, DOT11_RSN_ENABLED,
+					    priv->wpa.rsn_enabled);
 		break;
 	case SME_RSN_MODE_REQUEST:
 		if (priv->wpa.version == IW_AUTH_WPA_VERSION_WPA2) {
@@ -1783,9 +1802,8 @@ void hostif_sme_set_rsn(struct ks_wlan_private *priv, int type)
 			    cpu_to_le32((uint32_t)RSN_MODE_NONE);
 			rsn_mode.rsn_capability = cpu_to_le16((uint16_t)0);
 		}
-		hostif_mib_set_request(priv, LOCAL_RSN_MODE,
-				       MIB_VALUE_TYPE_OSTRING, &rsn_mode,
-				       sizeof(rsn_mode));
+		hostif_mib_set_request_ostring(priv, LOCAL_RSN_MODE,
+					       &rsn_mode, sizeof(rsn_mode));
 		break;
 	}
 }
@@ -1896,7 +1914,6 @@ void hostif_sme_multicast_set(struct ks_wlan_private *priv)
 	int mc_count;
 	struct netdev_hw_addr *ha;
 	char set_address[NIC_MAX_MCAST_LIST * ETH_ALEN];
-	__le32 filter_type;
 	int i = 0;
 
 	spin_lock(&priv->multicast_spin);
@@ -1904,19 +1921,15 @@ void hostif_sme_multicast_set(struct ks_wlan_private *priv)
 	memset(set_address, 0, NIC_MAX_MCAST_LIST * ETH_ALEN);
 
 	if (dev->flags & IFF_PROMISC) {
-		filter_type = cpu_to_le32((uint32_t)MCAST_FILTER_PROMISC);
-		hostif_mib_set_request(priv, LOCAL_MULTICAST_FILTER,
-				       MIB_VALUE_TYPE_BOOL,
-				       &filter_type, sizeof(filter_type));
+		hostif_mib_set_request_bool(priv, LOCAL_MULTICAST_FILTER,
+					    MCAST_FILTER_PROMISC);
 		goto spin_unlock;
 	}
 
 	if ((netdev_mc_count(dev) > NIC_MAX_MCAST_LIST) ||
 	    (dev->flags & IFF_ALLMULTI)) {
-		filter_type = cpu_to_le32((uint32_t)MCAST_FILTER_MCASTALL);
-		hostif_mib_set_request(priv, LOCAL_MULTICAST_FILTER,
-				       MIB_VALUE_TYPE_BOOL,
-				       &filter_type, sizeof(filter_type));
+		hostif_mib_set_request_bool(priv, LOCAL_MULTICAST_FILTER,
+					    MCAST_FILTER_MCASTALL);
 		goto spin_unlock;
 	}
 
@@ -1927,15 +1940,13 @@ void hostif_sme_multicast_set(struct ks_wlan_private *priv)
 			i++;
 		}
 		priv->sme_i.sme_flag &= ~SME_MULTICAST;
-		hostif_mib_set_request(priv, LOCAL_MULTICAST_ADDRESS,
-				       MIB_VALUE_TYPE_OSTRING,
-				       &set_address[0], ETH_ALEN * mc_count);
+		hostif_mib_set_request_ostring(priv, LOCAL_MULTICAST_ADDRESS,
+					       &set_address[0],
+					       ETH_ALEN * mc_count);
 	} else {
-		filter_type = cpu_to_le32((uint32_t)MCAST_FILTER_MCAST);
 		priv->sme_i.sme_flag |= SME_MULTICAST;
-		hostif_mib_set_request(priv, LOCAL_MULTICAST_FILTER,
-				       MIB_VALUE_TYPE_BOOL,
-				       &filter_type, sizeof(filter_type));
+		hostif_mib_set_request_bool(priv, LOCAL_MULTICAST_FILTER,
+					    MCAST_FILTER_MCAST);
 	}
 
 spin_unlock:
@@ -1987,60 +1998,53 @@ static void hostif_sme_sleep_set(struct ks_wlan_private *priv)
 static
 void hostif_sme_set_key(struct ks_wlan_private *priv, int type)
 {
-	__le32 val;
-
 	switch (type) {
 	case SME_SET_FLAG:
-		val = cpu_to_le32((uint32_t)(priv->reg.privacy_invoked));
-		hostif_mib_set_request(priv, DOT11_PRIVACY_INVOKED,
-				       MIB_VALUE_TYPE_BOOL, &val, sizeof(val));
+		hostif_mib_set_request_bool(priv, DOT11_PRIVACY_INVOKED,
+					    priv->reg.privacy_invoked);
 		break;
 	case SME_SET_TXKEY:
-		val = cpu_to_le32((uint32_t)(priv->wpa.txkey));
-		hostif_mib_set_request(priv, DOT11_WEP_DEFAULT_KEY_ID,
-				       MIB_VALUE_TYPE_INT, &val, sizeof(val));
+		hostif_mib_set_request_int(priv, DOT11_WEP_DEFAULT_KEY_ID,
+					   priv->wpa.txkey);
 		break;
 	case SME_SET_KEY1:
-		hostif_mib_set_request(priv, DOT11_WEP_DEFAULT_KEY_VALUE1,
-				       MIB_VALUE_TYPE_OSTRING,
-				       &priv->wpa.key[0].key_val[0],
-				       priv->wpa.key[0].key_len);
+		hostif_mib_set_request_ostring(priv,
+					       DOT11_WEP_DEFAULT_KEY_VALUE1,
+					       &priv->wpa.key[0].key_val[0],
+					       priv->wpa.key[0].key_len);
 		break;
 	case SME_SET_KEY2:
-		hostif_mib_set_request(priv, DOT11_WEP_DEFAULT_KEY_VALUE2,
-				       MIB_VALUE_TYPE_OSTRING,
-				       &priv->wpa.key[1].key_val[0],
-				       priv->wpa.key[1].key_len);
+		hostif_mib_set_request_ostring(priv,
+					       DOT11_WEP_DEFAULT_KEY_VALUE2,
+				               &priv->wpa.key[1].key_val[0],
+				               priv->wpa.key[1].key_len);
 		break;
 	case SME_SET_KEY3:
-		hostif_mib_set_request(priv, DOT11_WEP_DEFAULT_KEY_VALUE3,
-				       MIB_VALUE_TYPE_OSTRING,
-				       &priv->wpa.key[2].key_val[0],
-				       priv->wpa.key[2].key_len);
+		hostif_mib_set_request_ostring(priv,
+					       DOT11_WEP_DEFAULT_KEY_VALUE3,
+					       &priv->wpa.key[2].key_val[0],
+				               priv->wpa.key[2].key_len);
 		break;
 	case SME_SET_KEY4:
-		hostif_mib_set_request(priv, DOT11_WEP_DEFAULT_KEY_VALUE4,
-				       MIB_VALUE_TYPE_OSTRING,
-				       &priv->wpa.key[3].key_val[0],
-				       priv->wpa.key[3].key_len);
+		hostif_mib_set_request_ostring(priv,
+					       DOT11_WEP_DEFAULT_KEY_VALUE4,
+					       &priv->wpa.key[3].key_val[0],
+				               priv->wpa.key[3].key_len);
 		break;
 	case SME_SET_PMK_TSC:
-		hostif_mib_set_request(priv, DOT11_PMK_TSC,
-				       MIB_VALUE_TYPE_OSTRING,
-				       &priv->wpa.key[0].rx_seq[0],
-				       WPA_RX_SEQ_LEN);
+		hostif_mib_set_request_ostring(priv, DOT11_PMK_TSC,
+				               &priv->wpa.key[0].rx_seq[0],
+				               WPA_RX_SEQ_LEN);
 		break;
 	case SME_SET_GMK1_TSC:
-		hostif_mib_set_request(priv, DOT11_GMK1_TSC,
-				       MIB_VALUE_TYPE_OSTRING,
-				       &priv->wpa.key[1].rx_seq[0],
-				       WPA_RX_SEQ_LEN);
+		hostif_mib_set_request_ostring(priv, DOT11_GMK1_TSC,
+				               &priv->wpa.key[1].rx_seq[0],
+					       WPA_RX_SEQ_LEN);
 		break;
 	case SME_SET_GMK2_TSC:
-		hostif_mib_set_request(priv, DOT11_GMK2_TSC,
-				       MIB_VALUE_TYPE_OSTRING,
-				       &priv->wpa.key[2].rx_seq[0],
-				       WPA_RX_SEQ_LEN);
+		hostif_mib_set_request_ostring(priv, DOT11_GMK2_TSC,
+					       &priv->wpa.key[2].rx_seq[0],
+					       WPA_RX_SEQ_LEN);
 		break;
 	}
 }
@@ -2069,14 +2073,12 @@ void hostif_sme_set_pmksa(struct ks_wlan_private *priv)
 	pmkcache.size = cpu_to_le16((uint16_t)(priv->pmklist.size));
 	size = sizeof(priv->pmklist.size) +
 	       ((ETH_ALEN + IW_PMKID_LEN) * priv->pmklist.size);
-	hostif_mib_set_request(priv, LOCAL_PMK,
-			       MIB_VALUE_TYPE_OSTRING, &pmkcache, size);
+	hostif_mib_set_request_ostring(priv, LOCAL_PMK, &pmkcache, size);
 }
 
 /* execute sme */
 static void hostif_sme_execute(struct ks_wlan_private *priv, int event)
 {
-	__le32 val;
 	u16 failure;
 
 	switch (event) {
@@ -2088,9 +2090,8 @@ static void hostif_sme_execute(struct ks_wlan_private *priv, int event)
 		hostif_sme_multicast_set(priv);
 		break;
 	case SME_MACADDRESS_SET_REQUEST:
-		hostif_mib_set_request(priv, LOCAL_CURRENTADDRESS,
-				       MIB_VALUE_TYPE_OSTRING,
-				       &priv->eth_addr[0], ETH_ALEN);
+		hostif_mib_set_request_ostring(priv, LOCAL_CURRENTADDRESS,
+					       &priv->eth_addr[0], ETH_ALEN);
 		break;
 	case SME_BSS_SCAN_REQUEST:
 		hostif_bss_scan_request(priv, priv->reg.scan_type,
@@ -2133,14 +2134,12 @@ static void hostif_sme_execute(struct ks_wlan_private *priv, int event)
 		hostif_stop_request(priv);
 		break;
 	case SME_RTS_THRESHOLD_REQUEST:
-		val = cpu_to_le32((uint32_t)(priv->reg.rts));
-		hostif_mib_set_request(priv, DOT11_RTS_THRESHOLD,
-				       MIB_VALUE_TYPE_INT, &val, sizeof(val));
+		hostif_mib_set_request_int(priv, DOT11_RTS_THRESHOLD,
+					   priv->reg.rts);
 		break;
 	case SME_FRAGMENTATION_THRESHOLD_REQUEST:
-		val = cpu_to_le32((uint32_t)(priv->reg.fragment));
-		hostif_mib_set_request(priv, DOT11_FRAGMENTATION_THRESHOLD,
-				       MIB_VALUE_TYPE_INT, &val, sizeof(val));
+		hostif_mib_set_request_int(priv, DOT11_FRAGMENTATION_THRESHOLD,
+					   priv->reg.fragment);
 		break;
 	case SME_WEP_INDEX_REQUEST:
 	case SME_WEP_KEY1_REQUEST:
@@ -2172,23 +2171,19 @@ static void hostif_sme_execute(struct ks_wlan_private *priv, int event)
 		hostif_sme_set_pmksa(priv);
 		break;
 	case SME_WPS_ENABLE_REQUEST:
-		hostif_mib_set_request(priv, LOCAL_WPS_ENABLE,
-				       MIB_VALUE_TYPE_INT,
-				       &priv->wps.wps_enabled,
-				       sizeof(priv->wps.wps_enabled));
+		hostif_mib_set_request_int(priv, LOCAL_WPS_ENABLE,
+				           priv->wps.wps_enabled);
 		break;
 	case SME_WPS_PROBE_REQUEST:
-		hostif_mib_set_request(priv, LOCAL_WPS_PROBE_REQ,
-				       MIB_VALUE_TYPE_OSTRING, priv->wps.ie,
-				       priv->wps.ielen);
+		hostif_mib_set_request_ostring(priv, LOCAL_WPS_PROBE_REQ,
+					       priv->wps.ie, priv->wps.ielen);
 		break;
 	case SME_MODE_SET_REQUEST:
 		hostif_sme_mode_setup(priv);
 		break;
 	case SME_SET_GAIN:
-		hostif_mib_set_request(priv, LOCAL_GAIN,
-				       MIB_VALUE_TYPE_OSTRING, &priv->gain,
-				       sizeof(priv->gain));
+		hostif_mib_set_request_ostring(priv, LOCAL_GAIN,
+					       &priv->gain, sizeof(priv->gain));
 		break;
 	case SME_GET_GAIN:
 		hostif_mib_get_request(priv, LOCAL_GAIN);
@@ -2213,9 +2208,7 @@ static void hostif_sme_execute(struct ks_wlan_private *priv, int event)
 		hostif_sme_sleep_set(priv);
 		break;
 	case SME_SET_REGION:
-		val = cpu_to_le32((uint32_t)(priv->region));
-		hostif_mib_set_request(priv, LOCAL_REGION,
-				       MIB_VALUE_TYPE_INT, &val, sizeof(val));
+		hostif_mib_set_request_int(priv, LOCAL_REGION, priv->region);
 		break;
 	case SME_MULTICAST_CONFIRM:
 	case SME_BSS_SCAN_CONFIRM:
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 07/10] staging: ks7010: use ether_addr_copy in get_current_ap
  2018-04-27 14:05 [PATCH 00/10] staging: ks7010: next cleanups Sergio Paracuellos
                   ` (5 preceding siblings ...)
  2018-04-27 14:06 ` [PATCH 06/10] staging: ks7010: add new helpers to achieve mib set request and simplify code Sergio Paracuellos
@ 2018-04-27 14:06 ` Sergio Paracuellos
  2018-04-27 14:06 ` [PATCH 08/10] staging: ks7010: move two preprocessor definitions to ks_wlan.h Sergio Paracuellos
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 13+ messages in thread
From: Sergio Paracuellos @ 2018-04-27 14:06 UTC (permalink / raw)
  To: gregkh; +Cc: driverdev-devel, wsa

Instead of use memcpy to copy ethernet addresses use
ether_addr_copy created for that.

Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
---
 drivers/staging/ks7010/ks_hostif.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/ks7010/ks_hostif.c b/drivers/staging/ks7010/ks_hostif.c
index b22dc0c..f8bca54 100644
--- a/drivers/staging/ks7010/ks_hostif.c
+++ b/drivers/staging/ks7010/ks_hostif.c
@@ -110,7 +110,7 @@ int get_current_ap(struct ks_wlan_private *priv, struct link_ap_info *ap_info)
 		return -EPERM;
 	}
 
-	memcpy(ap->bssid, ap_info->bssid, ETH_ALEN);
+	ether_addr_copy(ap->bssid, ap_info->bssid);
 	memcpy(ap->ssid.body, priv->reg.ssid.body,
 	       priv->reg.ssid.size);
 	ap->ssid.size = priv->reg.ssid.size;
-- 
2.7.4

_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 08/10] staging: ks7010: move two preprocessor definitions to ks_wlan.h
  2018-04-27 14:05 [PATCH 00/10] staging: ks7010: next cleanups Sergio Paracuellos
                   ` (6 preceding siblings ...)
  2018-04-27 14:06 ` [PATCH 07/10] staging: ks7010: use ether_addr_copy in get_current_ap Sergio Paracuellos
@ 2018-04-27 14:06 ` Sergio Paracuellos
  2018-04-27 14:06 ` [PATCH 09/10] staging: ks7010: avoid two long lines in hostif_sme_mode_setup Sergio Paracuellos
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 13+ messages in thread
From: Sergio Paracuellos @ 2018-04-27 14:06 UTC (permalink / raw)
  To: gregkh; +Cc: driverdev-devel, wsa

In ks_wlan_translate_scan function there are two preprocessor
definitions:

    - RSN_INFO_ELEM_ID
    - GENERIC_INFO_ELEM_ID

These can be moved to common ks_wlan.h because they can be used
in get_current_ap function instead of use hardcoded values.
GENERIC_INFO_ELEM_ID has been renamed to WPA_INFO_ELEM_ID which
is more clear.

Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
---
 drivers/staging/ks7010/ks_hostif.c   | 4 ++--
 drivers/staging/ks7010/ks_wlan.h     | 3 +++
 drivers/staging/ks7010/ks_wlan_net.c | 4 +---
 3 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/ks7010/ks_hostif.c b/drivers/staging/ks7010/ks_hostif.c
index f8bca54..0054c48 100644
--- a/drivers/staging/ks7010/ks_hostif.c
+++ b/drivers/staging/ks7010/ks_hostif.c
@@ -132,12 +132,12 @@ int get_current_ap(struct ks_wlan_private *priv, struct link_ap_info *ap_info)
 		ap_info->rsn.size : RSN_IE_BODY_MAX;
 	if ((ap_info->rsn_mode & RSN_MODE_WPA2) &&
 	    (priv->wpa.version == IW_AUTH_WPA_VERSION_WPA2)) {
-		ap->rsn_ie.id = 0x30;
+		ap->rsn_ie.id = RSN_INFO_ELEM_ID;
 		ap->rsn_ie.size = size;
 		memcpy(ap->rsn_ie.body, ap_info->rsn.body, size);
 	} else if ((ap_info->rsn_mode & RSN_MODE_WPA) &&
 		   (priv->wpa.version == IW_AUTH_WPA_VERSION_WPA)) {
-		ap->wpa_ie.id = 0xdd;
+		ap->wpa_ie.id = WPA_INFO_ELEM_ID;
 		ap->wpa_ie.size = size;
 		memcpy(ap->wpa_ie.body, ap_info->rsn.body, size);
 	} else {
diff --git a/drivers/staging/ks7010/ks_wlan.h b/drivers/staging/ks7010/ks_wlan.h
index fb080fe..dd42692 100644
--- a/drivers/staging/ks7010/ks_wlan.h
+++ b/drivers/staging/ks7010/ks_wlan.h
@@ -190,6 +190,9 @@ struct rsn_ie {
 	u8 body[RSN_IE_BODY_MAX];
 } __packed;
 
+#define WPA_INFO_ELEM_ID 0xdd
+#define RSN_INFO_ELEM_ID 0x30
+
 #define WPS_IE_BODY_MAX 255
 struct wps_ie {
 	u8 id;	/* 221 'dd <len> 00 50 F2 04' */
diff --git a/drivers/staging/ks7010/ks_wlan_net.c b/drivers/staging/ks7010/ks_wlan_net.c
index e964779..838db49 100644
--- a/drivers/staging/ks7010/ks_wlan_net.c
+++ b/drivers/staging/ks7010/ks_wlan_net.c
@@ -1268,14 +1268,12 @@ static inline char *ks_wlan_translate_scan(struct net_device *dev,
 	if ((current_val - current_ev) > IW_EV_LCP_LEN)
 		current_ev = current_val;
 
-#define GENERIC_INFO_ELEM_ID 0xdd
-#define RSN_INFO_ELEM_ID 0x30
 	if (ap->rsn_ie.id == RSN_INFO_ELEM_ID && ap->rsn_ie.size != 0)
 		current_ev = ks_wlan_add_leader_event(rsn_leader, end_buf,
 						      current_ev, &ap->rsn_ie,
 						      &iwe, info);
 
-	if (ap->wpa_ie.id == GENERIC_INFO_ELEM_ID && ap->wpa_ie.size != 0)
+	if (ap->wpa_ie.id == WPA_INFO_ELEM_ID && ap->wpa_ie.size != 0)
 		current_ev = ks_wlan_add_leader_event(wpa_leader, end_buf,
 						      current_ev, &ap->wpa_ie,
 						      &iwe, info);
-- 
2.7.4

_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 09/10] staging: ks7010: avoid two long lines in hostif_sme_mode_setup
  2018-04-27 14:05 [PATCH 00/10] staging: ks7010: next cleanups Sergio Paracuellos
                   ` (7 preceding siblings ...)
  2018-04-27 14:06 ` [PATCH 08/10] staging: ks7010: move two preprocessor definitions to ks_wlan.h Sergio Paracuellos
@ 2018-04-27 14:06 ` Sergio Paracuellos
  2018-04-27 14:06 ` [PATCH 10/10] staging: ks7010: remove non sense comments in ks_hostif.c source file Sergio Paracuellos
  2018-04-29 13:23 ` [PATCH 00/10] staging: ks7010: next cleanups Greg KH
  10 siblings, 0 replies; 13+ messages in thread
From: Sergio Paracuellos @ 2018-04-27 14:06 UTC (permalink / raw)
  To: gregkh; +Cc: driverdev-devel, wsa

This commit avoid two checkpatch script complains about
two long lines.

Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
---
 drivers/staging/ks7010/ks_hostif.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/ks7010/ks_hostif.c b/drivers/staging/ks7010/ks_hostif.c
index 0054c48..b812011 100644
--- a/drivers/staging/ks7010/ks_hostif.c
+++ b/drivers/staging/ks7010/ks_hostif.c
@@ -1886,9 +1886,11 @@ void hostif_sme_mode_setup(struct ks_wlan_private *priv)
 		break;
 	case MODE_INFRASTRUCTURE:
 		if (!is_valid_ether_addr((u8 *)priv->reg.bssid)) {
-			hostif_infrastructure_set_request(priv, HIF_INFRA_SET_REQ);
+			hostif_infrastructure_set_request(priv,
+							  HIF_INFRA_SET_REQ);
 		} else {
-			hostif_infrastructure_set_request(priv, HIF_INFRA_SET2_REQ);
+			hostif_infrastructure_set_request(priv,
+							  HIF_INFRA_SET2_REQ);
 			netdev_dbg(priv->net_dev,
 				   "Infra bssid = %pM\n", priv->reg.bssid);
 		}
-- 
2.7.4

_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 10/10] staging: ks7010: remove non sense comments in ks_hostif.c source file
  2018-04-27 14:05 [PATCH 00/10] staging: ks7010: next cleanups Sergio Paracuellos
                   ` (8 preceding siblings ...)
  2018-04-27 14:06 ` [PATCH 09/10] staging: ks7010: avoid two long lines in hostif_sme_mode_setup Sergio Paracuellos
@ 2018-04-27 14:06 ` Sergio Paracuellos
  2018-04-29 13:23 ` [PATCH 00/10] staging: ks7010: next cleanups Greg KH
  10 siblings, 0 replies; 13+ messages in thread
From: Sergio Paracuellos @ 2018-04-27 14:06 UTC (permalink / raw)
  To: gregkh; +Cc: driverdev-devel, wsa

Comments which say the same as the code are not useful at all
so just remove them.

Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
---
 drivers/staging/ks7010/ks_hostif.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/ks7010/ks_hostif.c b/drivers/staging/ks7010/ks_hostif.c
index b812011..0ab2e1b 100644
--- a/drivers/staging/ks7010/ks_hostif.c
+++ b/drivers/staging/ks7010/ks_hostif.c
@@ -467,10 +467,10 @@ void hostif_mib_get_confirm(struct ks_wlan_private *priv)
 	u16 mib_val_size;
 	u16 mib_val_type;
 
-	mib_status = get_dword(priv);	/* MIB status */
-	mib_attribute = get_dword(priv);	/* MIB atttibute */
-	mib_val_size = get_word(priv);	/* MIB value size */
-	mib_val_type = get_word(priv);	/* MIB value type */
+	mib_status = get_dword(priv);
+	mib_attribute = get_dword(priv);
+	mib_val_size = get_word(priv);
+	mib_val_type = get_word(priv);
 
 	if (mib_status) {
 		netdev_err(priv->net_dev, "attribute=%08X, status=%08X\n",
@@ -527,11 +527,11 @@ void hostif_mib_get_confirm(struct ks_wlan_private *priv)
 static
 void hostif_mib_set_confirm(struct ks_wlan_private *priv)
 {
-	u32 mib_status;	/* +04 MIB Status */
-	u32 mib_attribute;	/* +08 MIB attribute */
+	u32 mib_status;
+	u32 mib_attribute;
 
-	mib_status = get_dword(priv);	/* MIB Status */
-	mib_attribute = get_dword(priv);	/* MIB attribute */
+	mib_status = get_dword(priv);
+	mib_attribute = get_dword(priv);
 
 	if (mib_status) {
 		/* in case of error */
-- 
2.7.4

_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [PATCH 00/10] staging: ks7010: next cleanups
  2018-04-27 14:05 [PATCH 00/10] staging: ks7010: next cleanups Sergio Paracuellos
                   ` (9 preceding siblings ...)
  2018-04-27 14:06 ` [PATCH 10/10] staging: ks7010: remove non sense comments in ks_hostif.c source file Sergio Paracuellos
@ 2018-04-29 13:23 ` Greg KH
  2018-04-30 13:40   ` Sergio Paracuellos
  10 siblings, 1 reply; 13+ messages in thread
From: Greg KH @ 2018-04-29 13:23 UTC (permalink / raw)
  To: Sergio Paracuellos; +Cc: driverdev-devel, wsa

On Fri, Apr 27, 2018 at 04:05:54PM +0200, Sergio Paracuellos wrote:
> Cleanups continues with this patch series. Main changes are 
> related with MIB where some preprocessor stuff has been change
> in favour of an enumeration and some helper functions to increase
> code readability has been included. Other changes are minor 
> cleanups in different part of code.
> 
> Sergio Paracuellos (10):
>   staging: ks7010: clean SME_MIC_FAILURE_REQUEST case in
>     hostif_sme_execute
>   staging: ks7010: convert MIB preprocessor defs into an enum
>   staging: ks7010: conver MIB attributes preprocessor defs into an enum
>   staging: ks7010: change some casts from uint8_t to u8 in ks_hostif
>     header
>   staging: ks7010: change parameter types and reorder them in
>     hostif_mib_set_request
>   staging: ks7010: add new helpers to achieve mib set request and
>     simplify code
>   staging: ks7010: use ether_addr_copy in get_current_ap
>   staging: ks7010: move two preprocessor definitions to ks_wlan.h
>   staging: ks7010: avoid two long lines in hostif_sme_mode_setup
>   staging: ks7010: remove non sense comments in ks_hostif.c source file
> 
>  drivers/staging/ks7010/ks_hostif.c   | 320 +++++++++++++++++------------------
>  drivers/staging/ks7010/ks_hostif.h   | 175 ++++++++++++-------
>  drivers/staging/ks7010/ks_wlan.h     |   3 +
>  drivers/staging/ks7010/ks_wlan_net.c |   4 +-
>  4 files changed, 275 insertions(+), 227 deletions(-)

I now have 31+ emails from you in my to-review queue.  These are
multiple series of patches, yet I have no idea what order they are in at
all.

Please make it easy on me, make it obvious what to do, and what to apply
in what order.

I'm dropping all of your emails now, please resend everything I have not
applied, in a _SINGLE_ patch series so I can handle it properly.

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 00/10] staging: ks7010: next cleanups
  2018-04-29 13:23 ` [PATCH 00/10] staging: ks7010: next cleanups Greg KH
@ 2018-04-30 13:40   ` Sergio Paracuellos
  0 siblings, 0 replies; 13+ messages in thread
From: Sergio Paracuellos @ 2018-04-30 13:40 UTC (permalink / raw)
  To: Greg KH; +Cc: driverdev-devel, wsa

On Sun, Apr 29, 2018 at 03:23:02PM +0200, Greg KH wrote:
> On Fri, Apr 27, 2018 at 04:05:54PM +0200, Sergio Paracuellos wrote:
> > Cleanups continues with this patch series. Main changes are 
> > related with MIB where some preprocessor stuff has been change
> > in favour of an enumeration and some helper functions to increase
> > code readability has been included. Other changes are minor 
> > cleanups in different part of code.
> > 
> > Sergio Paracuellos (10):
> >   staging: ks7010: clean SME_MIC_FAILURE_REQUEST case in
> >     hostif_sme_execute
> >   staging: ks7010: convert MIB preprocessor defs into an enum
> >   staging: ks7010: conver MIB attributes preprocessor defs into an enum
> >   staging: ks7010: change some casts from uint8_t to u8 in ks_hostif
> >     header
> >   staging: ks7010: change parameter types and reorder them in
> >     hostif_mib_set_request
> >   staging: ks7010: add new helpers to achieve mib set request and
> >     simplify code
> >   staging: ks7010: use ether_addr_copy in get_current_ap
> >   staging: ks7010: move two preprocessor definitions to ks_wlan.h
> >   staging: ks7010: avoid two long lines in hostif_sme_mode_setup
> >   staging: ks7010: remove non sense comments in ks_hostif.c source file
> > 
> >  drivers/staging/ks7010/ks_hostif.c   | 320 +++++++++++++++++------------------
> >  drivers/staging/ks7010/ks_hostif.h   | 175 ++++++++++++-------
> >  drivers/staging/ks7010/ks_wlan.h     |   3 +
> >  drivers/staging/ks7010/ks_wlan_net.c |   4 +-
> >  4 files changed, 275 insertions(+), 227 deletions(-)
> 
> I now have 31+ emails from you in my to-review queue.  These are
> multiple series of patches, yet I have no idea what order they are in at
> all.
> 
> Please make it easy on me, make it obvious what to do, and what to apply
> in what order.
> 
> I'm dropping all of your emails now, please resend everything I have not
> applied, in a _SINGLE_ patch series so I can handle it properly.

Ack! I'll resend all of them in one patch series.

> 
> thanks,
> 
> greg k-h

Best regards,
    Sergio Paracuellos
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2018-04-30 13:40 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-27 14:05 [PATCH 00/10] staging: ks7010: next cleanups Sergio Paracuellos
2018-04-27 14:05 ` [PATCH 01/10] staging: ks7010: clean SME_MIC_FAILURE_REQUEST case in hostif_sme_execute Sergio Paracuellos
2018-04-27 14:05 ` [PATCH 02/10] staging: ks7010: convert MIB preprocessor defs into an enum Sergio Paracuellos
2018-04-27 14:05 ` [PATCH 03/10] staging: ks7010: conver MIB attributes " Sergio Paracuellos
2018-04-27 14:05 ` [PATCH 04/10] staging: ks7010: change some casts from uint8_t to u8 in ks_hostif header Sergio Paracuellos
2018-04-27 14:05 ` [PATCH 05/10] staging: ks7010: change parameter types and reorder them in hostif_mib_set_request Sergio Paracuellos
2018-04-27 14:06 ` [PATCH 06/10] staging: ks7010: add new helpers to achieve mib set request and simplify code Sergio Paracuellos
2018-04-27 14:06 ` [PATCH 07/10] staging: ks7010: use ether_addr_copy in get_current_ap Sergio Paracuellos
2018-04-27 14:06 ` [PATCH 08/10] staging: ks7010: move two preprocessor definitions to ks_wlan.h Sergio Paracuellos
2018-04-27 14:06 ` [PATCH 09/10] staging: ks7010: avoid two long lines in hostif_sme_mode_setup Sergio Paracuellos
2018-04-27 14:06 ` [PATCH 10/10] staging: ks7010: remove non sense comments in ks_hostif.c source file Sergio Paracuellos
2018-04-29 13:23 ` [PATCH 00/10] staging: ks7010: next cleanups Greg KH
2018-04-30 13:40   ` Sergio Paracuellos

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.