From a9c4c5d88db75d5ba2327fe16d3be1654518ccaf Mon Sep 17 00:00:00 2001 From: Terje Bergstrom Date: Thu, 6 Apr 2017 12:47:54 -0700 Subject: gpu: nvgpu: volt: Use new error macros gk20a_err() and gk20a_warn() require a struct device pointer, which is not portable across operating systems. The new nvgpu_err() and nvgpu_warn() macros take struct gk20a pointer. Convert code to use the more portable macros. JIRA NVGPU-16 Change-Id: Iea4a2f81d3aa2ff409fbb4bf9db441401f3a41e5 Signed-off-by: Terje Bergstrom Reviewed-on: http://git-master/r/1457352 Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Alex Waterman Reviewed-by: svccoveritychecker GVS: Gerrit_Virtual_Submit --- drivers/gpu/nvgpu/volt/volt_dev.c | 36 ++++++++++++++++-------------------- drivers/gpu/nvgpu/volt/volt_pmu.c | 23 +++++++++++------------ drivers/gpu/nvgpu/volt/volt_policy.c | 12 ++++++------ drivers/gpu/nvgpu/volt/volt_rail.c | 14 +++++++------- 4 files changed, 40 insertions(+), 45 deletions(-) (limited to 'drivers/gpu/nvgpu/volt') diff --git a/drivers/gpu/nvgpu/volt/volt_dev.c b/drivers/gpu/nvgpu/volt/volt_dev.c index 12bad36c..8e229f4c 100644 --- a/drivers/gpu/nvgpu/volt/volt_dev.c +++ b/drivers/gpu/nvgpu/volt/volt_dev.c @@ -174,7 +174,7 @@ struct voltage_device *volt_volt_device_construct(struct gk20a *g, u32 status = construct_pwm_volt_device(g, &pboard_obj, sizeof(struct voltage_device_pwm), pargs); if (status) { - gk20a_err(dev_from_gk20a(g), + nvgpu_err(g, " Could not allocate memory for VOLTAGE_DEVICE type (%x).", BOARDOBJ_GET_TYPE(pargs)); pboard_obj = NULL; @@ -218,8 +218,7 @@ static u32 volt_get_voltage_device_table_1x_psv(struct gk20a *g, if (ptmp_dev->super.operation_type == CTRL_VOLT_DEVICE_OPERATION_TYPE_INVALID) { - gk20a_err(dev_from_gk20a(g), - " Invalid Voltage Device Operation Type."); + nvgpu_err(g, " Invalid Voltage Device Operation Type."); status = -EINVAL; goto done; @@ -248,8 +247,7 @@ static u32 volt_get_voltage_device_table_1x_psv(struct gk20a *g, volt_domain = volt_rail_vbios_volt_domain_convert_to_internal(g, (u8)p_bios_entry->volt_domain); if (volt_domain == CTRL_VOLT_DOMAIN_INVALID) { - gk20a_err(dev_from_gk20a(g), - "invalid voltage domain = %d", + nvgpu_err(g, "invalid voltage domain = %d", (u8)p_bios_entry->volt_domain); status = -EINVAL; goto done; @@ -283,8 +281,7 @@ static u32 volt_get_voltage_device_table_1x_psv(struct gk20a *g, pvolt_dev = volt_volt_device_construct(g, ptmp_dev); if (pvolt_dev == NULL) { - gk20a_err(dev_from_gk20a(g), - " Failure to construct VOLTAGE_DEVICE object."); + nvgpu_err(g, " Failure to construct VOLTAGE_DEVICE object."); status = -EINVAL; goto done; @@ -294,7 +291,7 @@ static u32 volt_get_voltage_device_table_1x_psv(struct gk20a *g, &p_Volt_Device_Meta_Data->volt_devices.super, (struct boardobj *)pvolt_dev, entry_Idx); if (status) { - gk20a_err(dev_from_gk20a(g), + nvgpu_err(g, "could not add VOLTAGE_DEVICE for entry %d into boardobjgrp ", entry_Idx); goto done; @@ -320,7 +317,7 @@ static u32 volt_get_voltage_device_table_1x_psv(struct gk20a *g, /* Check if there is room left in the voltage table. */ if (entry_cnt == VOLTAGE_TABLE_MAX_ENTRIES) { - gk20a_err(dev_from_gk20a(g), "Voltage table is full"); + nvgpu_err(g, "Voltage table is full"); status = -EINVAL; goto done; } @@ -329,7 +326,7 @@ static u32 volt_get_voltage_device_table_1x_psv(struct gk20a *g, volt_dev_construct_dev_entry_pwm(g, voltage_uv, &pwm_entry); if (pvolt_dev->pentry[entry_cnt] == NULL) { - gk20a_err(dev_from_gk20a(g), + nvgpu_err(g, " Error creating voltage_device_pwm_entry!"); status = -EINVAL; goto done; @@ -463,7 +460,7 @@ u32 volt_device_state_init(struct gk20a *g, struct voltage_device *pvolt_dev) rail_idx = volt_rail_volt_domain_convert_to_idx(g, pvolt_dev->volt_domain); if (rail_idx == CTRL_BOARDOBJ_IDX_INVALID) { - gk20a_err(dev_from_gk20a(g), + nvgpu_err(g, " could not convert voltage domain to rail index."); status = -EINVAL; goto done; @@ -471,7 +468,7 @@ u32 volt_device_state_init(struct gk20a *g, struct voltage_device *pvolt_dev) pRail = VOLT_GET_VOLT_RAIL(&g->perf_pmu.volt, rail_idx); if (pRail == NULL) { - gk20a_err(dev_from_gk20a(g), + nvgpu_err(g, "could not obtain ptr to rail object from rail index"); status = -EINVAL; goto done; @@ -480,7 +477,7 @@ u32 volt_device_state_init(struct gk20a *g, struct voltage_device *pvolt_dev) status = volt_rail_volt_dev_register(g, pRail, BOARDOBJ_GET_IDX(pvolt_dev), pvolt_dev->operation_type); if (status) { - gk20a_err(dev_from_gk20a(g), + nvgpu_err(g, "Failed to register the device with rail obj"); goto done; } @@ -488,8 +485,7 @@ u32 volt_device_state_init(struct gk20a *g, struct voltage_device *pvolt_dev) done: if (status) - gk20a_err(dev_from_gk20a(g), - "Error in building rail sw state device sw"); + nvgpu_err(g, "Error in building rail sw state device sw"); return status; } @@ -524,7 +520,7 @@ u32 volt_dev_sw_setup(struct gk20a *g) status = boardobjgrpconstruct_e32(&g->perf_pmu.volt.volt_dev_metadata. volt_devices); if (status) { - gk20a_err(dev_from_gk20a(g), + nvgpu_err(g, "error creating boardobjgrp for volt rail, status - 0x%x", status); goto done; @@ -547,7 +543,7 @@ u32 volt_dev_sw_setup(struct gk20a *g) status = BOARDOBJGRP_PMU_CMD_GRP_SET_CONSTRUCT(g, pboardobjgrp, volt, VOLT, volt_device, VOLT_DEVICE); if (status) { - gk20a_err(dev_from_gk20a(g), + nvgpu_err(g, "error constructing PMU_BOARDOBJ_CMD_GRP_SET interface - 0x%x", status); goto done; @@ -557,7 +553,7 @@ u32 volt_dev_sw_setup(struct gk20a *g) &g->perf_pmu.volt.volt_dev_metadata.volt_devices.super, volt, VOLT, volt_device, VOLT_DEVICE); if (status) { - gk20a_err(dev_from_gk20a(g), + nvgpu_err(g, "error constructing PMU_BOARDOBJ_CMD_GRP_SET interface - 0x%x", status); goto done; @@ -569,9 +565,9 @@ u32 volt_dev_sw_setup(struct gk20a *g) struct voltage_device *, pvolt_device, i) { status = volt_device_state_init(g, pvolt_device); if (status) { - gk20a_err(dev_from_gk20a(g), + nvgpu_err(g, "failure while executing devices's state init interface"); - gk20a_err(dev_from_gk20a(g), + nvgpu_err(g, " railIdx = %d, status = 0x%x", i, status); goto done; } diff --git a/drivers/gpu/nvgpu/volt/volt_pmu.c b/drivers/gpu/nvgpu/volt/volt_pmu.c index f8167000..dd2a0a63 100644 --- a/drivers/gpu/nvgpu/volt/volt_pmu.c +++ b/drivers/gpu/nvgpu/volt/volt_pmu.c @@ -38,7 +38,7 @@ static void volt_rpc_pmucmdhandler(struct gk20a *g, struct pmu_msg *msg, gk20a_dbg_info(""); if (msg->msg.volt.msg_type != NV_PMU_VOLT_MSG_ID_RPC) { - gk20a_err(dev_from_gk20a(g), "unsupported msg for VOLT RPC %x", + nvgpu_err(g, "unsupported msg for VOLT RPC %x", msg->msg.volt.msg_type); return; } @@ -82,7 +82,7 @@ static u32 volt_pmu_rpc_execute(struct gk20a *g, volt_rpc_pmucmdhandler, (void *)&handler, &seqdesc, ~0); if (status) { - gk20a_err(dev_from_gk20a(g), "unable to post volt RPC cmd %x", + nvgpu_err(g, "unable to post volt RPC cmd %x", cmd.cmd.volt.cmd_type); goto volt_pmu_rpc_execute; } @@ -93,7 +93,7 @@ static u32 volt_pmu_rpc_execute(struct gk20a *g, if (handler.success == 0) { status = -EINVAL; - gk20a_err(dev_from_gk20a(g), "rpc call to volt failed"); + nvgpu_err(g, "rpc call to volt failed"); } volt_pmu_rpc_execute: @@ -109,7 +109,7 @@ u32 volt_pmu_send_load_cmd_to_pmu(struct gk20a *g) status = volt_pmu_rpc_execute(g, &rpc_call); if (status) - gk20a_err(dev_from_gk20a(g), + nvgpu_err(g, "Error while executing LOAD RPC: status = 0x%08x.", status); @@ -126,7 +126,7 @@ static u32 volt_rail_get_voltage(struct gk20a *g, rail_idx = volt_rail_volt_domain_convert_to_idx(g, volt_domain); if ((rail_idx == CTRL_VOLT_RAIL_INDEX_INVALID) || (!VOLT_RAIL_INDEX_IS_VALID(&g->perf_pmu.volt, rail_idx))) { - gk20a_err(dev_from_gk20a(g), + nvgpu_err(g, "failed: volt_domain = %d, voltage rail table = %d.", volt_domain, rail_idx); return -EINVAL; @@ -139,7 +139,7 @@ static u32 volt_rail_get_voltage(struct gk20a *g, /* Execute the voltage get request via PMU RPC. */ status = volt_pmu_rpc_execute(g, &rpc_call); if (status) { - gk20a_err(dev_from_gk20a(g), + nvgpu_err(g, "Error while executing volt_rail_get_voltage rpc"); return status; } @@ -166,11 +166,10 @@ static u32 volt_policy_set_voltage(struct gk20a *g, u8 client_id, CTRL_VOLT_DOMAIN_INVALID) || (prail_list->rails[i].voltage_uv == NV_PMU_VOLT_VALUE_0V_IN_UV)) { - gk20a_err(dev_from_gk20a(g), "Invalid voltage domain or target "); - gk20a_err(dev_from_gk20a(g), " client_id = %d, listEntry = %d ", + nvgpu_err(g, "Invalid voltage domain or target"); + nvgpu_err(g, " client_id = %d, listEntry = %d", client_id, i); - gk20a_err(dev_from_gk20a(g), - "volt_domain = %d, voltage_uv = %d uV.", + nvgpu_err(g, " volt_domain = %d, voltage_uv = %d uV.", prail_list->rails[i].volt_domain, prail_list->rails[i].voltage_uv); status = -EINVAL; @@ -196,7 +195,7 @@ static u32 volt_policy_set_voltage(struct gk20a *g, u8 client_id, /* Execute the voltage change request via PMU RPC. */ status = volt_pmu_rpc_execute(g, &rpc_call); if (status) - gk20a_err(dev_from_gk20a(g), + nvgpu_err(g, "Error while executing VOLT_POLICY_SET_VOLTAGE RPC"); exit: @@ -244,7 +243,7 @@ static int volt_policy_set_noiseaware_vmin(struct gk20a *g, /* Execute the voltage change request via PMU RPC. */ status = volt_pmu_rpc_execute(g, &rpc_call); if (status) { - gk20a_err(dev_from_gk20a(g), + nvgpu_err(g, "Error while executing VOLT_POLICY_SET_VOLTAGE RPC"); return -EINVAL; } diff --git a/drivers/gpu/nvgpu/volt/volt_policy.c b/drivers/gpu/nvgpu/volt/volt_policy.c index 239b908e..d9d4d9da 100644 --- a/drivers/gpu/nvgpu/volt/volt_policy.c +++ b/drivers/gpu/nvgpu/volt/volt_policy.c @@ -127,7 +127,7 @@ struct voltage_policy *volt_volt_policy_construct(struct gk20a *g, void *pargs) sizeof(struct voltage_policy_split_rail_single_step), pargs); if (status) { - gk20a_err(dev_from_gk20a(g), + nvgpu_err(g, "Could not allocate memory for voltage_policy"); pboard_obj = NULL; } @@ -219,7 +219,7 @@ static u32 volt_get_volt_policy_table(struct gk20a *g, ppolicy = volt_volt_policy_construct(g, (void *)&policy_type_data); if (ppolicy == NULL) { - gk20a_err(dev_from_gk20a(g), + nvgpu_err(g, "Failure to construct VOLT_POLICY object."); status = -EINVAL; goto done; @@ -229,7 +229,7 @@ static u32 volt_get_volt_policy_table(struct gk20a *g, &pvolt_policy_metadata->volt_policies.super, (struct boardobj *)ppolicy, i); if (status) { - gk20a_err(dev_from_gk20a(g), + nvgpu_err(g, "could not add volt_policy for entry %d into boardobjgrp ", i); goto done; @@ -307,7 +307,7 @@ u32 volt_policy_sw_setup(struct gk20a *g) status = boardobjgrpconstruct_e32( &g->perf_pmu.volt.volt_policy_metadata.volt_policies); if (status) { - gk20a_err(dev_from_gk20a(g), + nvgpu_err(g, "error creating boardobjgrp for volt rail, status - 0x%x", status); goto done; @@ -331,7 +331,7 @@ u32 volt_policy_sw_setup(struct gk20a *g) status = BOARDOBJGRP_PMU_CMD_GRP_SET_CONSTRUCT(g, pboardobjgrp, volt, VOLT, volt_policy, VOLT_POLICY); if (status) { - gk20a_err(dev_from_gk20a(g), + nvgpu_err(g, "error constructing PMU_BOARDOBJ_CMD_GRP_SET interface - 0x%x", status); goto done; @@ -341,7 +341,7 @@ u32 volt_policy_sw_setup(struct gk20a *g) &g->perf_pmu.volt.volt_policy_metadata.volt_policies.super, volt, VOLT, volt_policy, VOLT_POLICY); if (status) { - gk20a_err(dev_from_gk20a(g), + nvgpu_err(g, "error constructing PMU_BOARDOBJ_CMD_GRP_SET interface - 0x%x", status); goto done; diff --git a/drivers/gpu/nvgpu/volt/volt_rail.c b/drivers/gpu/nvgpu/volt/volt_rail.c index aaad86a5..778c531e 100644 --- a/drivers/gpu/nvgpu/volt/volt_rail.c +++ b/drivers/gpu/nvgpu/volt/volt_rail.c @@ -64,7 +64,7 @@ u32 volt_rail_volt_dev_register(struct gk20a *g, struct voltage_rail exit: if (status) - gk20a_err(dev_from_gk20a(g), "Failed to register VOLTAGE_DEVICE"); + nvgpu_err(g, "Failed to register VOLTAGE_DEVICE"); return status; } @@ -94,7 +94,7 @@ static u32 volt_rail_state_init(struct gk20a *g, status = boardobjgrpmask_e32_init(&pvolt_rail->volt_dev_mask, NULL); if (status) { - gk20a_err(dev_from_gk20a(g), + nvgpu_err(g, "Failed to initialize BOARDOBJGRPMASK of VOLTAGE_DEVICEs"); } @@ -138,7 +138,7 @@ static u32 volt_rail_init_pmudata_super(struct gk20a *g, prail->volt_dev_mask.super.bitcount, &rail_pmu_data->volt_dev_mask.super); if (status) - gk20a_err(dev_from_gk20a(g), + nvgpu_err(g, "Failed to export BOARDOBJGRPMASK of VOLTAGE_DEVICEs"); gk20a_dbg_info("Done"); @@ -370,7 +370,7 @@ u32 volt_rail_sw_setup(struct gk20a *g) status = boardobjgrpconstruct_e32(&g->perf_pmu.volt.volt_rail_metadata. volt_rails); if (status) { - gk20a_err(dev_from_gk20a(g), + nvgpu_err(g, "error creating boardobjgrp for volt rail, status - 0x%x", status); goto done; @@ -396,7 +396,7 @@ u32 volt_rail_sw_setup(struct gk20a *g) status = BOARDOBJGRP_PMU_CMD_GRP_SET_CONSTRUCT(g, pboardobjgrp, volt, VOLT, volt_rail, VOLT_RAIL); if (status) { - gk20a_err(dev_from_gk20a(g), + nvgpu_err(g, "error constructing PMU_BOARDOBJ_CMD_GRP_SET interface - 0x%x", status); goto done; @@ -406,7 +406,7 @@ u32 volt_rail_sw_setup(struct gk20a *g) &g->perf_pmu.volt.volt_rail_metadata.volt_rails.super, volt, VOLT, volt_rail, VOLT_RAIL); if (status) { - gk20a_err(dev_from_gk20a(g), + nvgpu_err(g, "error constructing PMU_BOARDOBJ_CMD_GRP_SET interface - 0x%x", status); goto done; @@ -418,7 +418,7 @@ u32 volt_rail_sw_setup(struct gk20a *g) struct voltage_rail *, pvolt_rail, i) { status = volt_rail_state_init(g, pvolt_rail); if (status) { - gk20a_err(dev_from_gk20a(g), + nvgpu_err(g, "Failure while executing RAIL's state init railIdx = %d", i); goto done; -- cgit v1.2.2