[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1426059960-11587-1-git-send-email-mateusz.kulikowski@gmail.com>
Date: Wed, 11 Mar 2015 08:46:00 +0100
From: Mateusz Kulikowski <mateusz.kulikowski@...il.com>
To: gregkh@...uxfoundation.org
Cc: Mateusz Kulikowski <mateusz.kulikowski@...il.com>, joe@...ches.com,
mdcasey@...bloom.com, devel@...verdev.osuosl.org,
linux-kernel@...r.kernel.org
Subject: [PATCH v2] staging: rtl8192e: rtllib_wx: code style improvements
Code reformatting based on checkpatch.pl:
- Replaced min() with min_t()
- Replaced printk() with netdev_*()
- Merged broken string
Signed-off-by: Mateusz Kulikowski <mateusz.kulikowski@...il.com>
---
Notes:
v2 changes - removed double messages (via netdev_info and RTLLIB_DEBUG_WX)
drivers/staging/rtl8192e/rtllib_wx.c | 33 ++++++++++++---------------------
1 file changed, 12 insertions(+), 21 deletions(-)
diff --git a/drivers/staging/rtl8192e/rtllib_wx.c b/drivers/staging/rtl8192e/rtllib_wx.c
index 9e0f975..72818f3 100644
--- a/drivers/staging/rtl8192e/rtllib_wx.c
+++ b/drivers/staging/rtl8192e/rtllib_wx.c
@@ -74,7 +74,7 @@ static inline char *rtl819x_translate_scan(struct rtllib_device *ieee,
iwe.cmd = SIOCGIWESSID;
iwe.u.data.flags = 1;
if (network->ssid_len > 0) {
- iwe.u.data.length = min(network->ssid_len, (u8)32);
+ iwe.u.data.length = min_t(u8, network->ssid_len, 32);
start = iwe_stream_add_point_rsl(info, start, stop, &iwe,
network->ssid);
} else if (network->hidden_ssid_len == 0) {
@@ -82,7 +82,7 @@ static inline char *rtl819x_translate_scan(struct rtllib_device *ieee,
start = iwe_stream_add_point_rsl(info, start, stop,
&iwe, "<hidden>");
} else {
- iwe.u.data.length = min(network->hidden_ssid_len, (u8)32);
+ iwe.u.data.length = min_t(u8, network->hidden_ssid_len, 32);
start = iwe_stream_add_point_rsl(info, start, stop, &iwe,
network->hidden_ssid);
}
@@ -390,9 +390,7 @@ int rtllib_wx_set_encode(struct rtllib_device *ieee,
kfree(new_crypt);
new_crypt = NULL;
- printk(KERN_WARNING "%s: could not initialize WEP: "
- "load module rtllib_crypt_wep\n",
- dev->name);
+ netdev_warn(dev, "could not initialize WEP: load module rtllib_crypt_wep\n");
return -EOPNOTSUPP;
}
*crypt = new_crypt;
@@ -423,11 +421,7 @@ int rtllib_wx_set_encode(struct rtllib_device *ieee,
NULL, (*crypt)->priv);
if (len == 0) {
/* Set a default key of all 0 */
- printk(KERN_INFO "Setting key %d to all zero.\n",
- key);
-
- RTLLIB_DEBUG_WX("Setting key %d to all zero.\n",
- key);
+ netdev_info(dev, "Setting key %d to all zero.\n", key);
memset(sec.keys[key], 0, 13);
(*crypt)->ops->set_key(sec.keys[key], 13, NULL,
(*crypt)->priv);
@@ -437,8 +431,8 @@ int rtllib_wx_set_encode(struct rtllib_device *ieee,
/* No key data - just set the default TX key index */
if (key_provided) {
- RTLLIB_DEBUG_WX(
- "Setting key %d to default Tx key.\n", key);
+ RTLLIB_DEBUG_WX("Setting key %d to default Tx key.\n",
+ key);
ieee->crypt_info.tx_keyidx = key;
sec.active_key = key;
sec.flags |= SEC_ACTIVE_KEY;
@@ -469,7 +463,7 @@ int rtllib_wx_set_encode(struct rtllib_device *ieee,
if (ieee->reset_on_keychange &&
ieee->iw_mode != IW_MODE_INFRA &&
ieee->reset_port && ieee->reset_port(dev)) {
- printk(KERN_DEBUG "%s: reset_port failed\n", dev->name);
+ netdev_dbg(dev, "reset_port failed\n");
return -EINVAL;
}
return 0;
@@ -596,7 +590,7 @@ int rtllib_wx_set_encode_ext(struct rtllib_device *ieee,
ret = -EINVAL;
goto done;
}
- printk(KERN_INFO "alg name:%s\n", alg);
+ netdev_info(dev, "alg name:%s\n", alg);
ops = lib80211_get_crypto_ops(alg);
if (ops == NULL) {
@@ -608,9 +602,7 @@ int rtllib_wx_set_encode_ext(struct rtllib_device *ieee,
ops = lib80211_get_crypto_ops(alg);
}
if (ops == NULL) {
- RTLLIB_DEBUG_WX("%s: unknown crypto alg %d\n",
- dev->name, ext->alg);
- printk(KERN_INFO "========>unknown crypto alg %d\n", ext->alg);
+ netdev_info(dev, "unknown crypto alg %d\n", ext->alg);
ret = -EINVAL;
goto done;
}
@@ -641,8 +633,7 @@ int rtllib_wx_set_encode_ext(struct rtllib_device *ieee,
if (ext->key_len > 0 && (*crypt)->ops->set_key &&
(*crypt)->ops->set_key(ext->key, ext->key_len, ext->rx_seq,
(*crypt)->priv) < 0) {
- RTLLIB_DEBUG_WX("%s: key setting failed\n", dev->name);
- printk(KERN_INFO "key setting failed\n");
+ netdev_info(dev, "key setting failed\n");
ret = -EINVAL;
goto done;
}
@@ -759,9 +750,9 @@ int rtllib_wx_set_mlme(struct rtllib_device *ieee,
case IW_MLME_DISASSOC:
if (deauth)
- printk(KERN_INFO "disauth packet !\n");
+ netdev_warn(ieee->dev, "disauth packet !\n");
else
- printk(KERN_INFO "dis associate packet!\n");
+ netdev_warn(ieee->dev, "dis associate packet!\n");
ieee->cannot_notify = true;
--
1.8.4.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists