Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp5065397imu; Tue, 8 Jan 2019 10:53:20 -0800 (PST) X-Google-Smtp-Source: ALg8bN7bvRpuafEwr9cPm5Yr+4xzfOu2UKgBmXA/Jl6usHsZY/XkRGeh3WMVMW+8/jN/Xd6Ikil5 X-Received: by 2002:a63:2c0e:: with SMTP id s14mr2605365pgs.132.1546973600263; Tue, 08 Jan 2019 10:53:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1546973600; cv=none; d=google.com; s=arc-20160816; b=ibQIsZpQf7pH+7oac1FcCtgTH65gmtjAU8kIrXKs8+hDo2GreqP/TKwl2fQt9l5oF2 x0EcjQwa1iYXy3g3PnMAHreplZPnhdHXfB3j51myCZebK4jkouU56PRzxoMhk2MRGhYO PKwcNyVrGOELyU65foCOKaTPzVA3oV5ZwUnYA19GZFhu50aA+mVWJfHeHrwB8C45NMmS 5RyF3cRNe8FNoiIIar9MoidL5rSuu6GYzf7CZ9mbzxI7BYFfZ0W9Vqb3PAOe9R2syDp/ lgsC1DY5r0FXqCniKKjoZKvkSlQS9wr5QjyIPDl+LJZAJ2lK7hhT69qzvitaK1pQJp0D KB+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:in-reply-to:subject:cc:to:from:date; bh=K/I5+7UI7TrCJwKLriA1wRuam3j0DVb6BhrM9yZbgJI=; b=lsAFAwidJkCWtGHgmVWsKYmasH7VnvOcFM///Shmbim62pJOia/eJhfmUIOs/ZDWI6 pLqwNNocewMrSu4Ywp8o1zeip1O63hCgwpygEvMj9dyiuTq7WS7LyZ3VdoQE6FZgmw/r ae+NkufV78vDGlOc4ggf0KfZidkEs5q5c15lggHigclcxuZ7wxT378fz+9My4atIPfHl ID/OxBqy1wEG5wggmSOkbBns5XnZ/HTtSa2Ju/mLs1ygncwfD3nVmxmZPuWkLgZgJu7I MouxQZ91W/5sPD1NIGLazq4hXLVOLYeH90PifiEUk0tKS8hv7R+cPf1lZqvSFQqPipDx NMMQ== 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 v25si26975833pfj.139.2019.01.08.10.53.05; Tue, 08 Jan 2019 10:53:20 -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 S1728989AbfAHReS (ORCPT + 99 others); Tue, 8 Jan 2019 12:34:18 -0500 Received: from iolanthe.rowland.org ([192.131.102.54]:53914 "HELO iolanthe.rowland.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1728658AbfAHReS (ORCPT ); Tue, 8 Jan 2019 12:34:18 -0500 Received: (qmail 3940 invoked by uid 2102); 8 Jan 2019 12:34:17 -0500 Received: from localhost (sendmail-bs@127.0.0.1) by localhost with SMTP; 8 Jan 2019 12:34:17 -0500 Date: Tue, 8 Jan 2019 12:34:17 -0500 (EST) From: Alan Stern X-X-Sender: stern@iolanthe.rowland.org To: Kai Heng Feng cc: Greg KH , , Subject: Re: [PATCH v4] USB: Don't enable LPM if it's already enabled In-Reply-To: <98BF2E31-2F7F-47FA-B591-40B2FFBC65F1@canonical.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=UTF-8 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 9 Jan 2019, Kai Heng Feng wrote: > > On Jan 8, 2019, at 11:41 PM, Greg KH wrote: > > > > On Mon, Dec 03, 2018 at 06:26:43PM +0800, Kai-Heng Feng wrote: > >> USB Bluetooth controller QCA ROME (0cf3:e007) sometimes stops working > >> after S3: > >> [ 165.110742] Bluetooth: hci0: using NVM file: qca/nvm_usb_00000302.bin > >> [ 168.432065] Bluetooth: hci0: Failed to send body at 4 of 1953 (-110) > >> > >> After some experiments, I found that disabling LPM can workaround the > >> issue. > >> > >> On some platforms, the USB power is cut during S3, so the driver uses > >> reset-resume to resume the device. During port resume, LPM gets enabled > >> twice, by usb_reset_and_verify_device() and usb_port_resume(). > >> > >> So let's enable LPM for just once, as this solves the issue for the > >> device in question. > >> > >> Also consolidate USB2 LPM functions to usb_enable_usb2_hardware_lpm() > >> and usb_disable_usb2_hardware_lpm(). > > > > I thought I asked for this to be two different patches. One that does > > the "consolidation", and then one that fixes the bug. You are mixing > > two different things here together, making it harder to review. > > > > Can you please break this up and send a patch series, with the correct > > "Fixes:" tag added to the second patch that actually fixes the issue? > > The consolidation itself is the fix, so I am not sure how to break this up. > > In reset-resume case, LPM gets enabled twice, by > usb_reset_and_verify_device() and usb_port_resume(). > > If it’s a normal resume, LPM only gets enabled once, by > usb_port_resume(). > > Since all three checks (capable, allowed and enabled) are merged to > a single place, enabling LPM twice can be avoided, hence fixing the > issue. One approach would be to have the first patch add the new functions and change the code to call them instead of the original function, but leaves the checks the way they are now. Then the second patch could add the checks to the new functions and remove them from the call sites. I'm not sure if it's worth the effort to break things up that way, but it might make Greg happy. :-) Alan Stern