staging: vt6656: Refactor the vnt_rf_table_download function
authorOscar Carter <oscar.carter@gmx.com>
Wed, 29 Apr 2020 15:38:38 +0000 (17:38 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 5 May 2020 10:26:44 +0000 (12:26 +0200)
commitae220204873e2508fd8d7e5240a4d8aa45fe26e1
tree7a0bd124df51e6cc1eec46a5be9ff42a7e21510d
parent91387f5eb9fc22fe81bb09d6a97396da9d1e3967
staging: vt6656: Refactor the vnt_rf_table_download function

Create a constant array of struct vnt_table_info type elements with the
necessary info (address and length) about all the rf tables for every rf
type.

In every case of the "switch" statement replace the hardcoded info about
these tables with and index to the new constant array. Moreover, use
this array index to extract the necessary info in every call to the
vnt_control_out_* functions.

Check if this index has been set and return without error otherwise.
So, avoid the execution of code that previously did nothing due to
lengths with values of zero for some rf types.

Also remove all the variables that are now unused.

This way reduce the stack footprint, and make the code more clear.

Signed-off-by: Oscar Carter <oscar.carter@gmx.com>
Link: https://lore.kernel.org/r/20200429153838.7216-1-oscar.carter@gmx.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/vt6656/rf.c