Received: by 2002:ac0:e350:0:0:0:0:0 with SMTP id g16csp386901imn; Fri, 29 Jul 2022 09:51:32 -0700 (PDT) X-Google-Smtp-Source: AA6agR5bZzUzzyTGzuOD/xUH0z0O7/yrnq2s3zaCjPYBvu2tGEuEiPMg62tVQjJSNBnbaPsUjO/y X-Received: by 2002:a17:90b:4f47:b0:1f2:ab5b:f1b4 with SMTP id pj7-20020a17090b4f4700b001f2ab5bf1b4mr5637002pjb.208.1659113492700; Fri, 29 Jul 2022 09:51:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659113492; cv=none; d=google.com; s=arc-20160816; b=O8wjmPBk6JIwVwJdHLkr28jvyA/CdulQUHDpXcX7X8FxaQUuUs8Ww/Juzbmc7XuyRq m94eY41mFRwU+9dkSNwhnInJYMH9LHFQEnlK6YhBhxFJ/XCO493ZT6KVgpy4aRuPkkIu oeEhXrtai0oR1bRchxFk4/vwzYBOYhYpgsDMCbN5TaTpgZWlnVKGRa2feG2CCHl9D1U6 W7WeDcUPzC4XI7OijIpCs38tJtLLMEEQCiHy4pJ00QL4i1yOzgkHSoRRp6Gy6xUgQ4Yx 7zJTOL459Q3CyPamWAIAmAQSPIGt/C+TS+gamAGqHY8jLKDQSCvxTDrvO++q5sxvM/h7 iPCw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :feedback-id:dkim-signature:dkim-signature; bh=e8w96O80jWmpbrCBw3kEkho0/4LLDZdkQsICNURykFA=; b=EsM/IsG6hdFWRA1FUnh1Zx8tHuYPMi9HqoStB9bo3NeHZRqPGmI1jqnidkF/drrKKH jTXf0gzLT6EY9sqgD91+Q6lW1CzoMzl9dXz1qCqhXM1j87LewY9XMuGrnlVPgJXRSP1q yUhDaqTcTJqCHUiDoljyAgI+IjcXX9Ja7eVU1HamOzKStJ1tcqkRWjL2n0mZi/4Zhtzm +oLayryz2rzap59J6Zj0LKKseReCvW/fvygMKYI1Q7kXeoDqKw2sTKQ3uem4T/bYPYYG 7UdN/XgXWRPRcxtqNMlUSViaxayjeLX7qxeH1mCXVc7FjnF8Lb4qaDmo6xMn0CtuVDl/ ZGPw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cerno.tech header.s=fm2 header.b="QnXF2tg/"; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=FtWdbMbw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=cerno.tech Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h14-20020a056a00170e00b0052ab931ec55si4412697pfc.184.2022.07.29.09.51.15; Fri, 29 Jul 2022 09:51:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@cerno.tech header.s=fm2 header.b="QnXF2tg/"; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=FtWdbMbw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=cerno.tech Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238111AbiG2QqL (ORCPT + 99 others); Fri, 29 Jul 2022 12:46:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36264 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238124AbiG2Qps (ORCPT ); Fri, 29 Jul 2022 12:45:48 -0400 Received: from new4-smtp.messagingengine.com (new4-smtp.messagingengine.com [66.111.4.230]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C696F88F2C for ; Fri, 29 Jul 2022 09:45:47 -0700 (PDT) Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailnew.nyi.internal (Postfix) with ESMTP id 92AB1580940; Fri, 29 Jul 2022 12:36:03 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Fri, 29 Jul 2022 12:36:03 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cerno.tech; h=cc :cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm2; t=1659112563; x= 1659119763; bh=e8w96O80jWmpbrCBw3kEkho0/4LLDZdkQsICNURykFA=; b=Q nXF2tg/gQ3dK6BjE4qA2oH11e4jGyvmEpFUrjG5UdYRskaBHQFrJKfIvuePSNcTe a5Pshnm2g9vxd1lUmWYK9xh58xFgOzqiQvoVB4lcbJy++00kxdbuNVCM+BAdlDUt 0t6mZLuYplbVVk3Koif/MQAwjhFH6J0OzCepa9iz59aU4t/FeNppHIwrbxhdrh38 Yxn5wJh+a0vlMsXK18U0zpo0aogCW2C/H7VnrD2OOgfhNtuB5mF9zkne5Tj2pJ6G Sm4ohwmmyHVPAg5NXRe/XuVgrexFasfjDdkP5wV52mkAOF3xClomdDo3zyqWUXW6 yz/RRQ/tKzbCMxk5dHvWw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1659112563; x= 1659119763; bh=e8w96O80jWmpbrCBw3kEkho0/4LLDZdkQsICNURykFA=; b=F tWdbMbwd8gGLz7Pgfb8eYqdd73EAP0ttC5XD+SSbs2AVxnza5/jbd4e0JD+OrZpM 6d3wubHYvGeqJjfI3rvCDI4rpO/e5zvX3888iAaY+UgsWStaTdjX3v0u7aLWPCIw 0mfBcd9fHF08UeFnzWntUeRTng0wwfDjnqDpL2uc67GUe6IW5Qm90Mgu/CzfPhSa JFmlKqZjAPFXxssHue06CCjoLqyskdcpGGqDsAf7DDrmUYWRCgsAKj5YlKxrOnBf gg2KN7Hg30Ivf4Fm/LqzlQSDg1AXg6qDfVdyS0mFcIBS9/qiS9oYzq6s5OUxrU2x GGoZHOQaHUL0etfAa5eHw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrvddujedguddtfecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpefhvfevufffkffojghfgggtoffgsehtkeertdertdejnecuhfhrohhmpefo rgigihhmvgcutfhiphgrrhguuceomhgrgihimhgvsegtvghrnhhordhtvggthheqnecugg ftrfgrthhtvghrnhepgfffgfetffduudelhfevieffffduleevgfegkeeutefgffejheel leekjeefhfejnecuvehluhhsthgvrhfuihiivgepvdenucfrrghrrghmpehmrghilhhfrh homhepmhgrgihimhgvsegtvghrnhhordhtvggthh X-ME-Proxy: Feedback-ID: i8771445c:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 29 Jul 2022 12:36:02 -0400 (EDT) From: Maxime Ripard To: Jernej Skrabec , Martin Blumenstingl , Chen-Yu Tsai , Philipp Zabel , Jerome Brunet , Samuel Holland , Thomas Zimmermann , Daniel Vetter , Emma Anholt , David Airlie , Maarten Lankhorst , =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= , Kevin Hilman , Neil Armstrong , Maxime Ripard Cc: Maxime Ripard , linux-sunxi@lists.linux.dev, linux-kernel@vger.kernel.org, Phil Elwell , Mateusz Kwiatkowski , linux-arm-kernel@lists.infradead.org, Geert Uytterhoeven , Dave Stevenson , linux-amlogic@lists.infradead.org, dri-devel@lists.freedesktop.org, Dom Cobley Subject: [PATCH v1 10/35] drm/modes: Switch to named mode descriptors Date: Fri, 29 Jul 2022 18:34:53 +0200 Message-Id: <20220728-rpi-analog-tv-properties-v1-10-3d53ae722097@cerno.tech> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220728-rpi-analog-tv-properties-v1-0-3d53ae722097@cerno.tech> References: <20220728-rpi-analog-tv-properties-v1-0-3d53ae722097@cerno.tech> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" X-Mailer: b4 0.10.0-dev-49460 X-Developer-Signature: v=1; a=openpgp-sha256; l=1540; i=maxime@cerno.tech; h=from:subject:message-id; bh=7XZdQfRWjHdAHz8+TLk9cQGA52WaqvFzAKH3QklOSko=; b=owGbwMvMwCHc4XzqmfnC7acZT6slMSQ94VFScrT42N+ncm6dRG94xZ5Me7OwhzZJ3uduiUSph7zS FNrfUcrCIMzBICumyHJd8K0dX1iUWwTPh80wc1iZQIYwcHEKwET8PzIy/GypzfGVftPbOW3Z8+bNm4 s1J13O9fNZefvp8qvRub139RgZ9tawG7J2PrtYzTrV0V5P5+EP3t/LPx4oZ6g48b7oybecVQA= X-Developer-Key: i=maxime@cerno.tech; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_PASS, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The current named mode parsing relies only the mode name, and doesn't allow to specify any other parameter. Let's convert that string list to an array of a custom structure that will hold the name and some additional parameters in the future. Signed-off-by: Maxime Ripard diff --git a/drivers/gpu/drm/drm_modes.c b/drivers/gpu/drm/drm_modes.c index e85099df0326..1421e5da49e0 100644 --- a/drivers/gpu/drm/drm_modes.c +++ b/drivers/gpu/drm/drm_modes.c @@ -1768,9 +1768,13 @@ static int drm_mode_parse_cmdline_options(const char *str, return 0; } -static const char * const drm_named_modes_whitelist[] = { - "NTSC", - "PAL", +struct drm_named_mode { + const char *name; +}; + +static const struct drm_named_mode drm_named_modes[] = { + { "NTSC", }, + { "PAL", }, }; static bool drm_mode_parse_cmdline_named_mode(const char *name, @@ -1779,14 +1783,15 @@ static bool drm_mode_parse_cmdline_named_mode(const char *name, { unsigned int i; - for (i = 0; i < ARRAY_SIZE(drm_named_modes_whitelist); i++) { + for (i = 0; i < ARRAY_SIZE(drm_named_modes); i++) { + const struct drm_named_mode *mode = &drm_named_modes[i]; int ret; - ret = str_has_prefix(name, drm_named_modes_whitelist[i]); + ret = str_has_prefix(name, mode->name); if (ret != name_end) continue; - strcpy(cmdline_mode->name, drm_named_modes_whitelist[i]); + strcpy(cmdline_mode->name, mode->name); cmdline_mode->specified = true; return true; -- b4 0.10.0-dev-49460