All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/21] next cleanups
@ 2018-04-19  5:07 Sergio Paracuellos
  2018-04-19  5:07 ` [PATCH 01/21] staging: ks7010: remove struct ieee802_1x_eapol_key Sergio Paracuellos
                   ` (20 more replies)
  0 siblings, 21 replies; 31+ messages in thread
From: Sergio Paracuellos @ 2018-04-19  5:07 UTC (permalink / raw)
  To: gregkh; +Cc: driverdev-devel, wsa

Cleanups continue in this driver. This patch series includes 
 - some function refactors
 - clean code which is not being used at all
 - some style fixes
 - includes review in driver files

Sergio Paracuellos (21):
  staging: ks7010: remove struct ieee802_1x_eapol_key
  staging: ks7010: remove not used enum in eap_packet header file
  staging: ks7010: remove auxiliar zeros buffer in ks_wlan_get_encode
  staging: ks7010: refactor ks_wlan_set_encode function
  staging: ks7010: change if-else condition assignment to use ternary
    operator
  staging: ks7010: refactor ks_wlan_set_rx_gain function
  staging: ks7010: refactor ks_wlan_set_tx_gain function
  staging: ks7010: refactor ks_wlan_set_wps_enable function
  staging: ks7010: review includes of ks_wlan_net.c file
  staging: ks7010: review includes of ks_wlan.h file
  staging: ks7010: remove two fields of ks_wlan_private struct
  staging: ks7010: remove enum from ks_wlan.h header
  staging: ks7010: removes data_buff field of ks_wlan_private struct
  staging: ks7010: review includes of ks_hostif file
  staging: ks7010: review includes of ks7010_sdio file
  staging: ks7010: review includes of michael_mic.c file
  staging: ks7010: use IW_HANDLER macro in ks_wlan_handler
  staging: ks7010: remove KSC_OPNOTSUPP related code
  staging: ks7010: align comments in ks_wlan_private_handler
  staging: ks7010: use ARRAY_SIZE macro in ks_wlan_handler_def
  staging: ks7010: init local variables when they are declared in
    ks7010_sdio_probe

 drivers/staging/ks7010/eap_packet.h  |  47 ---
 drivers/staging/ks7010/ks7010_sdio.c |  14 +-
 drivers/staging/ks7010/ks_hostif.c   |  11 +-
 drivers/staging/ks7010/ks_wlan.h     |  32 +-
 drivers/staging/ks7010/ks_wlan_net.c | 662 +++++++++++++----------------------
 drivers/staging/ks7010/michael_mic.c |   5 +-
 6 files changed, 267 insertions(+), 504 deletions(-)

-- 
2.7.4

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

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

* [PATCH 01/21] staging: ks7010: remove struct ieee802_1x_eapol_key
  2018-04-19  5:07 [PATCH 00/21] next cleanups Sergio Paracuellos
@ 2018-04-19  5:07 ` Sergio Paracuellos
  2018-04-23 12:32   ` Greg KH
  2018-04-19  5:07 ` [PATCH 02/21] staging: ks7010: remove not used enum in eap_packet header file Sergio Paracuellos
                   ` (19 subsequent siblings)
  20 siblings, 1 reply; 31+ messages in thread
From: Sergio Paracuellos @ 2018-04-19  5:07 UTC (permalink / raw)
  To: gregkh; +Cc: driverdev-devel, wsa

This commit removes ieee802_1x_eapol_key struct because
it is not being used at all. It also removes definitions
related to some fields of the removed struct.

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

diff --git a/drivers/staging/ks7010/eap_packet.h b/drivers/staging/ks7010/eap_packet.h
index 989c63a..f7a7de3 100644
--- a/drivers/staging/ks7010/eap_packet.h
+++ b/drivers/staging/ks7010/eap_packet.h
@@ -40,47 +40,6 @@ enum {
 	EAPOL_KEY_TYPE_WPA = 254
 };
 
-#define IEEE8021X_REPLAY_COUNTER_LEN 8
-#define IEEE8021X_KEY_SIGN_LEN 16
-#define IEEE8021X_KEY_IV_LEN 16
-
-#define IEEE8021X_KEY_INDEX_FLAG 0x80
-#define IEEE8021X_KEY_INDEX_MASK 0x03
-
-struct ieee802_1x_eapol_key {
-	unsigned char type;
-	unsigned short key_length;
-	/*
-	 * does not repeat within the life of the keying material used to
-	 * encrypt the Key field; 64-bit NTP timestamp MAY be used here
-	 */
-	unsigned char replay_counter[IEEE8021X_REPLAY_COUNTER_LEN];
-	unsigned char key_iv[IEEE8021X_KEY_IV_LEN]; /* cryptographically random
-						     * number
-						     */
-	unsigned char key_index;	/*
-					 * key flag in the most significant bit:
-					 * 0 = broadcast (default key),
-					 * 1 = unicast (key mapping key);
-					 * key index is in the 7 least
-					 * significant bits
-					 */
-	/*
-	 * HMAC-MD5 message integrity check computed with MS-MPPE-Send-Key as
-	 * the key
-	 */
-	unsigned char key_signature[IEEE8021X_KEY_SIGN_LEN];
-
-	/*
-	 * followed by key: if packet body length = 44 + key length, then the
-	 * key field (of key_length bytes) contains the key in encrypted form;
-	 * if packet body length = 44, key field is absent and key_length
-	 * represents the number of least significant octets from
-	 * MS-MPPE-Send-Key attribute to be used as the keying material;
-	 * RC4 key used in encryption = Key-IV + MS-MPPE-Recv-Key
-	 */
-} __packed;
-
 #define WPA_NONCE_LEN 32
 #define WPA_REPLAY_COUNTER_LEN 8
 
-- 
2.7.4

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

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

* [PATCH 02/21] staging: ks7010: remove not used enum in eap_packet header file
  2018-04-19  5:07 [PATCH 00/21] next cleanups Sergio Paracuellos
  2018-04-19  5:07 ` [PATCH 01/21] staging: ks7010: remove struct ieee802_1x_eapol_key Sergio Paracuellos
@ 2018-04-19  5:07 ` Sergio Paracuellos
  2018-04-19  5:07 ` [PATCH 03/21] staging: ks7010: remove auxiliar zeros buffer in ks_wlan_get_encode Sergio Paracuellos
                   ` (18 subsequent siblings)
  20 siblings, 0 replies; 31+ messages in thread
From: Sergio Paracuellos @ 2018-04-19  5:07 UTC (permalink / raw)
  To: gregkh; +Cc: driverdev-devel, wsa

This commit removes an anonymous enumerator inside eap_packet
header file because it is not being used anymore.

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

diff --git a/drivers/staging/ks7010/eap_packet.h b/drivers/staging/ks7010/eap_packet.h
index f7a7de3..ded85d9 100644
--- a/drivers/staging/ks7010/eap_packet.h
+++ b/drivers/staging/ks7010/eap_packet.h
@@ -34,12 +34,6 @@ enum {
 	IEEE802_1X_TYPE_EAPOL_ENCAPSULATED_ASF_ALERT = 4
 };
 
-enum {
-	EAPOL_KEY_TYPE_RC4 = 1,
-	EAPOL_KEY_TYPE_RSN = 2,
-	EAPOL_KEY_TYPE_WPA = 254
-};
-
 #define WPA_NONCE_LEN 32
 #define WPA_REPLAY_COUNTER_LEN 8
 
-- 
2.7.4

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

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

* [PATCH 03/21] staging: ks7010: remove auxiliar zeros buffer in ks_wlan_get_encode
  2018-04-19  5:07 [PATCH 00/21] next cleanups Sergio Paracuellos
  2018-04-19  5:07 ` [PATCH 01/21] staging: ks7010: remove struct ieee802_1x_eapol_key Sergio Paracuellos
  2018-04-19  5:07 ` [PATCH 02/21] staging: ks7010: remove not used enum in eap_packet header file Sergio Paracuellos
@ 2018-04-19  5:07 ` Sergio Paracuellos
  2018-04-19  5:07 ` [PATCH 04/21] staging: ks7010: refactor ks_wlan_set_encode function Sergio Paracuellos
                   ` (17 subsequent siblings)
  20 siblings, 0 replies; 31+ messages in thread
From: Sergio Paracuellos @ 2018-04-19  5:07 UTC (permalink / raw)
  To: gregkh; +Cc: driverdev-devel, wsa

This commit removes the local buffer zeros in ks_wlan_get_encode
function. It also refactors related conditions in order to fill
'extra' output parameter of the function. Originally this zeros
is just memset to zeros and only being used if drw->length is
truncated to zero because of priv->reg.wep_key[index].size is
greater than 16 chars. In those cases the final if statement is
just using zeros but it is using memcpy with a length of zero
bytes which has no sense. Instead of that just handle the good
case copying from the same source the number of bytes of
priv->reg.wep_key[index].size. If it is zero the final 'extra'
parameter won't be copied at all because the number of bytes to
copy will be zero. With this change the code gets simplified.

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

diff --git a/drivers/staging/ks7010/ks_wlan_net.c b/drivers/staging/ks7010/ks_wlan_net.c
index 5a4d661..3e4cd11 100644
--- a/drivers/staging/ks7010/ks_wlan_net.c
+++ b/drivers/staging/ks7010/ks_wlan_net.c
@@ -932,7 +932,6 @@ static int ks_wlan_get_encode(struct net_device *dev,
 			      struct iw_point *dwrq, char *extra)
 {
 	struct ks_wlan_private *priv = netdev_priv(dev);
-	char zeros[16];
 	int index = (dwrq->flags & IW_ENCODE_INDEX) - 1;
 
 	if (priv->sleep_mode == SLP_SLEEP)
@@ -951,8 +950,6 @@ static int ks_wlan_get_encode(struct net_device *dev,
 		break;
 	}
 
-	memset(zeros, 0, sizeof(zeros));
-
 	/* Which key do we want ? -1 -> tx index */
 	if ((index < 0) || (index >= 4))
 		index = priv->reg.wep_index;
@@ -962,16 +959,10 @@ static int ks_wlan_get_encode(struct net_device *dev,
 	}
 	dwrq->flags |= index + 1;
 	/* Copy the key to the user buffer */
-	if ((index >= 0) && (index < 4))
-		dwrq->length = priv->reg.wep_key[index].size;
-	if (dwrq->length > 16)
-		dwrq->length = 0;
-	if (dwrq->length) {
-		if ((index >= 0) && (index < 4))
-			memcpy(extra, priv->reg.wep_key[index].val,
-			       dwrq->length);
-	} else {
-		memcpy(extra, zeros, dwrq->length);
+	if (index >= 0 && index < 4) {
+		dwrq->length = (priv->reg.wep_key[index].size <= 16) ?
+				priv->reg.wep_key[index].size : 0;
+		memcpy(extra, priv->reg.wep_key[index].val, dwrq->length);
 	}
 
 	return 0;
-- 
2.7.4

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

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

* [PATCH 04/21] staging: ks7010: refactor ks_wlan_set_encode function
  2018-04-19  5:07 [PATCH 00/21] next cleanups Sergio Paracuellos
                   ` (2 preceding siblings ...)
  2018-04-19  5:07 ` [PATCH 03/21] staging: ks7010: remove auxiliar zeros buffer in ks_wlan_get_encode Sergio Paracuellos
@ 2018-04-19  5:07 ` Sergio Paracuellos
  2018-04-19  5:07 ` [PATCH 05/21] staging: ks7010: change if-else condition assignment to use ternary operator Sergio Paracuellos
                   ` (16 subsequent siblings)
  20 siblings, 0 replies; 31+ messages in thread
From: Sergio Paracuellos @ 2018-04-19  5:07 UTC (permalink / raw)
  To: gregkh; +Cc: driverdev-devel, wsa

This commit refactors ks_wlan_set_encode function to improve
readability. It just removes level indentation in some paths
as well as removes not needed conditions paths which was
checked before. Changes are as follows:

 - (dwrq->length > MAX_KEY_SIZE) check has been moved to the top.
 - extra check about (dwrq->length > 0) inside an if block where
   that was the condition to enter inside it has been removed.
 - (dwrq->flags & IW_ENCODE_NOKEY) check has been turned to avoid
   one level indentation.
 - extra check (index >= 0) && (index < 4) has been removed. In
   the top of the file invalid index values are being checked
   so it has no sense to check that again.
 - remove commented line.

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

diff --git a/drivers/staging/ks7010/ks_wlan_net.c b/drivers/staging/ks7010/ks_wlan_net.c
index 3e4cd11..af42cf6 100644
--- a/drivers/staging/ks7010/ks_wlan_net.c
+++ b/drivers/staging/ks7010/ks_wlan_net.c
@@ -819,64 +819,48 @@ static int ks_wlan_set_encode(struct net_device *dev,
 			      struct iw_point *dwrq, char *extra)
 {
 	struct ks_wlan_private *priv = netdev_priv(dev);
-
 	struct wep_key key;
 	int index = (dwrq->flags & IW_ENCODE_INDEX);
-	int current_index = priv->reg.wep_index;
-	int i;
 
 	if (priv->sleep_mode == SLP_SLEEP)
 		return -EPERM;
 
+	if (dwrq->length > MAX_KEY_SIZE)
+		return -EINVAL;
+
 	/* for SLEEP MODE */
-	/* index check */
 	if ((index < 0) || (index > 4))
 		return -EINVAL;
-	else if (index == 0)
-		index = current_index;
-	else
-		index--;
+
+	index = (index == 0) ? priv->reg.wep_index : (index - 1);
 
 	/* Is WEP supported ? */
 	/* Basic checking: do we have a key to set ? */
 	if (dwrq->length > 0) {
-		if (dwrq->length > MAX_KEY_SIZE) {	/* Check the size of the key */
-			return -EINVAL;
-		}
-		if (dwrq->length > MIN_KEY_SIZE) {	/* Set the length */
-			key.len = MAX_KEY_SIZE;
-			priv->reg.privacy_invoked = 0x01;
-			priv->need_commit |= SME_WEP_FLAG;
-			wep_on_off = WEP_ON_128BIT;
-		} else {
-			if (dwrq->length > 0) {
-				key.len = MIN_KEY_SIZE;
-				priv->reg.privacy_invoked = 0x01;
-				priv->need_commit |= SME_WEP_FLAG;
-				wep_on_off = WEP_ON_64BIT;
-			} else {	/* Disable the key */
-				key.len = 0;
-			}
-		}
+		key.len = (dwrq->length > MIN_KEY_SIZE) ?
+			   MAX_KEY_SIZE : MIN_KEY_SIZE;
+		priv->reg.privacy_invoked = 0x01;
+		priv->need_commit |= SME_WEP_FLAG;
+		wep_on_off = (dwrq->length > MIN_KEY_SIZE) ?
+			      WEP_ON_128BIT : WEP_ON_64BIT;
 		/* Check if the key is not marked as invalid */
-		if (!(dwrq->flags & IW_ENCODE_NOKEY)) {
-			/* Cleanup */
-			memset(key.key, 0, MAX_KEY_SIZE);
-			/* Copy the key in the driver */
-			if (copy_from_user
-			    (key.key, dwrq->pointer, dwrq->length)) {
-				key.len = 0;
-				return -EFAULT;
-			}
-			/* Send the key to the card */
-			priv->reg.wep_key[index].size = key.len;
-			for (i = 0; i < (priv->reg.wep_key[index].size); i++)
-				priv->reg.wep_key[index].val[i] = key.key[i];
+		if (dwrq->flags & IW_ENCODE_NOKEY)
+			return 0;
 
-			priv->need_commit |= (SME_WEP_VAL1 << index);
-			priv->reg.wep_index = index;
-			priv->need_commit |= SME_WEP_INDEX;
+		/* Cleanup */
+		memset(key.key, 0, MAX_KEY_SIZE);
+		/* Copy the key in the driver */
+		if (copy_from_user(key.key, dwrq->pointer, dwrq->length)) {
+			key.len = 0;
+			return -EFAULT;
 		}
+		/* Send the key to the card */
+		priv->reg.wep_key[index].size = key.len;
+		memcpy(&priv->reg.wep_key[index].val[0], &key.key[0],
+		       priv->reg.wep_key[index].size);
+		priv->need_commit |= (SME_WEP_VAL1 << index);
+		priv->reg.wep_index = index;
+		priv->need_commit |= SME_WEP_INDEX;
 	} else {
 		if (dwrq->flags & IW_ENCODE_DISABLED) {
 			priv->reg.wep_key[0].size = 0;
@@ -891,16 +875,11 @@ static int ks_wlan_set_encode(struct net_device *dev,
 			wep_on_off = WEP_OFF;
 			priv->need_commit |= SME_WEP_FLAG;
 		} else {
-			/* Do we want to just set the transmit key index ? */
-			if ((index >= 0) && (index < 4)) {
-				/* set_wep_key(priv, index, 0, 0, 1);   xxx */
-				if (priv->reg.wep_key[index].size != 0) {
-					priv->reg.wep_index = index;
-					priv->need_commit |= SME_WEP_INDEX;
-				} else {
-					return -EINVAL;
-				}
-			}
+			/* set_wep_key(priv, index, 0, 0, 1);   xxx */
+			if (priv->reg.wep_key[index].size == 0)
+				return -EINVAL;
+			priv->reg.wep_index = index;
+			priv->need_commit |= SME_WEP_INDEX;
 		}
 	}
 
@@ -919,7 +898,6 @@ static int ks_wlan_set_encode(struct net_device *dev,
 
 		priv->reg.authenticate_type = AUTH_TYPE_SHARED_KEY;
 	}
-//      return -EINPROGRESS;            /* Call commit handler */
 	if (priv->need_commit) {
 		ks_wlan_setup_parameter(priv, priv->need_commit);
 		priv->need_commit = 0;
-- 
2.7.4

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

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

* [PATCH 05/21] staging: ks7010: change if-else condition assignment to use ternary operator
  2018-04-19  5:07 [PATCH 00/21] next cleanups Sergio Paracuellos
                   ` (3 preceding siblings ...)
  2018-04-19  5:07 ` [PATCH 04/21] staging: ks7010: refactor ks_wlan_set_encode function Sergio Paracuellos
@ 2018-04-19  5:07 ` Sergio Paracuellos
  2018-04-23 12:09   ` Dan Carpenter
  2018-04-19  5:08 ` [PATCH 06/21] staging: ks7010: refactor ks_wlan_set_rx_gain function Sergio Paracuellos
                   ` (15 subsequent siblings)
  20 siblings, 1 reply; 31+ messages in thread
From: Sergio Paracuellos @ 2018-04-19  5:07 UTC (permalink / raw)
  To: gregkh; +Cc: driverdev-devel, wsa

This commit changes an if-else block used to just assign a
variable to use a ternary operator to do the same improving
readability.

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

diff --git a/drivers/staging/ks7010/ks_wlan_net.c b/drivers/staging/ks7010/ks_wlan_net.c
index af42cf6..53b580e 100644
--- a/drivers/staging/ks7010/ks_wlan_net.c
+++ b/drivers/staging/ks7010/ks_wlan_net.c
@@ -673,10 +673,7 @@ static int ks_wlan_get_rate(struct net_device *dev,
 		ks_wlan_update_phy_information(priv);
 
 	vwrq->value = ((priv->current_rate) & RATE_MASK) * 500000;
-	if (priv->reg.tx_rate == TX_RATE_FIXED)
-		vwrq->fixed = 1;
-	else
-		vwrq->fixed = 0;
+	vwrq->fixed = (priv->reg.tx_rate == TX_RATE_FIXED) ? 1 : 0;
 
 	return 0;
 }
-- 
2.7.4

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

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

* [PATCH 06/21] staging: ks7010: refactor ks_wlan_set_rx_gain function
  2018-04-19  5:07 [PATCH 00/21] next cleanups Sergio Paracuellos
                   ` (4 preceding siblings ...)
  2018-04-19  5:07 ` [PATCH 05/21] staging: ks7010: change if-else condition assignment to use ternary operator Sergio Paracuellos
@ 2018-04-19  5:08 ` Sergio Paracuellos
  2018-04-19  5:08 ` [PATCH 07/21] staging: ks7010: refactor ks_wlan_set_tx_gain function Sergio Paracuellos
                   ` (14 subsequent siblings)
  20 siblings, 0 replies; 31+ messages in thread
From: Sergio Paracuellos @ 2018-04-19  5:08 UTC (permalink / raw)
  To: gregkh; +Cc: driverdev-devel, wsa

This commit refactors ks_wlan_set_rx_gain function to
improve readability:
    - error condition is handling the error to avoid an 'else'
    - ternary operator is used to clean if-else block assignment.

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

diff --git a/drivers/staging/ks7010/ks_wlan_net.c b/drivers/staging/ks7010/ks_wlan_net.c
index 53b580e..b255062 100644
--- a/drivers/staging/ks7010/ks_wlan_net.c
+++ b/drivers/staging/ks7010/ks_wlan_net.c
@@ -2327,16 +2327,11 @@ static int ks_wlan_set_rx_gain(struct net_device *dev,
 	if (priv->sleep_mode == SLP_SLEEP)
 		return -EPERM;
 	/* for SLEEP MODE */
-	if (*uwrq >= 0 && *uwrq <= 0xFF)	/* 0-255 */
-		priv->gain.rx_gain = (uint8_t)*uwrq;
-	else
+	if (*uwrq < 0 || *uwrq > 0xFF)
 		return -EINVAL;
 
-	if (priv->gain.rx_gain < 0xFF)
-		priv->gain.rx_mode = 1;
-	else
-		priv->gain.rx_mode = 0;
-
+	priv->gain.rx_gain = (uint8_t)*uwrq;
+	priv->gain.rx_mode = (priv->gain.rx_gain < 0xFF) ? 1 : 0;
 	hostif_sme_enqueue(priv, SME_SET_GAIN);
 	return 0;
 }
-- 
2.7.4

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

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

* [PATCH 07/21] staging: ks7010: refactor ks_wlan_set_tx_gain function
  2018-04-19  5:07 [PATCH 00/21] next cleanups Sergio Paracuellos
                   ` (5 preceding siblings ...)
  2018-04-19  5:08 ` [PATCH 06/21] staging: ks7010: refactor ks_wlan_set_rx_gain function Sergio Paracuellos
@ 2018-04-19  5:08 ` Sergio Paracuellos
  2018-04-19  5:08 ` [PATCH 08/21] staging: ks7010: refactor ks_wlan_set_wps_enable function Sergio Paracuellos
                   ` (13 subsequent siblings)
  20 siblings, 0 replies; 31+ messages in thread
From: Sergio Paracuellos @ 2018-04-19  5:08 UTC (permalink / raw)
  To: gregkh; +Cc: driverdev-devel, wsa

This commit refactors ks_wlan_set_rx_gain function to
improve readability:
    - error condition is handling the error to avoid an 'else'
    - ternary operator is used to clean if-else block assignment.

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

diff --git a/drivers/staging/ks7010/ks_wlan_net.c b/drivers/staging/ks7010/ks_wlan_net.c
index b255062..c5d176e 100644
--- a/drivers/staging/ks7010/ks_wlan_net.c
+++ b/drivers/staging/ks7010/ks_wlan_net.c
@@ -2290,16 +2290,11 @@ static int ks_wlan_set_tx_gain(struct net_device *dev,
 	if (priv->sleep_mode == SLP_SLEEP)
 		return -EPERM;
 	/* for SLEEP MODE */
-	if (*uwrq >= 0 && *uwrq <= 0xFF)	/* 0-255 */
-		priv->gain.tx_gain = (uint8_t)*uwrq;
-	else
+	if (*uwrq < 0 || *uwrq > 0xFF)
 		return -EINVAL;
 
-	if (priv->gain.tx_gain < 0xFF)
-		priv->gain.tx_mode = 1;
-	else
-		priv->gain.tx_mode = 0;
-
+	priv->gain.tx_gain = (uint8_t)*uwrq;
+	priv->gain.tx_mode = (priv->gain.tx_gain < 0xFF) ? 1 : 0;
 	hostif_sme_enqueue(priv, SME_SET_GAIN);
 	return 0;
 }
-- 
2.7.4

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

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

* [PATCH 08/21] staging: ks7010: refactor ks_wlan_set_wps_enable function
  2018-04-19  5:07 [PATCH 00/21] next cleanups Sergio Paracuellos
                   ` (6 preceding siblings ...)
  2018-04-19  5:08 ` [PATCH 07/21] staging: ks7010: refactor ks_wlan_set_tx_gain function Sergio Paracuellos
@ 2018-04-19  5:08 ` Sergio Paracuellos
  2018-04-19  5:08 ` [PATCH 09/21] staging: ks7010: review includes of ks_wlan_net.c file Sergio Paracuellos
                   ` (12 subsequent siblings)
  20 siblings, 0 replies; 31+ messages in thread
From: Sergio Paracuellos @ 2018-04-19  5:08 UTC (permalink / raw)
  To: gregkh; +Cc: driverdev-devel, wsa

This commit refactors ks_wlan_set_wps_enable function to
improve readability handling the error first to avoid an
'else'.

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

diff --git a/drivers/staging/ks7010/ks_wlan_net.c b/drivers/staging/ks7010/ks_wlan_net.c
index c5d176e..9771e6b 100644
--- a/drivers/staging/ks7010/ks_wlan_net.c
+++ b/drivers/staging/ks7010/ks_wlan_net.c
@@ -2224,11 +2224,10 @@ static int ks_wlan_set_wps_enable(struct net_device *dev,
 	if (priv->sleep_mode == SLP_SLEEP)
 		return -EPERM;
 	/* for SLEEP MODE */
-	if (*uwrq == 0 || *uwrq == 1)
-		priv->wps.wps_enabled = *uwrq;
-	else
+	if (*uwrq != 0 && *uwrq != 1)
 		return -EINVAL;
 
+	priv->wps.wps_enabled = *uwrq;
 	hostif_sme_enqueue(priv, SME_WPS_ENABLE_REQUEST);
 
 	return 0;
-- 
2.7.4

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

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

* [PATCH 09/21] staging: ks7010: review includes of ks_wlan_net.c file
  2018-04-19  5:07 [PATCH 00/21] next cleanups Sergio Paracuellos
                   ` (7 preceding siblings ...)
  2018-04-19  5:08 ` [PATCH 08/21] staging: ks7010: refactor ks_wlan_set_wps_enable function Sergio Paracuellos
@ 2018-04-19  5:08 ` Sergio Paracuellos
  2018-04-19  5:08 ` [PATCH 10/21] staging: ks7010: review includes of ks_wlan.h file Sergio Paracuellos
                   ` (11 subsequent siblings)
  20 siblings, 0 replies; 31+ messages in thread
From: Sergio Paracuellos @ 2018-04-19  5:08 UTC (permalink / raw)
  To: gregkh; +Cc: driverdev-devel, wsa

This commit reviews really needed includes in ks_wlan_net.c
source file. It removes those which are not needed at all.
It also reorder the remaining ones in alphabetical order.

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

diff --git a/drivers/staging/ks7010/ks_wlan_net.c b/drivers/staging/ks7010/ks_wlan_net.c
index 9771e6b..5fb4dd9 100644
--- a/drivers/staging/ks7010/ks_wlan_net.c
+++ b/drivers/staging/ks7010/ks_wlan_net.c
@@ -9,23 +9,11 @@
  *   published by the Free Software Foundation.
  */
 
-#include <linux/module.h>
-#include <linux/kernel.h>
-#include <linux/compiler.h>
-#include <linux/init.h>
-#include <linux/ioport.h>
-#include <linux/netdevice.h>
-#include <linux/etherdevice.h>
-#include <linux/if_arp.h>
-#include <linux/rtnetlink.h>
-#include <linux/delay.h>
+#include <linux/atomic.h>
 #include <linux/completion.h>
-#include <linux/mii.h>
-#include <linux/pci.h>
-#include <linux/ctype.h>
+#include <linux/if_arp.h>
+#include <linux/netdevice.h>
 #include <linux/timer.h>
-#include <linux/atomic.h>
-#include <linux/io.h>
 #include <linux/uaccess.h>
 
 static int wep_on_off;
-- 
2.7.4

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

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

* [PATCH 10/21] staging: ks7010: review includes of ks_wlan.h file
  2018-04-19  5:07 [PATCH 00/21] next cleanups Sergio Paracuellos
                   ` (8 preceding siblings ...)
  2018-04-19  5:08 ` [PATCH 09/21] staging: ks7010: review includes of ks_wlan_net.c file Sergio Paracuellos
@ 2018-04-19  5:08 ` Sergio Paracuellos
  2018-04-19  5:08 ` [PATCH 11/21] staging: ks7010: remove two fields of ks_wlan_private struct Sergio Paracuellos
                   ` (10 subsequent siblings)
  20 siblings, 0 replies; 31+ messages in thread
From: Sergio Paracuellos @ 2018-04-19  5:08 UTC (permalink / raw)
  To: gregkh; +Cc: driverdev-devel, wsa

This commit reviews includes of ks_wlan.h header file.
It removes those which are not being used at all. It
also reorder remaining ones in alphabetical order.
The linux/module.h include file has been moved to the
correct file which is ks7010_sdio.c in order to be able
to compile the driver without problems.

Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
---
 drivers/staging/ks7010/ks7010_sdio.c |  1 +
 drivers/staging/ks7010/ks_wlan.h     | 19 ++++---------------
 2 files changed, 5 insertions(+), 15 deletions(-)

diff --git a/drivers/staging/ks7010/ks7010_sdio.c b/drivers/staging/ks7010/ks7010_sdio.c
index fedcbb3..b13cc95 100644
--- a/drivers/staging/ks7010/ks7010_sdio.c
+++ b/drivers/staging/ks7010/ks7010_sdio.c
@@ -10,6 +10,7 @@
  *   published by the Free Software Foundation.
  */
 
+#include <linux/module.h>
 #include <linux/circ_buf.h>
 #include <linux/firmware.h>
 #include <linux/mmc/card.h>
diff --git a/drivers/staging/ks7010/ks_wlan.h b/drivers/staging/ks7010/ks_wlan.h
index c1bab57..2150f73 100644
--- a/drivers/staging/ks7010/ks_wlan.h
+++ b/drivers/staging/ks7010/ks_wlan.h
@@ -14,23 +14,12 @@
 
 #define WPS
 
-#include <linux/interrupt.h>
-#include <linux/kernel.h>
-#include <linux/module.h>
-
-#include <linux/spinlock.h>	/* spinlock_t */
-#include <linux/sched.h>	/* wait_queue_head_t */
-#include <linux/types.h>	/* pid_t */
-#include <linux/netdevice.h>	/* struct net_device_stats,  struct sk_buff */
-#include <linux/etherdevice.h>
-#include <linux/wireless.h>
 #include <linux/atomic.h>	/* struct atomic_t */
-#include <linux/timer.h>	/* struct timer_list */
-#include <linux/string.h>
 #include <linux/completion.h>	/* struct completion */
-#include <linux/workqueue.h>
-
-#include <linux/io.h>
+#include <linux/netdevice.h>	/* struct net_device_stats,  struct sk_buff */
+#include <linux/sched.h>	/* wait_queue_head_t */
+#include <linux/spinlock.h>	/* spinlock_t */
+#include <linux/wireless.h>
 
 #include "ks7010_sdio.h"
 
-- 
2.7.4

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

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

* [PATCH 11/21] staging: ks7010: remove two fields of ks_wlan_private struct
  2018-04-19  5:07 [PATCH 00/21] next cleanups Sergio Paracuellos
                   ` (9 preceding siblings ...)
  2018-04-19  5:08 ` [PATCH 10/21] staging: ks7010: review includes of ks_wlan.h file Sergio Paracuellos
@ 2018-04-19  5:08 ` Sergio Paracuellos
  2018-04-19  5:08 ` [PATCH 12/21] staging: ks7010: remove enum from ks_wlan.h header Sergio Paracuellos
                   ` (9 subsequent siblings)
  20 siblings, 0 replies; 31+ messages in thread
From: Sergio Paracuellos @ 2018-04-19  5:08 UTC (permalink / raw)
  To: gregkh; +Cc: driverdev-devel, wsa

This commit removes l2_dev and l2_fd fields of ks_wlan_private
struct because they are not being used at all.

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

diff --git a/drivers/staging/ks7010/ks_wlan.h b/drivers/staging/ks7010/ks_wlan.h
index 2150f73..9ac3343 100644
--- a/drivers/staging/ks7010/ks_wlan.h
+++ b/drivers/staging/ks7010/ks_wlan.h
@@ -462,8 +462,6 @@ struct ks_wlan_private {
 	u8 scan_ssid[IW_ESSID_MAX_SIZE + 1];
 	struct local_gain_t gain;
 #ifdef WPS
-	struct net_device *l2_dev;
-	int l2_fd;
 	struct wps_status_t wps;
 #endif /* WPS */
 	u8 sleep_mode;
-- 
2.7.4

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

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

* [PATCH 12/21] staging: ks7010: remove enum from ks_wlan.h header
  2018-04-19  5:07 [PATCH 00/21] next cleanups Sergio Paracuellos
                   ` (10 preceding siblings ...)
  2018-04-19  5:08 ` [PATCH 11/21] staging: ks7010: remove two fields of ks_wlan_private struct Sergio Paracuellos
@ 2018-04-19  5:08 ` Sergio Paracuellos
  2018-04-19  5:08 ` [PATCH 13/21] staging: ks7010: removes data_buff field of ks_wlan_private struct Sergio Paracuellos
                   ` (8 subsequent siblings)
  20 siblings, 0 replies; 31+ messages in thread
From: Sergio Paracuellos @ 2018-04-19  5:08 UTC (permalink / raw)
  To: gregkh; +Cc: driverdev-devel, wsa

This commit removes an enum which is in ks_wlan.h
and it is not being used at all.

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

diff --git a/drivers/staging/ks7010/ks_wlan.h b/drivers/staging/ks7010/ks_wlan.h
index 9ac3343..31f87c9 100644
--- a/drivers/staging/ks7010/ks_wlan.h
+++ b/drivers/staging/ks7010/ks_wlan.h
@@ -286,14 +286,6 @@ struct scan_ext_t {
 	char ssid[IW_ESSID_MAX_SIZE + 1];
 };
 
-enum {
-	CIPHER_NONE,
-	CIPHER_WEP40,
-	CIPHER_TKIP,
-	CIPHER_CCMP,
-	CIPHER_WEP104
-};
-
 #define CIPHER_ID_WPA_NONE    "\x00\x50\xf2\x00"
 #define CIPHER_ID_WPA_WEP40   "\x00\x50\xf2\x01"
 #define CIPHER_ID_WPA_TKIP    "\x00\x50\xf2\x02"
-- 
2.7.4

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

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

* [PATCH 13/21] staging: ks7010: removes data_buff field of ks_wlan_private struct
  2018-04-19  5:07 [PATCH 00/21] next cleanups Sergio Paracuellos
                   ` (11 preceding siblings ...)
  2018-04-19  5:08 ` [PATCH 12/21] staging: ks7010: remove enum from ks_wlan.h header Sergio Paracuellos
@ 2018-04-19  5:08 ` Sergio Paracuellos
  2018-04-19  5:08 ` [PATCH 14/21] staging: ks7010: review includes of ks_hostif file Sergio Paracuellos
                   ` (7 subsequent siblings)
  20 siblings, 0 replies; 31+ messages in thread
From: Sergio Paracuellos @ 2018-04-19  5:08 UTC (permalink / raw)
  To: gregkh; +Cc: driverdev-devel, wsa

This commit removes data_buff array field of ks_wlan_private
which is not being used at all.

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

diff --git a/drivers/staging/ks7010/ks_wlan.h b/drivers/staging/ks7010/ks_wlan.h
index 31f87c9..676a69d 100644
--- a/drivers/staging/ks7010/ks_wlan.h
+++ b/drivers/staging/ks7010/ks_wlan.h
@@ -447,9 +447,6 @@ struct ks_wlan_private {
 #define CONNECT_STATUS_MASK 0x7FFFFFFF
 	u32 connect_status;	/* connect status */
 	int infra_status;	/* Infractructure status */
-
-	u8 data_buff[0x1000];
-
 	u8 scan_ssid_len;
 	u8 scan_ssid[IW_ESSID_MAX_SIZE + 1];
 	struct local_gain_t gain;
-- 
2.7.4

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

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

* [PATCH 14/21] staging: ks7010: review includes of ks_hostif file
  2018-04-19  5:07 [PATCH 00/21] next cleanups Sergio Paracuellos
                   ` (12 preceding siblings ...)
  2018-04-19  5:08 ` [PATCH 13/21] staging: ks7010: removes data_buff field of ks_wlan_private struct Sergio Paracuellos
@ 2018-04-19  5:08 ` Sergio Paracuellos
  2018-04-19  5:08 ` [PATCH 15/21] staging: ks7010: review includes of ks7010_sdio file Sergio Paracuellos
                   ` (6 subsequent siblings)
  20 siblings, 0 replies; 31+ messages in thread
From: Sergio Paracuellos @ 2018-04-19  5:08 UTC (permalink / raw)
  To: gregkh; +Cc: driverdev-devel, wsa

This commit reviews includes of ks_hostif.c source file.
Those which are not being used at all have been removed.
Driver header includes have been moved after the kernel
header includes to make style consistent in different
files of the driver. The need of ks_wlan.h header include
is only because of some preprocessor conditional code
of WPS definition. This definition is in ks_wlan.h
so this one must be included before the ks_hostif.h header
file.

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

diff --git a/drivers/staging/ks7010/ks_hostif.c b/drivers/staging/ks7010/ks_hostif.c
index b182530..6288c49 100644
--- a/drivers/staging/ks7010/ks_hostif.c
+++ b/drivers/staging/ks7010/ks_hostif.c
@@ -9,15 +9,12 @@
  *   published by the Free Software Foundation.
  */
 
-#include "ks_wlan.h"
-#include "ks_hostif.h"
-#include "eap_packet.h"
-#include "michael_mic.h"
-
-#include <linux/etherdevice.h>
-#include <linux/if_ether.h>
 #include <linux/if_arp.h>
 #include <net/iw_handler.h>
+#include "eap_packet.h"
+#include "ks_wlan.h"
+#include "michael_mic.h"
+#include "ks_hostif.h"
 
 static inline void inc_smeqhead(struct ks_wlan_private *priv)
 {
-- 
2.7.4

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

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

* [PATCH 15/21] staging: ks7010: review includes of ks7010_sdio file
  2018-04-19  5:07 [PATCH 00/21] next cleanups Sergio Paracuellos
                   ` (13 preceding siblings ...)
  2018-04-19  5:08 ` [PATCH 14/21] staging: ks7010: review includes of ks_hostif file Sergio Paracuellos
@ 2018-04-19  5:08 ` Sergio Paracuellos
  2018-04-19  5:08 ` [PATCH 16/21] staging: ks7010: review includes of michael_mic.c file Sergio Paracuellos
                   ` (5 subsequent siblings)
  20 siblings, 0 replies; 31+ messages in thread
From: Sergio Paracuellos @ 2018-04-19  5:08 UTC (permalink / raw)
  To: gregkh; +Cc: driverdev-devel, wsa

This commit reviews includes of ks7010_sdio.c source
file removing those which are not being used at all.
Kernel header includes have been ordered alphabetically
also.

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

diff --git a/drivers/staging/ks7010/ks7010_sdio.c b/drivers/staging/ks7010/ks7010_sdio.c
index b13cc95..11839af 100644
--- a/drivers/staging/ks7010/ks7010_sdio.c
+++ b/drivers/staging/ks7010/ks7010_sdio.c
@@ -10,17 +10,15 @@
  *   published by the Free Software Foundation.
  */
 
-#include <linux/module.h>
+#include <linux/atomic.h>
 #include <linux/circ_buf.h>
 #include <linux/firmware.h>
+#include <linux/jiffies.h>
 #include <linux/mmc/card.h>
 #include <linux/mmc/sdio_func.h>
+#include <linux/module.h>
 #include <linux/workqueue.h>
-#include <linux/atomic.h>
-#include <linux/jiffies.h>
-
 #include "ks_wlan.h"
-#include "ks_wlan_ioctl.h"
 #include "ks_hostif.h"
 #include "ks7010_sdio.h"
 
-- 
2.7.4

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

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

* [PATCH 16/21] staging: ks7010: review includes of michael_mic.c file
  2018-04-19  5:07 [PATCH 00/21] next cleanups Sergio Paracuellos
                   ` (14 preceding siblings ...)
  2018-04-19  5:08 ` [PATCH 15/21] staging: ks7010: review includes of ks7010_sdio file Sergio Paracuellos
@ 2018-04-19  5:08 ` Sergio Paracuellos
  2018-04-19  5:08 ` [PATCH 17/21] staging: ks7010: use IW_HANDLER macro in ks_wlan_handler Sergio Paracuellos
                   ` (4 subsequent siblings)
  20 siblings, 0 replies; 31+ messages in thread
From: Sergio Paracuellos @ 2018-04-19  5:08 UTC (permalink / raw)
  To: gregkh; +Cc: driverdev-devel, wsa

This commit reviews includes of michael_mic.c source file
removing those which are not being used at all and
reordering the remaining ones in alphabetically order.

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

diff --git a/drivers/staging/ks7010/michael_mic.c b/drivers/staging/ks7010/michael_mic.c
index d22c27d..9094786 100644
--- a/drivers/staging/ks7010/michael_mic.c
+++ b/drivers/staging/ks7010/michael_mic.c
@@ -9,10 +9,9 @@
  *   published by the Free Software Foundation.
  */
 
-#include <linux/types.h>
-#include <linux/string.h>
-#include <linux/bitops.h>
 #include <asm/unaligned.h>
+#include <linux/bitops.h>
+#include <linux/string.h>
 #include "michael_mic.h"
 
 
-- 
2.7.4

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

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

* [PATCH 17/21] staging: ks7010: use IW_HANDLER macro in ks_wlan_handler
  2018-04-19  5:07 [PATCH 00/21] next cleanups Sergio Paracuellos
                   ` (15 preceding siblings ...)
  2018-04-19  5:08 ` [PATCH 16/21] staging: ks7010: review includes of michael_mic.c file Sergio Paracuellos
@ 2018-04-19  5:08 ` Sergio Paracuellos
  2018-04-19  5:08 ` [PATCH 18/21] staging: ks7010: remove KSC_OPNOTSUPP related code Sergio Paracuellos
                   ` (3 subsequent siblings)
  20 siblings, 0 replies; 31+ messages in thread
From: Sergio Paracuellos @ 2018-04-19  5:08 UTC (permalink / raw)
  To: gregkh; +Cc: driverdev-devel, wsa

This commit make use of IW_HANDLER to set wext operations
of the device. Using this, comments are not neccessary anymore
and also NULL entries so readability is clearly increased.
In order to avoid casting because of the use of a different
prototype in all related functions, those which are affected
have been updated also to make use of the  union iwreq_data
as third parameter updating code accordly. iw_handler_def
struct of this driver has been updated to use ARRAY_SIZE instead
of custom calculations.

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

diff --git a/drivers/staging/ks7010/ks_wlan_net.c b/drivers/staging/ks7010/ks_wlan_net.c
index 5fb4dd9..5f70957 100644
--- a/drivers/staging/ks7010/ks_wlan_net.c
+++ b/drivers/staging/ks7010/ks_wlan_net.c
@@ -160,7 +160,8 @@ int ks_wlan_setup_parameter(struct ks_wlan_private *priv,
  */
 
 static int ks_wlan_get_name(struct net_device *dev,
-			    struct iw_request_info *info, char *cwrq,
+			    struct iw_request_info *info,
+			    union iwreq_data *cwrq,
 			    char *extra)
 {
 	struct ks_wlan_private *priv = netdev_priv(dev);
@@ -170,20 +171,20 @@ static int ks_wlan_get_name(struct net_device *dev,
 
 	/* for SLEEP MODE */
 	if (priv->dev_state < DEVICE_STATE_READY)
-		strcpy(cwrq, "NOT READY!");
+		strcpy(cwrq->name, "NOT READY!");
 	else if (priv->reg.phy_type == D_11B_ONLY_MODE)
-		strcpy(cwrq, "IEEE 802.11b");
+		strcpy(cwrq->name, "IEEE 802.11b");
 	else if (priv->reg.phy_type == D_11G_ONLY_MODE)
-		strcpy(cwrq, "IEEE 802.11g");
+		strcpy(cwrq->name, "IEEE 802.11g");
 	else
-		strcpy(cwrq, "IEEE 802.11b/g");
+		strcpy(cwrq->name, "IEEE 802.11b/g");
 
 	return 0;
 }
 
 static int ks_wlan_set_freq(struct net_device *dev,
-			    struct iw_request_info *info, struct iw_freq *fwrq,
-			    char *extra)
+			    struct iw_request_info *info,
+			    union iwreq_data *fwrq, char *extra)
 {
 	struct ks_wlan_private *priv = netdev_priv(dev);
 	int channel;
@@ -193,28 +194,28 @@ static int ks_wlan_set_freq(struct net_device *dev,
 
 	/* for SLEEP MODE */
 	/* If setting by frequency, convert to a channel */
-	if ((fwrq->e == 1) &&
-	    (fwrq->m >= (int)2.412e8) && (fwrq->m <= (int)2.487e8)) {
-		int f = fwrq->m / 100000;
+	if ((fwrq->freq.e == 1) &&
+	    (fwrq->freq.m >= (int)2.412e8) && (fwrq->freq.m <= (int)2.487e8)) {
+		int f = fwrq->freq.m / 100000;
 		int c = 0;
 
 		while ((c < 14) && (f != frequency_list[c]))
 			c++;
 		/* Hack to fall through... */
-		fwrq->e = 0;
-		fwrq->m = c + 1;
+		fwrq->freq.e = 0;
+		fwrq->freq.m = c + 1;
 	}
 	/* Setting by channel number */
-	if ((fwrq->m > 1000) || (fwrq->e > 0))
+	if ((fwrq->freq.m > 1000) || (fwrq->freq.e > 0))
 		return -EOPNOTSUPP;
 
-	channel = fwrq->m;
+	channel = fwrq->freq.m;
 	/* We should do a better check than that,
 	 * based on the card capability !!!
 	 */
 	if ((channel < 1) || (channel > 14)) {
 		netdev_dbg(dev, "%s: New channel value of %d is invalid!\n",
-			   dev->name, fwrq->m);
+			   dev->name, fwrq->freq.m);
 		return -EINVAL;
 	}
 
@@ -226,8 +227,8 @@ static int ks_wlan_set_freq(struct net_device *dev,
 }
 
 static int ks_wlan_get_freq(struct net_device *dev,
-			    struct iw_request_info *info, struct iw_freq *fwrq,
-			    char *extra)
+			    struct iw_request_info *info,
+			    union iwreq_data *fwrq, char *extra)
 {
 	struct ks_wlan_private *priv = netdev_priv(dev);
 	int f;
@@ -241,15 +242,15 @@ static int ks_wlan_get_freq(struct net_device *dev,
 	else
 		f = (int)priv->reg.channel;
 
-	fwrq->m = frequency_list[f - 1] * 100000;
-	fwrq->e = 1;
+	fwrq->freq.m = frequency_list[f - 1] * 100000;
+	fwrq->freq.e = 1;
 
 	return 0;
 }
 
 static int ks_wlan_set_essid(struct net_device *dev,
 			     struct iw_request_info *info,
-			     struct iw_point *dwrq, char *extra)
+			     union iwreq_data *dwrq, char *extra)
 {
 	struct ks_wlan_private *priv = netdev_priv(dev);
 	size_t len;
@@ -259,12 +260,12 @@ static int ks_wlan_set_essid(struct net_device *dev,
 
 	/* for SLEEP MODE */
 	/* Check if we asked for `any' */
-	if (!dwrq->flags) {
+	if (!dwrq->essid.flags) {
 		/* Just send an empty SSID list */
 		memset(priv->reg.ssid.body, 0, sizeof(priv->reg.ssid.body));
 		priv->reg.ssid.size = 0;
 	} else {
-		len = dwrq->length;
+		len = dwrq->essid.length;
 		/* iwconfig uses nul termination in SSID.. */
 		if (len > 0 && extra[len - 1] == '\0')
 			len--;
@@ -288,7 +289,7 @@ static int ks_wlan_set_essid(struct net_device *dev,
 
 static int ks_wlan_get_essid(struct net_device *dev,
 			     struct iw_request_info *info,
-			     struct iw_point *dwrq, char *extra)
+			     union iwreq_data *dwrq, char *extra)
 {
 	struct ks_wlan_private *priv = netdev_priv(dev);
 
@@ -306,18 +307,18 @@ static int ks_wlan_get_essid(struct net_device *dev,
 		/* If none, we may want to get the one that was set */
 
 		/* Push it out ! */
-		dwrq->length = priv->reg.ssid.size;
-		dwrq->flags = 1;	/* active */
+		dwrq->essid.length = priv->reg.ssid.size;
+		dwrq->essid.flags = 1;	/* active */
 	} else {
-		dwrq->length = 0;
-		dwrq->flags = 0;	/* ANY */
+		dwrq->essid.length = 0;
+		dwrq->essid.flags = 0;	/* ANY */
 	}
 
 	return 0;
 }
 
 static int ks_wlan_set_wap(struct net_device *dev, struct iw_request_info *info,
-			   struct sockaddr *ap_addr, char *extra)
+			   union iwreq_data *awrq, char *extra)
 {
 	struct ks_wlan_private *priv = netdev_priv(dev);
 
@@ -327,7 +328,7 @@ static int ks_wlan_set_wap(struct net_device *dev, struct iw_request_info *info,
 	/* for SLEEP MODE */
 	if (priv->reg.operation_mode == MODE_ADHOC ||
 	    priv->reg.operation_mode == MODE_INFRASTRUCTURE) {
-		memcpy(priv->reg.bssid, &ap_addr->sa_data, ETH_ALEN);
+		memcpy(priv->reg.bssid, &awrq->ap_addr.sa_data, ETH_ALEN);
 
 		if (is_valid_ether_addr((u8 *)priv->reg.bssid))
 			priv->need_commit |= SME_MODE_SET;
@@ -348,7 +349,7 @@ static int ks_wlan_set_wap(struct net_device *dev, struct iw_request_info *info,
 }
 
 static int ks_wlan_get_wap(struct net_device *dev, struct iw_request_info *info,
-			   struct sockaddr *awrq, char *extra)
+			   union iwreq_data *awrq, char *extra)
 {
 	struct ks_wlan_private *priv = netdev_priv(dev);
 
@@ -357,18 +358,18 @@ static int ks_wlan_get_wap(struct net_device *dev, struct iw_request_info *info,
 
 	/* for SLEEP MODE */
 	if (is_connect_status(priv->connect_status))
-		memcpy(awrq->sa_data, priv->current_ap.bssid, ETH_ALEN);
+		memcpy(awrq->ap_addr.sa_data, priv->current_ap.bssid, ETH_ALEN);
 	else
-		eth_zero_addr(awrq->sa_data);
+		eth_zero_addr(awrq->ap_addr.sa_data);
 
-	awrq->sa_family = ARPHRD_ETHER;
+	awrq->ap_addr.sa_family = ARPHRD_ETHER;
 
 	return 0;
 }
 
 static int ks_wlan_set_nick(struct net_device *dev,
-			    struct iw_request_info *info, struct iw_point *dwrq,
-			    char *extra)
+			    struct iw_request_info *info,
+			    union iwreq_data *dwrq, char *extra)
 {
 	struct ks_wlan_private *priv = netdev_priv(dev);
 
@@ -377,18 +378,18 @@ static int ks_wlan_set_nick(struct net_device *dev,
 
 	/* for SLEEP MODE */
 	/* Check the size of the string */
-	if (dwrq->length > 16 + 1)
+	if (dwrq->data.length > 16 + 1)
 		return -E2BIG;
 
 	memset(priv->nick, 0, sizeof(priv->nick));
-	memcpy(priv->nick, extra, dwrq->length);
+	memcpy(priv->nick, extra, dwrq->data.length);
 
 	return -EINPROGRESS;	/* Call commit handler */
 }
 
 static int ks_wlan_get_nick(struct net_device *dev,
-			    struct iw_request_info *info, struct iw_point *dwrq,
-			    char *extra)
+			    struct iw_request_info *info,
+			    union iwreq_data *dwrq, char *extra)
 {
 	struct ks_wlan_private *priv = netdev_priv(dev);
 
@@ -398,14 +399,14 @@ static int ks_wlan_get_nick(struct net_device *dev,
 	/* for SLEEP MODE */
 	strncpy(extra, priv->nick, 16);
 	extra[16] = '\0';
-	dwrq->length = strlen(extra) + 1;
+	dwrq->data.length = strlen(extra) + 1;
 
 	return 0;
 }
 
 static int ks_wlan_set_rate(struct net_device *dev,
-			    struct iw_request_info *info, struct iw_param *vwrq,
-			    char *extra)
+			    struct iw_request_info *info,
+			    union iwreq_data *vwrq, char *extra)
 {
 	struct ks_wlan_private *priv = netdev_priv(dev);
 	int i = 0;
@@ -415,17 +416,17 @@ static int ks_wlan_set_rate(struct net_device *dev,
 
 	/* for SLEEP MODE */
 	if (priv->reg.phy_type == D_11B_ONLY_MODE) {
-		if (vwrq->fixed == 1) {
-			switch (vwrq->value) {
+		if (vwrq->bitrate.fixed == 1) {
+			switch (vwrq->bitrate.value) {
 			case 11000000:
 			case 5500000:
 				priv->reg.rate_set.body[0] =
-				    (uint8_t)(vwrq->value / 500000);
+				    (uint8_t)(vwrq->bitrate.value / 500000);
 				break;
 			case 2000000:
 			case 1000000:
 				priv->reg.rate_set.body[0] =
-				    ((uint8_t)(vwrq->value / 500000)) |
+				    ((uint8_t)(vwrq->bitrate.value / 500000)) |
 				    BASIC_RATE;
 				break;
 			default:
@@ -434,8 +435,8 @@ static int ks_wlan_set_rate(struct net_device *dev,
 			priv->reg.tx_rate = TX_RATE_FIXED;
 			priv->reg.rate_set.size = 1;
 		} else {	/* vwrq->fixed == 0 */
-			if (vwrq->value > 0) {
-				switch (vwrq->value) {
+			if (vwrq->bitrate.value > 0) {
+				switch (vwrq->bitrate.value) {
 				case 11000000:
 					priv->reg.rate_set.body[3] =
 					    TX_RATE_11M;
@@ -472,15 +473,15 @@ static int ks_wlan_set_rate(struct net_device *dev,
 			}
 		}
 	} else {	/* D_11B_ONLY_MODE or  D_11BG_COMPATIBLE_MODE */
-		if (vwrq->fixed == 1) {
-			switch (vwrq->value) {
+		if (vwrq->bitrate.fixed == 1) {
+			switch (vwrq->bitrate.value) {
 			case 54000000:
 			case 48000000:
 			case 36000000:
 			case 18000000:
 			case 9000000:
 				priv->reg.rate_set.body[0] =
-				    (uint8_t)(vwrq->value / 500000);
+				    (uint8_t)(vwrq->bitrate.value / 500000);
 				break;
 			case 24000000:
 			case 12000000:
@@ -490,7 +491,7 @@ static int ks_wlan_set_rate(struct net_device *dev,
 			case 2000000:
 			case 1000000:
 				priv->reg.rate_set.body[0] =
-				    ((uint8_t)(vwrq->value / 500000)) |
+				    ((uint8_t)(vwrq->bitrate.value / 500000)) |
 				    BASIC_RATE;
 				break;
 			default:
@@ -499,8 +500,8 @@ static int ks_wlan_set_rate(struct net_device *dev,
 			priv->reg.tx_rate = TX_RATE_FIXED;
 			priv->reg.rate_set.size = 1;
 		} else {	/* vwrq->fixed == 0 */
-			if (vwrq->value > 0) {
-				switch (vwrq->value) {
+			if (vwrq->bitrate.value > 0) {
+				switch (vwrq->bitrate.value) {
 				case 54000000:
 					priv->reg.rate_set.body[11] =
 					    TX_RATE_54M;
@@ -522,7 +523,7 @@ static int ks_wlan_set_rate(struct net_device *dev,
 				case 11000000:
 				case 9000000:
 				case 6000000:
-					if (vwrq->value == 24000000) {
+					if (vwrq->bitrate.value == 24000000) {
 						priv->reg.rate_set.body[8] =
 						    TX_RATE_18M;
 						i++;
@@ -541,7 +542,7 @@ static int ks_wlan_set_rate(struct net_device *dev,
 						priv->reg.rate_set.body[3] =
 						    TX_RATE_11M | BASIC_RATE;
 						i++;
-					} else if (vwrq->value == 18000000) {
+					} else if (vwrq->bitrate.value == 18000000) {
 						priv->reg.rate_set.body[7] =
 						    TX_RATE_18M;
 						i++;
@@ -557,7 +558,7 @@ static int ks_wlan_set_rate(struct net_device *dev,
 						priv->reg.rate_set.body[3] =
 						    TX_RATE_11M | BASIC_RATE;
 						i++;
-					} else if (vwrq->value == 12000000) {
+					} else if (vwrq->bitrate.value == 12000000) {
 						priv->reg.rate_set.body[6] =
 						    TX_RATE_9M;
 						i++;
@@ -570,7 +571,7 @@ static int ks_wlan_set_rate(struct net_device *dev,
 						priv->reg.rate_set.body[3] =
 						    TX_RATE_11M | BASIC_RATE;
 						i++;
-					} else if (vwrq->value == 11000000) {
+					} else if (vwrq->bitrate.value == 11000000) {
 						priv->reg.rate_set.body[5] =
 						    TX_RATE_9M;
 						i++;
@@ -580,7 +581,7 @@ static int ks_wlan_set_rate(struct net_device *dev,
 						priv->reg.rate_set.body[3] =
 						    TX_RATE_11M | BASIC_RATE;
 						i++;
-					} else if (vwrq->value == 9000000) {
+					} else if (vwrq->bitrate.value == 9000000) {
 						priv->reg.rate_set.body[4] =
 						    TX_RATE_9M;
 						i++;
@@ -645,8 +646,8 @@ static int ks_wlan_set_rate(struct net_device *dev,
 }
 
 static int ks_wlan_get_rate(struct net_device *dev,
-			    struct iw_request_info *info, struct iw_param *vwrq,
-			    char *extra)
+			    struct iw_request_info *info,
+			    union iwreq_data *vwrq, char *extra)
 {
 	struct ks_wlan_private *priv = netdev_priv(dev);
 
@@ -660,23 +661,23 @@ static int ks_wlan_get_rate(struct net_device *dev,
 	if (!atomic_read(&update_phyinfo))
 		ks_wlan_update_phy_information(priv);
 
-	vwrq->value = ((priv->current_rate) & RATE_MASK) * 500000;
-	vwrq->fixed = (priv->reg.tx_rate == TX_RATE_FIXED) ? 1 : 0;
+	vwrq->bitrate.value = ((priv->current_rate) & RATE_MASK) * 500000;
+	vwrq->bitrate.fixed = (priv->reg.tx_rate == TX_RATE_FIXED) ? 1 : 0;
 
 	return 0;
 }
 
 static int ks_wlan_set_rts(struct net_device *dev, struct iw_request_info *info,
-			   struct iw_param *vwrq, char *extra)
+			   union iwreq_data *vwrq, char *extra)
 {
 	struct ks_wlan_private *priv = netdev_priv(dev);
-	int rthr = vwrq->value;
+	int rthr = vwrq->rts.value;
 
 	if (priv->sleep_mode == SLP_SLEEP)
 		return -EPERM;
 
 	/* for SLEEP MODE */
-	if (vwrq->disabled)
+	if (vwrq->rts.disabled)
 		rthr = 2347;
 	if ((rthr < 0) || (rthr > 2347))
 		return -EINVAL;
@@ -688,7 +689,7 @@ static int ks_wlan_set_rts(struct net_device *dev, struct iw_request_info *info,
 }
 
 static int ks_wlan_get_rts(struct net_device *dev, struct iw_request_info *info,
-			   struct iw_param *vwrq, char *extra)
+			   union iwreq_data *vwrq, char *extra)
 {
 	struct ks_wlan_private *priv = netdev_priv(dev);
 
@@ -696,25 +697,25 @@ static int ks_wlan_get_rts(struct net_device *dev, struct iw_request_info *info,
 		return -EPERM;
 
 	/* for SLEEP MODE */
-	vwrq->value = priv->reg.rts;
-	vwrq->disabled = (vwrq->value >= 2347);
-	vwrq->fixed = 1;
+	vwrq->rts.value = priv->reg.rts;
+	vwrq->rts.disabled = (vwrq->rts.value >= 2347);
+	vwrq->rts.fixed = 1;
 
 	return 0;
 }
 
 static int ks_wlan_set_frag(struct net_device *dev,
-			    struct iw_request_info *info, struct iw_param *vwrq,
-			    char *extra)
+			    struct iw_request_info *info,
+			    union iwreq_data *vwrq, char *extra)
 {
 	struct ks_wlan_private *priv = netdev_priv(dev);
-	int fthr = vwrq->value;
+	int fthr = vwrq->frag.value;
 
 	if (priv->sleep_mode == SLP_SLEEP)
 		return -EPERM;
 
 	/* for SLEEP MODE */
-	if (vwrq->disabled)
+	if (vwrq->frag.disabled)
 		fthr = 2346;
 	if ((fthr < 256) || (fthr > 2346))
 		return -EINVAL;
@@ -727,8 +728,8 @@ static int ks_wlan_set_frag(struct net_device *dev,
 }
 
 static int ks_wlan_get_frag(struct net_device *dev,
-			    struct iw_request_info *info, struct iw_param *vwrq,
-			    char *extra)
+			    struct iw_request_info *info,
+			    union iwreq_data *vwrq, char *extra)
 {
 	struct ks_wlan_private *priv = netdev_priv(dev);
 
@@ -736,16 +737,16 @@ static int ks_wlan_get_frag(struct net_device *dev,
 		return -EPERM;
 
 	/* for SLEEP MODE */
-	vwrq->value = priv->reg.fragment;
-	vwrq->disabled = (vwrq->value >= 2346);
-	vwrq->fixed = 1;
+	vwrq->frag.value = priv->reg.fragment;
+	vwrq->frag.disabled = (vwrq->frag.value >= 2346);
+	vwrq->frag.fixed = 1;
 
 	return 0;
 }
 
 static int ks_wlan_set_mode(struct net_device *dev,
-			    struct iw_request_info *info, __u32 *uwrq,
-			    char *extra)
+			    struct iw_request_info *info,
+			    union iwreq_data *uwrq, char *extra)
 {
 	struct ks_wlan_private *priv = netdev_priv(dev);
 
@@ -753,7 +754,7 @@ static int ks_wlan_set_mode(struct net_device *dev,
 		return -EPERM;
 
 	/* for SLEEP MODE */
-	switch (*uwrq) {
+	switch (uwrq->mode) {
 	case IW_MODE_ADHOC:
 		priv->reg.operation_mode = MODE_ADHOC;
 		priv->need_commit |= SME_MODE_SET;
@@ -775,8 +776,8 @@ static int ks_wlan_set_mode(struct net_device *dev,
 }
 
 static int ks_wlan_get_mode(struct net_device *dev,
-			    struct iw_request_info *info, __u32 *uwrq,
-			    char *extra)
+			    struct iw_request_info *info,
+			    union iwreq_data *uwrq, char *extra)
 {
 	struct ks_wlan_private *priv = netdev_priv(dev);
 
@@ -787,13 +788,13 @@ static int ks_wlan_get_mode(struct net_device *dev,
 	/* If not managed, assume it's ad-hoc */
 	switch (priv->reg.operation_mode) {
 	case MODE_INFRASTRUCTURE:
-		*uwrq = IW_MODE_INFRA;
+		uwrq->mode = IW_MODE_INFRA;
 		break;
 	case MODE_ADHOC:
-		*uwrq = IW_MODE_ADHOC;
+		uwrq->mode = IW_MODE_ADHOC;
 		break;
 	default:
-		*uwrq = IW_MODE_ADHOC;
+		uwrq->mode = IW_MODE_ADHOC;
 	}
 
 	return 0;
@@ -801,16 +802,17 @@ static int ks_wlan_get_mode(struct net_device *dev,
 
 static int ks_wlan_set_encode(struct net_device *dev,
 			      struct iw_request_info *info,
-			      struct iw_point *dwrq, char *extra)
+			      union iwreq_data *dwrq, char *extra)
 {
 	struct ks_wlan_private *priv = netdev_priv(dev);
+	struct iw_point *enc = &dwrq->encoding;
 	struct wep_key key;
-	int index = (dwrq->flags & IW_ENCODE_INDEX);
+	int index = (enc->flags & IW_ENCODE_INDEX);
 
 	if (priv->sleep_mode == SLP_SLEEP)
 		return -EPERM;
 
-	if (dwrq->length > MAX_KEY_SIZE)
+	if (enc->length > MAX_KEY_SIZE)
 		return -EINVAL;
 
 	/* for SLEEP MODE */
@@ -821,21 +823,21 @@ static int ks_wlan_set_encode(struct net_device *dev,
 
 	/* Is WEP supported ? */
 	/* Basic checking: do we have a key to set ? */
-	if (dwrq->length > 0) {
-		key.len = (dwrq->length > MIN_KEY_SIZE) ?
+	if (enc->length > 0) {
+		key.len = (enc->length > MIN_KEY_SIZE) ?
 			   MAX_KEY_SIZE : MIN_KEY_SIZE;
 		priv->reg.privacy_invoked = 0x01;
 		priv->need_commit |= SME_WEP_FLAG;
-		wep_on_off = (dwrq->length > MIN_KEY_SIZE) ?
+		wep_on_off = (enc->length > MIN_KEY_SIZE) ?
 			      WEP_ON_128BIT : WEP_ON_64BIT;
 		/* Check if the key is not marked as invalid */
-		if (dwrq->flags & IW_ENCODE_NOKEY)
+		if (enc->flags & IW_ENCODE_NOKEY)
 			return 0;
 
 		/* Cleanup */
 		memset(key.key, 0, MAX_KEY_SIZE);
 		/* Copy the key in the driver */
-		if (copy_from_user(key.key, dwrq->pointer, dwrq->length)) {
+		if (copy_from_user(key.key, enc->pointer, enc->length)) {
 			key.len = 0;
 			return -EFAULT;
 		}
@@ -847,7 +849,7 @@ static int ks_wlan_set_encode(struct net_device *dev,
 		priv->reg.wep_index = index;
 		priv->need_commit |= SME_WEP_INDEX;
 	} else {
-		if (dwrq->flags & IW_ENCODE_DISABLED) {
+		if (enc->flags & IW_ENCODE_DISABLED) {
 			priv->reg.wep_key[0].size = 0;
 			priv->reg.wep_key[1].size = 0;
 			priv->reg.wep_key[2].size = 0;
@@ -869,15 +871,15 @@ static int ks_wlan_set_encode(struct net_device *dev,
 	}
 
 	/* Commit the changes if needed */
-	if (dwrq->flags & IW_ENCODE_MODE)
+	if (enc->flags & IW_ENCODE_MODE)
 		priv->need_commit |= SME_WEP_FLAG;
 
-	if (dwrq->flags & IW_ENCODE_OPEN) {
+	if (enc->flags & IW_ENCODE_OPEN) {
 		if (priv->reg.authenticate_type == AUTH_TYPE_SHARED_KEY)
 			priv->need_commit |= SME_MODE_SET;
 
 		priv->reg.authenticate_type = AUTH_TYPE_OPEN_SYSTEM;
-	} else if (dwrq->flags & IW_ENCODE_RESTRICTED) {
+	} else if (enc->flags & IW_ENCODE_RESTRICTED) {
 		if (priv->reg.authenticate_type == AUTH_TYPE_OPEN_SYSTEM)
 			priv->need_commit |= SME_MODE_SET;
 
@@ -892,24 +894,25 @@ static int ks_wlan_set_encode(struct net_device *dev,
 
 static int ks_wlan_get_encode(struct net_device *dev,
 			      struct iw_request_info *info,
-			      struct iw_point *dwrq, char *extra)
+			      union iwreq_data *dwrq, char *extra)
 {
 	struct ks_wlan_private *priv = netdev_priv(dev);
-	int index = (dwrq->flags & IW_ENCODE_INDEX) - 1;
+	struct iw_point *enc = &dwrq->encoding;
+	int index = (enc->flags & IW_ENCODE_INDEX) - 1;
 
 	if (priv->sleep_mode == SLP_SLEEP)
 		return -EPERM;
 
 	/* for SLEEP MODE */
-	dwrq->flags = IW_ENCODE_DISABLED;
+	enc->flags = IW_ENCODE_DISABLED;
 
 	/* Check encryption mode */
 	switch (priv->reg.authenticate_type) {
 	case AUTH_TYPE_OPEN_SYSTEM:
-		dwrq->flags = IW_ENCODE_OPEN;
+		enc->flags = IW_ENCODE_OPEN;
 		break;
 	case AUTH_TYPE_SHARED_KEY:
-		dwrq->flags = IW_ENCODE_RESTRICTED;
+		enc->flags = IW_ENCODE_RESTRICTED;
 		break;
 	}
 
@@ -917,15 +920,15 @@ static int ks_wlan_get_encode(struct net_device *dev,
 	if ((index < 0) || (index >= 4))
 		index = priv->reg.wep_index;
 	if (priv->reg.privacy_invoked) {
-		dwrq->flags &= ~IW_ENCODE_DISABLED;
+		enc->flags &= ~IW_ENCODE_DISABLED;
 		/* dwrq->flags |= IW_ENCODE_NOKEY; */
 	}
-	dwrq->flags |= index + 1;
+	enc->flags |= index + 1;
 	/* Copy the key to the user buffer */
 	if (index >= 0 && index < 4) {
-		dwrq->length = (priv->reg.wep_key[index].size <= 16) ?
+		enc->length = (priv->reg.wep_key[index].size <= 16) ?
 				priv->reg.wep_key[index].size : 0;
-		memcpy(extra, priv->reg.wep_key[index].val, dwrq->length);
+		memcpy(extra, priv->reg.wep_key[index].val, enc->length);
 	}
 
 	return 0;
@@ -934,52 +937,52 @@ static int ks_wlan_get_encode(struct net_device *dev,
 #ifndef KSC_OPNOTSUPP
 static int ks_wlan_set_txpow(struct net_device *dev,
 			     struct iw_request_info *info,
-			     struct iw_param *vwrq, char *extra)
+			     union iwreq_data *vwrq, char *extra)
 {
 	return -EOPNOTSUPP;	/* Not Support */
 }
 
 static int ks_wlan_get_txpow(struct net_device *dev,
 			     struct iw_request_info *info,
-			     struct iw_param *vwrq, char *extra)
+			     union iwreq_data *vwrq, char *extra)
 {
 	if (priv->sleep_mode == SLP_SLEEP)
 		return -EPERM;
 
 	/* for SLEEP MODE */
 	/* Not Support */
-	vwrq->value = 0;
-	vwrq->disabled = (vwrq->value == 0);
-	vwrq->fixed = 1;
+	vwrq->txpower.value = 0;
+	vwrq->txpower.disabled = (vwrq->txpower.value == 0);
+	vwrq->txpower.fixed = 1;
 	return 0;
 }
 
 static int ks_wlan_set_retry(struct net_device *dev,
 			     struct iw_request_info *info,
-			     struct iw_param *vwrq, char *extra)
+			     union iwreq_data *vwrq, char *extra)
 {
 	return -EOPNOTSUPP;	/* Not Support */
 }
 
 static int ks_wlan_get_retry(struct net_device *dev,
 			     struct iw_request_info *info,
-			     struct iw_param *vwrq, char *extra)
+			     union iwreq_data *vwrq, char *extra)
 {
 	if (priv->sleep_mode == SLP_SLEEP)
 		return -EPERM;
 
 	/* for SLEEP MODE */
 	/* Not Support */
-	vwrq->value = 0;
-	vwrq->disabled = (vwrq->value == 0);
-	vwrq->fixed = 1;
+	vwrq->retry.value = 0;
+	vwrq->retry.disabled = (vwrq->retry.value == 0);
+	vwrq->retry.fixed = 1;
 	return 0;
 }
 #endif /* KSC_OPNOTSUPP */
 
 static int ks_wlan_get_range(struct net_device *dev,
 			     struct iw_request_info *info,
-			     struct iw_point *dwrq, char *extra)
+			     union iwreq_data *dwrq, char *extra)
 {
 	struct ks_wlan_private *priv = netdev_priv(dev);
 	struct iw_range *range = (struct iw_range *)extra;
@@ -989,7 +992,7 @@ static int ks_wlan_get_range(struct net_device *dev,
 		return -EPERM;
 
 	/* for SLEEP MODE */
-	dwrq->length = sizeof(struct iw_range);
+	dwrq->data.length = sizeof(struct iw_range);
 	memset(range, 0, sizeof(*range));
 	range->min_nwid = 0x0000;
 	range->max_nwid = 0x0000;
@@ -1109,14 +1112,14 @@ static int ks_wlan_get_range(struct net_device *dev,
 
 static int ks_wlan_set_power(struct net_device *dev,
 			     struct iw_request_info *info,
-			     struct iw_param *vwrq, char *extra)
+			     union iwreq_data *vwrq, char *extra)
 {
 	struct ks_wlan_private *priv = netdev_priv(dev);
 
 	if (priv->sleep_mode == SLP_SLEEP)
 		return -EPERM;
 
-	if (vwrq->disabled) {
+	if (vwrq->power.disabled) {
 		priv->reg.power_mgmt = POWER_MGMT_ACTIVE;
 	} else {
 		if (priv->reg.operation_mode == MODE_INFRASTRUCTURE)
@@ -1132,7 +1135,7 @@ static int ks_wlan_set_power(struct net_device *dev,
 
 static int ks_wlan_get_power(struct net_device *dev,
 			     struct iw_request_info *info,
-			     struct iw_param *vwrq, char *extra)
+			     union iwreq_data *vwrq, char *extra)
 {
 	struct ks_wlan_private *priv = netdev_priv(dev);
 
@@ -1140,26 +1143,26 @@ static int ks_wlan_get_power(struct net_device *dev,
 		return -EPERM;
 	/* for SLEEP MODE */
 	if (priv->reg.power_mgmt > 0)
-		vwrq->disabled = 0;
+		vwrq->power.disabled = 0;
 	else
-		vwrq->disabled = 1;
+		vwrq->power.disabled = 1;
 
 	return 0;
 }
 
 static int ks_wlan_get_iwstats(struct net_device *dev,
 			       struct iw_request_info *info,
-			       struct iw_quality *vwrq, char *extra)
+			       union iwreq_data *vwrq, char *extra)
 {
 	struct ks_wlan_private *priv = netdev_priv(dev);
 
 	if (priv->sleep_mode == SLP_SLEEP)
 		return -EPERM;
 	/* for SLEEP MODE */
-	vwrq->qual = 0;	/* not supported */
-	vwrq->level = priv->wstats.qual.level;
-	vwrq->noise = 0;	/* not supported */
-	vwrq->updated = 0;
+	vwrq->qual.qual = 0;	/* not supported */
+	vwrq->qual.level = priv->wstats.qual.level;
+	vwrq->qual.noise = 0;	/* not supported */
+	vwrq->qual.updated = 0;
 
 	return 0;
 }
@@ -1167,20 +1170,20 @@ static int ks_wlan_get_iwstats(struct net_device *dev,
 #ifndef KSC_OPNOTSUPP
 
 static int ks_wlan_set_sens(struct net_device *dev,
-			    struct iw_request_info *info, struct iw_param *vwrq,
-			    char *extra)
+			    struct iw_request_info *info,
+			    union iwreq_data *vwrq, char *extra)
 {
 	return -EOPNOTSUPP;	/* Not Support */
 }
 
 static int ks_wlan_get_sens(struct net_device *dev,
-			    struct iw_request_info *info, struct iw_param *vwrq,
-			    char *extra)
+			    struct iw_request_info *info,
+			    union iwreq_data *vwrq, char *extra)
 {
 	/* Not Support */
-	vwrq->value = 0;
-	vwrq->disabled = (vwrq->value == 0);
-	vwrq->fixed = 1;
+	vwrq->sens.value = 0;
+	vwrq->sens.disabled = (vwrq->sens.value == 0);
+	vwrq->sens.fixed = 1;
 	return 0;
 }
 #endif /* KSC_OPNOTSUPP */
@@ -1188,7 +1191,7 @@ static int ks_wlan_get_sens(struct net_device *dev,
 /* Note : this is deprecated in favor of IWSCAN */
 static int ks_wlan_get_aplist(struct net_device *dev,
 			      struct iw_request_info *info,
-			      struct iw_point *dwrq, char *extra)
+			      union iwreq_data *dwrq, char *extra)
 {
 	struct ks_wlan_private *priv = netdev_priv(dev);
 	struct sockaddr *address = (struct sockaddr *)extra;
@@ -1209,11 +1212,11 @@ static int ks_wlan_get_aplist(struct net_device *dev,
 		qual[i].updated = 7;
 	}
 	if (i) {
-		dwrq->flags = 1;	/* Should be define'd */
+		dwrq->data.flags = 1;	/* Should be define'd */
 		memcpy(extra + sizeof(struct sockaddr) * i,
 		       &qual, sizeof(struct iw_quality) * i);
 	}
-	dwrq->length = i;
+	dwrq->data.length = i;
 
 	return 0;
 }
@@ -1410,8 +1413,8 @@ static inline char *ks_wlan_translate_scan(struct net_device *dev,
 }
 
 static int ks_wlan_get_scan(struct net_device *dev,
-			    struct iw_request_info *info, struct iw_point *dwrq,
-			    char *extra)
+			    struct iw_request_info *info,
+			    union iwreq_data *dwrq, char *extra)
 {
 	struct ks_wlan_private *priv = netdev_priv(dev);
 	int i;
@@ -1432,25 +1435,26 @@ static int ks_wlan_get_scan(struct net_device *dev,
 
 	/* Read and parse all entries */
 	for (i = 0; i < priv->aplist.size; i++) {
-		if ((extra + dwrq->length) - current_ev <= IW_EV_ADDR_LEN) {
-			dwrq->length = 0;
+		if ((extra + dwrq->data.length) - current_ev <= IW_EV_ADDR_LEN) {
+			dwrq->data.length = 0;
 			return -E2BIG;
 		}
 		/* Translate to WE format this entry */
 		current_ev = ks_wlan_translate_scan(dev, info, current_ev,
-						    extra + dwrq->length,
+						    extra + dwrq->data.length,
 						    &priv->aplist.ap[i]);
 	}
 	/* Length of data */
-	dwrq->length = (current_ev - extra);
-	dwrq->flags = 0;
+	dwrq->data.length = (current_ev - extra);
+	dwrq->data.flags = 0;
 
 	return 0;
 }
 
 /* called after a bunch of SET operations */
 static int ks_wlan_config_commit(struct net_device *dev,
-				 struct iw_request_info *info, void *zwrq,
+				 struct iw_request_info *info,
+				 union iwreq_data *zwrq,
 				 char *extra)
 {
 	struct ks_wlan_private *priv = netdev_priv(dev);
@@ -1466,7 +1470,7 @@ static int ks_wlan_config_commit(struct net_device *dev,
 /* set association ie params */
 static int ks_wlan_set_genie(struct net_device *dev,
 			     struct iw_request_info *info,
-			     struct iw_point *dwrq, char *extra)
+			     union iwreq_data *dwrq, char *extra)
 {
 	struct ks_wlan_private *priv = netdev_priv(dev);
 
@@ -1479,11 +1483,12 @@ static int ks_wlan_set_genie(struct net_device *dev,
 
 static int ks_wlan_set_auth_mode(struct net_device *dev,
 				 struct iw_request_info *info,
-				 struct iw_param *vwrq, char *extra)
+				 union iwreq_data *vwrq, char *extra)
 {
 	struct ks_wlan_private *priv = netdev_priv(dev);
-	int index = (vwrq->flags & IW_AUTH_INDEX);
-	int value = vwrq->value;
+	struct iw_param *param = &vwrq->param;
+	int index = (param->flags & IW_AUTH_INDEX);
+	int value = param->value;
 
 	if (priv->sleep_mode == SLP_SLEEP)
 		return -EPERM;
@@ -1611,10 +1616,11 @@ static int ks_wlan_set_auth_mode(struct net_device *dev,
 
 static int ks_wlan_get_auth_mode(struct net_device *dev,
 				 struct iw_request_info *info,
-				 struct iw_param *vwrq, char *extra)
+				 union iwreq_data *vwrq, char *extra)
 {
 	struct ks_wlan_private *priv = netdev_priv(dev);
-	int index = (vwrq->flags & IW_AUTH_INDEX);
+	struct iw_param *param = &vwrq->param;
+	int index = (param->flags & IW_AUTH_INDEX);
 
 	if (priv->sleep_mode == SLP_SLEEP)
 		return -EPERM;
@@ -1623,22 +1629,22 @@ static int ks_wlan_get_auth_mode(struct net_device *dev,
 	/*  WPA (not used ?? wpa_supplicant) */
 	switch (index) {
 	case IW_AUTH_WPA_VERSION:
-		vwrq->value = priv->wpa.version;
+		param->value = priv->wpa.version;
 		break;
 	case IW_AUTH_CIPHER_PAIRWISE:
-		vwrq->value = priv->wpa.pairwise_suite;
+		param->value = priv->wpa.pairwise_suite;
 		break;
 	case IW_AUTH_CIPHER_GROUP:
-		vwrq->value = priv->wpa.group_suite;
+		param->value = priv->wpa.group_suite;
 		break;
 	case IW_AUTH_KEY_MGMT:
-		vwrq->value = priv->wpa.key_mgmt_suite;
+		param->value = priv->wpa.key_mgmt_suite;
 		break;
 	case IW_AUTH_80211_AUTH_ALG:
-		vwrq->value = priv->wpa.auth_alg;
+		param->value = priv->wpa.auth_alg;
 		break;
 	case IW_AUTH_WPA_ENABLED:
-		vwrq->value = priv->wpa.rsn_enabled;
+		param->value = priv->wpa.rsn_enabled;
 		break;
 	case IW_AUTH_RX_UNENCRYPTED_EAPOL:	/* OK??? */
 	case IW_AUTH_TKIP_COUNTERMEASURES:
@@ -1653,11 +1659,11 @@ static int ks_wlan_get_auth_mode(struct net_device *dev,
 /* set encoding token & mode (WPA)*/
 static int ks_wlan_set_encode_ext(struct net_device *dev,
 				  struct iw_request_info *info,
-				  struct iw_point *dwrq, char *extra)
+				  union iwreq_data *dwrq, char *extra)
 {
 	struct ks_wlan_private *priv = netdev_priv(dev);
 	struct iw_encode_ext *enc;
-	int index = dwrq->flags & IW_ENCODE_INDEX;
+	int index = dwrq->encoding.flags & IW_ENCODE_INDEX;
 	unsigned int commit = 0;
 	struct wpa_key_t *key;
 
@@ -1674,7 +1680,7 @@ static int ks_wlan_set_encode_ext(struct net_device *dev,
 	index--;
 	key = &priv->wpa.key[index];
 
-	if (dwrq->flags & IW_ENCODE_DISABLED)
+	if (dwrq->encoding.flags & IW_ENCODE_DISABLED)
 		key->key_len = 0;
 
 	key->ext_flags = enc->ext_flags;
@@ -1746,7 +1752,7 @@ static int ks_wlan_set_encode_ext(struct net_device *dev,
 /* get encoding token & mode (WPA)*/
 static int ks_wlan_get_encode_ext(struct net_device *dev,
 				  struct iw_request_info *info,
-				  struct iw_point *dwrq, char *extra)
+				  union iwreq_data *dwrq, char *extra)
 {
 	struct ks_wlan_private *priv = netdev_priv(dev);
 
@@ -1766,7 +1772,7 @@ static int ks_wlan_get_encode_ext(struct net_device *dev,
 
 static int ks_wlan_set_pmksa(struct net_device *dev,
 			     struct iw_request_info *info,
-			     struct iw_point *dwrq, char *extra)
+			     union iwreq_data *dwrq, char *extra)
 {
 	struct ks_wlan_private *priv = netdev_priv(dev);
 	struct iw_pmksa *pmksa;
@@ -1906,8 +1912,8 @@ static int ks_wlan_set_stop_request(struct net_device *dev,
 
 #include <linux/ieee80211.h>
 static int ks_wlan_set_mlme(struct net_device *dev,
-			    struct iw_request_info *info, struct iw_point *dwrq,
-			    char *extra)
+			    struct iw_request_info *info,
+			    union iwreq_data *dwrq, char *extra)
 {
 	struct ks_wlan_private *priv = netdev_priv(dev);
 	struct iw_mlme *mlme = (struct iw_mlme *)extra;
@@ -2528,76 +2534,50 @@ static const struct iw_priv_args ks_wlan_private_args[] = {
 };
 
 static const iw_handler ks_wlan_handler[] = {
-	(iw_handler)ks_wlan_config_commit,	/* SIOCSIWCOMMIT */
-	(iw_handler)ks_wlan_get_name,	/* SIOCGIWNAME */
-	(iw_handler)NULL,	/* SIOCSIWNWID */
-	(iw_handler)NULL,	/* SIOCGIWNWID */
-	(iw_handler)ks_wlan_set_freq,	/* SIOCSIWFREQ */
-	(iw_handler)ks_wlan_get_freq,	/* SIOCGIWFREQ */
-	(iw_handler)ks_wlan_set_mode,	/* SIOCSIWMODE */
-	(iw_handler)ks_wlan_get_mode,	/* SIOCGIWMODE */
+	IW_HANDLER(SIOCSIWCOMMIT, ks_wlan_config_commit),
+	IW_HANDLER(SIOCGIWNAME, ks_wlan_get_name),
+	IW_HANDLER(SIOCSIWFREQ, ks_wlan_set_freq),
+	IW_HANDLER(SIOCGIWFREQ, ks_wlan_get_freq),
+	IW_HANDLER(SIOCSIWMODE, ks_wlan_set_mode),
+	IW_HANDLER(SIOCGIWMODE, ks_wlan_get_mode),
 #ifndef KSC_OPNOTSUPP
-	(iw_handler)ks_wlan_set_sens,	/* SIOCSIWSENS */
-	(iw_handler)ks_wlan_get_sens,	/* SIOCGIWSENS */
-#else /* KSC_OPNOTSUPP */
-	(iw_handler)NULL,	/* SIOCSIWSENS */
-	(iw_handler)NULL,	/* SIOCGIWSENS */
+	IW_HANDLER(SIOCSIWSENS, ks_wlan_set_sens),
+	IW_HANDLER(SIOCGIWSENS, ks_wlan_get_sens),
 #endif /* KSC_OPNOTSUPP */
-	(iw_handler)NULL,	/* SIOCSIWRANGE */
-	(iw_handler)ks_wlan_get_range,	/* SIOCGIWRANGE */
-	(iw_handler)NULL,	/* SIOCSIWPRIV */
-	(iw_handler)NULL,	/* SIOCGIWPRIV */
-	(iw_handler)NULL,	/* SIOCSIWSTATS */
-	(iw_handler)ks_wlan_get_iwstats,	/* SIOCGIWSTATS */
-	(iw_handler)NULL,	/* SIOCSIWSPY */
-	(iw_handler)NULL,	/* SIOCGIWSPY */
-	(iw_handler)NULL,	/* SIOCSIWTHRSPY */
-	(iw_handler)NULL,	/* SIOCGIWTHRSPY */
-	(iw_handler)ks_wlan_set_wap,	/* SIOCSIWAP */
-	(iw_handler)ks_wlan_get_wap,	/* SIOCGIWAP */
-//      (iw_handler)NULL,                      /* SIOCSIWMLME */
-	(iw_handler)ks_wlan_set_mlme,	/* SIOCSIWMLME */
-	(iw_handler)ks_wlan_get_aplist,	/* SIOCGIWAPLIST */
-	(iw_handler)ks_wlan_set_scan,	/* SIOCSIWSCAN */
-	(iw_handler)ks_wlan_get_scan,	/* SIOCGIWSCAN */
-	(iw_handler)ks_wlan_set_essid,	/* SIOCSIWESSID */
-	(iw_handler)ks_wlan_get_essid,	/* SIOCGIWESSID */
-	(iw_handler)ks_wlan_set_nick,	/* SIOCSIWNICKN */
-	(iw_handler)ks_wlan_get_nick,	/* SIOCGIWNICKN */
-	(iw_handler)NULL,	/* -- hole -- */
-	(iw_handler)NULL,	/* -- hole -- */
-	(iw_handler)ks_wlan_set_rate,	/* SIOCSIWRATE */
-	(iw_handler)ks_wlan_get_rate,	/* SIOCGIWRATE */
-	(iw_handler)ks_wlan_set_rts,	/* SIOCSIWRTS */
-	(iw_handler)ks_wlan_get_rts,	/* SIOCGIWRTS */
-	(iw_handler)ks_wlan_set_frag,	/* SIOCSIWFRAG */
-	(iw_handler)ks_wlan_get_frag,	/* SIOCGIWFRAG */
+	IW_HANDLER(SIOCGIWRANGE, ks_wlan_get_range),
+	IW_HANDLER(SIOCGIWSTATS, ks_wlan_get_iwstats),
+	IW_HANDLER(SIOCSIWAP, ks_wlan_set_wap),
+	IW_HANDLER(SIOCGIWAP, ks_wlan_get_wap),
+	IW_HANDLER(SIOCSIWMLME, ks_wlan_set_mlme),
+	IW_HANDLER(SIOCGIWAPLIST, ks_wlan_get_aplist),
+	IW_HANDLER(SIOCSIWSCAN, ks_wlan_set_scan),
+	IW_HANDLER(SIOCGIWSCAN, ks_wlan_get_scan),
+	IW_HANDLER(SIOCSIWESSID, ks_wlan_set_essid),
+	IW_HANDLER(SIOCGIWESSID, ks_wlan_get_essid),
+	IW_HANDLER(SIOCSIWNICKN, ks_wlan_set_nick),
+	IW_HANDLER(SIOCGIWNICKN, ks_wlan_get_nick),
+	IW_HANDLER(SIOCSIWRATE, ks_wlan_set_rate),
+	IW_HANDLER(SIOCGIWRATE, ks_wlan_get_rate),
+	IW_HANDLER(SIOCSIWRTS, ks_wlan_set_rts),
+	IW_HANDLER(SIOCGIWRTS, ks_wlan_get_rts),
+	IW_HANDLER(SIOCSIWFRAG, ks_wlan_set_frag),
+	IW_HANDLER(SIOCGIWFRAG, ks_wlan_get_frag),
 #ifndef KSC_OPNOTSUPP
-	(iw_handler)ks_wlan_set_txpow,	/* SIOCSIWTXPOW */
-	(iw_handler)ks_wlan_get_txpow,	/* SIOCGIWTXPOW */
-	(iw_handler)ks_wlan_set_retry,	/* SIOCSIWRETRY */
-	(iw_handler)ks_wlan_get_retry,	/* SIOCGIWRETRY */
-#else /* KSC_OPNOTSUPP */
-	(iw_handler)NULL,	/* SIOCSIWTXPOW */
-	(iw_handler)NULL,	/* SIOCGIWTXPOW */
-	(iw_handler)NULL,	/* SIOCSIWRETRY */
-	(iw_handler)NULL,	/* SIOCGIWRETRY */
+	IW_HANDLER(SIOCSIWTXPOW, ks_wlan_set_txpow),
+	IW_HANDLER(SIOCGIWTXPOW, ks_wlan_get_txpow),
+	IW_HANDLER(SIOCSIWRETRY, ks_wlan_set_retry),
+	IW_HANDLER(SIOCGIWRETRY, ks_wlan_get_retry),
 #endif /* KSC_OPNOTSUPP */
-	(iw_handler)ks_wlan_set_encode,	/* SIOCSIWENCODE */
-	(iw_handler)ks_wlan_get_encode,	/* SIOCGIWENCODE */
-	(iw_handler)ks_wlan_set_power,	/* SIOCSIWPOWER */
-	(iw_handler)ks_wlan_get_power,	/* SIOCGIWPOWER */
-	(iw_handler)NULL,	/* -- hole -- */
-	(iw_handler)NULL,	/* -- hole -- */
-//      (iw_handler)NULL,                      /* SIOCSIWGENIE */
-	(iw_handler)ks_wlan_set_genie,	/* SIOCSIWGENIE */
-	(iw_handler)NULL,	/* SIOCGIWGENIE */
-	(iw_handler)ks_wlan_set_auth_mode,	/* SIOCSIWAUTH */
-	(iw_handler)ks_wlan_get_auth_mode,	/* SIOCGIWAUTH */
-	(iw_handler)ks_wlan_set_encode_ext,	/* SIOCSIWENCODEEXT */
-	(iw_handler)ks_wlan_get_encode_ext,	/* SIOCGIWENCODEEXT */
-	(iw_handler)ks_wlan_set_pmksa,	/* SIOCSIWPMKSA */
-	(iw_handler)NULL,	/* -- hole -- */
+	IW_HANDLER(SIOCSIWENCODE, ks_wlan_set_encode),
+	IW_HANDLER(SIOCGIWENCODE, ks_wlan_get_encode),
+	IW_HANDLER(SIOCSIWPOWER, ks_wlan_set_power),
+	IW_HANDLER(SIOCGIWPOWER, ks_wlan_get_power),
+	IW_HANDLER(SIOCSIWGENIE, ks_wlan_set_genie),
+	IW_HANDLER(SIOCSIWAUTH, ks_wlan_set_auth_mode),
+	IW_HANDLER(SIOCGIWAUTH, ks_wlan_get_auth_mode),
+	IW_HANDLER(SIOCSIWENCODEEXT, ks_wlan_set_encode_ext),
+	IW_HANDLER(SIOCGIWENCODEEXT, ks_wlan_get_encode_ext),
+	IW_HANDLER(SIOCSIWPMKSA, ks_wlan_set_pmksa),
 };
 
 /* private_handler */
@@ -2644,11 +2624,11 @@ static const iw_handler ks_wlan_private_handler[] = {
 };
 
 static const struct iw_handler_def ks_wlan_handler_def = {
-	.num_standard = sizeof(ks_wlan_handler) / sizeof(iw_handler),
+	.standard = ks_wlan_handler,
+	.num_standard = ARRAY_SIZE(ks_wlan_handler),
 	.num_private = sizeof(ks_wlan_private_handler) / sizeof(iw_handler),
 	.num_private_args =
 	    sizeof(ks_wlan_private_args) / sizeof(struct iw_priv_args),
-	.standard = (iw_handler *)ks_wlan_handler,
 	.private = (iw_handler *)ks_wlan_private_handler,
 	.private_args = (struct iw_priv_args *)ks_wlan_private_args,
 	.get_wireless_stats = ks_get_wireless_stats,
-- 
2.7.4


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

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

* [PATCH 18/21] staging: ks7010: remove KSC_OPNOTSUPP related code
  2018-04-19  5:07 [PATCH 00/21] next cleanups Sergio Paracuellos
                   ` (16 preceding siblings ...)
  2018-04-19  5:08 ` [PATCH 17/21] staging: ks7010: use IW_HANDLER macro in ks_wlan_handler Sergio Paracuellos
@ 2018-04-19  5:08 ` Sergio Paracuellos
  2018-04-19  5:08 ` [PATCH 19/21] staging: ks7010: align comments in ks_wlan_private_handler Sergio Paracuellos
                   ` (2 subsequent siblings)
  20 siblings, 0 replies; 31+ messages in thread
From: Sergio Paracuellos @ 2018-04-19  5:08 UTC (permalink / raw)
  To: gregkh; +Cc: driverdev-devel, wsa

This commit reviews KSC_OPNOTSUPP related code. The
preprocessor KSC_OPNOTSUPP is defined by default so
related wext functions are not being used. Just clean
code removing all of this stuff.

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

diff --git a/drivers/staging/ks7010/ks_wlan_net.c b/drivers/staging/ks7010/ks_wlan_net.c
index 5f70957..979ff57 100644
--- a/drivers/staging/ks7010/ks_wlan_net.c
+++ b/drivers/staging/ks7010/ks_wlan_net.c
@@ -52,8 +52,6 @@ struct wep_key {
 /* List of Wireless Handlers (new API) */
 static const struct iw_handler_def ks_wlan_handler_def;
 
-#define KSC_OPNOTSUPP	/* Operation Not Support */
-
 /*
  *	function prototypes
  */
@@ -934,52 +932,6 @@ static int ks_wlan_get_encode(struct net_device *dev,
 	return 0;
 }
 
-#ifndef KSC_OPNOTSUPP
-static int ks_wlan_set_txpow(struct net_device *dev,
-			     struct iw_request_info *info,
-			     union iwreq_data *vwrq, char *extra)
-{
-	return -EOPNOTSUPP;	/* Not Support */
-}
-
-static int ks_wlan_get_txpow(struct net_device *dev,
-			     struct iw_request_info *info,
-			     union iwreq_data *vwrq, char *extra)
-{
-	if (priv->sleep_mode == SLP_SLEEP)
-		return -EPERM;
-
-	/* for SLEEP MODE */
-	/* Not Support */
-	vwrq->txpower.value = 0;
-	vwrq->txpower.disabled = (vwrq->txpower.value == 0);
-	vwrq->txpower.fixed = 1;
-	return 0;
-}
-
-static int ks_wlan_set_retry(struct net_device *dev,
-			     struct iw_request_info *info,
-			     union iwreq_data *vwrq, char *extra)
-{
-	return -EOPNOTSUPP;	/* Not Support */
-}
-
-static int ks_wlan_get_retry(struct net_device *dev,
-			     struct iw_request_info *info,
-			     union iwreq_data *vwrq, char *extra)
-{
-	if (priv->sleep_mode == SLP_SLEEP)
-		return -EPERM;
-
-	/* for SLEEP MODE */
-	/* Not Support */
-	vwrq->retry.value = 0;
-	vwrq->retry.disabled = (vwrq->retry.value == 0);
-	vwrq->retry.fixed = 1;
-	return 0;
-}
-#endif /* KSC_OPNOTSUPP */
-
 static int ks_wlan_get_range(struct net_device *dev,
 			     struct iw_request_info *info,
 			     union iwreq_data *dwrq, char *extra)
@@ -1167,27 +1119,6 @@ static int ks_wlan_get_iwstats(struct net_device *dev,
 	return 0;
 }
 
-#ifndef KSC_OPNOTSUPP
-
-static int ks_wlan_set_sens(struct net_device *dev,
-			    struct iw_request_info *info,
-			    union iwreq_data *vwrq, char *extra)
-{
-	return -EOPNOTSUPP;	/* Not Support */
-}
-
-static int ks_wlan_get_sens(struct net_device *dev,
-			    struct iw_request_info *info,
-			    union iwreq_data *vwrq, char *extra)
-{
-	/* Not Support */
-	vwrq->sens.value = 0;
-	vwrq->sens.disabled = (vwrq->sens.value == 0);
-	vwrq->sens.fixed = 1;
-	return 0;
-}
-#endif /* KSC_OPNOTSUPP */
-
 /* Note : this is deprecated in favor of IWSCAN */
 static int ks_wlan_get_aplist(struct net_device *dev,
 			      struct iw_request_info *info,
@@ -2540,10 +2471,6 @@ static const iw_handler ks_wlan_handler[] = {
 	IW_HANDLER(SIOCGIWFREQ, ks_wlan_get_freq),
 	IW_HANDLER(SIOCSIWMODE, ks_wlan_set_mode),
 	IW_HANDLER(SIOCGIWMODE, ks_wlan_get_mode),
-#ifndef KSC_OPNOTSUPP
-	IW_HANDLER(SIOCSIWSENS, ks_wlan_set_sens),
-	IW_HANDLER(SIOCGIWSENS, ks_wlan_get_sens),
-#endif /* KSC_OPNOTSUPP */
 	IW_HANDLER(SIOCGIWRANGE, ks_wlan_get_range),
 	IW_HANDLER(SIOCGIWSTATS, ks_wlan_get_iwstats),
 	IW_HANDLER(SIOCSIWAP, ks_wlan_set_wap),
@@ -2562,12 +2489,6 @@ static const iw_handler ks_wlan_handler[] = {
 	IW_HANDLER(SIOCGIWRTS, ks_wlan_get_rts),
 	IW_HANDLER(SIOCSIWFRAG, ks_wlan_set_frag),
 	IW_HANDLER(SIOCGIWFRAG, ks_wlan_get_frag),
-#ifndef KSC_OPNOTSUPP
-	IW_HANDLER(SIOCSIWTXPOW, ks_wlan_set_txpow),
-	IW_HANDLER(SIOCGIWTXPOW, ks_wlan_get_txpow),
-	IW_HANDLER(SIOCSIWRETRY, ks_wlan_set_retry),
-	IW_HANDLER(SIOCGIWRETRY, ks_wlan_get_retry),
-#endif /* KSC_OPNOTSUPP */
 	IW_HANDLER(SIOCSIWENCODE, ks_wlan_set_encode),
 	IW_HANDLER(SIOCGIWENCODE, ks_wlan_get_encode),
 	IW_HANDLER(SIOCSIWPOWER, ks_wlan_set_power),
-- 
2.7.4

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

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

* [PATCH 19/21] staging: ks7010: align comments in ks_wlan_private_handler
  2018-04-19  5:07 [PATCH 00/21] next cleanups Sergio Paracuellos
                   ` (17 preceding siblings ...)
  2018-04-19  5:08 ` [PATCH 18/21] staging: ks7010: remove KSC_OPNOTSUPP related code Sergio Paracuellos
@ 2018-04-19  5:08 ` Sergio Paracuellos
  2018-04-19  5:08 ` [PATCH 20/21] staging: ks7010: use ARRAY_SIZE macro in ks_wlan_handler_def Sergio Paracuellos
  2018-04-19  5:08 ` [PATCH 21/21] staging: ks7010: init local variables when they are declared in ks7010_sdio_probe Sergio Paracuellos
  20 siblings, 0 replies; 31+ messages in thread
From: Sergio Paracuellos @ 2018-04-19  5:08 UTC (permalink / raw)
  To: gregkh; +Cc: driverdev-devel, wsa

This commit align comment inside ks_wlan_private_handler
WEXT private driver operations. This improves readability.

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

diff --git a/drivers/staging/ks7010/ks_wlan_net.c b/drivers/staging/ks7010/ks_wlan_net.c
index 979ff57..6575cf8 100644
--- a/drivers/staging/ks7010/ks_wlan_net.c
+++ b/drivers/staging/ks7010/ks_wlan_net.c
@@ -2503,31 +2503,30 @@ static const iw_handler ks_wlan_handler[] = {
 
 /* private_handler */
 static const iw_handler ks_wlan_private_handler[] = {
-	(iw_handler)NULL,	/*  0 */
-	(iw_handler)NULL,	/*  1, used to be: KS_WLAN_GET_DRIVER_VERSION */
-	(iw_handler)NULL,	/*  2 */
-	(iw_handler)ks_wlan_get_firmware_version,	/*  3 KS_WLAN_GET_FIRM_VERSION */
+	(iw_handler)NULL,			/* 0 */
+	(iw_handler)NULL,			/* 1, KS_WLAN_GET_DRIVER_VERSION */
+	(iw_handler)NULL,			/* 2 */
+	(iw_handler)ks_wlan_get_firmware_version,/* 3 KS_WLAN_GET_FIRM_VERSION */
 #ifdef WPS
-	(iw_handler)ks_wlan_set_wps_enable,	/*  4 KS_WLAN_SET_WPS_ENABLE  */
-	(iw_handler)ks_wlan_get_wps_enable,	/*  5 KS_WLAN_GET_WPS_ENABLE  */
-	(iw_handler)ks_wlan_set_wps_probe_req,	/*  6 KS_WLAN_SET_WPS_PROBE_REQ */
+	(iw_handler)ks_wlan_set_wps_enable,	/* 4 KS_WLAN_SET_WPS_ENABLE */
+	(iw_handler)ks_wlan_get_wps_enable,	/* 5 KS_WLAN_GET_WPS_ENABLE */
+	(iw_handler)ks_wlan_set_wps_probe_req,	/* 6 KS_WLAN_SET_WPS_PROBE_REQ */
 #else
-	(iw_handler)NULL,	/*  4 */
-	(iw_handler)NULL,	/*  5 */
-	(iw_handler)NULL,	/*  6 */
+	(iw_handler)NULL,			/* 4 */
+	(iw_handler)NULL,			/* 5 */
+	(iw_handler)NULL,			/* 6 */
 #endif /* WPS */
-
-	(iw_handler)ks_wlan_get_eeprom_cksum,	/*  7 KS_WLAN_GET_CONNECT */
-	(iw_handler)ks_wlan_set_preamble,	/*  8 KS_WLAN_SET_PREAMBLE */
-	(iw_handler)ks_wlan_get_preamble,	/*  9 KS_WLAN_GET_PREAMBLE */
+	(iw_handler)ks_wlan_get_eeprom_cksum,	/* 7 KS_WLAN_GET_CONNECT */
+	(iw_handler)ks_wlan_set_preamble,	/* 8 KS_WLAN_SET_PREAMBLE */
+	(iw_handler)ks_wlan_get_preamble,	/* 9 KS_WLAN_GET_PREAMBLE */
 	(iw_handler)ks_wlan_set_power_mgmt,	/* 10 KS_WLAN_SET_POWER_SAVE */
 	(iw_handler)ks_wlan_get_power_mgmt,	/* 11 KS_WLAN_GET_POWER_SAVE */
 	(iw_handler)ks_wlan_set_scan_type,	/* 12 KS_WLAN_SET_SCAN_TYPE */
 	(iw_handler)ks_wlan_get_scan_type,	/* 13 KS_WLAN_GET_SCAN_TYPE */
 	(iw_handler)ks_wlan_set_rx_gain,	/* 14 KS_WLAN_SET_RX_GAIN */
 	(iw_handler)ks_wlan_get_rx_gain,	/* 15 KS_WLAN_GET_RX_GAIN */
-	(iw_handler)ks_wlan_hostt,	/* 16 KS_WLAN_HOSTT */
-	(iw_handler)NULL,	/* 17 */
+	(iw_handler)ks_wlan_hostt,		/* 16 KS_WLAN_HOSTT */
+	(iw_handler)NULL,			/* 17 */
 	(iw_handler)ks_wlan_set_beacon_lost,	/* 18 KS_WLAN_SET_BECAN_LOST */
 	(iw_handler)ks_wlan_get_beacon_lost,	/* 19 KS_WLAN_GET_BECAN_LOST */
 	(iw_handler)ks_wlan_set_tx_gain,	/* 20 KS_WLAN_SET_TX_GAIN */
@@ -2536,12 +2535,12 @@ static const iw_handler ks_wlan_private_handler[] = {
 	(iw_handler)ks_wlan_get_phy_type,	/* 23 KS_WLAN_GET_PHY_TYPE */
 	(iw_handler)ks_wlan_set_cts_mode,	/* 24 KS_WLAN_SET_CTS_MODE */
 	(iw_handler)ks_wlan_get_cts_mode,	/* 25 KS_WLAN_GET_CTS_MODE */
-	(iw_handler)NULL,	/* 26 */
-	(iw_handler)NULL,	/* 27 */
+	(iw_handler)NULL,			/* 26 */
+	(iw_handler)NULL,			/* 27 */
 	(iw_handler)ks_wlan_set_sleep_mode,	/* 28 KS_WLAN_SET_SLEEP_MODE */
 	(iw_handler)ks_wlan_get_sleep_mode,	/* 29 KS_WLAN_GET_SLEEP_MODE */
-	(iw_handler)NULL,	/* 30 */
-	(iw_handler)NULL,	/* 31 */
+	(iw_handler)NULL,			/* 30 */
+	(iw_handler)NULL,			/* 31 */
 };
 
 static const struct iw_handler_def ks_wlan_handler_def = {
-- 
2.7.4

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

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

* [PATCH 20/21] staging: ks7010: use ARRAY_SIZE macro in ks_wlan_handler_def
  2018-04-19  5:07 [PATCH 00/21] next cleanups Sergio Paracuellos
                   ` (18 preceding siblings ...)
  2018-04-19  5:08 ` [PATCH 19/21] staging: ks7010: align comments in ks_wlan_private_handler Sergio Paracuellos
@ 2018-04-19  5:08 ` Sergio Paracuellos
  2018-04-19  5:08 ` [PATCH 21/21] staging: ks7010: init local variables when they are declared in ks7010_sdio_probe Sergio Paracuellos
  20 siblings, 0 replies; 31+ messages in thread
From: Sergio Paracuellos @ 2018-04-19  5:08 UTC (permalink / raw)
  To: gregkh; +Cc: driverdev-devel, wsa

This commit make use of ARRAY_SIZE macro to set fields num_private
and num_private_args of the iw_handler_def struct of the driver.

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

diff --git a/drivers/staging/ks7010/ks_wlan_net.c b/drivers/staging/ks7010/ks_wlan_net.c
index 6575cf8..72c29aa 100644
--- a/drivers/staging/ks7010/ks_wlan_net.c
+++ b/drivers/staging/ks7010/ks_wlan_net.c
@@ -2546,9 +2546,8 @@ static const iw_handler ks_wlan_private_handler[] = {
 static const struct iw_handler_def ks_wlan_handler_def = {
 	.standard = ks_wlan_handler,
 	.num_standard = ARRAY_SIZE(ks_wlan_handler),
-	.num_private = sizeof(ks_wlan_private_handler) / sizeof(iw_handler),
-	.num_private_args =
-	    sizeof(ks_wlan_private_args) / sizeof(struct iw_priv_args),
+	.num_private = ARRAY_SIZE(ks_wlan_private_handler),
+	.num_private_args = ARRAY_SIZE(ks_wlan_private_args),
 	.private = (iw_handler *)ks_wlan_private_handler,
 	.private_args = (struct iw_priv_args *)ks_wlan_private_args,
 	.get_wireless_stats = ks_get_wireless_stats,
-- 
2.7.4

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

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

* [PATCH 21/21] staging: ks7010: init local variables when they are declared in ks7010_sdio_probe
  2018-04-19  5:07 [PATCH 00/21] next cleanups Sergio Paracuellos
                   ` (19 preceding siblings ...)
  2018-04-19  5:08 ` [PATCH 20/21] staging: ks7010: use ARRAY_SIZE macro in ks_wlan_handler_def Sergio Paracuellos
@ 2018-04-19  5:08 ` Sergio Paracuellos
  2018-04-23 12:45   ` Dan Carpenter
  20 siblings, 1 reply; 31+ messages in thread
From: Sergio Paracuellos @ 2018-04-19  5:08 UTC (permalink / raw)
  To: gregkh; +Cc: driverdev-devel, wsa

This commit change init point of two variables to forward them to
init time. This variables are just being assigned some lines after
and it is more clear to init them when the init value is known and
in this case this is known when they are declared.

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

diff --git a/drivers/staging/ks7010/ks7010_sdio.c b/drivers/staging/ks7010/ks7010_sdio.c
index 11839af..18e2350 100644
--- a/drivers/staging/ks7010/ks7010_sdio.c
+++ b/drivers/staging/ks7010/ks7010_sdio.c
@@ -981,14 +981,11 @@ static void ks7010_private_init(struct ks_wlan_private *priv,
 static int ks7010_sdio_probe(struct sdio_func *func,
 			     const struct sdio_device_id *device)
 {
-	struct ks_wlan_private *priv;
+	struct ks_wlan_private *priv = NULL;
+	struct net_device *netdev = NULL;
 	struct ks_sdio_card *card;
-	struct net_device *netdev;
 	int ret;
 
-	priv = NULL;
-	netdev = NULL;
-
 	card = kzalloc(sizeof(*card), GFP_KERNEL);
 	if (!card)
 		return -ENOMEM;
-- 
2.7.4

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

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

* Re: [PATCH 05/21] staging: ks7010: change if-else condition assignment to use ternary operator
  2018-04-19  5:07 ` [PATCH 05/21] staging: ks7010: change if-else condition assignment to use ternary operator Sergio Paracuellos
@ 2018-04-23 12:09   ` Dan Carpenter
  2018-04-23 13:26     ` Sergio Paracuellos
  0 siblings, 1 reply; 31+ messages in thread
From: Dan Carpenter @ 2018-04-23 12:09 UTC (permalink / raw)
  To: Sergio Paracuellos; +Cc: gregkh, driverdev-devel, wsa

On Thu, Apr 19, 2018 at 07:07:59AM +0200, Sergio Paracuellos wrote:
> This commit changes an if-else block used to just assign a
> variable to use a ternary operator to do the same improving
> readability.
> 
> Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
> ---
>  drivers/staging/ks7010/ks_wlan_net.c | 5 +----
>  1 file changed, 1 insertion(+), 4 deletions(-)
> 
> diff --git a/drivers/staging/ks7010/ks_wlan_net.c b/drivers/staging/ks7010/ks_wlan_net.c
> index af42cf6..53b580e 100644
> --- a/drivers/staging/ks7010/ks_wlan_net.c
> +++ b/drivers/staging/ks7010/ks_wlan_net.c
> @@ -673,10 +673,7 @@ static int ks_wlan_get_rate(struct net_device *dev,
>  		ks_wlan_update_phy_information(priv);
>  
>  	vwrq->value = ((priv->current_rate) & RATE_MASK) * 500000;
> -	if (priv->reg.tx_rate == TX_RATE_FIXED)
> -		vwrq->fixed = 1;
> -	else
> -		vwrq->fixed = 0;
> +	vwrq->fixed = (priv->reg.tx_rate == TX_RATE_FIXED) ? 1 : 0;

I noticed from earliyer patches that you're are a huge fan of ternaries.
To me it's basically the same readability before and after...  Maybe:

	vwrq->fixed = (priv->reg.tx_rate == TX_RATE_FIXED);

regards,
dan carpenter

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

* Re: [PATCH 01/21] staging: ks7010: remove struct ieee802_1x_eapol_key
  2018-04-19  5:07 ` [PATCH 01/21] staging: ks7010: remove struct ieee802_1x_eapol_key Sergio Paracuellos
@ 2018-04-23 12:32   ` Greg KH
  0 siblings, 0 replies; 31+ messages in thread
From: Greg KH @ 2018-04-23 12:32 UTC (permalink / raw)
  To: Sergio Paracuellos; +Cc: driverdev-devel, wsa

On Thu, Apr 19, 2018 at 07:07:55AM +0200, Sergio Paracuellos wrote:
> This commit removes ieee802_1x_eapol_key struct because
> it is not being used at all. It also removes definitions
> related to some fields of the removed struct.
> 
> Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
> ---
>  drivers/staging/ks7010/eap_packet.h | 41 -------------------------------------
>  1 file changed, 41 deletions(-)

Same for this series, most applied, but some did not.  Please rebase and
resend.

thanks,

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

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

* Re: [PATCH 21/21] staging: ks7010: init local variables when they are declared in ks7010_sdio_probe
  2018-04-19  5:08 ` [PATCH 21/21] staging: ks7010: init local variables when they are declared in ks7010_sdio_probe Sergio Paracuellos
@ 2018-04-23 12:45   ` Dan Carpenter
  2018-04-23 13:19     ` Sergio Paracuellos
  0 siblings, 1 reply; 31+ messages in thread
From: Dan Carpenter @ 2018-04-23 12:45 UTC (permalink / raw)
  To: Sergio Paracuellos; +Cc: gregkh, driverdev-devel, wsa

On Thu, Apr 19, 2018 at 07:08:15AM +0200, Sergio Paracuellos wrote:
> This commit change init point of two variables to forward them to
> init time. This variables are just being assigned some lines after
> and it is more clear to init them when the init value is known and
> in this case this is known when they are declared.
> 
> Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
> ---
>  drivers/staging/ks7010/ks7010_sdio.c | 7 ++-----
>  1 file changed, 2 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/staging/ks7010/ks7010_sdio.c b/drivers/staging/ks7010/ks7010_sdio.c
> index 11839af..18e2350 100644
> --- a/drivers/staging/ks7010/ks7010_sdio.c
> +++ b/drivers/staging/ks7010/ks7010_sdio.c
> @@ -981,14 +981,11 @@ static void ks7010_private_init(struct ks_wlan_private *priv,
>  static int ks7010_sdio_probe(struct sdio_func *func,
>  			     const struct sdio_device_id *device)
>  {
> -	struct ks_wlan_private *priv;
> +	struct ks_wlan_private *priv = NULL;
> +	struct net_device *netdev = NULL;
>  	struct ks_sdio_card *card;
> -	struct net_device *netdev;
>  	int ret;
>  
> -	priv = NULL;
> -	netdev = NULL;

It's better if we don't initialize these at all.  There is a bug here
and GCC finds it when these aren't initialized to bogus values:

drivers/staging/ks7010/ks7010_sdio.c: In function ‘ks7010_sdio_probe’:
drivers/staging/ks7010/ks7010_sdio.c:932:2: warning: ‘priv’ may be used uninitialized in this function [-Wmaybe-uninitialized]

regards,
dan carpenter

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

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

* Re: [PATCH 21/21] staging: ks7010: init local variables when they are declared in ks7010_sdio_probe
  2018-04-23 12:45   ` Dan Carpenter
@ 2018-04-23 13:19     ` Sergio Paracuellos
  2018-04-23 13:24       ` Dan Carpenter
  0 siblings, 1 reply; 31+ messages in thread
From: Sergio Paracuellos @ 2018-04-23 13:19 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: Greg KH, driverdev-devel, wsa

On Mon, Apr 23, 2018 at 2:45 PM, Dan Carpenter <dan.carpenter@oracle.com> wrote:
> On Thu, Apr 19, 2018 at 07:08:15AM +0200, Sergio Paracuellos wrote:
>> This commit change init point of two variables to forward them to
>> init time. This variables are just being assigned some lines after
>> and it is more clear to init them when the init value is known and
>> in this case this is known when they are declared.
>>
>> Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
>> ---
>>  drivers/staging/ks7010/ks7010_sdio.c | 7 ++-----
>>  1 file changed, 2 insertions(+), 5 deletions(-)
>>
>> diff --git a/drivers/staging/ks7010/ks7010_sdio.c b/drivers/staging/ks7010/ks7010_sdio.c
>> index 11839af..18e2350 100644
>> --- a/drivers/staging/ks7010/ks7010_sdio.c
>> +++ b/drivers/staging/ks7010/ks7010_sdio.c
>> @@ -981,14 +981,11 @@ static void ks7010_private_init(struct ks_wlan_private *priv,
>>  static int ks7010_sdio_probe(struct sdio_func *func,
>>                            const struct sdio_device_id *device)
>>  {
>> -     struct ks_wlan_private *priv;
>> +     struct ks_wlan_private *priv = NULL;
>> +     struct net_device *netdev = NULL;
>>       struct ks_sdio_card *card;
>> -     struct net_device *netdev;
>>       int ret;
>>
>> -     priv = NULL;
>> -     netdev = NULL;
>
> It's better if we don't initialize these at all.  There is a bug here
> and GCC finds it when these aren't initialized to bogus values:
>
> drivers/staging/ks7010/ks7010_sdio.c: In function ‘ks7010_sdio_probe’:
> drivers/staging/ks7010/ks7010_sdio.c:932:2: warning: ‘priv’ may be used uninitialized in this function [-Wmaybe-uninitialized]

I see... but I am not getting any warning in my tree making them
initialized. Am I missing something?

>
> regards,
> dan carpenter

Best regards,
    Sergio Paracuellos
>

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

* Re: [PATCH 21/21] staging: ks7010: init local variables when they are declared in ks7010_sdio_probe
  2018-04-23 13:19     ` Sergio Paracuellos
@ 2018-04-23 13:24       ` Dan Carpenter
  2018-04-23 13:28         ` Sergio Paracuellos
  0 siblings, 1 reply; 31+ messages in thread
From: Dan Carpenter @ 2018-04-23 13:24 UTC (permalink / raw)
  To: Sergio Paracuellos; +Cc: Greg KH, driverdev-devel, wsa

On Mon, Apr 23, 2018 at 03:19:49PM +0200, Sergio Paracuellos wrote:
> On Mon, Apr 23, 2018 at 2:45 PM, Dan Carpenter <dan.carpenter@oracle.com> wrote:
> > On Thu, Apr 19, 2018 at 07:08:15AM +0200, Sergio Paracuellos wrote:
> >> This commit change init point of two variables to forward them to
> >> init time. This variables are just being assigned some lines after
> >> and it is more clear to init them when the init value is known and
> >> in this case this is known when they are declared.
> >>
> >> Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
> >> ---
> >>  drivers/staging/ks7010/ks7010_sdio.c | 7 ++-----
> >>  1 file changed, 2 insertions(+), 5 deletions(-)
> >>
> >> diff --git a/drivers/staging/ks7010/ks7010_sdio.c b/drivers/staging/ks7010/ks7010_sdio.c
> >> index 11839af..18e2350 100644
> >> --- a/drivers/staging/ks7010/ks7010_sdio.c
> >> +++ b/drivers/staging/ks7010/ks7010_sdio.c
> >> @@ -981,14 +981,11 @@ static void ks7010_private_init(struct ks_wlan_private *priv,
> >>  static int ks7010_sdio_probe(struct sdio_func *func,
> >>                            const struct sdio_device_id *device)
> >>  {
> >> -     struct ks_wlan_private *priv;
> >> +     struct ks_wlan_private *priv = NULL;
> >> +     struct net_device *netdev = NULL;
> >>       struct ks_sdio_card *card;
> >> -     struct net_device *netdev;
> >>       int ret;
> >>
> >> -     priv = NULL;
> >> -     netdev = NULL;
> >
> > It's better if we don't initialize these at all.  There is a bug here
> > and GCC finds it when these aren't initialized to bogus values:
> >
> > drivers/staging/ks7010/ks7010_sdio.c: In function ‘ks7010_sdio_probe’:
> > drivers/staging/ks7010/ks7010_sdio.c:932:2: warning: ‘priv’ may be used uninitialized in this function [-Wmaybe-uninitialized]
> 
> I see... but I am not getting any warning in my tree making them
> initialized. Am I missing something?
> 

It's possible that someone fixed them.  I pulled from Greg's
staging-next and it was still buggy but I remember someone sending
patches for these.

Anyway, the point is the same either way.  Don't initialize variables if
you don't need to because it disable's GCC static analysis for
uninitialized variable bugs.

regards,
dan carpenter

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

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

* Re: [PATCH 05/21] staging: ks7010: change if-else condition assignment to use ternary operator
  2018-04-23 12:09   ` Dan Carpenter
@ 2018-04-23 13:26     ` Sergio Paracuellos
  2018-04-23 13:30       ` Dan Carpenter
  0 siblings, 1 reply; 31+ messages in thread
From: Sergio Paracuellos @ 2018-04-23 13:26 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: Greg KH, driverdev-devel, wsa

On Mon, Apr 23, 2018 at 2:09 PM, Dan Carpenter <dan.carpenter@oracle.com> wrote:
> On Thu, Apr 19, 2018 at 07:07:59AM +0200, Sergio Paracuellos wrote:
>> This commit changes an if-else block used to just assign a
>> variable to use a ternary operator to do the same improving
>> readability.
>>
>> Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
>> ---
>>  drivers/staging/ks7010/ks_wlan_net.c | 5 +----
>>  1 file changed, 1 insertion(+), 4 deletions(-)
>>
>> diff --git a/drivers/staging/ks7010/ks_wlan_net.c b/drivers/staging/ks7010/ks_wlan_net.c
>> index af42cf6..53b580e 100644
>> --- a/drivers/staging/ks7010/ks_wlan_net.c
>> +++ b/drivers/staging/ks7010/ks_wlan_net.c
>> @@ -673,10 +673,7 @@ static int ks_wlan_get_rate(struct net_device *dev,
>>               ks_wlan_update_phy_information(priv);
>>
>>       vwrq->value = ((priv->current_rate) & RATE_MASK) * 500000;
>> -     if (priv->reg.tx_rate == TX_RATE_FIXED)
>> -             vwrq->fixed = 1;
>> -     else
>> -             vwrq->fixed = 0;
>> +     vwrq->fixed = (priv->reg.tx_rate == TX_RATE_FIXED) ? 1 : 0;
>
> I noticed from earliyer patches that you're are a huge fan of ternaries.

Hahaha! This made me laugh :-). Well... I kind of like it a bit, maybe :)

> To me it's basically the same readability before and after...  Maybe:
>
>         vwrq->fixed = (priv->reg.tx_rate == TX_RATE_FIXED);

Much more better this! Thanks.

>
> regards,
> dan carpenter
>

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

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

* Re: [PATCH 21/21] staging: ks7010: init local variables when they are declared in ks7010_sdio_probe
  2018-04-23 13:24       ` Dan Carpenter
@ 2018-04-23 13:28         ` Sergio Paracuellos
  0 siblings, 0 replies; 31+ messages in thread
From: Sergio Paracuellos @ 2018-04-23 13:28 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: Greg KH, driverdev-devel, wsa

On Mon, Apr 23, 2018 at 3:24 PM, Dan Carpenter <dan.carpenter@oracle.com> wrote:
> On Mon, Apr 23, 2018 at 03:19:49PM +0200, Sergio Paracuellos wrote:
>> On Mon, Apr 23, 2018 at 2:45 PM, Dan Carpenter <dan.carpenter@oracle.com> wrote:
>> > On Thu, Apr 19, 2018 at 07:08:15AM +0200, Sergio Paracuellos wrote:
>> >> This commit change init point of two variables to forward them to
>> >> init time. This variables are just being assigned some lines after
>> >> and it is more clear to init them when the init value is known and
>> >> in this case this is known when they are declared.
>> >>
>> >> Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
>> >> ---
>> >>  drivers/staging/ks7010/ks7010_sdio.c | 7 ++-----
>> >>  1 file changed, 2 insertions(+), 5 deletions(-)
>> >>
>> >> diff --git a/drivers/staging/ks7010/ks7010_sdio.c b/drivers/staging/ks7010/ks7010_sdio.c
>> >> index 11839af..18e2350 100644
>> >> --- a/drivers/staging/ks7010/ks7010_sdio.c
>> >> +++ b/drivers/staging/ks7010/ks7010_sdio.c
>> >> @@ -981,14 +981,11 @@ static void ks7010_private_init(struct ks_wlan_private *priv,
>> >>  static int ks7010_sdio_probe(struct sdio_func *func,
>> >>                            const struct sdio_device_id *device)
>> >>  {
>> >> -     struct ks_wlan_private *priv;
>> >> +     struct ks_wlan_private *priv = NULL;
>> >> +     struct net_device *netdev = NULL;
>> >>       struct ks_sdio_card *card;
>> >> -     struct net_device *netdev;
>> >>       int ret;
>> >>
>> >> -     priv = NULL;
>> >> -     netdev = NULL;
>> >
>> > It's better if we don't initialize these at all.  There is a bug here
>> > and GCC finds it when these aren't initialized to bogus values:
>> >
>> > drivers/staging/ks7010/ks7010_sdio.c: In function ‘ks7010_sdio_probe’:
>> > drivers/staging/ks7010/ks7010_sdio.c:932:2: warning: ‘priv’ may be used uninitialized in this function [-Wmaybe-uninitialized]
>>
>> I see... but I am not getting any warning in my tree making them
>> initialized. Am I missing something?
>>
>
> It's possible that someone fixed them.  I pulled from Greg's
> staging-next and it was still buggy but I remember someone sending
> patches for these.
>
> Anyway, the point is the same either way.  Don't initialize variables if
> you don't need to because it disable's GCC static analysis for
> uninitialized variable bugs.

Get it! I'll take this into account from now. Thanks!

>
> regards,
> dan carpenter
>

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

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

* Re: [PATCH 05/21] staging: ks7010: change if-else condition assignment to use ternary operator
  2018-04-23 13:26     ` Sergio Paracuellos
@ 2018-04-23 13:30       ` Dan Carpenter
  2018-04-23 13:49         ` Sergio Paracuellos
  0 siblings, 1 reply; 31+ messages in thread
From: Dan Carpenter @ 2018-04-23 13:30 UTC (permalink / raw)
  To: Sergio Paracuellos; +Cc: Greg KH, driverdev-devel, wsa

To be honest, it wasn't even the right thing for me to comment this
patch.  If you think it makes the code nicer then go ahead, you've
earned that.  The patchset is nice and makes a bunch of tricky
improvements to the code.  I reviewed it pretty carefully and couldn't
find any new bugs.

regards,
dan carpenter

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

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

* Re: [PATCH 05/21] staging: ks7010: change if-else condition assignment to use ternary operator
  2018-04-23 13:30       ` Dan Carpenter
@ 2018-04-23 13:49         ` Sergio Paracuellos
  0 siblings, 0 replies; 31+ messages in thread
From: Sergio Paracuellos @ 2018-04-23 13:49 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: Greg KH, driverdev-devel, wsa

On Mon, Apr 23, 2018 at 3:30 PM, Dan Carpenter <dan.carpenter@oracle.com> wrote:
> To be honest, it wasn't even the right thing for me to comment this
> patch.  If you think it makes the code nicer then go ahead, you've
> earned that.  The patchset is nice and makes a bunch of tricky
> improvements to the code.  I reviewed it pretty carefully and couldn't
> find any new bugs.

Thanks Dan. I learn from every comment. This patch was already applied but
I'll take into account those way also from now.

>
> regards,
> dan carpenter
>

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

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

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

Thread overview: 31+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-19  5:07 [PATCH 00/21] next cleanups Sergio Paracuellos
2018-04-19  5:07 ` [PATCH 01/21] staging: ks7010: remove struct ieee802_1x_eapol_key Sergio Paracuellos
2018-04-23 12:32   ` Greg KH
2018-04-19  5:07 ` [PATCH 02/21] staging: ks7010: remove not used enum in eap_packet header file Sergio Paracuellos
2018-04-19  5:07 ` [PATCH 03/21] staging: ks7010: remove auxiliar zeros buffer in ks_wlan_get_encode Sergio Paracuellos
2018-04-19  5:07 ` [PATCH 04/21] staging: ks7010: refactor ks_wlan_set_encode function Sergio Paracuellos
2018-04-19  5:07 ` [PATCH 05/21] staging: ks7010: change if-else condition assignment to use ternary operator Sergio Paracuellos
2018-04-23 12:09   ` Dan Carpenter
2018-04-23 13:26     ` Sergio Paracuellos
2018-04-23 13:30       ` Dan Carpenter
2018-04-23 13:49         ` Sergio Paracuellos
2018-04-19  5:08 ` [PATCH 06/21] staging: ks7010: refactor ks_wlan_set_rx_gain function Sergio Paracuellos
2018-04-19  5:08 ` [PATCH 07/21] staging: ks7010: refactor ks_wlan_set_tx_gain function Sergio Paracuellos
2018-04-19  5:08 ` [PATCH 08/21] staging: ks7010: refactor ks_wlan_set_wps_enable function Sergio Paracuellos
2018-04-19  5:08 ` [PATCH 09/21] staging: ks7010: review includes of ks_wlan_net.c file Sergio Paracuellos
2018-04-19  5:08 ` [PATCH 10/21] staging: ks7010: review includes of ks_wlan.h file Sergio Paracuellos
2018-04-19  5:08 ` [PATCH 11/21] staging: ks7010: remove two fields of ks_wlan_private struct Sergio Paracuellos
2018-04-19  5:08 ` [PATCH 12/21] staging: ks7010: remove enum from ks_wlan.h header Sergio Paracuellos
2018-04-19  5:08 ` [PATCH 13/21] staging: ks7010: removes data_buff field of ks_wlan_private struct Sergio Paracuellos
2018-04-19  5:08 ` [PATCH 14/21] staging: ks7010: review includes of ks_hostif file Sergio Paracuellos
2018-04-19  5:08 ` [PATCH 15/21] staging: ks7010: review includes of ks7010_sdio file Sergio Paracuellos
2018-04-19  5:08 ` [PATCH 16/21] staging: ks7010: review includes of michael_mic.c file Sergio Paracuellos
2018-04-19  5:08 ` [PATCH 17/21] staging: ks7010: use IW_HANDLER macro in ks_wlan_handler Sergio Paracuellos
2018-04-19  5:08 ` [PATCH 18/21] staging: ks7010: remove KSC_OPNOTSUPP related code Sergio Paracuellos
2018-04-19  5:08 ` [PATCH 19/21] staging: ks7010: align comments in ks_wlan_private_handler Sergio Paracuellos
2018-04-19  5:08 ` [PATCH 20/21] staging: ks7010: use ARRAY_SIZE macro in ks_wlan_handler_def Sergio Paracuellos
2018-04-19  5:08 ` [PATCH 21/21] staging: ks7010: init local variables when they are declared in ks7010_sdio_probe Sergio Paracuellos
2018-04-23 12:45   ` Dan Carpenter
2018-04-23 13:19     ` Sergio Paracuellos
2018-04-23 13:24       ` Dan Carpenter
2018-04-23 13:28         ` 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.