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,28 +1007,22 @@ static void tscam(struct Scsi_Host *host) ...@@ -1007,28 +1007,22 @@ static void tscam(struct Scsi_Host *host)
; ;
outb(1, 0x80); outb(1, 0x80);
udelay(100); udelay(100);
for (n = 0; n < 0x30000; n++) { for (n = 0; n < 0x30000; n++)
if ((inb(dev->ioport[0] + 0x1c) & 0x80) != 0) { /* bsy ? */ if ((inb(dev->ioport[0] + 0x1c) & 0x80) != 0) /* bsy ? */
goto wait_io; break;
} if (n < 0x30000)
} for (n = 0; n < 0x30000; n++)
goto TCM_SYNC; if ((inb(dev->ioport[0] + 0x1c) & 0x81) == 0x0081) {
wait_io: inb(0x80);
for (n = 0; n < 0x30000; n++) { val |= 0x8003; /* io,cd,db7 */
if ((inb(dev->ioport[0] + 0x1c) & 0x81) == 0x0081) { outw(val, dev->ioport[0] + 0x1c);
goto wait_io1; inb(0x80);
} val &= 0x00bf; /* no sel */
} outw(val, dev->ioport[0] + 0x1c);
goto TCM_SYNC; outb(2, 0x80);
wait_io1: break;
inb(0x80); }
val |= 0x8003; /* io,cd,db7 */ while (1) {
outw(val, dev->ioport[0] + 0x1c);
inb(0x80);
val &= 0x00bf; /* no sel */
outw(val, dev->ioport[0] + 0x1c);
outb(2, 0x80);
TCM_SYNC:
/* /*
* The funny division into multiple delays is to accomodate * The funny division into multiple delays is to accomodate
* arches like ARM where udelay() multiplies its argument by * arches like ARM where udelay() multiplies its argument by
...@@ -1059,31 +1053,28 @@ static void tscam(struct Scsi_Host *host) ...@@ -1059,31 +1053,28 @@ static void tscam(struct Scsi_Host *host)
outb(4, 0x80); outb(4, 0x80);
i = 8; i = 8;
j = 0; j = 0;
TCM_ID:
if ((inw(dev->ioport[0] + 0x1c) & 0x2000) == 0) { while (1) {
goto TCM_ID; if ((inw(dev->ioport[0] + 0x1c) & 0x2000) == 0)
} continue;
outb(5, 0x80); outb(5, 0x80);
val &= 0x00ff; /* get ID_STRING */ val &= 0x00ff; /* get ID_STRING */
val |= 0x2000; val |= 0x2000;
k = fun_scam(dev, &val); k = fun_scam(dev, &val);
if ((k & 0x03) == 0) { if ((k & 0x03) == 0)
goto TCM_5; break;
} mbuf[j] <<= 0x01;
mbuf[j] <<= 0x01; mbuf[j] &= 0xfe;
mbuf[j] &= 0xfe; if ((k & 0x02) != 0)
if ((k & 0x02) != 0) { mbuf[j] |= 0x01;
mbuf[j] |= 0x01; i--;
} if (i > 0)
i--; continue;
if (i > 0) { j++;
goto TCM_ID; i = 8;
} }
j++;
i = 8;
goto TCM_ID;
TCM_5: /* isolation complete.. */ /* isolation complete.. */
/* mbuf[32]=0; /* mbuf[32]=0;
printk(" \n%x %x %x %s\n ",assignid_map,mbuf[0],mbuf[1],&mbuf[2]); */ printk(" \n%x %x %x %s\n ",assignid_map,mbuf[0],mbuf[1],&mbuf[2]); */
i = 15; i = 15;
...@@ -1091,33 +1082,33 @@ static void tscam(struct Scsi_Host *host) ...@@ -1091,33 +1082,33 @@ static void tscam(struct Scsi_Host *host)
if ((j & 0x20) != 0) { /* bit5=1:ID up to 7 */ if ((j & 0x20) != 0) { /* bit5=1:ID up to 7 */
i = 7; i = 7;
} }
if ((j & 0x06) == 0) { /* IDvalid? */ if ((j & 0x06) != 0) { /* IDvalid? */
goto G2Q5; k = mbuf[1];
} while (1) {
k = mbuf[1]; m = 1;
small_id: m <<= k;
m = 1; if ((m & assignid_map) == 0)
m <<= k; break;
if ((m & assignid_map) == 0) { if (k > 0)
goto G2Q_QUIN; k--;
} else
if (k > 0) { break;
k--; }
goto small_id;
}
G2Q5: /* srch from max acceptable ID# */
k = i; /* max acceptable ID# */
G2Q_LP:
m = 1;
m <<= k;
if ((m & assignid_map) == 0) {
goto G2Q_QUIN;
} }
if (k > 0) { if ((m & assignid_map) != 0) { /* srch from max acceptable ID# */
k--; k = i; /* max acceptable ID# */
goto G2Q_LP; while (1) {
m = 1;
m <<= k;
if ((m & assignid_map) == 0)
break;
if (k > 0)
k--;
else
break;
}
} }
G2Q_QUIN: /* k=binID#, */ /* k=binID#, */
assignid_map |= m; assignid_map |= m;
if (k < 8) { if (k < 8) {
quintet[0] = 0x38; /* 1st dft ID<8 */ quintet[0] = 0x38; /* 1st dft ID<8 */
...@@ -1136,8 +1127,7 @@ static void tscam(struct Scsi_Host *host) ...@@ -1136,8 +1127,7 @@ static void tscam(struct Scsi_Host *host)
val |= m; val |= m;
fun_scam(dev, &val); fun_scam(dev, &val);
goto TCM_SYNC; }
} }
static void is870(struct atp_unit *dev, unsigned int wkport) 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