diff options
author | Ralf Baechle <ralf@linux-mips.org> | 1999-02-15 02:15:32 +0000 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 1999-02-15 02:15:32 +0000 |
commit | 86464aed71025541805e7b1515541aee89879e33 (patch) | |
tree | e01a457a4912a8553bc65524aa3125d51f29f810 /drivers/cdrom | |
parent | 88f99939ecc6a95a79614574cb7d95ffccfc3466 (diff) |
Merge with Linux 2.2.1.
Diffstat (limited to 'drivers/cdrom')
-rw-r--r-- | drivers/cdrom/cdrom.c | 86 | ||||
-rw-r--r-- | drivers/cdrom/cdu31a.c | 23 | ||||
-rw-r--r-- | drivers/cdrom/mcdx.c | 2 | ||||
-rw-r--r-- | drivers/cdrom/mcdx.h | 1 | ||||
-rw-r--r-- | drivers/cdrom/sbpcd.c | 28 | ||||
-rw-r--r-- | drivers/cdrom/sjcd.c | 6 | ||||
-rw-r--r-- | drivers/cdrom/sonycd535.c | 23 |
7 files changed, 100 insertions, 69 deletions
diff --git a/drivers/cdrom/cdrom.c b/drivers/cdrom/cdrom.c index 85ed482b8..410c6e455 100644 --- a/drivers/cdrom/cdrom.c +++ b/drivers/cdrom/cdrom.c @@ -1,7 +1,7 @@ /* linux/drivers/cdrom/cdrom.c. Copyright (c) 1996, 1997 David A. van Leeuwen. Copyright (c) 1997, 1998 Erik Andersen <andersee@debian.org> - Copyright (c) 1998 Jens Axboe and Chris Zwilling + Copyright (c) 1998, 1999 Jens Axboe May be copied or modified under the terms of the GNU General Public License. See linux/COPYING for more information. @@ -87,15 +87,27 @@ Thanks to Grant R. Guenther <grant@torque.net> for spotting this bug. -- Made a few things more pedanticly correct. - 2.50 Oct 19, 1998 - Jens Axboe <axboe@image.dk> +2.50 Oct 19, 1998 - Jens Axboe <axboe@image.dk> -- New maintainers! Erik was too busy to continue the work on the driver, so now Chris Zwilling <chris@cloudnet.com> and Jens Axboe <axboe@image.dk> will do their best to follow in his footsteps + + 2.51 Dec 20, 1998 - Jens Axboe <axboe@image.dk> + -- Check if drive is capable of doing what we ask before blindly changing + cdi->options in various ioctl. + -- Added version to proc entry. + + 2.52 Jan 16, 1998 - Jens Axboe <axboe@image.dk> + -- Fixed an error in open_for_data where we would sometimes not return + the correct error value. Thanks Huba Gaspar <huba@softcell.hu>. + -- Fixed module usage count - usage was based on /proc/sys/dev + instead of /proc/sys/dev/cdrom. This could lead to an oops when other + modules had entries in dev. -------------------------------------------------------------------------*/ -#define REVISION "Revision: 2.50" -#define VERSION "Id: cdrom.c 2.50 1998/10/19" +#define REVISION "Revision: 2.52" +#define VERSION "Id: cdrom.c 2.52 1999/01/16" /* I use an error-log mask to give fine grain control over the type of messages dumped to the system logs. The available masks include: */ @@ -211,6 +223,8 @@ int register_cdrom(struct cdrom_device_info *cdi) struct cdrom_device_ops *cdo = cdi->ops; int *change_capability = (int *)&cdo->capability; /* hack */ + cdinfo(CD_OPEN, "entering register_cdrom\n"); + if (major < 0 || major >= MAX_BLKDEV) return -1; if (cdo->open == NULL || cdo->release == NULL) @@ -236,9 +250,10 @@ int register_cdrom(struct cdrom_device_info *cdi) cdi->mc_flags = 0; cdo->n_minors = 0; cdi->options = CDO_USE_FFLAGS; - if (autoclose==1) + + if (autoclose==1 && cdo->capability & ~cdi->mask & CDC_OPEN_TRAY) cdi->options |= (int) CDO_AUTO_CLOSE; - if (autoeject==1) + if (autoeject==1 && cdo->capability & ~cdi->mask & CDC_OPEN_TRAY) cdi->options |= (int) CDO_AUTO_EJECT; if (lockdoor==1) cdi->options |= (int) CDO_LOCK; @@ -257,6 +272,8 @@ int unregister_cdrom(struct cdrom_device_info *unreg) struct cdrom_device_info *cdi, *prev; int major = MAJOR (unreg->dev); + cdinfo(CD_OPEN, "entering unregister_cdrom\n"); + if (major < 0 || major >= MAX_BLKDEV) return -1; @@ -353,7 +370,7 @@ int open_for_data(struct cdrom_device_info * cdi) goto clean_up_and_return; } } else { - cdinfo(CD_OPEN, "bummer. this driver can't close the tray.\n"); + cdinfo(CD_OPEN, "bummer. this drive can't close the tray.\n"); ret=-ENOMEDIUM; goto clean_up_and_return; } @@ -361,13 +378,16 @@ int open_for_data(struct cdrom_device_info * cdi) ret = cdo->drive_status(cdi, CDSL_CURRENT); if ((ret == CDS_NO_DISC) || (ret==CDS_TRAY_OPEN)) { cdinfo(CD_OPEN, "bummer. the tray is still not closed.\n"); + cdinfo(CD_OPEN, "tray might not contain a medium.\n"); ret=-ENOMEDIUM; goto clean_up_and_return; } cdinfo(CD_OPEN, "the tray is now closed.\n"); } - if (ret!=CDS_DISC_OK) + if (ret!=CDS_DISC_OK) { + ret = -ENOMEDIUM; goto clean_up_and_return; + } } cdrom_count_tracks(cdi, &tracks); if (tracks.error == CDS_NO_DISC) { @@ -405,7 +425,7 @@ int open_for_data(struct cdrom_device_info * cdi) cdo->lock_door(cdi, 1); cdinfo(CD_OPEN, "door locked.\n"); } - cdinfo(CD_OPEN, "device opened sucessfully.\n"); + cdinfo(CD_OPEN, "device opened successfully.\n"); return ret; /* Something failed. Try to unlock the drive, because some drivers @@ -687,7 +707,7 @@ int cdrom_ioctl(struct inode *ip, struct file *fp, sanitize_format(&ms_info.addr, &ms_info.addr_format, requested_format); IOCTL_OUT(arg, struct cdrom_multisession, ms_info); - cdinfo(CD_DO_IOCTL, "CDROMMULTISESSION sucessful\n"); + cdinfo(CD_DO_IOCTL, "CDROMMULTISESSION successful\n"); return 0; } @@ -713,6 +733,8 @@ int cdrom_ioctl(struct inode *ip, struct file *fp, case CDROMEJECT_SW: cdinfo(CD_DO_IOCTL, "entering CDROMEJECT_SW\n"); + if (!(cdo->capability & ~cdi->mask & CDC_OPEN_TRAY)) + return -ENOSYS; cdi->options &= ~(CDO_AUTO_CLOSE | CDO_AUTO_EJECT); if (arg) cdi->options |= CDO_AUTO_CLOSE | CDO_AUTO_EJECT; @@ -733,6 +755,8 @@ int cdrom_ioctl(struct inode *ip, struct file *fp, case CDROM_SET_OPTIONS: cdinfo(CD_DO_IOCTL, "entering CDROM_SET_OPTIONS\n"); + if (cdo->capability & arg & ~cdi->mask) + return -ENOSYS; cdi->options |= (int) arg; return cdi->options; @@ -773,7 +797,7 @@ int cdrom_ioctl(struct inode *ip, struct file *fp, if ((ret=cdo->get_mcn(cdi, &mcn))) return ret; IOCTL_OUT(arg, struct cdrom_mcn, mcn); - cdinfo(CD_DO_IOCTL, "CDROM_GET_MCN sucessful\n"); + cdinfo(CD_DO_IOCTL, "CDROM_GET_MCN successful\n"); return 0; } @@ -879,7 +903,7 @@ int cdrom_ioctl(struct inode *ip, struct file *fp, sanitize_format(&q.cdsc_absaddr, &back, requested); sanitize_format(&q.cdsc_reladdr, &q.cdsc_format, requested); IOCTL_OUT(arg, struct cdrom_subchnl, q); - /* cdinfo(CD_DO_IOCTL, "CDROMSUBCHNL sucessful\n"); */ + /* cdinfo(CD_DO_IOCTL, "CDROMSUBCHNL successful\n"); */ return 0; } case CDROMREADTOCHDR: { @@ -892,7 +916,7 @@ int cdrom_ioctl(struct inode *ip, struct file *fp, if ((ret=cdo->audio_ioctl(cdi, cmd, &header))) return ret; IOCTL_OUT(arg, struct cdrom_tochdr, header); - /* cdinfo(CD_DO_IOCTL, "CDROMREADTOCHDR sucessful\n"); */ + /* cdinfo(CD_DO_IOCTL, "CDROMREADTOCHDR successful\n"); */ return 0; } case CDROMREADTOCENTRY: { @@ -914,7 +938,7 @@ int cdrom_ioctl(struct inode *ip, struct file *fp, sanitize_format(&entry.cdte_addr, &entry.cdte_format, requested_format); IOCTL_OUT(arg, struct cdrom_tocentry, entry); - /* cdinfo(CD_DO_IOCTL, "CDROMREADTOCENTRY sucessful\n"); */ + /* cdinfo(CD_DO_IOCTL, "CDROMREADTOCENTRY successful\n"); */ return 0; } case CDROMPLAYMSF: { @@ -981,10 +1005,15 @@ static char cdrom_drive_info[CDROM_STR_SIZE]="info\n"; int cdrom_sysctl_info(ctl_table *ctl, int write, struct file * filp, void *buffer, size_t *lenp) { - int retv,pos; + int pos; struct cdrom_device_info *cdi; + + if (!*lenp || (filp->f_pos && !write)) { + *lenp = 0; + return 0; + } - pos = sprintf(cdrom_drive_info, "CD-ROM information\n"); + pos = sprintf(cdrom_drive_info, "CD-ROM information, " VERSION "\n"); pos += sprintf(cdrom_drive_info+pos, "\ndrive name:\t"); for (cdi=topCdromPtr;cdi!=NULL;cdi=cdi->next) @@ -1045,18 +1074,14 @@ int cdrom_sysctl_info(ctl_table *ctl, int write, struct file * filp, strcpy(cdrom_drive_info+pos,"\n\n"); *lenp=pos+3; - if (!write) { - retv = proc_dostring(ctl, write, filp, buffer, lenp); - } - else - retv = proc_dostring(ctl, write, filp, buffer, lenp); - return retv; + + return proc_dostring(ctl, write, filp, buffer, lenp); } /* Place files in /proc/sys/dev/cdrom */ ctl_table cdrom_table[] = { {DEV_CDROM_INFO, "info", &cdrom_drive_info, - CDROM_STR_SIZE*sizeof(char), 0444, NULL, &cdrom_sysctl_info}, + CDROM_STR_SIZE, 0444, NULL, &cdrom_sysctl_info}, {0} }; @@ -1083,20 +1108,23 @@ static struct ctl_table_header *cdrom_sysctl_header; */ static void cdrom_procfs_modcount(struct inode *inode, int fill) { - if (fill) - MOD_INC_USE_COUNT; - else - MOD_DEC_USE_COUNT; + if (fill) { + MOD_INC_USE_COUNT; + } else { + MOD_DEC_USE_COUNT; + } } static void cdrom_sysctl_register(void) { static int initialized = 0; - if ( initialized == 1 ) + if (initialized == 1) return; - cdrom_sysctl_header = register_sysctl_table(cdrom_root_table, 0); + + cdrom_sysctl_header = register_sysctl_table(cdrom_root_table, 1); cdrom_root_table->de->fill_inode = &cdrom_procfs_modcount; + initialized = 1; } diff --git a/drivers/cdrom/cdu31a.c b/drivers/cdrom/cdu31a.c index 7bafb457a..d893cdecd 100644 --- a/drivers/cdrom/cdu31a.c +++ b/drivers/cdrom/cdu31a.c @@ -32,7 +32,7 @@ * the following: * * retry_count = jiffies+ SONY_JIFFIES_TIMEOUT; - * while ((retry_count > jiffies) && (! <some condition to wait for)) + * while (time_before(jiffies, retry_count) && (! <some condition to wait for)) * { * while (handle_sony_cd_attention()) * ; @@ -488,7 +488,7 @@ static int scd_reset(struct cdrom_device_info * cdi) reset_drive(); retry_count = jiffies + SONY_RESET_TIMEOUT; - while ((retry_count > jiffies) && (!is_attention())) + while (time_before(jiffies, retry_count) && (!is_attention())) { sony_sleep(); } @@ -740,7 +740,7 @@ restart_on_error(void) printk("cdu31a: Resetting drive on error\n"); reset_drive(); retry_count = jiffies + SONY_RESET_TIMEOUT; - while ((retry_count > jiffies) && (!is_attention())) + while (time_before(jiffies, retry_count) && (!is_attention())) { sony_sleep(); } @@ -808,7 +808,7 @@ get_result(unsigned char *result_buffer, ; /* Wait for the result data to be ready */ retry_count = jiffies + SONY_JIFFIES_TIMEOUT; - while ((retry_count > jiffies) && (is_busy() || (!(is_result_ready())))) + while (time_before(jiffies, retry_count) && (is_busy() || (!(is_result_ready())))) { sony_sleep(); @@ -978,7 +978,7 @@ retry_cd_operation: sti(); retry_count = jiffies + SONY_JIFFIES_TIMEOUT; - while ((retry_count > jiffies) && (is_busy())) + while (time_before(jiffies, retry_count) && (is_busy())) { sony_sleep(); @@ -1246,7 +1246,7 @@ start_request(unsigned int sector, ; retry_count = jiffies + SONY_JIFFIES_TIMEOUT; - while ((retry_count > jiffies) && (is_busy())) + while (time_before(jiffies, retry_count) && (is_busy())) { sony_sleep(); @@ -1514,7 +1514,7 @@ read_data_block(char *buffer, /* Wait for the drive to tell us we have something */ retry_count = jiffies + SONY_JIFFIES_TIMEOUT; - while ((retry_count > jiffies) && !(is_data_ready())) + while (time_before(jiffies, retry_count) && !(is_data_ready())) { while (handle_sony_cd_attention()) ; @@ -1553,7 +1553,7 @@ read_data_block(char *buffer, /* Wait for the status from the drive. */ retry_count = jiffies + SONY_JIFFIES_TIMEOUT; - while ((retry_count > jiffies) && !(is_result_ready())) + while (time_before(jiffies, retry_count) && !(is_result_ready())) { while (handle_sony_cd_attention()) ; @@ -2432,8 +2432,7 @@ read_audio_data(char *buffer, /* Wait for the drive to tell us we have something */ retry_count = jiffies + SONY_JIFFIES_TIMEOUT; continue_read_audio_wait: - while ( (retry_count > jiffies) - && !(is_data_ready()) + while (time_before(jiffies, retry_count) && !(is_data_ready()) && !(is_result_ready() || result_read)) { while (handle_sony_cd_attention()) @@ -2495,7 +2494,7 @@ continue_read_audio_wait: { /* Wait for the drive to tell us we have something */ retry_count = jiffies + SONY_JIFFIES_TIMEOUT; - while ((retry_count > jiffies) && !(is_result_ready())) + while (time_before(jiffies, retry_count) && !(is_result_ready())) { while (handle_sony_cd_attention()) ; @@ -3286,7 +3285,7 @@ get_drive_configuration(unsigned short base_io, */ reset_drive(); retry_count = jiffies + SONY_RESET_TIMEOUT; - while ((retry_count > jiffies) && (!is_attention())) + while (time_before(jiffies, retry_count) && (!is_attention())) { sony_sleep(); } diff --git a/drivers/cdrom/mcdx.c b/drivers/cdrom/mcdx.c index 121550cc3..708b72833 100644 --- a/drivers/cdrom/mcdx.c +++ b/drivers/cdrom/mcdx.c @@ -1778,7 +1778,7 @@ mcdx_getval(struct s_drive_stuff *stuffp, int to, int delay, char* buf) if (!buf) buf = &c; while (inb((unsigned int) stuffp->rreg_status) & MCDX_RBIT_STEN) { - if (jiffies > timeout) return -1; + if (time_after(jiffies, timeout)) return -1; mcdx_delay(stuffp, delay); } diff --git a/drivers/cdrom/mcdx.h b/drivers/cdrom/mcdx.h index b1b431326..ac3c8c85b 100644 --- a/drivers/cdrom/mcdx.h +++ b/drivers/cdrom/mcdx.h @@ -77,7 +77,6 @@ /* *** make the following line uncommented, if you're sure, * *** all configuration is done */ /* #define I_WAS_HERE */ -#define I_WAS_HERE /* delete this line, it's for heiko only */ /* The name of the device */ #define MCDX "mcdx" diff --git a/drivers/cdrom/sbpcd.c b/drivers/cdrom/sbpcd.c index 8c7592146..73750c56c 100644 --- a/drivers/cdrom/sbpcd.c +++ b/drivers/cdrom/sbpcd.c @@ -1014,20 +1014,20 @@ static int CDi_stat_loop_T(void) { case 4: sbp_sleep(HZ); - if (jiffies > timeout_4) gear++; + if (time_after(jiffies, timeout_4)) gear++; msg(DBG_TEA, "CDi_stat_loop_T: long sleep active.\n"); break; case 3: sbp_sleep(HZ/10); - if (jiffies > timeout_3) gear++; + if (time_after(jiffies, timeout_3)) gear++; break; case 2: sbp_sleep(HZ/100); - if (jiffies > timeout_2) gear++; + if (time_after(jiffies, timeout_2)) gear++; break; case 1: sbp_sleep(0); - if (jiffies > timeout_1) gear++; + if (time_after(jiffies, timeout_1)) gear++; } } while (gear < 5); return -1; @@ -1037,7 +1037,7 @@ static int CDi_stat_loop(void) { int i,j; - for(timeout = jiffies + 10*HZ, i=maxtim_data; timeout > jiffies; ) + for(timeout = jiffies + 10*HZ, i=maxtim_data; time_before(jiffies, timeout); ) { for ( ;i!=0;i--) { @@ -1098,11 +1098,11 @@ static int ResponseInfo(void) st=inb(CDi_status); if (!(st&s_not_result_ready)) break; } - if ((j!=0)||(timeout<=jiffies)) break; + if ((j!=0)||time_after_eq(jiffies, timeout)) break; sbp_sleep(1); j = 1; } - if (timeout<=jiffies) break; + if (time_after_eq(jiffies, timeout)) break; infobuf[i]=inb(CDi_info); } #if 000 @@ -1238,7 +1238,7 @@ static int ResponseStatus(void) i=inb(CDi_status); if (!(i&s_not_result_ready)) break; } - if ((j!=0)||(timeout<jiffies)) break; + if ((j!=0)||time_after(jiffies, timeout)) break; sbp_sleep(1); j = 1; } @@ -4355,7 +4355,7 @@ static int sbpcd_dev_ioctl(struct cdrom_device_info *cdi, u_int cmd, if (!(j&s_not_result_ready)) break; if (fam0L_drive) if (j&s_attention) break; } - if (try != 0 || timeout <= jiffies) break; + if (try != 0 || time_after_eq(jiffies, timeout)) break; if (data_retrying == 0) data_waits++; data_retrying = 1; sbp_sleep(1); @@ -4419,7 +4419,7 @@ static int sbpcd_dev_ioctl(struct cdrom_device_info *cdi, u_int cmd, if (fam0L_drive) { i=maxtim_data; - for (timeout=jiffies+9*HZ; timeout > jiffies; timeout--) + for (timeout=jiffies+9*HZ; time_before(jiffies, timeout); timeout--) { for ( ;i!=0;i--) { @@ -4428,7 +4428,7 @@ static int sbpcd_dev_ioctl(struct cdrom_device_info *cdi, u_int cmd, if (!(j&s_not_result_ready)) break; if (j&s_attention) break; } - if (i != 0 || timeout <= jiffies) break; + if (i != 0 || time_after_eq(jiffies, timeout)) break; sbp_sleep(0); i = 1; } @@ -5250,7 +5250,7 @@ static int sbp_data(struct request *req) { SBPCD_CLI; i=maxtim_data; - for (timeout=jiffies+HZ; timeout > jiffies; timeout--) + for (timeout=jiffies+HZ; time_before(jiffies, timeout); timeout--) { for ( ;i!=0;i--) { @@ -5259,7 +5259,7 @@ static int sbp_data(struct request *req) if (!(j&s_not_result_ready)) break; if (j&s_attention) break; } - if (i != 0 || timeout <= jiffies) break; + if (i != 0 || time_after_eq(jiffies, timeout)) break; sbp_sleep(0); i = 1; } @@ -5701,7 +5701,7 @@ __initfunc(int SBPCD_INIT(void)) if (i<0) break; if (!st_caddy_in) break; } - while ((!st_diskok)||(timeout<jiffies)); + while ((!st_diskok)||time_after(jiffies, timeout)); } i=SetSpeed(); if (i>=0) D_S[j].CD_changed=1; diff --git a/drivers/cdrom/sjcd.c b/drivers/cdrom/sjcd.c index 6681f2a19..631dbffa6 100644 --- a/drivers/cdrom/sjcd.c +++ b/drivers/cdrom/sjcd.c @@ -1488,7 +1488,7 @@ __initfunc(int sjcd_init( void )){ /* * Wait 10ms approx. */ - for( timer = jiffies; jiffies <= timer; ); + for( timer = jiffies; time_before_eq(jiffies, timer); ); if ( (i % 100) == 0 ) printk( "." ); ( void )sjcd_check_status(); } @@ -1509,7 +1509,7 @@ __initfunc(int sjcd_init( void )){ /* * Wait 10ms approx. */ - for( timer = jiffies; jiffies <= timer; ); + for( timer = jiffies; time_before_eq(jiffies, timer); ); if ( (i % 100) == 0 ) printk( "." ); ( void )sjcd_check_status(); } @@ -1540,7 +1540,7 @@ __initfunc(int sjcd_init( void )){ /* * Wait 10ms approx. */ - for( timer = jiffies; jiffies <= timer; ); + for( timer = jiffies; time_before_eq(jiffies, timer); ); if ( (i % 100) == 0 ) printk( "." ); ( void )sjcd_check_status(); } 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); |