Message ID | 20180418193951.17922-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 94F07601D7 for <patchwork-linux-amlogic@patchwork.kernel.org>; Wed, 18 Apr 2018 19:41:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 85A7528834 for <patchwork-linux-amlogic@patchwork.kernel.org>; Wed, 18 Apr 2018 19:41:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7A83B2883A; Wed, 18 Apr 2018 19:41:34 +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 E401428834 for <patchwork-linux-amlogic@patchwork.kernel.org>; Wed, 18 Apr 2018 19:41:33 +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=R6L4ZzSYBkIS9LRiV1r3FIexD7 zRNnLN+kNjN3QQlBdD43AmDVbinE8il3ZbcPPQNrf2GUUiIGMRQMsmgAYprhsqPT5CHiB17TIWhtt EBDe8z0BtPemdwcXW2mfmFSN0wFZrOhyqXCKcIDV+QAsMsOB+Etqrdi/8VsjekkhaUizfiT+sRczN 8QGQMD41HB8Ro/mteA6RDG+Ox8K/zjIyQ2BjwLwBCqZ3mEXpslEuq+R1k3yhFQRGZhqRvVXeF25n1 1xGLyXkrWWo3+cEMZKrlm2FtdoJdGviCnr6l3qcKiOac0GySN6nWHO6IdVBsKeeKh/eIDZKkdHuZi MxieN6yg==; 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 1f8sxO-0003AC-Hz; Wed, 18 Apr 2018 19:41:30 +0000 Received: from mail-wr0-x242.google.com ([2a00:1450:400c:c0c::242]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1f8swN-0002az-7K; Wed, 18 Apr 2018 19:40:29 +0000 Received: by mail-wr0-x242.google.com with SMTP id q6-v6so7849841wrd.6; Wed, 18 Apr 2018 12:40:16 -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=XoMeu8//3qpkxOScuN9rY7hLa0OaaHCIgz8ppnKbolGeo2qLse0aO6Xp4fedUpmVhM I2k+sg750NAH+UouYqwWUZevlDhgaSoZMeX3ubV1+KYJFHtzYIdeIyh1MIe9BL4svTMX /TNAqaCTggbNFXRwUg55v9k982gQXDn+ojk+wiFxIe4v+QLDTdn4DOBJYuiLDWK+St5E eP4d3MT4UFWTw358/QG2LEzyInE4cd762JmUq2RqhRVNgSfxUY0g308aufv5pAEmXgBW BQoY7ZpLoGFcW/zMl7o5GROucEPCdWk6SP0wmo6FUuloNCNfeHM/Zg35Elpo7y5Bf+iG NOBw== 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=Sf29DUjZERY0k80ucDyVdV2Ke42HAXbN5Gcqlx3UZU835fByZRPHzkjwgVdbrnASnD Mxnt3kXJHSAfmr9JzHtCJ8dqFnhV3cvg0CC9vpVGhFPWgzoCHfCA0ZNVPtv1cc7wJIXg B/zJ+Wg6sjDSKbjNOJfGEHTg44rC8bjzat/vik8mD0xX3j1ln1xisurusQSAiydYqs9V ZUfbIFzJ9XQ5P2/axd4p3Wj7enxpTKyatr886M3OT998FnWtUxb4JbLtmmmLDO6VvsV4 H4NpB9jz/KJlwJk8xmfoz5YApc+aM4s0WLmDuuEs+m2NJXX5E5PJifLScgGpJc/HphEI GYjA== X-Gm-Message-State: ALQs6tCrYVO+kMv/MMQ6A36mB2AGbgEGc4X+YczxFRz2aao0VsJqyf6E q+nBVmL9LuYqb4DnQ9vK9vY= X-Google-Smtp-Source: AIpwx48GIuUUXzbrA/E2G53ugSlrSMplSlgYfe0ZUsdDRyIbjt9JeuaU1SJ0pc8GfASg54+moF35IA== X-Received: by 2002:adf:c682:: with SMTP id j2-v6mr2490178wrg.135.1524080415577; Wed, 18 Apr 2018 12:40:15 -0700 (PDT) Received: from blackbox.darklights.net (p200300DCD743A504F9143C002217B8ED.dip0.t-ipconnect.de. [2003:dc:d743:a504:f914:3c00:2217:b8ed]) by smtp.googlemail.com with ESMTPSA id 60-v6sm1871990wrj.62.2018.04.18.12.40.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Apr 2018 12:40:14 -0700 (PDT) From: Martin Blumenstingl <martin.blumenstingl@googlemail.com> To: linux-usb@vger.kernel.org, gregkh@linuxfoundation.org Subject: [PATCH usb v6 4/6] usb: core: phy: make it a no-op if CONFIG_GENERIC_PHY is disabled Date: Wed, 18 Apr 2018 21:39:49 +0200 Message-Id: <20180418193951.17922-5-martin.blumenstingl@googlemail.com> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180418193951.17922-1-martin.blumenstingl@googlemail.com> References: <20180418193951.17922-1-martin.blumenstingl@googlemail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180418_124027_301523_51313BA6 X-CRM114-Status: GOOD ( 13.84 ) 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(+)