ide: check drive->present in ide_get_paired_drive()

* Change ide_get_paired_drive() to return NULL if peer device
  is not present and update all users accordingly.

While at it:

* ide_get_paired_drive() -> ide_get_pair_dev()

* Use ide_get_pair_dev() in cs5530.c, sc1200.c and via82cxxx.c.

There should be no functional changes caused by this patch.

Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
This commit is contained in:
Bartlomiej Zolnierkiewicz 2008-10-10 22:39:26 +02:00
parent 2a924662b6
commit 7e59ea21aa
8 changed files with 17 additions and 17 deletions

View file

@ -1450,10 +1450,10 @@ static inline int hwif_to_node(ide_hwif_t *hwif)
return hwif->dev ? dev_to_node(hwif->dev) : -1;
}
static inline ide_drive_t *ide_get_paired_drive(ide_drive_t *drive)
static inline ide_drive_t *ide_get_pair_dev(ide_drive_t *drive)
{
ide_hwif_t *hwif = HWIF(drive);
ide_drive_t *peer = &drive->hwif->drives[(drive->dn ^ 1) & 1];
return &hwif->drives[(drive->dn ^ 1) & 1];
return peer->present ? peer : NULL;
}
#endif /* _IDE_H */