Skip to content

Commit

Permalink
ata: hpt37x: Convert to use match_string() helper
Browse files Browse the repository at this point in the history
The new helper returns index of the matching string in an array.
We are going to use it here.

Signed-off-by: Andy Shevchenko <[email protected]>
Signed-off-by: Tejun Heo <[email protected]>
  • Loading branch information
andy-shev authored and htejun committed May 7, 2018
1 parent 75bc37f commit dc85ca5
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions drivers/ata/pata_hpt37x.c
Original file line number Diff line number Diff line change
Expand Up @@ -224,17 +224,14 @@ static int hpt_dma_blacklisted(const struct ata_device *dev, char *modestr,
const char * const list[])
{
unsigned char model_num[ATA_ID_PROD_LEN + 1];
int i = 0;
int i;

ata_id_c_string(dev->id, model_num, ATA_ID_PROD, sizeof(model_num));

while (list[i] != NULL) {
if (!strcmp(list[i], model_num)) {
pr_warn("%s is not supported for %s\n",
modestr, list[i]);
return 1;
}
i++;
i = match_string(list, -1, model_num);
if (i >= 0) {
pr_warn("%s is not supported for %s\n", modestr, list[i]);
return 1;
}
return 0;
}
Expand Down

0 comments on commit dc85ca5

Please sign in to comment.