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

drm/gm12u320: 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: Sam Ravnborg <sam@ravnborg.org>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Cc: Hans de Goede <hdegoede@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200415074034.175360-23-daniel.vetter@ffwll.ch

+6 -5
+6 -5
drivers/gpu/drm/tiny/gm12u320.c
··· 98 98 } fb_update; 99 99 }; 100 100 101 + #define to_gm12u320(__dev) container_of(__dev, struct gm12u320_device, dev) 102 + 101 103 static const char cmd_data[CMD_SIZE] = { 102 104 0x55, 0x53, 0x42, 0x43, 0x00, 0x00, 0x00, 0x00, 103 105 0x68, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x10, 0xff, ··· 410 408 static void gm12u320_fb_mark_dirty(struct drm_framebuffer *fb, 411 409 struct drm_rect *dirty) 412 410 { 413 - struct gm12u320_device *gm12u320 = fb->dev->dev_private; 411 + struct gm12u320_device *gm12u320 = to_gm12u320(fb->dev); 414 412 struct drm_framebuffer *old_fb = NULL; 415 413 bool wakeup = false; 416 414 ··· 560 558 struct drm_plane_state *plane_state) 561 559 { 562 560 struct drm_rect rect = { 0, 0, GM12U320_USER_WIDTH, GM12U320_HEIGHT }; 563 - struct gm12u320_device *gm12u320 = pipe->crtc.dev->dev_private; 561 + struct gm12u320_device *gm12u320 = to_gm12u320(pipe->crtc.dev); 564 562 565 563 gm12u320->fb_update.draw_status_timeout = FIRST_FRAME_TIMEOUT; 566 564 gm12u320_fb_mark_dirty(plane_state->fb, &rect); ··· 568 566 569 567 static void gm12u320_pipe_disable(struct drm_simple_display_pipe *pipe) 570 568 { 571 - struct gm12u320_device *gm12u320 = pipe->crtc.dev->dev_private; 569 + struct gm12u320_device *gm12u320 = to_gm12u320(pipe->crtc.dev); 572 570 573 571 gm12u320_stop_fb_update(gm12u320); 574 572 } ··· 643 641 mutex_init(&gm12u320->fb_update.lock); 644 642 645 643 dev = &gm12u320->dev; 646 - dev->dev_private = gm12u320; 647 644 648 645 ret = drmm_mode_config_init(dev); 649 646 if (ret) ··· 707 706 static __maybe_unused int gm12u320_resume(struct usb_interface *interface) 708 707 { 709 708 struct drm_device *dev = usb_get_intfdata(interface); 710 - struct gm12u320_device *gm12u320 = dev->dev_private; 709 + struct gm12u320_device *gm12u320 = to_gm12u320(dev); 711 710 712 711 gm12u320_set_ecomode(gm12u320); 713 712