Skip to content

Commit 5f56e59

Browse files
dakrdliviu
authored andcommitted
drm/arm/hdlcd: replace drm->dev_private with drm_to_hdlcd_priv()
Using drm_device->dev_private is deprecated. Since we've switched to devm_drm_dev_alloc(), struct drm_device is now embedded in struct hdlcd_drm_private, hence we can use container_of() to get the struct drm_device instance instead. Signed-off-by: Danilo Krummrich <[email protected]> Signed-off-by: Liviu Dudau <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent 9914013 commit 5f56e59

File tree

3 files changed

+8
-9
lines changed

3 files changed

+8
-9
lines changed

drivers/gpu/drm/arm/hdlcd_crtc.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ static void hdlcd_plane_atomic_update(struct drm_plane *plane,
274274
dest_h = drm_rect_height(&new_plane_state->dst);
275275
scanout_start = drm_fb_dma_get_gem_addr(fb, new_plane_state, 0);
276276

277-
hdlcd = plane->dev->dev_private;
277+
hdlcd = drm_to_hdlcd_priv(plane->dev);
278278
hdlcd_write(hdlcd, HDLCD_REG_FB_LINE_LENGTH, fb->pitches[0]);
279279
hdlcd_write(hdlcd, HDLCD_REG_FB_LINE_PITCH, fb->pitches[0]);
280280
hdlcd_write(hdlcd, HDLCD_REG_FB_LINE_COUNT, dest_h - 1);
@@ -297,7 +297,7 @@ static const struct drm_plane_funcs hdlcd_plane_funcs = {
297297

298298
static struct drm_plane *hdlcd_plane_init(struct drm_device *drm)
299299
{
300-
struct hdlcd_drm_private *hdlcd = drm->dev_private;
300+
struct hdlcd_drm_private *hdlcd = drm_to_hdlcd_priv(drm);
301301
struct drm_plane *plane = NULL;
302302
u32 formats[ARRAY_SIZE(supported_formats)], i;
303303
int ret;
@@ -324,7 +324,7 @@ static struct drm_plane *hdlcd_plane_init(struct drm_device *drm)
324324

325325
int hdlcd_setup_crtc(struct drm_device *drm)
326326
{
327-
struct hdlcd_drm_private *hdlcd = drm->dev_private;
327+
struct hdlcd_drm_private *hdlcd = drm_to_hdlcd_priv(drm);
328328
struct drm_plane *primary;
329329
int ret;
330330

drivers/gpu/drm/arm/hdlcd_drv.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ static void hdlcd_irq_uninstall(struct hdlcd_drm_private *hdlcd)
9898

9999
static int hdlcd_load(struct drm_device *drm, unsigned long flags)
100100
{
101-
struct hdlcd_drm_private *hdlcd = drm->dev_private;
101+
struct hdlcd_drm_private *hdlcd = drm_to_hdlcd_priv(drm);
102102
struct platform_device *pdev = to_platform_device(drm->dev);
103103
struct resource *res;
104104
u32 version;
@@ -190,7 +190,7 @@ static int hdlcd_show_underrun_count(struct seq_file *m, void *arg)
190190
{
191191
struct drm_info_node *node = (struct drm_info_node *)m->private;
192192
struct drm_device *drm = node->minor->dev;
193-
struct hdlcd_drm_private *hdlcd = drm->dev_private;
193+
struct hdlcd_drm_private *hdlcd = drm_to_hdlcd_priv(drm);
194194

195195
seq_printf(m, "underrun : %d\n", atomic_read(&hdlcd->buffer_underrun_count));
196196
seq_printf(m, "dma_end : %d\n", atomic_read(&hdlcd->dma_end_count));
@@ -203,7 +203,7 @@ static int hdlcd_show_pxlclock(struct seq_file *m, void *arg)
203203
{
204204
struct drm_info_node *node = (struct drm_info_node *)m->private;
205205
struct drm_device *drm = node->minor->dev;
206-
struct hdlcd_drm_private *hdlcd = drm->dev_private;
206+
struct hdlcd_drm_private *hdlcd = drm_to_hdlcd_priv(drm);
207207
unsigned long clkrate = clk_get_rate(hdlcd->clk);
208208
unsigned long mode_clock = hdlcd->crtc.mode.crtc_clock * 1000;
209209

@@ -253,7 +253,6 @@ static int hdlcd_drm_bind(struct device *dev)
253253

254254
drm = &hdlcd->base;
255255

256-
drm->dev_private = hdlcd;
257256
dev_set_drvdata(dev, drm);
258257

259258
hdlcd_setup_mode_config(drm);
@@ -324,7 +323,7 @@ static int hdlcd_drm_bind(struct device *dev)
324323
static void hdlcd_drm_unbind(struct device *dev)
325324
{
326325
struct drm_device *drm = dev_get_drvdata(dev);
327-
struct hdlcd_drm_private *hdlcd = drm->dev_private;
326+
struct hdlcd_drm_private *hdlcd = drm_to_hdlcd_priv(drm);
328327

329328
drm_dev_unregister(drm);
330329
drm_kms_helper_poll_fini(drm);
@@ -339,7 +338,6 @@ static void hdlcd_drm_unbind(struct device *dev)
339338
pm_runtime_disable(dev);
340339
of_reserved_mem_device_release(dev);
341340
drm_mode_config_cleanup(drm);
342-
drm->dev_private = NULL;
343341
dev_set_drvdata(dev, NULL);
344342
}
345343

drivers/gpu/drm/arm/hdlcd_drv.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ struct hdlcd_drm_private {
2121
#endif
2222
};
2323

24+
#define drm_to_hdlcd_priv(x) container_of(x, struct hdlcd_drm_private, base)
2425
#define crtc_to_hdlcd_priv(x) container_of(x, struct hdlcd_drm_private, crtc)
2526

2627
static inline void hdlcd_write(struct hdlcd_drm_private *hdlcd,

0 commit comments

Comments
 (0)