Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp1783833rwb; Fri, 12 Aug 2022 06:52:34 -0700 (PDT) X-Google-Smtp-Source: AA6agR6Xe7NnAEvhYxrbKmFYM9PuahNf9OJYYODTxO9lVzMUkeu+wsCugHduQjX2m2g3T1u5LLxR X-Received: by 2002:a17:907:6095:b0:731:87a0:b9e8 with SMTP id ht21-20020a170907609500b0073187a0b9e8mr2861677ejc.124.1660312353806; Fri, 12 Aug 2022 06:52:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660312353; cv=none; d=google.com; s=arc-20160816; b=G39X7eT2eODGTfmywldqIKig7l7wDvLzdJdkQYlfMLxs1ZUi0QpYSRqi6nGzT1A5vi e61in2315SDrk4dQgJRIBBSghRlLwfj1+DKPX5/URyMzSrPv7ufejTuY5fx47wKuQgfl c03x2Elsy8fcN44uiu0504nXDayL2scmwmcHvN2qpI8MrVKLFMISfVOKYMAt62qAqrMK luksew9u07yrgnE1DAEy2qv2JLNBh1pjbwMbxE1P6Q0Sk6jlBhGeP86gB9P94alW+Od4 BWcUWp5MAanq5zGa/b4CEVmL3hd8z7E0sKwZO+++2cgGM+sP0MSdw82CQe9cR4gPdDyx P0YA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version; bh=OXdSHuVG78f8K6rpNcMaWPwy/pvmJ+nqUgx8dG2xzfs=; b=UTYZlidUL8ZjTFzRCeSWeJhO3lvf14G6LNr2Ofn5RcdlXkZrOw9+N2Ewd20dY/nH2d q9dZ+g+G1624/Vv/2kcxRoOcVgPetmQJvigr4M1LZk69K2mN8M0ION1uiAFgW9IaEtBD 1tGMXbMiCOocRvpAK2WoNc65P/0eVOZ8y5oM0rLYPK2fxvyVb3lfvIVeBNhxAzcSXiRh 8mcb4d37uMjPkI9h+8HUowGBMeHxK9MxQ/PmaZ6JudmpIYP806uliFTFWgjmg6FJi1DJ tRLNL44gtvR4BPZmv51gIDG2qqdWewnws7Y9rpI5CTCLg2kklxa3XkX3D0a59KXInfk5 GLVQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ga23-20020a1709070c1700b00726b8cf8debsi2174249ejc.869.2022.08.12.06.51.44; Fri, 12 Aug 2022 06:52:33 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238902AbiHLNcW (ORCPT + 99 others); Fri, 12 Aug 2022 09:32:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51174 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238896AbiHLNcU (ORCPT ); Fri, 12 Aug 2022 09:32:20 -0400 Received: from mail-vs1-f45.google.com (mail-vs1-f45.google.com [209.85.217.45]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 611919AFCD for ; Fri, 12 Aug 2022 06:32:19 -0700 (PDT) Received: by mail-vs1-f45.google.com with SMTP id 67so810270vsv.2 for ; Fri, 12 Aug 2022 06:32:19 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc; bh=OXdSHuVG78f8K6rpNcMaWPwy/pvmJ+nqUgx8dG2xzfs=; b=K1soJI4r2/RDWqg2Fashs/x5heF18hY/NkA2TIHO58NjoaQ+cAiocx5dpY/d01+f69 3kjfJgqT2IKCSSSSlCrhLJRf/sF9zQFm7xYCHfitVysc3i7PURBMzAC24OS9fAX1OjC9 DPHI5C/qNgh04yugToovM8nEjO+NjL2VLXw7GPT3XAXf5ocn1+nm6FB7vPhSIc2nhO6V iow+OOPQQdG3hlqVBMooqkrdWe4w1m9cZ5ew5cZJOV3n/9Scx/Z2wEb+lz68xc5LR3Lu 5pYlXslYXjG+dJ8Kpt/nuYrnM+8hl54RUdTyE3eao19zMOfVcUVW6odWtotDMBYKiKYi wQDg== X-Gm-Message-State: ACgBeo3aFuweQDvnBs/cMOqxRBabgo8koOhAxGlkk7p7eJ67q5rvWett ksHMZLgVkDi4nADAiagiuDReUUkyNX+kzQ== X-Received: by 2002:a05:6102:2223:b0:32d:2ae1:412 with SMTP id d3-20020a056102222300b0032d2ae10412mr1901446vsb.6.1660311138174; Fri, 12 Aug 2022 06:32:18 -0700 (PDT) Received: from mail-ua1-f41.google.com (mail-ua1-f41.google.com. [209.85.222.41]) by smtp.gmail.com with ESMTPSA id f28-20020ab0101c000000b00384d3ce037dsm1510008uab.4.2022.08.12.06.32.17 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 12 Aug 2022 06:32:17 -0700 (PDT) Received: by mail-ua1-f41.google.com with SMTP id f10so315835uap.2 for ; Fri, 12 Aug 2022 06:32:17 -0700 (PDT) X-Received: by 2002:a5b:6c1:0:b0:669:a7c3:4c33 with SMTP id r1-20020a5b06c1000000b00669a7c34c33mr3307653ybq.543.1660310750947; Fri, 12 Aug 2022 06:25:50 -0700 (PDT) MIME-Version: 1.0 References: <20220728-rpi-analog-tv-properties-v1-0-3d53ae722097@cerno.tech> <20220728-rpi-analog-tv-properties-v1-7-3d53ae722097@cerno.tech> In-Reply-To: <20220728-rpi-analog-tv-properties-v1-7-3d53ae722097@cerno.tech> From: Geert Uytterhoeven Date: Fri, 12 Aug 2022 15:25:39 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v1 07/35] drm/modes: Only consider bpp and refresh before options To: Maxime Ripard Cc: 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=C3=B8nnes?= , Kevin Hilman , Neil Armstrong , Maxime Ripard , linux-sunxi@lists.linux.dev, Linux Kernel Mailing List , Phil Elwell , Mateusz Kwiatkowski , Linux ARM , Dave Stevenson , "open list:ARM/Amlogic Meson..." , DRI Development , Dom Cobley Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.4 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=no 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 Hi Maxime, On Fri, Jul 29, 2022 at 6:35 PM Maxime Ripard wrote: > 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 Thanks for your patch! Reviewed-by: Geert Uytterhoeven > --- 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, '-'); Probably you still want to add a check that the next character is actually a digit, cfr. my "[PATCH v2 5/5] drm/modes: parse_cmdline: Add support for named modes containing dashes" (https://lore.kernel.org/dri-devel/2eb205da88c3cb19ddf04d167ece4e16a330948b.1657788997.git.geert@linux-m68k.org)? > 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; Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds