Received: by 2002:ab2:6816:0:b0:1f9:5764:f03e with SMTP id t22csp2650652lqo; Mon, 20 May 2024 11:58:55 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCU5aP66SEXJGUFN+AZXGPiVs70vHGaHogoQlzy6uUq/zeU41P3Mw9wWIjuJ4qeRlRDZ64+CGa3pZI/FV7vafbMQPXVGvrqlNq9FLnUYiQ== X-Google-Smtp-Source: AGHT+IFgI+TlLegCtrzQXz4U/E259wz0t1PSelbK5kBySQ20ax+OsIDl567RqJSNi6ZjjOTNBUw2 X-Received: by 2002:a05:6a20:3946:b0:1aa:674a:5e8a with SMTP id adf61e73a8af0-1b1ca4717e8mr11409886637.25.1716231535486; Mon, 20 May 2024 11:58:55 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716231535; cv=pass; d=google.com; s=arc-20160816; b=RNLDJgw7mcv8lQWuM1ak4JEJhnR9zz8pNUxdfvvMU0pClx8Toe8mWc4VMzET6IaKt1 cQhMpeBLE7oqsGVWffO6Dzm8yllPPKjkkm2vLPLgffnVYY2QwGzqsp8eFXYv/81fi5Iz All50JBQyzCmCK51k9il3fZ0Edqbgj4eOJqY/wwi+F1gD6qlkyxPFmYvczsIuu/Wgp9I nZZILW+XTY9VjmHgY4g3mj7WL2bEF2vgUc9cKK3mUT4cfBWOWwIRzt+nci/ZyS1lSmQw GK2LZDB+OkYDlbGBzv/NZLErRosCNXKpsNFUNHDRvo3+BQWvig7J3stsHvrFF1eQIqqv KHZw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=dl4+SLBeFPnriuBwYnryUMkurFVrv5hxlqLG9E31XsI=; fh=Y/OXONmFelwgg1GQy0p7yAJZiD/5r31VQiOUG3bfM34=; b=TUkSUM5QHnromePSPYdD4S2WZoyB/Pofb3dICPUHgXrmDy/GT7QrayvoDHp7RrV3oO cb1pP92iQnMX8faVOrFb5BYRgm3svl/OxNAG9stf7Mdd9s3WbRevfplTjP4DaQHjPHXs 6uIiLqDhxZA16FqH6MFA0tRkaa3v48gJI8jcIEb879DTTWln8a2eWuByZVyL1mH6ILxK 1nHIoQDKOroG3cn48MrLvTSIQCK4fw14DNkZueK5mMnxX/RSk3RzcYAhVGdeuxxidhkk ZkB5rxLwOJ6tRgby7v3ygzN1b+eiUl7GKZGtWxn3sXWVq3m4/IS6V3rhb+fNbf9z5zY+ rtIA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=RwwEU0bS; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-184089-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-184089-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id 41be03b00d2f7-634103f7118si23097928a12.383.2024.05.20.11.58.54 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 May 2024 11:58:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-184089-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=RwwEU0bS; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-184089-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-184089-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 58D31B20D92 for ; Mon, 20 May 2024 18:58:47 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7A0761386D6; Mon, 20 May 2024 18:58:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="RwwEU0bS" Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EE6011386C0 for ; Mon, 20 May 2024 18:58:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716231505; cv=none; b=TDDo994CRfXEk9uf5dprw9h+2T7LVJVM/GKrShkDapvbNrjJQnmYMf6tJIlm3/djr9Ev43YZ53L1VHuph6p6HaXtbqjQxQ5qzbO5MbBsdXtS89IRblvPpE850Wkeaes1yi9WKkvcgQAiNHct8F/uaVYSO8UUfSra93jz49ys9v8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716231505; c=relaxed/simple; bh=a+eA01vjVkP3G5nFgnuhnP1gKtaM1FSkoDTcoDq1BTs=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=XRaX34S3/EfcQbnsEu8C/I3Fm05Egn8M/qGQMbYLjLJngQ0VCpPCFoLwPmwOTZfUTLIHfz+P9T6qWKkFusQpl5pfNGDyLThwzSaZXezDm4MJ36BSGdRgwRSV/3LtPmYMUt5RASgf8P8LoCbSEpgkK05osGDvFUfgQPH6nmwJhq0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=RwwEU0bS; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1716231502; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=dl4+SLBeFPnriuBwYnryUMkurFVrv5hxlqLG9E31XsI=; b=RwwEU0bSJXYp1EC+3hHFi7mgUhXR6wrvbRADnZyvXv6jzmagPROI+2dSbqIPY+RtOJaahz FWeh0KRNZV/VComDi23cFoJPw8EErJnGLsvtl3Sq/OqbWHydWO4DGkdIRFOspg3nVRVfTr 3UuRInXhsifx84lkcEZqAAROOro7KZE= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-641-tnOtF_v7M-ide5nKun1KlQ-1; Mon, 20 May 2024 14:58:19 -0400 X-MC-Unique: tnOtF_v7M-ide5nKun1KlQ-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 51AFA101A525; Mon, 20 May 2024 18:58:18 +0000 (UTC) Received: from dba-icx.bos.redhat.com (prarit2023-dbaguest.khw.eng.bos2.dc.redhat.com [10.26.1.94]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2BDBA200A78F; Mon, 20 May 2024 18:58:18 +0000 (UTC) From: David Arcari To: linux-pm@vger.kernel.org Cc: David Arcari , Len Brown , linux-kernel@vger.kernel.org Subject: [PATCH] tools/power turbostat: make the '-n' command line argument work in all cases Date: Mon, 20 May 2024 14:57:49 -0400 Message-ID: <20240520185749.1404283-1-darcari@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.6 In some cases specifying the '-n' command line argument will cause turbostat to fail. For instance 'turbostat -n 1' works fine; however, 'turbostat -n 1 -d' will fail. This is the result of the first call to getopt_long_only() where "MP" is specified as the optstring. This can be easily fixed by changing the optstring from "MP" to "MPn:" to remove ambiguity between the arguments. Signed-off-by: David Arcari Cc: Len Brown Cc: linux-kernel@vger.kernel.org --- tools/power/x86/turbostat/turbostat.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/power/x86/turbostat/turbostat.c b/tools/power/x86/turbostat/turbostat.c index 98256468e248..8071a3ef2a2e 100644 --- a/tools/power/x86/turbostat/turbostat.c +++ b/tools/power/x86/turbostat/turbostat.c @@ -7851,7 +7851,7 @@ void cmdline(int argc, char **argv) * Parse some options early, because they may make other options invalid, * like adding the MSR counter with --add and at the same time using --no-msr. */ - while ((opt = getopt_long_only(argc, argv, "MP", long_options, &option_index)) != -1) { + while ((opt = getopt_long_only(argc, argv, "MPn:", long_options, &option_index)) != -1) { switch (opt) { case 'M': no_msr = 1; -- 2.44.0