drm/imx: turn remaining container_of macros into inline functions
authorPhilipp Zabel <p.zabel@pengutronix.de>
Wed, 6 Jul 2016 13:47:11 +0000 (15:47 +0200)
committerPhilipp Zabel <p.zabel@pengutronix.de>
Tue, 12 Jul 2016 16:24:29 +0000 (18:24 +0200)
This allows the compiler to do type checking.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
drivers/gpu/drm/imx/imx-ldb.c
drivers/gpu/drm/imx/imx-tve.c
drivers/gpu/drm/imx/ipuv3-crtc.c
drivers/gpu/drm/imx/ipuv3-plane.c
drivers/gpu/drm/imx/parallel-display.c

index 9ac833540080a0217bca8d20b3ee6c8b1de33223..00d67b5407d8d6833d1ca8429134323a742a90bf 100644 (file)
@@ -51,8 +51,6 @@
 #define LDB_DI1_VS_POL_ACT_LOW         (1 << 10)
 #define LDB_BGREF_RMODE_INT            (1 << 15)
 
-#define con_to_imx_ldb_ch(x) container_of(x, struct imx_ldb_channel, connector)
-
 struct imx_ldb;
 
 struct imx_ldb_channel {
@@ -70,6 +68,11 @@ struct imx_ldb_channel {
        u32 bus_format;
 };
 
+static inline struct imx_ldb_channel *con_to_imx_ldb_ch(struct drm_connector *c)
+{
+       return container_of(c, struct imx_ldb_channel, connector);
+}
+
 static inline struct imx_ldb_channel *enc_to_imx_ldb_ch(struct drm_encoder *e)
 {
        return container_of(e, struct imx_ldb_channel, encoder);
index 520b31228a6f748151fd64bcb5b3318c340253a8..a293a7dad0d975335624a8327b01608dd5915fe1 100644 (file)
@@ -98,8 +98,6 @@
 /* TVE_TST_MODE_REG */
 #define TVE_TVDAC_TEST_MODE_MASK       (0x7 << 0)
 
-#define con_to_tve(x) container_of(x, struct imx_tve, connector)
-
 enum {
        TVE_MODE_TVOUT,
        TVE_MODE_VGA,
@@ -124,6 +122,11 @@ struct imx_tve {
        struct clk *di_clk;
 };
 
+static inline struct imx_tve *con_to_tve(struct drm_connector *c)
+{
+       return container_of(c, struct imx_tve, connector);
+}
+
 static inline struct imx_tve *enc_to_tve(struct drm_encoder *e)
 {
        return container_of(e, struct imx_tve, encoder);
index 2791ef070e2e57bfc677dfb6bd947372c70452c9..08e188bc10fc6200501d4f13fccc999970a35566 100644 (file)
@@ -46,7 +46,10 @@ struct ipu_crtc {
        int                     irq;
 };
 
-#define to_ipu_crtc(x) container_of(x, struct ipu_crtc, base)
+static inline struct ipu_crtc *to_ipu_crtc(struct drm_crtc *crtc)
+{
+       return container_of(crtc, struct ipu_crtc, base);
+}
 
 static void ipu_crtc_enable(struct drm_crtc *crtc)
 {
index 3f5f9566b152b4375a219488156763a63e9805fa..4ad67d015ec7fdcb32dc84b17ebb99eb185590d2 100644 (file)
 #include "video/imx-ipu-v3.h"
 #include "ipuv3-plane.h"
 
-#define to_ipu_plane(x)        container_of(x, struct ipu_plane, base)
+static inline struct ipu_plane *to_ipu_plane(struct drm_plane *p)
+{
+       return container_of(p, struct ipu_plane, base);
+}
 
 static const uint32_t ipu_plane_formats[] = {
        DRM_FORMAT_ARGB1555,
index 9da60df5efa7703270b25027181d4479c26504ec..7b7bb31008319562bcb8d960e8e954ca6c3ceecb 100644 (file)
@@ -26,8 +26,6 @@
 
 #include "imx-drm.h"
 
-#define con_to_imxpd(x) container_of(x, struct imx_parallel_display, connector)
-
 struct imx_parallel_display {
        struct drm_connector connector;
        struct drm_encoder encoder;
@@ -39,6 +37,11 @@ struct imx_parallel_display {
        struct drm_panel *panel;
 };
 
+static inline struct imx_parallel_display *con_to_imxpd(struct drm_connector *c)
+{
+       return container_of(c, struct imx_parallel_display, connector);
+}
+
 static inline struct imx_parallel_display *enc_to_imxpd(struct drm_encoder *e)
 {
        return container_of(e, struct imx_parallel_display, encoder);