Message ID | 20180408212743.22934-5-martin.blumenstingl@googlemail.com (mailing list archive) |
---|---|
State | Not Applicable |
Headers | show
Return-Path: <linux-amlogic-bounces+patchwork-linux-amlogic=patchwork.kernel.org@lists.infradead.org> Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id D983C604D4 for <patchwork-linux-amlogic@patchwork.kernel.org>; Sun, 8 Apr 2018 21:28:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C8C64287A6 for <patchwork-linux-amlogic@patchwork.kernel.org>; Sun, 8 Apr 2018 21:28:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BCE7528A02; Sun, 8 Apr 2018 21:28:43 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, DKIM_VALID, FREEMAIL_FROM, MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 278D3287A6 for <patchwork-linux-amlogic@patchwork.kernel.org>; Sun, 8 Apr 2018 21:28:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=+3O7ljsa1BA/dmvUFuaEfe6Pc0rEI4W09IuXiETvOqA=; b=AbPQoVP7n0HDUwcTuFRUk41P/D LK/tTwyD3MuV8z8cRySXznEb0/pC//oK00CCDFzsKxRVwQjSiV4jjcihMJB3MOqVwtFjgfvW5CBdb QGmqbc1XaW7mr/Q6mEDXfDcil1JhayhJH55M8kCMkbyS6AUbBfvcjFjHXARrbzvU45r0mPZ5GUrKf LldzzsadkVGnWDvCZYuV1iCcG9QybpInkVXPsuLpGxrOtANoQguY05AYjOGROxxoGH5Oco7rhSFLn VG8lneNjvfcy7WkCGcSybwhHeZNbhH7LnUmbw6VmBok4JgkPvO23+8kA/UtXCo+iFvLEyL3KlE9mo oZ1lCwgw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1f5Hrd-0006Ot-0L; Sun, 08 Apr 2018 21:28:41 +0000 Received: from mail-wr0-x241.google.com ([2a00:1450:400c:c0c::241]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1f5HrA-0005yr-8h; Sun, 08 Apr 2018 21:28:14 +0000 Received: by mail-wr0-x241.google.com with SMTP id d19so2906549wre.1; Sun, 08 Apr 2018 14:28:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=ZuEbBcOqud9+K0+H1xHXobWt6HY2p39yMwmD2yUjg1Q=; b=Ad4OZf/+t0l+DTWxEaRWcD4qHD6VqVXiaAJlrEclJx3NmCgrFhIsI5yovLa/OOhIKc ZHE1iDiVi51ilDNj+AG6InG7P6coMTSei+AgJi+VmXVNhHs2jNdBqphZDrChOKLCfW/B PzP9hr22TpnFNhTNuTh2mOnw16lr5tpa08C4SqntZc8Vt43s1eDfoMKtpe3sGIKKW747 zL96B66w7Qp650zRZ4/2utY2elTlf8E1ZJG7YlyYB9dsHDLZagZJZMAW/MOmaVjjFGeO XFH/+nx3GaYkOIi+8MuGedW3P+6lmc79BhmrfynKBjOSnQ8Vmzn8YCRD/cJnpdu091p2 Sjiw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=ZuEbBcOqud9+K0+H1xHXobWt6HY2p39yMwmD2yUjg1Q=; b=KnHZgwOE6WJDVUvvD2kYNynTADovJh3GNmDnPI4UeAlyVc0oEkpn/RW3lLyyT0buO4 +zhJapCMbVrXh3XVnl6pr/QG/7Bdrak1gr2TAoyJoNKdMTL9rPk7Oc9O6ttuoXWqel7N Oy4ikBJhbwN5w3U+85VVNbCmHrCBprGjctkhdVzNAbIy4H2+rsqGBXFIdlaD3o0yYI9P mGw1Y18NytZlVDr+0ASgB/Q+l068Rli6uFRV0jivlN9dFnYtludRrhXKoq0M0uUlqn6e IFUvT6b85i2k7aYrnjtvS41n2BXqxW1lNrTmenzhKx78f81le/qpvXdrvlSy44DtsRGO evFg== X-Gm-Message-State: AElRT7GTSi6+Z15aHzvWh8ECX/Wm+z0sIPrjKoxYMoJtgd4D4n2P4tPU 0Ofu6DxZVKCQy9Tb1fPWg0o= X-Google-Smtp-Source: AIpwx4/Ak7C31Xx9/JT+CLLIEyFhlpc54nGeMzzOzhPICBSNuDFKgiusFXY2qgMthXUMRX7vdZLJAQ== X-Received: by 10.223.130.102 with SMTP id 93mr21919502wrb.97.1523222881758; Sun, 08 Apr 2018 14:28:01 -0700 (PDT) Received: from blackbox.darklights.net (p5B056562.dip0.t-ipconnect.de. [91.5.101.98]) by smtp.googlemail.com with ESMTPSA id j21sm18476370wrb.49.2018.04.08.14.28.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 08 Apr 2018 14:28:01 -0700 (PDT) From: Martin Blumenstingl <martin.blumenstingl@googlemail.com> To: linux-usb@vger.kernel.org, gregkh@linuxfoundation.org Subject: [PATCH usb v5 4/6] usb: core: phy: make it a no-op if CONFIG_GENERIC_PHY is disabled Date: Sun, 8 Apr 2018 23:27:41 +0200 Message-Id: <20180408212743.22934-5-martin.blumenstingl@googlemail.com> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180408212743.22934-1-martin.blumenstingl@googlemail.com> References: <20180408212743.22934-1-martin.blumenstingl@googlemail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180408_142812_348472_23E8D9A3 X-CRM114-Status: GOOD ( 13.09 ) X-BeenThere: linux-amlogic@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: <linux-amlogic.lists.infradead.org> List-Unsubscribe: <http://lists.infradead.org/mailman/options/linux-amlogic>, <mailto:linux-amlogic-request@lists.infradead.org?subject=unsubscribe> List-Archive: <http://lists.infradead.org/pipermail/linux-amlogic/> List-Post: <mailto:linux-amlogic@lists.infradead.org> List-Help: <mailto:linux-amlogic-request@lists.infradead.org?subject=help> List-Subscribe: <http://lists.infradead.org/mailman/listinfo/linux-amlogic>, <mailto:linux-amlogic-request@lists.infradead.org?subject=subscribe> Cc: d-gerlach@ti.com, eric@anholt.net, j-keerthy@ti.com, stern@rowland.harvard.edu, chunfeng.yun@mediatek.com, yamada.masahiro@socionext.com, linux-mediatek@lists.infradead.org, linux-rpi-kernel@lists.infradead.org, matthias.bgg@gmail.com, linux-amlogic@lists.infradead.org, kishon@ti.com, Martin Blumenstingl <martin.blumenstingl@googlemail.com>, rogerq@ti.com MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-amlogic" <linux-amlogic-bounces@lists.infradead.org> Errors-To: linux-amlogic-bounces+patchwork-linux-amlogic=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP |
diff --git a/drivers/usb/core/phy.c b/drivers/usb/core/phy.c index a39d9bb26a4f..9879767452a2 100644 --- a/drivers/usb/core/phy.c +++ b/drivers/usb/core/phy.c @@ -50,6 +50,9 @@ struct usb_phy_roothub *usb_phy_roothub_alloc(struct device *dev) struct usb_phy_roothub *phy_roothub; int i, num_phys, err; + if (!IS_ENABLED(CONFIG_GENERIC_PHY)) + return NULL; + num_phys = of_count_phandle_with_args(dev->of_node, "phys", "#phy-cells"); if (num_phys <= 0)
If the generic PHY support is disabled the stub of devm_of_phy_get_by_index returns ENOSYS. This corner case isn't handled properly by usb_phy_roothub_add_phy and at least breaks USB support on Raspberry Pi (bcm2835_defconfig): dwc2 20980000.usb: dwc2_hcd_init() FAILED, returning -38 dwc2: probe of 20980000.usb failed with error -38 Let usb_phy_roothub_alloc() return in case CONFIG_GENERIC_PHY is disabled to fix this issue (compilers might even be smart enough to optimize away most of the code within usb_phy_roothub_alloc and usb_phy_roothub_add_phy if CONFIG_GENERIC_PHY is disabled). All existing usb_phy_roothub_* functions are already NULL-safe, so no special handling is required there. Fixes: 07dbff0ddbd8 ("usb: core: add a wrapper for the USB PHYs on the HCD") Reported-by: Stefan Wahren <stefan.wahren@i2se.com> Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com> --- drivers/usb/core/phy.c | 3 +++ 1 file changed, 3 insertions(+)