patch-2.3.17 linux/drivers/block/ide-cd.c

Next file: linux/drivers/block/ll_rw_blk.c
Previous file: linux/drivers/block/hpt366.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.3.16/linux/drivers/block/ide-cd.c linux/drivers/block/ide-cd.c
@@ -1247,20 +1247,10 @@
 
 	/* Figure out how much data to transfer. */
 	thislen = pc->buflen;
-	if (thislen < 0) thislen = -thislen;
 	if (thislen > len) thislen = len;
 
 	/* The drive wants to be written to. */
 	if ((ireason & 3) == 0) {
-		/* Check that we want to write. */
-		if (pc->buflen > 0) {
-			printk ("%s: cdrom_pc_intr: Drive wants "
-				"to transfer data the wrong way!\n",
-				drive->name);
-			pc->stat = 1;
-			thislen = 0;
-		}
-
 		/* Transfer the data. */
 		atapi_output_bytes (drive, pc->buffer, thislen);
 
@@ -1274,19 +1264,11 @@
 
 		/* Keep count of how much data we've moved. */
 		pc->buffer += thislen;
-		pc->buflen += thislen;
+		pc->buflen -= thislen;
 	}
 
 	/* Same drill for reading. */
 	else if ((ireason & 3) == 2) {
-		/* Check that we want to read. */
-		if (pc->buflen < 0) {
-			printk ("%s: cdrom_pc_intr: Drive wants to "
-				"transfer data the wrong way!\n",
-				drive->name);
-			pc->stat = 1;
-			thislen = 0;
-		}
 
 		/* Transfer the data. */
 		atapi_input_bytes (drive, pc->buffer, thislen);
@@ -1333,11 +1315,8 @@
 	struct cdrom_info *info = drive->driver_data;
 
 	info->dma = 0;
-
-	len = pc->buflen;
-	if (len < 0) len = -len;
-
 	pc->stat = 0;
+	len = pc->buflen;
 
 	/* Start sending the command to the drive. */
 	cdrom_start_packet_command (drive, len, cdrom_do_pc_continuation);
@@ -1794,10 +1773,13 @@
 	toc->xa_flag = (ms_tmp.hdr.first_track != ms_tmp.hdr.last_track);
 
 	/* Now try to get the total cdrom capacity. */
+#if 0
 	stat = cdrom_get_last_written(MKDEV(HWIF(drive)->major,
 				      drive->select.b.unit << PARTN_BITS),
 				     (long *)&toc->capacity);
-	if (stat) stat = cdrom_read_capacity (drive, &toc->capacity, reqbuf);
+	if (stat)
+#endif
+	stat = cdrom_read_capacity (drive, &toc->capacity, reqbuf);
 	if (stat) toc->capacity = 0x1fffff;
 
 	HWIF(drive)->gd->sizes[drive->select.b.unit << PARTN_BITS]
@@ -1863,7 +1845,7 @@
 	pc.sense_data = reqbuf;
 
 	pc.buffer =  buf;
-	pc.buflen = - buflen;
+	pc.buflen = buflen;
 	pc.c[0] = GPCMD_MODE_SELECT_10;
 	pc.c[1] = 0x10;
 	pc.c[2] = pageno;
@@ -2048,7 +2030,6 @@
 	return cgc->stat;
 }
 
-
 static
 int ide_cdrom_dev_ioctl (struct cdrom_device_info *cdi,
 			 unsigned int cmd, unsigned long arg)
@@ -2977,11 +2958,3 @@
 	MOD_DEC_USE_COUNT;
 	return 0;
 }
-
-
-/*==========================================================================*/
-/*
- * Local variables:
- * c-basic-offset: 8
- * End:
- */

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)