Skip to content

Commit 325d0ab

Browse files
committed
drm/modes: Add a switch to differentiate free standing options
Some extra command line options can be either specified without anything else on the command line (basically all the force connection options), but some other are only relevant when matched with a resolution (margin and interlace). Let's add a switch to restrict if needed the available option set. Fixes: e08ab74 ("drm/modes: Rewrite the command line parser") Signed-off-by: Maxime Ripard <[email protected]> Tested-by: Thomas Graichen <[email protected]> Reviewed-by: Jernej Skrabec <[email protected]> Signed-off-by: Maxime Ripard <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent 807f6c8 commit 325d0ab

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

drivers/gpu/drm/drm_modes.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1454,6 +1454,7 @@ static int drm_mode_parse_cmdline_refresh(const char *str, char **end_ptr,
14541454
}
14551455

14561456
static int drm_mode_parse_cmdline_extra(const char *str, int length,
1457+
bool freestanding,
14571458
const struct drm_connector *connector,
14581459
struct drm_cmdline_mode *mode)
14591460
{
@@ -1462,9 +1463,15 @@ static int drm_mode_parse_cmdline_extra(const char *str, int length,
14621463
for (i = 0; i < length; i++) {
14631464
switch (str[i]) {
14641465
case 'i':
1466+
if (freestanding)
1467+
return -EINVAL;
1468+
14651469
mode->interlace = true;
14661470
break;
14671471
case 'm':
1472+
if (freestanding)
1473+
return -EINVAL;
1474+
14681475
mode->margins = true;
14691476
break;
14701477
case 'D':
@@ -1542,6 +1549,7 @@ static int drm_mode_parse_cmdline_res_mode(const char *str, unsigned int length,
15421549
if (extras) {
15431550
int ret = drm_mode_parse_cmdline_extra(end_ptr + i,
15441551
1,
1552+
false,
15451553
connector,
15461554
mode);
15471555
if (ret)
@@ -1811,7 +1819,7 @@ bool drm_mode_parse_command_line_for_connector(const char *mode_option,
18111819
extra_ptr != options_ptr) {
18121820
int len = strlen(name) - (extra_ptr - name);
18131821

1814-
ret = drm_mode_parse_cmdline_extra(extra_ptr, len,
1822+
ret = drm_mode_parse_cmdline_extra(extra_ptr, len, false,
18151823
connector, mode);
18161824
if (ret)
18171825
return false;

0 commit comments

Comments
 (0)