Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp5418669imu; Sun, 20 Jan 2019 10:25:05 -0800 (PST) X-Google-Smtp-Source: ALg8bN4L1lgb5b6GrGFWL4GWDVvjjw1EisMPjJK/swrxxVzctbu048WtVzYmmx0VpUuqnvSNCB6/ X-Received: by 2002:a63:d104:: with SMTP id k4mr24763632pgg.227.1548008705859; Sun, 20 Jan 2019 10:25:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548008705; cv=none; d=google.com; s=arc-20160816; b=jctP1sZLcDCiftwxOUENnecfcriTgUeUMOZcVLYeEcTsbfe2ypiHnoN4psnVnmFU5b jl6VQzYfe+zC5urOYVmu+fugKkSwBT3r3E2/qYB+O6nBu00sgXg9pYVNEc2LPhlfT5TY Bd6kaUZmW9n93cHNUbL1NHhqyaKgQ+16Eh7PKsjwQwmseglCbRjp7R/Bk4U1IoN9lqzR Nz9K9emBqyqjlF38m97OJsUyL7/zFqq+/Y+c6ajlvHTnZxjFryjJAj2liVz/w2zEFF2R ID+CUmeNK98fZosnalbguR8Myygc4ICgHxNKICVOy6aRKzG8lOooIFhz42yzrX3lQEPg XSOw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=sVJQwF63ETEnAv0IiKeZsOHT6xT1sC/5EAjok9Z59oM=; b=i3R0U+TvCHQH922APs6PCm2Yrv83Tq3sJoX7IWZxFU6AHSTJYVvz7OUnR5rWaT35ch Q9wR5riIIowqg8zN+gx/QgqL1cK24cNda8hYQKc3uXOjrfFisffrRt/zTNHk5P/RySdn I/PPba97hq4kZpEJi94QRbwDqbyLF2Cqxv4K71OpP5aGRP2JJFBVzfSHvFcrRwAXTePq yFylzKp8DpxMkXqeS2xjM+L/lp8gO8yPIRGfqinvKjIhQ/ikv8fawbimFt5y8620Mr3l RdKxvHml7uWvN1MQ+F8wkjwLUfje0yp1uA6jSgouy+8O2iIcBu1v/q2QlIRyCphBphRc mbpg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=LtaEkGAd; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v10si5614664pgt.343.2019.01.20.10.24.21; Sun, 20 Jan 2019 10:25:05 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=LtaEkGAd; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727263AbfATR7k (ORCPT + 99 others); Sun, 20 Jan 2019 12:59:40 -0500 Received: from perceval.ideasonboard.com ([213.167.242.64]:37794 "EHLO perceval.ideasonboard.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726786AbfATR7j (ORCPT ); Sun, 20 Jan 2019 12:59:39 -0500 Received: from localhost.localdomain (unknown [96.44.9.117]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 2020441; Sun, 20 Jan 2019 18:59:36 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1548007177; bh=NZKxA8iCufbOY9AOA0y8QkiK/5zr7vkaHb9+RHxdPcI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=LtaEkGAdqnxL3/0JDRwQeU7L5qo64QEb+JqqgKOsLqJEILbEgShsNRLr8G4FW6oga sD4kn+0qxwhfLJvnRpMoBGZV5ol6pKdxu7mCdCJTPSurKSrNOABTXNXlBFjmVekXaZ EG//VxTU+Ws6WWQdFnlzr6p7VISQVi3ShPAeJYDA= Date: Sun, 20 Jan 2019 12:59:29 -0500 From: Paul Elder To: Alan Stern Cc: laurent.pinchart@ideasonboard.com, kieran.bingham@ideasonboard.com, b-liu@ti.com, rogerq@ti.com, balbi@kernel.org, gregkh@linuxfoundation.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v5 4/6] usb: gadget: add mechanism to specify an explicit status stage Message-ID: <20190120175929.GF7331@localhost.localdomain> References: <20190118163106.GC7331@localhost.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jan 18, 2019 at 11:52:57AM -0500, Alan Stern wrote: > On Fri, 18 Jan 2019, Paul Elder wrote: > > > > > I meant the functions (procedures) in the function driver, so the setup > > > > handler (uvc_function_setup), the completion handler > > > > (uvc_function_ep0_complete), and the status sender (uvc_send_response), > > > > although the last one actually sends the data stage for control IN. > > > > So after the status is sent on the uvc gadget driver's end, its > > > > completion handler is called again without the setup handler being > > > > called beforehand and I cant figure out why. > > > > > > Isn't this what you should expect? Every usb_request, if it is queued > > > successfully, eventually gets a completion callback. That promise is > > > made by every UDC driver; it's part of the gadget API. So for a > > > control transfer with a data stage, you expect to have: > > > > > > Setup handler called > > > Data-stage request submitted > > > Data-stage request completion callback > > > Status-stage request submitted > > > Status-stage request completion callback > > > > > > Thus, two completion callbacks but only one setup callback. > > > > omg how did I not notice this :/ > > > > I guess I have to fix the uvc function driver so it works with that. > > musb doesn't call the status stage completion callback though; not that > > it does anything so it seems fine to me, but indeed the function driver > > has to be ready for it if it is called. > > musb _has_ to call the status-stage completion callback. As just one > reason, if the explicit_status flag isn't set then that callback is > responsible for deallocating the status request. Without it, the > status request will leak. Ah, I see what you mean. I forgot about that because we reuse the request in uvc gadget. I'll have to add the status stage completion callback to musb too, then. Thanks, Paul