From patchwork Tue Nov 29 17:22:11 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Quentin Schulz X-Patchwork-Id: 84887 Delivered-To: patch@linaro.org Received: by 10.182.1.168 with SMTP id 8csp2408463obn; Tue, 29 Nov 2016 09:24:06 -0800 (PST) X-Received: by 10.84.218.136 with SMTP id r8mr63830408pli.23.1480440246788; Tue, 29 Nov 2016 09:24:06 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s8si60768944pfd.186.2016.11.29.09.24.05; Tue, 29 Nov 2016 09:24:06 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758122AbcK2RXx (ORCPT + 25 others); Tue, 29 Nov 2016 12:23:53 -0500 Received: from mail.free-electrons.com ([62.4.15.54]:35534 "EHLO mail.free-electrons.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933249AbcK2RWu (ORCPT ); Tue, 29 Nov 2016 12:22:50 -0500 Received: by mail.free-electrons.com (Postfix, from userid 110) id 0E0FC20A36; Tue, 29 Nov 2016 18:22:35 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mail.free-electrons.com X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,SHORTCIRCUIT shortcircuit=ham autolearn=disabled version=3.4.0 Received: from localhost.localdomain (unknown [80.215.74.154]) by mail.free-electrons.com (Postfix) with ESMTPSA id 583F82064E; Tue, 29 Nov 2016 18:22:34 +0100 (CET) From: Quentin Schulz To: kishon@ti.com, maxime.ripard@free-electrons.com, wens@csie.org Cc: Quentin Schulz , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, thomas.petazzoni@free-electrons.com Subject: [PATCH v2] phy: phy-sun4i-usb: Add log when probing Date: Tue, 29 Nov 2016 18:22:11 +0100 Message-Id: <20161129172211.21388-1-quentin.schulz@free-electrons.com> X-Mailer: git-send-email 2.9.3 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When phy-sun4i-usb's probing fails, it does not print the reason in kernel log, forcing the developer to edit this driver to add info logs. This commit makes the kernel print the reason of phy-sun4i-usb's probing failure or a success message. Signed-off-by: Quentin Schulz --- Sorry for the delay, I completely forgot to send a v2. v2: - removing (from v1) debug message when devm_ioremap_resource fails, - changing dev_info to dev_dbg when driver is successfully loaded, drivers/phy/phy-sun4i-usb.c | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) -- 2.9.3 diff --git a/drivers/phy/phy-sun4i-usb.c b/drivers/phy/phy-sun4i-usb.c index fec34f5..f1b2848 100644 --- a/drivers/phy/phy-sun4i-usb.c +++ b/drivers/phy/phy-sun4i-usb.c @@ -632,19 +632,25 @@ static int sun4i_usb_phy_probe(struct platform_device *pdev) data->id_det_gpio = devm_gpiod_get_optional(dev, "usb0_id_det", GPIOD_IN); - if (IS_ERR(data->id_det_gpio)) + if (IS_ERR(data->id_det_gpio)) { + dev_err(dev, "Couldn't request ID GPIO\n"); return PTR_ERR(data->id_det_gpio); + } data->vbus_det_gpio = devm_gpiod_get_optional(dev, "usb0_vbus_det", GPIOD_IN); - if (IS_ERR(data->vbus_det_gpio)) + if (IS_ERR(data->vbus_det_gpio)) { + dev_err(dev, "Couldn't request VBUS detect GPIO\n"); return PTR_ERR(data->vbus_det_gpio); + } if (of_find_property(np, "usb0_vbus_power-supply", NULL)) { data->vbus_power_supply = devm_power_supply_get_by_phandle(dev, "usb0_vbus_power-supply"); - if (IS_ERR(data->vbus_power_supply)) + if (IS_ERR(data->vbus_power_supply)) { + dev_err(dev, "Couldn't get the VBUS power supply\n"); return PTR_ERR(data->vbus_power_supply); + } if (!data->vbus_power_supply) return -EPROBE_DEFER; @@ -653,8 +659,10 @@ static int sun4i_usb_phy_probe(struct platform_device *pdev) data->dr_mode = of_usb_get_dr_mode_by_phy(np, 0); data->extcon = devm_extcon_dev_allocate(dev, sun4i_usb_phy0_cable); - if (IS_ERR(data->extcon)) + if (IS_ERR(data->extcon)) { + dev_err(dev, "Couldn't allocate our extcon device\n"); return PTR_ERR(data->extcon); + } ret = devm_extcon_dev_register(dev, data->extcon); if (ret) { @@ -669,8 +677,13 @@ static int sun4i_usb_phy_probe(struct platform_device *pdev) snprintf(name, sizeof(name), "usb%d_vbus", i); phy->vbus = devm_regulator_get_optional(dev, name); if (IS_ERR(phy->vbus)) { - if (PTR_ERR(phy->vbus) == -EPROBE_DEFER) + if (PTR_ERR(phy->vbus) == -EPROBE_DEFER) { + dev_err(dev, + "Couldn't get regulator %s... Deferring probe\n", + name); return -EPROBE_DEFER; + } + phy->vbus = NULL; } @@ -754,6 +767,8 @@ static int sun4i_usb_phy_probe(struct platform_device *pdev) return PTR_ERR(phy_provider); } + dev_dbg(dev, "successfully loaded\n"); + return 0; }