Merge master.kernel.org:/pub/scm/linux/kernel/git/lethal/sh-2.6
[sfrench/cifs-2.6.git] / drivers / cdrom / cdrom.c
index 7ea0f48f8fa6e63c1bd081d29910d781cd6834b4..b36f44d4d1bf6c3d97e1682ff7611fb87e0044f1 100644 (file)
@@ -337,6 +337,12 @@ static const char *mrw_address_space[] = { "DMA", "GAA" };
 /* used in the audio ioctls */
 #define CHECKAUDIO if ((ret=check_for_audio_disc(cdi, cdo))) return ret
 
+/*
+ * Another popular OS uses 7 seconds as the hard timeout for default
+ * commands, so it is a good choice for us as well.
+ */
+#define CDROM_DEF_TIMEOUT      (7 * HZ)
+
 /* Not-exported routines. */
 static int open_for_data(struct cdrom_device_info * cdi);
 static int check_for_audio_disc(struct cdrom_device_info * cdi,
@@ -1528,7 +1534,7 @@ void init_cdrom_command(struct packet_command *cgc, void *buf, int len,
        cgc->buffer = (char *) buf;
        cgc->buflen = len;
        cgc->data_direction = type;
-       cgc->timeout = 5*HZ;
+       cgc->timeout = CDROM_DEF_TIMEOUT;
 }
 
 /* DVD handling */
@@ -1810,7 +1816,7 @@ static int dvd_read_disckey(struct cdrom_device_info *cdi, dvd_struct *s)
 
        size = sizeof(s->disckey.value) + 4;
 
-       if ((buf = (u_char *) kmalloc(size, GFP_KERNEL)) == NULL)
+       if ((buf = kmalloc(size, GFP_KERNEL)) == NULL)
                return -ENOMEM;
 
        init_cdrom_command(&cgc, buf, size, CGC_DATA_READ);
@@ -1861,7 +1867,7 @@ static int dvd_read_manufact(struct cdrom_device_info *cdi, dvd_struct *s)
 
        size = sizeof(s->manufact.value) + 4;
 
-       if ((buf = (u_char *) kmalloc(size, GFP_KERNEL)) == NULL)
+       if ((buf = kmalloc(size, GFP_KERNEL)) == NULL)
                return -ENOMEM;
 
        init_cdrom_command(&cgc, buf, size, CGC_DATA_READ);
@@ -2133,16 +2139,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, 0)) {
                        struct request_sense *s = rq->sense;
                        ret = -EIO;
                        cdi->last_sense = s->sense_key;
                }
 
-               if (blk_rq_unmap_user(bio, len))
+               if (blk_rq_unmap_user(bio))
                        ret = -EFAULT;
 
                if (ret)
@@ -2851,7 +2854,7 @@ static int mmc_ioctl(struct cdrom_device_info *cdi, unsigned int cmd,
                /* FIXME: we need upper bound checking, too!! */
                if (lba < 0)
                        return -EINVAL;
-               cgc.buffer = (char *) kmalloc(blocksize, GFP_KERNEL);
+               cgc.buffer = kmalloc(blocksize, GFP_KERNEL);
                if (cgc.buffer == NULL)
                        return -ENOMEM;
                memset(&sense, 0, sizeof(sense));
@@ -3033,7 +3036,7 @@ static int mmc_ioctl(struct cdrom_device_info *cdi, unsigned int cmd,
                int size = sizeof(dvd_struct);
                if (!CDROM_CAN(CDC_DVD))
                        return -ENOSYS;
-               if ((s = (dvd_struct *) kmalloc(size, GFP_KERNEL)) == NULL)
+               if ((s = kmalloc(size, GFP_KERNEL)) == NULL)
                        return -ENOMEM;
                cdinfo(CD_DO_IOCTL, "entering DVD_READ_STRUCT\n"); 
                if (copy_from_user(s, (dvd_struct __user *)arg, size)) {
@@ -3550,9 +3553,7 @@ static void cdrom_sysctl_register(void)
        if (initialized == 1)
                return;
 
-       cdrom_sysctl_header = register_sysctl_table(cdrom_root_table, 1);
-       if (cdrom_root_table->ctl_name && cdrom_root_table->child->de)
-               cdrom_root_table->child->de->owner = THIS_MODULE;
+       cdrom_sysctl_header = register_sysctl_table(cdrom_root_table);
 
        /* set the defaults */
        cdrom_sysctl_settings.autoclose = autoclose;