Commit ddcb81e7 authored by Tapasweni Pathak's avatar Tapasweni Pathak Committed by Greg Kroah-Hartman

staging: rtl8712: merge lines and remove unused variable for immediate return

This patch merge two lines in a single line if immediate return is found.
Unused variables in each case were removed manually as they are no longer
needed.

This is done using Coccinelle. Semantic patch used for this is as
follows :
@@
expression ret;
identifier f;
@@

-ret =
+return
     f(...);
-return ret;
Signed-off-by: default avatarTapasweni Pathak <tapaswenipathak@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent a988265c
...@@ -39,11 +39,9 @@ u8 r8712_read8(struct _adapter *adapter, u32 addr) ...@@ -39,11 +39,9 @@ u8 r8712_read8(struct _adapter *adapter, u32 addr)
struct io_queue *pio_queue = (struct io_queue *)adapter->pio_queue; struct io_queue *pio_queue = (struct io_queue *)adapter->pio_queue;
struct intf_hdl *pintfhdl = &(pio_queue->intf); struct intf_hdl *pintfhdl = &(pio_queue->intf);
u8 (*_read8)(struct intf_hdl *pintfhdl, u32 addr); u8 (*_read8)(struct intf_hdl *pintfhdl, u32 addr);
u8 r_val;
_read8 = pintfhdl->io_ops._read8; _read8 = pintfhdl->io_ops._read8;
r_val = _read8(pintfhdl, addr); return _read8(pintfhdl, addr);
return r_val;
} }
u16 r8712_read16(struct _adapter *adapter, u32 addr) u16 r8712_read16(struct _adapter *adapter, u32 addr)
...@@ -51,11 +49,9 @@ u16 r8712_read16(struct _adapter *adapter, u32 addr) ...@@ -51,11 +49,9 @@ u16 r8712_read16(struct _adapter *adapter, u32 addr)
struct io_queue *pio_queue = (struct io_queue *)adapter->pio_queue; struct io_queue *pio_queue = (struct io_queue *)adapter->pio_queue;
struct intf_hdl *pintfhdl = &(pio_queue->intf); struct intf_hdl *pintfhdl = &(pio_queue->intf);
u16 (*_read16)(struct intf_hdl *pintfhdl, u32 addr); u16 (*_read16)(struct intf_hdl *pintfhdl, u32 addr);
u16 r_val;
_read16 = pintfhdl->io_ops._read16; _read16 = pintfhdl->io_ops._read16;
r_val = _read16(pintfhdl, addr); return _read16(pintfhdl, addr);
return r_val;
} }
u32 r8712_read32(struct _adapter *adapter, u32 addr) u32 r8712_read32(struct _adapter *adapter, u32 addr)
...@@ -63,11 +59,9 @@ u32 r8712_read32(struct _adapter *adapter, u32 addr) ...@@ -63,11 +59,9 @@ u32 r8712_read32(struct _adapter *adapter, u32 addr)
struct io_queue *pio_queue = (struct io_queue *)adapter->pio_queue; struct io_queue *pio_queue = (struct io_queue *)adapter->pio_queue;
struct intf_hdl *pintfhdl = &(pio_queue->intf); struct intf_hdl *pintfhdl = &(pio_queue->intf);
u32 (*_read32)(struct intf_hdl *pintfhdl, u32 addr); u32 (*_read32)(struct intf_hdl *pintfhdl, u32 addr);
u32 r_val;
_read32 = pintfhdl->io_ops._read32; _read32 = pintfhdl->io_ops._read32;
r_val = _read32(pintfhdl, addr); return _read32(pintfhdl, addr);
return r_val;
} }
void r8712_write8(struct _adapter *adapter, u32 addr, u8 val) void r8712_write8(struct _adapter *adapter, u32 addr, u8 val)
......
...@@ -186,14 +186,12 @@ u8 r8712_bb_reg_write(struct _adapter *pAdapter, u16 offset, u32 value) ...@@ -186,14 +186,12 @@ u8 r8712_bb_reg_write(struct _adapter *pAdapter, u16 offset, u32 value)
u32 r8712_rf_reg_read(struct _adapter *pAdapter, u8 path, u8 offset) u32 r8712_rf_reg_read(struct _adapter *pAdapter, u8 path, u8 offset)
{ {
u16 rf_addr = (path << 8) | offset; u16 rf_addr = (path << 8) | offset;
u32 rf_data;
struct IOCMD_STRUCT iocmd; struct IOCMD_STRUCT iocmd;
iocmd.cmdclass = IOCMD_CLASS_BB_RF; iocmd.cmdclass = IOCMD_CLASS_BB_RF;
iocmd.value = rf_addr; iocmd.value = rf_addr;
iocmd.index = IOCMD_RF_READ_IDX; iocmd.index = IOCMD_RF_READ_IDX;
rf_data = fw_iocmd_read(pAdapter, iocmd); return fw_iocmd_read(pAdapter, iocmd);
return rf_data;
} }
u8 r8712_rf_reg_write(struct _adapter *pAdapter, u8 path, u8 offset, u32 value) u8 r8712_rf_reg_write(struct _adapter *pAdapter, u8 path, u8 offset, u32 value)
...@@ -504,11 +502,8 @@ static void TriggerRFThermalMeter(struct _adapter *pAdapter) ...@@ -504,11 +502,8 @@ static void TriggerRFThermalMeter(struct _adapter *pAdapter)
static u32 ReadRFThermalMeter(struct _adapter *pAdapter) static u32 ReadRFThermalMeter(struct _adapter *pAdapter)
{ {
u32 ThermalValue = 0;
/* 0x24: RF Reg[4:0] */ /* 0x24: RF Reg[4:0] */
ThermalValue = get_rf_reg(pAdapter, RF_PATH_A, RF_T_METER, 0x1F); return get_rf_reg(pAdapter, RF_PATH_A, RF_T_METER, 0x1F);
return ThermalValue;
} }
void r8712_GetThermalMeter(struct _adapter *pAdapter, u32 *value) void r8712_GetThermalMeter(struct _adapter *pAdapter, u32 *value)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment