Commit 185f22d2 authored by Andrzej Hajda's avatar Andrzej Hajda Committed by Inki Dae

drm/exynos/hdmi: convert container_of macro to inline function

Inline function is safer than macro, also the name has been changed to
be consistent with other inline function encoder_to_hdmi.
Signed-off-by: default avatarAndrzej Hajda <a.hajda@samsung.com>
Reviewed-by: default avatarGustavo Padovan <gustavo.padovan@collabora.co.uk>
Signed-off-by: default avatarInki Dae <inki.dae@samsung.com>
parent af1f7c24
...@@ -46,8 +46,6 @@ ...@@ -46,8 +46,6 @@
#include "exynos_drm_crtc.h" #include "exynos_drm_crtc.h"
#include "exynos_mixer.h" #include "exynos_mixer.h"
#define ctx_from_connector(c) container_of(c, struct hdmi_context, connector)
#define HOTPLUG_DEBOUNCE_MS 1100 #define HOTPLUG_DEBOUNCE_MS 1100
/* AVI header and aspect ratio */ /* AVI header and aspect ratio */
...@@ -128,6 +126,11 @@ static inline struct hdmi_context *encoder_to_hdmi(struct drm_encoder *e) ...@@ -128,6 +126,11 @@ static inline struct hdmi_context *encoder_to_hdmi(struct drm_encoder *e)
return container_of(e, struct hdmi_context, encoder); return container_of(e, struct hdmi_context, encoder);
} }
static inline struct hdmi_context *connector_to_hdmi(struct drm_connector *c)
{
return container_of(c, struct hdmi_context, connector);
}
struct hdmiphy_config { struct hdmiphy_config {
int pixel_clock; int pixel_clock;
u8 conf[32]; u8 conf[32];
...@@ -935,7 +938,7 @@ static void hdmi_reg_infoframe(struct hdmi_context *hdata, ...@@ -935,7 +938,7 @@ static void hdmi_reg_infoframe(struct hdmi_context *hdata,
static enum drm_connector_status hdmi_detect(struct drm_connector *connector, static enum drm_connector_status hdmi_detect(struct drm_connector *connector,
bool force) bool force)
{ {
struct hdmi_context *hdata = ctx_from_connector(connector); struct hdmi_context *hdata = connector_to_hdmi(connector);
if (gpiod_get_value(hdata->hpd_gpio)) if (gpiod_get_value(hdata->hpd_gpio))
return connector_status_connected; return connector_status_connected;
...@@ -961,7 +964,7 @@ static struct drm_connector_funcs hdmi_connector_funcs = { ...@@ -961,7 +964,7 @@ static struct drm_connector_funcs hdmi_connector_funcs = {
static int hdmi_get_modes(struct drm_connector *connector) static int hdmi_get_modes(struct drm_connector *connector)
{ {
struct hdmi_context *hdata = ctx_from_connector(connector); struct hdmi_context *hdata = connector_to_hdmi(connector);
struct edid *edid; struct edid *edid;
int ret; int ret;
...@@ -1001,7 +1004,7 @@ static int hdmi_find_phy_conf(struct hdmi_context *hdata, u32 pixel_clock) ...@@ -1001,7 +1004,7 @@ static int hdmi_find_phy_conf(struct hdmi_context *hdata, u32 pixel_clock)
static int hdmi_mode_valid(struct drm_connector *connector, static int hdmi_mode_valid(struct drm_connector *connector,
struct drm_display_mode *mode) struct drm_display_mode *mode)
{ {
struct hdmi_context *hdata = ctx_from_connector(connector); struct hdmi_context *hdata = connector_to_hdmi(connector);
int ret; int ret;
DRM_DEBUG_KMS("xres=%d, yres=%d, refresh=%d, intl=%d clock=%d\n", DRM_DEBUG_KMS("xres=%d, yres=%d, refresh=%d, intl=%d clock=%d\n",
...@@ -1022,7 +1025,7 @@ static int hdmi_mode_valid(struct drm_connector *connector, ...@@ -1022,7 +1025,7 @@ static int hdmi_mode_valid(struct drm_connector *connector,
static struct drm_encoder *hdmi_best_encoder(struct drm_connector *connector) static struct drm_encoder *hdmi_best_encoder(struct drm_connector *connector)
{ {
struct hdmi_context *hdata = ctx_from_connector(connector); struct hdmi_context *hdata = connector_to_hdmi(connector);
return &hdata->encoder; return &hdata->encoder;
} }
......
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