[PATCH 10/10] staging: ks7010: rename return value identifier

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Driver uses multiple identifier names for the same task (retval, ret,
rc). It would be easier to read the code if a single task is
identified with a single name. 'ret' is the most common return value
identifier name found in the kernel tree, following the principle of
least surprise using 'ret' is a decent choice.

Rename rc -> ret
Rename retval -> ret

Signed-off-by: Tobin C. Harding <me@xxxxxxxx>
---
 drivers/staging/ks7010/ks7010_sdio.c | 142 +++++++++++++++++------------------
 drivers/staging/ks7010/ks_hostif.c   |  16 ++--
 drivers/staging/ks7010/ks_wlan_net.c |  10 +--
 3 files changed, 84 insertions(+), 84 deletions(-)

diff --git a/drivers/staging/ks7010/ks7010_sdio.c b/drivers/staging/ks7010/ks7010_sdio.c
index 8823e93..28b91be 100644
--- a/drivers/staging/ks7010/ks7010_sdio.c
+++ b/drivers/staging/ks7010/ks7010_sdio.c
@@ -52,44 +52,48 @@ static int ks7010_sdio_read(struct ks_wlan_private *priv, unsigned int address,
 			    unsigned char *buffer, int length)
 {
 	struct ks_sdio_card *card;
-	int rc;
+	int ret;
 
 	card = priv->ks_wlan_hw.sdio_card;
 
 	if (length == 1)	/* CMD52 */
-		*buffer = sdio_readb(card->func, address, &rc);
+		*buffer = sdio_readb(card->func, address, &ret);
 	else	/* CMD53 multi-block transfer */
-		rc = sdio_memcpy_fromio(card->func, buffer, address, length);
+		ret = sdio_memcpy_fromio(card->func, buffer, address, length);
 
-	if (rc)
-		DPRINTK(1, "sdio error=%d size=%d\n", rc, length);
+	if (ret) {
+		DPRINTK(1, "sdio error=%d size=%d\n", ret, length);
+		return ret;
+	}
 
-	return rc;
+	return 0;
 }
 
 static int ks7010_sdio_write(struct ks_wlan_private *priv, unsigned int address,
 			     unsigned char *buffer, int length)
 {
 	struct ks_sdio_card *card;
-	int rc;
+	int ret;
 
 	card = priv->ks_wlan_hw.sdio_card;
 
 	if (length == 1)	/* CMD52 */
-		sdio_writeb(card->func, *buffer, address, &rc);
+		sdio_writeb(card->func, *buffer, address, &ret);
 	else	/* CMD53 */
-		rc = sdio_memcpy_toio(card->func, address, buffer, length);
+		ret = sdio_memcpy_toio(card->func, address, buffer, length);
 
-	if (rc)
-		DPRINTK(1, "sdio error=%d size=%d\n", rc, length);
+	if (ret) {
+		DPRINTK(1, "sdio error=%d size=%d\n", ret, length);
+		return ret;
+	}
 
-	return rc;
+	return 0;
 }
 
 static void ks_wlan_hw_sleep_doze_request(struct ks_wlan_private *priv)
 {
 	unsigned char rw_data;
-	int retval;
+	int ret;
 
 	DPRINTK(4, "\n");
 
@@ -98,9 +102,8 @@ static void ks_wlan_hw_sleep_doze_request(struct ks_wlan_private *priv)
 
 	if (atomic_read(&priv->sleepstatus.status) == 0) {
 		rw_data = GCR_B_DOZE;
-		retval =
-		    ks7010_sdio_write(priv, GCR_B, &rw_data, sizeof(rw_data));
-		if (retval) {
+		ret = ks7010_sdio_write(priv, GCR_B, &rw_data, sizeof(rw_data));
+		if (ret) {
 			DPRINTK(1, " error : GCR_B=%02X\n", rw_data);
 			goto set_sleep_mode;
 		}
@@ -119,7 +122,7 @@ static void ks_wlan_hw_sleep_doze_request(struct ks_wlan_private *priv)
 static void ks_wlan_hw_sleep_wakeup_request(struct ks_wlan_private *priv)
 {
 	unsigned char rw_data;
-	int retval;
+	int ret;
 
 	DPRINTK(4, "\n");
 
@@ -128,9 +131,8 @@ static void ks_wlan_hw_sleep_wakeup_request(struct ks_wlan_private *priv)
 
 	if (atomic_read(&priv->sleepstatus.status) == 1) {
 		rw_data = WAKEUP_REQ;
-		retval =
-		    ks7010_sdio_write(priv, WAKEUP, &rw_data, sizeof(rw_data));
-		if (retval) {
+		ret = ks7010_sdio_write(priv, WAKEUP, &rw_data, sizeof(rw_data));
+		if (ret) {
 			DPRINTK(1, " error : WAKEUP=%02X\n", rw_data);
 			goto set_sleep_mode;
 		}
@@ -149,14 +151,13 @@ static void ks_wlan_hw_sleep_wakeup_request(struct ks_wlan_private *priv)
 void ks_wlan_hw_wakeup_request(struct ks_wlan_private *priv)
 {
 	unsigned char rw_data;
-	int retval;
+	int ret;
 
 	DPRINTK(4, "\n");
 	if (atomic_read(&priv->psstatus.status) == PS_SNOOZE) {
 		rw_data = WAKEUP_REQ;
-		retval =
-		    ks7010_sdio_write(priv, WAKEUP, &rw_data, sizeof(rw_data));
-		if (retval)
+		ret = ks7010_sdio_write(priv, WAKEUP, &rw_data, sizeof(rw_data));
+		if (ret)
 			DPRINTK(1, " error : WAKEUP=%02X\n", rw_data);
 
 		DPRINTK(4, "wake up : WAKEUP=%02X\n", rw_data);
@@ -241,17 +242,17 @@ static int enqueue_txdev(struct ks_wlan_private *priv, unsigned char *p,
 			 void *arg1, void *arg2)
 {
 	struct tx_device_buffer *sp;
-	int rc;
+	int ret;
 
 	if (priv->dev_state < DEVICE_STATE_BOOT) {
-		rc = -EPERM;
+		ret = -EPERM;
 		goto err_complete;
 	}
 
 	if ((TX_DEVICE_BUFF_SIZE - 1) <= cnt_txqbody(priv)) {
 		/* in case of buffer overflow */
 		DPRINTK(1, "tx buffer overflow\n");
-		rc = -EOVERFLOW;
+		ret = -EOVERFLOW;
 		goto err_complete;
 	}
 
@@ -270,7 +271,7 @@ static int enqueue_txdev(struct ks_wlan_private *priv, unsigned char *p,
 	if (complete_handler)
 		(*complete_handler) (arg1, arg2);
 
-	return rc;
+	return ret;
 }
 
 /* write data */
@@ -279,7 +280,7 @@ static int write_to_device(struct ks_wlan_private *priv, unsigned char *buffer,
 {
 	unsigned char rw_data;
 	struct hostif_hdr *hdr;
-	int rc;
+	int ret;
 
 	hdr = (struct hostif_hdr *)buffer;
 
@@ -289,17 +290,17 @@ static int write_to_device(struct ks_wlan_private *priv, unsigned char *buffer,
 		return 0;
 	}
 
-	rc = ks7010_sdio_write(priv, DATA_WINDOW, buffer, size);
-	if (rc) {
-		DPRINTK(1, " write error : retval=%d\n", rc);
-		return rc;
+	ret = ks7010_sdio_write(priv, DATA_WINDOW, buffer, size);
+	if (ret) {
+		DPRINTK(1, " write error : retval=%d\n", ret);
+		return ret;
 	}
 
 	rw_data = WRITE_STATUS_BUSY;
-	rc = ks7010_sdio_write(priv, WRITE_STATUS, &rw_data, sizeof(rw_data));
-	if (rc) {
+	ret = ks7010_sdio_write(priv, WRITE_STATUS, &rw_data, sizeof(rw_data));
+	if (ret) {
 		DPRINTK(1, " error : WRITE_STATUS=%02X\n", rw_data);
-		return rc;
+		return ret;
 	}
 
 	return 0;
@@ -461,7 +462,7 @@ static void ks7010_rw_function(struct work_struct *work)
 	struct hw_info_t *hw;
 	struct ks_wlan_private *priv;
 	unsigned char rw_data;
-	int retval;
+	int ret;
 
 	hw = container_of(work, struct hw_info_t, rw_wq.work);
 	priv = container_of(hw, struct ks_wlan_private, ks_wlan_hw);
@@ -510,9 +511,8 @@ static void ks7010_rw_function(struct work_struct *work)
 	}
 
 	/* read (WriteStatus/ReadDataSize FN1:00_0014) */
-	retval =
-	    ks7010_sdio_read(priv, WSTATUS_RSIZE, &rw_data, sizeof(rw_data));
-	if (retval) {
+	ret = ks7010_sdio_read(priv, WSTATUS_RSIZE, &rw_data, sizeof(rw_data));
+	if (ret) {
 		DPRINTK(1, " error : WSTATUS_RSIZE=%02X psstatus=%d\n", rw_data,
 			atomic_read(&priv->psstatus.status));
 		goto err_release_host;
@@ -656,7 +656,7 @@ static void trx_device_exit(struct ks_wlan_private *priv)
 
 static int ks7010_sdio_update_index(struct ks_wlan_private *priv, u32 index)
 {
-	int rc;
+	int ret;
 	unsigned char *data_buf;
 
 	data_buf = kmalloc(sizeof(u32), GFP_KERNEL);
@@ -664,12 +664,12 @@ static int ks7010_sdio_update_index(struct ks_wlan_private *priv, u32 index)
 		return -ENOMEM;
 
 	memcpy(data_buf, &index, sizeof(index));
-	rc = ks7010_sdio_write(priv, WRITE_INDEX, data_buf, sizeof(index));
-	if (rc)
+	ret = ks7010_sdio_write(priv, WRITE_INDEX, data_buf, sizeof(index));
+	if (ret)
 		goto err_free_data_buf;
 
-	rc = ks7010_sdio_write(priv, READ_INDEX, data_buf, sizeof(index));
-	if (rc)
+	ret = ks7010_sdio_write(priv, READ_INDEX, data_buf, sizeof(index));
+	if (ret)
 		goto err_free_data_buf;
 
 	return 0;
@@ -677,27 +677,27 @@ static int ks7010_sdio_update_index(struct ks_wlan_private *priv, u32 index)
 err_free_data_buf:
 	kfree(data_buf);
 
-	return rc;
+	return ret;
 }
 
 #define ROM_BUFF_SIZE (64 * 1024)
 static int ks7010_sdio_data_compare(struct ks_wlan_private *priv, u32 address,
 				    unsigned char *data, unsigned int size)
 {
-	int rc;
+	int ret;
 	unsigned char *read_buf;
 
 	read_buf = kmalloc(ROM_BUFF_SIZE, GFP_KERNEL);
 	if (!read_buf)
 		return -ENOMEM;
 
-	rc = ks7010_sdio_read(priv, address, read_buf, size);
-	if (rc)
+	ret = ks7010_sdio_read(priv, address, read_buf, size);
+	if (ret)
 		goto err_free_read_buf;
 
-	rc = memcmp(data, read_buf, size);
-	if (rc) {
-		DPRINTK(0, "data compare error (%d)\n", rc);
+	ret = memcmp(data, read_buf, size);
+	if (ret) {
+		DPRINTK(0, "data compare error (%d)\n", ret);
 		goto err_free_read_buf;
 	}
 
@@ -706,7 +706,7 @@ static int ks7010_sdio_data_compare(struct ks_wlan_private *priv, u32 address,
 err_free_read_buf:
 	kfree(read_buf);
 
-	return rc;
+	return ret;
 }
 
 static int ks7010_upload_firmware(struct ks_wlan_private *priv,
@@ -715,7 +715,7 @@ static int ks7010_upload_firmware(struct ks_wlan_private *priv,
 	unsigned int size, offset, n = 0;
 	unsigned char *rom_buf;
 	unsigned char rw_data = 0;
-	int rc;
+	int ret;
 	int length;
 	const struct firmware *fw_entry = NULL;
 
@@ -727,14 +727,15 @@ static int ks7010_upload_firmware(struct ks_wlan_private *priv,
 	sdio_claim_host(card->func);
 
 	/* Firmware running ? */
-	rc = ks7010_sdio_read(priv, GCR_A, &rw_data, sizeof(rw_data));
+	ret = ks7010_sdio_read(priv, GCR_A, &rw_data, sizeof(rw_data));
 	if (rw_data == GCR_A_RUN) {
 		DPRINTK(0, "MAC firmware running ...\n");
 		goto release_host_and_free;
 	}
 
-	rc = request_firmware(&fw_entry, ROM_FILE, &priv->ks_wlan_hw.sdio_card->func->dev);
-	if (rc)
+	ret = request_firmware(&fw_entry, ROM_FILE,
+			       &priv->ks_wlan_hw.sdio_card->func->dev);
+	if (ret)
 		goto release_host_and_free;
 
 	length = fw_entry->size;
@@ -755,19 +756,18 @@ static int ks7010_upload_firmware(struct ks_wlan_private *priv,
 		memcpy(rom_buf, fw_entry->data + n, size);
 		/* Update write index */
 		offset = n;
-		rc = ks7010_sdio_update_index(priv,
-					      KS7010_IRAM_ADDRESS + offset);
-		if (rc)
+		ret = ks7010_sdio_update_index(priv, KS7010_IRAM_ADDRESS + offset);
+		if (ret)
 			goto release_firmware;
 
 		/* Write data */
-		rc = ks7010_sdio_write(priv, DATA_WINDOW, rom_buf, size);
-		if (rc)
+		ret = ks7010_sdio_write(priv, DATA_WINDOW, rom_buf, size);
+		if (ret)
 			goto release_firmware;
 
 		/* compare */
-		rc = ks7010_sdio_data_compare(priv, DATA_WINDOW, rom_buf, size);
-		if (rc)
+		ret = ks7010_sdio_data_compare(priv, DATA_WINDOW, rom_buf, size);
+		if (ret)
 			goto release_firmware;
 
 		n += size;
@@ -776,8 +776,8 @@ static int ks7010_upload_firmware(struct ks_wlan_private *priv,
 
 	/* Remap request */
 	rw_data = GCR_A_REMAP;
-	rc = ks7010_sdio_write(priv, GCR_A, &rw_data, sizeof(rw_data));
-	if (rc)
+	ret = ks7010_sdio_write(priv, GCR_A, &rw_data, sizeof(rw_data));
+	if (ret)
 		goto release_firmware;
 
 	DPRINTK(4, " REMAP Request : GCR_A=%02X\n", rw_data);
@@ -785,8 +785,8 @@ static int ks7010_upload_firmware(struct ks_wlan_private *priv,
 	/* Firmware running check */
 	for (n = 0; n < 50; ++n) {
 		mdelay(10);	/* wait_ms(10); */
-		rc = ks7010_sdio_read(priv, GCR_A, &rw_data, sizeof(rw_data));
-		if (rc)
+		ret = ks7010_sdio_read(priv, GCR_A, &rw_data, sizeof(rw_data));
+		if (ret)
 			goto release_firmware;
 
 		if (rw_data == GCR_A_RUN)
@@ -795,11 +795,11 @@ static int ks7010_upload_firmware(struct ks_wlan_private *priv,
 	DPRINTK(4, "firmware wakeup (%d)!!!!\n", n);
 	if ((50) <= n) {
 		DPRINTK(1, "firmware can't start\n");
-		rc = -EIO;
+		ret = -EIO;
 		goto release_firmware;
 	}
 
-	rc = 0;
+	ret = 0;
 
  release_firmware:
 	release_firmware(fw_entry);
@@ -807,7 +807,7 @@ static int ks7010_upload_firmware(struct ks_wlan_private *priv,
 	sdio_release_host(card->func);
 	kfree(rom_buf);
 
-	return rc;
+	return ret;
 }
 
 static void ks7010_card_init(struct ks_wlan_private *priv)
diff --git a/drivers/staging/ks7010/ks_hostif.c b/drivers/staging/ks7010/ks_hostif.c
index 83cda1f..460ab13 100644
--- a/drivers/staging/ks7010/ks_hostif.c
+++ b/drivers/staging/ks7010/ks_hostif.c
@@ -402,7 +402,7 @@ void hostif_data_indication(struct ks_wlan_private *priv)
 	unsigned short eth_proto;
 	struct ieee802_1x_hdr *aa1x_hdr;
 	struct wpa_eapol_key *eap_key;
-	int rc;
+	int ret;
 
 	DPRINTK(3, "\n");
 
@@ -434,8 +434,8 @@ void hostif_data_indication(struct ks_wlan_private *priv)
 
 	/*  for WPA */
 	if (auth_type != TYPE_DATA && priv->wpa.rsn_enabled) {
-		rc = hostif_data_indication_wpa(priv, auth_type);
-		if (rc)
+		ret = hostif_data_indication_wpa(priv, auth_type);
+		if (ret)
 			return;
 	}
 
@@ -1124,12 +1124,12 @@ int hostif_data_request(struct ks_wlan_private *priv, struct sk_buff *packet)
 	struct ieee802_1x_hdr *aa1x_hdr;
 	struct wpa_eapol_key *eap_key;
 	struct ethhdr *eth;
-	int rc;
+	int ret;
 
 	packet_len = packet->len;
 	if (packet_len > ETH_FRAME_LEN) {
 		DPRINTK(1, "bad length packet_len=%d\n", packet_len);
-		rc = -EOVERFLOW;
+		ret = -EOVERFLOW;
 		goto err_kfree_skb;
 	}
 
@@ -1157,7 +1157,7 @@ int hostif_data_request(struct ks_wlan_private *priv, struct sk_buff *packet)
 
 	if (!pp) {
 		DPRINTK(3, "allocate memory failed..\n");
-		rc = -ENOMEM;
+		ret = -ENOMEM;
 		goto err_kfree_skb;
 	}
 
@@ -1171,7 +1171,7 @@ int hostif_data_request(struct ks_wlan_private *priv, struct sk_buff *packet)
 	if (memcmp(&priv->eth_addr[0], eth->h_source, ETH_ALEN)) {
 		DPRINTK(1, "invalid mac address !!\n");
 		DPRINTK(1, "ethernet->h_source=%pM\n", eth->h_source);
-		rc = -ENXIO;
+		ret = -ENXIO;
 		goto err_kfree;
 	}
 
@@ -1281,7 +1281,7 @@ int hostif_data_request(struct ks_wlan_private *priv, struct sk_buff *packet)
 err_kfree_skb:
 	dev_kfree_skb(packet);
 
-	return rc;
+	return ret;
 }
 
 #define ps_confirm_wait_inc(priv) do { \
diff --git a/drivers/staging/ks7010/ks_wlan_net.c b/drivers/staging/ks7010/ks_wlan_net.c
index 7d4c7f3..3f9eba4 100644
--- a/drivers/staging/ks7010/ks_wlan_net.c
+++ b/drivers/staging/ks7010/ks_wlan_net.c
@@ -2842,20 +2842,20 @@ static const struct iw_handler_def ks_wlan_handler_def = {
 static int ks_wlan_netdev_ioctl(struct net_device *dev, struct ifreq *rq,
 				int cmd)
 {
-	int rc = 0;
+	int ret;
 	struct iwreq *wrq = (struct iwreq *)rq;
 
 	switch (cmd) {
 	case SIOCIWFIRSTPRIV + 20:	/* KS_WLAN_SET_STOP_REQ */
-		rc = ks_wlan_set_stop_request(dev, NULL, &wrq->u.mode, NULL);
+		ret = ks_wlan_set_stop_request(dev, NULL, &wrq->u.mode, NULL);
 		break;
 		// All other calls are currently unsupported
 	default:
-		rc = -EOPNOTSUPP;
+		ret = -EOPNOTSUPP;
 	}
 
-	DPRINTK(5, "return=%d\n", rc);
-	return rc;
+	DPRINTK(5, "return=%d\n", ret);
+	return ret;
 }
 
 static
-- 
2.7.4

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel



[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux