Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp3159186rwe; Mon, 29 Aug 2022 06:53:15 -0700 (PDT) X-Google-Smtp-Source: AA6agR66CfKmtjH9fCFn1pejsTSA7dktwGdMtH2kUymoKpxnJgE3Nr7dr1YesEqd/Xpex9SV7f8H X-Received: by 2002:a17:907:2e01:b0:730:9ecc:cd28 with SMTP id ig1-20020a1709072e0100b007309ecccd28mr13283972ejc.360.1661781195369; Mon, 29 Aug 2022 06:53:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661781195; cv=none; d=google.com; s=arc-20160816; b=yT2LwQ6TVQ/6TiSW0B66sMohC/raOYnPl73tqpNmFArKnrSKA+IiHH4HBnXcUroe/B OIkNDSTuWVMI4+56sGL9PNX2dAsnUxyqN6GbDmEO2uKkijiR+HxFo9VVT1QM5kNeQwgC 3mv1wU9E9HYxYywew2Zlh7B1xXSUNy2g2RXjrPRZLvNYAt7nSr4ppGB6hrQlW3owdKvO poOsCGK9B7MoKKpeFtLVCJrVDe5/QSAEjAU7cPJDyO/XLs0L78KtdEPdoFWhTUBReOyf m6GzqXlLazLw/XzdinbSkD/LCsgVHII5y/3FDa70iaLO1qxYpz5h6rVZWUePr3jetQfc cXBg== 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=ltOYRG7v3tJzbIBGGuYcDX0LFcNaJ6PQeW/ZDe0nh/k=; b=KTuv5iCTKwyIGXSBTS+eqMja0HTMi6beAc13b6mS9hrg11kYYykNlu1F5dJa6eF5jL nmAmat6fcNF38T59vUmQIhT24ZWPtqp7smi1qvzLlYcHBDGhQKMacsVyeE/Pc7+s8XaQ SWZC+3cbJbJY1UzAi4Gmyt2xE/BVNKOjpKcJWLuxq90PUX328qcyPuvO1ZYghwKNMELe XnRW2WjK4kwEKGahEaEmuPeosl1PErcxzoqNuajsZQIbt4j0mz/3KCDmxrPTUX4nqOcM 3MTKaOyINwuLfv+43Od3bj3w1yoCkaJrJG8wpTqd3z3B0JY4D49b2Zog2ENahZk3pTLZ +bjw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cerno.tech header.s=fm3 header.b=m7cJL3Tx; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=EgQdFq4F; 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 j4-20020a50ed04000000b004477cac2be2si3804750eds.242.2022.08.29.06.52.48; Mon, 29 Aug 2022 06:53:15 -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=fm3 header.b=m7cJL3Tx; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=EgQdFq4F; 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 S230287AbiH2NOv (ORCPT + 99 others); Mon, 29 Aug 2022 09:14:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34944 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230272AbiH2NOT (ORCPT ); Mon, 29 Aug 2022 09:14:19 -0400 Received: from wnew2-smtp.messagingengine.com (wnew2-smtp.messagingengine.com [64.147.123.27]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BE10A2AC45 for ; Mon, 29 Aug 2022 06:13:58 -0700 (PDT) Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailnew.west.internal (Postfix) with ESMTP id 5CBD12B0605E; Mon, 29 Aug 2022 09:13:42 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Mon, 29 Aug 2022 09:13:45 -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=fm3; t=1661778821; x= 1661786021; bh=ltOYRG7v3tJzbIBGGuYcDX0LFcNaJ6PQeW/ZDe0nh/k=; b=m 7cJL3Tx1R/AdRyXvg9fuTo+UkRM7I9GJqB3muCppd0uzMsB/u+S+VVVy0wfCEdl6 wqXmchU4kN9Yc7O8Yv0Gh8nFHpXTqcJpMQd3ekaHDCn6Z1Ztl9tSpvjZBommGqwE vPQvOhoQcmftregixxfdTKx33AtFhnIqO6c2TPiMWAsU056yLTQvE1fs8bEzReC+ dsK66EPukNp7njpMz+6Fers7BUpwGEJWYBvgtkE1pN3ig+CzJhnekQ32Xih+ZD3E Gh2WWZCvbqCBzeBPaGVmVDZOZkfOoZ6je/FTfd1DDQ+V8Pxf1FjXy+Vo+QSzp4mM wL4QDSD9lcQu7kVeuiyRg== 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=fm1; t=1661778821; x= 1661786021; bh=ltOYRG7v3tJzbIBGGuYcDX0LFcNaJ6PQeW/ZDe0nh/k=; b=E gQdFq4FpwAaoluysfo4+L8sX7Spy2I9XIpng5hfvx0hUvtTmCqkBPSwzxL4FuN/+ y//4E/PG4eAiYFk7qUyue7xGvXvYrJ46yrRPGJdxnK2eear8WV0bpy3sX83/M61x uvTPdAfdGOoaiv7AdM+KToUcKeg3AFpmnD2uVCCRVgGL6Am7XD40/AhRkOtoKazd uhiMDGAVQir7q2+XFLzmwVa2cb/+YwqSHM6uJPWV2jQ47Zo8X8XlP1nXLm69c3/h Fqlka9w81rdGt7Yclq2SdV5oy/ElCUqrbeLEFKLZVOQ6zEV+oI4Y2/LHXj7Al6tt THo2S9JTcNZ2BD0tNUp2g== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrvdekuddgieefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvvefufffkofgjfhggtgfogfesthhqredtredtjeenucfhrhhomhepofgr gihimhgvucftihhprghrugcuoehmrgigihhmvgestggvrhhnohdrthgvtghhqeenucggtf frrghtthgvrhhnpeefiedvfefggffgffehveejieffuddtgffhjefggeetieduvdeileet lefgveegtdenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhroh hmpehmrgigihhmvgestggvrhhnohdrthgvtghh X-ME-Proxy: Feedback-ID: i8771445c:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 29 Aug 2022 09:13:40 -0400 (EDT) From: Maxime Ripard To: Maxime Ripard , Ben Skeggs , David Airlie , Chen-Yu Tsai , Thomas Zimmermann , Jani Nikula , Lyude Paul , Philipp Zabel , Maarten Lankhorst , Rodrigo Vivi , Tvrtko Ursulin , Jernej Skrabec , Samuel Holland , Karol Herbst , =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= , Emma Anholt , Daniel Vetter , Joonas Lahtinen Cc: Maxime Ripard , Hans de Goede , linux-arm-kernel@lists.infradead.org, Phil Elwell , intel-gfx@lists.freedesktop.org, Dave Stevenson , dri-devel@lists.freedesktop.org, Dom Cobley , linux-kernel@vger.kernel.org, nouveau@lists.freedesktop.org, linux-sunxi@lists.linux.dev, Mateusz Kwiatkowski , Geert Uytterhoeven Subject: [PATCH v2 15/41] drm/modes: Switch to named mode descriptors Date: Mon, 29 Aug 2022 15:11:29 +0200 Message-Id: <20220728-rpi-analog-tv-properties-v2-15-459522d653a7@cerno.tech> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220728-rpi-analog-tv-properties-v2-0-459522d653a7@cerno.tech> References: <20220728-rpi-analog-tv-properties-v2-0-459522d653a7@cerno.tech> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" X-Mailer: b4 0.10.0-dev-65ba7 X-Developer-Signature: v=1; a=openpgp-sha256; l=1620; i=maxime@cerno.tech; h=from:subject:message-id; bh=dI9HvhesuJCadfdRJpcjt131uRCcHtdTs7qad6DvrlM=; b=owGbwMvMwCX2+D1vfrpE4FHG02pJDMk8u+SvxJRNvRO9PfP45cNP94Uk+JdUnqx/s6mu1+Psb7uL 9nycHaUsDGJcDLJiiiwxwuZL4k7Net3JxjcPZg4rE8gQBi5OAZiIZzYjw3bHY1dcZ9wR1rhUue3wpU kNuTsdojmEy87kM/sbR/OeuMDwz+ShxdZlsx66S8zcaZ/nz3DsW7MlczSju49UVLQBz4s1XAA= X-Developer-Key: i=maxime@cerno.tech; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D Content-Transfer-Encoding: quoted-printable 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,T_SCC_BODY_TEXT_LINE 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= =0D to specify any other parameter.=0D =0D Let's convert that string list to an array of a custom structure that will= =0D hold the name and some additional parameters in the future.=0D =0D Signed-off-by: Maxime Ripard =0D =0D diff --git a/drivers/gpu/drm/drm_modes.c b/drivers/gpu/drm/drm_modes.c=0D index 0636cb707544..1fdfa004b139 100644=0D --- a/drivers/gpu/drm/drm_modes.c=0D +++ b/drivers/gpu/drm/drm_modes.c=0D @@ -2206,9 +2206,13 @@ static int drm_mode_parse_cmdline_options(const char= *str,=0D return 0;=0D }=0D =0D -static const char * const drm_named_modes_whitelist[] =3D {=0D - "NTSC",=0D - "PAL",=0D +struct drm_named_mode {=0D + const char *name;=0D +};=0D +=0D +static const struct drm_named_mode drm_named_modes[] =3D {=0D + { "NTSC", },=0D + { "PAL", },=0D };=0D =0D static int drm_mode_parse_cmdline_named_mode(const char *name,=0D @@ -2241,14 +2245,15 @@ static int drm_mode_parse_cmdline_named_mode(const = char *name,=0D * We're sure we're a named mode at that point, iterate over the=0D * list of modes we're aware of.=0D */=0D - for (i =3D 0; i < ARRAY_SIZE(drm_named_modes_whitelist); i++) {=0D + for (i =3D 0; i < ARRAY_SIZE(drm_named_modes); i++) {=0D + const struct drm_named_mode *mode =3D &drm_named_modes[i];=0D int ret;=0D =0D - ret =3D str_has_prefix(name, drm_named_modes_whitelist[i]);=0D + ret =3D str_has_prefix(name, mode->name);=0D if (ret !=3D name_end)=0D continue;=0D =0D - strcpy(cmdline_mode->name, drm_named_modes_whitelist[i]);=0D + strcpy(cmdline_mode->name, mode->name);=0D cmdline_mode->specified =3D true;=0D =0D return 1;=0D =0D -- =0D b4 0.10.0-dev-65ba7=0D