Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755675AbbHYLEu (ORCPT ); Tue, 25 Aug 2015 07:04:50 -0400 Received: from mga01.intel.com ([192.55.52.88]:6090 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755635AbbHYLEs (ORCPT ); Tue, 25 Aug 2015 07:04:48 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.15,745,1432623600"; d="scan'208";a="754968572" From: Heikki Krogerus To: Felipe Balbi Cc: David Cohen , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Srinivas Kandagatla , Giuseppe Cavallaro , Peter Griffin Subject: [PATCH 2/5] usb: dwc3: st: prepare the driver for generic usb_get_dr_mode function Date: Tue, 25 Aug 2015 14:04:32 +0300 Message-Id: <1440500675-55872-3-git-send-email-heikki.krogerus@linux.intel.com> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1440500675-55872-1-git-send-email-heikki.krogerus@linux.intel.com> References: <1440500675-55872-1-git-send-email-heikki.krogerus@linux.intel.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1951 Lines: 60 of_usb_get_dr_mode will be converted into more generic usb_get_dr_mode function that will take struct device instead of struct device_node as it's parameter. To make the conversion possible later, waiting for the platform device for dwc3 to be populated before calling of_usb_get_dr_mode. Signed-off-by: Heikki Krogerus CC: Giuseppe Cavallaro CC: Peter Griffin --- drivers/usb/dwc3/dwc3-st.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/drivers/usb/dwc3/dwc3-st.c b/drivers/usb/dwc3/dwc3-st.c index de4d52f..02d47d5 100644 --- a/drivers/usb/dwc3/dwc3-st.c +++ b/drivers/usb/dwc3/dwc3-st.c @@ -195,6 +195,7 @@ static int st_dwc3_probe(struct platform_device *pdev) struct resource *res; struct device *dev = &pdev->dev; struct device_node *node = dev->of_node, *child; + struct platform_device *child_pdev; struct regmap *regmap; int ret; @@ -253,8 +254,6 @@ static int st_dwc3_probe(struct platform_device *pdev) goto undo_softreset; } - dwc3_data->dr_mode = of_usb_get_dr_mode(child); - /* Allocate and initialize the core */ ret = of_platform_populate(node, NULL, NULL, dev); if (ret) { @@ -262,6 +261,15 @@ static int st_dwc3_probe(struct platform_device *pdev) goto undo_softreset; } + child_pdev = of_find_device_by_node(child); + if (!child_pdev) { + dev_err(dev, "failed to find dwc3 core device\n"); + ret = -ENODEV; + goto undo_softreset; + } + + dwc3_data->dr_mode = of_usb_get_dr_mode(child_pdev->dev.of_node); + /* * Configure the USB port as device or host according to the static * configuration passed from DT. -- 2.5.0 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/