Received: by 10.223.176.46 with SMTP id f43csp684270wra; Fri, 26 Jan 2018 05:21:18 -0800 (PST) X-Google-Smtp-Source: AH8x227g8RobuHyX2dtXXAsfRHykJYO6ACSKOUNlYyRyTk6kp31M2kXKr8RaWCwTxO3b7Wy0ERWk X-Received: by 10.99.179.77 with SMTP id x13mr14192712pgt.135.1516972878219; Fri, 26 Jan 2018 05:21:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516972878; cv=none; d=google.com; s=arc-20160816; b=FfencCaPoJeabKGvVZn4pfEBW6PiFI5UvqQF5cQvN3gx4AlNbUO/aPk5CJplYWD1WU H8+eOuKXPXWsxXlp7snUD0/MvHO8K5lI53jO4zYpHi5li4OQysoA754uqI6jVKNsEEPL QX6ujxqGWgsbC5rUmU6FaNeOXeBSbjaBXuhmvufgdSuK+3Do25RzzDfP7bwy+3T22o0L FNtVL/0NcR9cmONm5HFEJ8tUALKqjROJp+xQn47WrkobcRdPTEoyPi1CT5W43Ej1ORDe t+xRXFiT3jnV9ZXP8Kvhu/SyiGYvJ28L9uodR3XJlkow6rFTRbBxOZFT2M7YaCUDx88f 3bVQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfert-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=hbyKC+XbbPN37btuYXBMrHi8nIZCP/nIAN9CsgrO854=; b=nvOSupvb8dWH0Z/J7CzitQEZQNEC5hC87plJ9TmMp+FPDReXxrPYVdev6YZwB4TZCM GqCNlqDGtcLnGktkNkRw4wM2got6ny9hsFlIY558yz+C17g8i/BGHv7TD/0dO264Wmk5 LhbwyX90fDHFUHja/wrewNK5nZkbktYiFlp7TncN9pnMDkfagsguhxsphMaYqw0pw2dc cEMGqFqEM60KflVEqe5fXCFfPbco887AwIS/eUrvckpA9wo68kG0MnsKfpKvvZaxnPbL yNLiH/unUnPyIjvSFQpQt6g0kUA9pmwBV36QMwPfuPKg0k0H2e0ipqTYZUI4CFdNcn8x Fv1w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j188si5191697pfb.379.2018.01.26.05.21.03; Fri, 26 Jan 2018 05:21:18 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752632AbeAZNTs (ORCPT + 99 others); Fri, 26 Jan 2018 08:19:48 -0500 Received: from bhuna.collabora.co.uk ([46.235.227.227]:34866 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752426AbeAZNSD (ORCPT ); Fri, 26 Jan 2018 08:18:03 -0500 Received: from localhost.localdomain (unknown [IPv6:2a01:e35:8a7e:4790:a8d7:ca4:7b4f:7f87]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: tescande) by bhuna.collabora.co.uk (Postfix) with ESMTPSA id A0B5B274ED3; Fri, 26 Jan 2018 13:18:02 +0000 (GMT) From: Thierry Escande To: Archit Taneja , Inki Dae , Thierry Reding , Sandy Huang , Sean Paul , David Airlie , Tomasz Figa Cc: Haixia Shi , =?UTF-8?q?=C3=98rjan=20Eide?= , Zain Wang , Yakir Yang , Lin Huang , Douglas Anderson , Mark Yao , linux-kernel@vger.kernel.org, linux-rockchip@lists.infradead.org, dri-devel@lists.freedesktop.org Subject: [PATCH v2 36/43] drm/rockchip: analogix_dp: Do not call Analogix code before bind Date: Fri, 26 Jan 2018 14:17:03 +0100 Message-Id: <20180126131710.7622-37-thierry.escande@collabora.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180126131710.7622-1-thierry.escande@collabora.com> References: <20180126131710.7622-1-thierry.escande@collabora.com> MIME-Version: 1.0 Content-Type: text/plain; charset = "utf-8" Content-Transfert-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Tomasz Figa Driver callbacks, such as system suspend or resume can be called any time, specifically they can be called before the component bind callback. Let's use dp->adp pointer as a safeguard and skip calling Analogix entry points if it is an ERR_PTR(). Signed-off-by: Tomasz Figa Signed-off-by: Thierry Escande --- drivers/gpu/drm/rockchip/analogix_dp-rockchip.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c b/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c index 23317a2269e1..6d45d62466b3 100644 --- a/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c +++ b/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c @@ -368,6 +368,8 @@ static void rockchip_dp_unbind(struct device *dev, struct device *master, analogix_dp_unbind(dp->adp); rockchip_drm_psr_unregister(&dp->encoder); dp->encoder.funcs->destroy(&dp->encoder); + + dp->adp = ERR_PTR(-ENODEV); } static const struct component_ops rockchip_dp_component_ops = { @@ -391,6 +393,7 @@ static int rockchip_dp_probe(struct platform_device *pdev) return -ENOMEM; dp->dev = dev; + dp->adp = ERR_PTR(-ENODEV); dp->plat_data.panel = panel; ret = rockchip_dp_of_probe(dp); @@ -414,6 +417,9 @@ static int rockchip_dp_suspend(struct device *dev) { struct rockchip_dp_device *dp = dev_get_drvdata(dev); + if (IS_ERR(dp->adp)) + return 0; + return analogix_dp_suspend(dp->adp); } @@ -421,6 +427,9 @@ static int rockchip_dp_resume(struct device *dev) { struct rockchip_dp_device *dp = dev_get_drvdata(dev); + if (IS_ERR(dp->adp)) + return 0; + return analogix_dp_resume(dp->adp); } #endif -- 2.14.1