aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata/libata-core.c
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2010-05-10 15:41:30 -0400
committerJeff Garzik <jgarzik@redhat.com>2010-05-17 22:49:02 -0400
commit3e4ec3443f70fbe144799ccf0b1c3797f78d1715 (patch)
treecfb297e42075baacbbabfb6034e3e7c9a44c73b2 /drivers/ata/libata-core.c
parentc7a8209f766961eea4cfc6f22d2d6e06ef63546c (diff)
libata: kill ATA_FLAG_DISABLED
ATA_FLAG_DISABLED is only used by drivers which don't use ->error_handler framework and is largely broken. Its only meaningful function is to make irq handlers skip processing if the flag is set, which is largely useless and even harmful as it makes those ports more likely to cause IRQ storms. Kill ATA_FLAG_DISABLED and makes the callers disable attached devices instead. ata_port_probe() and ata_port_disable() which manipulate the flag are also killed. This simplifies condition check in IRQ handlers. While updating IRQ handlers, remove ap NULL check as libata guarantees consecutive port allocation (unoccupied ports are initialized with dummies) and long-obsolete ATA_QCFLAG_ACTIVE check (checked by ata_qc_from_tag()). 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.c66
1 files changed, 1 insertions, 65 deletions
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index 86f405b4831..3d8b62f7441 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -1907,22 +1907,6 @@ unsigned ata_exec_internal_sg(struct ata_device *dev,
1907 ap->qc_active = preempted_qc_active; 1907 ap->qc_active = preempted_qc_active;
1908 ap->nr_active_links = preempted_nr_active_links; 1908 ap->nr_active_links = preempted_nr_active_links;
1909 1909
1910 /* XXX - Some LLDDs (sata_mv) disable port on command failure.
1911 * Until those drivers are fixed, we detect the condition
1912 * here, fail the command with AC_ERR_SYSTEM and reenable the
1913 * port.
1914 *
1915 * Note that this doesn't change any behavior as internal
1916 * command failure results in disabling the device in the
1917 * higher layer for LLDDs without new reset/EH callbacks.
1918 *
1919 * Kill the following code as soon as those drivers are fixed.
1920 */
1921 if (ap->flags & ATA_FLAG_DISABLED) {
1922 err_mask |= AC_ERR_SYSTEM;
1923 ata_port_probe(ap);
1924 }
1925
1926 spin_unlock_irqrestore(ap->lock, flags); 1910 spin_unlock_irqrestore(ap->lock, flags);
1927 1911
1928 if ((err_mask & AC_ERR_TIMEOUT) && auto_timeout) 1912 if ((err_mask & AC_ERR_TIMEOUT) && auto_timeout)
@@ -2768,8 +2752,6 @@ int ata_bus_probe(struct ata_port *ap)
2768 int rc; 2752 int rc;
2769 struct ata_device *dev; 2753 struct ata_device *dev;
2770 2754
2771 ata_port_probe(ap);
2772
2773 ata_for_each_dev(dev, &ap->link, ALL) 2755 ata_for_each_dev(dev, &ap->link, ALL)
2774 tries[dev->devno] = ATA_PROBE_MAX_TRIES; 2756 tries[dev->devno] = ATA_PROBE_MAX_TRIES;
2775 2757
@@ -2797,8 +2779,7 @@ int ata_bus_probe(struct ata_port *ap)
2797 ap->ops->phy_reset(ap); 2779 ap->ops->phy_reset(ap);
2798 2780
2799 ata_for_each_dev(dev, &ap->link, ALL) { 2781 ata_for_each_dev(dev, &ap->link, ALL) {
2800 if (!(ap->flags & ATA_FLAG_DISABLED) && 2782 if (dev->class != ATA_DEV_UNKNOWN)
2801 dev->class != ATA_DEV_UNKNOWN)
2802 classes[dev->devno] = dev->class; 2783 classes[dev->devno] = dev->class;
2803 else 2784 else
2804 classes[dev->devno] = ATA_DEV_NONE; 2785 classes[dev->devno] = ATA_DEV_NONE;
@@ -2806,8 +2787,6 @@ int ata_bus_probe(struct ata_port *ap)
2806 dev->class = ATA_DEV_UNKNOWN; 2787 dev->class = ATA_DEV_UNKNOWN;
2807 } 2788 }
2808 2789
2809 ata_port_probe(ap);
2810
2811 /* read IDENTIFY page and configure devices. We have to do the identify 2790 /* read IDENTIFY page and configure devices. We have to do the identify
2812 specific sequence bass-ackwards so that PDIAG- is released by 2791 specific sequence bass-ackwards so that PDIAG- is released by
2813 the slave device */ 2792 the slave device */
@@ -2857,8 +2836,6 @@ int ata_bus_probe(struct ata_port *ap)
2857 ata_for_each_dev(dev, &ap->link, ENABLED) 2836 ata_for_each_dev(dev, &ap->link, ENABLED)
2858 return 0; 2837 return 0;
2859 2838
2860 /* no device present, disable port */
2861 ata_port_disable(ap);
2862 return -ENODEV; 2839 return -ENODEV;
2863 2840
2864 fail: 2841 fail:
@@ -2890,22 +2867,6 @@ int ata_bus_probe(struct ata_port *ap)
2890} 2867}
2891 2868
2892/** 2869/**
2893 * ata_port_probe - Mark port as enabled
2894 * @ap: Port for which we indicate enablement
2895 *
2896 * Modify @ap data structure such that the system
2897 * thinks that the entire port is enabled.
2898 *
2899 * LOCKING: host lock, or some other form of
2900 * serialization.
2901 */
2902
2903void ata_port_probe(struct ata_port *ap)
2904{
2905 ap->flags &= ~ATA_FLAG_DISABLED;
2906}
2907
2908/**
2909 * sata_print_link_status - Print SATA link status 2870 * sata_print_link_status - Print SATA link status
2910 * @link: SATA link to printk link status about 2871 * @link: SATA link to printk link status about
2911 * 2872 *
@@ -2952,26 +2913,6 @@ struct ata_device *ata_dev_pair(struct ata_device *adev)
2952} 2913}
2953 2914
2954/** 2915/**
2955 * ata_port_disable - Disable port.
2956 * @ap: Port to be disabled.
2957 *
2958 * Modify @ap data structure such that the system
2959 * thinks that the entire port is disabled, and should
2960 * never attempt to probe or communicate with devices
2961 * on this port.
2962 *
2963 * LOCKING: host lock, or some other form of
2964 * serialization.
2965 */
2966
2967void ata_port_disable(struct ata_port *ap)
2968{
2969 ap->link.device[0].class = ATA_DEV_NONE;
2970 ap->link.device[1].class = ATA_DEV_NONE;
2971 ap->flags |= ATA_FLAG_DISABLED;
2972}
2973
2974/**
2975 * sata_down_spd_limit - adjust SATA spd limit downward 2916 * sata_down_spd_limit - adjust SATA spd limit downward
2976 * @link: Link to adjust SATA spd limit for 2917 * @link: Link to adjust SATA spd limit for
2977 * @spd_limit: Additional limit 2918 * @spd_limit: Additional limit
@@ -5716,7 +5657,6 @@ struct ata_port *ata_port_alloc(struct ata_host *host)
5716 5657
5717 ap->pflags |= ATA_PFLAG_INITIALIZING; 5658 ap->pflags |= ATA_PFLAG_INITIALIZING;
5718 ap->lock = &host->lock; 5659 ap->lock = &host->lock;
5719 ap->flags = ATA_FLAG_DISABLED;
5720 ap->print_id = -1; 5660 ap->print_id = -1;
5721 ap->ctl = ATA_DEVCTL_OBS; 5661 ap->ctl = ATA_DEVCTL_OBS;
5722 ap->host = host; 5662 ap->host = host;
@@ -6145,8 +6085,6 @@ static void async_port_probe(void *data, async_cookie_t cookie)
6145 struct ata_eh_info *ehi = &ap->link.eh_info; 6085 struct ata_eh_info *ehi = &ap->link.eh_info;
6146 unsigned long flags; 6086 unsigned long flags;
6147 6087
6148 ata_port_probe(ap);
6149
6150 /* kick EH for boot probing */ 6088 /* kick EH for boot probing */
6151 spin_lock_irqsave(ap->lock, flags); 6089 spin_lock_irqsave(ap->lock, flags);
6152 6090
@@ -6823,7 +6761,6 @@ EXPORT_SYMBOL_GPL(ata_port_start);
6823EXPORT_SYMBOL_GPL(ata_do_set_mode); 6761EXPORT_SYMBOL_GPL(ata_do_set_mode);
6824EXPORT_SYMBOL_GPL(ata_std_qc_defer); 6762EXPORT_SYMBOL_GPL(ata_std_qc_defer);
6825EXPORT_SYMBOL_GPL(ata_noop_qc_prep); 6763EXPORT_SYMBOL_GPL(ata_noop_qc_prep);
6826EXPORT_SYMBOL_GPL(ata_port_probe);
6827EXPORT_SYMBOL_GPL(ata_dev_disable); 6764EXPORT_SYMBOL_GPL(ata_dev_disable);
6828EXPORT_SYMBOL_GPL(sata_set_spd); 6765EXPORT_SYMBOL_GPL(sata_set_spd);
6829EXPORT_SYMBOL_GPL(ata_wait_after_reset); 6766EXPORT_SYMBOL_GPL(ata_wait_after_reset);
@@ -6835,7 +6772,6 @@ EXPORT_SYMBOL_GPL(sata_std_hardreset);
6835EXPORT_SYMBOL_GPL(ata_std_postreset); 6772EXPORT_SYMBOL_GPL(ata_std_postreset);
6836EXPORT_SYMBOL_GPL(ata_dev_classify); 6773EXPORT_SYMBOL_GPL(ata_dev_classify);
6837EXPORT_SYMBOL_GPL(ata_dev_pair); 6774EXPORT_SYMBOL_GPL(ata_dev_pair);
6838EXPORT_SYMBOL_GPL(ata_port_disable);
6839EXPORT_SYMBOL_GPL(ata_ratelimit); 6775EXPORT_SYMBOL_GPL(ata_ratelimit);
6840EXPORT_SYMBOL_GPL(ata_wait_register); 6776EXPORT_SYMBOL_GPL(ata_wait_register);
6841EXPORT_SYMBOL_GPL(ata_scsi_queuecmd); 6777EXPORT_SYMBOL_GPL(ata_scsi_queuecmd);