Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 89E2CCAC5B9 for ; Mon, 29 Sep 2025 19:21:39 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 3FA2510E4A2; Mon, 29 Sep 2025 19:21:39 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="iOolpN9l"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.16]) by gabe.freedesktop.org (Postfix) with ESMTPS id 7DAAA10E492 for ; Mon, 29 Sep 2025 19:21:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1759173698; x=1790709698; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=lXb1enMoy8a6N+yqGPGEXcsZ+nA3Gu2J5Jx2CHMFErE=; b=iOolpN9lcAw4zPE0qdD7+z1U4nIu7jzwJsB6WJEX2LXnQhvkNb4raoHq GQ2Ps9x0T6JMpSor9bRkXlDe9wPmNacxFsPmgoekPrMrinNl9A1nnZ35R KsQsTjWYA1BacGKxyrCrT2BwUBS+2Q1oAPtwPm5cls8fKVaJ4m5dO68+q VCiQ6zzvSiqjI1ftFvBk4TdI1EKp5BoDsvjI/1XwL++xgBIBsH1BQ/ih3 5ZNlG9VtoDt8phlkoVhJIIL8A/ypd2FbiDvrSRUNwk4lcNKdQ9rn4dUYX XTm0vJ6PE+eGi44KZIHSjyJn/G97pBQOusYX41PkamEBvSZ/lYcD3jXW2 A==; X-CSE-ConnectionGUID: 9L400S7qR7eZoKa8PfNLlQ== X-CSE-MsgGUID: N9uHSmwaS1mpExGqmDdHTQ== X-IronPort-AV: E=McAfee;i="6800,10657,11568"; a="61589840" X-IronPort-AV: E=Sophos;i="6.18,302,1751266800"; d="scan'208";a="61589840" Received: from fmviesa006.fm.intel.com ([10.60.135.146]) by orvoesa108.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Sep 2025 12:21:37 -0700 X-CSE-ConnectionGUID: Mc0RbtKCRAiaaLSEb/dovw== X-CSE-MsgGUID: Jkyzi0eVSSq+RuGaqjc5NA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.18,302,1751266800"; d="scan'208";a="178250167" Received: from jkrzyszt-mobl2.ger.corp.intel.com (HELO localhost) ([10.245.245.198]) by fmviesa006-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Sep 2025 12:21:36 -0700 From: Ville Syrjala To: igt-dev@lists.freedesktop.org Subject: [PATCH i-g-t 2/6] tools/intel_vbt_decode: Use to_str() more Date: Mon, 29 Sep 2025 22:21:22 +0300 Message-ID: <20250929192127.5865-3-ville.syrjala@linux.intel.com> X-Mailer: git-send-email 2.49.1 In-Reply-To: <20250929192127.5865-1-ville.syrjala@linux.intel.com> References: <20250929192127.5865-1-ville.syrjala@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo Content-Transfer-Encoding: 8bit X-BeenThere: igt-dev@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development mailing list for IGT GPU Tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: igt-dev-bounces@lists.freedesktop.org Sender: "igt-dev" From: Ville Syrjälä Convert all the naked string array dereferences to to_str() instead. Not strictly necessary in these cases (since the VBT bitfields doen't have unused values) but it seems better to stick to the same formula for all decoding. Signed-off-by: Ville Syrjälä --- tools/intel_vbt_decode.c | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/tools/intel_vbt_decode.c b/tools/intel_vbt_decode.c index dbcba3b9cd3b..2f228fcd14b7 100644 --- a/tools/intel_vbt_decode.c +++ b/tools/intel_vbt_decode.c @@ -655,7 +655,7 @@ static int decode_ssc_freq(struct context *context, bool alternate) } } -static const char * const panel_fitting[] = { +static const char * const panel_fitting_str[] = { [0] = "disabled", [1] = "text only", [2] = "graphics only", @@ -668,7 +668,7 @@ static void dump_general_features(struct context *context, const struct bdb_general_features *features = block_data(block); printf("\tPanel fitting: %s (0x%x)\n", - panel_fitting[features->panel_fitting], features->panel_fitting); + to_str(panel_fitting_str, features->panel_fitting), features->panel_fitting); printf("\tFlexaim: %s\n", YESNO(features->flexaim)); printf("\tMessage: %s\n", YESNO(features->msg_enable)); printf("\tClear screen: %d\n", features->clear_screen); @@ -1504,28 +1504,28 @@ static void dump_legacy_child_devices(struct context *context, child_dev_num, defs->child_dev_size); } -static const char * const channel_type[] = { +static const char * const channel_type_str[] = { [0] = "automatic", [1] = "single", [2] = "dual", [3] = "reserved", }; -static const char * const dps_type[] = { +static const char * const dps_type_str[] = { [0] = "static DRRS", [1] = "D2PO", [2] = "seamless DRRS", [3] = "reserved", }; -static const char * const blt_type[] = { +static const char * const blt_type_str[] = { [0] = "default", [1] = "CCFL", [2] = "LED", [3] = "reserved", }; -static const char * const pos_type[] = { +static const char * const pos_type_str[] = { [0] = "inside shell", [1] = "outside shell", [2] = "reserved", @@ -1562,7 +1562,7 @@ static void dump_lfp_options(struct context *context, val = panel_bits(options->lvds_panel_channel_bits, i, 2); printf("\t\tChannel type: %s (0x%x)\n", - channel_type[val], val); + to_str(channel_type_str, val), val); printf("\t\tSSC: %s\n", YESNO(panel_bool(options->ssc_bits, i))); @@ -1586,11 +1586,11 @@ static void dump_lfp_options(struct context *context, val = panel_bits(options->dps_panel_type_bits, i, 2); printf("\t\tDPS type: %s (0x%x)\n", - dps_type[val], val); + to_str(dps_type_str, val), val); val = panel_bits(options->blt_control_type_bits, i, 2); printf("\t\tBacklight type: %s (0x%x)\n", - blt_type[val], val); + to_str(blt_type_str, val), val); if (context->bdb->version < 200) continue; @@ -1610,7 +1610,7 @@ static void dump_lfp_options(struct context *context, val = panel_bits((options->position), i, 2); printf("\t\tPanel position: %s (0x%x)\n", - pos_type[val], val); + to_str(pos_type_str, val), val); } } @@ -1807,7 +1807,7 @@ static void dump_lfp_data(struct context *context, free(ptrs_block); } -static const char * const lvds_config[] = { +static const char * const lvds_config_str[] = { [BDB_DRIVER_FEATURE_NO_LVDS] = "No LVDS", [BDB_DRIVER_FEATURE_INT_LVDS] = "Integrated LVDS", [BDB_DRIVER_FEATURE_SDVO_LVDS] = "SDVO LVDS", @@ -1869,7 +1869,7 @@ static void dump_driver_feature(struct context *context, printf("\tCRT hotplug: %s\n", YESNO(feature->crt_hotplug)); printf("\tLVDS config: %s (0x%x)\n", - lvds_config[feature->lvds_config], feature->lvds_config); + to_str(lvds_config_str, feature->lvds_config), feature->lvds_config); printf("\tTV hotplug: %s\n", YESNO(feature->tv_hotplug)); @@ -2325,11 +2325,11 @@ static void dump_efp_list(struct context *context, } } -static const char * const underscan_overscan[] = { - "Neither", - "Underscan/Overscan", - "Overscan only", - "Underscan only", +static const char * const underscan_overscan_str[] = { + [0] = "Neither", + [1] = "Underscan/Overscan", + [2] = "Overscan only", + [3] = "Underscan only", }; static void dump_tv_options(struct context *context, @@ -2342,9 +2342,9 @@ static void dump_tv_options(struct context *context, printf("\tAdd modes to avoid overscan issue: %s\n", YESNO(tv->add_modes_to_avoid_overscan_issue)); printf("\tUndescan/Overscan for HDTV via DVI: %s\n", - underscan_overscan[tv->underscan_overscan_hdtv_dvi]); + to_str(underscan_overscan_str, tv->underscan_overscan_hdtv_dvi)); printf("\tUndescan/Overscan for HDTV via component: %s\n", - underscan_overscan[tv->underscan_overscan_hdtv_component]); + to_str(underscan_overscan_str, tv->underscan_overscan_hdtv_component)); } static void dump_edp(struct context *context, -- 2.49.1