ahci: add HFLAG_YES_FBS and apply it to 88SE9128
[pandora-kernel.git] / fs / fcntl.c
index f74d270..6769fd0 100644 (file)
@@ -274,7 +274,7 @@ static int f_setown_ex(struct file *filp, unsigned long arg)
 
        ret = copy_from_user(&owner, owner_p, sizeof(owner));
        if (ret)
-               return ret;
+               return -EFAULT;
 
        switch (owner.type) {
        case F_OWNER_TID:
@@ -332,8 +332,11 @@ static int f_getown_ex(struct file *filp, unsigned long arg)
        }
        read_unlock(&filp->f_owner.lock);
 
-       if (!ret)
+       if (!ret) {
                ret = copy_to_user(owner_p, &owner, sizeof(owner));
+               if (ret)
+                       ret = -EFAULT;
+       }
        return ret;
 }
 
@@ -730,12 +733,14 @@ static void kill_fasync_rcu(struct fasync_struct *fa, int sig, int band)
 {
        while (fa) {
                struct fown_struct *fown;
+               unsigned long flags;
+
                if (fa->magic != FASYNC_MAGIC) {
                        printk(KERN_ERR "kill_fasync: bad magic number in "
                               "fasync_struct!\n");
                        return;
                }
-               spin_lock(&fa->fa_lock);
+               spin_lock_irqsave(&fa->fa_lock, flags);
                if (fa->fa_file) {
                        fown = &fa->fa_file->f_owner;
                        /* Don't send SIGURG to processes which have not set a
@@ -744,7 +749,7 @@ static void kill_fasync_rcu(struct fasync_struct *fa, int sig, int band)
                        if (!(sig == SIGURG && fown->signum == 0))
                                send_sigio(fown, fa->fa_fd, band);
                }
-               spin_unlock(&fa->fa_lock);
+               spin_unlock_irqrestore(&fa->fa_lock, flags);
                fa = rcu_dereference(fa->fa_next);
        }
 }
@@ -762,11 +767,22 @@ void kill_fasync(struct fasync_struct **fp, int sig, int band)
 }
 EXPORT_SYMBOL(kill_fasync);
 
-static int __init fasync_init(void)
+static int __init fcntl_init(void)
 {
+       /* please add new bits here to ensure allocation uniqueness */
+       BUILD_BUG_ON(19 - 1 /* for O_RDONLY being 0 */ != HWEIGHT32(
+               O_RDONLY        | O_WRONLY      | O_RDWR        |
+               O_CREAT         | O_EXCL        | O_NOCTTY      |
+               O_TRUNC         | O_APPEND      | O_NONBLOCK    |
+               __O_SYNC        | O_DSYNC       | FASYNC        |
+               O_DIRECT        | O_LARGEFILE   | O_DIRECTORY   |
+               O_NOFOLLOW      | O_NOATIME     | O_CLOEXEC     |
+               FMODE_EXEC
+               ));
+
        fasync_cache = kmem_cache_create("fasync_cache",
                sizeof(struct fasync_struct), 0, SLAB_PANIC, NULL);
        return 0;
 }
 
-module_init(fasync_init)
+module_init(fcntl_init)