From patchwork Mon Dec 12 11:05:31 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Caesar Wang X-Patchwork-Id: 9470413 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 2E91960573 for ; Mon, 12 Dec 2016 11:06:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1F6E62845A for ; Mon, 12 Dec 2016 11:06:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 142BE28472; Mon, 12 Dec 2016 11:06:25 +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=-3.7 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RCVD_IN_SORBS_SPAM autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 9C2BB2845A for ; Mon, 12 Dec 2016 11:06:24 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1cGOR6-00077B-6x; Mon, 12 Dec 2016 11:06:24 +0000 Received: from mail-pf0-f193.google.com ([209.85.192.193]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1cGOR1-0006zU-VZ for linux-rockchip@lists.infradead.org; Mon, 12 Dec 2016 11:06:21 +0000 Received: by mail-pf0-f193.google.com with SMTP id 144so4274778pfv.0 for ; Mon, 12 Dec 2016 03:05:59 -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=ezutMjq6u7Xtm2UNpEHFz1+aXDTmYPrGtxB3xQp9zss=; b=gzGOiTyH6j29xQO4MJLkU0fk5NNWpm01VqD5qQ9PSOxSk6gnwjttzGjcY9kcWTuq7n 79Ovu3dSmbvK2fkaqK2wm8+j+tUDeVuASqbK3dU2TmMbc2ub3nZutke7k5/EINeWBeou rXJ+pxhnY9er8fEa8KXzHSsFTEKB4k9exKuO4tuApoKjlaADGLYrTr6E0Kx8vzcGxk3a IlRLgaKrd5X0j/0CKJdPrwFDWbWaYNo0384hgGrV/acuzg9g8EekMDsFiIwsk74xu4Bl 4khTMFcGFIwK5Fm68CBz+7V1lESPUagfPdSRqNzZmndcj3Z4WuGvS342Evfave6pJPX8 GKNQ== X-Gm-Message-State: AKaTC02hffn6HSTvEprfGA6IQAYjxOIeySXyJQktIw22S7hvHmT/v49yZlBzM5SVFJc7JQ== X-Received: by 10.99.229.17 with SMTP id r17mr166730749pgh.149.1481540759038; Mon, 12 Dec 2016 03:05:59 -0800 (PST) Received: from localhost.localdomain ([47.89.33.70]) by smtp.gmail.com with ESMTPSA id i124sm76047411pgd.15.2016.12.12.03.05.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 12 Dec 2016 03:05:58 -0800 (PST) From: Caesar Wang To: edubezval@gmail.com, rui.zhang@intel.com Subject: [PATCH v4 1/5] thermal: rockchip: improve conversion error messages Date: Mon, 12 Dec 2016 19:05:31 +0800 Message-Id: <1481540735-12710-2-git-send-email-wxt@rock-chips.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1481540735-12710-1-git-send-email-wxt@rock-chips.com> References: <1481540735-12710-1-git-send-email-wxt@rock-chips.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20161212_030620_104583_8FF225E6 X-CRM114-Status: UNSURE ( 9.42 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-pm@vger.kernel.org, briannorris@chromium.org, linux-kernel@vger.kernel.org, smbarber@chromium.org, linux-rockchip@lists.infradead.org, Caesar Wang MIME-Version: 1.0 Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.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 v4: - As Eduardo and Brian commnets on https://patchwork.kernel.org/patch/9449301 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 | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/thermal/rockchip_thermal.c b/drivers/thermal/rockchip_thermal.c index b811b0f..3bbc97c 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,8 @@ 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: unknown table mode: %d\n", __func__, table.mode); + return -EINVAL; } /*