From patchwork Tue Apr 4 07:25:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 7679 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2838427vqo; Tue, 4 Apr 2023 00:33:30 -0700 (PDT) X-Google-Smtp-Source: AKy350Z/twJFi42NMVfjz2EzYBulxBREYdJRP4DWP6YGijGMLN1dOCc91d9JjsQUcgnMXcJaXTVJ X-Received: by 2002:a17:902:e884:b0:1a2:296:9355 with SMTP id w4-20020a170902e88400b001a202969355mr2195809plg.16.1680593610090; Tue, 04 Apr 2023 00:33:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680593610; cv=none; d=google.com; s=arc-20160816; b=qQh4rYJWv+FvNi79j+efR3xxgTiqT2KBtEvmrdT+2dBuBZCgcYuCv83empFibsXb/p MqKWxyZUfmpgQbYtBKk2jKhKM8pdJGdYsIx0qesJHz4dvQoq7Jk9xOu3MdN8kbwD6JHv u5lgIp9OjAeqeDfKzjud15iTm77TQgsqKcAWtgAWIAq4a3SuZV9k2FFT1tLE/VECWJgb Eht93Ma8QoDU/+WdQJT2+IkupXCHRaoczeV8P6H82KMIUzTlVA4lQybCguOHJP+KfOw3 bLodGXtRH5icF6pmiJ6tQnMh9q619te86eCCL9Y5yZG6TPt5jaRSWNismbCO3CCjAvyE iPyQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=8QmNJY1u0axWlbUnuA2jBMheHkmqud4BR/C8E4DeujQ=; b=l4KIs3fCaDnL6ihwk5DGm1FDnrhs52NzU6wPfGTLt73Z0+Ea5PiZ+qx5PNw56/2XHe icd1ObjltnXERR5WMJrMYbP/co1SPunTFByTPtKccQFFJBT4ae7UI6XcbdMWHfwYY3ZU BQ5YiO18RT8lWLkuMTW/Y/FHaS+59pjlwE7VPSw7Kuunxc2bNzBbRuISKpgjsvRfRI8d DkCwMa6qvkTMo6UNC2TZsVPp8riYkGQHwECgPGwIAo441nMUGP3xedE3fqgIo5ytBgHd eu1Jvnn+dym2A99RVnScaPh4Slfwj9g6JfLwA10gM/1jAj+P2t9lXA54wiOndaIB4awR JPIA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=lIywFly4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l6-20020a170903244600b001a1f3916f4bsi10312566pls.265.2023.04.04.00.33.17; Tue, 04 Apr 2023 00:33:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=lIywFly4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234016AbjDDH0Y (ORCPT + 99 others); Tue, 4 Apr 2023 03:26:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56334 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233850AbjDDHZz (ORCPT ); Tue, 4 Apr 2023 03:25:55 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0BF762704; Tue, 4 Apr 2023 00:25:46 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 7DD3962F6D; Tue, 4 Apr 2023 07:25:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CFFBDC433A0; Tue, 4 Apr 2023 07:25:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1680593145; bh=mn2h65ezqykHfNm9cluQczqVnvmM9+sVb+m1AOd6lJU=; h=From:To:Cc:Subject:Date:From; b=lIywFly4FN+zFkJsDzTqGqa8hMizWK05LijBmRxH9Zg5f4ZwRn9XUkRjdST5V1IUB 0/o8tYOzxPjPXxopgGPmsXR5SLEK36GbuXESBJH+wvPbPb2lt8jO3aFmbe9enxk6RN pXhGbWhaY7f4tgHC3CyavobyPzahxG24Sbz34adT06sAzxAKe3FNlafqYMENv+gtxk Gute3LdACRrlJp/64Fmmq4QrVUlR4LbAMpAKopnDsJLzJyHIFo1hEvJz1STlsSChhF +xyErAYB/uwQL1L/9iJlocQhWvzLRWc0H/5dZUvaaTI1L9ocSGosTAQ5oNoBZA4IB+ zS2g7l17fJcbA== Received: from johan by xi.lan with local (Exim 4.94.2) (envelope-from ) id 1pjb3U-0004xO-HA; Tue, 04 Apr 2023 09:26:12 +0200 From: Johan Hovold To: Thinh Nguyen Cc: Greg Kroah-Hartman , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Johan Hovold Subject: [PATCH 00/11] USB: dwc3: error handling fixes and cleanups Date: Tue, 4 Apr 2023 09:25:13 +0200 Message-Id: <20230404072524.19014-1-johan+linaro@kernel.org> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 X-Spam-Status: No, score=-5.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1762230125163049930?= X-GMAIL-MSGID: =?utf-8?q?1762230125163049930?= When reviewing the dwc3 runtime PM implementation I noticed that the probe error handling and unbind code was broken. The first two patches addresses the corresponding imbalances. The probe error handling has suffered from some bit rot over years and an attempt to clean it up lead to the realisation that the code dealing with the "hibernation" feature was both broken and had never been used. Rather than try to fix up something which has never been used since it was first merged ten years ago, let's get rid of this dead code until there is a mainline user (and a complete implementation). The rest of the series clean up probe and core initialisation by using descriptive error labels and adding a few helper functions to improve readability which will hopefully help prevent similar bugs from being introduced in the future. Johan Johan Hovold (11): USB: dwc3: fix runtime pm imbalance on probe errors USB: dwc3: fix runtime pm imbalance on unbind USB: dwc3: disable autosuspend on unbind USB: dwc3: gadget: drop dead hibernation code USB: dwc3: drop dead hibernation code USB: dwc3: clean up probe error labels USB: dwc3: clean up phy init error handling USB: dwc3: clean up core init error handling USB: dwc3: refactor phy handling USB: dwc3: refactor clock lookups USB: dwc3: clean up probe declarations drivers/usb/dwc3/core.c | 426 ++++++++++++++++---------------------- drivers/usb/dwc3/core.h | 8 - drivers/usb/dwc3/gadget.c | 46 +--- 3 files changed, 182 insertions(+), 298 deletions(-)