On Mon, Oct 06 2014, Robert Baldyga <r.bald...@samsung.com> wrote:
> Since we can compose gadgets from many functions, there is the problem
> related to gadget breakage while FunctionFS daemon being closed. In some
> cases it's strongly desired to keep gadget alive for a while, despite
> FunctionFS files are closed, to allow another functions to complete
> some presumably critical operations.
>
> For this purpose this patch introduces "zombie" mode. It can be enabled
> by setting mount option "zombie=1", and results with defering function
> closure to the moment of reopening ep0 file or filesystem umount.
>
> When ffs->state == FFS_ZOMBIE:
> - function is still binded and visible to host,
> - setup requests are automatically stalled,
> - all another transfers are refused,
> - opening ep0 causes function close, and then FunctionFS is ready for
>   descriptors and string write,
> - umount of functionfs cause function close.

However, all the ep# files will still exist on the filesystem.  This may
be a bit confusing and error-prone, no?

>
> Signed-off-by: Robert Baldyga <r.bald...@samsung.com>
> ---
>  drivers/usb/gadget/function/f_fs.c | 25 ++++++++++++++++++++++---
>  drivers/usb/gadget/function/u_fs.h |  4 ++++
>  2 files changed, 26 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/usb/gadget/function/f_fs.c 
> b/drivers/usb/gadget/function/f_fs.c
> @@ -1222,6 +1225,12 @@ static int ffs_fs_parse_opts(struct ffs_sb_fill_data 
> *data, char *opts)
>  
>               /* Interpret option */
>               switch (eq - opts) {
> +             case 6:
> +                     if (!memcmp(opts, "zombie", 6))
> +                             data->zombie_mode  = !!value;

Unnecessary double space before =.

> +                     else
> +                             goto invalid;
> +                     break;
>               case 5:
>                       if (!memcmp(opts, "rmode", 5))
>                               data->root_mode  = (value & 0555) | S_IFDIR;
> diff --git a/drivers/usb/gadget/function/u_fs.h 
> b/drivers/usb/gadget/function/u_fs.h
> @@ -92,6 +92,8 @@ enum ffs_state {
>        */
>       FFS_ACTIVE,
>  
> +     FFS_ZOMBIE,
> +

Add comment describing the state.

>       /*
>        * All endpoints have been closed.  This state is also set if
>        * we encounter an unrecoverable error.  The only

-- 
Best regards,                                         _     _
.o. | Liege of Serenely Enlightened Majesty of      o' \,=./ `o
..o | Computer Science,  Michał “mina86” Nazarewicz    (o o)
ooo +--<m...@google.com>--<xmpp:min...@jabber.org>--ooO--(_)--Ooo--
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to