2017-03-18 09:26:54

by Suniel Mahesh

[permalink] [raw]
Subject: [PATCH v5 0/6] staging: rtl8192e: Fix coding style, warnings and checks

From: Suniel Mahesh <[email protected]>

Changed email address from [email protected] to [email protected],
reason being few patches were being dropped and not getting delivered,
couldn't resolve that issue.
Split earlier patches into multiple commits for easy review as
suggested by Dan Carpenter.
Modified subject, description and in few patches both for
better readability as suggested by Greg KH.
Dropped two patches from the earler series, as they were not adding
significant value, suggested by Dan Carpenter.
Fixed the following issues reported by checkpatch.pl:
Block comments should align the * on each line, aligned.
Block comments use * on subsequent lines, other characters
are replaced by * .
Removed unnecessary 'out of memory' message.
Comparison's to NULL could be written '!foo' or 'foo', modified.
Replaced sizeof(struct foo) into sizeof(*ptr).
Spaces preferred around that 'operator', spacing provided.
Logical continuations should be on the previous line, modified accordingly.
Unnecessary parentheses around variables, removed.
Please use a blank line after function/struct/union/enum declarations, used.
Blank lines aren't necessary after an open brace '{' and before a
close brace '}', removed.
No space is necessary after a cast, removed.
Please don't use multiple blank lines, removed.

Rebased on top of next-20170310.
Patches were tested and built on next-20170310 and staging-testing
as suggested by Greg K-H, no errors reported.

Suniel Mahesh (6):
staging: rtl8192e: Fix comments as per kernel coding style
staging: rtl8192e: Remove unnecessary 'out of memory' message
staging: rtl8192e: Rectify pointer comparisions with NULL
staging: rtl8192e: Pass a pointer as an argument to sizeof() instead
of struct
staging: rtl8192e: Fix issues reported by checkpatch.pl
staging: rtl8192e: Fix blank lines and space after a cast

drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 141 ++++++++++-----------------
1 file changed, 50 insertions(+), 91 deletions(-)

--
1.9.1


2017-03-18 08:06:37

by Suniel Mahesh

[permalink] [raw]
Subject: [PATCH v5 4/6] staging: rtl8192e: Pass a pointer as an argument to sizeof() instead of struct

From: Suniel Mahesh <[email protected]>

Replaced sizeof(struct foo) into sizeof(*ptr), found by checkpatch.pl

Signed-off-by: Suniel Mahesh <[email protected]>
---
Changes for v5:

- Changed email address from [email protected] to [email protected],
reason being few patches were being dropped and not getting delivered,
couldn't resolve that issue
- Resending the whole series as requested by Greg K-H
- Patches were tested and built on next-20170310 and staging-testing

Changes for v4:

- Dropped two patches from the series, as they were not adding significant value
suggested by Dan Carpenter.
staging: rtl8192e: Fix coding style, this was fixing line over 80 characters.
staging: rtl8192e: Fix unbalanced braces
- Resending the whole series as requested by Greg K-H
- Patches were tested and built on next-20170310 and staging-testing

Changes for v3:

- Split earlier patches into multiple commits for easy review
as suggested by Greg K-H
- Modified description for better readability
- Rebased on top of next-20170310
- Patches were tested and built on next-20170310 and staging-testing
as suggested by Greg K-H, no errors reported

Changes for v2:

- new patch addition to the series
- Rebased on top of next-20170306
---
drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
index 4f4cd07..999af05 100644
--- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
+++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
@@ -969,7 +969,7 @@ static void _rtl92e_init_priv_variable(struct net_device *dev)

priv->card_type = PCI;

- priv->pFirmware = vzalloc(sizeof(struct rt_firmware));
+ priv->pFirmware = vzalloc(sizeof(*priv->pFirmware));
if (!priv->pFirmware)
return;

--
1.9.1

2017-03-18 08:08:58

by Suniel Mahesh

[permalink] [raw]
Subject: [PATCH v5 3/6] staging: rtl8192e: Rectify pointer comparisions with NULL

From: Suniel Mahesh <[email protected]>

This patch simplifies code by replacing explicit NULL comparison
with ! or unmark operator
Reported by checkpatch.pl for comparison to NULL could be
written '!foo' or 'foo'

Signed-off-by: Suniel Mahesh <[email protected]>
---
Changes for v5:

- Changed email address from [email protected] to [email protected],
reason being few patches were being dropped and not getting delivered,
couldn't resolve that issue
- Resending the whole series as requested by Greg K-H
- Patches were tested and built on next-20170310 and staging-testing

Changes for v4:

- Dropped two patches from the series, as they were not adding significant value
suggested by Dan Carpenter.
staging: rtl8192e: Fix coding style, this was fixing line over 80 characters.
staging: rtl8192e: Fix unbalanced braces
- Resending the whole series as requested by Greg K-H
- Patches were tested and built on next-20170310 and staging-testing

Changes for v3:

- Split earlier patches into multiple commits for easy review
as suggested by Greg K-H
- Modified description for better readability
- Rebased on top of next-20170310
- Patches were tested and built on next-20170310 and staging-testing
as suggested by Greg K-H, no errors reported

Changes for v2:

- Rectify pointer comparisions reported by checkpatch.pl in rtl_core.c
- new patch addition to the series
- Rebased on top of next-20170306
---
drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
index f00ee3b..4f4cd07 100644
--- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
+++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
@@ -472,7 +472,7 @@ static int _rtl92e_qos_assoc_resp(struct r8192_priv *priv,
u32 size = sizeof(struct rtllib_qos_parameters);
int set_qos_param = 0;

- if ((priv == NULL) || (network == NULL))
+ if (!priv || !network)
return 0;

if (priv->rtllib->state != RTLLIB_LINKED)
@@ -785,7 +785,7 @@ static int _rtl92e_sta_down(struct net_device *dev, bool shutdownrf)
if (priv->up == 0)
return -1;

- if (priv->rtllib->rtllib_ips_leave != NULL)
+ if (priv->rtllib->rtllib_ips_leave)
priv->rtllib->rtllib_ips_leave(dev);

if (priv->rtllib->state == RTLLIB_LINKED)
--
1.9.1

2017-03-18 08:09:17

by Suniel Mahesh

[permalink] [raw]
Subject: [PATCH v5 1/6] staging: rtl8192e: Fix comments as per kernel coding style

From: Suniel Mahesh <[email protected]>

Fixed the following checkpatch.pl warnings:
Block comments should align the * on each line
Block comments use * on subsequent lines

Signed-off-by: Suniel Mahesh <[email protected]>
---
Changes for v5:

- Changed email address from [email protected] to [email protected],
reason being few patches were being dropped and not getting delivered,
couldn't resolve that issue
- Resending the whole series as requested by Greg K-H
- Patches were tested and built on next-20170310 and staging-testing

Changes for v4:

- Dropped two patches from the series, as they were not adding significant value
suggested by Dan Carpenter.
staging: rtl8192e: Fix coding style, this was fixing line over 80 characters.
staging: rtl8192e: Fix unbalanced braces
- Resending the whole series as requested by Greg K-H
- Patches were tested and built on next-20170310 and staging-testing

Changes for v3:

- Split earlier patches into multiple commits for easy review
as suggested by Greg K-H
- Modified subject and description for better readability
- Rebased on top of next-20170310
- Patches were tested and built on next-20170310 and staging-testing
as suggested by Greg K-H, no errors reported

Changes for v2:

- Split larger patch into multiple commits as suggested
by Dan Carpenter
- This patch fixes coding style issues, comments in rtl_core.c
reported by checkpatch.pl
- Modified short description to 'Fix coding style issues' from
'Fix coding style issues, improve error handling'
- Improve error handling is taken care by the following patch
in the series
- Removed statements, 'Return -ENOMEM, if it is out of memory',
'Pointer comparison with NULL replaced by logical NOT' from the
body of the patch
- Rebased on top of next-20170306
---
drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 61 ++++++++++------------------
1 file changed, 22 insertions(+), 39 deletions(-)

diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
index 4c0caa6..a648064 100644
--- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
+++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
@@ -1,4 +1,4 @@
-/******************************************************************************
+/*
* Copyright(c) 2008 - 2010 Realtek Corporation. All rights reserved.
*
* Based on the r8180 driver, which is:
@@ -17,7 +17,7 @@
*
* Contact Information:
* wlanfae <[email protected]>
-******************************************************************************/
+ */
#include <linux/uaccess.h>
#include <linux/pci.h>
#include <linux/vmalloc.h>
@@ -75,12 +75,12 @@ static int _rtl92e_pci_probe(struct pci_dev *pdev,
static irqreturn_t _rtl92e_irq(int irq, void *netdev);

static struct pci_driver rtl8192_pci_driver = {
- .name = DRV_NAME, /* Driver name */
- .id_table = rtl8192_pci_id_tbl, /* PCI_ID table */
- .probe = _rtl92e_pci_probe, /* probe fn */
- .remove = _rtl92e_pci_disconnect, /* remove fn */
- .suspend = rtl92e_suspend, /* PM suspend fn */
- .resume = rtl92e_resume, /* PM resume fn */
+ .name = DRV_NAME,
+ .id_table = rtl8192_pci_id_tbl,
+ .probe = _rtl92e_pci_probe,
+ .remove = _rtl92e_pci_disconnect,
+ .suspend = rtl92e_suspend,
+ .resume = rtl92e_resume,
};

static short _rtl92e_is_tx_queue_empty(struct net_device *dev);
@@ -100,10 +100,7 @@ static void _rtl92e_hard_data_xmit(struct sk_buff *skb, struct net_device *dev,
static int _rtl92e_down(struct net_device *dev, bool shutdownrf);
static void _rtl92e_restart(void *data);

-/****************************************************************************
- -----------------------------IO STUFF-------------------------
-*****************************************************************************/
-
+/* IO STUFF */
u8 rtl92e_readb(struct net_device *dev, int x)
{
return 0xff & readb((u8 __iomem *)dev->mem_start + x);
@@ -140,9 +137,7 @@ void rtl92e_writew(struct net_device *dev, int x, u16 y)
udelay(20);
}

-/****************************************************************************
- -----------------------------GENERAL FUNCTION-------------------------
-*****************************************************************************/
+/* GENERAL FUNCTION */
bool rtl92e_set_rf_state(struct net_device *dev,
enum rt_rf_power_state StateToSet,
RT_RF_CHANGE_SOURCE ChangeSource)
@@ -978,7 +973,6 @@ static void _rtl92e_init_priv_variable(struct net_device *dev)
if (!priv->pFirmware)
netdev_err(dev,
"rtl8192e: Unable to allocate space for firmware\n");
-
skb_queue_head_init(&priv->skb_queue);

for (i = 0; i < MAX_QUEUE_SIZE; i++)
@@ -1101,9 +1095,7 @@ static short _rtl92e_init(struct net_device *dev)
return 0;
}

-/***************************************************************************
- -------------------------------WATCHDOG STUFF---------------------------
-***************************************************************************/
+/* WATCHDOG STUFF */
static short _rtl92e_is_tx_queue_empty(struct net_device *dev)
{
int i = 0;
@@ -1540,9 +1532,7 @@ static void _rtl92e_watchdog_timer_cb(unsigned long data)
msecs_to_jiffies(RTLLIB_WATCH_DOG_TIME));
}

-/****************************************************************************
- ---------------------------- NIC TX/RX STUFF---------------------------
-*****************************************************************************/
+/* NIC TX/RX STUFF */
void rtl92e_rx_enable(struct net_device *dev)
{
struct r8192_priv *priv = rtllib_priv(dev);
@@ -1982,6 +1972,7 @@ void rtl92e_update_rx_statistics(struct r8192_priv *priv,
weighting) / 6;
}

+/* QueryRxPwrPercentage */
u8 rtl92e_rx_db_to_percent(s8 antpower)
{
if ((antpower <= -100) || (antpower >= 20))
@@ -1991,7 +1982,7 @@ u8 rtl92e_rx_db_to_percent(s8 antpower)
else
return 100 + antpower;

-} /* QueryRxPwrPercentage */
+}

u8 rtl92e_evm_db_to_percent(s8 value)
{
@@ -2052,9 +2043,9 @@ static void _rtl92e_rx_normal(struct net_device *dev)
pdesc, skb))
goto done;
new_skb = dev_alloc_skb(priv->rxbuffersize);
- /* if allocation of new skb failed - drop current packet
- * and reuse skb
- */
+/* if allocation of new skb failed - drop current packet
+ * and reuse skb
+ */
if (unlikely(!new_skb))
goto done;

