sched/headers: Prepare to move signal wakeup & sigpending methods from <linux/sched...
[linux-2.6-block.git] / drivers / usb / gadget / function / f_fs.c
index fd80c1b9c8234cf4de8371c7ca4e528bc4712fc3..a5b7cd6156987a80ad74ba73bde16a30de4e2bf9 100644 (file)
@@ -23,6 +23,7 @@
 #include <linux/export.h>
 #include <linux/hid.h>
 #include <linux/module.h>
+#include <linux/sched/signal.h>
 #include <linux/uio.h>
 #include <asm/unaligned.h>
 
@@ -1230,7 +1231,7 @@ static long ffs_epfile_ioctl(struct file *file, unsigned code,
                        desc = epfile->ep->descs[desc_idx];
 
                        spin_unlock_irq(&epfile->ffs->eps_lock);
-                       ret = copy_to_user((void *)value, desc, sizeof(*desc));
+                       ret = copy_to_user((void *)value, desc, desc->bLength);
                        if (ret)
                                ret = -EFAULT;
                        return ret;
@@ -2101,7 +2102,7 @@ static int __ffs_data_do_entity(enum ffs_entity_type type,
        case FFS_ENDPOINT:
                d = (void *)desc;
                helper->eps_count++;
-               if (helper->eps_count >= 15)
+               if (helper->eps_count >= FFS_MAX_EPS_COUNT)
                        return -EINVAL;
                /* Check if descriptors for any speed were already parsed */
                if (!helper->ffs->eps_count && !helper->ffs->interfaces_count)
@@ -3698,7 +3699,7 @@ static void ffs_closed(struct ffs_data *ffs)
                goto done;
 
        if (opts->no_configfs || !opts->func_inst.group.cg_item.ci_parent
-           || !atomic_read(&opts->func_inst.group.cg_item.ci_kref.refcount))
+           || !kref_read(&opts->func_inst.group.cg_item.ci_kref))
                goto done;
 
        ci = opts->func_inst.group.cg_item.ci_parent->ci_parent;