Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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 <dakr@redhat.com>
Signed-off-by: Liviu Dudau <liviu.dudau@arm.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20221026153431.72033-3-dakr@redhat.com

authored by

Danilo Krummrich and committed by
Liviu Dudau
5f56e596 9914013f

+8 -9
+3 -3
drivers/gpu/drm/arm/hdlcd_crtc.c
··· 274 274 dest_h = drm_rect_height(&new_plane_state->dst); 275 275 scanout_start = drm_fb_dma_get_gem_addr(fb, new_plane_state, 0); 276 276 277 - hdlcd = plane->dev->dev_private; 277 + hdlcd = drm_to_hdlcd_priv(plane->dev); 278 278 hdlcd_write(hdlcd, HDLCD_REG_FB_LINE_LENGTH, fb->pitches[0]); 279 279 hdlcd_write(hdlcd, HDLCD_REG_FB_LINE_PITCH, fb->pitches[0]); 280 280 hdlcd_write(hdlcd, HDLCD_REG_FB_LINE_COUNT, dest_h - 1); ··· 297 297 298 298 static struct drm_plane *hdlcd_plane_init(struct drm_device *drm) 299 299 { 300 - struct hdlcd_drm_private *hdlcd = drm->dev_private; 300 + struct hdlcd_drm_private *hdlcd = drm_to_hdlcd_priv(drm); 301 301 struct drm_plane *plane = NULL; 302 302 u32 formats[ARRAY_SIZE(supported_formats)], i; 303 303 int ret; ··· 324 324 325 325 int hdlcd_setup_crtc(struct drm_device *drm) 326 326 { 327 - struct hdlcd_drm_private *hdlcd = drm->dev_private; 327 + struct hdlcd_drm_private *hdlcd = drm_to_hdlcd_priv(drm); 328 328 struct drm_plane *primary; 329 329 int ret; 330 330
+4 -6
drivers/gpu/drm/arm/hdlcd_drv.c
··· 98 98 99 99 static int hdlcd_load(struct drm_device *drm, unsigned long flags) 100 100 { 101 - struct hdlcd_drm_private *hdlcd = drm->dev_private; 101 + struct hdlcd_drm_private *hdlcd = drm_to_hdlcd_priv(drm); 102 102 struct platform_device *pdev = to_platform_device(drm->dev); 103 103 struct resource *res; 104 104 u32 version; ··· 190 190 { 191 191 struct drm_info_node *node = (struct drm_info_node *)m->private; 192 192 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); 194 194 195 195 seq_printf(m, "underrun : %d\n", atomic_read(&hdlcd->buffer_underrun_count)); 196 196 seq_printf(m, "dma_end : %d\n", atomic_read(&hdlcd->dma_end_count)); ··· 203 203 { 204 204 struct drm_info_node *node = (struct drm_info_node *)m->private; 205 205 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); 207 207 unsigned long clkrate = clk_get_rate(hdlcd->clk); 208 208 unsigned long mode_clock = hdlcd->crtc.mode.crtc_clock * 1000; 209 209 ··· 253 253 254 254 drm = &hdlcd->base; 255 255 256 - drm->dev_private = hdlcd; 257 256 dev_set_drvdata(dev, drm); 258 257 259 258 hdlcd_setup_mode_config(drm); ··· 323 324 static void hdlcd_drm_unbind(struct device *dev) 324 325 { 325 326 struct drm_device *drm = dev_get_drvdata(dev); 326 - struct hdlcd_drm_private *hdlcd = drm->dev_private; 327 + struct hdlcd_drm_private *hdlcd = drm_to_hdlcd_priv(drm); 327 328 328 329 drm_dev_unregister(drm); 329 330 drm_kms_helper_poll_fini(drm); ··· 338 339 pm_runtime_disable(dev); 339 340 of_reserved_mem_device_release(dev); 340 341 drm_mode_config_cleanup(drm); 341 - drm->dev_private = NULL; 342 342 dev_set_drvdata(dev, NULL); 343 343 } 344 344
+1
drivers/gpu/drm/arm/hdlcd_drv.h
··· 21 21 #endif 22 22 }; 23 23 24 + #define drm_to_hdlcd_priv(x) container_of(x, struct hdlcd_drm_private, base) 24 25 #define crtc_to_hdlcd_priv(x) container_of(x, struct hdlcd_drm_private, crtc) 25 26 26 27 static inline void hdlcd_write(struct hdlcd_drm_private *hdlcd,