@@ -2066,7 +2057,7 @@ static void _rtl92e_rx_normal(struct net_device *dev)
skb_put(skb, pdesc->Length);
skb_reserve(skb, stats.RxDrvInfoSize +
stats.RxBufShift);
- skb_trim(skb, skb->len - 4/*sCrcLng*/);
+ skb_trim(skb, skb->len - 4/* sCrcLng */);
rtllib_hdr = (struct rtllib_hdr_1addr *)skb->data;
if (!is_multicast_ether_addr(rtllib_hdr->addr1)) {
/* unicast packet */
@@ -2155,9 +2146,7 @@ static void _rtl92e_irq_rx_tasklet(struct r8192_priv *priv)
rtl92e_readl(priv->rtllib->dev, INTA_MASK) | IMR_RDU);
}

-/****************************************************************************
- ---------------------------- NIC START/CLOSE STUFF---------------------------
-*****************************************************************************/
+/* NIC START/CLOSE STUFF */
static void _rtl92e_cancel_deferred_work(struct r8192_priv *priv)
{
cancel_delayed_work_sync(&priv->watch_dog_wq);
@@ -2532,11 +2521,7 @@ static irqreturn_t _rtl92e_irq(int irq, void *netdev)
return IRQ_HANDLED;
}

-
-
-/****************************************************************************
- ---------------------------- PCI_STUFF---------------------------
-*****************************************************************************/
+/* PCI_STUFF */
static const struct net_device_ops rtl8192_netdev_ops = {
.ndo_open = _rtl92e_open,
.ndo_stop = _rtl92e_close,
@@ -2620,7 +2605,7 @@ static int _rtl92e_pci_probe(struct pci_dev *pdev,
dev->mem_end = ioaddr + pci_resource_len(pdev, 0);

pci_read_config_byte(pdev, 0x08, &revision_id);
- /* If the revisionid is 0x10, the device uses rtl8192se. */
+ /* If the revisionid is 0x10, the device uses rtl8192se */
if (pdev->device == 0x8192 && revision_id == 0x10)
goto err_unmap;

@@ -2784,9 +2769,7 @@ void rtl92e_check_rfctrl_gpio_timer(unsigned long data)
msecs_to_jiffies(RTLLIB_WATCH_DOG_TIME));
}

