gpu: nvgpu: MISRA 11.8 fix to gk20a_from_pmu()

MISRA Rule 11.8 states that a cast shall not remove any const or
volatile qualification from the type pointed to by a pointer.

The linux kernel's container_of() macro contains such a violation as
it generates a pointer to a caller-specified (and so possibly non-const
qualified) type by casting an internally declared const pointer.

The gk20a_from_pmu() uses the container_of() macro to convert
from a struct nvgpu_pmu pointer to a struct gk20a pointer.

The struct nvgpu_pmu has a back pointer to struct gk20a already
however and so this change modifies gk20a_from_gpu() to just
return this back pointer rather than use container_of().

JIRA NVGPU-862

Change-Id: If0e2481c1cf104c2fa6b89334e20e75705bf9c44
Signed-off-by: Scott Long <scottl@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1955540
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Scott Long
2018-11-21 09:09:46 -08:00
committed by mobile promotions
parent d6d10592b3
commit 06dadf216e

View File

@@ -665,7 +665,7 @@ void nvgpu_pmu_surface_free(struct gk20a *g, struct nvgpu_mem *mem)
struct gk20a *gk20a_from_pmu(struct nvgpu_pmu *pmu)
{
return container_of(pmu, struct gk20a, pmu);
return pmu->g;
}
int nvgpu_pmu_wait_ready(struct gk20a *g)