[PATCH] fix request->cmd == INT cases
[cascardo/linux.git] / drivers / cdrom / optcd.c
index 351a01d..efd619c 100644 (file)
@@ -101,7 +101,7 @@ static void debug(int debug_this, const char* fmt, ...)
                return;
 
        va_start(args, fmt);
-       vsprintf(s, fmt, args);
+       vsnprintf(s, sizeof(s), fmt, args);
        printk(KERN_DEBUG "optcd: %s\n", s);
        va_end(args);
 }
@@ -264,7 +264,7 @@ static inline int flag_low(int flag, unsigned long timeout)
 static int sleep_timeout;      /* max # of ticks to sleep */
 static DECLARE_WAIT_QUEUE_HEAD(waitq);
 static void sleep_timer(unsigned long data);
-static struct timer_list delay_timer = TIMER_INITIALIZER(sleep_timer, 0, 0);
+static DEFINE_TIMER(delay_timer, sleep_timer, 0, 0);
 static DEFINE_SPINLOCK(optcd_lock);
 static struct request_queue *opt_queue;
 
@@ -977,7 +977,7 @@ static int update_toc(void)
 static int current_valid(void)
 {
         return CURRENT &&
-               CURRENT->cmd == READ &&
+               rq_data_dir(CURRENT) == READ &&
                CURRENT->sector != -1;
 }
 
@@ -2033,7 +2033,6 @@ static int __init optcd_init(void)
        optcd_disk->first_minor = 0;
        optcd_disk->fops = &opt_fops;
        sprintf(optcd_disk->disk_name, "optcd");
-       sprintf(optcd_disk->devfs_name, "optcd");
 
        if (!request_region(optcd_port, 4, "optcd")) {
                printk(KERN_ERR "optcd: conflict, I/O port 0x%x already used\n",