diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/ide/ide-tape.c | 43 |
1 files changed, 2 insertions, 41 deletions
diff --git a/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c index 99084663a7c0..3d15e8e729ef 100644 --- a/drivers/ide/ide-tape.c +++ b/drivers/ide/ide-tape.c | |||
@@ -107,8 +107,6 @@ typedef struct os_dat_s { | |||
107 | * The following are used to debug the driver: | 107 | * The following are used to debug the driver: |
108 | * | 108 | * |
109 | * Setting IDETAPE_DEBUG_LOG to 1 will log driver flow control. | 109 | * Setting IDETAPE_DEBUG_LOG to 1 will log driver flow control. |
110 | * Setting IDETAPE_DEBUG_BUGS to 1 will enable self-sanity checks in | ||
111 | * some places. | ||
112 | * | 110 | * |
113 | * Setting them to 0 will restore normal operation mode: | 111 | * Setting them to 0 will restore normal operation mode: |
114 | * | 112 | * |
@@ -121,7 +119,6 @@ typedef struct os_dat_s { | |||
121 | * esthetic. | 119 | * esthetic. |
122 | */ | 120 | */ |
123 | #define IDETAPE_DEBUG_LOG 0 | 121 | #define IDETAPE_DEBUG_LOG 0 |
124 | #define IDETAPE_DEBUG_BUGS 1 | ||
125 | 122 | ||
126 | /* | 123 | /* |
127 | * After each failed packet command we issue a request sense command | 124 | * After each failed packet command we issue a request sense command |
@@ -847,14 +844,12 @@ static void idetape_input_buffers (ide_drive_t *drive, idetape_pc_t *pc, unsigne | |||
847 | int count; | 844 | int count; |
848 | 845 | ||
849 | while (bcount) { | 846 | while (bcount) { |
850 | #if IDETAPE_DEBUG_BUGS | ||
851 | if (bh == NULL) { | 847 | if (bh == NULL) { |
852 | printk(KERN_ERR "ide-tape: bh == NULL in " | 848 | printk(KERN_ERR "ide-tape: bh == NULL in " |
853 | "idetape_input_buffers\n"); | 849 | "idetape_input_buffers\n"); |
854 | idetape_discard_data(drive, bcount); | 850 | idetape_discard_data(drive, bcount); |
855 | return; | 851 | return; |
856 | } | 852 | } |
857 | #endif /* IDETAPE_DEBUG_BUGS */ | ||
858 | count = min((unsigned int)(bh->b_size - atomic_read(&bh->b_count)), bcount); | 853 | count = min((unsigned int)(bh->b_size - atomic_read(&bh->b_count)), bcount); |
859 | HWIF(drive)->atapi_input_bytes(drive, bh->b_data + atomic_read(&bh->b_count), count); | 854 | HWIF(drive)->atapi_input_bytes(drive, bh->b_data + atomic_read(&bh->b_count), count); |
860 | bcount -= count; | 855 | bcount -= count; |
@@ -874,13 +869,11 @@ static void idetape_output_buffers (ide_drive_t *drive, idetape_pc_t *pc, unsign | |||
874 | int count; | 869 | int count; |
875 | 870 | ||
876 | while (bcount) { | 871 | while (bcount) { |
877 | #if IDETAPE_DEBUG_BUGS | ||
878 | if (bh == NULL) { | 872 | if (bh == NULL) { |
879 | printk(KERN_ERR "ide-tape: bh == NULL in " | 873 | printk(KERN_ERR "ide-tape: bh == NULL in " |
880 | "idetape_output_buffers\n"); | 874 | "idetape_output_buffers\n"); |
881 | return; | 875 | return; |
882 | } | 876 | } |
883 | #endif /* IDETAPE_DEBUG_BUGS */ | ||
884 | count = min((unsigned int)pc->b_count, (unsigned int)bcount); | 877 | count = min((unsigned int)pc->b_count, (unsigned int)bcount); |
885 | HWIF(drive)->atapi_output_bytes(drive, pc->b_data, count); | 878 | HWIF(drive)->atapi_output_bytes(drive, pc->b_data, count); |
886 | bcount -= count; | 879 | bcount -= count; |
@@ -905,13 +898,11 @@ static void idetape_update_buffers (idetape_pc_t *pc) | |||
905 | if (test_bit(PC_WRITING, &pc->flags)) | 898 | if (test_bit(PC_WRITING, &pc->flags)) |
906 | return; | 899 | return; |
907 | while (bcount) { | 900 | while (bcount) { |
908 | #if IDETAPE_DEBUG_BUGS | ||
909 | if (bh == NULL) { | 901 | if (bh == NULL) { |
910 | printk(KERN_ERR "ide-tape: bh == NULL in " | 902 | printk(KERN_ERR "ide-tape: bh == NULL in " |
911 | "idetape_update_buffers\n"); | 903 | "idetape_update_buffers\n"); |
912 | return; | 904 | return; |
913 | } | 905 | } |
914 | #endif /* IDETAPE_DEBUG_BUGS */ | ||
915 | count = min((unsigned int)bh->b_size, (unsigned int)bcount); | 906 | count = min((unsigned int)bh->b_size, (unsigned int)bcount); |
916 | atomic_set(&bh->b_count, count); | 907 | atomic_set(&bh->b_count, count); |
917 | if (atomic_read(&bh->b_count) == bh->b_size) | 908 | if (atomic_read(&bh->b_count) == bh->b_size) |
@@ -1065,12 +1056,10 @@ static void idetape_active_next_stage (ide_drive_t *drive) | |||
1065 | if (tape->debug_level >= 4) | 1056 | if (tape->debug_level >= 4) |
1066 | printk(KERN_INFO "ide-tape: Reached idetape_active_next_stage\n"); | 1057 | printk(KERN_INFO "ide-tape: Reached idetape_active_next_stage\n"); |
1067 | #endif /* IDETAPE_DEBUG_LOG */ | 1058 | #endif /* IDETAPE_DEBUG_LOG */ |
1068 | #if IDETAPE_DEBUG_BUGS | ||
1069 | if (stage == NULL) { | 1059 | if (stage == NULL) { |
1070 | printk(KERN_ERR "ide-tape: bug: Trying to activate a non existing stage\n"); | 1060 | printk(KERN_ERR "ide-tape: bug: Trying to activate a non existing stage\n"); |
1071 | return; | 1061 | return; |
1072 | } | 1062 | } |
1073 | #endif /* IDETAPE_DEBUG_BUGS */ | ||
1074 | 1063 | ||
1075 | rq->rq_disk = tape->disk; | 1064 | rq->rq_disk = tape->disk; |
1076 | rq->buffer = NULL; | 1065 | rq->buffer = NULL; |
@@ -1145,28 +1134,24 @@ static void idetape_remove_stage_head (ide_drive_t *drive) | |||
1145 | if (tape->debug_level >= 4) | 1134 | if (tape->debug_level >= 4) |
1146 | printk(KERN_INFO "ide-tape: Reached idetape_remove_stage_head\n"); | 1135 | printk(KERN_INFO "ide-tape: Reached idetape_remove_stage_head\n"); |
1147 | #endif /* IDETAPE_DEBUG_LOG */ | 1136 | #endif /* IDETAPE_DEBUG_LOG */ |
1148 | #if IDETAPE_DEBUG_BUGS | ||
1149 | if (tape->first_stage == NULL) { | 1137 | if (tape->first_stage == NULL) { |
1150 | printk(KERN_ERR "ide-tape: bug: tape->first_stage is NULL\n"); | 1138 | printk(KERN_ERR "ide-tape: bug: tape->first_stage is NULL\n"); |
1151 | return; | 1139 | return; |
1152 | } | 1140 | } |
1153 | if (tape->active_stage == tape->first_stage) { | 1141 | if (tape->active_stage == tape->first_stage) { |
1154 | printk(KERN_ERR "ide-tape: bug: Trying to free our active pipeline stage\n"); | 1142 | printk(KERN_ERR "ide-tape: bug: Trying to free our active pipeline stage\n"); |
1155 | return; | 1143 | return; |
1156 | } | 1144 | } |
1157 | #endif /* IDETAPE_DEBUG_BUGS */ | ||
1158 | stage = tape->first_stage; | 1145 | stage = tape->first_stage; |
1159 | tape->first_stage = stage->next; | 1146 | tape->first_stage = stage->next; |
1160 | idetape_kfree_stage(tape, stage); | 1147 | idetape_kfree_stage(tape, stage); |
1161 | tape->nr_stages--; | 1148 | tape->nr_stages--; |
1162 | if (tape->first_stage == NULL) { | 1149 | if (tape->first_stage == NULL) { |
1163 | tape->last_stage = NULL; | 1150 | tape->last_stage = NULL; |
1164 | #if IDETAPE_DEBUG_BUGS | ||
1165 | if (tape->next_stage != NULL) | 1151 | if (tape->next_stage != NULL) |
1166 | printk(KERN_ERR "ide-tape: bug: tape->next_stage != NULL\n"); | 1152 | printk(KERN_ERR "ide-tape: bug: tape->next_stage != NULL\n"); |
1167 | if (tape->nr_stages) | 1153 | if (tape->nr_stages) |
1168 | printk(KERN_ERR "ide-tape: bug: nr_stages should be 0 now\n"); | 1154 | printk(KERN_ERR "ide-tape: bug: nr_stages should be 0 now\n"); |
1169 | #endif /* IDETAPE_DEBUG_BUGS */ | ||
1170 | } | 1155 | } |
1171 | } | 1156 | } |
1172 | 1157 | ||
@@ -1654,13 +1639,11 @@ static ide_startstop_t idetape_issue_packet_command (ide_drive_t *drive, idetape | |||
1654 | int dma_ok = 0; | 1639 | int dma_ok = 0; |
1655 | u16 bcount; | 1640 | u16 bcount; |
1656 | 1641 | ||
1657 | #if IDETAPE_DEBUG_BUGS | ||
1658 | if (tape->pc->c[0] == IDETAPE_REQUEST_SENSE_CMD && | 1642 | if (tape->pc->c[0] == IDETAPE_REQUEST_SENSE_CMD && |
1659 | pc->c[0] == IDETAPE_REQUEST_SENSE_CMD) { | 1643 | pc->c[0] == IDETAPE_REQUEST_SENSE_CMD) { |
1660 | printk(KERN_ERR "ide-tape: possible ide-tape.c bug - " | 1644 | printk(KERN_ERR "ide-tape: possible ide-tape.c bug - " |
1661 | "Two request sense in serial were issued\n"); | 1645 | "Two request sense in serial were issued\n"); |
1662 | } | 1646 | } |
1663 | #endif /* IDETAPE_DEBUG_BUGS */ | ||
1664 | 1647 | ||
1665 | if (tape->failed_pc == NULL && pc->c[0] != IDETAPE_REQUEST_SENSE_CMD) | 1648 | if (tape->failed_pc == NULL && pc->c[0] != IDETAPE_REQUEST_SENSE_CMD) |
1666 | tape->failed_pc = pc; | 1649 | tape->failed_pc = pc; |
@@ -1971,7 +1954,6 @@ static ide_startstop_t idetape_do_request(ide_drive_t *drive, | |||
1971 | tape->pc->c[0] == IDETAPE_REQUEST_SENSE_CMD) { | 1954 | tape->pc->c[0] == IDETAPE_REQUEST_SENSE_CMD) { |
1972 | return idetape_issue_packet_command(drive, tape->failed_pc); | 1955 | return idetape_issue_packet_command(drive, tape->failed_pc); |
1973 | } | 1956 | } |
1974 | #if IDETAPE_DEBUG_BUGS | ||
1975 | if (postponed_rq != NULL) | 1957 | if (postponed_rq != NULL) |
1976 | if (rq != postponed_rq) { | 1958 | if (rq != postponed_rq) { |
1977 | printk(KERN_ERR "ide-tape: ide-tape.c bug - " | 1959 | printk(KERN_ERR "ide-tape: ide-tape.c bug - " |
@@ -1979,7 +1961,6 @@ static ide_startstop_t idetape_do_request(ide_drive_t *drive, | |||
1979 | idetape_end_request(drive, 0, 0); | 1961 | idetape_end_request(drive, 0, 0); |
1980 | return ide_stopped; | 1962 | return ide_stopped; |
1981 | } | 1963 | } |
1982 | #endif /* IDETAPE_DEBUG_BUGS */ | ||
1983 | 1964 | ||
1984 | tape->postponed_rq = NULL; | 1965 | tape->postponed_rq = NULL; |
1985 | 1966 | ||
@@ -2166,13 +2147,11 @@ static int idetape_copy_stage_from_user (idetape_tape_t *tape, idetape_stage_t * | |||
2166 | int ret = 0; | 2147 | int ret = 0; |
2167 | 2148 | ||
2168 | while (n) { | 2149 | while (n) { |
2169 | #if IDETAPE_DEBUG_BUGS | ||
2170 | if (bh == NULL) { | 2150 | if (bh == NULL) { |
2171 | printk(KERN_ERR "ide-tape: bh == NULL in " | 2151 | printk(KERN_ERR "ide-tape: bh == NULL in " |
2172 | "idetape_copy_stage_from_user\n"); | 2152 | "idetape_copy_stage_from_user\n"); |
2173 | return 1; | 2153 | return 1; |
2174 | } | 2154 | } |
2175 | #endif /* IDETAPE_DEBUG_BUGS */ | ||
2176 | count = min((unsigned int)(bh->b_size - atomic_read(&bh->b_count)), (unsigned int)n); | 2155 | count = min((unsigned int)(bh->b_size - atomic_read(&bh->b_count)), (unsigned int)n); |
2177 | if (copy_from_user(bh->b_data + atomic_read(&bh->b_count), buf, count)) | 2156 | if (copy_from_user(bh->b_data + atomic_read(&bh->b_count), buf, count)) |
2178 | ret = 1; | 2157 | ret = 1; |
@@ -2196,13 +2175,11 @@ static int idetape_copy_stage_to_user (idetape_tape_t *tape, char __user *buf, i | |||
2196 | int ret = 0; | 2175 | int ret = 0; |
2197 | 2176 | ||
2198 | while (n) { | 2177 | while (n) { |
2199 | #if IDETAPE_DEBUG_BUGS | ||
2200 | if (bh == NULL) { | 2178 | if (bh == NULL) { |
2201 | printk(KERN_ERR "ide-tape: bh == NULL in " | 2179 | printk(KERN_ERR "ide-tape: bh == NULL in " |
2202 | "idetape_copy_stage_to_user\n"); | 2180 | "idetape_copy_stage_to_user\n"); |
2203 | return 1; | 2181 | return 1; |
2204 | } | 2182 | } |
2205 | #endif /* IDETAPE_DEBUG_BUGS */ | ||
2206 | count = min(tape->b_count, n); | 2183 | count = min(tape->b_count, n); |
2207 | if (copy_to_user(buf, tape->b_data, count)) | 2184 | if (copy_to_user(buf, tape->b_data, count)) |
2208 | ret = 1; | 2185 | ret = 1; |
@@ -2282,12 +2259,10 @@ static void idetape_wait_for_request (ide_drive_t *drive, struct request *rq) | |||
2282 | DECLARE_COMPLETION_ONSTACK(wait); | 2259 | DECLARE_COMPLETION_ONSTACK(wait); |
2283 | idetape_tape_t *tape = drive->driver_data; | 2260 | idetape_tape_t *tape = drive->driver_data; |
2284 | 2261 | ||
2285 | #if IDETAPE_DEBUG_BUGS | ||
2286 | if (rq == NULL || !blk_special_request(rq)) { | 2262 | if (rq == NULL || !blk_special_request(rq)) { |
2287 | printk (KERN_ERR "ide-tape: bug: Trying to sleep on non-valid request\n"); | 2263 | printk (KERN_ERR "ide-tape: bug: Trying to sleep on non-valid request\n"); |
2288 | return; | 2264 | return; |
2289 | } | 2265 | } |
2290 | #endif /* IDETAPE_DEBUG_BUGS */ | ||
2291 | rq->end_io_data = &wait; | 2266 | rq->end_io_data = &wait; |
2292 | rq->end_io = blk_end_sync_rq; | 2267 | rq->end_io = blk_end_sync_rq; |
2293 | spin_unlock_irq(&tape->spinlock); | 2268 | spin_unlock_irq(&tape->spinlock); |
@@ -2602,12 +2577,10 @@ static int idetape_queue_rw_tail(ide_drive_t *drive, int cmd, int blocks, struct | |||
2602 | if (tape->debug_level >= 2) | 2577 | if (tape->debug_level >= 2) |
2603 | printk(KERN_INFO "ide-tape: idetape_queue_rw_tail: cmd=%d\n",cmd); | 2578 | printk(KERN_INFO "ide-tape: idetape_queue_rw_tail: cmd=%d\n",cmd); |
2604 | #endif /* IDETAPE_DEBUG_LOG */ | 2579 | #endif /* IDETAPE_DEBUG_LOG */ |
2605 | #if IDETAPE_DEBUG_BUGS | ||
2606 | if (idetape_pipeline_active(tape)) { | 2580 | if (idetape_pipeline_active(tape)) { |
2607 | printk(KERN_ERR "ide-tape: bug: the pipeline is active in idetape_queue_rw_tail\n"); | 2581 | printk(KERN_ERR "ide-tape: bug: the pipeline is active in idetape_queue_rw_tail\n"); |
2608 | return (0); | 2582 | return (0); |
2609 | } | 2583 | } |
2610 | #endif /* IDETAPE_DEBUG_BUGS */ | ||
2611 | 2584 | ||
2612 | idetape_init_rq(&rq, cmd); | 2585 | idetape_init_rq(&rq, cmd); |
2613 | rq.rq_disk = tape->disk; | 2586 | rq.rq_disk = tape->disk; |
@@ -2792,8 +2765,7 @@ static void idetape_empty_write_pipeline (ide_drive_t *drive) | |||
2792 | idetape_tape_t *tape = drive->driver_data; | 2765 | idetape_tape_t *tape = drive->driver_data; |
2793 | int blocks, min; | 2766 | int blocks, min; |
2794 | struct idetape_bh *bh; | 2767 | struct idetape_bh *bh; |
2795 | 2768 | ||
2796 | #if IDETAPE_DEBUG_BUGS | ||
2797 | if (tape->chrdev_direction != idetape_direction_write) { | 2769 | if (tape->chrdev_direction != idetape_direction_write) { |
2798 | printk(KERN_ERR "ide-tape: bug: Trying to empty write pipeline, but we are not writing.\n"); | 2770 | printk(KERN_ERR "ide-tape: bug: Trying to empty write pipeline, but we are not writing.\n"); |
2799 | return; | 2771 | return; |
@@ -2802,7 +2774,6 @@ static void idetape_empty_write_pipeline (ide_drive_t *drive) | |||
2802 | printk(KERN_ERR "ide-tape: bug: merge_buffer too big\n"); | 2774 | printk(KERN_ERR "ide-tape: bug: merge_buffer too big\n"); |
2803 | tape->merge_stage_size = tape->stage_size; | 2775 | tape->merge_stage_size = tape->stage_size; |
2804 | } | 2776 | } |
2805 | #endif /* IDETAPE_DEBUG_BUGS */ | ||
2806 | if (tape->merge_stage_size) { | 2777 | if (tape->merge_stage_size) { |
2807 | blocks = tape->merge_stage_size / tape->tape_block_size; | 2778 | blocks = tape->merge_stage_size / tape->tape_block_size; |
2808 | if (tape->merge_stage_size % tape->tape_block_size) { | 2779 | if (tape->merge_stage_size % tape->tape_block_size) { |
@@ -2847,7 +2818,6 @@ static void idetape_empty_write_pipeline (ide_drive_t *drive) | |||
2847 | * can be totally different on the next backup). | 2818 | * can be totally different on the next backup). |
2848 | */ | 2819 | */ |
2849 | tape->max_stages = tape->min_pipeline; | 2820 | tape->max_stages = tape->min_pipeline; |
2850 | #if IDETAPE_DEBUG_BUGS | ||
2851 | if (tape->first_stage != NULL || | 2821 | if (tape->first_stage != NULL || |
2852 | tape->next_stage != NULL || | 2822 | tape->next_stage != NULL || |
2853 | tape->last_stage != NULL || | 2823 | tape->last_stage != NULL || |
@@ -2858,7 +2828,6 @@ static void idetape_empty_write_pipeline (ide_drive_t *drive) | |||
2858 | tape->first_stage, tape->next_stage, | 2828 | tape->first_stage, tape->next_stage, |
2859 | tape->last_stage, tape->nr_stages); | 2829 | tape->last_stage, tape->nr_stages); |
2860 | } | 2830 | } |
2861 | #endif /* IDETAPE_DEBUG_BUGS */ | ||
2862 | } | 2831 | } |
2863 | 2832 | ||
2864 | static void idetape_restart_speed_control (ide_drive_t *drive) | 2833 | static void idetape_restart_speed_control (ide_drive_t *drive) |
@@ -2889,12 +2858,10 @@ static int idetape_initiate_read (ide_drive_t *drive, int max_stages) | |||
2889 | idetape_empty_write_pipeline(drive); | 2858 | idetape_empty_write_pipeline(drive); |
2890 | idetape_flush_tape_buffers(drive); | 2859 | idetape_flush_tape_buffers(drive); |
2891 | } | 2860 | } |
2892 | #if IDETAPE_DEBUG_BUGS | ||
2893 | if (tape->merge_stage || tape->merge_stage_size) { | 2861 | if (tape->merge_stage || tape->merge_stage_size) { |
2894 | printk (KERN_ERR "ide-tape: merge_stage_size should be 0 now\n"); | 2862 | printk (KERN_ERR "ide-tape: merge_stage_size should be 0 now\n"); |
2895 | tape->merge_stage_size = 0; | 2863 | tape->merge_stage_size = 0; |
2896 | } | 2864 | } |
2897 | #endif /* IDETAPE_DEBUG_BUGS */ | ||
2898 | if ((tape->merge_stage = __idetape_kmalloc_stage(tape, 0, 0)) == NULL) | 2865 | if ((tape->merge_stage = __idetape_kmalloc_stage(tape, 0, 0)) == NULL) |
2899 | return -ENOMEM; | 2866 | return -ENOMEM; |
2900 | tape->chrdev_direction = idetape_direction_read; | 2867 | tape->chrdev_direction = idetape_direction_read; |
@@ -2995,12 +2962,10 @@ static int idetape_add_chrdev_read_request (ide_drive_t *drive,int blocks) | |||
2995 | tape->pipeline_head++; | 2962 | tape->pipeline_head++; |
2996 | calculate_speeds(drive); | 2963 | calculate_speeds(drive); |
2997 | } | 2964 | } |
2998 | #if IDETAPE_DEBUG_BUGS | ||
2999 | if (bytes_read > blocks * tape->tape_block_size) { | 2965 | if (bytes_read > blocks * tape->tape_block_size) { |
3000 | printk(KERN_ERR "ide-tape: bug: trying to return more bytes than requested\n"); | 2966 | printk(KERN_ERR "ide-tape: bug: trying to return more bytes than requested\n"); |
3001 | bytes_read = blocks * tape->tape_block_size; | 2967 | bytes_read = blocks * tape->tape_block_size; |
3002 | } | 2968 | } |
3003 | #endif /* IDETAPE_DEBUG_BUGS */ | ||
3004 | return (bytes_read); | 2969 | return (bytes_read); |
3005 | } | 2970 | } |
3006 | 2971 | ||
@@ -3299,13 +3264,11 @@ static ssize_t idetape_chrdev_write (struct file *file, const char __user *buf, | |||
3299 | if (tape->chrdev_direction != idetape_direction_write) { | 3264 | if (tape->chrdev_direction != idetape_direction_write) { |
3300 | if (tape->chrdev_direction == idetape_direction_read) | 3265 | if (tape->chrdev_direction == idetape_direction_read) |
3301 | idetape_discard_read_pipeline(drive, 1); | 3266 | idetape_discard_read_pipeline(drive, 1); |
3302 | #if IDETAPE_DEBUG_BUGS | ||
3303 | if (tape->merge_stage || tape->merge_stage_size) { | 3267 | if (tape->merge_stage || tape->merge_stage_size) { |
3304 | printk(KERN_ERR "ide-tape: merge_stage_size " | 3268 | printk(KERN_ERR "ide-tape: merge_stage_size " |
3305 | "should be 0 now\n"); | 3269 | "should be 0 now\n"); |
3306 | tape->merge_stage_size = 0; | 3270 | tape->merge_stage_size = 0; |
3307 | } | 3271 | } |
3308 | #endif /* IDETAPE_DEBUG_BUGS */ | ||
3309 | if ((tape->merge_stage = __idetape_kmalloc_stage(tape, 0, 0)) == NULL) | 3272 | if ((tape->merge_stage = __idetape_kmalloc_stage(tape, 0, 0)) == NULL) |
3310 | return -ENOMEM; | 3273 | return -ENOMEM; |
3311 | tape->chrdev_direction = idetape_direction_write; | 3274 | tape->chrdev_direction = idetape_direction_write; |
@@ -3333,12 +3296,10 @@ static ssize_t idetape_chrdev_write (struct file *file, const char __user *buf, | |||
3333 | if (tape->restart_speed_control_req) | 3296 | if (tape->restart_speed_control_req) |
3334 | idetape_restart_speed_control(drive); | 3297 | idetape_restart_speed_control(drive); |
3335 | if (tape->merge_stage_size) { | 3298 | if (tape->merge_stage_size) { |
3336 | #if IDETAPE_DEBUG_BUGS | ||
3337 | if (tape->merge_stage_size >= tape->stage_size) { | 3299 | if (tape->merge_stage_size >= tape->stage_size) { |
3338 | printk(KERN_ERR "ide-tape: bug: merge buffer too big\n"); | 3300 | printk(KERN_ERR "ide-tape: bug: merge buffer too big\n"); |
3339 | tape->merge_stage_size = 0; | 3301 | tape->merge_stage_size = 0; |
3340 | } | 3302 | } |
3341 | #endif /* IDETAPE_DEBUG_BUGS */ | ||
3342 | actually_written = min((unsigned int)(tape->stage_size - tape->merge_stage_size), (unsigned int)count); | 3303 | actually_written = min((unsigned int)(tape->stage_size - tape->merge_stage_size), (unsigned int)count); |
3343 | if (idetape_copy_stage_from_user(tape, tape->merge_stage, buf, actually_written)) | 3304 | if (idetape_copy_stage_from_user(tape, tape->merge_stage, buf, actually_written)) |
3344 | ret = -EFAULT; | 3305 | ret = -EFAULT; |