From patchwork Wed Jul 8 13:00:03 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Zapolskiy X-Patchwork-Id: 6747051 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 DF7079F38C for ; Wed, 8 Jul 2015 13:03:39 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0A5A8206B1 for ; Wed, 8 Jul 2015 13:03:39 +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 14CF9205B1 for ; Wed, 8 Jul 2015 13:03:37 +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 1ZCoyu-0003X9-Ae; Wed, 08 Jul 2015 13:01:44 +0000 Received: from merlin.infradead.org ([2001:4978:20e::2]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZCoyF-00035H-5t for linux-arm-kernel@bombadil.infradead.org; Wed, 08 Jul 2015 13:01:03 +0000 Received: from relay1.mentorg.com ([192.94.38.131]) by merlin.infradead.org with esmtp (Exim 4.85 #2 (Red Hat Linux)) id 1ZCoyC-00016U-Ci for linux-arm-kernel@lists.infradead.org; Wed, 08 Jul 2015 13:01:02 +0000 Received: from nat-ies.mentorg.com ([192.94.31.2] helo=SVR-IES-FEM-01.mgc.mentorg.com) by relay1.mentorg.com with esmtp id 1ZCoxl-0004Ak-J4 from Vladimir_Zapolskiy@mentor.com ; Wed, 08 Jul 2015 06:00:33 -0700 Received: from eyas.fin.mentorg.com (137.202.0.76) by SVR-IES-FEM-01.mgc.mentorg.com (137.202.0.104) with Microsoft SMTP Server (TLS) id 14.3.224.2; Wed, 8 Jul 2015 14:00:06 +0100 From: Vladimir Zapolskiy To: David Airlie , Thierry Reding Subject: [PATCH 07/10] drm: tegra: use of_get_i2c_adapter_by_node interface Date: Wed, 8 Jul 2015 16:00:03 +0300 Message-ID: <1436360403-9462-1-git-send-email-vladimir_zapolskiy@mentor.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1436360095-9065-1-git-send-email-vladimir_zapolskiy@mentor.com> References: <1436360095-9065-1-git-send-email-vladimir_zapolskiy@mentor.com> MIME-Version: 1.0 X-Originating-IP: [137.202.0.76] X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150708_090100_529301_A65055D7 X-CRM114-Status: GOOD ( 12.06 ) 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: Alexandre Courbot , =?UTF-8?q?Terje=20Bergstr=C3=B6m?= , Wolfram Sang , Stephen Warren , dri-devel@lists.freedesktop.org, linux-i2c@vger.kernel.org, linux-tegra@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=-4.9 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 This change is needed to properly lock I2C bus driver, which serves DDC. On release of_get_i2c_adapter_by_node() requires i2c_put_adapter() call. Note, that prior to the change put_device() coupled with of_find_i2c_adapter_by_node() was missing on error path of tegra_output_probe(). Signed-off-by: Vladimir Zapolskiy --- drivers/gpu/drm/tegra/output.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/tegra/output.c b/drivers/gpu/drm/tegra/output.c index 37db479..d7731cd 100644 --- a/drivers/gpu/drm/tegra/output.c +++ b/drivers/gpu/drm/tegra/output.c @@ -116,7 +116,7 @@ int tegra_output_probe(struct tegra_output *output) ddc = of_parse_phandle(output->of_node, "nvidia,ddc-i2c-bus", 0); if (ddc) { - output->ddc = of_find_i2c_adapter_by_node(ddc); + output->ddc = of_get_i2c_adapter_by_node(ddc); if (!output->ddc) { err = -EPROBE_DEFER; of_node_put(ddc); @@ -136,14 +136,13 @@ int tegra_output_probe(struct tegra_output *output) "HDMI hotplug detect"); if (err < 0) { dev_err(output->dev, "gpio_request_one(): %d\n", err); - return err; + goto i2c_release; } err = gpio_to_irq(output->hpd_gpio); if (err < 0) { dev_err(output->dev, "gpio_to_irq(): %d\n", err); - gpio_free(output->hpd_gpio); - return err; + goto gpio_release; } output->hpd_irq = err; @@ -156,8 +155,7 @@ int tegra_output_probe(struct tegra_output *output) if (err < 0) { dev_err(output->dev, "failed to request IRQ#%u: %d\n", output->hpd_irq, err); - gpio_free(output->hpd_gpio); - return err; + goto gpio_release; } output->connector.polled = DRM_CONNECTOR_POLL_HPD; @@ -171,6 +169,12 @@ int tegra_output_probe(struct tegra_output *output) } return 0; + + gpio_release: + gpio_free(output->hpd_gpio); + i2c_release: + i2c_put_adapter(output->ddc); + return err; } void tegra_output_remove(struct tegra_output *output) @@ -180,8 +184,7 @@ void tegra_output_remove(struct tegra_output *output) gpio_free(output->hpd_gpio); } - if (output->ddc) - put_device(&output->ddc->dev); + i2c_put_adapter(output->ddc); } int tegra_output_init(struct drm_device *drm, struct tegra_output *output)