Skip to content

Commit

Permalink
pdc202xx_new: remove check_in_drive_lists abomination
Browse files Browse the repository at this point in the history
Fold check_in_drive_lists() into quirkproc() handler in both PDC202xx
drivers-- this function was never called with a list other than
pdc_quirk_drives and was a bad example of code overall...

Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
  • Loading branch information
Sergei Shtylyov authored and Bartlomiej Zolnierkiewicz committed Feb 7, 2007
1 parent 2721031 commit d24ec42
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 42 deletions.
27 changes: 6 additions & 21 deletions drivers/ide/pci/pdc202xx_new.c
Original file line number Diff line number Diff line change
Expand Up @@ -92,26 +92,6 @@ static u8 pdcnew_ratemask(ide_drive_t *drive)
return mode;
}

static int check_in_drive_lists(ide_drive_t *drive, const char **list)
{
struct hd_driveid *id = drive->id;

if (pdc_quirk_drives == list) {
while (*list) {
if (strstr(id->model, *list++)) {
return 2;
}
}
} else {
while (*list) {
if (!strcmp(*list++,id->model)) {
return 1;
}
}
}
return 0;
}

/**
* get_indexed_reg - Get indexed register
* @hwif: for the port address
Expand Down Expand Up @@ -324,7 +304,12 @@ static int pdcnew_config_drive_xfer_rate(ide_drive_t *drive)

static int pdcnew_quirkproc(ide_drive_t *drive)
{
return check_in_drive_lists(drive, pdc_quirk_drives);
const char **list, *model = drive->id->model;

for (list = pdc_quirk_drives; *list != NULL; list++)
if (strstr(model, *list) != NULL)
return 2;
return 0;
}

static void pdcnew_reset(ide_drive_t *drive)
Expand Down
27 changes: 6 additions & 21 deletions drivers/ide/pci/pdc202xx_old.c
Original file line number Diff line number Diff line change
Expand Up @@ -123,26 +123,6 @@ static u8 pdc202xx_ratemask (ide_drive_t *drive)
return mode;
}

static int check_in_drive_lists (ide_drive_t *drive, const char **list)
{
struct hd_driveid *id = drive->id;

if (pdc_quirk_drives == list) {
while (*list) {
if (strstr(id->model, *list++)) {
return 2;
}
}
} else {
while (*list) {
if (!strcmp(*list++,id->model)) {
return 1;
}
}
}
return 0;
}

static int pdc202xx_tune_chipset (ide_drive_t *drive, u8 xferspeed)
{
ide_hwif_t *hwif = HWIF(drive);
Expand Down Expand Up @@ -377,7 +357,12 @@ static int pdc202xx_config_drive_xfer_rate (ide_drive_t *drive)

static int pdc202xx_quirkproc (ide_drive_t *drive)
{
return ((int) check_in_drive_lists(drive, pdc_quirk_drives));
const char **list, *model = drive->id->model;

for (list = pdc_quirk_drives; *list != NULL; list++)
if (strstr(model, *list) != NULL)
return 2;
return 0;
}

static void pdc202xx_old_ide_dma_start(ide_drive_t *drive)
Expand Down

0 comments on commit d24ec42

Please sign in to comment.