mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-29 18:11:20 +00:00
atp870u: Remove ugly gotos #5
Signed-off-by: Ondrej Zary <linux@rainbow-software.org> Reviewed-by: Hannes Reinicke <hare@suse.de> Acked-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
This commit is contained in:
parent
58c4d046b4
commit
c7fcc089b0
1 changed files with 63 additions and 73 deletions
|
@ -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 @@ TCM_SYNC:
|
||||||
outb(4, 0x80);
|
outb(4, 0x80);
|
||||||
i = 8;
|
i = 8;
|
||||||
j = 0;
|
j = 0;
|
||||||
TCM_ID:
|
|
||||||
if ((inw(dev->ioport[0] + 0x1c) & 0x2000) == 0) {
|
|
||||||
goto TCM_ID;
|
|
||||||
}
|
|
||||||
outb(5, 0x80);
|
|
||||||
val &= 0x00ff; /* get ID_STRING */
|
|
||||||
val |= 0x2000;
|
|
||||||
k = fun_scam(dev, &val);
|
|
||||||
if ((k & 0x03) == 0) {
|
|
||||||
goto TCM_5;
|
|
||||||
}
|
|
||||||
mbuf[j] <<= 0x01;
|
|
||||||
mbuf[j] &= 0xfe;
|
|
||||||
if ((k & 0x02) != 0) {
|
|
||||||
mbuf[j] |= 0x01;
|
|
||||||
}
|
|
||||||
i--;
|
|
||||||
if (i > 0) {
|
|
||||||
goto TCM_ID;
|
|
||||||
}
|
|
||||||
j++;
|
|
||||||
i = 8;
|
|
||||||
goto TCM_ID;
|
|
||||||
|
|
||||||
TCM_5: /* isolation complete.. */
|
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)
|
||||||
|
break;
|
||||||
|
mbuf[j] <<= 0x01;
|
||||||
|
mbuf[j] &= 0xfe;
|
||||||
|
if ((k & 0x02) != 0)
|
||||||
|
mbuf[j] |= 0x01;
|
||||||
|
i--;
|
||||||
|
if (i > 0)
|
||||||
|
continue;
|
||||||
|
j++;
|
||||||
|
i = 8;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 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 @@ TCM_5: /* isolation complete.. */
|
||||||
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) {
|
||||||
|
m = 1;
|
||||||
|
m <<= k;
|
||||||
|
if ((m & assignid_map) == 0)
|
||||||
|
break;
|
||||||
|
if (k > 0)
|
||||||
|
k--;
|
||||||
|
else
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
k = mbuf[1];
|
if ((m & assignid_map) != 0) { /* srch from max acceptable ID# */
|
||||||
small_id:
|
k = i; /* max acceptable ID# */
|
||||||
m = 1;
|
while (1) {
|
||||||
m <<= k;
|
m = 1;
|
||||||
if ((m & assignid_map) == 0) {
|
m <<= k;
|
||||||
goto G2Q_QUIN;
|
if ((m & assignid_map) == 0)
|
||||||
|
break;
|
||||||
|
if (k > 0)
|
||||||
|
k--;
|
||||||
|
else
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (k > 0) {
|
/* k=binID#, */
|
||||||
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) {
|
|
||||||
k--;
|
|
||||||
goto G2Q_LP;
|
|
||||||
}
|
|
||||||
G2Q_QUIN: /* 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 @@ G2Q_QUIN: /* k=binID#, */
|
||||||
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)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue