summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Kepplinger <martink@posteo.de>2014-05-06 07:58:39 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-05-15 13:28:16 -0700
commitea9a8dae5acca2e2ac0421279de7818e92e4b251 (patch)
tree69379d83bdb2fa518c35c254d25f02249bcc98aa
parentbc5cf6563576bb36baa7e93417b9a2e29999a5c6 (diff)
staging: vt6656: make spin_lock_irq() human readable
Don't require FIRMWAREbDownload() to, first off, unlock a held lock. Thus do all locking in main_usb.c and hold it for a insignificantly shorter period of time. This makes the affected area significantly more readable though. Signed-off-by: Martin Kepplinger <martink@posteo.de> Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/staging/vt6656/firmware.c2
-rw-r--r--drivers/staging/vt6656/main_usb.c5
2 files changed, 4 insertions, 3 deletions
diff --git a/drivers/staging/vt6656/firmware.c b/drivers/staging/vt6656/firmware.c
index 15c1e861c84b..afb79c66a933 100644
--- a/drivers/staging/vt6656/firmware.c
+++ b/drivers/staging/vt6656/firmware.c
@@ -55,7 +55,6 @@ int FIRMWAREbDownload(struct vnt_private *pDevice) __must_hold(&pDevice->lock)
int ii, rc;
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"---->Download firmware\n");
- spin_unlock_irq(&pDevice->lock);
rc = request_firmware(&fw, FIRMWARE_NAME, dev);
if (rc) {
@@ -92,7 +91,6 @@ free_fw:
out:
kfree(pBuffer);
- spin_lock_irq(&pDevice->lock);
return result;
}
MODULE_FIRMWARE(FIRMWARE_NAME);
diff --git a/drivers/staging/vt6656/main_usb.c b/drivers/staging/vt6656/main_usb.c
index 3c9323069e01..1dc02c4abbed 100644
--- a/drivers/staging/vt6656/main_usb.c
+++ b/drivers/staging/vt6656/main_usb.c
@@ -319,7 +319,11 @@ static int device_init_registers(struct vnt_private *pDevice)
memcpy(pDevice->abySNAP_Bridgetunnel, abySNAP_Bridgetunnel, ETH_ALEN);
if (!FIRMWAREbCheckVersion(pDevice)) {
+
+ spin_unlock_irq(&pDevice->lock);
if (FIRMWAREbDownload(pDevice) == true) {
+
+ spin_lock_irq(&pDevice->lock);
if (FIRMWAREbBrach2Sram(pDevice) == false) {
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO
" FIRMWAREbBrach2Sram fail\n");
@@ -329,7 +333,6 @@ static int device_init_registers(struct vnt_private *pDevice)
} else {
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO
" FIRMWAREbDownload fail\n");
- spin_unlock_irq(&pDevice->lock);
return false;
}
}