|
@@ -315,7 +315,6 @@ static ssize_t ffs_ep0_write(struct file *file, const char __user *buf,
|
|
return ret;
|
|
return ret;
|
|
}
|
|
}
|
|
|
|
|
|
- set_bit(FFS_FL_CALL_CLOSED_CALLBACK, &ffs->flags);
|
|
|
|
return len;
|
|
return len;
|
|
}
|
|
}
|
|
break;
|
|
break;
|
|
@@ -1463,8 +1462,7 @@ static void ffs_data_clear(struct ffs_data *ffs)
|
|
{
|
|
{
|
|
ENTER();
|
|
ENTER();
|
|
|
|
|
|
- if (test_and_clear_bit(FFS_FL_CALL_CLOSED_CALLBACK, &ffs->flags))
|
|
|
|
- ffs_closed(ffs);
|
|
|
|
|
|
+ ffs_closed(ffs);
|
|
|
|
|
|
BUG_ON(ffs->gadget);
|
|
BUG_ON(ffs->gadget);
|
|
|
|
|
|
@@ -3422,9 +3420,13 @@ static int ffs_ready(struct ffs_data *ffs)
|
|
ffs_obj->desc_ready = true;
|
|
ffs_obj->desc_ready = true;
|
|
ffs_obj->ffs_data = ffs;
|
|
ffs_obj->ffs_data = ffs;
|
|
|
|
|
|
- if (ffs_obj->ffs_ready_callback)
|
|
|
|
|
|
+ if (ffs_obj->ffs_ready_callback) {
|
|
ret = ffs_obj->ffs_ready_callback(ffs);
|
|
ret = ffs_obj->ffs_ready_callback(ffs);
|
|
|
|
+ if (ret)
|
|
|
|
+ goto done;
|
|
|
|
+ }
|
|
|
|
|
|
|
|
+ set_bit(FFS_FL_CALL_CLOSED_CALLBACK, &ffs->flags);
|
|
done:
|
|
done:
|
|
ffs_dev_unlock();
|
|
ffs_dev_unlock();
|
|
return ret;
|
|
return ret;
|
|
@@ -3443,7 +3445,8 @@ static void ffs_closed(struct ffs_data *ffs)
|
|
|
|
|
|
ffs_obj->desc_ready = false;
|
|
ffs_obj->desc_ready = false;
|
|
|
|
|
|
- if (ffs_obj->ffs_closed_callback)
|
|
|
|
|
|
+ if (test_and_clear_bit(FFS_FL_CALL_CLOSED_CALLBACK, &ffs->flags) &&
|
|
|
|
+ ffs_obj->ffs_closed_callback)
|
|
ffs_obj->ffs_closed_callback(ffs);
|
|
ffs_obj->ffs_closed_callback(ffs);
|
|
|
|
|
|
if (!ffs_obj->opts || ffs_obj->opts->no_configfs
|
|
if (!ffs_obj->opts || ffs_obj->opts->no_configfs
|