aboutsummaryrefslogtreecommitdiff
path: root/drivers/net/dc2114x.c
diff options
context:
space:
mode:
authorMarek Vasut <marek.vasut+renesas@gmail.com>2020-04-19 03:10:14 +0200
committermarex <marex@desktop.lan>2020-05-01 12:35:21 +0200
commit7c53e3364e4dc7dc4752a75f18a3d72548098365 (patch)
treeecfd741fdb38bc284b0f1647753ac62210a8b08f /drivers/net/dc2114x.c
parentca5cb04b7fef31d66461cb58872d9ea32a24628b (diff)
downloadu-boot-7c53e3364e4dc7dc4752a75f18a3d72548098365.zip
u-boot-7c53e3364e4dc7dc4752a75f18a3d72548098365.tar.gz
u-boot-7c53e3364e4dc7dc4752a75f18a3d72548098365.tar.bz2
net: dc2114x: Clean up dc21x4x_send()
Clean up the driver send code to bring it up to standards with U-Boot coding style, invert the loops where applicable to cut down the level of indent. No functional change. Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com> Cc: Joe Hershberger <joe.hershberger@ni.com>
Diffstat (limited to 'drivers/net/dc2114x.c')
-rw-r--r--drivers/net/dc2114x.c42
1 files changed, 20 insertions, 22 deletions
diff --git a/drivers/net/dc2114x.c b/drivers/net/dc2114x.c
index d302d03..11ebea9 100644
--- a/drivers/net/dc2114x.c
+++ b/drivers/net/dc2114x.c
@@ -304,47 +304,45 @@ static int dc21x4x_init(struct eth_device *dev, bd_t *bis)
static int dc21x4x_send(struct eth_device *dev, void *packet, int length)
{
- int status = -1;
- int i;
+ int status = -1;
+ int i;
if (length <= 0) {
printf("%s: bad packet size: %d\n", dev->name, length);
- goto Done;
+ goto done;
}
- for(i = 0; tx_ring[tx_new].status & cpu_to_le32(T_OWN); i++) {
- if (i >= TOUT_LOOP) {
- printf("%s: tx error buffer not ready\n", dev->name);
- goto Done;
- }
+ for (i = 0; tx_ring[tx_new].status & cpu_to_le32(T_OWN); i++) {
+ if (i < TOUT_LOOP)
+ continue;
+
+ printf("%s: tx error buffer not ready\n", dev->name);
+ goto done;
}
- tx_ring[tx_new].buf = cpu_to_le32(phys_to_bus((u32) packet));
- tx_ring[tx_new].des1 = cpu_to_le32(TD_TER | TD_LS | TD_FS | length);
+ tx_ring[tx_new].buf = cpu_to_le32(phys_to_bus((u32)packet));
+ tx_ring[tx_new].des1 = cpu_to_le32(TD_TER | TD_LS | TD_FS | length);
tx_ring[tx_new].status = cpu_to_le32(T_OWN);
OUTL(dev, POLL_DEMAND, DE4X5_TPD);
- for(i = 0; tx_ring[tx_new].status & cpu_to_le32(T_OWN); i++) {
- if (i >= TOUT_LOOP) {
- printf(".%s: tx buffer not ready\n", dev->name);
- goto Done;
- }
+ for (i = 0; tx_ring[tx_new].status & cpu_to_le32(T_OWN); i++) {
+ if (i < TOUT_LOOP)
+ continue;
+
+ printf(".%s: tx buffer not ready\n", dev->name);
+ goto done;
}
if (le32_to_cpu(tx_ring[tx_new].status) & TD_ES) {
-#if 0 /* test-only */
- printf("TX error status = 0x%08X\n",
- le32_to_cpu(tx_ring[tx_new].status));
-#endif
tx_ring[tx_new].status = 0x0;
- goto Done;
+ goto done;
}
status = length;
- Done:
- tx_new = (tx_new+1) % NUM_TX_DESC;
+done:
+ tx_new = (tx_new + 1) % NUM_TX_DESC;
return status;
}