aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata/libata-core.c
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2010-05-10 15:41:38 -0400
committerJeff Garzik <jgarzik@redhat.com>2010-05-19 13:35:49 -0400
commitc429137a67b82788d24682153bb9c96501a9ef34 (patch)
treeb24ed75908f08cc9cddb19efc74fcb46be75de8f /drivers/ata/libata-core.c
parent5fe7454aa9c6ef5fcf506b0f2dfc20f696891f1a (diff)
libata-sff: port_task is SFF specific
port_task is tightly bound to the standard SFF PIO HSM implementation. Using it for any other purpose would be error-prone and there's no such user and if some drivers need such feature, it would be much better off using its own. Move it inside CONFIG_ATA_SFF and rename it to sff_pio_task. The only function which is exposed to the core layer is ata_sff_flush_pio_task() which is renamed from ata_port_flush_task() and now also takes care of resetting hsm_task_state to HSM_ST_IDLE, which is possible as it's now specific to PIO HSM. Signed-off-by: Tejun Heo <tj@kernel.org> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
Diffstat (limited to 'drivers/ata/libata-core.c')
-rw-r--r--drivers/ata/libata-core.c69
1 files changed, 1 insertions, 68 deletions
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index bf6ffc1273a..c47373f01f8 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -97,7 +97,6 @@ static void ata_dev_xfermask(struct ata_device *dev);
97static unsigned long ata_dev_blacklisted(const struct ata_device *dev); 97static unsigned long ata_dev_blacklisted(const struct ata_device *dev);
98 98
99unsigned int ata_print_id = 1; 99unsigned int ata_print_id = 1;
100static struct workqueue_struct *ata_wq;
101 100
102struct workqueue_struct *ata_aux_wq; 101struct workqueue_struct *ata_aux_wq;
103 102
@@ -1686,52 +1685,6 @@ unsigned long ata_id_xfermask(const u16 *id)
1686 return ata_pack_xfermask(pio_mask, mwdma_mask, udma_mask); 1685 return ata_pack_xfermask(pio_mask, mwdma_mask, udma_mask);
1687} 1686}
1688 1687
1689/**
1690 * ata_pio_queue_task - Queue port_task
1691 * @ap: The ata_port to queue port_task for
1692 * @data: data for @fn to use
1693 * @delay: delay time in msecs for workqueue function
1694 *
1695 * Schedule @fn(@data) for execution after @delay jiffies using
1696 * port_task. There is one port_task per port and it's the
1697 * user(low level driver)'s responsibility to make sure that only
1698 * one task is active at any given time.
1699 *
1700 * libata core layer takes care of synchronization between
1701 * port_task and EH. ata_pio_queue_task() may be ignored for EH
1702 * synchronization.
1703 *
1704 * LOCKING:
1705 * Inherited from caller.
1706 */
1707void ata_pio_queue_task(struct ata_port *ap, void *data, unsigned long delay)
1708{
1709 ap->port_task_data = data;
1710
1711 /* may fail if ata_port_flush_task() in progress */
1712 queue_delayed_work(ata_wq, &ap->port_task, msecs_to_jiffies(delay));
1713}
1714
1715/**
1716 * ata_port_flush_task - Flush port_task
1717 * @ap: The ata_port to flush port_task for
1718 *
1719 * After this function completes, port_task is guranteed not to
1720 * be running or scheduled.
1721 *
1722 * LOCKING:
1723 * Kernel thread context (may sleep)
1724 */
1725void ata_port_flush_task(struct ata_port *ap)
1726{
1727 DPRINTK("ENTER\n");
1728
1729 cancel_rearming_delayed_work(&ap->port_task);
1730
1731 if (ata_msg_ctl(ap))
1732 ata_port_printk(ap, KERN_DEBUG, "%s: EXIT\n", __func__);
1733}
1734
1735static void ata_qc_complete_internal(struct ata_queued_cmd *qc) 1688static void ata_qc_complete_internal(struct ata_queued_cmd *qc)
1736{ 1689{
1737 struct completion *waiting = qc->private_data; 1690 struct completion *waiting = qc->private_data;
@@ -1853,7 +1806,7 @@ unsigned ata_exec_internal_sg(struct ata_device *dev,
1853 1806
1854 rc = wait_for_completion_timeout(&wait, msecs_to_jiffies(timeout)); 1807 rc = wait_for_completion_timeout(&wait, msecs_to_jiffies(timeout));
1855 1808
1856 ata_port_flush_task(ap); 1809 ata_sff_flush_pio_task(ap);
1857 1810
1858 if (!rc) { 1811 if (!rc) {
1859 spin_lock_irqsave(ap->lock, flags); 1812 spin_lock_irqsave(ap->lock, flags);
@@ -5646,11 +5599,6 @@ struct ata_port *ata_port_alloc(struct ata_host *host)
5646 ap->msg_enable = ATA_MSG_DRV | ATA_MSG_ERR | ATA_MSG_WARN; 5599 ap->msg_enable = ATA_MSG_DRV | ATA_MSG_ERR | ATA_MSG_WARN;
5647#endif 5600#endif
5648 5601
5649#ifdef CONFIG_ATA_SFF
5650 INIT_DELAYED_WORK(&ap->port_task, ata_pio_task);
5651#else
5652 INIT_DELAYED_WORK(&ap->port_task, NULL);
5653#endif
5654 INIT_DELAYED_WORK(&ap->hotplug_task, ata_scsi_hotplug); 5602 INIT_DELAYED_WORK(&ap->hotplug_task, ata_scsi_hotplug);
5655 INIT_WORK(&ap->scsi_rescan_task, ata_scsi_dev_rescan); 5603 INIT_WORK(&ap->scsi_rescan_task, ata_scsi_dev_rescan);
5656 INIT_LIST_HEAD(&ap->eh_done_q); 5604 INIT_LIST_HEAD(&ap->eh_done_q);
@@ -6588,17 +6536,6 @@ static int __init ata_init(void)
6588 6536
6589 ata_parse_force_param(); 6537 ata_parse_force_param();
6590 6538
6591 /*
6592 * FIXME: In UP case, there is only one workqueue thread and if you
6593 * have more than one PIO device, latency is bloody awful, with
6594 * occasional multi-second "hiccups" as one PIO device waits for
6595 * another. It's an ugly wart that users DO occasionally complain
6596 * about; luckily most users have at most one PIO polled device.
6597 */
6598 ata_wq = create_workqueue("ata");
6599 if (!ata_wq)
6600 goto fail;
6601
6602 ata_aux_wq = create_singlethread_workqueue("ata_aux"); 6539 ata_aux_wq = create_singlethread_workqueue("ata_aux");
6603 if (!ata_aux_wq) 6540 if (!ata_aux_wq)
6604 goto fail; 6541 goto fail;
@@ -6612,8 +6549,6 @@ static int __init ata_init(void)
6612 6549
6613fail: 6550fail:
6614 kfree(ata_force_tbl); 6551 kfree(ata_force_tbl);
6615 if (ata_wq)
6616 destroy_workqueue(ata_wq);
6617 if (ata_aux_wq) 6552 if (ata_aux_wq)
6618 destroy_workqueue(ata_aux_wq); 6553 destroy_workqueue(ata_aux_wq);
6619 return rc; 6554 return rc;
@@ -6623,7 +6558,6 @@ static void __exit ata_exit(void)
6623{ 6558{
6624 ata_sff_exit(); 6559 ata_sff_exit();
6625 kfree(ata_force_tbl); 6560 kfree(ata_force_tbl);
6626 destroy_workqueue(ata_wq);
6627 destroy_workqueue(ata_aux_wq); 6561 destroy_workqueue(ata_aux_wq);
6628} 6562}
6629 6563
@@ -6777,7 +6711,6 @@ EXPORT_SYMBOL_GPL(ata_id_c_string);
6777EXPORT_SYMBOL_GPL(ata_do_dev_read_id); 6711EXPORT_SYMBOL_GPL(ata_do_dev_read_id);
6778EXPORT_SYMBOL_GPL(ata_scsi_simulate); 6712EXPORT_SYMBOL_GPL(ata_scsi_simulate);
6779 6713
6780EXPORT_SYMBOL_GPL(ata_pio_queue_task);
6781EXPORT_SYMBOL_GPL(ata_pio_need_iordy); 6714EXPORT_SYMBOL_GPL(ata_pio_need_iordy);
6782EXPORT_SYMBOL_GPL(ata_timing_find_mode); 6715EXPORT_SYMBOL_GPL(ata_timing_find_mode);
6783EXPORT_SYMBOL_GPL(ata_timing_compute); 6716EXPORT_SYMBOL_GPL(ata_timing_compute);