On Wed, Oct 31, 2018 at 8:28 AM Rex Zhu <Rex.Zhu@xxxxxxx> wrote: > > Get the sdma index from sdma ring > > Signed-off-by: Rex Zhu <Rex.Zhu@xxxxxxx> > --- > drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.c | 16 ++++++++++++++++ > drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.h | 1 + > 2 files changed, 17 insertions(+) > > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.c > index 0fb9907..99668a5 100644 > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.c > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.c > @@ -40,3 +40,19 @@ struct amdgpu_sdma_instance * amdgpu_get_sdma_instance(struct amdgpu_ring *ring) > > return NULL; > } > + > +int amdgpu_get_sdma_index(struct amdgpu_ring *ring, uint32_t *index) For consistency with other files, call this function something like amdgpu_sdma_get_index_from_ring(). We should also update amdgpu_get_sdma_instance() to amdgpu_sdma_get_instance(). Alex > +{ > + struct amdgpu_device *adev = ring->adev; > + int i; > + > + for (i = 0; i < adev->sdma.num_instances; i++) { > + if (ring == &adev->sdma.instance[i].ring || > + ring == &adev->sdma.instance[i].page) { > + *index = i; > + return 0; > + } > + } > + > + return -EINVAL; > +} > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.h > index 237a357..92e5097 100644 > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.h > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.h > @@ -96,5 +96,6 @@ struct amdgpu_buffer_funcs { > > struct amdgpu_sdma_instance * > amdgpu_get_sdma_instance(struct amdgpu_ring *ring); > +int amdgpu_get_sdma_index(struct amdgpu_ring *ring, uint32_t *index); > > #endif > -- > 1.9.1 > > _______________________________________________ > amd-gfx mailing list > amd-gfx@xxxxxxxxxxxxxxxxxxxxx > https://lists.freedesktop.org/mailman/listinfo/amd-gfx _______________________________________________ amd-gfx mailing list amd-gfx@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/amd-gfx