Skip to content

Commit 1d614a4

Browse files
author
Thomas Zimmermann
committed
drm/bochs: Upcast with to_bochs_device()
The dev_private field in struct drm_device is deprecated. Limit its use by moving it into a helper function. A later change will remove it entirely. Signed-off-by: Thomas Zimmermann <[email protected]> Acked-by: Gerd Hoffmann <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent 7a195f1 commit 1d614a4

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

drivers/gpu/drm/tiny/bochs.c

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,11 @@ struct bochs_device {
9292
struct drm_connector connector;
9393
};
9494

95+
static struct bochs_device *to_bochs_device(const struct drm_device *dev)
96+
{
97+
return (struct bochs_device *)dev->dev_private;
98+
}
99+
95100
/* ---------------------------------------------------------------------- */
96101

97102
static void bochs_vga_writeb(struct bochs_device *bochs, u16 ioport, u8 val)
@@ -191,7 +196,7 @@ static int bochs_get_edid_block(void *data, u8 *buf, unsigned int block, size_t
191196
static const struct drm_edid *bochs_hw_read_edid(struct drm_connector *connector)
192197
{
193198
struct drm_device *dev = connector->dev;
194-
struct bochs_device *bochs = dev->dev_private;
199+
struct bochs_device *bochs = to_bochs_device(dev);
195200
u8 header[8];
196201

197202
/* check header to detect whenever edid support is enabled in qemu */
@@ -420,23 +425,23 @@ static void bochs_pipe_enable(struct drm_simple_display_pipe *pipe,
420425
struct drm_crtc_state *crtc_state,
421426
struct drm_plane_state *plane_state)
422427
{
423-
struct bochs_device *bochs = pipe->crtc.dev->dev_private;
428+
struct bochs_device *bochs = to_bochs_device(pipe->crtc.dev);
424429

425430
bochs_hw_setmode(bochs, &crtc_state->mode);
426431
bochs_plane_update(bochs, plane_state);
427432
}
428433

429434
static void bochs_pipe_disable(struct drm_simple_display_pipe *pipe)
430435
{
431-
struct bochs_device *bochs = pipe->crtc.dev->dev_private;
436+
struct bochs_device *bochs = to_bochs_device(pipe->crtc.dev);
432437

433438
bochs_hw_blank(bochs, true);
434439
}
435440

436441
static void bochs_pipe_update(struct drm_simple_display_pipe *pipe,
437442
struct drm_plane_state *old_state)
438443
{
439-
struct bochs_device *bochs = pipe->crtc.dev->dev_private;
444+
struct bochs_device *bochs = to_bochs_device(pipe->crtc.dev);
440445

441446
bochs_plane_update(bochs, pipe->plane.state);
442447
}

0 commit comments

Comments
 (0)