From patchwork Mon Nov 28 11:12:00 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Caesar Wang X-Patchwork-Id: 9449321 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 AE56F6071C for ; Mon, 28 Nov 2016 11:13:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9E2A320410 for ; Mon, 28 Nov 2016 11:13:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9285326A99; Mon, 28 Nov 2016 11:13:32 +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 3CCD920410 for ; Mon, 28 Nov 2016 11:13:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932701AbcK1LMi (ORCPT ); Mon, 28 Nov 2016 06:12:38 -0500 Received: from mail-pf0-f193.google.com ([209.85.192.193]:33225 "EHLO mail-pf0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932622AbcK1LMg (ORCPT ); Mon, 28 Nov 2016 06:12:36 -0500 Received: by mail-pf0-f193.google.com with SMTP id 144so6348507pfv.0; Mon, 28 Nov 2016 03:12:36 -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=KXb6paAevmzxIF/M/ZnMg2oxkopiGhdPLw1HNuJWtt8=; b=E7Gh4inLKYg1tnBo6mPFfs7PlWNrL9H1pwZXahdd1NBiAtKw92bAt67kBXzXCCmUNQ ehXcMcR38GX3WkDKbWEJQMcrtREiYc/BW3zRw5GmDHMT+Ny5QaL46AtMXFtD5ZHtBHvK JUBVg/mNq5GDNiXDbwrHY2C0+sxzCDtnu3oOOhsw9K8GaUotdjQObgMsrNhBfPRkFqgW S6a5k1XrAVTzjXjcMAzMxqghOqB8/qY1GYhHsawlZSP/RG2ZRkmTRzsYopfX/865RphD eC9VDJYmnzNpIAnCvDSKmGaUTDZdSwa3hU44e5u76BF7E8b/G16a6qK5uFDNlE/dkcqT pWMg== X-Gm-Message-State: AKaTC001A4zc/UTFXQdcZCHnDfpLPPjax9fQAZlihXm7CrshPUxwK/Zf6pIl1jb/rYTnnQ== X-Received: by 10.84.218.14 with SMTP id q14mr47755999pli.53.1480331554846; Mon, 28 Nov 2016 03:12:34 -0800 (PST) Received: from localhost.localdomain ([103.29.142.67]) by smtp.gmail.com with ESMTPSA id y20sm86586905pfj.26.2016.11.28.03.12.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 28 Nov 2016 03:12:34 -0800 (PST) From: Caesar Wang To: rui.zhang@intel.com, edubezval@gmail.com Cc: heiko@sntech.de, smbarber@chromium.org, briannorris@chromium.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, linux-rockchip@lists.infradead.org, Caesar Wang Subject: [PATCH v3 1/5] thermal: rockchip: improve conversion error messages Date: Mon, 28 Nov 2016 19:12:00 +0800 Message-Id: <1480331524-18741-2-git-send-email-wxt@rock-chips.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1480331524-18741-1-git-send-email-wxt@rock-chips.com> References: <1480331524-18741-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 in v3: None Changes in v2: None Changes in v1: - The original Brian posted on https://patchwork.kernel.org/patch/9437686 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; } /*