aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging/rtl8192u/r819xU_firmware.c
diff options
context:
space:
mode:
authorXenia Ragiadakou <burzalodowa@gmail.com>2013-06-06 16:40:51 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-06-06 11:57:16 -0700
commitb3d42bf18784607b90b0661ac43f410713ff428b (patch)
treefb468c07ff06fc325fe9b076f62dd232ba21725a /drivers/staging/rtl8192u/r819xU_firmware.c
parentStaging: rtl8192u: fix a reversed test (diff)
downloadlinux-dev-b3d42bf18784607b90b0661ac43f410713ff428b.tar.xz
linux-dev-b3d42bf18784607b90b0661ac43f410713ff428b.zip
staging: rtl8192u: fix read_nic_* functions
read_nic_*() functions are defined in r8192U_core.c. They call internally usb_control_msg() to read the nic registers and return the value read. Following a remark made by Dan Carpenter, if usb_control_msg() fails, the value returned will be invalid. To accommodate for this, this patch changes the functions to take a pointer as argument to set the value read and return 0 on success and the error status on failure, so that callers of read_nic_*() can check the return status. Some other fixes introduced in read_nic_*() functions are: The expressions (1<<EPROM_*_SHIFT) used to address and set the individual bits of the eeprom register were replaced with EPROM_*_BIT bitmasks to make the code more intuitive. EPROM_*_BIT bitmasks were defined in r8192U_hw.h and EPROM_*_SHIFT were removed. In netdev_err(), which is called in case of failure, the hardcoded function name in the error log message was replaced with __func__ to reduce line size. Also, from the error log message, it was omitted the word "Timeout" and it is just reported the error code since the failure can not only be due to timeout expiration but also due to a memory allocation failure. In case of timeout expiration, usb_start_wait_urb() prints an appropriate log message when debug is enabled. Finally, some minor fixes to the coding style were applied in lines affected by the above changes, including the removal of ifdef DEBUG_RX (the debugging of reads and writes of the nic registers shall be done with explicit check on their return status which will be added in a follow on patch). Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/rtl8192u/r819xU_firmware.c')
-rw-r--r--drivers/staging/rtl8192u/r819xU_firmware.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/staging/rtl8192u/r819xU_firmware.c b/drivers/staging/rtl8192u/r819xU_firmware.c
index f8ace12786e7..bb924ac97e47 100644
--- a/drivers/staging/rtl8192u/r819xU_firmware.c
+++ b/drivers/staging/rtl8192u/r819xU_firmware.c
@@ -168,7 +168,7 @@ bool CPUcheck_maincodeok_turnonCPU(struct net_device *dev)
/* Check whether put code OK */
do {
- CPU_status = read_nic_dword(dev, CPU_GEN);
+ read_nic_dword(dev, CPU_GEN, &CPU_status);
if (CPU_status&CPU_GEN_PUT_CODE_OK)
break;
@@ -183,13 +183,13 @@ bool CPUcheck_maincodeok_turnonCPU(struct net_device *dev)
}
/* Turn On CPU */
- CPU_status = read_nic_dword(dev, CPU_GEN);
+ read_nic_dword(dev, CPU_GEN, &CPU_status);
write_nic_byte(dev, CPU_GEN, (u8)((CPU_status|CPU_GEN_PWR_STB_CPU)&0xff));
mdelay(1000);
/* Check whether CPU boot OK */
do {
- CPU_status = read_nic_dword(dev, CPU_GEN);
+ read_nic_dword(dev, CPU_GEN, &CPU_status);
if (CPU_status&CPU_GEN_BOOT_RDY)
break;
@@ -218,7 +218,7 @@ bool CPUcheck_firmware_ready(struct net_device *dev)
/* Check Firmware Ready */
do {
- CPU_status = read_nic_dword(dev, CPU_GEN);
+ read_nic_dword(dev, CPU_GEN, &CPU_status);
if (CPU_status&CPU_GEN_FIRM_RDY)
break;