From patchwork Tue Aug 20 12:50:19 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: sunshaojie X-Patchwork-Id: 19354 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-gh0-f199.google.com (mail-gh0-f199.google.com [209.85.160.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 400D02468F for ; Tue, 20 Aug 2013 12:50:39 +0000 (UTC) Received: by mail-gh0-f199.google.com with SMTP id g14sf353421ghb.2 for ; Tue, 20 Aug 2013 05:50:38 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:x-gm-message-state:delivered-to:from:to:cc:subject :date:message-id:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=qxviXq8yVc67khJYsqwLUs81iuJGaqohAJR0QeB4m7c=; b=k4CVW8+dIsinwi3idXETYtUnVYQcwu6B8+uOIF2yb1ZT76wF7F5x68ZzePcpJ7rCLP v0IGaO2dBaxIfdf60rIr6Fkon62YuEYtvdwpbvUE7vVyUXZDShJueDFSwa6yLkAWvjps CvG5YwjZk5EDAm7q9q+Medo5PZ6gSJbL9umDTlJnIMn+UkhAkdfPi+3wsyatSH1EhSFg WCFzkhMqcksmagAfEmvFb2fbBGeGCveg2mPLbKPv+2sM17leQMLTthF5qAvpdlA2wQE7 EKuLGIV7IUQ05OlnWyFceTNrjyG5Se/e0jb//7j3n8L6BCtnWu1CxSW1pet+PeEIk+a+ 3KpQ== X-Received: by 10.236.13.36 with SMTP id a24mr498974yha.50.1377003038522; Tue, 20 Aug 2013 05:50:38 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.76.33 with SMTP id h1ls217417qew.29.gmail; Tue, 20 Aug 2013 05:50:38 -0700 (PDT) X-Received: by 10.58.196.132 with SMTP id im4mr192256vec.28.1377003038362; Tue, 20 Aug 2013 05:50:38 -0700 (PDT) Received: from mail-vb0-f46.google.com (mail-vb0-f46.google.com [209.85.212.46]) by mx.google.com with ESMTPS id vf5si317533vdc.31.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 20 Aug 2013 05:50:38 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.212.46 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.212.46; Received: by mail-vb0-f46.google.com with SMTP id p13so206763vbe.19 for ; Tue, 20 Aug 2013 05:50:38 -0700 (PDT) X-Gm-Message-State: ALoCoQkefaw4kdiYwZ1tVhuCeeBIgkLN6aAS8w40K528SiGR3GD+8rk2qPDQ1UejXjrIDSJBhQpU X-Received: by 10.220.11.7 with SMTP id r7mr1117855vcr.12.1377003038284; Tue, 20 Aug 2013 05:50:38 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.174.196 with SMTP id u4csp154361vcz; Tue, 20 Aug 2013 05:50:37 -0700 (PDT) X-Received: by 10.68.234.102 with SMTP id ud6mr1745358pbc.50.1377003037297; Tue, 20 Aug 2013 05:50:37 -0700 (PDT) Received: from mail-pd0-f172.google.com (mail-pd0-f172.google.com [209.85.192.172]) by mx.google.com with ESMTPS id yd4si1398854pbc.116.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 20 Aug 2013 05:50:37 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.192.172 is neither permitted nor denied by best guess record for domain of shaojie.sun@linaro.org) client-ip=209.85.192.172; Received: by mail-pd0-f172.google.com with SMTP id z10so340300pdj.3 for ; Tue, 20 Aug 2013 05:50:36 -0700 (PDT) X-Received: by 10.68.52.200 with SMTP id v8mr1757364pbo.48.1377003036760; Tue, 20 Aug 2013 05:50:36 -0700 (PDT) Received: from localhost.localdomain ([58.251.159.202]) by mx.google.com with ESMTPSA id mr3sm2009659pbb.27.1969.12.31.16.00.00 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 20 Aug 2013 05:50:36 -0700 (PDT) From: Shaojie Sun To: sanjay.rawat@linaro.org Cc: patches@linaro.org, private-pmwg@linaro.org, sunshaojie@huawei.com, Shaojie Sun Subject: [PATCH POWERDEBUG] Pressing "R" to refresh does not update regulator and sensor values Date: Tue, 20 Aug 2013 20:50:19 +0800 Message-Id: <1377003019-13435-1-git-send-email-shaojie.sun@linaro.com> X-Mailer: git-send-email 1.7.9.5 X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: shaojie.sun@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.212.46 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Fix this bug, and read regulator and sensor datas again when "R" key pressed. Signed-off-by: Shaojie Sun --- regulator.c | 43 ++++++++++++++++++++++++++++--------------- sensor.c | 17 +++++++++++++++-- 2 files changed, 43 insertions(+), 17 deletions(-) diff --git a/regulator.c b/regulator.c index 68c686f..9cd89fd 100644 --- a/regulator.c +++ b/regulator.c @@ -160,21 +160,6 @@ static int regulator_print_header(void) } -static int regulator_display(bool refresh) -{ - int ret, line = 0; - - display_reset_cursor(REGULATOR); - - regulator_print_header(); - - ret = tree_for_each(reg_tree, regulator_display_cb, &line); - - display_refresh_pad(REGULATOR); - - return ret; -} - static int regulator_filter_cb(const char *name) { /* let's ignore some directories in order to avoid to be @@ -213,6 +198,34 @@ static inline int read_regulator_cb(struct tree *t, void *data) return 0; } +static int read_regulator_info(struct tree *tree) +{ + return tree_for_each(tree, read_regulator_cb, NULL); +} + +static int regulator_print_info(struct tree *tree) +{ + int ret, line = 0; + + display_reset_cursor(REGULATOR); + + regulator_print_header(); + + ret = tree_for_each(tree, regulator_display_cb, &line); + + display_refresh_pad(REGULATOR); + + return ret; +} + +static int regulator_display(bool refresh) +{ + if (refresh && read_regulator_info(reg_tree)) + return -1; + + return regulator_print_info(reg_tree); +} + static int fill_regulator_cb(struct tree *t, void *data) { struct regulator_info *reg; diff --git a/sensor.c b/sensor.c index bd8c354..0645d25 100644 --- a/sensor.c +++ b/sensor.c @@ -161,6 +161,11 @@ static int read_sensor_cb(struct tree *tree, void *data) return 0; } +static int read_sensor_info(struct tree *tree) +{ + return tree_for_each(tree, read_sensor_cb, NULL); +} + static int fill_sensor_cb(struct tree *t, void *data) { struct sensor_info *sensor; @@ -250,7 +255,7 @@ static int sensor_print_header(void) return ret; } -static int sensor_display(bool refresh) +static int sensor_print_info(struct tree *tree) { int ret, line = 0; @@ -258,13 +263,21 @@ static int sensor_display(bool refresh) sensor_print_header(); - ret = tree_for_each(sensor_tree, sensor_display_cb, &line); + ret = tree_for_each(tree, sensor_display_cb, &line); display_refresh_pad(SENSOR); return ret; } +static int sensor_display(bool refresh) +{ + if (refresh && read_sensor_info(sensor_tree)) + return -1; + + return sensor_print_info(sensor_tree); +} + static struct display_ops sensor_ops = { .display = sensor_display, };