summaryrefslogtreecommitdiff
path: root/drivers/staging/vt6656
diff options
context:
space:
mode:
authorOscar Carter <oscar.carter@gmx.com>2020-04-25 17:17:47 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-04-28 14:26:29 +0200
commit10b674be0a0c8a2a819c69786b07e76ab141e7c0 (patch)
tree83840f4b6d7052165be5cd3ff460c306c723422e /drivers/staging/vt6656
parentd78b62c3eaf257dfb114f579c797a4777e3f45d4 (diff)
staging: vt6656: Remove duplicate code in vnt_rf_table_download
Replace three while loops with three calls to the vnt_control_out_blocks function. This way avoid repeat a functionality that already exists. Also remove the variables that now are not used. Signed-off-by: Oscar Carter <oscar.carter@gmx.com> Link: https://lore.kernel.org/r/20200425151747.8199-4-oscar.carter@gmx.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/vt6656')
-rw-r--r--drivers/staging/vt6656/rf.c65
1 files changed, 12 insertions, 53 deletions
diff --git a/drivers/staging/vt6656/rf.c b/drivers/staging/vt6656/rf.c
index 278845366e6f..f18d456a8f5d 100644
--- a/drivers/staging/vt6656/rf.c
+++ b/drivers/staging/vt6656/rf.c
@@ -762,7 +762,6 @@ int vnt_rf_table_download(struct vnt_private *priv)
int ret;
u16 length1 = 0, length2 = 0, length3 = 0;
u8 *addr1 = NULL, *addr2 = NULL, *addr3 = NULL;
- u16 length, value;
switch (priv->rf_type) {
case RF_AL2230:
@@ -815,40 +814,14 @@ int vnt_rf_table_download(struct vnt_private *priv)
return ret;
/* Channel Table 0 */
- value = 0;
- while (length2 > 0) {
- if (length2 >= 64)
- length = 64;
- else
- length = length2;
-
- ret = vnt_control_out(priv, MESSAGE_TYPE_WRITE, value,
- MESSAGE_REQUEST_RF_CH0, length, addr2);
- if (ret)
- return ret;
-
- length2 -= length;
- value += length;
- addr2 += length;
- }
-
- /* Channel table 1 */
- value = 0;
- while (length3 > 0) {
- if (length3 >= 64)
- length = 64;
- else
- length = length3;
-
- ret = vnt_control_out(priv, MESSAGE_TYPE_WRITE, value,
- MESSAGE_REQUEST_RF_CH1, length, addr3);
- if (ret)
- return ret;
+ ret = vnt_control_out_blocks(priv, VNT_REG_BLOCK_SIZE,
+ MESSAGE_REQUEST_RF_CH0, length2, addr2);
+ if (ret)
+ return ret;
- length3 -= length;
- value += length;
- addr3 += length;
- }
+ /* Channel Table 1 */
+ ret = vnt_control_out_blocks(priv, VNT_REG_BLOCK_SIZE,
+ MESSAGE_REQUEST_RF_CH1, length3, addr3);
if (priv->rf_type == RF_AIROHA7230) {
length1 = CB_AL7230_INIT_SEQ * 3;
@@ -862,25 +835,11 @@ int vnt_rf_table_download(struct vnt_private *priv)
if (ret)
return ret;
- /* Channel Table 0 */
- value = 0;
- while (length2 > 0) {
- if (length2 >= 64)
- length = 64;
- else
- length = length2;
-
- ret = vnt_control_out(priv, MESSAGE_TYPE_WRITE, value,
- MESSAGE_REQUEST_RF_CH2, length,
- addr2);
- if (ret)
- return ret;
-
- length2 -= length;
- value += length;
- addr2 += length;
- }
+ /* Channel Table 2 */
+ ret = vnt_control_out_blocks(priv, VNT_REG_BLOCK_SIZE,
+ MESSAGE_REQUEST_RF_CH2, length2,
+ addr2);
}
- return 0;
+ return ret;
}