]> git.baikalelectronics.ru Git - kernel.git/commitdiff
drm: rcar-du: Replace dev_private with container_of
authorLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Thu, 3 Dec 2020 16:21:55 +0000 (18:21 +0200)
committerLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Tue, 5 Jan 2021 05:20:04 +0000 (07:20 +0200)
Now that drm_device is embedded in rcar_du_device, we can use
container_of to get the rcar_du_device pointer from the drm_device,
instead of using the drm_device.dev_private field.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
Reviewed-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
drivers/gpu/drm/rcar-du/rcar_du_drv.c
drivers/gpu/drm/rcar-du/rcar_du_drv.h
drivers/gpu/drm/rcar-du/rcar_du_kms.c
drivers/gpu/drm/rcar-du/rcar_du_plane.c

index 8bb545c600c154bb760c5f45b6bd20e378d7bea4..bfbff90588cbf647e3d9c6f110140c48e8811574 100644 (file)
@@ -585,8 +585,6 @@ static int rcar_du_probe(struct platform_device *pdev)
                return PTR_ERR(rcdu->mmio);
 
        /* DRM/KMS objects */
-       rcdu->ddev.dev_private = rcdu;
-
        ret = rcar_du_modeset_init(rcdu);
        if (ret < 0) {
                if (ret != -EPROBE_DEFER)
index 0b1726fd7bdbdf1746603211204b8d0c1b1df9cc..02ca2d0e1b55b0aeb20d812e878b9034cbc45cc1 100644 (file)
@@ -99,6 +99,11 @@ struct rcar_du_device {
        unsigned int vspd1_sink;
 };
 
+static inline struct rcar_du_device *to_rcar_du_device(struct drm_device *dev)
+{
+       return container_of(dev, struct rcar_du_device, ddev);
+}
+
 static inline bool rcar_du_has(struct rcar_du_device *rcdu,
                               unsigned int feature)
 {
index 57bb0dc2280704f6aa5c62879cbba15450c9c184..d6b71a9361ca6c312d3c450b445aeacc91eafa92 100644 (file)
@@ -327,7 +327,7 @@ const struct rcar_du_format_info *rcar_du_format_info(u32 fourcc)
 int rcar_du_dumb_create(struct drm_file *file, struct drm_device *dev,
                        struct drm_mode_create_dumb *args)
 {
-       struct rcar_du_device *rcdu = dev->dev_private;
+       struct rcar_du_device *rcdu = to_rcar_du_device(dev);
        unsigned int min_pitch = DIV_ROUND_UP(args->width * args->bpp, 8);
        unsigned int align;
 
@@ -349,7 +349,7 @@ static struct drm_framebuffer *
 rcar_du_fb_create(struct drm_device *dev, struct drm_file *file_priv,
                  const struct drm_mode_fb_cmd2 *mode_cmd)
 {
-       struct rcar_du_device *rcdu = dev->dev_private;
+       struct rcar_du_device *rcdu = to_rcar_du_device(dev);
        const struct rcar_du_format_info *format;
        unsigned int chroma_pitch;
        unsigned int max_pitch;
@@ -421,7 +421,7 @@ rcar_du_fb_create(struct drm_device *dev, struct drm_file *file_priv,
 static int rcar_du_atomic_check(struct drm_device *dev,
                                struct drm_atomic_state *state)
 {
-       struct rcar_du_device *rcdu = dev->dev_private;
+       struct rcar_du_device *rcdu = to_rcar_du_device(dev);
        int ret;
 
        ret = drm_atomic_helper_check(dev, state);
@@ -437,7 +437,7 @@ static int rcar_du_atomic_check(struct drm_device *dev,
 static void rcar_du_atomic_commit_tail(struct drm_atomic_state *old_state)
 {
        struct drm_device *dev = old_state->dev;
-       struct rcar_du_device *rcdu = dev->dev_private;
+       struct rcar_du_device *rcdu = to_rcar_du_device(dev);
        struct drm_crtc_state *crtc_state;
        struct drm_crtc *crtc;
        unsigned int i;
index 5f69ff4502c151b3427e093916cc3af1802fc6ee..02e5f11f38eb7f6d072268375fac9aec3801337b 100644 (file)
@@ -128,7 +128,7 @@ static int rcar_du_plane_hwalloc(struct rcar_du_plane *plane,
 int rcar_du_atomic_check_planes(struct drm_device *dev,
                                struct drm_atomic_state *state)
 {
-       struct rcar_du_device *rcdu = dev->dev_private;
+       struct rcar_du_device *rcdu = to_rcar_du_device(dev);
        unsigned int group_freed_planes[RCAR_DU_MAX_GROUPS] = { 0, };
        unsigned int group_free_planes[RCAR_DU_MAX_GROUPS] = { 0, };
        bool needs_realloc = false;