Skip to content

Commit fd7ee85

Browse files
committed
drm/mcde: Don't use drm_device->dev_private
Upcasting using a container_of macro is more typesafe, faster and easier for the compiler to optimize. v2: Move misplaced removal of double-assignment to this patch (Sam) Reviewed-by: Linus Walleij <linus.walleij@linaro.org> (v1) Acked-by: Sam Ravnborg <sam@ravnborg.org> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com> Cc: Linus Walleij <linus.walleij@linaro.org> Link: https://patchwork.freedesktop.org/patch/msgid/20200415074034.175360-30-daniel.vetter@ffwll.ch
1 parent 6ff71ed commit fd7ee85

File tree

4 files changed

+10
-10
lines changed

4 files changed

+10
-10
lines changed

drivers/gpu/drm/mcde/mcde_display.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -948,7 +948,7 @@ static void mcde_display_disable(struct drm_simple_display_pipe *pipe)
948948
{
949949
struct drm_crtc *crtc = &pipe->crtc;
950950
struct drm_device *drm = crtc->dev;
951-
struct mcde *mcde = drm->dev_private;
951+
struct mcde *mcde = to_mcde(drm);
952952
struct drm_pending_vblank_event *event;
953953

954954
drm_crtc_vblank_off(crtc);
@@ -1020,7 +1020,7 @@ static void mcde_display_update(struct drm_simple_display_pipe *pipe,
10201020
{
10211021
struct drm_crtc *crtc = &pipe->crtc;
10221022
struct drm_device *drm = crtc->dev;
1023-
struct mcde *mcde = drm->dev_private;
1023+
struct mcde *mcde = to_mcde(drm);
10241024
struct drm_pending_vblank_event *event = crtc->state->event;
10251025
struct drm_plane *plane = &pipe->plane;
10261026
struct drm_plane_state *pstate = plane->state;
@@ -1078,7 +1078,7 @@ static int mcde_display_enable_vblank(struct drm_simple_display_pipe *pipe)
10781078
{
10791079
struct drm_crtc *crtc = &pipe->crtc;
10801080
struct drm_device *drm = crtc->dev;
1081-
struct mcde *mcde = drm->dev_private;
1081+
struct mcde *mcde = to_mcde(drm);
10821082
u32 val;
10831083

10841084
/* Enable all VBLANK IRQs */
@@ -1097,7 +1097,7 @@ static void mcde_display_disable_vblank(struct drm_simple_display_pipe *pipe)
10971097
{
10981098
struct drm_crtc *crtc = &pipe->crtc;
10991099
struct drm_device *drm = crtc->dev;
1100-
struct mcde *mcde = drm->dev_private;
1100+
struct mcde *mcde = to_mcde(drm);
11011101

11021102
/* Disable all VBLANK IRQs */
11031103
writel(0, mcde->regs + MCDE_IMSCPP);
@@ -1117,7 +1117,7 @@ static struct drm_simple_display_pipe_funcs mcde_display_funcs = {
11171117

11181118
int mcde_display_init(struct drm_device *drm)
11191119
{
1120-
struct mcde *mcde = drm->dev_private;
1120+
struct mcde *mcde = to_mcde(drm);
11211121
int ret;
11221122
static const u32 formats[] = {
11231123
DRM_FORMAT_ARGB8888,

drivers/gpu/drm/mcde/mcde_drm.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ struct mcde {
3434
struct regulator *vana;
3535
};
3636

37+
#define to_mcde(dev) container_of(dev, struct mcde, drm)
38+
3739
bool mcde_dsi_irq(struct mipi_dsi_device *mdsi);
3840
void mcde_dsi_te_request(struct mipi_dsi_device *mdsi);
3941
extern struct platform_driver mcde_dsi_driver;

drivers/gpu/drm/mcde/mcde_drv.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ static irqreturn_t mcde_irq(int irq, void *data)
164164
static int mcde_modeset_init(struct drm_device *drm)
165165
{
166166
struct drm_mode_config *mode_config;
167-
struct mcde *mcde = drm->dev_private;
167+
struct mcde *mcde = to_mcde(drm);
168168
int ret;
169169

170170
if (!mcde->bridge) {
@@ -311,13 +311,11 @@ static int mcde_probe(struct platform_device *pdev)
311311
if (IS_ERR(mcde))
312312
return PTR_ERR(mcde);
313313
drm = &mcde->drm;
314-
drm->dev_private = mcde;
315314
mcde->dev = dev;
316315
platform_set_drvdata(pdev, drm);
317316

318317
/* Enable continuous updates: this is what Linux' framebuffer expects */
319318
mcde->oneshot_mode = false;
320-
drm->dev_private = mcde;
321319

322320
/* First obtain and turn on the main power */
323321
mcde->epod = devm_regulator_get(dev, "epod");
@@ -487,7 +485,7 @@ static int mcde_probe(struct platform_device *pdev)
487485
static int mcde_remove(struct platform_device *pdev)
488486
{
489487
struct drm_device *drm = platform_get_drvdata(pdev);
490-
struct mcde *mcde = drm->dev_private;
488+
struct mcde *mcde = to_mcde(drm);
491489

492490
component_master_del(&pdev->dev, &mcde_drm_comp_ops);
493491
clk_disable_unprepare(mcde->mcde_clk);

drivers/gpu/drm/mcde/mcde_dsi.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1020,7 +1020,7 @@ static int mcde_dsi_bind(struct device *dev, struct device *master,
10201020
void *data)
10211021
{
10221022
struct drm_device *drm = data;
1023-
struct mcde *mcde = drm->dev_private;
1023+
struct mcde *mcde = to_mcde(drm);
10241024
struct mcde_dsi *d = dev_get_drvdata(dev);
10251025
struct device_node *child;
10261026
struct drm_panel *panel = NULL;

0 commit comments

Comments
 (0)