Commit 0d8424f8 authored by Andrzej Hajda's avatar Andrzej Hajda Committed by Inki Dae

drm/exynos/hdmi: stop using display->ctx pointer

The patch replaces accesses to display->ctx pointer by container_of
construct. It will allow to remove ctx field in the future.
Signed-off-by: default avatarAndrzej Hajda <a.hajda@samsung.com>
Signed-off-by: default avatarInki Dae <inki.dae@samsung.com>
parent 930865fb
...@@ -213,6 +213,11 @@ struct hdmi_context { ...@@ -213,6 +213,11 @@ struct hdmi_context {
enum hdmi_type type; enum hdmi_type type;
}; };
static inline struct hdmi_context *display_to_hdmi(struct exynos_drm_display *d)
{
return container_of(d, struct hdmi_context, display);
}
struct hdmiphy_config { struct hdmiphy_config {
int pixel_clock; int pixel_clock;
u8 conf[32]; u8 conf[32];
...@@ -1123,7 +1128,7 @@ static struct drm_connector_helper_funcs hdmi_connector_helper_funcs = { ...@@ -1123,7 +1128,7 @@ static struct drm_connector_helper_funcs hdmi_connector_helper_funcs = {
static int hdmi_create_connector(struct exynos_drm_display *display, static int hdmi_create_connector(struct exynos_drm_display *display,
struct drm_encoder *encoder) struct drm_encoder *encoder)
{ {
struct hdmi_context *hdata = display->ctx; struct hdmi_context *hdata = display_to_hdmi(display);
struct drm_connector *connector = &hdata->connector; struct drm_connector *connector = &hdata->connector;
int ret; int ret;
...@@ -2000,7 +2005,7 @@ static void hdmi_v14_mode_set(struct hdmi_context *hdata, ...@@ -2000,7 +2005,7 @@ static void hdmi_v14_mode_set(struct hdmi_context *hdata,
static void hdmi_mode_set(struct exynos_drm_display *display, static void hdmi_mode_set(struct exynos_drm_display *display,
struct drm_display_mode *mode) struct drm_display_mode *mode)
{ {
struct hdmi_context *hdata = display->ctx; struct hdmi_context *hdata = display_to_hdmi(display);
struct drm_display_mode *m = mode; struct drm_display_mode *m = mode;
DRM_DEBUG_KMS("xres=%d, yres=%d, refresh=%d, intl=%s\n", DRM_DEBUG_KMS("xres=%d, yres=%d, refresh=%d, intl=%s\n",
...@@ -2019,7 +2024,7 @@ static void hdmi_mode_set(struct exynos_drm_display *display, ...@@ -2019,7 +2024,7 @@ static void hdmi_mode_set(struct exynos_drm_display *display,
static void hdmi_commit(struct exynos_drm_display *display) static void hdmi_commit(struct exynos_drm_display *display)
{ {
struct hdmi_context *hdata = display->ctx; struct hdmi_context *hdata = display_to_hdmi(display);
mutex_lock(&hdata->hdmi_mutex); mutex_lock(&hdata->hdmi_mutex);
if (!hdata->powered) { if (!hdata->powered) {
...@@ -2033,7 +2038,7 @@ static void hdmi_commit(struct exynos_drm_display *display) ...@@ -2033,7 +2038,7 @@ static void hdmi_commit(struct exynos_drm_display *display)
static void hdmi_poweron(struct exynos_drm_display *display) static void hdmi_poweron(struct exynos_drm_display *display)
{ {
struct hdmi_context *hdata = display->ctx; struct hdmi_context *hdata = display_to_hdmi(display);
struct hdmi_resources *res = &hdata->res; struct hdmi_resources *res = &hdata->res;
mutex_lock(&hdata->hdmi_mutex); mutex_lock(&hdata->hdmi_mutex);
...@@ -2064,7 +2069,7 @@ static void hdmi_poweron(struct exynos_drm_display *display) ...@@ -2064,7 +2069,7 @@ static void hdmi_poweron(struct exynos_drm_display *display)
static void hdmi_poweroff(struct exynos_drm_display *display) static void hdmi_poweroff(struct exynos_drm_display *display)
{ {
struct hdmi_context *hdata = display->ctx; struct hdmi_context *hdata = display_to_hdmi(display);
struct hdmi_resources *res = &hdata->res; struct hdmi_resources *res = &hdata->res;
mutex_lock(&hdata->hdmi_mutex); mutex_lock(&hdata->hdmi_mutex);
...@@ -2099,7 +2104,7 @@ static void hdmi_poweroff(struct exynos_drm_display *display) ...@@ -2099,7 +2104,7 @@ static void hdmi_poweroff(struct exynos_drm_display *display)
static void hdmi_dpms(struct exynos_drm_display *display, int mode) static void hdmi_dpms(struct exynos_drm_display *display, int mode)
{ {
struct hdmi_context *hdata = display->ctx; struct hdmi_context *hdata = display_to_hdmi(display);
struct drm_encoder *encoder = hdata->encoder; struct drm_encoder *encoder = hdata->encoder;
struct drm_crtc *crtc = encoder->crtc; struct drm_crtc *crtc = encoder->crtc;
struct drm_crtc_helper_funcs *funcs = NULL; struct drm_crtc_helper_funcs *funcs = NULL;
...@@ -2476,7 +2481,6 @@ static int hdmi_probe(struct platform_device *pdev) ...@@ -2476,7 +2481,6 @@ static int hdmi_probe(struct platform_device *pdev)
} }
pm_runtime_enable(dev); pm_runtime_enable(dev);
hdata->display.ctx = hdata;
ret = component_add(&pdev->dev, &hdmi_component_ops); ret = component_add(&pdev->dev, &hdmi_component_ops);
if (ret) if (ret)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment