[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAMuHMdWa9soLHSvmxWqjKAO93WhViww6GZiC9qh0RccVENPRYw@mail.gmail.com>
Date: Fri, 12 Aug 2022 15:25:39 +0200
From: Geert Uytterhoeven <geert@...ux-m68k.org>
To: Maxime Ripard <maxime@...no.tech>
Cc: Jernej Skrabec <jernej.skrabec@...il.com>,
Martin Blumenstingl <martin.blumenstingl@...glemail.com>,
Chen-Yu Tsai <wens@...e.org>,
Philipp Zabel <p.zabel@...gutronix.de>,
Jerome Brunet <jbrunet@...libre.com>,
Samuel Holland <samuel@...lland.org>,
Thomas Zimmermann <tzimmermann@...e.de>,
Daniel Vetter <daniel@...ll.ch>, Emma Anholt <emma@...olt.net>,
David Airlie <airlied@...ux.ie>,
Maarten Lankhorst <maarten.lankhorst@...ux.intel.com>,
Noralf Trønnes <noralf@...nnes.org>,
Kevin Hilman <khilman@...libre.com>,
Neil Armstrong <narmstrong@...libre.com>,
Maxime Ripard <mripard@...nel.org>,
linux-sunxi@...ts.linux.dev,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Phil Elwell <phil@...pberrypi.com>,
Mateusz Kwiatkowski <kfyatek+publicgit@...il.com>,
Linux ARM <linux-arm-kernel@...ts.infradead.org>,
Dave Stevenson <dave.stevenson@...pberrypi.com>,
"open list:ARM/Amlogic Meson..." <linux-amlogic@...ts.infradead.org>,
DRI Development <dri-devel@...ts.freedesktop.org>,
Dom Cobley <dom@...pberrypi.com>
Subject: Re: [PATCH v1 07/35] drm/modes: Only consider bpp and refresh before options
Hi Maxime,
On Fri, Jul 29, 2022 at 6:35 PM Maxime Ripard <maxime@...no.tech> 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 <maxime@...no.tech>
Thanks for your patch!
Reviewed-by: Geert Uytterhoeven <geert@...ux-m68k.org>
> --- 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@...ux-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
Powered by blists - more mailing lists