-/***************************************************************************
- ------------------- module init / exit stubs ----------------
-****************************************************************************/
+/* module init / exit stubs */
MODULE_DESCRIPTION("Linux driver for Realtek RTL819x WiFi cards");
MODULE_AUTHOR(DRV_COPYRIGHT " " DRV_AUTHOR);
MODULE_VERSION(DRV_VERSION);
--
1.9.1

2017-03-18 08:51:53

by Suniel Mahesh

[permalink] [raw]
Subject: [PATCH v5 5/6] staging: rtl8192e: Fix issues reported by checkpatch.pl

From: Suniel Mahesh <[email protected]>

Fixed the following checkpatch.pl checks:
spaces preferred around that 'operator', spacing provided
Logical continuations should be on the previous line, modified accordingly
Unnecessary parentheses around variables, removed
Please use a blank line after function/struct/union/enum declarations, used

Signed-off-by: Suniel Mahesh <[email protected]>
---
Changes for v5:

- Changed email address from [email protected] to [email protected],
reason being few patches were being dropped and not getting delivered,
couldn't resolve that issue
- Resending the whole series as requested by Greg K-H
- Patches were tested and built on next-20170310 and staging-testing

Changes for v4:

- Dropped two patches from the series, as they were not adding significant value
suggested by Dan Carpenter.
staging: rtl8192e: Fix coding style, this was fixing line over 80 characters.
staging: rtl8192e: Fix unbalanced braces
- Resending the whole series as requested by Greg K-H
- Patches were tested and built on next-20170310 and staging-testing

