diff options
| author | Albert Lee <albertcc@tw.ibm.com> | 2006-03-25 04:53:57 -0500 |
|---|---|---|
| committer | Jeff Garzik <jeff@garzik.org> | 2006-03-29 17:21:54 -0500 |
| commit | 27cdadef6dfe0d0614653919a110fc75ab1650ce (patch) | |
| tree | 88c762ec72b2f09ef7aab5acdd8d3888b5c50758 | |
| parent | a1af37344f669d0fefa8c8a9e37eb6a7c086a2c2 (diff) | |
[PATCH] libata-dev: Cleanup unused enums/functions
Cleanup the following unused functions:
- ata_pio_poll()
- ata_pio_complete()
- ata_pio_first_block()
- ata_pio_block()
- ata_pio_error()
ap->pio_task_timeout and other enums.
Signed-off-by: Albert Lee <albertcc@tw.ibm.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
| -rw-r--r-- | drivers/scsi/libata-core.c | 279 | ||||
| -rw-r--r-- | include/linux/libata.h | 9 |
2 files changed, 0 insertions, 288 deletions
diff --git a/drivers/scsi/libata-core.c b/drivers/scsi/libata-core.c index eeeeda0481a2..ef0d0dd90e17 100644 --- a/drivers/scsi/libata-core.c +++ b/drivers/scsi/libata-core.c | |||
| @@ -67,7 +67,6 @@ static void ata_set_mode(struct ata_port *ap); | |||
| 67 | static unsigned int ata_dev_set_xfermode(struct ata_port *ap, | 67 | static unsigned int ata_dev_set_xfermode(struct ata_port *ap, |
| 68 | struct ata_device *dev); | 68 | struct ata_device *dev); |
| 69 | static void ata_dev_xfermask(struct ata_port *ap, struct ata_device *dev); | 69 | static void ata_dev_xfermask(struct ata_port *ap, struct ata_device *dev); |
| 70 | static void ata_pio_error(struct ata_port *ap); | ||
| 71 | 70 | ||
| 72 | static unsigned int ata_unique_id = 1; | 71 | static unsigned int ata_unique_id = 1; |
| 73 | static struct workqueue_struct *ata_wq; | 72 | static struct workqueue_struct *ata_wq; |
| @@ -3132,114 +3131,6 @@ void ata_poll_qc_complete(struct ata_queued_cmd *qc) | |||
| 3132 | } | 3131 | } |
| 3133 | 3132 | ||
| 3134 | /** | 3133 | /** |
| 3135 | * ata_pio_poll - poll using PIO, depending on current state | ||
| 3136 | * @ap: the target ata_port | ||
| 3137 | * | ||
| 3138 | * LOCKING: | ||
| 3139 | * None. (executing in kernel thread context) | ||
| 3140 | * | ||
| 3141 | * RETURNS: | ||
| 3142 | * timeout value to use | ||
| 3143 | */ | ||
| 3144 | |||
| 3145 | static unsigned long ata_pio_poll(struct ata_port *ap) | ||
| 3146 | { | ||
| 3147 | struct ata_queued_cmd *qc; | ||
| 3148 | u8 status; | ||
| 3149 | unsigned int poll_state = HSM_ST_UNKNOWN; | ||
| 3150 | unsigned int reg_state = HSM_ST_UNKNOWN; | ||
| 3151 | |||
| 3152 | qc = ata_qc_from_tag(ap, ap->active_tag); | ||
| 3153 | WARN_ON(qc == NULL); | ||
| 3154 | |||
| 3155 | switch (ap->hsm_task_state) { | ||
| 3156 | case HSM_ST: | ||
| 3157 | case HSM_ST_POLL: | ||
| 3158 | poll_state = HSM_ST_POLL; | ||
| 3159 | reg_state = HSM_ST; | ||
| 3160 | break; | ||
| 3161 | case HSM_ST_LAST: | ||
| 3162 | case HSM_ST_LAST_POLL: | ||
| 3163 | poll_state = HSM_ST_LAST_POLL; | ||
| 3164 | reg_state = HSM_ST_LAST; | ||
| 3165 | break; | ||
| 3166 | default: | ||
| 3167 | BUG(); | ||
| 3168 | break; | ||
| 3169 | } | ||
| 3170 | |||
| 3171 | status = ata_chk_status(ap); | ||
| 3172 | if (status & ATA_BUSY) { | ||
| 3173 | if (time_after(jiffies, ap->pio_task_timeout)) { | ||
| 3174 | qc->err_mask |= AC_ERR_TIMEOUT; | ||
| 3175 | ap->hsm_task_state = HSM_ST_TMOUT; | ||
| 3176 | return 0; | ||
| 3177 | } | ||
| 3178 | ap->hsm_task_state = poll_state; | ||
| 3179 | return ATA_SHORT_PAUSE; | ||
| 3180 | } | ||
| 3181 | |||
| 3182 | ap->hsm_task_state = reg_state; | ||
| 3183 | return 0; | ||
| 3184 | } | ||
| 3185 | |||
| 3186 | /** | ||
| 3187 | * ata_pio_complete - check if drive is busy or idle | ||
| 3188 | * @ap: the target ata_port | ||
| 3189 | * | ||
| 3190 | * LOCKING: | ||
| 3191 | * None. (executing in kernel thread context) | ||
| 3192 | * | ||
| 3193 | * RETURNS: | ||
| 3194 | * Zero if qc completed. | ||
| 3195 | * Non-zero if has next. | ||
| 3196 | */ | ||
| 3197 | |||
| 3198 | static int ata_pio_complete (struct ata_port *ap) | ||
| 3199 | { | ||
| 3200 | struct ata_queued_cmd *qc; | ||
| 3201 | u8 drv_stat; | ||
| 3202 | |||
| 3203 | /* | ||
| 3204 | * This is purely heuristic. This is a fast path. Sometimes when | ||
| 3205 | * we enter, BSY will be cleared in a chk-status or two. If not, | ||
| 3206 | * the drive is probably seeking or something. Snooze for a couple | ||
| 3207 | * msecs, then chk-status again. If still busy, fall back to | ||
| 3208 | * HSM_ST_LAST_POLL state. | ||
| 3209 | */ | ||
| 3210 | drv_stat = ata_busy_wait(ap, ATA_BUSY, 10); | ||
| 3211 | if (drv_stat & ATA_BUSY) { | ||
| 3212 | msleep(2); | ||
| 3213 | drv_stat = ata_busy_wait(ap, ATA_BUSY, 10); | ||
| 3214 | if (drv_stat & ATA_BUSY) { | ||
| 3215 | ap->hsm_task_state = HSM_ST_LAST_POLL; | ||
| 3216 | ap->pio_task_timeout = jiffies + ATA_TMOUT_PIO; | ||
| 3217 | return 1; | ||
| 3218 | } | ||
| 3219 | } | ||
| 3220 | |||
| 3221 | qc = ata_qc_from_tag(ap, ap->active_tag); | ||
| 3222 | WARN_ON(qc == NULL); | ||
| 3223 | |||
| 3224 | drv_stat = ata_wait_idle(ap); | ||
| 3225 | if (!ata_ok(drv_stat)) { | ||
| 3226 | qc->err_mask |= __ac_err_mask(drv_stat); | ||
| 3227 | ap->hsm_task_state = HSM_ST_ERR; | ||
| 3228 | return 1; | ||
| 3229 | } | ||
| 3230 | |||
| 3231 | ap->hsm_task_state = HSM_ST_IDLE; | ||
| 3232 | |||
| 3233 | WARN_ON(qc->err_mask); | ||
| 3234 | ata_poll_qc_complete(qc); | ||
| 3235 | |||
| 3236 | /* another command may start at this point */ | ||
| 3237 | |||
| 3238 | return 0; | ||
| 3239 | } | ||
| 3240 | |||
| 3241 | |||
| 3242 | /** | ||
| 3243 | * swap_buf_le16 - swap halves of 16-bit words in place | 3134 | * swap_buf_le16 - swap halves of 16-bit words in place |
| 3244 | * @buf: Buffer to swap | 3135 | * @buf: Buffer to swap |
| 3245 | * @buf_words: Number of 16-bit words in buffer. | 3136 | * @buf_words: Number of 16-bit words in buffer. |
| @@ -3497,91 +3388,6 @@ static void atapi_send_cdb(struct ata_port *ap, struct ata_queued_cmd *qc) | |||
| 3497 | } | 3388 | } |
| 3498 | 3389 | ||
| 3499 | /** | 3390 | /** |
| 3500 | * ata_pio_first_block - Write first data block to hardware | ||
| 3501 | * @ap: Port to which ATA/ATAPI device is attached. | ||
| 3502 | * | ||
| 3503 | * When device has indicated its readiness to accept | ||
| 3504 | * the data, this function sends out the CDB or | ||
| 3505 | * the first data block by PIO. | ||
| 3506 | * After this, | ||
| 3507 | * - If polling, ata_pio_task() handles the rest. | ||
| 3508 | * - Otherwise, interrupt handler takes over. | ||
| 3509 | * | ||
| 3510 | * LOCKING: | ||
| 3511 | * Kernel thread context (may sleep) | ||
| 3512 | * | ||
| 3513 | * RETURNS: | ||
| 3514 | * Zero if irq handler takes over | ||
| 3515 | * Non-zero if has next (polling). | ||
| 3516 | */ | ||
| 3517 | |||
| 3518 | static int ata_pio_first_block(struct ata_port *ap) | ||
| 3519 | { | ||
| 3520 | struct ata_queued_cmd *qc; | ||
| 3521 | u8 status; | ||
| 3522 | unsigned long flags; | ||
| 3523 | int has_next; | ||
| 3524 | |||
| 3525 | qc = ata_qc_from_tag(ap, ap->active_tag); | ||
| 3526 | WARN_ON(qc == NULL); | ||
| 3527 | WARN_ON((qc->flags & ATA_QCFLAG_ACTIVE) == 0); | ||
| 3528 | |||
| 3529 | /* if polling, we will stay in the work queue after sending the data. | ||
| 3530 | * otherwise, interrupt handler takes over after sending the data. | ||
| 3531 | */ | ||
| 3532 | has_next = (qc->tf.flags & ATA_TFLAG_POLLING); | ||
| 3533 | |||
| 3534 | /* sleep-wait for BSY to clear */ | ||
| 3535 | DPRINTK("busy wait\n"); | ||
| 3536 | if (ata_busy_sleep(ap, ATA_TMOUT_DATAOUT_QUICK, ATA_TMOUT_DATAOUT)) { | ||
| 3537 | qc->err_mask |= AC_ERR_TIMEOUT; | ||
| 3538 | ap->hsm_task_state = HSM_ST_TMOUT; | ||
| 3539 | goto err_out; | ||
| 3540 | } | ||
| 3541 | |||
| 3542 | /* make sure DRQ is set */ | ||
| 3543 | status = ata_chk_status(ap); | ||
| 3544 | if ((status & (ATA_BUSY | ATA_DRQ)) != ATA_DRQ) { | ||
| 3545 | /* device status error */ | ||
| 3546 | qc->err_mask |= AC_ERR_HSM; | ||
| 3547 | ap->hsm_task_state = HSM_ST_ERR; | ||
| 3548 | goto err_out; | ||
| 3549 | } | ||
| 3550 | |||
| 3551 | /* Send the CDB (atapi) or the first data block (ata pio out). | ||
| 3552 | * During the state transition, interrupt handler shouldn't | ||
| 3553 | * be invoked before the data transfer is complete and | ||
| 3554 | * hsm_task_state is changed. Hence, the following locking. | ||
| 3555 | */ | ||
| 3556 | spin_lock_irqsave(&ap->host_set->lock, flags); | ||
| 3557 | |||
| 3558 | if (qc->tf.protocol == ATA_PROT_PIO) { | ||
| 3559 | /* PIO data out protocol. | ||
| 3560 | * send first data block. | ||
| 3561 | */ | ||
| 3562 | |||
| 3563 | /* ata_pio_sectors() might change the state to HSM_ST_LAST. | ||
| 3564 | * so, the state is changed here before ata_pio_sectors(). | ||
| 3565 | */ | ||
| 3566 | ap->hsm_task_state = HSM_ST; | ||
| 3567 | ata_pio_sectors(qc); | ||
| 3568 | ata_altstatus(ap); /* flush */ | ||
| 3569 | } else | ||
| 3570 | /* send CDB */ | ||
| 3571 | atapi_send_cdb(ap, qc); | ||
| 3572 | |||
| 3573 | spin_unlock_irqrestore(&ap->host_set->lock, flags); | ||
| 3574 | |||
| 3575 | /* if polling, ata_pio_task() handles the rest. | ||
| 3576 | * otherwise, interrupt handler takes over from here. | ||
| 3577 | */ | ||
| 3578 | return has_next; | ||
| 3579 | |||
| 3580 | err_out: | ||
| 3581 | return 1; /* has next */ | ||
| 3582 | } | ||
| 3583 | |||
| 3584 | /** | ||
| 3585 | * __atapi_pio_bytes - Transfer data from/to the ATAPI device. | 3391 | * __atapi_pio_bytes - Transfer data from/to the ATAPI device. |
| 3586 | * @qc: Command on going | 3392 | * @qc: Command on going |
| 3587 | * @bytes: number of bytes | 3393 | * @bytes: number of bytes |
| @@ -3721,91 +3527,6 @@ err_out: | |||
| 3721 | } | 3527 | } |
| 3722 | 3528 | ||
| 3723 | /** | 3529 | /** |
| 3724 | * ata_pio_block - start PIO on a block | ||
| 3725 | * @ap: the target ata_port | ||
| 3726 | * | ||
| 3727 | * LOCKING: | ||
| 3728 | * None. (executing in kernel thread context) | ||
| 3729 | */ | ||
| 3730 | |||
| 3731 | static void ata_pio_block(struct ata_port *ap) | ||
| 3732 | { | ||
| 3733 | struct ata_queued_cmd *qc; | ||
| 3734 | u8 status; | ||
| 3735 | |||
| 3736 | /* | ||
| 3737 | * This is purely heuristic. This is a fast path. | ||
| 3738 | * Sometimes when we enter, BSY will be cleared in | ||
| 3739 | * a chk-status or two. If not, the drive is probably seeking | ||
| 3740 | * or something. Snooze for a couple msecs, then | ||
| 3741 | * chk-status again. If still busy, fall back to | ||
| 3742 | * HSM_ST_POLL state. | ||
| 3743 | */ | ||
| 3744 | status = ata_busy_wait(ap, ATA_BUSY, 5); | ||
| 3745 | if (status & ATA_BUSY) { | ||
| 3746 | msleep(2); | ||
| 3747 | status = ata_busy_wait(ap, ATA_BUSY, 10); | ||
| 3748 | if (status & ATA_BUSY) { | ||
| 3749 | ap->hsm_task_state = HSM_ST_POLL; | ||
| 3750 | ap->pio_task_timeout = jiffies + ATA_TMOUT_PIO; | ||
| 3751 | return; | ||
| 3752 | } | ||
| 3753 | } | ||
| 3754 | |||
| 3755 | qc = ata_qc_from_tag(ap, ap->active_tag); | ||
| 3756 | WARN_ON(qc == NULL); | ||
| 3757 | |||
| 3758 | /* check error */ | ||
| 3759 | if (status & (ATA_ERR | ATA_DF)) { | ||
| 3760 | qc->err_mask |= AC_ERR_DEV; | ||
| 3761 | ap->hsm_task_state = HSM_ST_ERR; | ||
| 3762 | return; | ||
| 3763 | } | ||
| 3764 | |||
| 3765 | /* transfer data if any */ | ||
| 3766 | if (is_atapi_taskfile(&qc->tf)) { | ||
| 3767 | /* DRQ=0 means no more data to transfer */ | ||
| 3768 | if ((status & ATA_DRQ) == 0) { | ||
| 3769 | ap->hsm_task_state = HSM_ST_LAST; | ||
| 3770 | return; | ||
| 3771 | } | ||
| 3772 | |||
| 3773 | atapi_pio_bytes(qc); | ||
| 3774 | } else { | ||
| 3775 | /* handle BSY=0, DRQ=0 as error */ | ||
| 3776 | if ((status & ATA_DRQ) == 0) { | ||
| 3777 | qc->err_mask |= AC_ERR_HSM; | ||
| 3778 | ap->hsm_task_state = HSM_ST_ERR; | ||
| 3779 | return; | ||
| 3780 | } | ||
| 3781 | |||
| 3782 | ata_pio_sectors(qc); | ||
| 3783 | } | ||
| 3784 | |||
| 3785 | ata_altstatus(ap); /* flush */ | ||
| 3786 | } | ||
| 3787 | |||
| 3788 | static void ata_pio_error(struct ata_port *ap) | ||
| 3789 | { | ||
| 3790 | struct ata_queued_cmd *qc; | ||
| 3791 | |||
| 3792 | qc = ata_qc_from_tag(ap, ap->active_tag); | ||
| 3793 | WARN_ON(qc == NULL); | ||
| 3794 | |||
| 3795 | if (qc->tf.command != ATA_CMD_PACKET) | ||
| 3796 | printk(KERN_WARNING "ata%u: PIO error\n", ap->id); | ||
| 3797 | |||
| 3798 | /* make sure qc->err_mask is available to | ||
| 3799 | * know what's wrong and recover | ||
| 3800 | */ | ||
| 3801 | WARN_ON(qc->err_mask == 0); | ||
| 3802 | |||
| 3803 | ap->hsm_task_state = HSM_ST_IDLE; | ||
| 3804 | |||
| 3805 | ata_poll_qc_complete(qc); | ||
| 3806 | } | ||
| 3807 | |||
| 3808 | /** | ||
| 3809 | * ata_hsm_move - move the HSM to the next state. | 3530 | * ata_hsm_move - move the HSM to the next state. |
| 3810 | * @ap: the target ata_port | 3531 | * @ap: the target ata_port |
| 3811 | * @qc: qc on going | 3532 | * @qc: qc on going |
diff --git a/include/linux/libata.h b/include/linux/libata.h index 70ca99bbc6c7..0eb71c1773a1 100644 --- a/include/linux/libata.h +++ b/include/linux/libata.h | |||
| @@ -162,13 +162,8 @@ enum { | |||
| 162 | ATA_QCFLAG_EH_SCHEDULED = (1 << 5), /* EH scheduled */ | 162 | ATA_QCFLAG_EH_SCHEDULED = (1 << 5), /* EH scheduled */ |
| 163 | 163 | ||
| 164 | /* various lengths of time */ | 164 | /* various lengths of time */ |
| 165 | ATA_TMOUT_PIO = 30 * HZ, | ||
| 166 | ATA_TMOUT_BOOT = 30 * HZ, /* heuristic */ | 165 | ATA_TMOUT_BOOT = 30 * HZ, /* heuristic */ |
| 167 | ATA_TMOUT_BOOT_QUICK = 7 * HZ, /* heuristic */ | 166 | ATA_TMOUT_BOOT_QUICK = 7 * HZ, /* heuristic */ |
| 168 | ATA_TMOUT_DATAOUT = 30 * HZ, | ||
| 169 | ATA_TMOUT_DATAOUT_QUICK = 5 * HZ, | ||
| 170 | ATA_TMOUT_CDB = 30 * HZ, | ||
| 171 | ATA_TMOUT_CDB_QUICK = 5 * HZ, | ||
| 172 | ATA_TMOUT_INTERNAL = 30 * HZ, | 167 | ATA_TMOUT_INTERNAL = 30 * HZ, |
| 173 | ATA_TMOUT_INTERNAL_QUICK = 5 * HZ, | 168 | ATA_TMOUT_INTERNAL_QUICK = 5 * HZ, |
| 174 | 169 | ||
| @@ -216,11 +211,8 @@ enum { | |||
| 216 | enum hsm_task_states { | 211 | enum hsm_task_states { |
| 217 | HSM_ST_UNKNOWN, /* state unknown */ | 212 | HSM_ST_UNKNOWN, /* state unknown */ |
| 218 | HSM_ST_IDLE, /* no command on going */ | 213 | HSM_ST_IDLE, /* no command on going */ |
| 219 | HSM_ST_POLL, /* same as HSM_ST, waits longer */ | ||
| 220 | HSM_ST_TMOUT, /* timeout */ | ||
| 221 | HSM_ST, /* (waiting the device to) transfer data */ | 214 | HSM_ST, /* (waiting the device to) transfer data */ |
| 222 | HSM_ST_LAST, /* (waiting the device to) complete command */ | 215 | HSM_ST_LAST, /* (waiting the device to) complete command */ |
| 223 | HSM_ST_LAST_POLL, /* same as HSM_ST_LAST, waits longer */ | ||
| 224 | HSM_ST_ERR, /* error */ | 216 | HSM_ST_ERR, /* error */ |
| 225 | HSM_ST_FIRST, /* (waiting the device to) | 217 | HSM_ST_FIRST, /* (waiting the device to) |
| 226 | write CDB or first data block */ | 218 | write CDB or first data block */ |
| @@ -409,7 +401,6 @@ struct ata_port { | |||
| 409 | struct work_struct port_task; | 401 | struct work_struct port_task; |
| 410 | 402 | ||
| 411 | unsigned int hsm_task_state; | 403 | unsigned int hsm_task_state; |
| 412 | unsigned long pio_task_timeout; | ||
| 413 | 404 | ||
| 414 | u32 msg_enable; | 405 | u32 msg_enable; |
| 415 | struct list_head eh_done_q; | 406 | struct list_head eh_done_q; |
