Skip to content

Commit 7ced480

Browse files
committed
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
1 parent 9213142 commit 7ced480

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

‎drivers/gpu/drm/tiny/gm12u320.c‎

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,8 @@ struct gm12u320_device {
9898
} fb_update;
9999
};
100100

101+
#define to_gm12u320(__dev) container_of(__dev, struct gm12u320_device, dev)
102+
101103
static const char cmd_data[CMD_SIZE] = {
102104
0x55, 0x53, 0x42, 0x43, 0x00, 0x00, 0x00, 0x00,
103105
0x68, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x10, 0xff,
@@ -408,7 +410,7 @@ static void gm12u320_fb_update_work(struct work_struct *work)
408410
static void gm12u320_fb_mark_dirty(struct drm_framebuffer *fb,
409411
struct drm_rect *dirty)
410412
{
411-
struct gm12u320_device *gm12u320 = fb->dev->dev_private;
413+
struct gm12u320_device *gm12u320 = to_gm12u320(fb->dev);
412414
struct drm_framebuffer *old_fb = NULL;
413415
bool wakeup = false;
414416

@@ -558,15 +560,15 @@ static void gm12u320_pipe_enable(struct drm_simple_display_pipe *pipe,
558560
struct drm_plane_state *plane_state)
559561
{
560562
struct drm_rect rect = { 0, 0, GM12U320_USER_WIDTH, GM12U320_HEIGHT };
561-
struct gm12u320_device *gm12u320 = pipe->crtc.dev->dev_private;
563+
struct gm12u320_device *gm12u320 = to_gm12u320(pipe->crtc.dev);
562564

563565
gm12u320->fb_update.draw_status_timeout = FIRST_FRAME_TIMEOUT;
564566
gm12u320_fb_mark_dirty(plane_state->fb, &rect);
565567
}
566568

567569
static void gm12u320_pipe_disable(struct drm_simple_display_pipe *pipe)
568570
{
569-
struct gm12u320_device *gm12u320 = pipe->crtc.dev->dev_private;
571+
struct gm12u320_device *gm12u320 = to_gm12u320(pipe->crtc.dev);
570572

571573
gm12u320_stop_fb_update(gm12u320);
572574
}
@@ -641,7 +643,6 @@ static int gm12u320_usb_probe(struct usb_interface *interface,
641643
mutex_init(&gm12u320->fb_update.lock);
642644

643645
dev = &gm12u320->dev;
644-
dev->dev_private = gm12u320;
645646

646647
ret = drmm_mode_config_init(dev);
647648
if (ret)
@@ -706,7 +707,7 @@ static __maybe_unused int gm12u320_suspend(struct usb_interface *interface,
706707
static __maybe_unused int gm12u320_resume(struct usb_interface *interface)
707708
{
708709
struct drm_device *dev = usb_get_intfdata(interface);
709-
struct gm12u320_device *gm12u320 = dev->dev_private;
710+
struct gm12u320_device *gm12u320 = to_gm12u320(dev);
710711

711712
gm12u320_set_ecomode(gm12u320);
712713

0 commit comments

Comments
 (0)