diff options
author | Ondrej Zary <linux@rainbow-software.org> | 2015-11-17 13:23:50 -0500 |
---|---|---|
committer | Martin K. Petersen <martin.petersen@oracle.com> | 2015-11-25 22:08:34 -0500 |
commit | 468b8968157466996b70c610c080c41ae517c61c (patch) | |
tree | bdf3024386a5fcc78439ceca12df09cd7bee7e7d /drivers/scsi/atp870u.c | |
parent | 78614ecdda717ac4afa2764bec622b50400a1dc3 (diff) |
atp870u: Remove ugly gotos #2
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>
Diffstat (limited to 'drivers/scsi/atp870u.c')
-rw-r--r-- | drivers/scsi/atp870u.c | 68 |
1 files changed, 30 insertions, 38 deletions
diff --git a/drivers/scsi/atp870u.c b/drivers/scsi/atp870u.c index 886e54ba97ff..999bf74c3a86 100644 --- a/drivers/scsi/atp870u.c +++ b/drivers/scsi/atp870u.c | |||
@@ -617,7 +617,7 @@ static DEF_SCSI_QCMD(atp870u_queuecommand) | |||
617 | */ | 617 | */ |
618 | static void send_s870(struct atp_unit *dev,unsigned char c) | 618 | static void send_s870(struct atp_unit *dev,unsigned char c) |
619 | { | 619 | { |
620 | struct scsi_cmnd *workreq; | 620 | struct scsi_cmnd *workreq = NULL; |
621 | unsigned int i;//,k; | 621 | unsigned int i;//,k; |
622 | unsigned char j, target_id; | 622 | unsigned char j, target_id; |
623 | unsigned char *prd; | 623 | unsigned char *prd; |
@@ -638,50 +638,42 @@ static void send_s870(struct atp_unit *dev,unsigned char c) | |||
638 | if ((dev->last_cmd[c] != 0xff) && ((dev->last_cmd[c] & 0x40) != 0)) { | 638 | if ((dev->last_cmd[c] != 0xff) && ((dev->last_cmd[c] & 0x40) != 0)) { |
639 | dev->last_cmd[c] &= 0x0f; | 639 | dev->last_cmd[c] &= 0x0f; |
640 | workreq = dev->id[c][dev->last_cmd[c]].curr_req; | 640 | workreq = dev->id[c][dev->last_cmd[c]].curr_req; |
641 | if (workreq != NULL) { /* check NULL pointer */ | 641 | if (!workreq) { |
642 | goto cmd_subp; | 642 | dev->last_cmd[c] = 0xff; |
643 | } | 643 | if (dev->quhd[c] == dev->quend[c]) { |
644 | dev->last_cmd[c] = 0xff; | 644 | dev->in_snd[c] = 0; |
645 | if (dev->quhd[c] == dev->quend[c]) { | 645 | return; |
646 | dev->in_snd[c] = 0; | 646 | } |
647 | return ; | ||
648 | } | 647 | } |
649 | } | 648 | } |
650 | if ((dev->last_cmd[c] != 0xff) && (dev->working[c] != 0)) { | 649 | if (!workreq) { |
651 | dev->in_snd[c] = 0; | 650 | if ((dev->last_cmd[c] != 0xff) && (dev->working[c] != 0)) { |
652 | return ; | 651 | dev->in_snd[c] = 0; |
653 | } | 652 | return; |
654 | dev->working[c]++; | 653 | } |
655 | j = dev->quhd[c]; | 654 | dev->working[c]++; |
656 | dev->quhd[c]++; | 655 | j = dev->quhd[c]; |
657 | if (dev->quhd[c] >= qcnt) { | 656 | dev->quhd[c]++; |
658 | dev->quhd[c] = 0; | 657 | if (dev->quhd[c] >= qcnt) |
659 | } | 658 | dev->quhd[c] = 0; |
660 | workreq = dev->quereq[c][dev->quhd[c]]; | 659 | workreq = dev->quereq[c][dev->quhd[c]]; |
661 | if (dev->id[c][scmd_id(workreq)].curr_req == NULL) { | 660 | if (dev->id[c][scmd_id(workreq)].curr_req != NULL) { |
661 | dev->quhd[c] = j; | ||
662 | dev->working[c]--; | ||
663 | dev->in_snd[c] = 0; | ||
664 | return; | ||
665 | } | ||
662 | dev->id[c][scmd_id(workreq)].curr_req = workreq; | 666 | dev->id[c][scmd_id(workreq)].curr_req = workreq; |
663 | dev->last_cmd[c] = scmd_id(workreq); | 667 | dev->last_cmd[c] = scmd_id(workreq); |
664 | goto cmd_subp; | ||
665 | } | ||
666 | dev->quhd[c] = j; | ||
667 | dev->working[c]--; | ||
668 | dev->in_snd[c] = 0; | ||
669 | return; | ||
670 | cmd_subp: | ||
671 | if ((inb(dev->ioport[c] + 0x1f) & 0xb0) != 0) { | ||
672 | goto abortsnd; | ||
673 | } | ||
674 | if (inb(dev->ioport[c] + 0x1c) == 0) { | ||
675 | goto oktosend; | ||
676 | } | 668 | } |
677 | abortsnd: | 669 | if ((inb(dev->ioport[c] + 0x1f) & 0xb0) != 0 || inb(dev->ioport[c] + 0x1c) != 0) { |
678 | #ifdef ED_DBGP | 670 | #ifdef ED_DBGP |
679 | printk("Abort to Send\n"); | 671 | printk("Abort to Send\n"); |
680 | #endif | 672 | #endif |
681 | dev->last_cmd[c] |= 0x40; | 673 | dev->last_cmd[c] |= 0x40; |
682 | dev->in_snd[c] = 0; | 674 | dev->in_snd[c] = 0; |
683 | return; | 675 | return; |
684 | oktosend: | 676 | } |
685 | #ifdef ED_DBGP | 677 | #ifdef ED_DBGP |
686 | printk("OK to Send\n"); | 678 | printk("OK to Send\n"); |
687 | scmd_printk(KERN_DEBUG, workreq, "CDB"); | 679 | scmd_printk(KERN_DEBUG, workreq, "CDB"); |