From patchwork Mon Sep 21 15:51:27 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Zapolskiy X-Patchwork-Id: 7232571 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id D80ACBEEC1 for ; Mon, 21 Sep 2015 15:51:38 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0966B207EA for ; Mon, 21 Sep 2015 15:51:38 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id D4B67207CC for ; Mon, 21 Sep 2015 15:51:35 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 7F3846E154; Mon, 21 Sep 2015 08:51:34 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from relay1.mentorg.com (relay1.mentorg.com [192.94.38.131]) by gabe.freedesktop.org (Postfix) with ESMTPS id C239D6E508 for ; Mon, 21 Sep 2015 08:51:33 -0700 (PDT) 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 1Ze3NM-0004ym-P3 from Vladimir_Zapolskiy@mentor.com ; Mon, 21 Sep 2015 08:51:32 -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; Mon, 21 Sep 2015 16:51:31 +0100 From: Vladimir Zapolskiy To: Benjamin Gaignard , Vincent Abriou Subject: [PATCH 2/2] drm: sti_hdmi: use of_get_i2c_adapter_by_node interface Date: Mon, 21 Sep 2015 18:51:27 +0300 Message-ID: <1442850687-13002-2-git-send-email-vladimir_zapolskiy@mentor.com> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1442850687-13002-1-git-send-email-vladimir_zapolskiy@mentor.com> References: <1442850687-13002-1-git-send-email-vladimir_zapolskiy@mentor.com> MIME-Version: 1.0 X-Originating-IP: [137.202.0.76] Cc: dri-devel@lists.freedesktop.org X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Spam-Status: No, score=-4.2 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 device and driver, which serve DDC lines. Without this change I2C bus driver module may gone in runtime and this won't be noticed by the driver. Signed-off-by: Vladimir Zapolskiy --- drivers/gpu/drm/sti/sti_hdmi.c | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/drivers/gpu/drm/sti/sti_hdmi.c b/drivers/gpu/drm/sti/sti_hdmi.c index c23b580..b892f29a 100644 --- a/drivers/gpu/drm/sti/sti_hdmi.c +++ b/drivers/gpu/drm/sti/sti_hdmi.c @@ -792,13 +792,10 @@ static int sti_hdmi_probe(struct platform_device *pdev) ddc = of_parse_phandle(pdev->dev.of_node, "ddc", 0); if (ddc) { - hdmi->ddc_adapt = of_find_i2c_adapter_by_node(ddc); - if (!hdmi->ddc_adapt) { - of_node_put(ddc); - return -EPROBE_DEFER; - } - + hdmi->ddc_adapt = of_get_i2c_adapter_by_node(ddc); of_node_put(ddc); + if (!hdmi->ddc_adapt) + return -EPROBE_DEFER; } hdmi->dev = pdev->dev; @@ -887,8 +884,7 @@ static int sti_hdmi_probe(struct platform_device *pdev) return component_add(&pdev->dev, &sti_hdmi_ops); release_adapter: - if (hdmi->ddc_adapt) - put_device(&hdmi->ddc_adapt->dev); + i2c_put_adapter(hdmi->ddc_adapt); return ret; } @@ -897,10 +893,9 @@ static int sti_hdmi_remove(struct platform_device *pdev) { struct sti_hdmi *hdmi = dev_get_drvdata(&pdev->dev); - if (hdmi->ddc_adapt) - put_device(&hdmi->ddc_adapt->dev); - + i2c_put_adapter(hdmi->ddc_adapt); component_del(&pdev->dev, &sti_hdmi_ops); + return 0; }