ide: move ide_pio_cycle_time() to ide-timings.c

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Linux Kernel Mailing List
Date: Wednesday, July 16, 2008 - 4:11 pm

Gitweb:     http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=c9d6c1...
Commit:     c9d6c1a2379373219bb3271bdcbdc0ab2edf349d
Parent:     8a97206e31dc2e2f8f9b4d97e234b5c701fe9894
Author:     Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
AuthorDate: Wed Jul 16 20:33:39 2008 +0200
Committer:  Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
CommitDate: Wed Jul 16 20:33:39 2008 +0200

    ide: move ide_pio_cycle_time() to ide-timings.c
    
    All ide_pio_cycle_time() users already select CONFIG_IDE_TIMINGS
    so move the function from ide-lib.c to ide-timings.c.
    
    While at it:
    
    - convert ide_pio_cycle_time() to use ide_timing_find_mode()
    
    - cleanup ide_pio_cycle_time() a bit
    
    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>
---
 drivers/ide/ide-lib.c     |   23 -----------------------
 drivers/ide/ide-timings.c |   22 ++++++++++++++++++++++
 include/linux/ide.h       |    2 +-
 3 files changed, 23 insertions(+), 24 deletions(-)

diff --git a/drivers/ide/ide-lib.c b/drivers/ide/ide-lib.c
index 7e053d2..efa5bfa 100644
--- a/drivers/ide/ide-lib.c
+++ b/drivers/ide/ide-lib.c
@@ -188,29 +188,6 @@ static int ide_scan_pio_blacklist (char *model)
 	return -1;
 }
 
-unsigned int ide_pio_cycle_time(ide_drive_t *drive, u8 pio)
-{
-	struct hd_driveid *id = drive->id;
-	int cycle_time = 0;
-
-	if (id->field_valid & 2) {
-		if (id->capability & 8)
-			cycle_time = id->eide_pio_iordy;
-		else
-			cycle_time = id->eide_pio;
-	}
-
-	/* conservative "downgrade" for all pre-ATA2 drives */
-	if (pio < 3) {
-		if (cycle_time && cycle_time < ide_pio_timings[pio].cycle_time)
-			cycle_time = 0; /* use standard timing */
-	}
-
-	return cycle_time ? cycle_time : ide_pio_timings[pio].cycle_time;
-}
-
-EXPORT_SYMBOL_GPL(ide_pio_cycle_time);
-
 /**
  *	ide_get_best_pio_mode	-	get PIO mode from drive
  *	@drive: drive to consider
diff --git a/drivers/ide/ide-timings.c b/drivers/ide/ide-timings.c
index ebef6d4..8c2f832 100644
--- a/drivers/ide/ide-timings.c
+++ b/drivers/ide/ide-timings.c
@@ -1,5 +1,6 @@
 /*
  *  Copyright (c) 1999-2001 Vojtech Pavlik
+ *  Copyright (c) 2007-2008 Bartlomiej Zolnierkiewicz
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -75,6 +76,27 @@ struct ide_timing *ide_timing_find_mode(u8 speed)
 }
 EXPORT_SYMBOL_GPL(ide_timing_find_mode);
 
+u16 ide_pio_cycle_time(ide_drive_t *drive, u8 pio)
+{
+	struct hd_driveid *id = drive->id;
+	struct ide_timing *t = ide_timing_find_mode(XFER_PIO_0 + pio);
+	u16 cycle = 0;
+
+	if (id->field_valid & 2) {
+		if (id->capability & 8)
+			cycle = id->eide_pio_iordy;
+		else
+			cycle = id->eide_pio;
+
+		/* conservative "downgrade" for all pre-ATA2 drives */
+		if (pio < 3 && cycle < t->cycle)
+			cycle = 0; /* use standard timing */
+	}
+
+	return cycle ? cycle : t->cycle;
+}
+EXPORT_SYMBOL_GPL(ide_pio_cycle_time);
+
 #define ENOUGH(v, unit)		(((v) - 1) / (unit) + 1)
 #define EZ(v, unit)		((v) ? ENOUGH(v, unit) : 0)
 
diff --git a/include/linux/ide.h b/include/linux/ide.h
index 057001f..3899c76 100644
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -1300,6 +1300,7 @@ enum {
 };
 
 struct ide_timing *ide_timing_find_mode(u8);
+u16 ide_pio_cycle_time(ide_drive_t *, u8);
 void ide_timing_merge(struct ide_timing *, struct ide_timing *,
 		      struct ide_timing *, unsigned int);
 int ide_timing_compute(ide_drive_t *, u8, struct ide_timing *, int, int);
@@ -1311,7 +1312,6 @@ typedef struct ide_pio_timings_s {
 				/* active + recovery (+ setup for some chips) */
 } ide_pio_timings_t;
 
-unsigned int ide_pio_cycle_time(ide_drive_t *, u8);
 u8 ide_get_best_pio_mode(ide_drive_t *, u8, u8);
 extern const ide_pio_timings_t ide_pio_timings[6];
 
--
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
ide: move ide_pio_cycle_time() to ide-timings.c, Linux Kernel Mailing ..., (Wed Jul 16, 4:11 pm)