Commit 0c7890dc authored by Daniel Vetter's avatar Daniel Vetter

drm/cirrus: 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: default avatarEric Anholt <eric@anholt.net>
Acked-by: default avatarSam Ravnborg <sam@ravnborg.org>
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@intel.com>
Cc: Dave Airlie <airlied@redhat.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: "Noralf Trønnes" <noralf@tronnes.org>
Cc: Sam Ravnborg <sam@ravnborg.org>
Cc: Eric Anholt <eric@anholt.net>
Cc: Thomas Zimmermann <tzimmermann@suse.de>
Cc: virtualization@lists.linux-foundation.org
Link: https://patchwork.freedesktop.org/patch/msgid/20200415074034.175360-37-daniel.vetter@ffwll.ch
parent 9bb2e637
...@@ -59,6 +59,8 @@ struct cirrus_device { ...@@ -59,6 +59,8 @@ struct cirrus_device {
void __iomem *mmio; void __iomem *mmio;
}; };
#define to_cirrus(_dev) container_of(_dev, struct cirrus_device, dev)
/* ------------------------------------------------------------------ */ /* ------------------------------------------------------------------ */
/* /*
* The meat of this driver. The core passes us a mode and we have to program * The meat of this driver. The core passes us a mode and we have to program
...@@ -311,7 +313,7 @@ static int cirrus_mode_set(struct cirrus_device *cirrus, ...@@ -311,7 +313,7 @@ static int cirrus_mode_set(struct cirrus_device *cirrus,
static int cirrus_fb_blit_rect(struct drm_framebuffer *fb, static int cirrus_fb_blit_rect(struct drm_framebuffer *fb,
struct drm_rect *rect) struct drm_rect *rect)
{ {
struct cirrus_device *cirrus = fb->dev->dev_private; struct cirrus_device *cirrus = to_cirrus(fb->dev);
void *vmap; void *vmap;
int idx, ret; int idx, ret;
...@@ -436,7 +438,7 @@ static void cirrus_pipe_enable(struct drm_simple_display_pipe *pipe, ...@@ -436,7 +438,7 @@ static void cirrus_pipe_enable(struct drm_simple_display_pipe *pipe,
struct drm_crtc_state *crtc_state, struct drm_crtc_state *crtc_state,
struct drm_plane_state *plane_state) struct drm_plane_state *plane_state)
{ {
struct cirrus_device *cirrus = pipe->crtc.dev->dev_private; struct cirrus_device *cirrus = to_cirrus(pipe->crtc.dev);
cirrus_mode_set(cirrus, &crtc_state->mode, plane_state->fb); cirrus_mode_set(cirrus, &crtc_state->mode, plane_state->fb);
cirrus_fb_blit_fullscreen(plane_state->fb); cirrus_fb_blit_fullscreen(plane_state->fb);
...@@ -445,7 +447,7 @@ static void cirrus_pipe_enable(struct drm_simple_display_pipe *pipe, ...@@ -445,7 +447,7 @@ static void cirrus_pipe_enable(struct drm_simple_display_pipe *pipe,
static void cirrus_pipe_update(struct drm_simple_display_pipe *pipe, static void cirrus_pipe_update(struct drm_simple_display_pipe *pipe,
struct drm_plane_state *old_state) struct drm_plane_state *old_state)
{ {
struct cirrus_device *cirrus = pipe->crtc.dev->dev_private; struct cirrus_device *cirrus = to_cirrus(pipe->crtc.dev);
struct drm_plane_state *state = pipe->plane.state; struct drm_plane_state *state = pipe->plane.state;
struct drm_crtc *crtc = &pipe->crtc; struct drm_crtc *crtc = &pipe->crtc;
struct drm_rect rect; struct drm_rect rect;
...@@ -573,7 +575,6 @@ static int cirrus_pci_probe(struct pci_dev *pdev, ...@@ -573,7 +575,6 @@ static int cirrus_pci_probe(struct pci_dev *pdev,
return PTR_ERR(cirrus); return PTR_ERR(cirrus);
dev = &cirrus->dev; dev = &cirrus->dev;
dev->dev_private = cirrus;
cirrus->vram = devm_ioremap(&pdev->dev, pci_resource_start(pdev, 0), cirrus->vram = devm_ioremap(&pdev->dev, pci_resource_start(pdev, 0),
pci_resource_len(pdev, 0)); pci_resource_len(pdev, 0));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment