#include "vsp1_dl.h"
 #include "vsp1_entity.h"
 
+static inline struct vsp1_entity *
+media_entity_to_vsp1_entity(struct media_entity *entity)
+{
+       return container_of(entity, struct vsp1_entity, subdev.entity);
+}
+
 void vsp1_entity_route_setup(struct vsp1_entity *source,
                             struct vsp1_dl_list *dl)
 {
        if (source->route->reg == 0)
                return;
 
-       sink = container_of(source->sink, struct vsp1_entity, subdev.entity);
+       sink = media_entity_to_vsp1_entity(source->sink);
        vsp1_dl_list_write(dl, source->route->reg,
                           sink->route->inputs[source->sink_pad]);
 }
        if (!(local->flags & MEDIA_PAD_FL_SOURCE))
                return 0;
 
-       source = container_of(local->entity, struct vsp1_entity, subdev.entity);
+       source = media_entity_to_vsp1_entity(local->entity);
 
        if (!source->route)
                return 0;