LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Borislav Petkov <petkovbb@googlemail.com>
To: <bzolnier@gmail.com>
Cc: linux-ide@vger.kernel.org, linux-kernel@vger.kernel.org,
	Borislav Petkov <petkovbb@gmail.com>
Subject: [PATCH 01/24] ide-tape: remove idetape_pipeline_active()
Date: Sat,  1 Mar 2008 09:58:25 +0100	[thread overview]
Message-ID: <1204361928-30229-2-git-send-email-petkovbb@gmail.com> (raw)
In-Reply-To: <1204361928-30229-1-git-send-email-petkovbb@gmail.com>

This function was simply a wrapper for a test_bit() macro so remove it and
use the macro instead.

Signed-off-by: Borislav Petkov <petkovbb@gmail.com>
---
 drivers/ide/ide-tape.c |   29 +++++++++++------------------
 1 files changed, 11 insertions(+), 18 deletions(-)

diff --git a/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c
index 3f9fbd8..792c76e 100644
--- a/drivers/ide/ide-tape.c
+++ b/drivers/ide/ide-tape.c
@@ -1605,14 +1605,6 @@ out:
 }
 
 /* Pipeline related functions */
-static inline int idetape_pipeline_active(idetape_tape_t *tape)
-{
-	int rc1, rc2;
-
-	rc1 = test_bit(IDETAPE_FLAG_PIPELINE_ACTIVE, &tape->flags);
-	rc2 = (tape->active_data_rq != NULL);
-	return rc1;
-}
 
 /*
  * The function below uses __get_free_page to allocate a pipeline stage, along
@@ -2058,7 +2050,7 @@ static int __idetape_discard_read_pipeline(ide_drive_t *drive)
 
 	spin_lock_irqsave(&tape->lock, flags);
 	tape->next_stage = NULL;
-	if (idetape_pipeline_active(tape))
+	if (test_bit(IDETAPE_FLAG_PIPELINE_ACTIVE, &tape->flags))
 		idetape_wait_for_request(drive, tape->active_data_rq);
 	spin_unlock_irqrestore(&tape->lock, flags);
 
@@ -2131,7 +2123,7 @@ static int idetape_queue_rw_tail(ide_drive_t *drive, int cmd, int blocks,
 
 	debug_log(DBG_SENSE, "%s: cmd=%d\n", __func__, cmd);
 
-	if (idetape_pipeline_active(tape)) {
+	if (test_bit(IDETAPE_FLAG_PIPELINE_ACTIVE, &tape->flags)) {
 		printk(KERN_ERR "ide-tape: bug: the pipeline is active in %s\n",
 				__func__);
 		return (0);
@@ -2162,8 +2154,7 @@ static void idetape_plug_pipeline(ide_drive_t *drive)
 
 	if (tape->next_stage == NULL)
 		return;
-	if (!idetape_pipeline_active(tape)) {
-		set_bit(IDETAPE_FLAG_PIPELINE_ACTIVE, &tape->flags);
+	if (!test_and_set_bit(IDETAPE_FLAG_PIPELINE_ACTIVE, &tape->flags)) {
 		idetape_activate_next_stage(drive);
 		(void) ide_do_drive_cmd(drive, tape->active_data_rq, ide_end);
 	}
@@ -2242,13 +2233,14 @@ static int idetape_add_chrdev_write_request(ide_drive_t *drive, int blocks)
 	/* Attempt to allocate a new stage. Beware possible race conditions. */
 	while ((new_stage = idetape_kmalloc_stage(tape)) == NULL) {
 		spin_lock_irqsave(&tape->lock, flags);
-		if (idetape_pipeline_active(tape)) {
+		if (test_bit(IDETAPE_FLAG_PIPELINE_ACTIVE, &tape->flags)) {
 			idetape_wait_for_request(drive, tape->active_data_rq);
 			spin_unlock_irqrestore(&tape->lock, flags);
 		} else {
 			spin_unlock_irqrestore(&tape->lock, flags);
 			idetape_plug_pipeline(drive);
-			if (idetape_pipeline_active(tape))
+			if (test_bit(IDETAPE_FLAG_PIPELINE_ACTIVE,
+					&tape->flags))
 				continue;
 			/*
 			 * The machine is short on memory. Fallback to non-
@@ -2277,7 +2269,7 @@ static int idetape_add_chrdev_write_request(ide_drive_t *drive, int blocks)
 	 * starting to service requests, so that we will be able to keep up with
 	 * the higher speeds of the tape.
 	 */
-	if (!idetape_pipeline_active(tape)) {
+	if (!test_bit(IDETAPE_FLAG_PIPELINE_ACTIVE, &tape->flags)) {
 		if (tape->nr_stages >= tape->max_stages * 9 / 10 ||
 			tape->nr_stages >= tape->max_stages -
 			tape->uncontrolled_pipeline_head_speed * 3 * 1024 /
@@ -2304,10 +2296,11 @@ static void idetape_wait_for_pipeline(ide_drive_t *drive)
 	idetape_tape_t *tape = drive->driver_data;
 	unsigned long flags;
 
-	while (tape->next_stage || idetape_pipeline_active(tape)) {
+	while (tape->next_stage || test_bit(IDETAPE_FLAG_PIPELINE_ACTIVE,
+						&tape->flags)) {
 		idetape_plug_pipeline(drive);
 		spin_lock_irqsave(&tape->lock, flags);
-		if (idetape_pipeline_active(tape))
+		if (test_bit(IDETAPE_FLAG_PIPELINE_ACTIVE, &tape->flags))
 			idetape_wait_for_request(drive, tape->active_data_rq);
 		spin_unlock_irqrestore(&tape->lock, flags);
 	}
@@ -2464,7 +2457,7 @@ static int idetape_init_read(ide_drive_t *drive, int max_stages)
 			new_stage = idetape_kmalloc_stage(tape);
 		}
 	}
-	if (!idetape_pipeline_active(tape)) {
+	if (!test_bit(IDETAPE_FLAG_PIPELINE_ACTIVE, &tape->flags)) {
 		if (tape->nr_pending_stages >= 3 * max_stages / 4) {
 			tape->measure_insert_time = 1;
 			tape->insert_time = jiffies;
-- 
1.5.4.1


  reply	other threads:[~2008-03-01  9:11 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-01  8:58 [PATCH 00/24] ide-tape: remove pipelined mode operation Borislav Petkov
2008-03-01  8:58 ` Borislav Petkov [this message]
2008-03-02 18:21   ` [PATCH 01/24] ide-tape: remove idetape_pipeline_active() Bartlomiej Zolnierkiewicz
2008-03-01  8:58 ` [PATCH 02/24] ide-tape: remove pipeline-specific code from idetape_add_chrdev_write_request Borislav Petkov
2008-03-02 18:33   ` Bartlomiej Zolnierkiewicz
2008-03-02 21:19     ` Borislav Petkov
2008-03-02 23:16       ` Bartlomiej Zolnierkiewicz
2008-03-03  6:43         ` Borislav Petkov
2008-03-03 22:32           ` Bartlomiej Zolnierkiewicz
2008-03-01  8:58 ` [PATCH 03/24] ide-tape: remove pipeline-specific code from idetape_add_chrdev_read_request Borislav Petkov
2008-03-02 18:36   ` Bartlomiej Zolnierkiewicz
2008-03-02 21:28     ` Borislav Petkov
2008-03-01  8:58 ` [PATCH 04/24] ide-tape: remove pipeline-specific code from idetape_chrdev_write Borislav Petkov
2008-03-02 18:41   ` Bartlomiej Zolnierkiewicz
2008-03-02 21:31     ` Borislav Petkov
2008-03-02 23:17       ` Bartlomiej Zolnierkiewicz
2008-03-01  8:58 ` [PATCH 05/24] ide-tape: cleanup pipeline-specific code from idetape_init_read Borislav Petkov
2008-03-02 18:48   ` Bartlomiej Zolnierkiewicz
2008-03-01  8:58 ` [PATCH 06/24] ide-tape: remove unused stage-parameter from idetape_copy_stage_to_user Borislav Petkov
2008-03-02 19:15   ` Bartlomiej Zolnierkiewicz
2008-03-01  8:58 ` [PATCH 07/24] ide-tape: remove pipeline-specific code bits from idetape_chrdev_read Borislav Petkov
2008-03-01  8:58 ` [PATCH 08/24] ide-tape: remove pipeline-specific code from idetape_space_over_filemarks Borislav Petkov
2008-03-01  8:58 ` [PATCH 09/24] ide-tape: remove pipeline-specific code from idetape_mtioctop Borislav Petkov
2008-03-01  8:58 ` [RFCPATCH 10/24] ide-tape: remove pipeline-specific code from idetape_chrdev_ioctl Borislav Petkov
2008-03-01  8:58 ` [PATCH 11/24] ide-tape: remove pipeline-specific code from idetape_blkdev_ioctl Borislav Petkov
2008-03-01  8:58 ` [PATCH 12/24] ide-tape: remove idetape_empty_write_pipeline Borislav Petkov
2008-03-01  8:58 ` [PATCH 13/24] ide-tape: remove pipeline-specific code from idetape_chrdev_release Borislav Petkov
2008-03-01  8:58 ` [PATCH 14/24] ide-tape: remove __idetape_discard_read_pipeline Borislav Petkov
2008-03-01  8:58 ` [PATCH 15/24] ide-tape: remove pipeline-specific code from idetape_end_request Borislav Petkov
2008-03-01  8:58 ` [PATCH 16/24] ide-tape: remove idetape_calculate_speeds Borislav Petkov
2008-03-01  8:58 ` [PATCH 17/24] ide-tape: remove pipeline-specific code from idetape_chrdev_open Borislav Petkov
2008-03-01  8:58 ` [PATCH 18/24] ide-tape: remove pipeline-specific code from idetape_setup Borislav Petkov
2008-03-01  8:58 ` [PATCH 19/24] ide-tape: remove pipelined mode parameters Borislav Petkov
2008-03-01  8:58 ` [PATCH 20/24] ide-tape: remove pipelined mode tape control flags Borislav Petkov
2008-03-01  8:58 ` [PATCH 21/24] ide-tape: remove pipeline-specific members from struct ide_tape_obj Borislav Petkov
2008-03-01  8:58 ` [PATCH 22/24] ide-tape: remove misc references to pipelined operation in the comments Borislav Petkov
2008-03-01  8:58 ` [PATCH 23/24] ide-tape: remove pipelined mode description from Documentation/ide/ide-tape.txt Borislav Petkov
2008-03-01  8:58 ` [PATCH 24/24] ide-tape: remove comments markup " Borislav Petkov
2008-03-01  9:55 ` [PATCH 00/24] ide-tape: remove pipelined mode operation Jens Axboe
2008-03-01 15:45   ` Borislav Petkov
2008-03-01 18:36     ` Jens Axboe
2008-03-01 10:20 ` Adrian Bunk
2008-03-01 15:37   ` Borislav Petkov
2008-03-22 16:09     ` 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=1204361928-30229-2-git-send-email-petkovbb@gmail.com \
    --to=petkovbb@googlemail.com \
    --cc=bzolnier@gmail.com \
    --cc=linux-ide@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=petkovbb@gmail.com \
    --subject='Re: [PATCH 01/24] ide-tape: remove idetape_pipeline_active()' \
    /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

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).