From patchwork Mon Feb 18 13:26:31 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 10818009 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 26FC4922 for ; Mon, 18 Feb 2019 13:26:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 14DB22AB83 for ; Mon, 18 Feb 2019 13:26:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 08BD12ABA9; Mon, 18 Feb 2019 13:26:37 +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=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A01C02AB83 for ; Mon, 18 Feb 2019 13:26:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731027AbfBRN0f (ORCPT ); Mon, 18 Feb 2019 08:26:35 -0500 Received: from mga12.intel.com ([192.55.52.136]:19279 "EHLO mga12.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728132AbfBRN0f (ORCPT ); Mon, 18 Feb 2019 08:26:35 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 18 Feb 2019 05:26:34 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.58,384,1544515200"; d="scan'208";a="117091942" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga006.jf.intel.com with ESMTP; 18 Feb 2019 05:26:33 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id 2BCAAE3; Mon, 18 Feb 2019 15:26:32 +0200 (EET) From: Andy Shevchenko To: Greg Kroah-Hartman , linux-usb@vger.kernel.org Cc: Andy Shevchenko , Felipe Balbi Subject: [PATCH v1] usb: dwc3: drd: Defer probe if extcon device is not found Date: Mon, 18 Feb 2019 15:26:31 +0200 Message-Id: <20190218132631.80196-1-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP In case the "linux,extcon-name" property is defined but device itself is not ready, defer the probe. Cc: Felipe Balbi Signed-off-by: Andy Shevchenko Acked-by: Felipe Balbi --- This is a missed part of the v2 [1] of the commit 268784ba14a7 ("usb: dwc3: drd: Add support for DR detection through extcon") which seems to be v1 mistakenly applied. Greg, it would be good to have this appended to v5.0 release, if it's not too late. [1]: https://patchwork.kernel.org/patch/10684311/ drivers/usb/dwc3/drd.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/usb/dwc3/drd.c b/drivers/usb/dwc3/drd.c index 869725d15c74..726100d1ac0d 100644 --- a/drivers/usb/dwc3/drd.c +++ b/drivers/usb/dwc3/drd.c @@ -457,8 +457,13 @@ static struct extcon_dev *dwc3_get_extcon(struct dwc3 *dwc) * This device property is for kernel internal use only and * is expected to be set by the glue code. */ - if (device_property_read_string(dev, "linux,extcon-name", &name) == 0) - return extcon_get_extcon_dev(name); + if (device_property_read_string(dev, "linux,extcon-name", &name) == 0) { + edev = extcon_get_extcon_dev(name); + if (!edev) + return ERR_PTR(-EPROBE_DEFER); + + return edev; + } np_phy = of_parse_phandle(dev->of_node, "phys", 0); np_conn = of_graph_get_remote_node(np_phy, -1, -1);