Skip to content

Commit

Permalink
drm/gm12u320: Don't use drm_device->dev_private
Browse files Browse the repository at this point in the history
Upcasting using a container_of macro is more typesafe, faster and
easier for the compiler to optimize.

Acked-by: Sam Ravnborg <[email protected]>
Reviewed-by: Hans de Goede <[email protected]>
Signed-off-by: Daniel Vetter <[email protected]>
Cc: Hans de Goede <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
  • Loading branch information
danvet committed Apr 28, 2020
1 parent 9213142 commit 7ced480
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions drivers/gpu/drm/tiny/gm12u320.c
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@ struct gm12u320_device {
} fb_update;
};

#define to_gm12u320(__dev) container_of(__dev, struct gm12u320_device, dev)

static const char cmd_data[CMD_SIZE] = {
0x55, 0x53, 0x42, 0x43, 0x00, 0x00, 0x00, 0x00,
0x68, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x10, 0xff,
Expand Down Expand Up @@ -408,7 +410,7 @@ static void gm12u320_fb_update_work(struct work_struct *work)
static void gm12u320_fb_mark_dirty(struct drm_framebuffer *fb,
struct drm_rect *dirty)
{
struct gm12u320_device *gm12u320 = fb->dev->dev_private;
struct gm12u320_device *gm12u320 = to_gm12u320(fb->dev);
struct drm_framebuffer *old_fb = NULL;
bool wakeup = false;

Expand Down Expand Up @@ -558,15 +560,15 @@ static void gm12u320_pipe_enable(struct drm_simple_display_pipe *pipe,
struct drm_plane_state *plane_state)
{
struct drm_rect rect = { 0, 0, GM12U320_USER_WIDTH, GM12U320_HEIGHT };
struct gm12u320_device *gm12u320 = pipe->crtc.dev->dev_private;
struct gm12u320_device *gm12u320 = to_gm12u320(pipe->crtc.dev);

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

static void gm12u320_pipe_disable(struct drm_simple_display_pipe *pipe)
{
struct gm12u320_device *gm12u320 = pipe->crtc.dev->dev_private;
struct gm12u320_device *gm12u320 = to_gm12u320(pipe->crtc.dev);

gm12u320_stop_fb_update(gm12u320);
}
Expand Down Expand Up @@ -641,7 +643,6 @@ static int gm12u320_usb_probe(struct usb_interface *interface,
mutex_init(&gm12u320->fb_update.lock);

dev = &gm12u320->dev;
dev->dev_private = gm12u320;

ret = drmm_mode_config_init(dev);
if (ret)
Expand Down Expand Up @@ -706,7 +707,7 @@ static __maybe_unused int gm12u320_suspend(struct usb_interface *interface,
static __maybe_unused int gm12u320_resume(struct usb_interface *interface)
{
struct drm_device *dev = usb_get_intfdata(interface);
struct gm12u320_device *gm12u320 = dev->dev_private;
struct gm12u320_device *gm12u320 = to_gm12u320(dev);

gm12u320_set_ecomode(gm12u320);

Expand Down

0 comments on commit 7ced480

Please sign in to comment.