From patchwork Wed Jul 8 12:59:56 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Zapolskiy X-Patchwork-Id: 6746941 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 D670FC05AF for ; Wed, 8 Jul 2015 13:00:39 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 020B1206C7 for ; Wed, 8 Jul 2015 13:00:39 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 0D018205E5 for ; Wed, 8 Jul 2015 13:00:38 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 343E66EB1A; Wed, 8 Jul 2015 06:00:36 -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 2F95D6EB1B for ; Wed, 8 Jul 2015 06:00:34 -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 1ZCoxl-00049U-6Z 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 13:59:59 +0100 From: Vladimir Zapolskiy To: David Airlie Subject: [PATCH 06/10] drm: sti_hdmi: use of_get_i2c_adapter_by_node interface Date: Wed, 8 Jul 2015 15:59:56 +0300 Message-ID: <1436360396-9417-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] Cc: Wolfram Sang , Arnaud Pouliquen , dri-devel@lists.freedesktop.org, linux-i2c@vger.kernel.org, Thierry Reding , Ajay Kumar , linux-arm-kernel@lists.infradead.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.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 incorrectly placed to sti_hdmi_remove() instead of sti_hdmi_unbind(). Signed-off-by: Vladimir Zapolskiy --- drivers/gpu/drm/sti/sti_hdmi.c | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/drivers/gpu/drm/sti/sti_hdmi.c b/drivers/gpu/drm/sti/sti_hdmi.c index f28a4d5..580a413 100644 --- a/drivers/gpu/drm/sti/sti_hdmi.c +++ b/drivers/gpu/drm/sti/sti_hdmi.c @@ -698,14 +698,10 @@ static int sti_hdmi_bind(struct device *dev, struct device *master, void *data) ddc = of_parse_phandle(dev->of_node, "ddc", 0); if (ddc) { - hdmi->ddc_adapt = of_find_i2c_adapter_by_node(ddc); - if (!hdmi->ddc_adapt) { - err = -EPROBE_DEFER; - of_node_put(ddc); - return err; - } - + hdmi->ddc_adapt = of_get_i2c_adapter_by_node(ddc); of_node_put(ddc); + if (!hdmi->ddc_adapt) + return -EPROBE_DEFER; } /* Set the drm device handle */ @@ -762,14 +758,15 @@ err_sysfs: err_connector: drm_connector_cleanup(drm_connector); err_adapt: - put_device(&hdmi->ddc_adapt->dev); + i2c_put_adapter(hdmi->ddc_adapt); + return -EINVAL; } static void sti_hdmi_unbind(struct device *dev, struct device *master, void *data) { - /* do nothing */ + i2c_put_adapter(hdmi->ddc_adapt); } static const struct component_ops sti_hdmi_ops = { @@ -885,10 +882,8 @@ 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); - component_del(&pdev->dev, &sti_hdmi_ops); + return 0; }