From patchwork Tue Nov 22 12:34:44 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Caesar Wang X-Patchwork-Id: 9440969 X-Patchwork-Delegate: eduardo.valentin@ti.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 4401F60237 for ; Tue, 22 Nov 2016 12:35:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 35E19284E6 for ; Tue, 22 Nov 2016 12:35:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2A63F28528; Tue, 22 Nov 2016 12:35:28 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B27C8284E6 for ; Tue, 22 Nov 2016 12:35:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932436AbcKVMfR (ORCPT ); Tue, 22 Nov 2016 07:35:17 -0500 Received: from mail-pg0-f67.google.com ([74.125.83.67]:35249 "EHLO mail-pg0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932127AbcKVMfQ (ORCPT ); Tue, 22 Nov 2016 07:35:16 -0500 Received: by mail-pg0-f67.google.com with SMTP id p66so2046363pga.2; Tue, 22 Nov 2016 04:35:15 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=QHIEWQX/ksySF+sDqIAXpxvsQ2xDvHkQObTH/pGp1F8=; b=ULL+BCJQgELZ2GIZxgCvGz1Sp56C0UriVEwxuhMwAlhLRUqVzDRI7AGRgVdOOcXmFA wuIH/oHBw57Rt2Vqso6iAetJ6HvP91EQ9/oo6RwyroJ1U9iLh42LQOiK/RfpOO4KtrWM THUalVZIJy5bTHZGLWwBUmjbpssXCvUKVj60wgvStKpdkBbd0fnL/+5NiR1UiR6WoH9B 8PfZVTq2Y7CAjDW0McYzt4gPWh72PzvnBOfGZxm1VLeXSm5qZiJiJgeoQPR2oFrqRC5P yc6O3SMABM2FMw6X4Ys7ig8CV88x4lIN/tDSjeDKSaAQ+8ZaDd/mr6RtnweHV1GE09nt yDVg== X-Gm-Message-State: AKaTC02Ck0e6nKVC9QJsYLTLsXPOqroAyp+0J3Gr9OXZ56Bn2G3jxFAQY9CkQUgq2jPqLw== X-Received: by 10.98.208.70 with SMTP id p67mr25839924pfg.15.1479818115389; Tue, 22 Nov 2016 04:35:15 -0800 (PST) Received: from localhost.localdomain ([103.29.142.67]) by smtp.gmail.com with ESMTPSA id m5sm27140335pgn.42.2016.11.22.04.35.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 22 Nov 2016 04:35:14 -0800 (PST) From: Caesar Wang To: edubezval@gmail.com, rui.zhang@intel.com Cc: linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, linux-rockchip@lists.infradead.org, briannorris@chromium.org, heiko@sntech.de, smbarber@chromium.org, Caesar Wang Subject: [PATCH 1/5] thermal: rockchip: improve conversion error messages Date: Tue, 22 Nov 2016 20:34:44 +0800 Message-Id: <1479818088-6007-2-git-send-email-wxt@rock-chips.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1479818088-6007-1-git-send-email-wxt@rock-chips.com> References: <1479818088-6007-1-git-send-email-wxt@rock-chips.com> Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Brian Norris These error messages don't give much information about what went wrong. It would be nice, for one, to see what invalid temperature was being requested when conversion fails. It's also good to return an error when we can't handle a conversion properly. While we're at it, fix the grammar too. Signed-off-by: Brian Norris Signed-off-by: Caesar Wang --- Changes: - The original Brian posted on https://patchwork.kernel.org/patch/9437685 Brain said: "Note: it'd probably be even nicer to know which sensor this was, but we've kinda abstracted that one away by this point..." drivers/thermal/rockchip_thermal.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/thermal/rockchip_thermal.c b/drivers/thermal/rockchip_thermal.c index b811b0f..26c247c 100644 --- a/drivers/thermal/rockchip_thermal.c +++ b/drivers/thermal/rockchip_thermal.c @@ -424,7 +424,8 @@ static u32 rk_tsadcv2_temp_to_code(struct chip_tsadc_table table, } exit: - pr_err("Invalid the conversion, error=%d\n", error); + pr_err("%s: invalid temperature, temp=%d error=%d\n", + __func__, temp, error); return error; } @@ -475,7 +476,9 @@ static int rk_tsadcv2_code_to_temp(struct chip_tsadc_table table, u32 code, } break; default: - pr_err("Invalid the conversion table\n"); + pr_err("%s: invalid conversion table, mode=%d\n", + __func__, table.mode); + return -EINVAL; } /*