From patchwork Wed Feb 28 00:00:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "David E. Box" X-Patchwork-Id: 207577 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:a81b:b0:108:e6aa:91d0 with SMTP id bq27csp3073467dyb; Tue, 27 Feb 2024 17:30:47 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVzcng7aJ/y/e5VhO7UNjJI7eLHyc8FsLy0tvuxLEYtaPPFzAWg0sN5lb11TsPwRp3k+6NUvv1F4k58s1p5M0y4O34Kzg== X-Google-Smtp-Source: AGHT+IHDkbadq2OG4o/DzYsxDF7nsmtS6pntyi7QjF8uwFEFK1rNoWRwD2sAkBmOZtWY0wnKZUOJ X-Received: by 2002:a17:902:e74f:b0:1dc:6073:a3a4 with SMTP id p15-20020a170902e74f00b001dc6073a3a4mr1443415plf.3.1709083846890; Tue, 27 Feb 2024 17:30:46 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709083846; cv=pass; d=google.com; s=arc-20160816; b=k0X8jgHRCjEizY0hzLStqnFgpMwXh9aqJJOQa24OSAi5lnJsjSwFui3wul6vvZKICQ nL2muzpWumVMrso9j0bNiCwiWFvzjBXDankWP4/6kr/5rFpm2lmGp1H5u3AZuGgyMTtY wWzHeWPxlpjkH7VG4f+AIcFtXLJNjYFMS7caGgZRq1ujMmno+CQC+FVLKikLslZKiJHK LdIjwcf0K1bz8wpXFiLlb8g5O/gdmki4gK84uWsP6+/+tZFEWGoAJZAwQyuIp3rB2bYj 3xJo223RKcgET23kwxJFYBlTB8+EFFlDjTEVvZMcglU3KFOBqNe7AFj6/cmUAIX602CM OwnQ== 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:references:in-reply-to:message-id :date:subject:to:from:dkim-signature; bh=bxuCPIWHWUh/5S/QbZNpBTw7dIXgz6wn+DGslZR6H+0=; fh=x4bFVqj5qD52f35ITnpIMR9XPjt+nAjpv5WW2CLFX0Q=; b=VCuhbnCP3yJzSE5Xl13iyuvp+sTxCTukriDsO2PfxP5e8CzPmX7U5DcqlquPQRUZ7w DJYUed0UEAFTcFEex4TZNtBCDZmgT6vI3RKqKxq3PpVHuYt13/ZFCFPTEb7rfLqldl7L MtFzi4bf6927kSnP1T7ynOWcuRodkZk/8IWpm1/3Nzg4U3+OLvon3Y7yTYcPR+iUcr5n rQd3Dqb5q1o1yB5U6pejBgNoKOsmA9gG/45moJs2dL9MkehKee4dS0Z25WlfAh2Sq87w wEoOPQr0X0ctdGW8cyj2Z1bWKRhEIMroz9f5GgQUNrVjGntg6AeSmrA4h/u+18DOfbn3 q8Rw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=KIbMAkyI; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-84251-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-84251-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id d4-20020a170902cec400b001db63a53b73si2411221plg.45.2024.02.27.17.30.46 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Feb 2024 17:30:46 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-84251-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=KIbMAkyI; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-84251-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-84251-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 250AA286FA7 for ; Wed, 28 Feb 2024 00:03:01 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B41905788B; Wed, 28 Feb 2024 00:00:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="KIbMAkyI" Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.13]) (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 6EE091CF9A; Wed, 28 Feb 2024 00:00:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.13 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709078422; cv=none; b=hyw2eVZeYRd6HzrXbVpkN4vwmhpR60sMrGFXwg2VjmoRs2i195LuLJJUWzCjejigHWSLTGuBV+T8Um9T98ZuQ8fWBpKTQltbB8jBkEROMkaA8Wi5gSRuX84KZ5q9LskZ5gVLHF+4b3wEBweFUdUClaS0pM7kOzxNSOEhLAoQUsU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709078422; c=relaxed/simple; bh=Xrls4UpurhgVy6jk7w6ROuUCyAmG1GzPqDtSTrya6q4=; h=From:To:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=l29KhKR5AfCwhB42503ujjekWjn4oX8WjMo/wTILr4SI5XLhlm2tE75mHNni9ZC6WJxZoiGlNDVrJp1yEJFFjw4JiZCOVpUdHKms2OTvnblPjBiOTgFqhnHXUs35T0oYkSsIqThmKg5dAhzWyq8INEpopK4uSBJMUIrvqU4W5LE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=KIbMAkyI; arc=none smtp.client-ip=198.175.65.13 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1709078422; x=1740614422; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=Xrls4UpurhgVy6jk7w6ROuUCyAmG1GzPqDtSTrya6q4=; b=KIbMAkyIzOYE35LxiY0wCShMOOK1LjvEVhdbE+Xw2uRnOrmwboUBsiz7 so5VFJPavYtPMRjocQa3pC23F1xlD2X0dAgMlCp7AXuEIE3cY2fjJiJuv DZjn82PSIdl5m25qs/GAncDS+OFwn7choqO5ZtRuG7Vkjasr9X4hHtDOV GtSC6L7JHQZcSase8NdgH2EMAIwozUE7JdRoxg51vNx/oTlc2fTDxPm7k n7Rss5eRr9OoH6u7j+yZGXrfAKDAEERSk6xaXD/5VDRXxZfvx0zZD1DSj ZzDtkSnJR8QOJinbJngAxQWogAnmhzBmSUpq5sT1Oe1Rn5tgnUoCeRAnO Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10996"; a="14604944" X-IronPort-AV: E=Sophos;i="6.06,189,1705392000"; d="scan'208";a="14604944" Received: from orviesa010.jf.intel.com ([10.64.159.150]) by orvoesa105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Feb 2024 16:00:18 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.06,189,1705392000"; d="scan'208";a="7176943" Received: from linux.intel.com ([10.54.29.200]) by orviesa010.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Feb 2024 16:00:18 -0800 Received: from debox1-desk4.lan (unknown [10.251.6.149]) by linux.intel.com (Postfix) with ESMTP id D2EAF580D7F; Tue, 27 Feb 2024 16:00:17 -0800 (PST) From: "David E. Box" To: david.e.box@linux.intel.com, rajvi.jingar@linux.intel.com, platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org, hdegoede@redhat.com, ilpo.jarvinen@linux.intel.com Subject: [PATCH V2 8/9] platform/x86/intel/sdsi: Simplify ascii printing Date: Tue, 27 Feb 2024 16:00:15 -0800 Message-Id: <20240228000016.1685518-9-david.e.box@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240228000016.1685518-1-david.e.box@linux.intel.com> References: <20240228000016.1685518-1-david.e.box@linux.intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1792104303866733171 X-GMAIL-MSGID: 1792104303866733171 Use printf width specifier to set the display length of encoded feature names. Signed-off-by: David E. Box Reviewed-by: Kuppuswamy Sathyanarayanan --- V2 - Split of V1 patch 7 tools/arch/x86/intel_sdsi/intel_sdsi.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/tools/arch/x86/intel_sdsi/intel_sdsi.c b/tools/arch/x86/intel_sdsi/intel_sdsi.c index 2acc6be5f5d6..a8fb6d17405f 100644 --- a/tools/arch/x86/intel_sdsi/intel_sdsi.c +++ b/tools/arch/x86/intel_sdsi/intel_sdsi.c @@ -407,11 +407,10 @@ static int sdsi_meter_cert_show(struct sdsi_dev *s) printf("Number of Feature Counters: %d\n", mc->bundle_length / 8); while (count < mc->bundle_length / 8) { - char feature[5]; + char feature[4]; - feature[4] = '\0'; get_feature(bec[count].encoding, feature); - printf(" %s: %d\n", feature, bec[count].counter); + printf(" %.4s: %d\n", feature, bec[count].counter); ++count; } @@ -492,7 +491,7 @@ static int sdsi_state_cert_show(struct sdsi_dev *s) sizeof(*lki) + // size of the license key info offset; // offset to this blob content struct bundle_encoding *bundle = (void *)(lbc) + sizeof(*lbc); - char feature[5]; + char feature[4]; uint32_t i; printf(" Blob %d:\n", count - 1); @@ -505,11 +504,9 @@ static int sdsi_state_cert_show(struct sdsi_dev *s) printf(" Blob revision ID: %u\n", lbc->rev_id); printf(" Number of Features: %u\n", lbc->num_bundles); - feature[4] = '\0'; - for (i = 0; i < min(lbc->num_bundles, STATE_MAX_NUM_IN_BUNDLE); i++) { get_feature(bundle[i].encoding, feature); - printf(" Feature %d: %s\n", i, feature); + printf(" Feature %d: %.4s\n", i, feature); } if (lbc->num_bundles > STATE_MAX_NUM_IN_BUNDLE)