From patchwork Sun Sep 15 07:13:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Torokhov X-Patchwork-Id: 11146519 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 127EE14DB for ; Mon, 16 Sep 2019 07:28:31 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id EF17320890 for ; Mon, 16 Sep 2019 07:28:30 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org EF17320890 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B76636E84D; Mon, 16 Sep 2019 07:28:06 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pl1-x644.google.com (mail-pl1-x644.google.com [IPv6:2607:f8b0:4864:20::644]) by gabe.freedesktop.org (Postfix) with ESMTPS id AC9686E067 for ; Sun, 15 Sep 2019 07:13:27 +0000 (UTC) Received: by mail-pl1-x644.google.com with SMTP id k1so15126755pls.11 for ; Sun, 15 Sep 2019 00:13:27 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition:user-agent; bh=9RsUkl6MEN71BO//b46KRM887milBSbG2u+IqiX1rgM=; b=NFJL3rZM3o14IPPNKJZKoi4fYC5vTCGtQ/OOCwdZHTV1hyuJYmysAJXEyaH0CQK80h ZOO4JUyVkrptCKO4C4sdYFLpMDhnXB9nNPotjxWuDSuBfqzEMI+1rcbfoUq9YdrKZVLv GogNVMiGPzd8KFENRaYl/Lynr+a3FgWql65GB8vCtLUW3Py5+aq6wGYaaK9kqUO/t/01 Z9R1G5XubI+ECdQcZAnjO3hfUHymYbSFog+at7fhUw6vhY35FsD5SHze0lrkXzcK1uQM AbR2GIGCC3SOPMGEYUhG1Qfmv9SFKYzaXIljrzsRdSw4lY15fOEQZSMh2gXtyg6QQun1 qoGA== X-Gm-Message-State: APjAAAWYJqFUFz9UegCjloJnnDCrV69WqLJEwIcHlyea/hcNMQW2GOxb MjYHjYHTTP2GlHfYKJB/9ZU= X-Google-Smtp-Source: APXvYqx75/bX6ZgLs/5GYKN91lU9aCoHIZOyWt9XH5ENUcWqcGQC61YP9nuIxCK/uDC1YZS4VL1NOA== X-Received: by 2002:a17:902:7586:: with SMTP id j6mr57986217pll.8.1568531606466; Sun, 15 Sep 2019 00:13:26 -0700 (PDT) Received: from dtor-ws ([2620:15c:202:201:3adc:b08c:7acc:b325]) by smtp.gmail.com with ESMTPSA id k5sm28129193pgo.45.2019.09.15.00.13.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 15 Sep 2019 00:13:26 -0700 (PDT) Date: Sun, 15 Sep 2019 00:13:23 -0700 From: Dmitry Torokhov To: David Airlie , Daniel Vetter Subject: [PATCH] drm/tegra: switch to using devm_gpiod_get_optional Message-ID: <20190915071323.GA36596@dtor-ws> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.10.1 (2018-07-13) X-Mailman-Approved-At: Mon, 16 Sep 2019 07:28:04 +0000 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :user-agent; bh=9RsUkl6MEN71BO//b46KRM887milBSbG2u+IqiX1rgM=; b=NtivAAM77GDp12fbYDh716oc0G9uYsGGnDGcKfDhDvYThgJ/8sfdOvaqtV/croIwHr /r+TKQW6PvyWCNK+z6shvTcxM0BJnOIQ4+SadvG/jn9vBuN32skVTgsd6jQ2I6khu+/v U18L5eJ1pqnqYpimgRGOAA5L3ciY1GflwlaHE5Z2Mw/4qQ9tuZ4SlqQN58C6noEJwOy/ zFhsPmpe0Inp3cZmeP9uN9BygF2Zw3hoLZq5PX1zSWfbX4JOCZg+ZNH8CakevgcHR71Q BLOd+BEk+Ok6pq6LHMckAc4r31AizMBvy65zk95uDwaFf01+PzFt0Rz9KoddNnRMSovt Hupw== X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Jonathan Hunter , Thierry Reding , linux-tegra@vger.kernel.org, Dmitry Osipenko , Thomas Gleixner Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" We do not really need to use API that fetches GPIO data from an arbitrary device tree node, as we are dealing with device tree node assigned to the device structure. We can easily switch to devm_gpiod_get_optional() plus gpiod_set_consumer_name() and clean up the code. Note this is part of efforts to get rid of [devm_]gpiod_get_from_of_node in drivers so that gpiolib can be cleaned up. Signed-off-by: Dmitry Torokhov --- drivers/gpu/drm/tegra/output.c | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/drivers/gpu/drm/tegra/output.c b/drivers/gpu/drm/tegra/output.c index bdcaa4c7168c..b4248125b844 100644 --- a/drivers/gpu/drm/tegra/output.c +++ b/drivers/gpu/drm/tegra/output.c @@ -121,19 +121,15 @@ int tegra_output_probe(struct tegra_output *output) of_node_put(ddc); } - output->hpd_gpio = devm_gpiod_get_from_of_node(output->dev, - output->of_node, - "nvidia,hpd-gpio", 0, - GPIOD_IN, - "HDMI hotplug detect"); - if (IS_ERR(output->hpd_gpio)) { - if (PTR_ERR(output->hpd_gpio) != -ENOENT) - return PTR_ERR(output->hpd_gpio); - - output->hpd_gpio = NULL; - } + output->hpd_gpio = devm_gpiod_get_optional(output->dev, + "nvidia,hpd", GPIOD_IN); + if (IS_ERR(output->hpd_gpio)) + return PTR_ERR(output->hpd_gpio); if (output->hpd_gpio) { + gpiod_set_consumer_name(output->hpd_gpio, + "HDMI hotplug detect"); + err = gpiod_to_irq(output->hpd_gpio); if (err < 0) { dev_err(output->dev, "gpiod_to_irq(): %d\n", err);