diff options
author | Tejun Heo <htejun@gmail.com> | 2007-11-27 05:28:53 -0500 |
---|---|---|
committer | Jeff Garzik <jeff@garzik.org> | 2008-01-23 05:24:10 -0500 |
commit | 405e66b38797875e80669eaf72d313dbb76533c3 (patch) | |
tree | a069f0bb4ae1e81a58bc8f8965a2443d25186f0d /drivers/ata/sata_sil24.c | |
parent | f20ded38aa54b92dd0af32578b8916d0aa2d9e05 (diff) |
libata: implement protocol tests
Implement protocol tests - ata_is_atapi(), ata_is_nodata(),
ata_is_pio(), ata_is_dma(), ata_is_ncq() and ata_is_data() and use
them to replace is_atapi_taskfile() and hard coded protocol tests.
Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/ata/sata_sil24.c')
-rw-r--r-- | drivers/ata/sata_sil24.c | 24 |
1 files changed, 4 insertions, 20 deletions
diff --git a/drivers/ata/sata_sil24.c b/drivers/ata/sata_sil24.c index 864c1c1b8511..fdd3ceac329b 100644 --- a/drivers/ata/sata_sil24.c +++ b/drivers/ata/sata_sil24.c | |||
@@ -852,9 +852,7 @@ static int sil24_qc_defer(struct ata_queued_cmd *qc) | |||
852 | * set. | 852 | * set. |
853 | * | 853 | * |
854 | */ | 854 | */ |
855 | int is_excl = (prot == ATA_PROT_ATAPI || | 855 | int is_excl = (ata_is_atapi(prot) || |
856 | prot == ATA_PROT_ATAPI_NODATA || | ||
857 | prot == ATA_PROT_ATAPI_DMA || | ||
858 | (qc->flags & ATA_QCFLAG_RESULT_TF)); | 856 | (qc->flags & ATA_QCFLAG_RESULT_TF)); |
859 | 857 | ||
860 | if (unlikely(ap->excl_link)) { | 858 | if (unlikely(ap->excl_link)) { |
@@ -885,35 +883,21 @@ static void sil24_qc_prep(struct ata_queued_cmd *qc) | |||
885 | 883 | ||
886 | cb = &pp->cmd_block[sil24_tag(qc->tag)]; | 884 | cb = &pp->cmd_block[sil24_tag(qc->tag)]; |
887 | 885 | ||
888 | switch (qc->tf.protocol) { | 886 | if (!ata_is_atapi(qc->tf.protocol)) { |
889 | case ATA_PROT_PIO: | ||
890 | case ATA_PROT_DMA: | ||
891 | case ATA_PROT_NCQ: | ||
892 | case ATA_PROT_NODATA: | ||
893 | prb = &cb->ata.prb; | 887 | prb = &cb->ata.prb; |
894 | sge = cb->ata.sge; | 888 | sge = cb->ata.sge; |
895 | break; | 889 | } else { |
896 | |||
897 | case ATA_PROT_ATAPI: | ||
898 | case ATA_PROT_ATAPI_DMA: | ||
899 | case ATA_PROT_ATAPI_NODATA: | ||
900 | prb = &cb->atapi.prb; | 890 | prb = &cb->atapi.prb; |
901 | sge = cb->atapi.sge; | 891 | sge = cb->atapi.sge; |
902 | memset(cb->atapi.cdb, 0, 32); | 892 | memset(cb->atapi.cdb, 0, 32); |
903 | memcpy(cb->atapi.cdb, qc->cdb, qc->dev->cdb_len); | 893 | memcpy(cb->atapi.cdb, qc->cdb, qc->dev->cdb_len); |
904 | 894 | ||
905 | if (qc->tf.protocol != ATA_PROT_ATAPI_NODATA) { | 895 | if (ata_is_data(qc->tf.protocol)) { |
906 | if (qc->tf.flags & ATA_TFLAG_WRITE) | 896 | if (qc->tf.flags & ATA_TFLAG_WRITE) |
907 | ctrl = PRB_CTRL_PACKET_WRITE; | 897 | ctrl = PRB_CTRL_PACKET_WRITE; |
908 | else | 898 | else |
909 | ctrl = PRB_CTRL_PACKET_READ; | 899 | ctrl = PRB_CTRL_PACKET_READ; |
910 | } | 900 | } |
911 | break; | ||
912 | |||
913 | default: | ||
914 | prb = NULL; /* shut up, gcc */ | ||
915 | sge = NULL; | ||
916 | BUG(); | ||
917 | } | 901 | } |
918 | 902 | ||
919 | prb->ctrl = cpu_to_le16(ctrl); | 903 | prb->ctrl = cpu_to_le16(ctrl); |