Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/cirrus: Don't use drm_device->dev_private

Upcasting using a container_of macro is more typesafe, faster and
easier for the compiler to optimize.

Acked-by: Eric Anholt <eric@anholt.net>
Acked-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Cc: Dave Airlie <airlied@redhat.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: "Noralf Trønnes" <noralf@tronnes.org>
Cc: Sam Ravnborg <sam@ravnborg.org>
Cc: Eric Anholt <eric@anholt.net>
Cc: Thomas Zimmermann <tzimmermann@suse.de>
Cc: virtualization@lists.linux-foundation.org
Link: https://patchwork.freedesktop.org/patch/msgid/20200415074034.175360-37-daniel.vetter@ffwll.ch

+5 -4
+5 -4
drivers/gpu/drm/cirrus/cirrus.c
··· 59 59 void __iomem *mmio; 60 60 }; 61 61 62 + #define to_cirrus(_dev) container_of(_dev, struct cirrus_device, dev) 63 + 62 64 /* ------------------------------------------------------------------ */ 63 65 /* 64 66 * The meat of this driver. The core passes us a mode and we have to program ··· 313 311 static int cirrus_fb_blit_rect(struct drm_framebuffer *fb, 314 312 struct drm_rect *rect) 315 313 { 316 - struct cirrus_device *cirrus = fb->dev->dev_private; 314 + struct cirrus_device *cirrus = to_cirrus(fb->dev); 317 315 void *vmap; 318 316 int idx, ret; 319 317 ··· 438 436 struct drm_crtc_state *crtc_state, 439 437 struct drm_plane_state *plane_state) 440 438 { 441 - struct cirrus_device *cirrus = pipe->crtc.dev->dev_private; 439 + struct cirrus_device *cirrus = to_cirrus(pipe->crtc.dev); 442 440 443 441 cirrus_mode_set(cirrus, &crtc_state->mode, plane_state->fb); 444 442 cirrus_fb_blit_fullscreen(plane_state->fb); ··· 447 445 static void cirrus_pipe_update(struct drm_simple_display_pipe *pipe, 448 446 struct drm_plane_state *old_state) 449 447 { 450 - struct cirrus_device *cirrus = pipe->crtc.dev->dev_private; 448 + struct cirrus_device *cirrus = to_cirrus(pipe->crtc.dev); 451 449 struct drm_plane_state *state = pipe->plane.state; 452 450 struct drm_crtc *crtc = &pipe->crtc; 453 451 struct drm_rect rect; ··· 575 573 return PTR_ERR(cirrus); 576 574 577 575 dev = &cirrus->dev; 578 - dev->dev_private = cirrus; 579 576 580 577 cirrus->vram = devm_ioremap(&pdev->dev, pci_resource_start(pdev, 0), 581 578 pci_resource_len(pdev, 0));