All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
To: linux-ide@vger.kernel.org
Cc: Borislav Petkov <petkovbb@gmail.com>,
	Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>,
	linux-kernel@vger.kernel.org
Subject: [PATCH 14/22] ide: move IDE{FLOPPY,TAPE}_WAIT_CMD defines to <linux/ide.h>
Date: Sun, 10 Aug 2008 17:37:07 +0200	[thread overview]
Message-ID: <20080810153707.16255.15094.sendpatchset@localhost.localdomain> (raw)
In-Reply-To: <20080810153527.16255.2504.sendpatchset@localhost.localdomain>

While at it:

* IDE{FLOPPY,TAPE}_WAIT_CMD -> WAIT_{FLOPPY,TAPE}_CMD

* Use enum for WAIT_* defines.

There should be no functional changes caused by this patch.

Cc: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
 drivers/ide/ide-floppy.c |   13 ++++---------
 drivers/ide/ide-tape.c   |   13 +++----------
 include/linux/ide.h      |   28 ++++++++++++++++++++++------
 3 files changed, 29 insertions(+), 25 deletions(-)

Index: b/drivers/ide/ide-floppy.c
===================================================================
--- a/drivers/ide/ide-floppy.c
+++ b/drivers/ide/ide-floppy.c
@@ -60,10 +60,6 @@
 #define debug_log(fmt, args...) do {} while (0)
 #endif
 
-
-/* Some drives require a longer irq timeout. */
-#define IDEFLOPPY_WAIT_CMD		(5 * WAIT_CMD)
-
 /*
  * After each failed packet command we issue a request sense command and retry
  * the packet command IDEFLOPPY_MAX_PC_RETRIES times.
@@ -225,7 +221,7 @@ static ide_startstop_t idefloppy_pc_intr
 	idefloppy_floppy_t *floppy = drive->driver_data;
 
 	return ide_pc_intr(drive, floppy->pc, idefloppy_pc_intr,
-			   IDEFLOPPY_WAIT_CMD, NULL, idefloppy_update_buffers,
+			   WAIT_FLOPPY_CMD, NULL, idefloppy_update_buffers,
 			   idefloppy_retry_pc, NULL, ide_io_buffers);
 }
 
@@ -243,10 +239,9 @@ static int idefloppy_transfer_pc(ide_dri
 	drive->hwif->tp_ops->output_data(drive, NULL, floppy->pc->c, 12);
 
 	/* Timeout for the packet command */
-	return IDEFLOPPY_WAIT_CMD;
+	return WAIT_FLOPPY_CMD;
 }
 
-
 /*
  * Called as an interrupt (or directly). When the device says it's ready for a
  * packet, we schedule the packet transfer to occur about 2-3 ticks later in
@@ -271,7 +266,7 @@ static ide_startstop_t idefloppy_start_p
 		timeout = floppy->ticks;
 		expiry = &idefloppy_transfer_pc;
 	} else {
-		timeout = IDEFLOPPY_WAIT_CMD;
+		timeout = WAIT_FLOPPY_CMD;
 		expiry = NULL;
 	}
 
@@ -321,7 +316,7 @@ static ide_startstop_t idefloppy_issue_p
 	pc->retries++;
 
 	return ide_issue_pc(drive, pc, idefloppy_start_pc_transfer,
-			    IDEFLOPPY_WAIT_CMD, NULL);
+			    WAIT_FLOPPY_CMD, NULL);
 }
 
 void ide_floppy_create_read_capacity_cmd(struct ide_atapi_pc *pc)
Index: b/drivers/ide/ide-tape.c
===================================================================
--- a/drivers/ide/ide-tape.c
+++ b/drivers/ide/ide-tape.c
@@ -81,13 +81,6 @@ enum {
 #define IDETAPE_MAX_PC_RETRIES		3
 
 /*
- * Some drives (for example, Seagate STT3401A Travan) require a very long
- * timeout, because they don't return an interrupt or clear their busy bit
- * until after the command completes (even retension commands).
- */
-#define IDETAPE_WAIT_CMD		(900*HZ)
-
-/*
  * The following parameter is used to select the point in the internal tape fifo
  * in which we will start to refill the buffer. Decreasing the following
  * parameter will improve the system's latency and interactive response, while
@@ -663,7 +656,7 @@ static ide_startstop_t idetape_pc_intr(i
 {
 	idetape_tape_t *tape = drive->driver_data;
 
-	return ide_pc_intr(drive, tape->pc, idetape_pc_intr, IDETAPE_WAIT_CMD,
+	return ide_pc_intr(drive, tape->pc, idetape_pc_intr, WAIT_TAPE_CMD,
 			   NULL, idetape_update_buffers, idetape_retry_pc,
 			   ide_tape_handle_dsc, ide_tape_io_buffers);
 }
@@ -709,7 +702,7 @@ static ide_startstop_t idetape_transfer_
 	idetape_tape_t *tape = drive->driver_data;
 
 	return ide_transfer_pc(drive, tape->pc, idetape_pc_intr,
-			       IDETAPE_WAIT_CMD, NULL);
+			       WAIT_TAPE_CMD, NULL);
 }
 
 static ide_startstop_t idetape_issue_pc(ide_drive_t *drive,
@@ -758,7 +751,7 @@ static ide_startstop_t idetape_issue_pc(
 	pc->retries++;
 
 	return ide_issue_pc(drive, pc, idetape_transfer_pc,
-			    IDETAPE_WAIT_CMD, NULL);
+			    WAIT_TAPE_CMD, NULL);
 }
 
 /* A mode sense command is used to "sense" tape parameters. */
