From patchwork Wed Nov 23 14:29:30 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Caesar Wang X-Patchwork-Id: 9443509 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 7F2B7600BA for ; Wed, 23 Nov 2016 14:31:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7098026C9B for ; Wed, 23 Nov 2016 14:31:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 650CD26D05; Wed, 23 Nov 2016 14:31:08 +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 E6AD926C9B for ; Wed, 23 Nov 2016 14:31:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S938652AbcKWOaQ (ORCPT ); Wed, 23 Nov 2016 09:30:16 -0500 Received: from mail-pg0-f68.google.com ([74.125.83.68]:35985 "EHLO mail-pg0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S964906AbcKWO3s (ORCPT ); Wed, 23 Nov 2016 09:29:48 -0500 Received: by mail-pg0-f68.google.com with SMTP id x23so1218263pgx.3; Wed, 23 Nov 2016 06:29:48 -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=tMwXZEAss56feslfHZPG1LYPHhkKyCkXEAgB88+PoKU=; b=fPXP3fj4UW4iqCmiql8T4+avvQXYCnkerH07pB6WrATQp2Ym3dgv1QcARC0Mpr7AFT /D4ID3fBK8ndNbDfRNCdkZe3cccABWlMkKOWLe+aVwuBRhjQmpw4PxO3pB12TGY6LIA5 AbDjjCOOVZDCyg1/USfysaBd8ZYK8ARlVaEtruW2jtrcVHZvuOv9Wi8cbALIn8WqWQqZ 3ErTo/QstGRxHbC8DkAYyuwAwONQDJtBC92LkZj91lqC1a+CtNfEjiwIY2qIrIXrKl5F nZ8V+KI9nWmsoZiDhnAEKi4KcXH6MdPy8plU64bgkdAa+5ZODggykFLUM89vg+KFD+Qw VA+Q== X-Gm-Message-State: AKaTC01GFzT9DV6DIU3pQ8YBQXkUycAx7QPCbR/+L96Gl02UK2G50kXF/0LkIvQUbP3Pmg== X-Received: by 10.98.84.68 with SMTP id i65mr3075782pfb.133.1479911387684; Wed, 23 Nov 2016 06:29:47 -0800 (PST) Received: from localhost.localdomain ([103.29.142.67]) by smtp.gmail.com with ESMTPSA id y29sm53385351pfd.63.2016.11.23.06.29.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 23 Nov 2016 06:29:46 -0800 (PST) From: Caesar Wang To: edubezval@gmail.com, rui.zhang@intel.com Cc: linux-rockchip@lists.infradead.org, linux-pm@vger.kernel.org, briannorris@chromium.org, linux-kernel@vger.kernel.org, smbarber@chromium.org, Caesar Wang Subject: [PATCH v2 1/5] thermal: rockchip: improve conversion error messages Date: Wed, 23 Nov 2016 22:29:30 +0800 Message-Id: <1479911374-22006-2-git-send-email-wxt@rock-chips.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1479911374-22006-1-git-send-email-wxt@rock-chips.com> References: <1479911374-22006-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 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; } /*