From patchwork Fri Jul 29 16:34:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 12932618 X-Patchwork-Delegate: neil.armstrong@linaro.org 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 3D91AC00144 for ; Fri, 29 Jul 2022 16:40:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=uSlmnd9ybj3ZiYERGZ2XhQevQUsFSMiYtzygw6Xl7rA=; b=M5w4cmHEh5MyGj Uv6RhEBmQwAft72v8fCaQk6RlKuDEtbx7mSqKjixurpERDl0H03eDx0+OBQaoeHt6lGoUy8P64L7z vQaIKfrQnong8QHDNe5ajtglPay2GyESZvtj/yS782Nnv0q6qhDhPpPe3ll5D8R1rACOnj2grPf/U q1cPPSLMihbPSh+lMk0IGR4Q3wDg5TSLLZRjRHSGU3tJvpkV3rlkkfJNbYNUfKLCW1M56tDK5Uh2p JRn0epXcoWUP7dBY0oT600bV20gy+tbmzE7dcAvy7RsRudcnh3O861sylaN9fv0/vNVe4R3GQvH3w rv7t0v79GEZ6phLtWVeg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oHT2T-006V1m-8d; Fri, 29 Jul 2022 16:40:37 +0000 Received: from new4-smtp.messagingengine.com ([66.111.4.230]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oHSxu-006S1U-Lj; Fri, 29 Jul 2022 16:35:56 +0000 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailnew.nyi.internal (Postfix) with ESMTP id EF557580934; Fri, 29 Jul 2022 12:35:53 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute3.internal (MEProxy); Fri, 29 Jul 2022 12:35:53 -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=1659112553; x= 1659119753; bh=YWzd1M45UJ404WTbCsULbW4KUvX+gwYYJ16acMe7FbA=; b=X UlA55IazycpWrng33oGOZjKDBcXEBEtCPzoC9xCLjQUHZglaSZbN57EODWPZWXF9 VhjKvMYqJaqP06Def9hzPeLQWu4GJnaKaA1SALnMRB6KnQQRzpW98hfPnNQmJkjC 5TCiOn5vtoKgsakxMv+WU2uFg4vx089YxYtVfIM17NiGf5W7twXh1Tn6V8LRAGoq sHq87bOw1FOGsmx2oJ/0v0ILsQcm4QR2guPJ1eJMvmCBNe12y2H2lAyXn3nU0AN0 tJGrCu6Il8I0AVw/nOmyr3lsBQOOKGv0KWJLVOPGrLgSYaZo/YvwSHwsX1OReTlB qMh5Zq+gzIRPIsCDy2F5Q== 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=1659112553; x= 1659119753; bh=YWzd1M45UJ404WTbCsULbW4KUvX+gwYYJ16acMe7FbA=; b=y r0ThaqJ/KJUkyoGPxyMP1PzOWIyvCPqanUCJ21AEWpRAPqWZjxcEVkRd/Rw+8efu riKGHAFPbHtiFGeDXXFraXWK8qP7WqpP56NTy1+AU8keJ2tKTUwwK8wFm78QVulr HEeULZTwMlKeDbhATRz6laOo73pw+2Jyy4LiwfP3DkMOgBw0qBEi9n/xJmbLkjsA j0ppPjjJbYRnN/iG7+LbCYhJWtryIG6zkcYeocUWDXFd5qfb7ZNvlvjRLh+6Jf0x Nf89bZDGsdSViQgrj+Xgop2nHYbin+yaCP93DtCZwyKbc6LgTTKzYpTMnJxDZdU6 Vr8qvsYtmAJhs4dsLwswA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrvddujedguddtgecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpefhvfevufffkffojghfgggtoffgsehtkeertdertdejnecuhfhrohhmpefo rgigihhmvgcutfhiphgrrhguuceomhgrgihimhgvsegtvghrnhhordhtvggthheqnecugg ftrfgrthhtvghrnhepgfffgfetffduudelhfevieffffduleevgfegkeeutefgffejheel leekjeefhfejnecuvehluhhsthgvrhfuihiivgepudenucfrrghrrghmpehmrghilhhfrh homhepmhgrgihimhgvsegtvghrnhhordhtvggthh X-ME-Proxy: Feedback-ID: i8771445c:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 29 Jul 2022 12:35:52 -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_Tr?= =?utf-8?q?=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 07/35] drm/modes: Only consider bpp and refresh before options Date: Fri, 29 Jul 2022 18:34:50 +0200 Message-Id: <20220728-rpi-analog-tv-properties-v1-7-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 X-Mailer: b4 0.10.0-dev-49460 X-Developer-Signature: v=1; a=openpgp-sha256; l=1546; i=maxime@cerno.tech; h=from:subject:message-id; bh=0dDWMayp8tTv4iediPV+Th9ldEA0clkjbey5Bc39YFo=; b=owGbwMvMwCHc4XzqmfnC7acZT6slMSQ94VHS+bvy0CbL/BcxfRX31OoO3U4T3Ml02bK8bFFfv9S+ XO7rHaUsDMIcDLJiiizXBd/a8YVFuUXwfNgMM4eVCWQIAxenAExEejnD/wzjHzrzmEKfOfJu33CgXv tcKNutvdPr/ooX97F1a82fNZ2R4bNJTO9KrViujNObVlv/4N0y7Vu66nXjiZ2hB2K852S5/QQA X-Developer-Key: i=maxime@cerno.tech; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220729_093554_879516_291DB39E X-CRM114-Status: GOOD ( 10.60 ) X-BeenThere: linux-amlogic@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-amlogic" Errors-To: linux-amlogic-bounces+linux-amlogic=archiver.kernel.org@lists.infradead.org Some video= options might have a value that contains a dash. However, the command line parsing mode considers all dashes as the separator between the mode and the bpp count. Let's rework the parsing code a bit to only consider a dash as the bpp separator if it before a comma, the options separator. A follow-up patch will add a unit-test for this once such an option is introduced. Signed-off-by: Maxime Ripard Reviewed-by: Geert Uytterhoeven diff --git a/drivers/gpu/drm/drm_modes.c b/drivers/gpu/drm/drm_modes.c index a4c1bd688338..06a006e0b2e3 100644 --- a/drivers/gpu/drm/drm_modes.c +++ b/drivers/gpu/drm/drm_modes.c @@ -1819,20 +1819,22 @@ bool drm_mode_parse_command_line_for_connector(const char *mode_option, name = mode_option; + /* Locate the start of named options */ + options_ptr = strchr(name, ','); + if (options_ptr) + options_off = options_ptr - name; + else + options_off = strlen(name); + /* Try to locate the bpp and refresh specifiers, if any */ - bpp_ptr = strchr(name, '-'); + bpp_ptr = strnchr(name, options_off, '-'); if (bpp_ptr) bpp_off = bpp_ptr - name; - refresh_ptr = strchr(name, '@'); + refresh_ptr = strnchr(name, options_off, '@'); if (refresh_ptr) refresh_off = refresh_ptr - name; - /* Locate the start of named options */ - options_ptr = strchr(name, ','); - if (options_ptr) - options_off = options_ptr - name; - /* Locate the end of the name / resolution, and parse it */ if (bpp_ptr) { mode_end = bpp_off;