upgrade to fedora-2.6.12-1.1398.FC4 + vserver 2.0.rc7
[linux-2.6.git] / drivers / macintosh / adb.c
index b7cc2da..7297c77 100644 (file)
@@ -120,7 +120,7 @@ static struct adb_handler {
  * called.
  */
 static DECLARE_MUTEX(adb_handler_sem);
-static rwlock_t adb_handler_lock = RW_LOCK_UNLOCKED;
+static DEFINE_RWLOCK(adb_handler_lock);
 
 #if 0
 static void printADBreply(struct adb_request *req)
@@ -755,7 +755,7 @@ static int adb_release(struct inode *inode, struct file *file)
 static ssize_t adb_read(struct file *file, char __user *buf,
                        size_t count, loff_t *ppos)
 {
-       int ret;
+       int ret = 0;
        struct adbdev_state *state = file->private_data;
        struct adb_request *req;
        wait_queue_t wait = __WAITQUEUE_INITIALIZER(wait,current);
@@ -765,9 +765,8 @@ static ssize_t adb_read(struct file *file, char __user *buf,
                return -EINVAL;
        if (count > sizeof(req->reply))
                count = sizeof(req->reply);
-       ret = verify_area(VERIFY_WRITE, buf, count);
-       if (ret)
-               return ret;
+       if (!access_ok(VERIFY_WRITE, buf, count))
+               return -EFAULT;
 
        req = NULL;
        spin_lock_irqsave(&state->lock, flags);
@@ -824,9 +823,8 @@ static ssize_t adb_write(struct file *file, const char __user *buf,
                return -EINVAL;
        if (adb_controller == NULL)
                return -ENXIO;
-       ret = verify_area(VERIFY_READ, buf, count);
-       if (ret)
-               return ret;
+       if (!access_ok(VERIFY_READ, buf, count))
+               return -EFAULT;
 
        req = (struct adb_request *) kmalloc(sizeof(struct adb_request),
                                             GFP_KERNEL);