Received: by 10.213.65.68 with SMTP id h4csp1756597imn; Mon, 19 Mar 2018 12:24:20 -0700 (PDT) X-Google-Smtp-Source: AG47ELvqRJ7iAVf18tiDHHEJ/TUH9WySFyuuCnK+qGrg/PLIiZW/+ojL+S0rb8xKisbDxHg0ZeVi X-Received: by 2002:a17:902:9308:: with SMTP id bc8-v6mr9645495plb.189.1521487460283; Mon, 19 Mar 2018 12:24:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521487460; cv=none; d=google.com; s=arc-20160816; b=YKwD+py5yXCjkDKngpprocc43OV1NVjli97UrW2mfUETRToLWrW44wW2LMisv+Tw87 FohxWIFQVf1bnURk0yiNe6pWAZgUtilscbOX0LmudK/ucb9GD6A2adli8V2Oyc70eJCX Hzy6XX1hAwL6kZhFhi/REDAjcNFNJTolZtCeGP3he1LEUp88xl66SKtNkTbvX6IKrknc AEe1bvKFk5M12Mga7uwYMB+s6FtTsVYZ4PBAHQGTl4sMaY8a8Zgm6TbrEmxjcldn/V70 ftHKC8vBn8olBCYgxHn194vTPzFMvTD5uDmxZyHJwsW13l3jBZfwcXKF4KnpgTaDMroC 3M3A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=9AJfmlKh1215va3z5UFx8d57hg/rCsJq0VfgSgyNN+0=; b=GvULcaEKRTYGA8ltzu4dDgcwaVvDPURl+0G+VLcZ+uZ+/zL08TaUqm2AcUIXL/lJIY g4qQp0AdfyP4q7jrPcDTYmbh1+K3pqqcc1rDmEhXd4fQbg1sVirEO30CCerwYh9LK3UA AyxolBaQJxmta8prDDJhYnWZlobHv7jboDbYCMmfQ8Aj0RyoJlYxgMlaepptEqyEZ1Uz /qVzGcwYRQk0p1WsOtHy0dHDWiKxvHtFltNSDxiOcAXWm9WEipZ3XBSGxk0+BEWVKmEX CbwQFJdRvk//ZYUpIboHRjacvYnMm/SAuVJltWT4JDVwv2P+p5BjtOCv57cpHrr/px59 yFlA== 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 l6si390432pgc.732.2018.03.19.12.24.04; Mon, 19 Mar 2018 12:24:20 -0700 (PDT) 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 S1031580AbeCSSZI (ORCPT + 99 others); Mon, 19 Mar 2018 14:25:08 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:50168 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1031570AbeCSSY6 (ORCPT ); Mon, 19 Mar 2018 14:24:58 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 340C2FD2; Mon, 19 Mar 2018 18:24:57 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alan Stern , Yuyang Du , Felipe Balbi , Sasha Levin Subject: [PATCH 4.9 140/241] usb: gadget: dummy_hcd: Fix wrong power status bit clear/reset in dummy_hub_control() Date: Mon, 19 Mar 2018 19:06:45 +0100 Message-Id: <20180319180756.983304643@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180319180751.172155436@linuxfoundation.org> References: <20180319180751.172155436@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.9-stable review patch. If anyone has any objections, please let me know. ------------------ From: Yuyang Du [ Upstream commit 9f20dfb44d03745d0d3cef2ffb3abf8d8024fa61 ] This fixes the commit: 1cd8fd2887e1 ("usb: gadget: dummy_hcd: add SuperSpeed support"). In the case of ClearPortFeature and USB_PORT_FEAT_POWER, simply clear the right bit regardless of what the wValue is. Acked-by: Alan Stern Signed-off-by: Yuyang Du Signed-off-by: Felipe Balbi Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/usb/gadget/udc/dummy_hcd.c | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) --- a/drivers/usb/gadget/udc/dummy_hcd.c +++ b/drivers/usb/gadget/udc/dummy_hcd.c @@ -2103,16 +2103,13 @@ static int dummy_hub_control( } break; case USB_PORT_FEAT_POWER: - if (hcd->speed == HCD_USB3) { - if (dum_hcd->port_status & USB_PORT_STAT_POWER) - dev_dbg(dummy_dev(dum_hcd), - "power-off\n"); - } else - if (dum_hcd->port_status & - USB_SS_PORT_STAT_POWER) - dev_dbg(dummy_dev(dum_hcd), - "power-off\n"); - /* FALLS THROUGH */ + dev_dbg(dummy_dev(dum_hcd), "power-off\n"); + if (hcd->speed == HCD_USB3) + dum_hcd->port_status &= ~USB_SS_PORT_STAT_POWER; + else + dum_hcd->port_status &= ~USB_PORT_STAT_POWER; + set_link_state(dum_hcd); + break; default: dum_hcd->port_status &= ~(1 << wValue); set_link_state(dum_hcd); @@ -2283,14 +2280,13 @@ static int dummy_hub_control( if ((dum_hcd->port_status & USB_SS_PORT_STAT_POWER) != 0) { dum_hcd->port_status |= (1 << wValue); - set_link_state(dum_hcd); } } else if ((dum_hcd->port_status & USB_PORT_STAT_POWER) != 0) { dum_hcd->port_status |= (1 << wValue); - set_link_state(dum_hcd); } + set_link_state(dum_hcd); } break; case GetPortErrorCount: