From patchwork Fri Oct 17 17:09:51 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felipe Balbi X-Patchwork-Id: 38906 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f197.google.com (mail-wi0-f197.google.com [209.85.212.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 0E26620973 for ; Fri, 17 Oct 2014 17:10:38 +0000 (UTC) Received: by mail-wi0-f197.google.com with SMTP id n3sf794517wiv.0 for ; Fri, 17 Oct 2014 10:10:38 -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=iKG2RCucdhhCAnGwYvbrwajUtEQCfT+UweDOKp1z8XU=; b=MPRjzw9or8gh1OdT1YgKO1iU+UXc9rohKwireJZVs9WJ+h35r0fs/oPV2xcfhvkNfO 2YQ2FfYHlhOyfwfQYAY16a9UbsrRdQIRe7VjOr99JMrHfevcJ3/1aj1MLTrOBx0GUELB uZ1oKAJF5X0Y29AAiyahKgmx+V+mx8sJZdkslaRvqDPEBqp6tmKeHZxhgCQk1JiJfxQs lHKTDg5vhwVrPbxRVMCWJe3LFFBT00YBoxwTBO7H9nYL/bbwsbpbXOJiqHJNDwlHo/E7 W/8fnzZdvT3HaJCaKtVV/9b429eYjamd0jWel/k/ZY8eckTBVGCamEMMCY236vgnoo1v PTZg== X-Gm-Message-State: ALoCoQkRazP+MFCHWL+cS2dolEQhKAV9mP0mOb1G5wkX/pZWVlRkki1TLBE11ebEu4ee40jMk2On X-Received: by 10.180.75.133 with SMTP id c5mr48392wiw.3.1413565838297; Fri, 17 Oct 2014 10:10:38 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.7.230 with SMTP id m6ls303118laa.89.gmail; Fri, 17 Oct 2014 10:10:38 -0700 (PDT) X-Received: by 10.112.180.198 with SMTP id dq6mr10073501lbc.56.1413565837994; Fri, 17 Oct 2014 10:10:37 -0700 (PDT) Received: from mail-lb0-f169.google.com (mail-lb0-f169.google.com. [209.85.217.169]) by mx.google.com with ESMTPS id ei3si2950866lad.84.2014.10.17.10.10.37 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 17 Oct 2014 10:10:37 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.169 as permitted sender) client-ip=209.85.217.169; Received: by mail-lb0-f169.google.com with SMTP id 10so1037596lbg.0 for ; Fri, 17 Oct 2014 10:10:37 -0700 (PDT) X-Received: by 10.112.130.41 with SMTP id ob9mr10033334lbb.74.1413565837859; Fri, 17 Oct 2014 10:10:37 -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 c5csp266717lbz; Fri, 17 Oct 2014 10:10:37 -0700 (PDT) X-Received: by 10.66.252.8 with SMTP id zo8mr9864280pac.12.1413565835980; Fri, 17 Oct 2014 10:10:35 -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.35 for ; Fri, 17 Oct 2014 10:10:35 -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 S1753541AbaJQRKd (ORCPT + 3 others); Fri, 17 Oct 2014 13:10:33 -0400 Received: from bear.ext.ti.com ([192.94.94.41]:44002 "EHLO bear.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753526AbaJQRKb (ORCPT ); Fri, 17 Oct 2014 13:10:31 -0400 Received: from dflxv15.itg.ti.com ([128.247.5.124]) by bear.ext.ti.com (8.13.7/8.13.7) with ESMTP id s9HHAUCS007478 for ; Fri, 17 Oct 2014 12:10:30 -0500 Received: from DLEE70.ent.ti.com (dlemailx.itg.ti.com [157.170.170.113]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id s9HHAUJl023168 for ; Fri, 17 Oct 2014 12:10:30 -0500 Received: from dlep33.itg.ti.com (157.170.170.75) by DLEE70.ent.ti.com (157.170.170.113) with Microsoft SMTP Server id 14.3.174.1; Fri, 17 Oct 2014 12:10:29 -0500 Received: from localhost (ileax41-snat.itg.ti.com [10.172.224.153]) by dlep33.itg.ti.com (8.14.3/8.13.8) with ESMTP id s9HHATj4021703; Fri, 17 Oct 2014 12:10:30 -0500 From: Felipe Balbi To: Linux USB Mailing List CC: Felipe Balbi Subject: [PATCH 15/28] usb: gadget: function: f_obex: fix Interface Descriptor Test Date: Fri, 17 Oct 2014 12:09:51 -0500 Message-ID: <1413565804-13061-16-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.217.169 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: , On USB20CV's Interface Descriptor Test, a series of SetInterface/GetInterface requests are issued and gadget driver is required to always return correct alternate setting. In one step of the test, g_serial with f_obex was returning the wrong value (1 instead of 0). In order to fix this, we will now hold currently selected alternate setting inside our struct f_obex and just return that from our ->get_alt() implementation. Note that his also simplifies the code a bit. Signed-off-by: Felipe Balbi --- drivers/usb/gadget/function/f_obex.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/usb/gadget/function/f_obex.c b/drivers/usb/gadget/function/f_obex.c index 5f40080..1a1a490 100644 --- a/drivers/usb/gadget/function/f_obex.c +++ b/drivers/usb/gadget/function/f_obex.c @@ -35,6 +35,7 @@ struct f_obex { struct gserial port; u8 ctrl_id; u8 data_id; + u8 cur_alt; u8 port_num; u8 can_activate; }; @@ -235,6 +236,8 @@ static int obex_set_alt(struct usb_function *f, unsigned intf, unsigned alt) } else goto fail; + obex->cur_alt = alt; + return 0; fail: @@ -245,10 +248,7 @@ static int obex_get_alt(struct usb_function *f, unsigned intf) { struct f_obex *obex = func_to_obex(f); - if (intf == obex->ctrl_id) - return 0; - - return obex->port.in->driver_data ? 1 : 0; + return obex->cur_alt; } static void obex_disable(struct usb_function *f)