Changes for v3:

- Split earlier patches into multiple commits for easy review
as suggested by Greg K-H
- New patch addition to the series
- Rebased on top of next-20170310
- Patches were tested and built on next-20170310 and staging-testing
as suggested by Greg K-H, no errors reported

Changes for v2:
---
drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 46 +++++++++++++++-------------
1 file changed, 24 insertions(+), 22 deletions(-)

diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
index 999af05..1d22f18 100644
--- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
+++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
@@ -341,7 +341,7 @@ static void _rtl92e_update_cap(struct net_device *dev, u16 cap)
}
}

- if (net->mode & (IEEE_G|IEEE_N_24G)) {
+ if (net->mode & (IEEE_G | IEEE_N_24G)) {
u8 slot_time_val;
u8 CurSlotTime = priv->slot_time;

@@ -675,7 +675,7 @@ static u8 _rtl92e_get_supported_wireless_mode(struct net_device *dev)
case RF_8256:
case RF_6052:
case RF_PSEUDO_11N:
- ret = (WIRELESS_MODE_N_24G|WIRELESS_MODE_G | WIRELESS_MODE_B);
+ ret = (WIRELESS_MODE_N_24G | WIRELESS_MODE_G | WIRELESS_MODE_B);
break;
case RF_8258:
ret = (WIRELESS_MODE_A | WIRELESS_MODE_N_5G);
@@ -737,7 +737,7 @@ static int _rtl92e_sta_up(struct net_device *dev, bool is_silent_reset)
{
struct r8192_priv *priv = rtllib_priv(dev);
struct rt_pwr_save_ctrl *pPSC = (struct rt_pwr_save_ctrl *)
- (&(priv->rtllib->PowerSaveControl));
+ (&priv->rtllib->PowerSaveControl);
bool init_status = true;

priv->bDriverIsGoingToUnload = false;
@@ -883,7 +883,7 @@ static void _rtl92e_init_priv_constant(struct net_device *dev)
{
struct r8192_priv *priv = rtllib_priv(dev);
struct rt_pwr_save_ctrl *pPSC = (struct rt_pwr_save_ctrl *)
- &(priv->rtllib->PowerSaveControl);
+ &priv->rtllib->PowerSaveControl;

pPSC->RegMaxLPSAwakeIntvl = 5;
}
@@ -1009,9 +1009,9 @@ static void _rtl92e_init_priv_task(struct net_device *dev)
(void *)_rtl92e_update_beacon, dev);
INIT_WORK_RSL(&priv->qos_activate, (void *)_rtl92e_qos_activate, dev);
INIT_DELAYED_WORK_RSL(&priv->rtllib->hw_wakeup_wq,
- (void *) rtl92e_hw_wakeup_wq, dev);
+ (void *)rtl92e_hw_wakeup_wq, dev);
INIT_DELAYED_WORK_RSL(&priv->rtllib->hw_sleep_wq,
- (void *) rtl92e_hw_sleep_wq, dev);
+ (void *)rtl92e_hw_sleep_wq, dev);
tasklet_init(&priv->irq_rx_tasklet,
(void(*)(unsigned long))_rtl92e_irq_rx_tasklet,
(unsigned long)priv);
@@ -1029,8 +1029,8 @@ static short _rtl92e_get_channel_map(struct net_device *dev)

