From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
To: linux-ide@vger.kernel.org
Cc: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>,
linux-kernel@vger.kernel.org
Subject: [PATCH 19/21] ide: move ide_pio_cycle_time() to ide-timings.c
Date: Wed, 28 May 2008 23:43:20 +0200 [thread overview]
Message-ID: <20080528214320.16327.69738.sendpatchset@localhost.localdomain> (raw)
In-Reply-To: <20080528213944.16327.92950.sendpatchset@localhost.localdomain>
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.
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(-)
Index: b/drivers/ide/ide-lib.c
===================================================================
--- a/drivers/ide/ide-lib.c
+++ b/drivers/ide/ide-lib.c
@@ -188,29 +188,6 @@ static int ide_scan_pio_blacklist (char
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
Index: b/drivers/ide/ide-timings.c
===================================================================
--- 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
@@ -73,6 +74,27 @@ struct ide_timing *ide_timing_find_mode(
return t;
}
+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)
Index: b/include/linux/ide.h
===================================================================
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -1285,6 +1285,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);
@@ -1296,7 +1297,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];
next prev parent reply other threads:[~2008-05-28 21:46 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-05-28 21:39 [PATCH 00/21] ide: convert ide-timing.h to ide-timings.c library Bartlomiej Zolnierkiewicz
2008-05-28 21:39 ` [PATCH 01/21] ide: remove needless includes from ide-lib.c Bartlomiej Zolnierkiewicz
2008-05-28 21:40 ` [PATCH 02/21] ide: remove unused XFER_UDMA_SLOW Bartlomiej Zolnierkiewicz
2008-06-02 11:43 ` Sergei Shtylyov
2008-05-28 21:40 ` [PATCH 03/21] ide: use u8 for xfer modes in ide-timing.h Bartlomiej Zolnierkiewicz
2008-06-02 11:43 ` Sergei Shtylyov
2008-05-28 21:40 ` [PATCH 04/21] ide: move some bits from ide-timing.h to <linux/ide.h> Bartlomiej Zolnierkiewicz
2008-05-30 11:45 ` Sergei Shtylyov
2008-05-28 21:40 ` [PATCH 05/21] ide: remove XFER_* masks from ide-timing.h Bartlomiej Zolnierkiewicz
2008-05-30 11:46 ` Sergei Shtylyov
2008-05-28 21:40 ` [PATCH 06/21] ide: checkpatch.pl fixes for ide-timing.h Bartlomiej Zolnierkiewicz
2008-05-30 11:46 ` Sergei Shtylyov
2008-05-28 21:40 ` [PATCH 07/21] ide: convert ide-timing.h to ide-timings.c library Bartlomiej Zolnierkiewicz
2008-05-28 21:40 ` [PATCH 08/21] ali14xx: convert to use ide_timing_find_mode() Bartlomiej Zolnierkiewicz
2008-06-02 11:38 ` Sergei Shtylyov
2008-05-28 21:41 ` [PATCH 09/21] ht6560b: " Bartlomiej Zolnierkiewicz
2008-06-02 11:38 ` Sergei Shtylyov
2008-05-28 21:42 ` [PATCH 10/21] qd65xx: " Bartlomiej Zolnierkiewicz
2008-06-02 11:38 ` Sergei Shtylyov
2008-05-28 21:42 ` [PATCH 11/21] alim15x3: " Bartlomiej Zolnierkiewicz
2008-06-02 11:39 ` Sergei Shtylyov
2008-05-28 21:42 ` [PATCH 12/21] cmd640: " Bartlomiej Zolnierkiewicz
2008-06-02 11:40 ` Sergei Shtylyov
2008-06-02 11:40 ` Sergei Shtylyov
2008-05-28 21:42 ` [PATCH 13/21] cmd64x: " Bartlomiej Zolnierkiewicz
2008-06-02 11:40 ` Sergei Shtylyov
2008-05-28 21:42 ` [PATCH 14/21] cy82c693: " Bartlomiej Zolnierkiewicz
2008-06-02 11:40 ` Sergei Shtylyov
2008-05-28 21:42 ` [PATCH 15/21] opti621: " Bartlomiej Zolnierkiewicz
2008-06-02 11:41 ` Sergei Shtylyov
2008-05-28 21:42 ` [PATCH 16/21] sl82c105: " Bartlomiej Zolnierkiewicz
2008-06-02 11:41 ` Sergei Shtylyov
2008-05-28 21:43 ` [PATCH 17/21] ide-mpc8xx: " Bartlomiej Zolnierkiewicz
2008-05-28 21:43 ` [PATCH 18/21] ide-pmac: " Bartlomiej Zolnierkiewicz
2008-06-02 11:41 ` Sergei Shtylyov
2008-05-28 21:43 ` Bartlomiej Zolnierkiewicz [this message]
2008-06-02 11:49 ` [PATCH 19/21] ide: move ide_pio_cycle_time() to ide-timings.c Sergei Shtylyov
2008-05-28 21:43 ` [PATCH 20/21] ide: remove no longer used ide_pio_timings[] Bartlomiej Zolnierkiewicz
2008-06-02 11:42 ` Sergei Shtylyov
2008-05-28 21:43 ` [PATCH 21/21] ide: move PIO blacklist to ide-pio-blacklist.c Bartlomiej Zolnierkiewicz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20080528214320.16327.69738.sendpatchset@localhost.localdomain \
--to=bzolnier@gmail.com \
--cc=linux-ide@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).