diff options
author | Tejun Heo <htejun@gmail.com> | 2007-07-05 00:31:27 -0400 |
---|---|---|
committer | Jeff Garzik <jeff@garzik.org> | 2007-07-10 21:30:33 -0400 |
commit | 75683fe7153c3817bb4fd4491e2a5913af6c463e (patch) | |
tree | 5c7bb12e577a328b41df16d036c7060309493f44 | |
parent | 39ce7128066f2ac5954bcda9f07f429f28166da3 (diff) |
libata: clean up horkage handling
Horkage handling had the following problems.
* dev->horkage was positioned after ATA_DEVICE_CLEAR_OFFSET, so it was
cleared before the device is configured. This broke
HORKAGE_DIAGNOSTIC.
* Some used dev->horkage while others called ata_device_blacklisted()
directly. This was at best confusing.
This patch moves dev->horkage right after dev->flags and set the field
according to the blacklist during device configuration. All users
test against dev->horkage. ata_device_blacklisted() now has only one
user, make it static. While at it, rename it to ata_dev_blacklisted()
for consistency.
Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
-rw-r--r-- | drivers/ata/libata-core.c | 13 | ||||
-rw-r--r-- | include/linux/libata.h | 3 |
2 files changed, 9 insertions, 7 deletions
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index a00e4ee58b73..66c8c8c377ab 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c | |||
@@ -71,6 +71,7 @@ static unsigned int ata_dev_init_params(struct ata_device *dev, | |||
71 | u16 heads, u16 sectors); | 71 | u16 heads, u16 sectors); |
72 | static unsigned int ata_dev_set_xfermode(struct ata_device *dev); | 72 | static unsigned int ata_dev_set_xfermode(struct ata_device *dev); |
73 | static void ata_dev_xfermask(struct ata_device *dev); | 73 | static void ata_dev_xfermask(struct ata_device *dev); |
74 | static unsigned long ata_dev_blacklisted(const struct ata_device *dev); | ||
74 | 75 | ||
75 | unsigned int ata_print_id = 1; | 76 | unsigned int ata_print_id = 1; |
76 | static struct workqueue_struct *ata_wq; | 77 | static struct workqueue_struct *ata_wq; |
@@ -1784,7 +1785,7 @@ static void ata_dev_config_ncq(struct ata_device *dev, | |||
1784 | desc[0] = '\0'; | 1785 | desc[0] = '\0'; |
1785 | return; | 1786 | return; |
1786 | } | 1787 | } |
1787 | if (ata_device_blacklisted(dev) & ATA_HORKAGE_NONCQ) { | 1788 | if (dev->horkage & ATA_HORKAGE_NONCQ) { |
1788 | snprintf(desc, desc_sz, "NCQ (not used)"); | 1789 | snprintf(desc, desc_sz, "NCQ (not used)"); |
1789 | return; | 1790 | return; |
1790 | } | 1791 | } |
@@ -1833,6 +1834,9 @@ int ata_dev_configure(struct ata_device *dev) | |||
1833 | if (ata_msg_probe(ap)) | 1834 | if (ata_msg_probe(ap)) |
1834 | ata_dev_printk(dev, KERN_DEBUG, "%s: ENTER\n", __FUNCTION__); | 1835 | ata_dev_printk(dev, KERN_DEBUG, "%s: ENTER\n", __FUNCTION__); |
1835 | 1836 | ||
1837 | /* set horkage */ | ||
1838 | dev->horkage |= ata_dev_blacklisted(dev); | ||
1839 | |||
1836 | /* let ACPI work its magic */ | 1840 | /* let ACPI work its magic */ |
1837 | rc = ata_acpi_on_devcfg(dev); | 1841 | rc = ata_acpi_on_devcfg(dev); |
1838 | if (rc) | 1842 | if (rc) |
@@ -2008,7 +2012,7 @@ int ata_dev_configure(struct ata_device *dev) | |||
2008 | dev->max_sectors = ATA_MAX_SECTORS; | 2012 | dev->max_sectors = ATA_MAX_SECTORS; |
2009 | } | 2013 | } |
2010 | 2014 | ||
2011 | if (ata_device_blacklisted(dev) & ATA_HORKAGE_MAX_SEC_128) | 2015 | if (dev->horkage & ATA_HORKAGE_MAX_SEC_128) |
2012 | dev->max_sectors = min_t(unsigned int, ATA_MAX_SECTORS_128, | 2016 | dev->max_sectors = min_t(unsigned int, ATA_MAX_SECTORS_128, |
2013 | dev->max_sectors); | 2017 | dev->max_sectors); |
2014 | 2018 | ||
@@ -3775,7 +3779,7 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = { | |||
3775 | { } | 3779 | { } |
3776 | }; | 3780 | }; |
3777 | 3781 | ||
3778 | unsigned long ata_device_blacklisted(const struct ata_device *dev) | 3782 | static unsigned long ata_dev_blacklisted(const struct ata_device *dev) |
3779 | { | 3783 | { |
3780 | unsigned char model_num[ATA_ID_PROD_LEN + 1]; | 3784 | unsigned char model_num[ATA_ID_PROD_LEN + 1]; |
3781 | unsigned char model_rev[ATA_ID_FW_REV_LEN + 1]; | 3785 | unsigned char model_rev[ATA_ID_FW_REV_LEN + 1]; |
@@ -3805,7 +3809,7 @@ static int ata_dma_blacklisted(const struct ata_device *dev) | |||
3805 | if ((dev->ap->flags & ATA_FLAG_PIO_POLLING) && | 3809 | if ((dev->ap->flags & ATA_FLAG_PIO_POLLING) && |
3806 | (dev->flags & ATA_DFLAG_CDB_INTR)) | 3810 | (dev->flags & ATA_DFLAG_CDB_INTR)) |
3807 | return 1; | 3811 | return 1; |
3808 | return (ata_device_blacklisted(dev) & ATA_HORKAGE_NODMA) ? 1 : 0; | 3812 | return (dev->horkage & ATA_HORKAGE_NODMA) ? 1 : 0; |
3809 | } | 3813 | } |
3810 | 3814 | ||
3811 | /** | 3815 | /** |
@@ -6918,7 +6922,6 @@ EXPORT_SYMBOL_GPL(ata_host_resume); | |||
6918 | EXPORT_SYMBOL_GPL(ata_id_string); | 6922 | EXPORT_SYMBOL_GPL(ata_id_string); |
6919 | EXPORT_SYMBOL_GPL(ata_id_c_string); | 6923 | EXPORT_SYMBOL_GPL(ata_id_c_string); |
6920 | EXPORT_SYMBOL_GPL(ata_id_to_dma_mode); | 6924 | EXPORT_SYMBOL_GPL(ata_id_to_dma_mode); |
6921 | EXPORT_SYMBOL_GPL(ata_device_blacklisted); | ||
6922 | EXPORT_SYMBOL_GPL(ata_scsi_simulate); | 6925 | EXPORT_SYMBOL_GPL(ata_scsi_simulate); |
6923 | 6926 | ||
6924 | EXPORT_SYMBOL_GPL(ata_pio_need_iordy); | 6927 | EXPORT_SYMBOL_GPL(ata_pio_need_iordy); |
diff --git a/include/linux/libata.h b/include/linux/libata.h index 0c8b6578bd59..47cd2a1c5544 100644 --- a/include/linux/libata.h +++ b/include/linux/libata.h | |||
@@ -434,6 +434,7 @@ struct ata_device { | |||
434 | struct ata_port *ap; | 434 | struct ata_port *ap; |
435 | unsigned int devno; /* 0 or 1 */ | 435 | unsigned int devno; /* 0 or 1 */ |
436 | unsigned long flags; /* ATA_DFLAG_xxx */ | 436 | unsigned long flags; /* ATA_DFLAG_xxx */ |
437 | unsigned int horkage; /* List of broken features */ | ||
437 | struct scsi_device *sdev; /* attached SCSI device */ | 438 | struct scsi_device *sdev; /* attached SCSI device */ |
438 | #ifdef CONFIG_ATA_ACPI | 439 | #ifdef CONFIG_ATA_ACPI |
439 | acpi_handle acpi_handle; | 440 | acpi_handle acpi_handle; |
@@ -465,7 +466,6 @@ struct ata_device { | |||
465 | /* error history */ | 466 | /* error history */ |
466 | struct ata_ering ering; | 467 | struct ata_ering ering; |
467 | int spdn_cnt; | 468 | int spdn_cnt; |
468 | unsigned int horkage; /* List of broken features */ | ||
469 | }; | 469 | }; |
470 | 470 | ||
471 | /* Offset into struct ata_device. Fields above it are maintained | 471 | /* Offset into struct ata_device. Fields above it are maintained |
@@ -793,7 +793,6 @@ extern void ata_id_string(const u16 *id, unsigned char *s, | |||
793 | extern void ata_id_c_string(const u16 *id, unsigned char *s, | 793 | extern void ata_id_c_string(const u16 *id, unsigned char *s, |
794 | unsigned int ofs, unsigned int len); | 794 | unsigned int ofs, unsigned int len); |
795 | extern void ata_id_to_dma_mode(struct ata_device *dev, u8 unknown); | 795 | extern void ata_id_to_dma_mode(struct ata_device *dev, u8 unknown); |
796 | extern unsigned long ata_device_blacklisted(const struct ata_device *dev); | ||
797 | extern void ata_bmdma_setup (struct ata_queued_cmd *qc); | 796 | extern void ata_bmdma_setup (struct ata_queued_cmd *qc); |
798 | extern void ata_bmdma_start (struct ata_queued_cmd *qc); | 797 | extern void ata_bmdma_start (struct ata_queued_cmd *qc); |
799 | extern void ata_bmdma_stop(struct ata_queued_cmd *qc); | 798 | extern void ata_bmdma_stop(struct ata_queued_cmd *qc); |