Skip to content

Commit 02e6c5b

Browse files
committed
drm: renesas: shmobile: Convert container helpers to static inline functions
Replace to conversion helper macros using container_of() by static inline functions, to improve type-safety. Reviewed-by: Laurent Pinchart <[email protected]> Signed-off-by: Geert Uytterhoeven <[email protected]> Link: https://lore.kernel.org/r/7d1f1aa4b832499f9e527353ce0ad6d84ff9a74a.1694767209.git.geert+renesas@glider.be
1 parent 5417750 commit 02e6c5b

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

drivers/gpu/drm/renesas/shmobile/shmob_drm_crtc.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,10 @@ static void shmob_drm_crtc_update_base(struct shmob_drm_crtc *scrtc)
258258
lcdc_write(sdev, LDRCNTR, lcdc_read(sdev, LDRCNTR) ^ LDRCNTR_MRS);
259259
}
260260

261-
#define to_shmob_crtc(c) container_of(c, struct shmob_drm_crtc, crtc)
261+
static inline struct shmob_drm_crtc *to_shmob_crtc(struct drm_crtc *crtc)
262+
{
263+
return container_of(crtc, struct shmob_drm_crtc, crtc);
264+
}
262265

263266
static void shmob_drm_crtc_dpms(struct drm_crtc *crtc, int mode)
264267
{
@@ -538,8 +541,10 @@ int shmob_drm_encoder_create(struct shmob_drm_device *sdev)
538541
* Connector
539542
*/
540543

541-
#define to_shmob_connector(c) \
542-
container_of(c, struct shmob_drm_connector, connector)
544+
static inline struct shmob_drm_connector *to_shmob_connector(struct drm_connector *connector)
545+
{
546+
return container_of(connector, struct shmob_drm_connector, connector);
547+
}
543548

544549
static int shmob_drm_connector_get_modes(struct drm_connector *connector)
545550
{

drivers/gpu/drm/renesas/shmobile/shmob_drm_plane.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,10 @@ struct shmob_drm_plane {
3434
unsigned int crtc_h;
3535
};
3636

37-
#define to_shmob_plane(p) container_of(p, struct shmob_drm_plane, plane)
37+
static inline struct shmob_drm_plane *to_shmob_plane(struct drm_plane *plane)
38+
{
39+
return container_of(plane, struct shmob_drm_plane, plane);
40+
}
3841

3942
static void shmob_drm_plane_compute_base(struct shmob_drm_plane *splane,
4043
struct drm_framebuffer *fb,

0 commit comments

Comments
 (0)