From patchwork Sat Nov 10 11:16:52 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 10677061 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 966C5175A for ; Sat, 10 Nov 2018 11:16:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8514129DC9 for ; Sat, 10 Nov 2018 11:16:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 79A742C1E1; Sat, 10 Nov 2018 11:16:47 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 20DD329DC9 for ; Sat, 10 Nov 2018 11:16:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729013AbeKJVBX (ORCPT ); Sat, 10 Nov 2018 16:01:23 -0500 Received: from perceval.ideasonboard.com ([213.167.242.64]:39100 "EHLO perceval.ideasonboard.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728883AbeKJVBX (ORCPT ); Sat, 10 Nov 2018 16:01:23 -0500 Received: from avalon.ideasonboard.com (unknown [212.213.198.112]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 2AFB8563; Sat, 10 Nov 2018 12:16:43 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1541848603; bh=UFbPOSJ4oSOukwYywMBcKWkl3hXQyBf9h7qMzr1mJsU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WLQVO6HFr5ndw3d4IaXVfFvPfmNjPVU66Z4OP3hKrCJpJH9c7PRAN8x2IuIq0yEa8 FXLMNuMfTeonYnDBLXeh55EjI8ELD/8TkSUrnXEeh09pJBp4HXh96a+ZptUG0SlysH QhjTP847fueN8FFjddFOCjOlI0vJkJnFczmEsK3o= From: Laurent Pinchart To: dri-devel@lists.freedesktop.org Cc: Tony Lindgren , Tomi Valkeinen , linux-omap@vger.kernel.org Subject: [PATCH v3 2/4] drm/omap: hdmi4: Ensure the device is active during bind Date: Sat, 10 Nov 2018 13:16:52 +0200 Message-Id: <20181110111654.4387-3-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.18.1 In-Reply-To: <20181110111654.4387-1-laurent.pinchart@ideasonboard.com> References: <20181110111654.4387-1-laurent.pinchart@ideasonboard.com> Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The bind function performs hardware access (in hdmi4_cec_init()) and thus requires the device to be active. Ensure this by surrounding the bind function by hdmi_runtime_get() and hdmi_runtime_put() calls. Fixes: 27d624527d99 ("drm/omap: dss: Acquire next dssdev at probe time") Signed-off-by: Laurent Pinchart Reviewed-by: Sebastian Reichel --- Changes since v2: - Call hdmi_runtime_put() instead of hdmi_runtime_get() in error path --- drivers/gpu/drm/omapdrm/dss/hdmi4.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/omapdrm/dss/hdmi4.c b/drivers/gpu/drm/omapdrm/dss/hdmi4.c index cf6230eac31a..073fa462930a 100644 --- a/drivers/gpu/drm/omapdrm/dss/hdmi4.c +++ b/drivers/gpu/drm/omapdrm/dss/hdmi4.c @@ -635,10 +635,14 @@ static int hdmi4_bind(struct device *dev, struct device *master, void *data) hdmi->dss = dss; - r = hdmi_pll_init(dss, hdmi->pdev, &hdmi->pll, &hdmi->wp); + r = hdmi_runtime_get(hdmi); if (r) return r; + r = hdmi_pll_init(dss, hdmi->pdev, &hdmi->pll, &hdmi->wp); + if (r) + goto err_runtime_put; + r = hdmi4_cec_init(hdmi->pdev, &hdmi->core, &hdmi->wp); if (r) goto err_pll_uninit; @@ -652,12 +656,16 @@ static int hdmi4_bind(struct device *dev, struct device *master, void *data) hdmi->debugfs = dss_debugfs_create_file(dss, "hdmi", hdmi_dump_regs, hdmi); + hdmi_runtime_put(hdmi); + return 0; err_cec_uninit: hdmi4_cec_uninit(&hdmi->core); err_pll_uninit: hdmi_pll_uninit(&hdmi->pll); +err_runtime_put: + hdmi_runtime_put(hdmi); return r; }