struct r8192_priv *priv = rtllib_priv(dev);

- if ((priv->rf_chip != RF_8225) && (priv->rf_chip != RF_8256)
- && (priv->rf_chip != RF_6052)) {
+ if ((priv->rf_chip != RF_8225) && (priv->rf_chip != RF_8256) &&
+ (priv->rf_chip != RF_6052)) {
netdev_err(dev, "%s: unknown rf chip, can't set channel map\n",
__func__);
return -1;
@@ -1056,7 +1056,7 @@ static short _rtl92e_init(struct net_device *dev)
{
struct r8192_priv *priv = rtllib_priv(dev);

- memset(&(priv->stats), 0, sizeof(struct rt_stats));
+ memset(&priv->stats, 0, sizeof(struct rt_stats));

_rtl92e_init_priv_handler(dev);
_rtl92e_init_priv_constant(dev);
@@ -1071,7 +1071,7 @@ static short _rtl92e_init(struct net_device *dev)

setup_timer(&priv->watch_dog_timer,
_rtl92e_watchdog_timer_cb,
- (unsigned long) dev);
+ (unsigned long)dev);

setup_timer(&priv->gpio_polling_timer,
rtl92e_check_rfctrl_gpio_timer,
@@ -1126,7 +1126,7 @@ static enum reset_type _rtl92e_tx_check_stuck(struct net_device *dev)
switch (priv->rtllib->ps) {
case RTLLIB_PS_DISABLED:
break;
- case (RTLLIB_PS_MBCAST|RTLLIB_PS_UNICAST):
+ case (RTLLIB_PS_MBCAST | RTLLIB_PS_UNICAST):
break;
default:
break;
@@ -1379,7 +1379,7 @@ static void _rtl92e_watchdog_wq_cb(void *data)
static u8 check_reset_cnt;
unsigned long flags;
struct rt_pwr_save_ctrl *pPSC = (struct rt_pwr_save_ctrl *)
- (&(priv->rtllib->PowerSaveControl));
+ (&priv->rtllib->PowerSaveControl);
bool bBusyTraffic = false;
bool bHigherBusyTraffic = false;
bool bHigherBusyRxTraffic = false;
@@ -1461,7 +1461,7 @@ static void _rtl92e_watchdog_wq_cb(void *data)

_rtl92e_update_rxcounts(priv, &TotalRxBcnNum, &TotalRxDataNum);

- if ((TotalRxBcnNum+TotalRxDataNum) == 0)
+ if ((TotalRxBcnNum + TotalRxDataNum) == 0)
priv->check_roaming_cnt++;
else
priv->check_roaming_cnt = 0;
@@ -1489,7 +1489,7 @@ static void _rtl92e_watchdog_wq_cb(void *data)
notify_wx_assoc_event(ieee);

if (!(ieee->rtllib_ap_sec_type(ieee) &
- (SEC_ALG_CCMP|SEC_ALG_TKIP)))
+ (SEC_ALG_CCMP | SEC_ALG_TKIP)))
schedule_delayed_work(
&ieee->associate_procedure_wq, 0);

@@ -1593,7 +1593,7 @@ static void _rtl92e_free_tx_ring(struct net_device *dev, unsigned int prio)
ring->idx = (ring->idx + 1) % ring->entries;
}

- pci_free_consistent(priv->pdev, sizeof(*ring->desc)*ring->entries,
+ pci_free_consistent(priv->pdev, sizeof(*ring->desc) * ring->entries,
ring->desc, ring->dma);
ring->desc = NULL;
}
@@ -1702,7 +1702,7 @@ static void _rtl92e_tx_cmd(struct net_device *dev, struct sk_buff *skb)
ring = &priv->tx_ring[TXCMD_QUEUE];

idx = (ring->idx + skb_queue_len(&ring->queue)) % ring->entries;
- entry = (struct tx_desc_cmd *) &ring->desc[idx];
+ entry = (struct tx_desc_cmd *)&ring->desc[idx];

tcb_desc = (struct cb_desc *)(skb->cb + MAX_DEV_ADDR_SIZE);

@@ -2022,7 +2022,7 @@ static void _rtl92e_rx_normal(struct net_device *dev)

struct rtllib_rx_stats stats = {
.signal = 0,
- .noise = (u8) -98,
+ .noise = (u8)-98,
.rate = 0,
.freq = RTLLIB_24GHZ_BAND,
};
@@ -2095,7 +2095,7 @@ static void _rtl92e_rx_normal(struct net_device *dev)

priv->rx_buf[rx_queue_idx][priv->rx_idx[rx_queue_idx]] =
skb;
- *((dma_addr_t *) skb->cb) = pci_map_single(priv->pdev,
+ *((dma_addr_t *)skb->cb) = pci_map_single(priv->pdev,
skb_tail_pointer_rsl(skb),
priv->rxbuffersize,
PCI_DMA_FROMDEVICE);
@@ -2108,7 +2108,7 @@ static void _rtl92e_rx_normal(struct net_device *dev)
pdesc->BufferAddress = *((dma_addr_t *)skb->cb);
pdesc->OWN = 1;
pdesc->Length = priv->rxbuffersize;
- if (priv->rx_idx[rx_queue_idx] == priv->rxringcount-1)
+ if (priv->rx_idx[rx_queue_idx] == priv->rxringcount - 1)
pdesc->EOR = 1;
priv->rx_idx[rx_queue_idx] = (priv->rx_idx[rx_queue_idx] + 1) %
priv->rxringcount;
@@ -2337,8 +2337,9 @@ static int _rtl92e_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
0, key);
}
}
- if ((ieee->pairwise_key_type == KEY_TYPE_CCMP)
- && ieee->pHTInfo->bCurrentHTSupport) {
+ if ((ieee->pairwise_key_type ==
+ KEY_TYPE_CCMP) &&
+ ieee->pHTInfo->bCurrentHTSupport) {
rtl92e_writeb(dev, 0x173, 1);
}

@@ -2711,7 +2712,7 @@ bool rtl92e_enable_nic(struct net_device *dev)
bool init_status = true;
struct r8192_priv *priv = rtllib_priv(dev);
struct rt_pwr_save_ctrl *pPSC = (struct rt_pwr_save_ctrl *)
- (&(priv->rtllib->PowerSaveControl));
+ (&priv->rtllib->PowerSaveControl);

if (!priv->up) {
netdev_warn(dev, "%s(): Driver is already down!\n", __func__);
@@ -2736,6 +2737,7 @@ bool rtl92e_enable_nic(struct net_device *dev)
RT_TRACE(COMP_PS, "<===========%s()\n", __func__);
return init_status;
}
+
bool rtl92e_disable_nic(struct net_device *dev)
{
struct r8192_priv *priv = rtllib_priv(dev);
--
1.9.1

2017-03-18 10:43:23

by Suniel Mahesh

[permalink] [raw]
Subject: [PATCH v5 6/6] staging: rtl8192e: Fix blank lines and space after a cast

From: Suniel Mahesh <[email protected]>

Fixed the following checkpatch.pl checks:
Blank lines aren't necessary after an open brace '{'
and before a close brace '}', removed
No space is necessary after a cast, removed
Please don't use multiple blank lines, removed

Signed-off-by: Suniel Mahesh <[email protected]>
---
Changes for v5:

- Changed email address from [email protected] to [email protected],
reason being few patches were being dropped and not getting delivered,
couldn't resolve that issue
- Resending the whole series as requested by Greg K-H
- Patches were tested and built on next-20170310 and staging-testing

Changes for v4:

- Dropped two patches from the series, as they were not adding significant value
suggested by Dan Carpenter.
staging: rtl8192e: Fix coding style, this was fixing line over 80 characters.
staging: rtl8192e: Fix unbalanced braces
- Resending the whole series as requested by Greg K-H
- Patches were tested and built on next-20170310 and staging-testing

Changes for v3:

- Split earlier patches into multiple commits for easy review
as suggested by Greg K-H
- New patch addition to the series
- Rebased on top of next-20170310
- Patches were tested and built on next-20170310 and staging-testing
as suggested by Greg K-H, no errors reported

Changes for v2:
---
drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 26 --------------------------
1 file changed, 26 deletions(-)

diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
index 1d22f18..bc2c732 100644
--- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
+++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
@@ -37,7 +37,6 @@
static int channels = 0x3fff;
static char *ifname = "wlan%d";

-
static const struct rtl819x_ops rtl819xp_ops = {
.nic_type = NIC_8192E,
.get_eeprom_size = rtl92e_get_eeprom_size,
@@ -195,7 +194,6 @@ bool rtl92e_set_rf_state(struct net_device *dev,
priv->rtllib->RfOffReason = 0;
bActionAllowed = true;

-
if (rtState == eRfOff &&
ChangeSource >= RF_CHANGE_BY_HW)
bConnectBySSID = true;
@@ -242,7 +240,6 @@ bool rtl92e_set_rf_state(struct net_device *dev,
StateToSet, priv->rtllib->RfOffReason);
PHY_SetRFPowerState(dev, StateToSet);
if (StateToSet == eRfOn) {
-
if (bConnectBySSID && priv->blinked_ingpio) {
schedule_delayed_work(
&ieee->associate_procedure_wq, 0);
@@ -401,8 +398,6 @@ static void _rtl92e_qos_activate(void *data)

for (i = 0; i < QOS_QUEUE_NUM; i++)
priv->rtllib->SetHwRegHandler(dev, HW_VAR_AC_PARAM, (u8 *)(&i));
-
-
success:
mutex_unlock(&priv->mutex);
}
@@ -462,7 +457,6 @@ static int _rtl92e_handle_beacon(struct net_device *dev,

schedule_delayed_work(&priv->update_beacon_wq, 0);
return 0;
-
}

static int _rtl92e_qos_assoc_resp(struct r8192_priv *priv,
@@ -888,7 +882,6 @@ static void _rtl92e_init_priv_constant(struct net_device *dev)
pPSC->RegMaxLPSAwakeIntvl = 5;
}

-
static void _rtl92e_init_priv_variable(struct net_device *dev)
{
struct r8192_priv *priv = rtllib_priv(dev);
@@ -1211,7 +1204,6 @@ static enum reset_type _rtl92e_if_check_reset(struct net_device *dev)
} else {
return RESET_TYPE_NORESET;
}
-
}

static void _rtl92e_if_silent_reset(struct net_device *dev)
@@ -1223,7 +1215,6 @@ static void _rtl92e_if_silent_reset(struct net_device *dev)
unsigned long flag;

if (priv->ResetProgress == RESET_TYPE_NORESET) {
-
RT_TRACE(COMP_RESET, "=========>Reset progress!!\n");

priv->ResetProgress = RESET_TYPE_SILENT;
@@ -1417,7 +1408,6 @@ static void _rtl92e_watchdog_wq_cb(void *data)
ieee->LinkDetectInfo.NumTxOkInPeriod > 100)
bBusyTraffic = true;

-
if (ieee->LinkDetectInfo.NumRxOkInPeriod > 4000 ||
ieee->LinkDetectInfo.NumTxOkInPeriod > 4000) {
bHigherBusyTraffic = true;
@@ -1466,7 +1456,6 @@ static void _rtl92e_watchdog_wq_cb(void *data)
else
priv->check_roaming_cnt = 0;

-
if (priv->check_roaming_cnt > 0) {
if (ieee->eRFPowerState == eRfOff)
netdev_info(dev, "%s(): RF is off\n", __func__);
@@ -1497,7 +1486,6 @@ static void _rtl92e_watchdog_wq_cb(void *data)
}
ieee->LinkDetectInfo.NumRecvBcnInPeriod = 0;
ieee->LinkDetectInfo.NumRecvDataInPeriod = 0;
-
}

spin_lock_irqsave(&priv->tx_lock, flags);
@@ -1549,7 +1537,6 @@ void rtl92e_tx_enable(struct net_device *dev)
rtllib_reset_queue(priv->rtllib);
}

-
static void _rtl92e_free_rx_ring(struct net_device *dev)
{
struct r8192_priv *priv = rtllib_priv(dev);
@@ -1951,13 +1938,11 @@ long rtl92e_translate_to_dbm(struct r8192_priv *priv, u8 signal_strength_index)
return signal_power;
}

-
void rtl92e_update_rx_statistics(struct r8192_priv *priv,
struct rtllib_rx_stats *pprevious_stats)
{
int weighting = 0;

-
if (priv->stats.recv_signal_power == 0)
priv->stats.recv_signal_power =
pprevious_stats->RecvSignalPower;
@@ -1981,7 +1966,6 @@ u8 rtl92e_rx_db_to_percent(s8 antpower)
return 100;
else
return 100 + antpower;
-
}

u8 rtl92e_evm_db_to_percent(s8 value)
@@ -2008,8 +1992,6 @@ void rtl92e_copy_mpdu_stats(struct rtllib_rx_stats *psrc_stats,
ptarget_stats->bFirstMPDU = psrc_stats->bFirstMPDU;
}

-
-
static void _rtl92e_rx_normal(struct net_device *dev)
{
struct r8192_priv *priv = rtllib_priv(dev);
@@ -2113,7 +2095,6 @@ static void _rtl92e_rx_normal(struct net_device *dev)
priv->rx_idx[rx_queue_idx] = (priv->rx_idx[rx_queue_idx] + 1) %
priv->rxringcount;
}
-
}

static void _rtl92e_tx_resume(struct net_device *dev)
@@ -2172,7 +2153,6 @@ static int _rtl92e_open(struct net_device *dev)
ret = _rtl92e_try_up(dev);
mutex_unlock(&priv->wx_mutex);
return ret;
-
}

static int _rtl92e_try_up(struct net_device *dev)
@@ -2184,7 +2164,6 @@ static int _rtl92e_try_up(struct net_device *dev)
return _rtl92e_up(dev, false);
}

-
static int _rtl92e_close(struct net_device *dev)
{
struct r8192_priv *priv = rtllib_priv(dev);
@@ -2202,7 +2181,6 @@ static int _rtl92e_close(struct net_device *dev)
mutex_unlock(&priv->wx_mutex);

return ret;
-
}

static int _rtl92e_down(struct net_device *dev, bool shutdownrf)
@@ -2245,10 +2223,8 @@ static void _rtl92e_set_multicast(struct net_device *dev)

promisc = (dev->flags & IFF_PROMISC) ? 1 : 0;
priv->promisc = promisc;
-
}

