From: Borislav Petkov <petkovbb@gmail.com>
To: bzolnier@gmail.com
Cc: linux-kernel@vger.kernel.org, linux-ide@vger.kernel.org,
Borislav Petkov <bbpetkov@yahoo.de>
Subject: [PATCH 24/32] ide-tape: remove unreachable code chunk
Date: Sun, 27 Jan 2008 10:48:12 +0100 [thread overview]
Message-ID: <1201427300-3954-19-git-send-email-petkovbb@gmail.com> (raw)
In-Reply-To: <1201427300-3954-1-git-send-email-petkovbb@gmail.com>
From: Borislav Petkov <bbpetkov@yahoo.de>
tape->speed_ctl is set to 1 in idetape_setup(), but, in calculate_speeds() its
value is tested for being 0, 1, or 2. Remove the if-branches where
tape->speed_ctl != 1 since they are never executed.
Also, rename calculate_speeds() by adding driver's prefix as is with the other
function names.
Signed-off-by: Borislav Petkov <bbpetkov@yahoo.de>
---
drivers/ide/ide-tape.c | 23 +++++++++--------------
1 files changed, 9 insertions(+), 14 deletions(-)
diff --git a/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c
index 31edb0c..eab552e 100644
--- a/drivers/ide/ide-tape.c
+++ b/drivers/ide/ide-tape.c
@@ -61,7 +61,8 @@
* the optimum value or until we reach MAX.
*
* Setting the following parameter to 0 is illegal: the pipelined mode
- * cannot be disabled (calculate_speeds() divides by tape->max_stages.)
+ * cannot be disabled (idetape_calculate_speeds() divides by
+ * tape->max_stages.)
*/
#define IDETAPE_MIN_PIPELINE_STAGES 1
#define IDETAPE_MAX_PIPELINE_STAGES 400
@@ -1462,10 +1463,9 @@ static void idetape_create_mode_sense_cmd (idetape_pc_t *pc, u8 page_code)
pc->callback = &idetape_pc_callback;
}
-static void calculate_speeds(ide_drive_t *drive)
+static void idetape_calculate_speeds(ide_drive_t *drive)
{
idetape_tape_t *tape = drive->driver_data;
- int full = 125, empty = 75;
if (time_after(jiffies, tape->ctl_pipe_htime + 120 * HZ)) {
tape->ctl_prev_pipe_h = tape->ctl_last_pipe_h;
@@ -1497,9 +1497,8 @@ static void calculate_speeds(ide_drive_t *drive)
tape->unctl_pipe_htime = jiffies;
}
tape->pipe_hspeed = max(tape->unctl_pipe_hspeed, tape->pipe_ctl_hspeed);
- if (tape->speed_ctl == 0) {
- tape->max_ins_speed = 5000;
- } else if (tape->speed_ctl == 1) {
+
+ if (tape->speed_ctl == 1) {
if (tape->nr_pending_stages >= tape->max_stages / 2)
tape->max_ins_speed = tape->pipe_hspeed +
(1100 - tape->pipe_hspeed) * 2 *
@@ -1511,13 +1510,9 @@ static void calculate_speeds(ide_drive_t *drive)
tape->nr_pending_stages / tape->max_stages;
if (tape->nr_pending_stages >= tape->max_stages * 99 / 100)
tape->max_ins_speed = 5000;
- } else if (tape->speed_ctl == 2) {
- tape->max_ins_speed = tape->pipe_hspeed * empty / 100 +
- (tape->pipe_hspeed * full / 100 - tape->pipe_hspeed *
- empty / 100) * tape->nr_pending_stages
- / tape->max_stages;
} else
tape->max_ins_speed = tape->speed_ctl;
+
tape->max_ins_speed = max(tape->max_ins_speed, 500);
}
@@ -1696,7 +1691,7 @@ static ide_startstop_t idetape_do_request(ide_drive_t *drive,
if (time_after(jiffies, tape->ins_time))
tape->ins_speed = tape->ins_size / 1024 * HZ /
(jiffies - tape->ins_time);
- calculate_speeds(drive);
+ idetape_calculate_speeds(drive);
if (!test_and_clear_bit(IDETAPE_IGNORE_DSC, &tape->flags) &&
(stat & SEEK_STAT) == 0) {
if (postponed_rq == NULL) {
@@ -2416,7 +2411,7 @@ static int idetape_add_chrdev_write_request (ide_drive_t *drive, int blocks)
idetape_switch_buffers(tape, new_stage);
idetape_add_stage_tail(drive, new_stage);
tape->pipeline_head++;
- calculate_speeds(drive);
+ idetape_calculate_speeds(drive);
/*
* Estimate whether the tape has stopped writing by checking
@@ -2658,7 +2653,7 @@ static int idetape_add_chrdev_read_request (ide_drive_t *drive,int blocks)
idetape_remove_stage_head(drive);
spin_unlock_irqrestore(&tape->que_lock, flags);
tape->pipeline_head++;
- calculate_speeds(drive);
+ idetape_calculate_speeds(drive);
}
if (bytes_read > blocks * tape->blk_sz) {
printk(KERN_ERR "ide-tape: bug: trying to return more bytes than requested\n");
--
1.5.3.7
next prev parent reply other threads:[~2008-01-27 9:49 UTC|newest]
Thread overview: 43+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-01-27 9:47 [PATCH 06/32] ide-tape: remove IDETAPE_DEBUG_BUGS Borislav Petkov
2008-01-27 9:47 ` [PATCH 07/32] ide-tape: refactor the debug logging facility Borislav Petkov
2008-01-27 16:12 ` Bartlomiej Zolnierkiewicz
2008-01-27 9:47 ` [PATCH 08/32] ide-tape: remove struct idetape_capabilities_page_t Borislav Petkov
2008-01-27 16:46 ` Bartlomiej Zolnierkiewicz
2008-01-27 9:47 ` [PATCH 09/32] ide-tape: remove struct idetape_inquiry_result_t Borislav Petkov
2008-01-27 9:47 ` [PATCH 10/32] ide-tape: remove struct idetape_read_position_result_t Borislav Petkov
2008-01-27 19:43 ` Bartlomiej Zolnierkiewicz
2008-01-27 9:47 ` [PATCH 11/32] ide-tape: remove struct idetape_data_compression_page_t Borislav Petkov
2008-01-27 9:48 ` [PATCH 12/32] ide-tape: remove struct idetape_medium_partition_page_t Borislav Petkov
2008-01-27 9:48 ` [PATCH 13/32] ide-tape: remove struct idetape_parameter_block_descriptor_t Borislav Petkov
2008-01-27 9:48 ` [PATCH 14/32] ide-tape: remove structs os_partition_t, os_dat_entry_t, os_dat_t Borislav Petkov
2008-01-27 9:48 ` [PATCH 15/32] ide-tape: remove struct idetape_block_size_page_t Borislav Petkov
2008-01-27 9:48 ` [PATCH 16/32] ide-tape: use generic scsi commands Borislav Petkov
2008-01-27 9:48 ` [PATCH 17/32] ide-tape: remove EXPERIMENTAL driver status Borislav Petkov
2008-01-27 9:48 ` [PATCH 18/32] ide-tape: use generic byteorder macros Borislav Petkov
2008-01-27 9:48 ` [PATCH 19/32] ide-tape: remove unused sense packet commands Borislav Petkov
2008-01-27 9:48 ` [PATCH 20/32] ide-tape: make function name more accurate Borislav Petkov
2008-01-27 9:48 ` [PATCH 21/32] ide-tape: idetape_chrdev_direction_t:shorten enum names Borislav Petkov
2008-01-27 18:38 ` Bartlomiej Zolnierkiewicz
2008-01-27 9:48 ` [PATCH 22/32] ide-tape: struct idetape_packet_command_s: shorten member names Borislav Petkov
2008-01-27 19:40 ` Bartlomiej Zolnierkiewicz
2008-01-27 9:48 ` [PATCH 23/32] ide-tape: struct idetape_tape_t: " Borislav Petkov
2008-02-02 23:43 ` Bartlomiej Zolnierkiewicz
2008-02-03 11:36 ` Borislav Petkov
2008-01-27 9:48 ` Borislav Petkov [this message]
2008-01-27 19:41 ` [PATCH 24/32] ide-tape: remove unreachable code chunk Bartlomiej Zolnierkiewicz
2008-01-27 9:48 ` [PATCH 25/32] ide-tape: simplify code branching in the interrupt handler Borislav Petkov
2008-01-27 19:42 ` Bartlomiej Zolnierkiewicz
2008-01-27 9:48 ` [RFC PATCH 26/32] ide-tape: remove packet command and struct request memory buffers Borislav Petkov
2008-02-03 0:03 ` Bartlomiej Zolnierkiewicz
2008-01-27 9:48 ` [PATCH 27/32] ide-tape: remove idetape_increase_max_pipeline_stages() Borislav Petkov
2008-02-03 0:07 ` Bartlomiej Zolnierkiewicz
2008-01-27 9:48 ` [PATCH 28/32] ide-tape: shorten some function names Borislav Petkov
2008-02-03 0:12 ` Bartlomiej Zolnierkiewicz
2008-01-27 9:48 ` [PATCH 29/32] ide-tape: remove mtio.h related comments Borislav Petkov
2008-01-27 18:24 ` Bartlomiej Zolnierkiewicz
2008-01-27 9:48 ` [PATCH 30/32] ide-tape: remove atomic test/set macros Borislav Petkov
2008-01-27 9:48 ` [PATCH 31/32] ide-tape: remove idetape_config_t typedef Borislav Petkov
2008-01-27 18:30 ` Bartlomiej Zolnierkiewicz
2008-01-27 9:48 ` [PATCH 32/32] ide-tape: cleanup the remaining codestyle issues Borislav Petkov
2008-01-27 10:48 ` [PATCH 06/32] ide-tape: remove IDETAPE_DEBUG_BUGS Borislav Petkov
2008-01-27 15:35 ` 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=1201427300-3954-19-git-send-email-petkovbb@gmail.com \
--to=petkovbb@gmail.com \
--cc=bbpetkov@yahoo.de \
--cc=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).