Commit Graph

2 Commits

Author SHA1 Message Date
Scott Long
69e5b2a38c gpu: nvgpu: container_of() changes to mm code
The container_of() macro used in nvgpu produces the following
set of MISRA required rule violations:

 * Rule 11.3 : A cast shall not be performed between a pointer to
               object type and a pointer to a different object type.

 * Rule 11.8 : A cast shall not remove any const or volatile
               qualification from the type pointed to be a pointer.

 * Rule 20.7 : Expressions resulting from the expansion of macro
               parameters shall be enclosed in parentheses

Using the same modified implementation of container_of() as that
used in the nvgpu_list_node/nvgpu_rbtree_node routines eliminates
the Rule 11.8 and Rule 20.7 violations and exchanges the Rule 11.3
violation with an advisory Rule 11.4 violation.

This patch uses that same equivalent implementation in two new
(static) functions that are used to replace references to
container_of() references in vm.c:

 * nvgpu_mapped_buf_from_ref
 * vm_gk20a_from_ref

The implementation of the following routine has also been updated
using the same approach to eliminate the direct reference to
container_of():

* gk20a_from_as

It should be noted that replacement functions still contain
potentially dangerous (and non-MISRA compliant code) and that it is
expected that deviation requests will be filed for the new advisory
rule violations accordingly.

JIRA NVGPU-782

Change-Id: I530f8d0cbe37445535b82578953eb5193ccf682c
Signed-off-by: Scott Long <scottl@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1989570
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-misra <svc-mobile-misra@nvidia.com>
Reviewed-by: svc-misra-checker <svc-misra-checker@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Konsta Holtta <kholtta@nvidia.com>
Reviewed-by: Adeel Raza <araza@nvidia.com>
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-01-11 16:15:03 -08:00
Alex Waterman
8cc819801c gpu: nvgpu: Move as.c to mm/as.c
This file, as.c, is an MM related source file. As
such it should be placed below mm/.

Note there's no relevant JIRA task for this.

Change-Id: Ie1062897e209bba2efb4ed4983fdd4966a688bfd
Signed-off-by: Alex Waterman <alexw@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1986177
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-01-03 11:55:14 -08:00