linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 06/32] ide-tape: remove IDETAPE_DEBUG_BUGS
@ 2008-01-27  9:47 Borislav Petkov
  2008-01-27  9:47 ` [PATCH 07/32] ide-tape: refactor the debug logging facility Borislav Petkov
                   ` (27 more replies)
  0 siblings, 28 replies; 43+ messages in thread
From: Borislav Petkov @ 2008-01-27  9:47 UTC (permalink / raw)
  To: bzolnier; +Cc: linux-kernel, linux-ide, Borislav Petkov

From: Borislav Petkov <bbpetkov@yahoo.de>

Signed-off-by: Borislav Petkov <bbpetkov@yahoo.de>
---
 drivers/ide/ide-tape.c |   42 ++----------------------------------------
 1 files changed, 2 insertions(+), 40 deletions(-)

diff --git a/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c
index dbececc..efb9d25 100644
--- a/drivers/ide/ide-tape.c
+++ b/drivers/ide/ide-tape.c
@@ -107,7 +107,6 @@ typedef struct os_dat_s {
  *	The following are used to debug the driver:
  *
  *	Setting IDETAPE_DEBUG_LOG to 1 will log driver flow control.
- *	Setting IDETAPE_DEBUG_BUGS to 1 will enable self-sanity checks in
  *	some places.
  *
  *	Setting them to 0 will restore normal operation mode:
@@ -121,7 +120,6 @@ typedef struct os_dat_s {
  *	esthetic.
  */
 #define IDETAPE_DEBUG_LOG		0
-#define IDETAPE_DEBUG_BUGS		1
 
 /*
  *	After each failed packet command we issue a request sense command
@@ -847,14 +845,12 @@ static void idetape_input_buffers (ide_drive_t *drive, idetape_pc_t *pc, unsigne
 	int count;
 
 	while (bcount) {
-#if IDETAPE_DEBUG_BUGS
 		if (bh == NULL) {
 			printk(KERN_ERR "ide-tape: bh == NULL in "
 				"idetape_input_buffers\n");
 			idetape_discard_data(drive, bcount);
 			return;
 		}
-#endif /* IDETAPE_DEBUG_BUGS */
 		count = min((unsigned int)(bh->b_size - atomic_read(&bh->b_count)), bcount);
 		HWIF(drive)->atapi_input_bytes(drive, bh->b_data + atomic_read(&bh->b_count), count);
 		bcount -= count;
@@ -874,13 +870,11 @@ static void idetape_output_buffers (ide_drive_t *drive, idetape_pc_t *pc, unsign
 	int count;
 
 	while (bcount) {
-#if IDETAPE_DEBUG_BUGS
 		if (bh == NULL) {
 			printk(KERN_ERR "ide-tape: bh == NULL in "
 				"idetape_output_buffers\n");
 			return;
 		}
-#endif /* IDETAPE_DEBUG_BUGS */
 		count = min((unsigned int)pc->b_count, (unsigned int)bcount);
 		HWIF(drive)->atapi_output_bytes(drive, pc->b_data, count);
 		bcount -= count;
@@ -905,13 +899,11 @@ static void idetape_update_buffers (idetape_pc_t *pc)
 	if (test_bit(PC_WRITING, &pc->flags))
 		return;
 	while (bcount) {
-#if IDETAPE_DEBUG_BUGS
 		if (bh == NULL) {
 			printk(KERN_ERR "ide-tape: bh == NULL in "
 				"idetape_update_buffers\n");
 			return;
 		}
-#endif /* IDETAPE_DEBUG_BUGS */
 		count = min((unsigned int)bh->b_size, (unsigned int)bcount);
 		atomic_set(&bh->b_count, count);
 		if (atomic_read(&bh->b_count) == bh->b_size)
@@ -1067,12 +1059,10 @@ static void idetape_active_next_stage (ide_drive_t *drive)
 	if (tape->debug_level >= 4)
 		printk(KERN_INFO "ide-tape: Reached idetape_active_next_stage\n");
 #endif /* IDETAPE_DEBUG_LOG */
-#if IDETAPE_DEBUG_BUGS
 	if (stage == NULL) {
 		printk(KERN_ERR "ide-tape: bug: Trying to activate a non existing stage\n");
 		return;
 	}
-#endif /* IDETAPE_DEBUG_BUGS */	
 
 	rq->rq_disk = tape->disk;
 	rq->buffer = NULL;
@@ -1147,28 +1137,24 @@ static void idetape_remove_stage_head (ide_drive_t *drive)
 	if (tape->debug_level >= 4)
 		printk(KERN_INFO "ide-tape: Reached idetape_remove_stage_head\n");
 #endif /* IDETAPE_DEBUG_LOG */
-#if IDETAPE_DEBUG_BUGS
 	if (tape->first_stage == NULL) {
 		printk(KERN_ERR "ide-tape: bug: tape->first_stage is NULL\n");
-		return;		
+		return;
 	}
 	if (tape->active_stage == tape->first_stage) {
 		printk(KERN_ERR "ide-tape: bug: Trying to free our active pipeline stage\n");
 		return;
 	}
-#endif /* IDETAPE_DEBUG_BUGS */
 	stage = tape->first_stage;
 	tape->first_stage = stage->next;
 	idetape_kfree_stage(tape, stage);
 	tape->nr_stages--;
 	if (tape->first_stage == NULL) {
 		tape->last_stage = NULL;
-#if IDETAPE_DEBUG_BUGS
 		if (tape->next_stage != NULL)
 			printk(KERN_ERR "ide-tape: bug: tape->next_stage != NULL\n");
 		if (tape->nr_stages)
 			printk(KERN_ERR "ide-tape: bug: nr_stages should be 0 now\n");
-#endif /* IDETAPE_DEBUG_BUGS */
 	}
 }
 
@@ -1656,13 +1642,11 @@ static ide_startstop_t idetape_issue_packet_command (ide_drive_t *drive, idetape
 	int dma_ok = 0;
 	u16 bcount;
 
-#if IDETAPE_DEBUG_BUGS
 	if (tape->pc->c[0] == IDETAPE_REQUEST_SENSE_CMD &&
 	    pc->c[0] == IDETAPE_REQUEST_SENSE_CMD) {
 		printk(KERN_ERR "ide-tape: possible ide-tape.c bug - "
 			"Two request sense in serial were issued\n");
 	}
-#endif /* IDETAPE_DEBUG_BUGS */
 
 	if (tape->failed_pc == NULL && pc->c[0] != IDETAPE_REQUEST_SENSE_CMD)
 		tape->failed_pc = pc;
@@ -1973,7 +1957,6 @@ static ide_startstop_t idetape_do_request(ide_drive_t *drive,
 	    tape->pc->c[0] == IDETAPE_REQUEST_SENSE_CMD) {
 		return idetape_issue_packet_command(drive, tape->failed_pc);
 	}
-#if IDETAPE_DEBUG_BUGS
 	if (postponed_rq != NULL)
 		if (rq != postponed_rq) {
 			printk(KERN_ERR "ide-tape: ide-tape.c bug - "
@@ -1981,7 +1964,6 @@ static ide_startstop_t idetape_do_request(ide_drive_t *drive,
 			idetape_end_request(drive, 0, 0);
 			return ide_stopped;
 		}
-#endif /* IDETAPE_DEBUG_BUGS */
 
 	tape->postponed_rq = NULL;
 
@@ -2168,13 +2150,11 @@ static int idetape_copy_stage_from_user (idetape_tape_t *tape, idetape_stage_t *
 	int ret = 0;
 
 	while (n) {
-#if IDETAPE_DEBUG_BUGS
 		if (bh == NULL) {
 			printk(KERN_ERR "ide-tape: bh == NULL in "
 				"idetape_copy_stage_from_user\n");
 			return 1;
 		}
-#endif /* IDETAPE_DEBUG_BUGS */
 		count = min((unsigned int)(bh->b_size - atomic_read(&bh->b_count)), (unsigned int)n);
 		if (copy_from_user(bh->b_data + atomic_read(&bh->b_count), buf, count))
 			ret = 1;
@@ -2198,13 +2178,11 @@ static int idetape_copy_stage_to_user (idetape_tape_t *tape, char __user *buf, i
 	int ret = 0;
 
 	while (n) {
-#if IDETAPE_DEBUG_BUGS
 		if (bh == NULL) {
 			printk(KERN_ERR "ide-tape: bh == NULL in "
 				"idetape_copy_stage_to_user\n");
 			return 1;
 		}
-#endif /* IDETAPE_DEBUG_BUGS */
 		count = min(tape->b_count, n);
 		if  (copy_to_user(buf, tape->b_data, count))
 			ret = 1;
@@ -2284,12 +2262,10 @@ static void idetape_wait_for_request (ide_drive_t *drive, struct request *rq)
 	DECLARE_COMPLETION_ONSTACK(wait);
 	idetape_tape_t *tape = drive->driver_data;
 
-#if IDETAPE_DEBUG_BUGS
 	if (rq == NULL || !blk_special_request(rq)) {
 		printk (KERN_ERR "ide-tape: bug: Trying to sleep on non-valid request\n");
 		return;
 	}
-#endif /* IDETAPE_DEBUG_BUGS */
 	rq->end_io_data = &wait;
 	rq->end_io = blk_end_sync_rq;
 	spin_unlock_irq(&tape->spinlock);
@@ -2604,12 +2580,10 @@ static int idetape_queue_rw_tail(ide_drive_t *drive, int cmd, int blocks, struct
 	if (tape->debug_level >= 2)
 		printk(KERN_INFO "ide-tape: idetape_queue_rw_tail: cmd=%d\n",cmd);
 #endif /* IDETAPE_DEBUG_LOG */
-#if IDETAPE_DEBUG_BUGS
 	if (idetape_pipeline_active(tape)) {
 		printk(KERN_ERR "ide-tape: bug: the pipeline is active in idetape_queue_rw_tail\n");
 		return (0);
 	}
-#endif /* IDETAPE_DEBUG_BUGS */	
 
 	idetape_init_rq(&rq, cmd);
 	rq.rq_disk = tape->disk;
@@ -2794,8 +2768,7 @@ static void idetape_empty_write_pipeline (ide_drive_t *drive)
 	idetape_tape_t *tape = drive->driver_data;
 	int blocks, min;
 	struct idetape_bh *bh;
-	
-#if IDETAPE_DEBUG_BUGS
+
 	if (tape->chrdev_direction != idetape_direction_write) {
 		printk(KERN_ERR "ide-tape: bug: Trying to empty write pipeline, but we are not writing.\n");
 		return;
@@ -2804,7 +2777,6 @@ static void idetape_empty_write_pipeline (ide_drive_t *drive)
 		printk(KERN_ERR "ide-tape: bug: merge_buffer too big\n");
 		tape->merge_stage_size = tape->stage_size;
 	}
-#endif /* IDETAPE_DEBUG_BUGS */
 	if (tape->merge_stage_size) {
 		blocks = tape->merge_stage_size / tape->tape_block_size;
 		if (tape->merge_stage_size % tape->tape_block_size) {
@@ -2849,7 +2821,6 @@ static void idetape_empty_write_pipeline (ide_drive_t *drive)
 	 *	 can be totally different on the next backup).
 	 */
 	tape->max_stages = tape->min_pipeline;
-#if IDETAPE_DEBUG_BUGS
 	if (tape->first_stage != NULL ||
 	    tape->next_stage != NULL ||
 	    tape->last_stage != NULL ||
@@ -2860,7 +2831,6 @@ static void idetape_empty_write_pipeline (ide_drive_t *drive)
 			tape->first_stage, tape->next_stage,
 			tape->last_stage, tape->nr_stages);
 	}
-#endif /* IDETAPE_DEBUG_BUGS */
 }
 
 static void idetape_restart_speed_control (ide_drive_t *drive)
@@ -2891,12 +2861,10 @@ static int idetape_initiate_read (ide_drive_t *drive, int max_stages)
 			idetape_empty_write_pipeline(drive);
 			idetape_flush_tape_buffers(drive);
 		}
-#if IDETAPE_DEBUG_BUGS
 		if (tape->merge_stage || tape->merge_stage_size) {
 			printk (KERN_ERR "ide-tape: merge_stage_size should be 0 now\n");
 			tape->merge_stage_size = 0;
 		}
-#endif /* IDETAPE_DEBUG_BUGS */
 		if ((tape->merge_stage = __idetape_kmalloc_stage(tape, 0, 0)) == NULL)
 			return -ENOMEM;
 		tape->chrdev_direction = idetape_direction_read;
@@ -2997,12 +2965,10 @@ static int idetape_add_chrdev_read_request (ide_drive_t *drive,int blocks)
 		tape->pipeline_head++;
 		calculate_speeds(drive);
 	}
-#if IDETAPE_DEBUG_BUGS
 	if (bytes_read > blocks * tape->tape_block_size) {
 		printk(KERN_ERR "ide-tape: bug: trying to return more bytes than requested\n");
 		bytes_read = blocks * tape->tape_block_size;
 	}
-#endif /* IDETAPE_DEBUG_BUGS */
 	return (bytes_read);
 }
 
@@ -3301,13 +3267,11 @@ static ssize_t idetape_chrdev_write (struct file *file, const char __user *buf,
 	if (tape->chrdev_direction != idetape_direction_write) {
 		if (tape->chrdev_direction == idetape_direction_read)
 			idetape_discard_read_pipeline(drive, 1);
-#if IDETAPE_DEBUG_BUGS
 		if (tape->merge_stage || tape->merge_stage_size) {
 			printk(KERN_ERR "ide-tape: merge_stage_size "
 				"should be 0 now\n");
 			tape->merge_stage_size = 0;
 		}
-#endif /* IDETAPE_DEBUG_BUGS */
 		if ((tape->merge_stage = __idetape_kmalloc_stage(tape, 0, 0)) == NULL)
 			return -ENOMEM;
 		tape->chrdev_direction = idetape_direction_write;
@@ -3335,12 +3299,10 @@ static ssize_t idetape_chrdev_write (struct file *file, const char __user *buf,
 	if (tape->restart_speed_control_req)
 		idetape_restart_speed_control(drive);
 	if (tape->merge_stage_size) {
-#if IDETAPE_DEBUG_BUGS
 		if (tape->merge_stage_size >= tape->stage_size) {
 			printk(KERN_ERR "ide-tape: bug: merge buffer too big\n");
 			tape->merge_stage_size = 0;
 		}
-#endif /* IDETAPE_DEBUG_BUGS */
 		actually_written = min((unsigned int)(tape->stage_size - tape->merge_stage_size), (unsigned int)count);
 		if (idetape_copy_stage_from_user(tape, tape->merge_stage, buf, actually_written))
 				ret = -EFAULT;
-- 
1.5.3.7


^ permalink raw reply related	[flat|nested] 43+ messages in thread

end of thread, other threads:[~2008-02-03 11:37 UTC | newest]

Thread overview: 43+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 ` [PATCH 24/32] ide-tape: remove unreachable code chunk Borislav Petkov
2008-01-27 19:41   ` 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

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