diff options
author | Srirangan <smadhavan@nvidia.com> | 2018-09-04 07:16:40 -0400 |
---|---|---|
committer | mobile promotions <svcmobile_promotions@nvidia.com> | 2018-09-05 23:41:06 -0400 |
commit | 3b413d58fa349eca1da9577359546c39effa2c8c (patch) | |
tree | 2bb45c9253fb6a5a18afa6d1c12ffeca79effd8e /drivers/gpu/nvgpu/volt/volt_rail.c | |
parent | 7405cd9a6dcd22d04f48be07be4839c735994ada (diff) |
gpu: nvgpu: volt: Fix MISRA 15.6 violations
MISRA Rule-15.6 requires that all if-else blocks be enclosed in braces,
including single statement blocks. Fix errors due to single statement
if blocks without braces by introducing the braces.
JIRA NVGPU-671
Change-Id: I938f49b2d1d042dc96573e1a579fe82909a679ab
Signed-off-by: Srirangan <smadhavan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1812421
Reviewed-by: svc-misra-checker <svc-misra-checker@nvidia.com>
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>
Diffstat (limited to 'drivers/gpu/nvgpu/volt/volt_rail.c')
-rw-r--r-- | drivers/gpu/nvgpu/volt/volt_rail.c | 55 |
1 files changed, 35 insertions, 20 deletions
diff --git a/drivers/gpu/nvgpu/volt/volt_rail.c b/drivers/gpu/nvgpu/volt/volt_rail.c index 6a7dcdbe..e44d8973 100644 --- a/drivers/gpu/nvgpu/volt/volt_rail.c +++ b/drivers/gpu/nvgpu/volt/volt_rail.c | |||
@@ -89,8 +89,9 @@ u32 volt_rail_volt_dev_register(struct gk20a *g, struct voltage_rail | |||
89 | volt_dev_idx); | 89 | volt_dev_idx); |
90 | 90 | ||
91 | exit: | 91 | exit: |
92 | if (status) | 92 | if (status) { |
93 | nvgpu_err(g, "Failed to register VOLTAGE_DEVICE"); | 93 | nvgpu_err(g, "Failed to register VOLTAGE_DEVICE"); |
94 | } | ||
94 | 95 | ||
95 | return status; | 96 | return status; |
96 | } | 97 | } |
@@ -138,8 +139,9 @@ static u32 volt_rail_init_pmudata_super(struct gk20a *g, | |||
138 | nvgpu_log_info(g, " "); | 139 | nvgpu_log_info(g, " "); |
139 | 140 | ||
140 | status = boardobj_pmudatainit_super(g, board_obj_ptr, ppmudata); | 141 | status = boardobj_pmudatainit_super(g, board_obj_ptr, ppmudata); |
141 | if (status) | 142 | if (status) { |
142 | return status; | 143 | return status; |
144 | } | ||
143 | 145 | ||
144 | prail = (struct voltage_rail *)board_obj_ptr; | 146 | prail = (struct voltage_rail *)board_obj_ptr; |
145 | rail_pmu_data = (struct nv_pmu_volt_volt_rail_boardobj_set *) | 147 | rail_pmu_data = (struct nv_pmu_volt_volt_rail_boardobj_set *) |
@@ -166,9 +168,10 @@ static u32 volt_rail_init_pmudata_super(struct gk20a *g, | |||
166 | status = boardobjgrpmask_export(&prail->volt_dev_mask.super, | 168 | status = boardobjgrpmask_export(&prail->volt_dev_mask.super, |
167 | prail->volt_dev_mask.super.bitcount, | 169 | prail->volt_dev_mask.super.bitcount, |
168 | &rail_pmu_data->volt_dev_mask.super); | 170 | &rail_pmu_data->volt_dev_mask.super); |
169 | if (status) | 171 | if (status) { |
170 | nvgpu_err(g, | 172 | nvgpu_err(g, |
171 | "Failed to export BOARDOBJGRPMASK of VOLTAGE_DEVICEs"); | 173 | "Failed to export BOARDOBJGRPMASK of VOLTAGE_DEVICEs"); |
174 | } | ||
172 | 175 | ||
173 | nvgpu_log_info(g, "Done"); | 176 | nvgpu_log_info(g, "Done"); |
174 | 177 | ||
@@ -185,8 +188,9 @@ static struct voltage_rail *construct_volt_rail(struct gk20a *g, void *pargs) | |||
185 | nvgpu_log_info(g, " "); | 188 | nvgpu_log_info(g, " "); |
186 | status = boardobj_construct_super(g, &board_obj_ptr, | 189 | status = boardobj_construct_super(g, &board_obj_ptr, |
187 | sizeof(struct voltage_rail), pargs); | 190 | sizeof(struct voltage_rail), pargs); |
188 | if (status) | 191 | if (status) { |
189 | return NULL; | 192 | return NULL; |
193 | } | ||
190 | 194 | ||
191 | board_obj_volt_rail_ptr = (struct voltage_rail *)board_obj_ptr; | 195 | board_obj_volt_rail_ptr = (struct voltage_rail *)board_obj_ptr; |
192 | /* override super class interface */ | 196 | /* override super class interface */ |
@@ -221,8 +225,9 @@ u8 volt_rail_vbios_volt_domain_convert_to_internal(struct gk20a *g, | |||
221 | { | 225 | { |
222 | switch (g->perf_pmu.volt.volt_rail_metadata.volt_domain_hal) { | 226 | switch (g->perf_pmu.volt.volt_rail_metadata.volt_domain_hal) { |
223 | case CTRL_VOLT_DOMAIN_HAL_GP10X_SINGLE_RAIL: | 227 | case CTRL_VOLT_DOMAIN_HAL_GP10X_SINGLE_RAIL: |
224 | if (vbios_volt_domain == 0) | 228 | if (vbios_volt_domain == 0) { |
225 | return CTRL_VOLT_DOMAIN_LOGIC; | 229 | return CTRL_VOLT_DOMAIN_LOGIC; |
230 | } | ||
226 | break; | 231 | break; |
227 | case CTRL_VOLT_DOMAIN_HAL_GP10X_SPLIT_RAIL: | 232 | case CTRL_VOLT_DOMAIN_HAL_GP10X_SPLIT_RAIL: |
228 | switch (vbios_volt_domain) { | 233 | switch (vbios_volt_domain) { |
@@ -246,8 +251,9 @@ u32 volt_rail_pmu_setup(struct gk20a *g) | |||
246 | 251 | ||
247 | pboardobjgrp = &g->perf_pmu.volt.volt_rail_metadata.volt_rails.super; | 252 | pboardobjgrp = &g->perf_pmu.volt.volt_rail_metadata.volt_rails.super; |
248 | 253 | ||
249 | if (!pboardobjgrp->bconstructed) | 254 | if (!pboardobjgrp->bconstructed) { |
250 | return -EINVAL; | 255 | return -EINVAL; |
256 | } | ||
251 | 257 | ||
252 | status = pboardobjgrp->pmuinithandle(g, pboardobjgrp); | 258 | status = pboardobjgrp->pmuinithandle(g, pboardobjgrp); |
253 | 259 | ||
@@ -294,8 +300,9 @@ static u32 volt_get_volt_rail_table(struct gk20a *g, | |||
294 | 300 | ||
295 | volt_domain = volt_rail_vbios_volt_domain_convert_to_internal(g, | 301 | volt_domain = volt_rail_vbios_volt_domain_convert_to_internal(g, |
296 | i); | 302 | i); |
297 | if (volt_domain == CTRL_VOLT_DOMAIN_INVALID) | 303 | if (volt_domain == CTRL_VOLT_DOMAIN_INVALID) { |
298 | continue; | 304 | continue; |
305 | } | ||
299 | 306 | ||
300 | rail_type_data.board_obj.type = volt_domain; | 307 | rail_type_data.board_obj.type = volt_domain; |
301 | rail_type_data.volt_rail.boot_voltage_uv = | 308 | rail_type_data.volt_rail.boot_voltage_uv = |
@@ -308,44 +315,49 @@ static u32 volt_get_volt_rail_table(struct gk20a *g, | |||
308 | (u8)entry.ov_limit_vfe_equ_idx; | 315 | (u8)entry.ov_limit_vfe_equ_idx; |
309 | 316 | ||
310 | if (header.table_entry_size >= | 317 | if (header.table_entry_size >= |
311 | NV_VBIOS_VOLTAGE_RAIL_1X_ENTRY_SIZE_0C) | 318 | NV_VBIOS_VOLTAGE_RAIL_1X_ENTRY_SIZE_0C) { |
312 | rail_type_data.volt_rail.volt_scale_exp_pwr_equ_idx = | 319 | rail_type_data.volt_rail.volt_scale_exp_pwr_equ_idx = |
313 | (u8)entry.volt_scale_exp_pwr_equ_idx; | 320 | (u8)entry.volt_scale_exp_pwr_equ_idx; |
314 | else | 321 | } else { |
315 | rail_type_data.volt_rail.volt_scale_exp_pwr_equ_idx = | 322 | rail_type_data.volt_rail.volt_scale_exp_pwr_equ_idx = |
316 | CTRL_BOARDOBJ_IDX_INVALID; | 323 | CTRL_BOARDOBJ_IDX_INVALID; |
324 | } | ||
317 | 325 | ||
318 | if (header.table_entry_size >= | 326 | if (header.table_entry_size >= |
319 | NV_VBIOS_VOLTAGE_RAIL_1X_ENTRY_SIZE_0B) | 327 | NV_VBIOS_VOLTAGE_RAIL_1X_ENTRY_SIZE_0B) { |
320 | rail_type_data.volt_rail.volt_margin_limit_vfe_equ_idx = | 328 | rail_type_data.volt_rail.volt_margin_limit_vfe_equ_idx = |
321 | (u8)entry.volt_margin_limit_vfe_equ_idx; | 329 | (u8)entry.volt_margin_limit_vfe_equ_idx; |
322 | else | 330 | } else { |
323 | rail_type_data.volt_rail.volt_margin_limit_vfe_equ_idx = | 331 | rail_type_data.volt_rail.volt_margin_limit_vfe_equ_idx = |
324 | CTRL_BOARDOBJ_IDX_INVALID; | 332 | CTRL_BOARDOBJ_IDX_INVALID; |
333 | } | ||
325 | 334 | ||
326 | if (header.table_entry_size >= | 335 | if (header.table_entry_size >= |
327 | NV_VBIOS_VOLTAGE_RAIL_1X_ENTRY_SIZE_0A) | 336 | NV_VBIOS_VOLTAGE_RAIL_1X_ENTRY_SIZE_0A) { |
328 | rail_type_data.volt_rail.vmin_limit_vfe_equ_idx = | 337 | rail_type_data.volt_rail.vmin_limit_vfe_equ_idx = |
329 | (u8)entry.vmin_limit_vfe_equ_idx; | 338 | (u8)entry.vmin_limit_vfe_equ_idx; |
330 | else | 339 | } else { |
331 | rail_type_data.volt_rail.vmin_limit_vfe_equ_idx = | 340 | rail_type_data.volt_rail.vmin_limit_vfe_equ_idx = |
332 | CTRL_BOARDOBJ_IDX_INVALID; | 341 | CTRL_BOARDOBJ_IDX_INVALID; |
342 | } | ||
333 | 343 | ||
334 | if (header.table_entry_size >= | 344 | if (header.table_entry_size >= |
335 | NV_VBIOS_VOLTAGE_RAIL_1X_ENTRY_SIZE_09) | 345 | NV_VBIOS_VOLTAGE_RAIL_1X_ENTRY_SIZE_09) { |
336 | rail_type_data.volt_rail.boot_volt_vfe_equ_idx = | 346 | rail_type_data.volt_rail.boot_volt_vfe_equ_idx = |
337 | (u8)entry.boot_volt_vfe_equ_idx; | 347 | (u8)entry.boot_volt_vfe_equ_idx; |
338 | else | 348 | } else { |
339 | rail_type_data.volt_rail.boot_volt_vfe_equ_idx = | 349 | rail_type_data.volt_rail.boot_volt_vfe_equ_idx = |
340 | CTRL_BOARDOBJ_IDX_INVALID; | 350 | CTRL_BOARDOBJ_IDX_INVALID; |
351 | } | ||
341 | 352 | ||
342 | if (header.table_entry_size >= | 353 | if (header.table_entry_size >= |
343 | NV_VBIOS_VOLTAGE_RAIL_1X_ENTRY_SIZE_08) | 354 | NV_VBIOS_VOLTAGE_RAIL_1X_ENTRY_SIZE_08) { |
344 | rail_type_data.volt_rail.pwr_equ_idx = | 355 | rail_type_data.volt_rail.pwr_equ_idx = |
345 | (u8)entry.pwr_equ_idx; | 356 | (u8)entry.pwr_equ_idx; |
346 | else | 357 | } else { |
347 | rail_type_data.volt_rail.pwr_equ_idx = | 358 | rail_type_data.volt_rail.pwr_equ_idx = |
348 | CTRL_PMGR_PWR_EQUATION_INDEX_INVALID; | 359 | CTRL_PMGR_PWR_EQUATION_INDEX_INVALID; |
360 | } | ||
349 | 361 | ||
350 | prail = construct_volt_rail(g, &rail_type_data); | 362 | prail = construct_volt_rail(g, &rail_type_data); |
351 | 363 | ||
@@ -370,8 +382,9 @@ static u32 _volt_rail_devgrp_pmudata_instget(struct gk20a *g, | |||
370 | 382 | ||
371 | /*check whether pmuboardobjgrp has a valid boardobj in index*/ | 383 | /*check whether pmuboardobjgrp has a valid boardobj in index*/ |
372 | if (((u32)BIT(idx) & | 384 | if (((u32)BIT(idx) & |
373 | pgrp_set->hdr.data.super.obj_mask.super.data[0]) == 0) | 385 | pgrp_set->hdr.data.super.obj_mask.super.data[0]) == 0) { |
374 | return -EINVAL; | 386 | return -EINVAL; |
387 | } | ||
375 | 388 | ||
376 | *ppboardobjpmudata = (struct nv_pmu_boardobj *) | 389 | *ppboardobjpmudata = (struct nv_pmu_boardobj *) |
377 | &pgrp_set->objects[idx].data.board_obj; | 390 | &pgrp_set->objects[idx].data.board_obj; |
@@ -389,8 +402,9 @@ static u32 _volt_rail_devgrp_pmustatus_instget(struct gk20a *g, | |||
389 | 402 | ||
390 | /*check whether pmuboardobjgrp has a valid boardobj in index*/ | 403 | /*check whether pmuboardobjgrp has a valid boardobj in index*/ |
391 | if (((u32)BIT(idx) & | 404 | if (((u32)BIT(idx) & |
392 | pgrp_get_status->hdr.data.super.obj_mask.super.data[0]) == 0) | 405 | pgrp_get_status->hdr.data.super.obj_mask.super.data[0]) == 0) { |
393 | return -EINVAL; | 406 | return -EINVAL; |
407 | } | ||
394 | 408 | ||
395 | *ppboardobjpmustatus = (struct nv_pmu_boardobj_query *) | 409 | *ppboardobjpmustatus = (struct nv_pmu_boardobj_query *) |
396 | &pgrp_get_status->objects[idx].data.board_obj; | 410 | &pgrp_get_status->objects[idx].data.board_obj; |
@@ -426,8 +440,9 @@ u32 volt_rail_sw_setup(struct gk20a *g) | |||
426 | /* Obtain Voltage Rail Table from VBIOS */ | 440 | /* Obtain Voltage Rail Table from VBIOS */ |
427 | status = volt_get_volt_rail_table(g, &g->perf_pmu.volt. | 441 | status = volt_get_volt_rail_table(g, &g->perf_pmu.volt. |
428 | volt_rail_metadata); | 442 | volt_rail_metadata); |
429 | if (status) | 443 | if (status) { |
430 | goto done; | 444 | goto done; |
445 | } | ||
431 | 446 | ||
432 | /* Populate data for the VOLT_RAIL PMU interface */ | 447 | /* Populate data for the VOLT_RAIL PMU interface */ |
433 | BOARDOBJGRP_PMU_CONSTRUCT(pboardobjgrp, VOLT, VOLT_RAIL); | 448 | BOARDOBJGRP_PMU_CONSTRUCT(pboardobjgrp, VOLT, VOLT_RAIL); |