Received: by 10.223.185.111 with SMTP id b44csp819709wrg; Fri, 9 Mar 2018 14:29:27 -0800 (PST) X-Google-Smtp-Source: AG47ELvb3ZcS7SiaoZimvWIkAzxzGD2qi6pyjzGZJRF5dgMEQ2/yfe5B/25HkCzNkkG8NVaA4LCn X-Received: by 2002:a17:902:76c2:: with SMTP id j2-v6mr64681plt.250.1520634566902; Fri, 09 Mar 2018 14:29:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520634566; cv=none; d=google.com; s=arc-20160816; b=X3UxVftgypujwQIz31/ueokjyY5Y2INZUpksgCFxPVagm5M7vX38I86x3xvYJNG+P6 emdtuB6+5XYQrw07LW+qHK1bq19Vefie8GuqDjG9skWeK+4mafj21FKHGRqIKZkrfYY4 Y235IAerrawwhtDPdR4Nu7gTfpHowVKswjhaV8C0zeoSjNK1EFQN0pAuzLBE3JKyDUfV oC8Gdrh9ezSISFnyVmYw4+1clxzbCgxSLrxAfRJ7anKOBXBTGi8MYoTnGc4LI/1PQv8e ZLG7XslJnUixjha75v/47GevDsnz6gWR4LTNs0gT6pbLrXYODtEXp3bAcrK0nYyaMzE7 kEIw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=ZsRpVRzdCGQQ/cuZ3PQAH2OD0VsEf1gAiwIFp5OYb4o=; b=wnRX3JUMLrAMs9fmspMSlIaXsu/Mo/N40IDetl9JQPbu56q0BlW5oO9LkU451MtXsS hcaV0gZ3s8PZ+twyQ8vuQ0/Xbn4peax4Ha5hMmb2jce/71/+cJ0Mi2wlTe5PATg6aXxj glFX/fAXxDQ4OmoS0lT41qzuUk2pYAL0YJVzzHHgai83M88XRfPPGqd/I8pjTQOaPinE M6bSUKtx/pU/KubyOpH+3EnEnLJ1oiXGh5gcp4CT8DlkenJpo2wJjTOOHZxnTjVAGBo0 c1OEbhtuYILcrm8od3Wm8x+78hkV4w/Z2584CurZkF+JrWyhFN4a3Ed1t5wlyz+prmhK q9Lw== 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 r24si1394989pgn.78.2018.03.09.14.29.12; Fri, 09 Mar 2018 14:29:26 -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 S933197AbeCIWY5 (ORCPT + 99 others); Fri, 9 Mar 2018 17:24:57 -0500 Received: from bhuna.collabora.co.uk ([46.235.227.227]:43000 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933180AbeCIWYz (ORCPT ); Fri, 9 Mar 2018 17:24:55 -0500 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: eballetbo) with ESMTPSA id DBB552792DC From: Enric Balletbo i Serra To: architt@codeaurora.org, inki.dae@samsung.com, thierry.reding@gmail.com, hjc@rock-chips.com, seanpaul@chromium.org, airlied@linux.ie, tfiga@chromium.org, heiko@sntech.de Cc: dri-devel@lists.freedesktop.org, dianders@chromium.org, a.hajda@samsung.com, ykk@rock-chips.com, kernel@collabora.com, m.szyprowski@samsung.com, linux-samsung-soc@vger.kernel.org, jy0922.shim@samsung.com, rydberg@bitmath.org, krzk@kernel.org, linux-rockchip@lists.infradead.org, kgene@kernel.org, linux-input@vger.kernel.org, orjan.eide@arm.com, wxt@rock-chips.com, jeffy.chen@rock-chips.com, linux-arm-kernel@lists.infradead.org, mark.yao@rock-chips.com, wzz@rock-chips.com, hl@rock-chips.com, jingoohan1@gmail.com, sw0312.kim@samsung.com, linux-kernel@vger.kernel.org, kyungmin.park@samsung.com, Laurent.pinchart@ideasonboard.com, kuankuan.y@gmail.com, hshi@chromium.org, Enric Balletbo i Serra Subject: [PATCH v5 29/36] drm/rockchip: analogix_dp: Do not call Analogix code before bind Date: Fri, 9 Mar 2018 23:23:20 +0100 Message-Id: <20180309222327.18689-30-enric.balletbo@collabora.com> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180309222327.18689-1-enric.balletbo@collabora.com> References: <20180309222327.18689-1-enric.balletbo@collabora.com> 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 Signed-off-by: Enric Balletbo i Serra Tested-by: Marek Szyprowski --- 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.16.1