Loading drivers/usb/gadget/function/f_ncm.c +2 −1 Original line number Diff line number Diff line Loading @@ -1706,6 +1706,8 @@ static void ncm_unbind(struct usb_configuration *c, struct usb_function *f) DBG(c->cdev, "ncm unbind\n"); opts->bound = false; hrtimer_cancel(&ncm->task_timer); tasklet_kill(&ncm->tx_tasklet); Loading @@ -1716,7 +1718,6 @@ static void ncm_unbind(struct usb_configuration *c, struct usb_function *f) usb_ep_free_request(ncm->notify, ncm->notify_req); gether_cleanup(netdev_priv(opts->net)); opts->bound = false; } static struct usb_function *ncm_alloc(struct usb_function_instance *fi) Loading drivers/usb/gadget/function/u_ether_configfs.h +35 −0 Original line number Diff line number Diff line Loading @@ -35,6 +35,11 @@ struct f_##_f_##_opts *opts = to_f_##_f_##_opts(item); \ int result; \ \ if (opts->bound == false) { \ pr_err("Gadget function do not bind yet.\n"); \ return -ENODEV; \ } \ \ mutex_lock(&opts->lock); \ result = gether_get_dev_addr(opts->net, page, PAGE_SIZE); \ mutex_unlock(&opts->lock); \ Loading @@ -48,6 +53,11 @@ struct f_##_f_##_opts *opts = to_f_##_f_##_opts(item); \ int ret; \ \ if (opts->bound == false) { \ pr_err("Gadget function do not bind yet.\n"); \ return -ENODEV; \ } \ \ mutex_lock(&opts->lock); \ if (opts->refcnt) { \ mutex_unlock(&opts->lock); \ Loading @@ -70,6 +80,11 @@ struct f_##_f_##_opts *opts = to_f_##_f_##_opts(item); \ int result; \ \ if (opts->bound == false) { \ pr_err("Gadget function do not bind yet.\n"); \ return -ENODEV; \ } \ \ mutex_lock(&opts->lock); \ result = gether_get_host_addr(opts->net, page, PAGE_SIZE); \ mutex_unlock(&opts->lock); \ Loading @@ -83,6 +98,11 @@ struct f_##_f_##_opts *opts = to_f_##_f_##_opts(item); \ int ret; \ \ if (opts->bound == false) { \ pr_err("Gadget function do not bind yet.\n"); \ return -ENODEV; \ } \ \ mutex_lock(&opts->lock); \ if (opts->refcnt) { \ mutex_unlock(&opts->lock); \ Loading @@ -105,6 +125,11 @@ struct f_##_f_##_opts *opts = to_f_##_f_##_opts(item); \ unsigned qmult; \ \ if (opts->bound == false) { \ pr_err("Gadget function do not bind yet.\n"); \ return -ENODEV; \ } \ \ mutex_lock(&opts->lock); \ qmult = gether_get_qmult(opts->net); \ mutex_unlock(&opts->lock); \ Loading @@ -118,6 +143,11 @@ u8 val; \ int ret; \ \ if (opts->bound == false) { \ pr_err("Gadget function do not bind yet.\n"); \ return -ENODEV; \ } \ \ mutex_lock(&opts->lock); \ if (opts->refcnt) { \ ret = -EBUSY; \ Loading @@ -144,6 +174,11 @@ out: \ struct f_##_f_##_opts *opts = to_f_##_f_##_opts(item); \ int ret; \ \ if (opts->bound == false) { \ pr_err("Gadget function do not bind yet.\n"); \ return -ENODEV; \ } \ \ mutex_lock(&opts->lock); \ ret = gether_get_ifname(opts->net, page, PAGE_SIZE); \ mutex_unlock(&opts->lock); \ Loading Loading
drivers/usb/gadget/function/f_ncm.c +2 −1 Original line number Diff line number Diff line Loading @@ -1706,6 +1706,8 @@ static void ncm_unbind(struct usb_configuration *c, struct usb_function *f) DBG(c->cdev, "ncm unbind\n"); opts->bound = false; hrtimer_cancel(&ncm->task_timer); tasklet_kill(&ncm->tx_tasklet); Loading @@ -1716,7 +1718,6 @@ static void ncm_unbind(struct usb_configuration *c, struct usb_function *f) usb_ep_free_request(ncm->notify, ncm->notify_req); gether_cleanup(netdev_priv(opts->net)); opts->bound = false; } static struct usb_function *ncm_alloc(struct usb_function_instance *fi) Loading
drivers/usb/gadget/function/u_ether_configfs.h +35 −0 Original line number Diff line number Diff line Loading @@ -35,6 +35,11 @@ struct f_##_f_##_opts *opts = to_f_##_f_##_opts(item); \ int result; \ \ if (opts->bound == false) { \ pr_err("Gadget function do not bind yet.\n"); \ return -ENODEV; \ } \ \ mutex_lock(&opts->lock); \ result = gether_get_dev_addr(opts->net, page, PAGE_SIZE); \ mutex_unlock(&opts->lock); \ Loading @@ -48,6 +53,11 @@ struct f_##_f_##_opts *opts = to_f_##_f_##_opts(item); \ int ret; \ \ if (opts->bound == false) { \ pr_err("Gadget function do not bind yet.\n"); \ return -ENODEV; \ } \ \ mutex_lock(&opts->lock); \ if (opts->refcnt) { \ mutex_unlock(&opts->lock); \ Loading @@ -70,6 +80,11 @@ struct f_##_f_##_opts *opts = to_f_##_f_##_opts(item); \ int result; \ \ if (opts->bound == false) { \ pr_err("Gadget function do not bind yet.\n"); \ return -ENODEV; \ } \ \ mutex_lock(&opts->lock); \ result = gether_get_host_addr(opts->net, page, PAGE_SIZE); \ mutex_unlock(&opts->lock); \ Loading @@ -83,6 +98,11 @@ struct f_##_f_##_opts *opts = to_f_##_f_##_opts(item); \ int ret; \ \ if (opts->bound == false) { \ pr_err("Gadget function do not bind yet.\n"); \ return -ENODEV; \ } \ \ mutex_lock(&opts->lock); \ if (opts->refcnt) { \ mutex_unlock(&opts->lock); \ Loading @@ -105,6 +125,11 @@ struct f_##_f_##_opts *opts = to_f_##_f_##_opts(item); \ unsigned qmult; \ \ if (opts->bound == false) { \ pr_err("Gadget function do not bind yet.\n"); \ return -ENODEV; \ } \ \ mutex_lock(&opts->lock); \ qmult = gether_get_qmult(opts->net); \ mutex_unlock(&opts->lock); \ Loading @@ -118,6 +143,11 @@ u8 val; \ int ret; \ \ if (opts->bound == false) { \ pr_err("Gadget function do not bind yet.\n"); \ return -ENODEV; \ } \ \ mutex_lock(&opts->lock); \ if (opts->refcnt) { \ ret = -EBUSY; \ Loading @@ -144,6 +174,11 @@ out: \ struct f_##_f_##_opts *opts = to_f_##_f_##_opts(item); \ int ret; \ \ if (opts->bound == false) { \ pr_err("Gadget function do not bind yet.\n"); \ return -ENODEV; \ } \ \ mutex_lock(&opts->lock); \ ret = gether_get_ifname(opts->net, page, PAGE_SIZE); \ mutex_unlock(&opts->lock); \ Loading