This commit was manufactured by cvs2svn to create tag
[linux-2.6.git] / drivers / cdrom / cdrom.c
index 2e1ee63..cd67fcd 100644 (file)
@@ -833,11 +833,8 @@ static int cdrom_open_write(struct cdrom_device_info *cdi)
        if (!cdrom_is_mrw(cdi, &mrw_write))
                mrw = 1;
 
-       if (CDROM_CAN(CDC_MO_DRIVE))
-               ram_write = 1;
-       else
-               (void) cdrom_is_random_writable(cdi, &ram_write);
-       
+       (void) cdrom_is_random_writable(cdi, &ram_write);
+
        if (mrw)
                cdi->mask &= ~CDC_MRW;
        else
@@ -858,7 +855,7 @@ static int cdrom_open_write(struct cdrom_device_info *cdi)
        else if (CDROM_CAN(CDC_DVD_RAM))
                ret = cdrom_dvdram_open_write(cdi);
        else if (CDROM_CAN(CDC_RAM) &&
-                !CDROM_CAN(CDC_CD_R|CDC_CD_RW|CDC_DVD|CDC_DVD_R|CDC_MRW|CDC_MO_DRIVE))
+                !CDROM_CAN(CDC_CD_R|CDC_CD_RW|CDC_DVD|CDC_DVD_R|CDC_MRW))
                ret = cdrom_ram_open_write(cdi);
        else if (CDROM_CAN(CDC_MO_DRIVE))
                ret = mo_open_write(cdi);
@@ -900,10 +897,10 @@ int cdrom_open(struct cdrom_device_info *cdi, struct inode *ip, struct file *fp)
                        goto err;
                if (fp->f_mode & FMODE_WRITE) {
                        ret = -EROFS;
-                       if (cdrom_open_write(cdi))
-                               goto err;
                        if (!CDROM_CAN(CDC_RAM))
                                goto err;
+                       if (cdrom_open_write(cdi))
+                               goto err;
                        ret = 0;
                }
        }
@@ -1924,8 +1921,6 @@ static int cdrom_read_cdda_old(struct cdrom_device_info *cdi, __u8 __user *ubuf,
        struct packet_command cgc;
        int nr, ret;
 
-       cdi->last_sense = 0;
-
        memset(&cgc, 0, sizeof(cgc));
 
        /*
@@ -1977,8 +1972,6 @@ static int cdrom_read_cdda_bpc(struct cdrom_device_info *cdi, __u8 __user *ubuf,
        if (!q)
                return -ENXIO;
 
-       cdi->last_sense = 0;
-
        while (nframes) {
                nr = nframes;
                if (cdi->cdda_method == CDDA_BPC_SINGLE)
@@ -2009,16 +2002,13 @@ static int cdrom_read_cdda_bpc(struct cdrom_device_info *cdi, __u8 __user *ubuf,
                rq->timeout = 60 * HZ;
                bio = rq->bio;
 
-               if (rq->bio)
-                       blk_queue_bounce(q, &rq->bio);
-
                if (blk_execute_rq(q, cdi->disk, rq)) {
                        struct request_sense *s = rq->sense;
                        ret = -EIO;
                        cdi->last_sense = s->sense_key;
                }
 
-               if (blk_rq_unmap_user(rq, bio, len))
+               if (blk_rq_unmap_user(rq, ubuf, bio, len))
                        ret = -EFAULT;
 
                if (ret)
@@ -2026,7 +2016,6 @@ static int cdrom_read_cdda_bpc(struct cdrom_device_info *cdi, __u8 __user *ubuf,
 
                nframes -= nr;
                lba += nr;
-               ubuf += len;
        }
 
        return ret;
@@ -2075,14 +2064,14 @@ retry:
  * these days. ATAPI / SCSI specific code now mainly resides in
  * mmc_ioct().
  */
-int cdrom_ioctl(struct file * file, struct cdrom_device_info *cdi,
-               struct inode *ip, unsigned int cmd, unsigned long arg)
+int cdrom_ioctl(struct cdrom_device_info *cdi, struct inode *ip,
+               unsigned int cmd, unsigned long arg)
 {
        struct cdrom_device_ops *cdo = cdi->ops;
        int ret;
 
        /* Try the generic SCSI command ioctl's first.. */
-       ret = scsi_cmd_ioctl(file, ip->i_bdev->bd_disk, cmd, (void __user *)arg);
+       ret = scsi_cmd_ioctl(ip->i_bdev->bd_disk, cmd, (void __user *)arg);
        if (ret != -ENOTTY)
                return ret;
 
@@ -2936,13 +2925,13 @@ struct cdrom_sysctl_settings {
 } cdrom_sysctl_settings;
 
 int cdrom_sysctl_info(ctl_table *ctl, int write, struct file * filp,
-                           void __user *buffer, size_t *lenp, loff_t *ppos)
+                           void __user *buffer, size_t *lenp)
 {
         int pos;
        struct cdrom_device_info *cdi;
        char *info = cdrom_sysctl_settings.info;
        
-       if (!*lenp || (*ppos && !write)) {
+       if (!*lenp || (filp->f_pos && !write)) {
                *lenp = 0;
                return 0;
        }
@@ -3031,7 +3020,7 @@ int cdrom_sysctl_info(ctl_table *ctl, int write, struct file * filp,
 
        strcpy(info+pos,"\n\n");
                
-        return proc_dostring(ctl, write, filp, buffer, lenp, ppos);
+        return proc_dostring(ctl, write, filp, buffer, lenp);
 }
 
 /* Unfortunately, per device settings are not implemented through
@@ -3063,13 +3052,13 @@ void cdrom_update_settings(void)
 }
 
 static int cdrom_sysctl_handler(ctl_table *ctl, int write, struct file * filp,
-                               void __user *buffer, size_t *lenp, loff_t *ppos)
+                               void __user *buffer, size_t *lenp)
 {
        int *valp = ctl->data;
        int val = *valp;
        int ret;
        
-       ret = proc_dointvec(ctl, write, filp, buffer, lenp, ppos);
+       ret = proc_dointvec(ctl, write, filp, buffer, lenp);
 
        if (write && *valp != val) {