Commit c7fcc089 authored by Ondrej Zary's avatar Ondrej Zary Committed by Martin K. Petersen

atp870u: Remove ugly gotos #5

Signed-off-by: default avatarOndrej Zary <linux@rainbow-software.org>
Reviewed-by: default avatarHannes Reinicke <hare@suse.de>
Acked-by: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent 58c4d046
......@@ -1007,20 +1007,12 @@ static void tscam(struct Scsi_Host *host)
;
outb(1, 0x80);
udelay(100);
for (n = 0; n < 0x30000; n++) {
if ((inb(dev->ioport[0] + 0x1c) & 0x80) != 0) { /* bsy ? */
goto wait_io;
}
}
goto TCM_SYNC;
wait_io:
for (n = 0; n < 0x30000; n++) {
for (n = 0; n < 0x30000; n++)
if ((inb(dev->ioport[0] + 0x1c) & 0x80) != 0) /* bsy ? */
break;
if (n < 0x30000)
for (n = 0; n < 0x30000; n++)
if ((inb(dev->ioport[0] + 0x1c) & 0x81) == 0x0081) {
goto wait_io1;
}
}
goto TCM_SYNC;
wait_io1:
inb(0x80);
val |= 0x8003; /* io,cd,db7 */
outw(val, dev->ioport[0] + 0x1c);
......@@ -1028,7 +1020,9 @@ static void tscam(struct Scsi_Host *host)
val &= 0x00bf; /* no sel */
outw(val, dev->ioport[0] + 0x1c);
outb(2, 0x80);
TCM_SYNC:
break;
}
while (1) {
/*
* The funny division into multiple delays is to accomodate
* arches like ARM where udelay() multiplies its argument by
......@@ -1059,31 +1053,28 @@ static void tscam(struct Scsi_Host *host)
outb(4, 0x80);
i = 8;
j = 0;
TCM_ID:
if ((inw(dev->ioport[0] + 0x1c) & 0x2000) == 0) {
goto TCM_ID;
}
while (1) {
if ((inw(dev->ioport[0] + 0x1c) & 0x2000) == 0)
continue;
outb(5, 0x80);
val &= 0x00ff; /* get ID_STRING */
val |= 0x2000;
k = fun_scam(dev, &val);
if ((k & 0x03) == 0) {
goto TCM_5;
}
if ((k & 0x03) == 0)
break;
mbuf[j] <<= 0x01;
mbuf[j] &= 0xfe;
if ((k & 0x02) != 0) {
if ((k & 0x02) != 0)
mbuf[j] |= 0x01;
}
i--;
if (i > 0) {
goto TCM_ID;
}
if (i > 0)
continue;
j++;
i = 8;
goto TCM_ID;
}
TCM_5: /* isolation complete.. */
/* isolation complete.. */
/* mbuf[32]=0;
printk(" \n%x %x %x %s\n ",assignid_map,mbuf[0],mbuf[1],&mbuf[2]); */
i = 15;
......@@ -1091,33 +1082,33 @@ static void tscam(struct Scsi_Host *host)
if ((j & 0x20) != 0) { /* bit5=1:ID up to 7 */
i = 7;
}
if ((j & 0x06) == 0) { /* IDvalid? */
goto G2Q5;
}
if ((j & 0x06) != 0) { /* IDvalid? */
k = mbuf[1];
small_id:
while (1) {
m = 1;
m <<= k;
if ((m & assignid_map) == 0) {
goto G2Q_QUIN;
}
if (k > 0) {
if ((m & assignid_map) == 0)
break;
if (k > 0)
k--;
goto small_id;
else
break;
}
}
G2Q5: /* srch from max acceptable ID# */
if ((m & assignid_map) != 0) { /* srch from max acceptable ID# */
k = i; /* max acceptable ID# */
G2Q_LP:
while (1) {
m = 1;
m <<= k;
if ((m & assignid_map) == 0) {
goto G2Q_QUIN;
}
if (k > 0) {
if ((m & assignid_map) == 0)
break;
if (k > 0)
k--;
goto G2Q_LP;
else
break;
}
G2Q_QUIN: /* k=binID#, */
}
/* k=binID#, */
assignid_map |= m;
if (k < 8) {
quintet[0] = 0x38; /* 1st dft ID<8 */
......@@ -1136,8 +1127,7 @@ static void tscam(struct Scsi_Host *host)
val |= m;
fun_scam(dev, &val);
goto TCM_SYNC;
}
}
static void is870(struct atp_unit *dev, unsigned int wkport)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment