From patchwork Fri Oct 17 17:09:47 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felipe Balbi X-Patchwork-Id: 38905 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f200.google.com (mail-lb0-f200.google.com [209.85.217.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 56CB3202DB for ; Fri, 17 Oct 2014 17:10:38 +0000 (UTC) Received: by mail-lb0-f200.google.com with SMTP id b6sf714333lbj.11 for ; Fri, 17 Oct 2014 10:10:37 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe:content-type; bh=BxUeMVjBLuh3WI7wfGbU5TNYbT4o7wzLX1OC+LIg2V0=; b=MMYaQW9Bs/9TGPAPsBhzHPka8ObDJR2sxeKALUmqoZJ1s0mw1Wv2OxvTazqW52lkVz 1pwfJj+wWHgO3h6e4GiwR9KvPN20vZAunw3JsUb6j5rvV/3+3X9jGGgh/iN7Jai8XRze oa0RLE7RpLSvntEtAMrJoo/QPuxoACZIcDF9KjWJOaJZF0ZyG5QKiIwHPCTnS/H0BZkY iKew0TfP3wFqyOke37bKyn74VrDuMs1xc2pxXJZVLIP1RqsuCBTkomQ2iR9iliIaWQiB 66d44hmhjL3WfFqz5RyZC2glSzywfvKtIXXeElsbJuaj4demqX/3reqNfgL6CVRcD16+ jQ3Q== X-Gm-Message-State: ALoCoQnhAQSrvIKYfZWphBNxadIANB40RBtiEfe1IrC7cieKvn8dsKBcrJzE7J6MQ+ikXsveFtNO X-Received: by 10.194.241.232 with SMTP id wl8mr621541wjc.5.1413565837270; Fri, 17 Oct 2014 10:10:37 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.3.132 with SMTP id c4ls256460lac.88.gmail; Fri, 17 Oct 2014 10:10:37 -0700 (PDT) X-Received: by 10.112.221.226 with SMTP id qh2mr10266997lbc.5.1413565836979; Fri, 17 Oct 2014 10:10:36 -0700 (PDT) Received: from mail-la0-f42.google.com (mail-la0-f42.google.com. [209.85.215.42]) by mx.google.com with ESMTPS id ql10si3002757lbb.25.2014.10.17.10.10.36 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 17 Oct 2014 10:10:36 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.42 as permitted sender) client-ip=209.85.215.42; Received: by mail-la0-f42.google.com with SMTP id gf13so1183916lab.1 for ; Fri, 17 Oct 2014 10:10:36 -0700 (PDT) X-Received: by 10.112.167.38 with SMTP id zl6mr10215609lbb.34.1413565836747; Fri, 17 Oct 2014 10:10:36 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.84.229 with SMTP id c5csp266715lbz; Fri, 17 Oct 2014 10:10:36 -0700 (PDT) X-Received: by 10.68.129.103 with SMTP id nv7mr10011210pbb.56.1413565833690; Fri, 17 Oct 2014 10:10:33 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y1si1697524pdo.45.2014.10.17.10.10.33 for ; Fri, 17 Oct 2014 10:10:33 -0700 (PDT) Received-SPF: none (google.com: linux-usb-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753524AbaJQRK3 (ORCPT + 3 others); Fri, 17 Oct 2014 13:10:29 -0400 Received: from devils.ext.ti.com ([198.47.26.153]:35997 "EHLO devils.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752032AbaJQRK0 (ORCPT ); Fri, 17 Oct 2014 13:10:26 -0400 Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by devils.ext.ti.com (8.13.7/8.13.7) with ESMTP id s9HHAQKj024651 for ; Fri, 17 Oct 2014 12:10:26 -0500 Received: from DLEE70.ent.ti.com (dlee70.ent.ti.com [157.170.170.113]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id s9HHAQVm027787 for ; Fri, 17 Oct 2014 12:10:26 -0500 Received: from dflp32.itg.ti.com (10.64.6.15) by DLEE70.ent.ti.com (157.170.170.113) with Microsoft SMTP Server id 14.3.174.1; Fri, 17 Oct 2014 12:10:25 -0500 Received: from localhost (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp32.itg.ti.com (8.14.3/8.13.8) with ESMTP id s9HHAPIf022680; Fri, 17 Oct 2014 12:10:26 -0500 From: Felipe Balbi To: Linux USB Mailing List CC: Felipe Balbi Subject: [PATCH 11/28] usb: gadget: function: uvc: disable endpoints on ->disable() Date: Fri, 17 Oct 2014 12:09:47 -0500 Message-ID: <1413565804-13061-12-git-send-email-balbi@ti.com> X-Mailer: git-send-email 2.1.0.GIT In-Reply-To: <1413565804-13061-1-git-send-email-balbi@ti.com> References: <1413565804-13061-1-git-send-email-balbi@ti.com> MIME-Version: 1.0 Sender: linux-usb-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-usb@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: balbi@ti.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.42 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , when our ->disable() method is called, we must make sure to teardown all our resources, including endpoints. Signed-off-by: Felipe Balbi --- drivers/usb/gadget/function/f_uvc.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/usb/gadget/function/f_uvc.c b/drivers/usb/gadget/function/f_uvc.c index 413a09f..945b3bd 100644 --- a/drivers/usb/gadget/function/f_uvc.c +++ b/drivers/usb/gadget/function/f_uvc.c @@ -390,6 +390,16 @@ uvc_function_disable(struct usb_function *f) v4l2_event_queue(uvc->vdev, &v4l2_event); uvc->state = UVC_STATE_DISCONNECTED; + + if (uvc->video.ep->driver_data) { + usb_ep_disable(uvc->video.ep); + uvc->video.ep->driver_data = NULL; + } + + if (uvc->control_ep->driver_data) { + usb_ep_disable(uvc->control_ep); + uvc->control_ep->driver_data = NULL; + } } /* --------------------------------------------------------------------------