aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorJeff Garzik <jeff@garzik.org>2007-09-20 16:31:47 -0400
committerJeff Garzik <jeff@garzik.org>2007-10-12 14:55:38 -0400
commit539cc7c70c12fbdad4ee11f901cd7a0d7f52b186 (patch)
treeb0c2d9e0b78f98108f3176cad481788d14706a36 /drivers
parentec300d99ef8699a6f383889b8f8c0d0ebadc2a74 (diff)
[libata] blacklist Maxtor*BANC* using new wildcard blacklist matching
Support the use of '*' in model_num and model_rev entries in ata_device_blacklist[]. Based largely on David Milburn's "libata-core: support wildcard matching in ata_blacklist_entry" patch. Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/ata/libata-core.c32
1 files changed, 22 insertions, 10 deletions
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index 84d81b26e384..2b222700d9bb 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -3814,16 +3814,11 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = {
3814 /* http://thread.gmane.org/gmane.linux.ide/14907 */ 3814 /* http://thread.gmane.org/gmane.linux.ide/14907 */
3815 { "FUJITSU MHT2060BH", NULL, ATA_HORKAGE_NONCQ }, 3815 { "FUJITSU MHT2060BH", NULL, ATA_HORKAGE_NONCQ },
3816 /* NCQ is broken */ 3816 /* NCQ is broken */
3817 { "Maxtor 6L250S0", "BANC1G10", ATA_HORKAGE_NONCQ }, 3817 { "Maxtor *", "BANC*", ATA_HORKAGE_NONCQ },
3818 { "Maxtor 6B200M0", "BANC1BM0", ATA_HORKAGE_NONCQ },
3819 { "Maxtor 6B200M0", "BANC1B10", ATA_HORKAGE_NONCQ },
3820 { "Maxtor 7B250S0", "BANC1B70", ATA_HORKAGE_NONCQ, },
3821 { "Maxtor 7B300S0", "BANC1B70", ATA_HORKAGE_NONCQ },
3822 { "Maxtor 7V300F0", "VA111630", ATA_HORKAGE_NONCQ }, 3818 { "Maxtor 7V300F0", "VA111630", ATA_HORKAGE_NONCQ },
3823 { "HITACHI HDS7250SASUN500G 0621KTAWSD", "K2AOAJ0AHITACHI", 3819 { "HITACHI HDS7250SASUN500G 0621KTAWSD", "K2AOAJ0AHITACHI",
3824 ATA_HORKAGE_NONCQ }, 3820 ATA_HORKAGE_NONCQ },
3825 /* NCQ hard hangs device under heavier load, needs hard power cycle */ 3821
3826 { "Maxtor 6B250S0", "BANC1B70", ATA_HORKAGE_NONCQ },
3827 /* Blacklist entries taken from Silicon Image 3124/3132 3822 /* Blacklist entries taken from Silicon Image 3124/3132
3828 Windows driver .inf file - also several Linux problem reports */ 3823 Windows driver .inf file - also several Linux problem reports */
3829 { "HTS541060G9SA00", "MB3OC60D", ATA_HORKAGE_NONCQ, }, 3824 { "HTS541060G9SA00", "MB3OC60D", ATA_HORKAGE_NONCQ, },
@@ -3849,6 +3844,23 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = {
3849 { } 3844 { }
3850}; 3845};
3851 3846
3847int strn_pattern_cmp(const char *patt, const char *name, int wildchar)
3848{
3849 const char *p;
3850 int len;
3851
3852 /*
3853 * check for trailing wildcard: *\0
3854 */
3855 p = strchr(patt, wildchar);
3856 if (p && ((*(p + 1)) == 0))
3857 len = p - patt;
3858 else
3859 len = strlen(name);
3860
3861 return strncmp(patt, name, len);
3862}
3863
3852static unsigned long ata_dev_blacklisted(const struct ata_device *dev) 3864static unsigned long ata_dev_blacklisted(const struct ata_device *dev)
3853{ 3865{
3854 unsigned char model_num[ATA_ID_PROD_LEN + 1]; 3866 unsigned char model_num[ATA_ID_PROD_LEN + 1];
@@ -3859,10 +3871,10 @@ static unsigned long ata_dev_blacklisted(const struct ata_device *dev)
3859 ata_id_c_string(dev->id, model_rev, ATA_ID_FW_REV, sizeof(model_rev)); 3871 ata_id_c_string(dev->id, model_rev, ATA_ID_FW_REV, sizeof(model_rev));
3860 3872
3861 while (ad->model_num) { 3873 while (ad->model_num) {
3862 if (!strcmp(ad->model_num, model_num)) { 3874 if (!strn_pattern_cmp(ad->model_num, model_num, '*')) {
3863 if (ad->model_rev == NULL) 3875 if (ad->model_rev == NULL)
3864 return ad->horkage; 3876 return ad->horkage;
3865 if (!strcmp(ad->model_rev, model_rev)) 3877 if (!strn_pattern_cmp(ad->model_rev, model_rev, '*'))
3866 return ad->horkage; 3878 return ad->horkage;
3867 } 3879 }
3868 ad++; 3880 ad++;