-
static int _rtl92e_set_mac_adr(struct net_device *dev, void *mac)
{
struct r8192_priv *priv = rtllib_priv(dev);
@@ -2388,7 +2364,6 @@ static int _rtl92e_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
return ret;
}

-
static irqreturn_t _rtl92e_irq(int irq, void *netdev)
{
struct net_device *dev = netdev;
@@ -2595,7 +2570,6 @@ static int _rtl92e_pci_probe(struct pci_dev *pdev,
goto err_rel_rtllib;
}

-
ioaddr = (unsigned long)ioremap_nocache(pmem_start, pmem_len);
if (ioaddr == (unsigned long)NULL) {
netdev_err(dev, "ioremap failed!");
--
1.9.1

2017-03-18 14:33:27

by Suniel Mahesh

[permalink] [raw]
Subject: [PATCH v5 2/6] staging: rtl8192e: Remove unnecessary 'out of memory' message

From: Suniel Mahesh <[email protected]>

Fixed the following checkpatch.pl warning:
Possible unnecessary 'out of memory' message
If it is out of memory, function should return with an
appropriate error code. Since this function is of type void,
a return statement is used.

Signed-off-by: Suniel Mahesh <[email protected]>
---
Changes for v5:

- Changed email address from [email protected] to [email protected],
reason being few patches were being dropped and not getting delivered,
couldn't resolve that issue
- Resending the whole series as requested by Greg K-H
- Patches were tested and built on next-20170310 and staging-testing

Changes for v4:

- Modified description for better readability as pointed out by
Dan Carpenter
- Dropped two patches from the series, as they were not adding significant value
suggested by Dan Carpenter.
staging: rtl8192e: Fix coding style, this was fixing line over 80 characters.
staging: rtl8192e: Fix unbalanced braces
- Resending the whole series as requested by Greg K-H
- Patches were tested and built on next-20170310 and staging-testing

Changes for v3:

- Split earlier patches into multiple commits for easy review
as suggested by Greg K-H
- Modified subject and description for better readability
- Rebased on top of next-20170310
- Patches were tested and built on next-20170310 and staging-testing
as suggested by Greg K-H, no errors reported

Changes for v2:

- Improve error handling reported by checkpatch.pl in rtl_core.c
- new patch addition to the series
- Rebased on top of next-20170306
---
drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
index a648064..f00ee3b 100644
--- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
+++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
@@ -971,8 +971,8 @@ static void _rtl92e_init_priv_variable(struct net_device *dev)

priv->pFirmware = vzalloc(sizeof(struct rt_firmware));
if (!priv->pFirmware)
- netdev_err(dev,
- "rtl8192e: Unable to allocate space for firmware\n");
+ return;
+
skb_queue_head_init(&priv->skb_queue);

for (i = 0; i < MAX_QUEUE_SIZE; i++)
--
1.9.1