diff options
author | Tejun Heo <htejun@gmail.com> | 2006-02-12 08:47:04 -0500 |
---|---|---|
committer | Jeff Garzik <jgarzik@pobox.com> | 2006-02-12 14:24:41 -0500 |
commit | 2e02671daa2cd69d93c828c40579bbe953f17210 (patch) | |
tree | bcafe5d5b36be475de57081600fae13408cd0c4e | |
parent | 0e949ff304a7ca07db38c17fbbf3ead1085d7bbf (diff) |
[PATCH] libata: use ata_dev_id_c_string()
Use ata_dev_id_c_string()
Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
-rw-r--r-- | drivers/scsi/libata-core.c | 18 | ||||
-rw-r--r-- | drivers/scsi/libata-scsi.c | 11 | ||||
-rw-r--r-- | drivers/scsi/sata_sil.c | 19 |
3 files changed, 13 insertions, 35 deletions
diff --git a/drivers/scsi/libata-core.c b/drivers/scsi/libata-core.c index 7e410299d67a..1d65f703348e 100644 --- a/drivers/scsi/libata-core.c +++ b/drivers/scsi/libata-core.c | |||
@@ -2301,24 +2301,14 @@ static const char * const ata_dma_blacklist [] = { | |||
2301 | 2301 | ||
2302 | static int ata_dma_blacklisted(const struct ata_device *dev) | 2302 | static int ata_dma_blacklisted(const struct ata_device *dev) |
2303 | { | 2303 | { |
2304 | unsigned char model_num[40]; | 2304 | unsigned char model_num[41]; |
2305 | char *s; | ||
2306 | unsigned int len; | ||
2307 | int i; | 2305 | int i; |
2308 | 2306 | ||
2309 | ata_dev_id_string(dev->id, model_num, ATA_ID_PROD_OFS, | 2307 | ata_dev_id_c_string(dev->id, model_num, ATA_ID_PROD_OFS, |
2310 | sizeof(model_num)); | 2308 | sizeof(model_num)); |
2311 | s = &model_num[0]; | ||
2312 | len = strnlen(s, sizeof(model_num)); | ||
2313 | |||
2314 | /* ATAPI specifies that empty space is blank-filled; remove blanks */ | ||
2315 | while ((len > 0) && (s[len - 1] == ' ')) { | ||
2316 | len--; | ||
2317 | s[len] = 0; | ||
2318 | } | ||
2319 | 2309 | ||
2320 | for (i = 0; i < ARRAY_SIZE(ata_dma_blacklist); i++) | 2310 | for (i = 0; i < ARRAY_SIZE(ata_dma_blacklist); i++) |
2321 | if (!strncmp(ata_dma_blacklist[i], s, len)) | 2311 | if (!strcmp(ata_dma_blacklist[i], model_num)) |
2322 | return 1; | 2312 | return 1; |
2323 | 2313 | ||
2324 | return 0; | 2314 | return 0; |
diff --git a/drivers/scsi/libata-scsi.c b/drivers/scsi/libata-scsi.c index 26f07a2617f9..ebd7cf42550b 100644 --- a/drivers/scsi/libata-scsi.c +++ b/drivers/scsi/libata-scsi.c | |||
@@ -1806,15 +1806,12 @@ static int ata_dev_supports_fua(u16 *id) | |||
1806 | if (!ata_id_has_fua(id)) | 1806 | if (!ata_id_has_fua(id)) |
1807 | return 0; | 1807 | return 0; |
1808 | 1808 | ||
1809 | model[40] = '\0'; | 1809 | ata_dev_id_c_string(id, model, ATA_ID_PROD_OFS, sizeof(model)); |
1810 | fw[8] = '\0'; | 1810 | ata_dev_id_c_string(id, fw, ATA_ID_FW_REV_OFS, sizeof(fw)); |
1811 | 1811 | ||
1812 | ata_dev_id_string(id, model, ATA_ID_PROD_OFS, sizeof(model) - 1); | 1812 | if (strcmp(model, "Maxtor")) |
1813 | ata_dev_id_string(id, fw, ATA_ID_FW_REV_OFS, sizeof(fw) - 1); | ||
1814 | |||
1815 | if (strncmp(model, "Maxtor", 6)) | ||
1816 | return 1; | 1813 | return 1; |
1817 | if (strncmp(fw, "BANC1G10", 8)) | 1814 | if (strcmp(fw, "BANC1G10")) |
1818 | return 1; | 1815 | return 1; |
1819 | 1816 | ||
1820 | return 0; /* blacklisted */ | 1817 | return 0; /* blacklisted */ |
diff --git a/drivers/scsi/sata_sil.c b/drivers/scsi/sata_sil.c index bd2887741d78..61c4ac7ff9db 100644 --- a/drivers/scsi/sata_sil.c +++ b/drivers/scsi/sata_sil.c | |||
@@ -337,22 +337,13 @@ static void sil_scr_write (struct ata_port *ap, unsigned int sc_reg, u32 val) | |||
337 | static void sil_dev_config(struct ata_port *ap, struct ata_device *dev) | 337 | static void sil_dev_config(struct ata_port *ap, struct ata_device *dev) |
338 | { | 338 | { |
339 | unsigned int n, quirks = 0; | 339 | unsigned int n, quirks = 0; |
340 | unsigned char model_num[40]; | 340 | unsigned char model_num[41]; |
341 | const char *s; | ||
342 | unsigned int len; | ||
343 | 341 | ||
344 | ata_dev_id_string(dev->id, model_num, ATA_ID_PROD_OFS, | 342 | ata_dev_id_c_string(dev->id, model_num, ATA_ID_PROD_OFS, |
345 | sizeof(model_num)); | 343 | sizeof(model_num)); |
346 | s = &model_num[0]; | ||
347 | len = strnlen(s, sizeof(model_num)); | ||
348 | |||
349 | /* ATAPI specifies that empty space is blank-filled; remove blanks */ | ||
350 | while ((len > 0) && (s[len - 1] == ' ')) | ||
351 | len--; | ||
352 | 344 | ||
353 | for (n = 0; sil_blacklist[n].product; n++) | 345 | for (n = 0; sil_blacklist[n].product; n++) |
354 | if (!memcmp(sil_blacklist[n].product, s, | 346 | if (!strcmp(sil_blacklist[n].product, model_num)) { |
355 | strlen(sil_blacklist[n].product))) { | ||
356 | quirks = sil_blacklist[n].quirk; | 347 | quirks = sil_blacklist[n].quirk; |
357 | break; | 348 | break; |
358 | } | 349 | } |
@@ -372,7 +363,7 @@ static void sil_dev_config(struct ata_port *ap, struct ata_device *dev) | |||
372 | /* limit to udma5 */ | 363 | /* limit to udma5 */ |
373 | if (quirks & SIL_QUIRK_UDMA5MAX) { | 364 | if (quirks & SIL_QUIRK_UDMA5MAX) { |
374 | printk(KERN_INFO "ata%u(%u): applying Maxtor errata fix %s\n", | 365 | printk(KERN_INFO "ata%u(%u): applying Maxtor errata fix %s\n", |
375 | ap->id, dev->devno, s); | 366 | ap->id, dev->devno, model_num); |
376 | ap->udma_mask &= ATA_UDMA5; | 367 | ap->udma_mask &= ATA_UDMA5; |
377 | return; | 368 | return; |
378 | } | 369 | } |