From patchwork Sat Oct 17 02:22:15 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kishon Vijay Abraham I X-Patchwork-Id: 55144 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lf0-f69.google.com (mail-lf0-f69.google.com [209.85.215.69]) by patches.linaro.org (Postfix) with ESMTPS id EFC5C22EAC for ; Sat, 17 Oct 2015 02:23:19 +0000 (UTC) Received: by lffy185 with SMTP id y185sf23597973lff.2 for ; Fri, 16 Oct 2015 19:23:18 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-type:sender:precedence :list-id:x-original-sender:x-original-authentication-results :mailing-list:list-post:list-help:list-archive:list-unsubscribe; bh=odLs1Q4QTIpl7/qvt0J1xl4nXM4YOjVSmPvaKzqXCCk=; b=BK/APbsLx+FhWv9zwx+smKfoR9dBjq7IQ94RZ0T5j0VKiFyvgteEwnRwoNZK3hs/1V 5ULWz5+kdAYgi+wlYppmJEatOs+ns30iY+8UsuxdXym297URFnmEH3JtJdE5EvRGhmgL ixPngw7W4VciCaYaxOwGiscaHvbqxtqCpcEwz73p5Kntbcx17s9orRpjsvKblhPQA7gN Ybi8fUE4wx7XdKAiAGkDezMbslGvOker5UOUKO29Hjx4WC29VykUkkIKsPDCNdYZoVoB 9giUg/DvftHvLSiyW9yLnicvEfWBab6Ii6uTKX1rYpvw+HvVNQOUy01FvnpxUFRW3kkC uqfw== X-Gm-Message-State: ALoCoQlUi+Sk6i399f8wQ7Xm31CY4e1POpGoDq9gjl/juSEc4J05UlNlQv4GjxcxtMY2rDEhp904 X-Received: by 10.112.54.197 with SMTP id l5mr4347961lbp.21.1445048598739; Fri, 16 Oct 2015 19:23:18 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.25.207.70 with SMTP id f67ls353950lfg.78.gmail; Fri, 16 Oct 2015 19:23:18 -0700 (PDT) X-Received: by 10.112.126.70 with SMTP id mw6mr9841069lbb.81.1445048598418; Fri, 16 Oct 2015 19:23:18 -0700 (PDT) Received: from mail-lf0-f46.google.com (mail-lf0-f46.google.com. [209.85.215.46]) by mx.google.com with ESMTPS id n187si14801057lfb.31.2015.10.16.19.23.18 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 16 Oct 2015 19:23:18 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.46 as permitted sender) client-ip=209.85.215.46; Received: by lffy185 with SMTP id y185so86778854lff.2 for ; Fri, 16 Oct 2015 19:23:18 -0700 (PDT) X-Received: by 10.25.211.201 with SMTP id k192mr6492462lfg.32.1445048598308; Fri, 16 Oct 2015 19:23:18 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.59.35 with SMTP id w3csp244320lbq; Fri, 16 Oct 2015 19:23:17 -0700 (PDT) X-Received: by 10.68.89.100 with SMTP id bn4mr20345959pbb.93.1445048596969; Fri, 16 Oct 2015 19:23:16 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id hg4si33425170pac.145.2015.10.16.19.23.15; Fri, 16 Oct 2015 19:23:16 -0700 (PDT) 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; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753217AbbJQCXJ (ORCPT + 30 others); Fri, 16 Oct 2015 22:23:09 -0400 Received: from bear.ext.ti.com ([192.94.94.41]:38340 "EHLO bear.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752463AbbJQCWU (ORCPT ); Fri, 16 Oct 2015 22:22:20 -0400 Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by bear.ext.ti.com (8.13.7/8.13.7) with ESMTP id t9H2MJQV006233; Fri, 16 Oct 2015 21:22:19 -0500 Received: from DLEE71.ent.ti.com (dlee71.ent.ti.com [157.170.170.114]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id t9H2MIps012548; Fri, 16 Oct 2015 21:22:19 -0500 Received: from dflp33.itg.ti.com (10.64.6.16) by DLEE71.ent.ti.com (157.170.170.114) with Microsoft SMTP Server id 14.3.224.2; Fri, 16 Oct 2015 21:22:18 -0500 Received: from a0393678ub.am.dhcp.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp33.itg.ti.com (8.14.3/8.13.8) with ESMTP id t9H2MIuZ003368; Fri, 16 Oct 2015 21:22:18 -0500 From: Kishon Vijay Abraham I To: CC: , Subject: [PATCH 4/7] phy: sun4i-usb: Use devm_gpiod_get_optional for optional GPIOs Date: Sat, 17 Oct 2015 07:52:15 +0530 Message-ID: <1445048538-4855-5-git-send-email-kishon@ti.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1445048538-4855-1-git-send-email-kishon@ti.com> References: <1445048538-4855-1-git-send-email-kishon@ti.com> MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: kishon@ti.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.46 as permitted sender) smtp.mailfrom=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , From: Axel Lin Both data->id_det_gpio and data->vbus_det_gpio are optional, so use devm_gpiod_get_optional for them. Signed-off-by: Axel Lin Reviewed-by: Hans de Goede Signed-off-by: Kishon Vijay Abraham I --- drivers/phy/phy-sun4i-usb.c | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/drivers/phy/phy-sun4i-usb.c b/drivers/phy/phy-sun4i-usb.c index 731b395..b12964b 100644 --- a/drivers/phy/phy-sun4i-usb.c +++ b/drivers/phy/phy-sun4i-usb.c @@ -551,19 +551,15 @@ static int sun4i_usb_phy_probe(struct platform_device *pdev) if (IS_ERR(data->base)) return PTR_ERR(data->base); - data->id_det_gpio = devm_gpiod_get(dev, "usb0_id_det", GPIOD_IN); - if (IS_ERR(data->id_det_gpio)) { - if (PTR_ERR(data->id_det_gpio) == -EPROBE_DEFER) - return -EPROBE_DEFER; - data->id_det_gpio = NULL; - } - - data->vbus_det_gpio = devm_gpiod_get(dev, "usb0_vbus_det", GPIOD_IN); - if (IS_ERR(data->vbus_det_gpio)) { - if (PTR_ERR(data->vbus_det_gpio) == -EPROBE_DEFER) - return -EPROBE_DEFER; - data->vbus_det_gpio = NULL; - } + data->id_det_gpio = devm_gpiod_get_optional(dev, "usb0_id_det", + GPIOD_IN); + if (IS_ERR(data->id_det_gpio)) + 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)) + 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,