summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm
diff options
context:
space:
mode:
authorThomas Zimmermann <tzimmermann@suse.de>2024-09-02 12:53:43 +0200
committerThomas Zimmermann <tzimmermann@suse.de>2024-09-06 14:41:35 +0200
commit1d614a46743ce291d87ffae7a3658cb2195d6e8b (patch)
tree8a1d1e82317d48343290f4b9067b88509641510f /drivers/gpu/drm
parent7a195f1c4042110ca37c88ec2829134541f6ecf7 (diff)
downloadlwn-1d614a46743ce291d87ffae7a3658cb2195d6e8b.tar.gz
lwn-1d614a46743ce291d87ffae7a3658cb2195d6e8b.zip
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 <tzimmermann@suse.de> Acked-by: Gerd Hoffmann <kraxel@redhat.com> Link: https://patchwork.freedesktop.org/patch/msgid/20240902105546.792625-6-tzimmermann@suse.de
Diffstat (limited to 'drivers/gpu/drm')
-rw-r--r--drivers/gpu/drm/tiny/bochs.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/drivers/gpu/drm/tiny/bochs.c b/drivers/gpu/drm/tiny/bochs.c
index acb2652577d4..61b2b7aa03cb 100644
--- a/drivers/gpu/drm/tiny/bochs.c
+++ b/drivers/gpu/drm/tiny/bochs.c
@@ -92,6 +92,11 @@ struct bochs_device {
struct drm_connector connector;
};
+static struct bochs_device *to_bochs_device(const struct drm_device *dev)
+{
+ return (struct bochs_device *)dev->dev_private;
+}
+
/* ---------------------------------------------------------------------- */
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
static const struct drm_edid *bochs_hw_read_edid(struct drm_connector *connector)
{
struct drm_device *dev = connector->dev;
- struct bochs_device *bochs = dev->dev_private;
+ struct bochs_device *bochs = to_bochs_device(dev);
u8 header[8];
/* check header to detect whenever edid support is enabled in qemu */
@@ -420,7 +425,7 @@ static void bochs_pipe_enable(struct drm_simple_display_pipe *pipe,
struct drm_crtc_state *crtc_state,
struct drm_plane_state *plane_state)
{
- struct bochs_device *bochs = pipe->crtc.dev->dev_private;
+ struct bochs_device *bochs = to_bochs_device(pipe->crtc.dev);
bochs_hw_setmode(bochs, &crtc_state->mode);
bochs_plane_update(bochs, plane_state);
@@ -428,7 +433,7 @@ static void bochs_pipe_enable(struct drm_simple_display_pipe *pipe,
static void bochs_pipe_disable(struct drm_simple_display_pipe *pipe)
{
- struct bochs_device *bochs = pipe->crtc.dev->dev_private;
+ struct bochs_device *bochs = to_bochs_device(pipe->crtc.dev);
bochs_hw_blank(bochs, true);
}
@@ -436,7 +441,7 @@ static void bochs_pipe_disable(struct drm_simple_display_pipe *pipe)
static void bochs_pipe_update(struct drm_simple_display_pipe *pipe,
struct drm_plane_state *old_state)
{
- struct bochs_device *bochs = pipe->crtc.dev->dev_private;
+ struct bochs_device *bochs = to_bochs_device(pipe->crtc.dev);
bochs_plane_update(bochs, pipe->plane.state);
}