gpu: pvr: more accurate error reporting when clk_set_rate fails
authorImre Deak <imre.deak@nokia.com>
Wed, 28 Apr 2010 12:02:19 +0000 (15:02 +0300)
committerGrazvydas Ignotas <notasas@gmail.com>
Sun, 20 May 2012 18:09:41 +0000 (21:09 +0300)
We reported a rounded-down MHz value when clk_set_rate failed,
but this didn't make the reason clear when the Hz value didn't
match exactly any supported rate. So report Hz values instead.

Signed-off-by: Imre Deak <imre.deak@nokia.com>
pvr/sysutils.c

index 0f803d0..3f51465 100644 (file)
@@ -483,11 +483,11 @@ static enum PVRSRV_ERROR InitSgxClocks(struct SYS_DATA *psSysData)
        rate = clk_round_rate(psSysSpecData->psSGX_FCK, sgx_get_max_freq() + 1);
        r = clk_set_rate(psSysSpecData->psSGX_FCK, rate);
        if (r < 0) {
-               rate = clk_get_rate(psSysSpecData->psSGX_FCK);
-               rate /= 1000000;
-               pr_warning("error %d when setting SGX fclk to %luMHz, "
-                          "falling back to %luMHz\n",
-                          r, sgx_get_max_freq() / 1000000, rate);
+               unsigned long current_rate;
+
+               current_rate = clk_get_rate(psSysSpecData->psSGX_FCK);
+               pr_warning("error %d when setting SGX fclk to %lu Hz, "
+                          "falling back to %lu Hz\n", r, rate, current_rate);
        } else {
                pr_info("SGX clock rate %lu MHz\n", rate / 1000000);
        };