summaryrefslogtreecommitdiffstats
path: root/drivers/cdrom/sonycd535.c
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>1999-02-15 02:15:32 +0000
committerRalf Baechle <ralf@linux-mips.org>1999-02-15 02:15:32 +0000
commit86464aed71025541805e7b1515541aee89879e33 (patch)
treee01a457a4912a8553bc65524aa3125d51f29f810 /drivers/cdrom/sonycd535.c
parent88f99939ecc6a95a79614574cb7d95ffccfc3466 (diff)
Merge with Linux 2.2.1.
Diffstat (limited to 'drivers/cdrom/sonycd535.c')
-rw-r--r--drivers/cdrom/sonycd535.c23
1 files changed, 14 insertions, 9 deletions
diff --git a/drivers/cdrom/sonycd535.c b/drivers/cdrom/sonycd535.c
index f9a321b6f..f16b5b1d0 100644
--- a/drivers/cdrom/sonycd535.c
+++ b/drivers/cdrom/sonycd535.c
@@ -151,6 +151,8 @@
# define CDU535_MESSAGE_NAME "Sony CDU-535"
#endif
+#define CDU535_BLOCK_SIZE 2048
+
#ifndef MAX_SPINUP_RETRY
# define MAX_SPINUP_RETRY 3 /* 1 is sufficient for most drives... */
#endif
@@ -591,7 +593,6 @@ static int
seek_and_read_N_blocks(Byte params[], int n_blocks, Byte status[2],
Byte **buff, int buf_size)
{
- const int block_size = 2048;
Byte cmd_buff[7];
int i;
int read_status;
@@ -599,7 +600,7 @@ seek_and_read_N_blocks(Byte params[], int n_blocks, Byte status[2],
Byte *data_buff;
int sector_count = 0;
- if (buf_size < ((long)block_size) * n_blocks)
+ if (buf_size < CDU535_BLOCK_SIZE * n_blocks)
return NO_ROOM;
set_drive_mode(SONY535_CDROM_DRIVE_MODE, status);
@@ -625,7 +626,7 @@ seek_and_read_N_blocks(Byte params[], int n_blocks, Byte status[2],
if ((read_status & SONY535_DATA_NOT_READY_BIT) == 0) {
/* data is ready, read it */
data_buff = buff[sector_count++];
- for (i = 0; i < block_size; i++)
+ for (i = 0; i < CDU535_BLOCK_SIZE; i++)
*data_buff++ = inb(data_reg); /* unrolling this loop does not seem to help */
data_valid = 1;
break; /* exit the timeout loop */
@@ -639,7 +640,7 @@ seek_and_read_N_blocks(Byte params[], int n_blocks, Byte status[2],
/* read all the data, now read the status */
if ((i = read_exec_status(status)) != 0)
return i;
- return block_size * sector_count;
+ return CDU535_BLOCK_SIZE * sector_count;
} /* seek_and_read_N_blocks() */
/****************************************************************************
@@ -776,7 +777,7 @@ size_to_buf(unsigned int size, Byte *buf)
* The OS calls this to perform a read or write operation to the drive.
* Write obviously fail. Reads to a read ahead of sony_buffer_size
* bytes to help speed operations. This especially helps since the OS
- * uses 1024 byte blocks and the drive uses 2048 byte blocks. Since most
+ * may use 1024 byte blocks and the drive uses 2048 byte blocks. Since most
* data access on a CD is done sequentially, this saves a lot of operations.
*/
static void
@@ -873,7 +874,7 @@ do_cdu535_request(void)
* seek_and_read_N_blocks for the various cases.
*/
int readStatus = seek_and_read_N_blocks(params, read_size,
- status, sony_buffer, (read_size * 2048));
+ status, sony_buffer, (read_size * CDU535_BLOCK_SIZE));
if (0 <= readStatus) /* Good data; common case, placed first */
break;
if (readStatus == NO_ROOM || spin_up_retry == MAX_SPINUP_RETRY) {
@@ -1480,6 +1481,8 @@ static struct file_operations cdu_fops =
NULL /* revalidate */
};
+static int sonycd535_block_size = CDU535_BLOCK_SIZE;
+
/*
* Initialize the driver.
*/
@@ -1580,7 +1583,7 @@ sony535_init(void))
if (do_sony_cmd(cmd_buff, 2, status, ret_buff, 1, 1) == 0) {
/* set the drive mode successful, we are set! */
sony_buffer_size = SONY535_BUFFER_SIZE;
- sony_buffer_sectors = sony_buffer_size / 2048;
+ sony_buffer_sectors = sony_buffer_size / CDU535_BLOCK_SIZE;
printk(KERN_INFO CDU535_MESSAGE_NAME " I/F CDROM : %8.8s %16.16s %4.4s",
drive_config.vendor_id,
@@ -1597,6 +1600,7 @@ sony535_init(void))
return -EIO;
}
blk_dev[MAJOR_NR].request_fn = DEVICE_REQUEST;
+ blksize_size[MAJOR_NR] = &sonycd535_block_size;
read_ahead[MAJOR_NR] = 8; /* 8 sector (4kB) read-ahead */
sony_toc = (struct s535_sony_toc *)
@@ -1617,7 +1621,8 @@ sony535_init(void))
return -ENOMEM;
}
for (i = 0; i < sony_buffer_sectors; i++) {
- sony_buffer[i] = (Byte *)kmalloc(2048, GFP_KERNEL);
+ sony_buffer[i] =
+ (Byte *)kmalloc(CDU535_BLOCK_SIZE, GFP_KERNEL);
if (sony_buffer[i] == NULL) {
while (--i>=0)
kfree(sony_buffer[i]);
@@ -1680,7 +1685,7 @@ cleanup_module(void)
release_region(sony535_cd_base_io, 4);
for (i = 0; i < sony_buffer_sectors; i++)
- kfree_s(sony_buffer[i], 2048);
+ kfree_s(sony_buffer[i], CDU535_BLOCK_SIZE);
kfree_s(sony_buffer, 4 * sony_buffer_sectors);
kfree_s(last_sony_subcode, sizeof *last_sony_subcode);
kfree_s(sony_toc, sizeof *sony_toc);