From patchwork Sat Oct 17 20:33:28 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: 55163 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f198.google.com (mail-lb0-f198.google.com [209.85.217.198]) by patches.linaro.org (Postfix) with ESMTPS id 3AEAF22FFA for ; Sat, 17 Oct 2015 20:33:39 +0000 (UTC) Received: by lbbpp2 with SMTP id pp2sf2351995lbb.0 for ; Sat, 17 Oct 2015 13:33:38 -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=WZkoIYqeuFWbeG7lH36H1pkKbRcoStyLunqWFcSNfuYpg+USfZ3fX/r9ZuBfpCM6Gp 5iEYZmeQXfabR3h0ZzKtTQkHVh9ZZMUppr2NQnBK7mt4gU7bcz5PK62xxMDHe/9pItSQ +fVypduten+BXHlMiO49HhJG1dxIezr2c6wzGLpUv3uxnwf6RbyEJPip+wKY/BDkxRk7 QApbILcpf2+y5KDnh9WySXlv5WlVsD/uLeC0i2EgzWR/6PfPm6IsMyX6qUqheD5tY80S 16sN1JnIsUF23b3UA6bJYxZJ6fpNkXpjIuIqHZQrWpKyx5CsoFlRR0KukQh+YB+cz5fP /N1g== X-Gm-Message-State: ALoCoQkGtp6d4dD+6ppFl+PncvrHvO8nDUv1O7VRl+JSY6kvnbyTPI1nDkbFVwVUjNBKyniKzAWV X-Received: by 10.194.118.65 with SMTP id kk1mr5263240wjb.5.1445114018155; Sat, 17 Oct 2015 13:33:38 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.25.170.72 with SMTP id t69ls405664lfe.56.gmail; Sat, 17 Oct 2015 13:33:37 -0700 (PDT) X-Received: by 10.25.141.77 with SMTP id p74mr1298137lfd.17.1445114017968; Sat, 17 Oct 2015 13:33:37 -0700 (PDT) Received: from mail-lb0-f169.google.com (mail-lb0-f169.google.com. [209.85.217.169]) by mx.google.com with ESMTPS id s199si17193314lfd.168.2015.10.17.13.33.37 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 17 Oct 2015 13:33:37 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.169 as permitted sender) client-ip=209.85.217.169; Received: by lbbes7 with SMTP id es7so30096842lbb.2 for ; Sat, 17 Oct 2015 13:33:37 -0700 (PDT) X-Received: by 10.112.146.104 with SMTP id tb8mr11253509lbb.35.1445114017845; Sat, 17 Oct 2015 13:33:37 -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 w3csp659178lbq; Sat, 17 Oct 2015 13:33:36 -0700 (PDT) X-Received: by 10.66.219.195 with SMTP id pq3mr24437541pac.98.1445114016693; Sat, 17 Oct 2015 13:33:36 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id en5si39391419pbd.215.2015.10.17.13.33.36; Sat, 17 Oct 2015 13:33:36 -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 S1751671AbbJQUde (ORCPT + 28 others); Sat, 17 Oct 2015 16:33:34 -0400 Received: from comal.ext.ti.com ([198.47.26.152]:34361 "EHLO comal.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750714AbbJQUdc (ORCPT ); Sat, 17 Oct 2015 16:33:32 -0400 Received: from dflxv15.itg.ti.com ([128.247.5.124]) by comal.ext.ti.com (8.13.7/8.13.7) with ESMTP id t9HKXW1P009847; Sat, 17 Oct 2015 15:33:32 -0500 Received: from DFLE72.ent.ti.com (dfle72.ent.ti.com [128.247.5.109]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id t9HKXW0P019261; Sat, 17 Oct 2015 15:33:32 -0500 Received: from dlep32.itg.ti.com (157.170.170.100) by DFLE72.ent.ti.com (128.247.5.109) with Microsoft SMTP Server id 14.3.224.2; Sat, 17 Oct 2015 15:33:32 -0500 Received: from a0393678ub.am.dhcp.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dlep32.itg.ti.com (8.14.3/8.13.8) with ESMTP id t9HKXVpi003521; Sat, 17 Oct 2015 15:33:32 -0500 From: Kishon Vijay Abraham I To: CC: , Subject: [PATCH 4/7] phy: sun4i-usb: Use devm_gpiod_get_optional for optional GPIOs Date: Sun, 18 Oct 2015 02:03:28 +0530 Message-ID: <1445114011-4191-5-git-send-email-kishon@ti.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1445114011-4191-1-git-send-email-kishon@ti.com> References: <1445114011-4191-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.217.169 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,