From patchwork Thu Jan 15 17:27:50 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: tim.gore@intel.com X-Patchwork-Id: 5641791 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id AD7EA9F357 for ; Thu, 15 Jan 2015 17:28:07 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id AE99F20125 for ; Thu, 15 Jan 2015 17:28:06 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id AC47F200FE for ; Thu, 15 Jan 2015 17:28:05 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E357272097; Thu, 15 Jan 2015 09:28:04 -0800 (PST) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by gabe.freedesktop.org (Postfix) with ESMTP id 69C9E72097 for ; Thu, 15 Jan 2015 09:28:03 -0800 (PST) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga103.jf.intel.com with ESMTP; 15 Jan 2015 09:24:10 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.09,404,1418112000"; d="scan'208";a="670528380" Received: from tgore-linux.isw.intel.com ([10.102.226.50]) by orsmga002.jf.intel.com with ESMTP; 15 Jan 2015 09:27:51 -0800 From: tim.gore@intel.com To: intel-gfx@lists.freedesktop.org Date: Thu, 15 Jan 2015 17:27:50 +0000 Message-Id: <1421342870-23275-1-git-send-email-tim.gore@intel.com> X-Mailer: git-send-email 2.2.1 Cc: ben@bwidawsk.net Subject: [Intel-gfx] [PATCH i-g-t] tools/intel_gpu_frequency: remove use of getsubopt X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Tim Gore getsubopt is not available in android. The "get" option doesn't really need sub-options, just display all the current frequency settings (as per discussion with Ben Widawsky) Signed-off-by: Tim Gore Reviewed-by: Ben Widawsky --- man/intel_gpu_frequency.man | 6 +++--- tools/intel_gpu_frequency.c | 27 ++++----------------------- 2 files changed, 7 insertions(+), 26 deletions(-) diff --git a/man/intel_gpu_frequency.man b/man/intel_gpu_frequency.man index 60e4e0c..7144848 100644 --- a/man/intel_gpu_frequency.man +++ b/man/intel_gpu_frequency.man @@ -3,7 +3,7 @@ intel_gpu_frequency: \- manual page for intel_gpu_frequency .SH SYNOPSIS .B intel_gpu_frequency -[\fI\,-e\/\fR] [\fI\,--min | --max\/\fR] [\fI\,-g (min|max|efficient)\/\fR] [\fI\,-s frequency_mhz\/\fR] +[\fI\,-e\/\fR] [\fI\,--min | --max\/\fR] [\fI\,-g\/\fR] [\fI\,-s frequency_mhz\/\fR] .SH DESCRIPTION \&A program to manipulate Intel GPU frequencies. Intel GPUs will automatically throttle the frequencies based on system demands, up when @@ -19,8 +19,8 @@ safe bet. \fB\-e\fR Lock frequency to the most efficient frequency .TP -\fB\-g\fR, \fB\-\-get=\fR -Get the frequency comma separated list of ("cur"|"min"|"max"|"eff") +\fB\-g\fR, \fB\-\-get\fR +Get all the current frequency settings .TP \fB\-s\fR, \fB\-\-set\fR Lock frequency to an absolute value (MHz) diff --git a/tools/intel_gpu_frequency.c b/tools/intel_gpu_frequency.c index aedceb4..7f85421 100644 --- a/tools/intel_gpu_frequency.c +++ b/tools/intel_gpu_frequency.c @@ -152,7 +152,7 @@ usage(const char *prog) printf("Usage: %s [-e] [--min | --max] [-g (min|max|efficient)] [-s frequency_mhz]\n\n", prog); printf("Options: \n"); printf(" -e Lock frequency to the most efficient frequency\n"); - printf(" -g, --get= Get the frequency (optional arg: \"cur\"|\"min\"|\"max\"|\"eff\")\n"); + printf(" -g, --get Get all the frequency settings (eg \"cur\"|\"min\"|\"max\"|\"eff\")\n"); printf(" -s, --set Lock frequency to an absolute value (MHz)\n"); printf(" -c, --custom Set a min, or max frequency \"min=X | max=Y\"\n"); printf(" -m --max Lock frequency to max frequency\n"); @@ -184,13 +184,6 @@ parse(int argc, char *argv[], bool *act_upon, size_t act_upon_n, int *new_freq) int c, tmp; bool write = false; - char *token[] = { - (char *)info[CUR].name, - (char *)info[MIN].name, - (char *)"eff", - (char *)info[MAX].name - }; - /* No args means -g" */ if (argc == 1) { for (c = 0; c < act_upon_n; c++) @@ -200,7 +193,7 @@ parse(int argc, char *argv[], bool *act_upon, size_t act_upon_n, int *new_freq) while (1) { int option_index = 0; static struct option long_options[] = { - { "get", optional_argument, NULL, 'g' }, + { "get", no_argument, NULL, 'g' }, { "set", required_argument, NULL, 's' }, { "custom", required_argument, NULL, 'c'}, { "min", no_argument, NULL, 'i' }, @@ -211,7 +204,7 @@ parse(int argc, char *argv[], bool *act_upon, size_t act_upon_n, int *new_freq) { NULL, 0, NULL, 0} }; - c = getopt_long(argc, argv, "eg::s:c:midh", long_options, &option_index); + c = getopt_long(argc, argv, "egs:c:midh", long_options, &option_index); if (c == -1) break; @@ -219,19 +212,7 @@ parse(int argc, char *argv[], bool *act_upon, size_t act_upon_n, int *new_freq) case 'g': if (write == true) fprintf(stderr, "Read and write operations not support simultaneously.\n"); - - if (optarg) { - char *value, *subopts = optarg; - int x; - while (*subopts != '\0') { - x = getsubopt(&subopts, token, &value); - if (x == -1) { - fprintf(stderr, "Unrecognized option (%s)\n", value); - break; - } else - act_upon[x] = true; - } - } else { + { int i; for (i = 0; i < act_upon_n; i++) act_upon[i] = true;