[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>
This commit is contained in:
parent
0e949ff304
commit
2e02671daa
|
@ -2301,24 +2301,14 @@ static const char * const ata_dma_blacklist [] = {
|
||||||
|
|
||||||
static int ata_dma_blacklisted(const struct ata_device *dev)
|
static int ata_dma_blacklisted(const struct ata_device *dev)
|
||||||
{
|
{
|
||||||
unsigned char model_num[40];
|
unsigned char model_num[41];
|
||||||
char *s;
|
|
||||||
unsigned int len;
|
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
ata_dev_id_string(dev->id, model_num, ATA_ID_PROD_OFS,
|
ata_dev_id_c_string(dev->id, model_num, ATA_ID_PROD_OFS,
|
||||||
sizeof(model_num));
|
sizeof(model_num));
|
||||||
s = &model_num[0];
|
|
||||||
len = strnlen(s, sizeof(model_num));
|
|
||||||
|
|
||||||
/* ATAPI specifies that empty space is blank-filled; remove blanks */
|
|
||||||
while ((len > 0) && (s[len - 1] == ' ')) {
|
|
||||||
len--;
|
|
||||||
s[len] = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_SIZE(ata_dma_blacklist); i++)
|
for (i = 0; i < ARRAY_SIZE(ata_dma_blacklist); i++)
|
||||||
if (!strncmp(ata_dma_blacklist[i], s, len))
|
if (!strcmp(ata_dma_blacklist[i], model_num))
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -1806,15 +1806,12 @@ static int ata_dev_supports_fua(u16 *id)
|
||||||
if (!ata_id_has_fua(id))
|
if (!ata_id_has_fua(id))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
model[40] = '\0';
|
ata_dev_id_c_string(id, model, ATA_ID_PROD_OFS, sizeof(model));
|
||||||
fw[8] = '\0';
|
ata_dev_id_c_string(id, fw, ATA_ID_FW_REV_OFS, sizeof(fw));
|
||||||
|
|
||||||
ata_dev_id_string(id, model, ATA_ID_PROD_OFS, sizeof(model) - 1);
|
if (strcmp(model, "Maxtor"))
|
||||||
ata_dev_id_string(id, fw, ATA_ID_FW_REV_OFS, sizeof(fw) - 1);
|
|
||||||
|
|
||||||
if (strncmp(model, "Maxtor", 6))
|
|
||||||
return 1;
|
return 1;
|
||||||
if (strncmp(fw, "BANC1G10", 8))
|
if (strcmp(fw, "BANC1G10"))
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
return 0; /* blacklisted */
|
return 0; /* blacklisted */
|
||||||
|
|
|
@ -337,22 +337,13 @@ static void sil_scr_write (struct ata_port *ap, unsigned int sc_reg, u32 val)
|
||||||
static void sil_dev_config(struct ata_port *ap, struct ata_device *dev)
|
static void sil_dev_config(struct ata_port *ap, struct ata_device *dev)
|
||||||
{
|
{
|
||||||
unsigned int n, quirks = 0;
|
unsigned int n, quirks = 0;
|
||||||
unsigned char model_num[40];
|
unsigned char model_num[41];
|
||||||
const char *s;
|
|
||||||
unsigned int len;
|
|
||||||
|
|
||||||
ata_dev_id_string(dev->id, model_num, ATA_ID_PROD_OFS,
|
ata_dev_id_c_string(dev->id, model_num, ATA_ID_PROD_OFS,
|
||||||
sizeof(model_num));
|
sizeof(model_num));
|
||||||
s = &model_num[0];
|
|
||||||
len = strnlen(s, sizeof(model_num));
|
|
||||||
|
|
||||||
/* ATAPI specifies that empty space is blank-filled; remove blanks */
|
|
||||||
while ((len > 0) && (s[len - 1] == ' '))
|
|
||||||
len--;
|
|
||||||
|
|
||||||
for (n = 0; sil_blacklist[n].product; n++)
|
for (n = 0; sil_blacklist[n].product; n++)
|
||||||
if (!memcmp(sil_blacklist[n].product, s,
|
if (!strcmp(sil_blacklist[n].product, model_num)) {
|
||||||
strlen(sil_blacklist[n].product))) {
|
|
||||||
quirks = sil_blacklist[n].quirk;
|
quirks = sil_blacklist[n].quirk;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -372,7 +363,7 @@ static void sil_dev_config(struct ata_port *ap, struct ata_device *dev)
|
||||||
/* limit to udma5 */
|
/* limit to udma5 */
|
||||||
if (quirks & SIL_QUIRK_UDMA5MAX) {
|
if (quirks & SIL_QUIRK_UDMA5MAX) {
|
||||||
printk(KERN_INFO "ata%u(%u): applying Maxtor errata fix %s\n",
|
printk(KERN_INFO "ata%u(%u): applying Maxtor errata fix %s\n",
|
||||||
ap->id, dev->devno, s);
|
ap->id, dev->devno, model_num);
|
||||||
ap->udma_mask &= ATA_UDMA5;
|
ap->udma_mask &= ATA_UDMA5;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue