From patchwork Mon Sep 24 13:28:03 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: rajagopal.venkat@linaro.org X-Patchwork-Id: 11668 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 4409223EFB for ; Mon, 24 Sep 2012 13:31:29 +0000 (UTC) Received: from mail-ie0-f180.google.com (mail-ie0-f180.google.com [209.85.223.180]) by fiordland.canonical.com (Postfix) with ESMTP id 41842A18E9B for ; Mon, 24 Sep 2012 13:31:28 +0000 (UTC) Received: by ieje10 with SMTP id e10so9896664iej.11 for ; Mon, 24 Sep 2012 06:31:27 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf:from:to:cc :subject:date:message-id:x-mailer:x-gm-message-state; bh=Nn9oWbKjxiMUTiksT+XLepAjl0wnSGqMv3/P/YGvHao=; b=WwaO+QAvphBsPZ9b+JdHrozbe/HEVJE9+Z+Qf0Nn7ni7/7mHHoQ/kwm/eQipcO7A7h 2uCoJGIyZ1woqONVdEzaK/l+vCHHdQ/b9MZ18dcWxss+HQOrP1eqwJR6skczXvvqcxH+ 1P+P1HNtcg/2Sy0FIAkpKlBh2bhcl3slcXjy4jLfkYTBVg0wzClUITZYYwi633mNOZ3T 8m5azYfyEfI2+V4nokxMj6glLMG6TfPpiW8Dg22lxnKyN8AGjDmAhDvMSsB1zkLaJhu5 oclm5MzsU1lZXxbMQ55vnnh5pAneU5ZujFBztP6ODJMmPnx69+qPgYA4OrU+Pnti9n7i lTNA== Received: by 10.50.154.227 with SMTP id vr3mr5187296igb.43.1348493487652; Mon, 24 Sep 2012 06:31:27 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.50.184.232 with SMTP id ex8csp243479igc; Mon, 24 Sep 2012 06:31:26 -0700 (PDT) Received: by 10.68.224.138 with SMTP id rc10mr36832230pbc.34.1348493486261; Mon, 24 Sep 2012 06:31:26 -0700 (PDT) Received: from mail-pb0-f50.google.com (mail-pb0-f50.google.com [209.85.160.50]) by mx.google.com with ESMTPS id iv6si19593798pbc.118.2012.09.24.06.31.25 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 24 Sep 2012 06:31:26 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.160.50 is neither permitted nor denied by best guess record for domain of rajagopal.venkat@linaro.org) client-ip=209.85.160.50; Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.160.50 is neither permitted nor denied by best guess record for domain of rajagopal.venkat@linaro.org) smtp.mail=rajagopal.venkat@linaro.org Received: by pbcmd12 with SMTP id md12so13214747pbc.37 for ; Mon, 24 Sep 2012 06:31:25 -0700 (PDT) Received: by 10.68.234.71 with SMTP id uc7mr25907142pbc.72.1348493485500; Mon, 24 Sep 2012 06:31:25 -0700 (PDT) Received: from localhost.localdomain ([115.242.131.216]) by mx.google.com with ESMTPS id i1sm8768345pay.26.2012.09.24.06.31.18 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 24 Sep 2012 06:31:24 -0700 (PDT) From: Rajagopal Venkat To: powertop@lists.01.org Cc: patches@linaro.org, linaro-dev@lists.linaro.org, Rajagopal Venkat Subject: [Powertop][PATCH v2 1/2] Updates to support Android platform Date: Mon, 24 Sep 2012 18:58:03 +0530 Message-Id: <1348493284-9375-1-git-send-email-rajagopal.venkat@linaro.org> X-Mailer: git-send-email 1.7.11.3 X-Gm-Message-State: ALoCoQmzekBNWjuE5BgW0DBnyV0nQZNv2h9o7CehEDNpi0ywjk21Vvz/4DvvbuYShtqqVv1kNfrl This patch adds following minor changes to prepare powertop to support Android platform. - Add missing HAVE_CONFIG_H conditional check. - remove un-used ethtool_cmd_speed_set and ethtool_cmd_speed functions. - Minimize dependency on exception handling in catch blocks. These changes will not affect powertop functionality. Signed-off-by: Rajagopal Venkat --- src/devices/ahci.cpp | 4 ++-- src/devices/alsa.cpp | 4 ++-- src/devices/network.cpp | 16 ---------------- src/main.cpp | 2 ++ 4 files changed, 6 insertions(+), 20 deletions(-) diff --git a/src/devices/ahci.cpp b/src/devices/ahci.cpp index 1fe39c7..67ce06e 100644 --- a/src/devices/ahci.cpp +++ b/src/devices/ahci.cpp @@ -170,7 +170,7 @@ void ahci::start_measurement(void) file.close(); } catch (std::ios_base::failure &c) { - fprintf(stderr, "%s\n", c.what()); + fprintf(stderr, "Failed to start measurement for ahci device\n"); } } @@ -203,7 +203,7 @@ void ahci::end_measurement(void) file.close(); } catch (std::ios_base::failure &c) { - fprintf(stderr, "%s\n", c.what()); + fprintf(stderr, "Failed to end measurement for ahci device\n"); } if (end_active < start_active) end_active = start_active; diff --git a/src/devices/alsa.cpp b/src/devices/alsa.cpp index 4f5d3f9..a67780c 100644 --- a/src/devices/alsa.cpp +++ b/src/devices/alsa.cpp @@ -104,7 +104,7 @@ void alsa::start_measurement(void) file.close(); } catch (std::ios_base::failure &c) { - fprintf(stderr, "%s\n", c.what()); + fprintf(stderr, "Failed to start measurement for alsa device\n"); } } @@ -130,7 +130,7 @@ void alsa::end_measurement(void) file.close(); } catch (std::ios_base::failure &c) { - fprintf(stderr, "%s\n", c.what()); + fprintf(stderr, "Failed to end measurement for alsa device\n"); } p = (end_active - start_active) / (0.001 + end_active + end_inactive - start_active - start_inactive) * 100.0; diff --git a/src/devices/network.cpp b/src/devices/network.cpp index b8a5c9c..ed9d7aa 100644 --- a/src/devices/network.cpp +++ b/src/devices/network.cpp @@ -55,22 +55,6 @@ extern "C" { static map nics; -#ifdef DISABLE_TRYCATCH - -static inline void ethtool_cmd_speed_set(struct ethtool_cmd *ep, - __u32 speed) -{ - - ep->speed = (__u16)speed; - ep->speed_hi = (__u16)(speed >> 16); -} - -static inline __u32 ethtool_cmd_speed(struct ethtool_cmd *ep) -{ - return (ep->speed_hi << 16) | ep->speed; -} - -#endif static void do_proc_net_dev(void) { diff --git a/src/main.cpp b/src/main.cpp index 1815075..dc49dba 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -42,7 +42,9 @@ #include "perf/perf.h" #include "perf/perf_bundle.h" #include "lib.h" +#ifdef HAVE_CONFIG_H #include "../config.h" +#endif #include "devices/device.h"