From patchwork Fri Aug 21 08:49:38 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Axel Lin X-Patchwork-Id: 7050351 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 70B289F358 for ; Fri, 21 Aug 2015 08:52:05 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 97F5C20571 for ; Fri, 21 Aug 2015 08:52:04 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id BF5372052C for ; Fri, 21 Aug 2015 08:52:03 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZSi1c-0004gB-99; Fri, 21 Aug 2015 08:50:12 +0000 Received: from mail-pa0-f44.google.com ([209.85.220.44]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZSi1V-0003Tz-Mi for linux-arm-kernel@lists.infradead.org; Fri, 21 Aug 2015 08:50:06 +0000 Received: by pacdd16 with SMTP id dd16so39916416pac.2 for ; Fri, 21 Aug 2015 01:49:44 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:message-id:subject:from:to:cc:date:content-type :mime-version:content-transfer-encoding; bh=MQjJlTAv+OOPAXdqVTzL1iL0gOKxL7VlRyBTFay1ECw=; b=dW3skY7M9L11/XInZdAE2EAD9szUs5Lir4tpWCb3PLnSD/fc/lD/ZwlWcmkgPNaVwZ WiyuQ9vTSOudvHIMxAIXK3Z/HRlxtrJQw9mEc5Uvy+uB0RqtCjjoe3/WgsCK2K5I9j1b RWPlf2YBr2V0llNwvIe3haGC0dIiJPALb1rowsBPzSjsebRp8JkVblbfAsa6qoDOKwTa W06AVNJY5un25RwT659sDQ8b9d2Ji9XzKYqT2aYxnXNxXDBOkjbTpX0T68lL5Xen/fHl Wp5nS8JD2D08WHx41VqCN0cWiJvXmICGLXUzZA29hZcj/N8Gi6tpOg8kflZkay+ByhTW pryQ== X-Gm-Message-State: ALoCoQldzCnC7uwZiXcA02PJYGiK4fJjyn7tsEiwsSoBo9y1mn3PxZJNv1iOoK75bq5YlZpw4FI6 X-Received: by 10.68.244.234 with SMTP id xj10mr15429489pbc.13.1440146983096; Fri, 21 Aug 2015 01:49:43 -0700 (PDT) Received: from phoenix.local (218-164-25-76.dynamic.hinet.net. [218.164.25.76]) by smtp.gmail.com with ESMTPSA id gh5sm6912609pbc.87.2015.08.21.01.49.40 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 21 Aug 2015 01:49:41 -0700 (PDT) Message-ID: <1440146978.29130.1.camel@ingics.com> Subject: [PATCH RFT] phy: sun4i-usb: Use devm_gpiod_get_optional for optional GPIOs From: Axel Lin To: Kishon Vijay Abraham I Date: Fri, 21 Aug 2015 16:49:38 +0800 X-Mailer: Evolution 3.12.10-0ubuntu1~14.10.1 Mime-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150821_015005_800977_6C3ADB12 X-CRM114-Status: GOOD ( 11.32 ) X-Spam-Score: -2.6 (--) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Hans de Goede , Maxime Ripard , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-5.0 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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,