Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3349165imu; Fri, 18 Jan 2019 08:54:47 -0800 (PST) X-Google-Smtp-Source: ALg8bN6jgnT6cPgB5TqaBfYvXPcS3DVubhp0V3rmphbMQVrmwSq2WHAgRiD7BH0sAJlNPk2YvhEJ X-Received: by 2002:a17:902:9a04:: with SMTP id v4mr20161856plp.34.1547830487886; Fri, 18 Jan 2019 08:54:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547830487; cv=none; d=google.com; s=arc-20160816; b=Z+sVYOUZ9nVorNK7lodEUjThehAZIeEDTsQ/ke5Oy9TFcUXbc1URX7t1uRna1+wSln PlStD1RfCLZqaHHvU/PBu8SEozIZNuLvNWyA/3Z/5h72LBEkrnA8/+DVxW0JwvAxTHN6 52uLRdLZdO3/t7PZv5DyWXLO+dBeOeskFSn3xrjeKl831hcI6PjYQs0RdAGRONjTF5IG O6M6CO1eyJTVCnJ2CxRtt6ek+qnhZGoqC6R1ysw3MG7mogLY8O06DVOrXg7ZxlcbwLKs IphDBeBVsWsYtXP+o/C44rw0jrA//qiYqqF+cfZCX+/O2qwFeL7ZO6ptvLOZIlk1N2d5 Earg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:in-reply-to :subject:cc:to:from:date; bh=UOeuTJJtOdIfhJGZpd2SUrxPkifRZwHFhpaVvSvV3fw=; b=X/UZEjQrX/ipAvigqy9YUJR2b2R5pSnbDjajIQD9UiPLdfQnwGSOasNxC4dXLtKEOA lykHxae+Mj6Wyuy0lBUMfW77ctCN/QzXpzKZ1arl+8i6agMGb66B7qYhTguc/C4b6rkQ kUK9dLxACBuY5LkcmULz9ivAbzo7qKZ+DP58Om74aQzSz1CNpUpu6BOEtLKujBAFgA7q oumctbTn3cJlczEQDs2dqczv5xDuT87oCruPBmEYn2RjE3wmqjuKoSz0z6dmXGcd3L+P awsrKUHfaBLKL286dwMroljgmL0FzEgV3TjYzDEw4g7B3SkM9176wyBP1Z+Yfyjei2Fu 50yQ== ARC-Authentication-Results: i=1; mx.google.com; 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 b91si3011735plb.11.2019.01.18.08.54.27; Fri, 18 Jan 2019 08:54:47 -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; 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 S1728167AbfARQw6 (ORCPT + 99 others); Fri, 18 Jan 2019 11:52:58 -0500 Received: from iolanthe.rowland.org ([192.131.102.54]:44498 "HELO iolanthe.rowland.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1727481AbfARQw6 (ORCPT ); Fri, 18 Jan 2019 11:52:58 -0500 Received: (qmail 4237 invoked by uid 2102); 18 Jan 2019 11:52:57 -0500 Received: from localhost (sendmail-bs@127.0.0.1) by localhost with SMTP; 18 Jan 2019 11:52:57 -0500 Date: Fri, 18 Jan 2019 11:52:57 -0500 (EST) From: Alan Stern X-X-Sender: stern@iolanthe.rowland.org To: Paul Elder cc: laurent.pinchart@ideasonboard.com, , , , , , , Subject: Re: [PATCH v5 4/6] usb: gadget: add mechanism to specify an explicit status stage In-Reply-To: <20190118163106.GC7331@localhost.localdomain> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Alan Stern