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>
diff --git a/include/linux/ide.h b/include/linux/ide.h
index a9206c4..1d9716a 100644
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -1450,10 +1450,10 @@
 	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 */