linux/drivers/staging/rtl8192u
Xenia Ragiadakou b3d42bf187 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>
2013-06-06 11:57:16 -07:00
..
ieee80211 STAGING: rtl8192u: fix checkpatch error by adding space after switch 2013-05-13 07:17:58 -07:00
authors
changes staging/rtl8192u: cleanfile run 2013-01-07 12:52:58 -08:00
copying
dot11d.h
ieee80211_crypt.h
Kconfig
Makefile
r819xU_cmdpkt.c Staging: rtl8192u: fix a reversed test 2013-06-06 11:57:15 -07:00
r819xU_cmdpkt.h STAGING: rtl8192u: fix checkpatch error about pointer position in r819xU_cmdpkt 2013-05-13 07:11:47 -07:00
r819xU_firmware_img.c
r819xU_firmware_img.h
r819xU_firmware.c staging: rtl8192u: fix read_nic_* functions 2013-06-06 11:57:16 -07:00
r819xU_firmware.h staging/rtl8192u: cleanfile run 2013-01-07 12:52:58 -08:00
r819xU_HTGen.h staging/rtl8192u: cleanfile run 2013-01-07 12:52:58 -08:00
r819xU_HTType.h staging/rtl8192u: cleanfile run 2013-01-07 12:52:58 -08:00
r819xU_phy.c staging: rtl8192u: fix read_nic_* functions 2013-06-06 11:57:16 -07:00
r819xU_phy.h STAGING: rtl8192u: fix checkpatch error about pointer position in r819xU_phy 2013-05-13 07:11:48 -07:00
r819xU_phyreg.h staging/rtl8192u: cleanfile run 2013-01-07 12:52:58 -08:00
r8180_93cx6.c staging: rtl8192u: fix read_nic_* functions 2013-06-06 11:57:16 -07:00
r8180_93cx6.h staging: rtl8192u Fix a typo. 2012-05-01 21:50:09 -07:00
r8180_pm.c
r8180_pm.h staging/rtl8192u: indent with tabs, not spaces 2013-01-07 12:53:40 -08:00
r8190_rtl8256.c rtl8192u: remove whitespace after '(' and before ')' in r8190_rtl8256.c 2013-05-16 16:45:51 -07:00
r8190_rtl8256.h STAGING: rtl8192u: fix checkpatch error about pointer position in r8190_rtl8256 2013-05-13 07:11:48 -07:00
r8192U_core.c staging: rtl8192u: fix read_nic_* functions 2013-06-06 11:57:16 -07:00
r8192U_dm.c staging: rtl8192u: fix read_nic_* functions 2013-06-06 11:57:16 -07:00
r8192U_dm.h staging: rtl8192u: fix coding style 2013-03-28 16:07:25 -07:00
r8192U_hw.h staging: rtl8192u: fix read_nic_* functions 2013-06-06 11:57:16 -07:00
r8192U_wx.c staging: rtl8192u: fix read_nic_* functions 2013-06-06 11:57:16 -07:00
r8192U_wx.h staging: rtl8192u Fix a typo. 2012-05-01 21:50:09 -07:00
r8192U.h staging: rtl8192u: fix read_nic_* functions 2013-06-06 11:57:16 -07:00