[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20180309222327.18689-30-enric.balletbo@collabora.com>
Date: Fri, 9 Mar 2018 23:23:20 +0100
From: Enric Balletbo i Serra <enric.balletbo@...labora.com>
To: architt@...eaurora.org, inki.dae@...sung.com,
thierry.reding@...il.com, hjc@...k-chips.com,
seanpaul@...omium.org, airlied@...ux.ie, tfiga@...omium.org,
heiko@...ech.de
Cc: dri-devel@...ts.freedesktop.org, dianders@...omium.org,
a.hajda@...sung.com, ykk@...k-chips.com, kernel@...labora.com,
m.szyprowski@...sung.com, linux-samsung-soc@...r.kernel.org,
jy0922.shim@...sung.com, rydberg@...math.org, krzk@...nel.org,
linux-rockchip@...ts.infradead.org, kgene@...nel.org,
linux-input@...r.kernel.org, orjan.eide@....com,
wxt@...k-chips.com, jeffy.chen@...k-chips.com,
linux-arm-kernel@...ts.infradead.org, mark.yao@...k-chips.com,
wzz@...k-chips.com, hl@...k-chips.com, jingoohan1@...il.com,
sw0312.kim@...sung.com, linux-kernel@...r.kernel.org,
kyungmin.park@...sung.com, Laurent.pinchart@...asonboard.com,
kuankuan.y@...il.com, hshi@...omium.org,
Enric Balletbo i Serra <enric.balletbo@...labora.com>
Subject: [PATCH v5 29/36] drm/rockchip: analogix_dp: Do not call Analogix code before bind
From: Tomasz Figa <tfiga@...omium.org>
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 <tfiga@...omium.org>
Signed-off-by: Thierry Escande <thierry.escande@...labora.com>
Signed-off-by: Enric Balletbo i Serra <enric.balletbo@...labora.com>
Tested-by: Marek Szyprowski <m.szyprowski@...sung.com>
---
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
Powered by blists - more mailing lists