Index: b/include/linux/ide.h
===================================================================
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -133,12 +133,28 @@ struct ide_io_ports {
 /*
  * Timeouts for various operations:
  */
-#define WAIT_DRQ	(HZ/10)		/* 100msec - spec allows up to 20ms */
-#define WAIT_READY	(5*HZ)		/* 5sec - some laptops are very slow */
-#define WAIT_PIDENTIFY	(10*HZ)	/* 10sec  - should be less than 3ms (?), if all ATAPI CD is closed at boot */
-#define WAIT_WORSTCASE	(30*HZ)	/* 30sec  - worst case when spinning up */
-#define WAIT_CMD	(10*HZ)	/* 10sec  - maximum wait for an IRQ to happen */
-#define WAIT_MIN_SLEEP	(2*HZ/100)	/* 20msec - minimum sleep time */
+enum {
+	/* spec allows up to 20ms */
+	WAIT_DRQ	= HZ / 10,	/* 100ms */
+	/* some laptops are very slow */
+	WAIT_READY	= 5 * HZ,	/* 5s */
+	/* should be less than 3ms (?), if all ATAPI CD is closed at boot */
+	WAIT_PIDENTIFY	= 10 * HZ,	/* 10s */
+	/* worst case when spinning up */
+	WAIT_WORSTCASE	= 30 * HZ,	/* 30s */
+	/* maximum wait for an IRQ to happen */
+	WAIT_CMD	= 10 * HZ,	/* 10s */
+	/* Some drives require a longer IRQ timeout. */
+	WAIT_FLOPPY_CMD	= 50 * HZ,	/* 50s */
+	/*
+	 * Some drives (for example, Seagate STT3401A Travan) require a very
+	 * long timeout, because they don't return an interrupt or clear their
+	 * BSY bit until after the command completes (even retension commands).
+	 */
+	WAIT_TAPE_CMD	= 900 * HZ,	/* 900s */
+	/* minimum sleep time */
+	WAIT_MIN_SLEEP	= HZ / 50,	/* 20ms */
+};
 
 /*
  * Op codes for special requests to be handled by ide_special_rq().

  parent reply	other threads:[~2008-08-10 15:39 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-10 15:35 [PATCH 00/22] ide: more work on generic ATAPI support Bartlomiej Zolnierkiewicz
2008-08-10 15:35 ` [PATCH 01/22] ide-floppy: fixup ide_floppy_io_buffers() Bartlomiej Zolnierkiewicz
2008-08-10 15:35 ` [PATCH 02/22] ide-scsi: cleanup ide_scsi_io_buffers() Bartlomiej Zolnierkiewicz
2008-08-10 15:35 ` [PATCH 03/22] ide: add ide_io_buffers() helper Bartlomiej Zolnierkiewicz
2008-08-10 15:35 ` [PATCH 04/22] ide-floppy: add ide_floppy_set_media_lock() helper Bartlomiej Zolnierkiewicz
2008-08-23 11:49   ` Sergei Shtylyov
2008-08-10 15:36 ` [PATCH 05/22] ide-tape: add ide_tape_set_media_lock() helper Bartlomiej Zolnierkiewicz
2008-08-10 15:36 ` [PATCH 06/22] ide: add ide_init_pc() helper Bartlomiej Zolnierkiewicz
2008-08-10 15:36 ` [PATCH 07/22] ide: add ide_queue_pc_head() helper Bartlomiej Zolnierkiewicz
2008-08-23 21:57   ` Sergei Shtylyov
2008-08-10 15:36 ` [PATCH 08/22] ide: add ide_queue_pc_tail() helper Bartlomiej Zolnierkiewicz
2008-08-23 21:58   ` Sergei Shtylyov
2008-08-10 15:36 ` [PATCH 09/22] ide-floppy: ->{srfp,wp} -> IDE_AFLAG_{SRFP,WP} Bartlomiej Zolnierkiewicz
2008-08-10 15:36 ` [PATCH 10/22] ide-floppy: move floppy ioctls handling to ide-floppy_ioctl.c Bartlomiej Zolnierkiewicz
2008-08-10 15:36 ` [PATCH 11/22] ide: add ide_set_media_lock() helper Bartlomiej Zolnierkiewicz
2008-08-11  6:02   ` Borislav Petkov
2008-08-12  9:05     ` Bartlomiej Zolnierkiewicz
2008-08-12 13:37       ` Boris Petkov
2008-08-12 17:48         ` Bartlomiej Zolnierkiewicz
2008-08-10 15:36 ` [PATCH 12/22] ide: add ide_do_start_stop() helper Bartlomiej Zolnierkiewicz
2008-08-10 15:37 ` [PATCH 13/22] ide: add ide_do_test_unit_ready() helper Bartlomiej Zolnierkiewicz
2008-08-23 21:31   ` Sergei Shtylyov
2008-08-10 15:37 ` Bartlomiej Zolnierkiewicz [this message]
2008-08-10 15:37 ` [PATCH 15/22] ide: drop dsc_handle argument from ide_pc_intr() Bartlomiej Zolnierkiewicz
2008-08-10 15:37 ` [PATCH 16/22] ide: add pointer to the current packet command to ide_drive_t Bartlomiej Zolnierkiewicz
2008-08-10 15:37 ` [PATCH 17/22] ide: drop 'timeout' and 'expiry' arguments from ide_pc_intr() Bartlomiej Zolnierkiewicz
2008-08-10 15:37 ` [PATCH 18/22] ide: add request_sense_{pc,rq} to ide_drive_t Bartlomiej Zolnierkiewicz
2008-08-10 15:37 ` [PATCH 19/22] ide: add ide_retry_pc() helper Bartlomiej Zolnierkiewicz
2008-08-10 15:37 ` [PATCH 20/22] ide: add ->pc_{update,io}_buffers methods Bartlomiej Zolnierkiewicz
2008-08-10 15:37 ` [PATCH 21/22] ide: make ide_pc_intr() static Bartlomiej Zolnierkiewicz
2008-08-10 15:38 ` [PATCH 22/22] ide: make ide_transfer_pc() static Bartlomiej Zolnierkiewicz
2008-08-11  6:36 ` [PATCH 00/22] ide: more work on generic ATAPI support Borislav Petkov

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=20080810153707.16255.15094.sendpatchset@localhost.localdomain \
    --to=bzolnier@gmail.com \
    --cc=linux-ide@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=petkovbb@gmail.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.