mirror of
git://nv-tegra.nvidia.com/linux-nvgpu.git
synced 2025-12-24 02:22:34 +03:00
gpu: nvgpu: MISRA 4.5 fixes to round_up()
MISRA Advisory Directive 4.5 states that identifiers in the same name space with overlapping visibility should be typographically unambiguous. The presence of both the roundup(x,y) and round_up(x,y) macros in the posix utils.h header incurs a violation of this rule. These macros were added to keep in sync with the linux kernel variants. However, there is a key distinction between how these two macros work in the linux kernel; roundup(x,y) can handle any y alignment while round_up(x,y) is intended to work only when y is a power-of-two. Passing a non-power-of-two alignment to round_up(x,y) results in an incorrect value being returned (silently). Because all current uses of roundup(x,y) and round_up(x,y) in nvgpu specify a y value that is a power-of-two and the underlying posix macro implementations assume as much, it is best to remove roundup(x,y) from nvgpu altogether to avoid any confusion. So this change converts all uses of roundup(x,y) to round_up(x,y). Jira NVGPU-3178 Change-Id: I0ee974d3e088fa704e251a38f6b7ada5a7600aec Signed-off-by: Scott Long <scottl@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/2271385 Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com> Reviewed-by: svc-mobile-misra <svc-mobile-misra@nvidia.com> Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com> Reviewed-by: Automatic_Commit_Validation_User GVS: Gerrit_Virtual_Submit Reviewed-by: Deepak Nibade <dnibade@nvidia.com> Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
committed by
Alex Waterman
parent
3f65316312
commit
ae44d384f3
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Color decompression engine support
|
||||
*
|
||||
* Copyright (c) 2014-2019, NVIDIA Corporation. All rights reserved.
|
||||
* Copyright (c) 2014-2020, NVIDIA Corporation. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
@@ -1549,10 +1549,10 @@ static int gk20a_buffer_convert_gpu_to_cde_v1(
|
||||
/* Compute per launch parameters */
|
||||
const int xtiles = (width + 7) >> 3;
|
||||
const int ytiles = (height + 7) >> 3;
|
||||
const int gridw_h = roundup(xtiles, xalign) / xalign;
|
||||
const int gridh_h = roundup(ytiles, yalign) / yalign;
|
||||
const int gridw_v = roundup(ytiles, xalign) / xalign;
|
||||
const int gridh_v = roundup(xtiles, yalign) / yalign;
|
||||
const int gridw_h = round_up(xtiles, xalign) / xalign;
|
||||
const int gridh_h = round_up(ytiles, yalign) / yalign;
|
||||
const int gridw_v = round_up(ytiles, xalign) / xalign;
|
||||
const int gridh_v = round_up(xtiles, yalign) / yalign;
|
||||
const int xblocks = (xtiles + 1) >> 1;
|
||||
const int voffset = compbits_voffset - compbits_hoffset;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user