6ed952bd4592ee8e71ac5ac94787d1a98716de6e
[openwrt/staging/chunkeey.git] /
1 From d3c76025a7de614fade5ffcaa8c1d88d8d64213e Mon Sep 17 00:00:00 2001
2 From: Hans de Goede <hdegoede@redhat.com>
3 Date: Mon, 18 Nov 2019 16:51:27 +0100
4 Subject: [PATCH] drm/modes: parse_cmdline: Add freestanding argument
5 to drm_mode_parse_cmdline_options()
6
7 Commit 99e2716e053734b70434502867be24d20a3e2d84 upstream.
8
9 Add a freestanding function argument to drm_mode_parse_cmdline_options()
10 similar to how drm_mode_parse_cmdline_extra() already has this.
11
12 This is a preparation patch for allowing parsing of stand-alone options
13 without a mode before them, e.g.: video=HDMI-1:margin_right=14,...
14
15 Acked-by: Maxime Ripard <mripard@kernel.org>
16 Signed-off-by: Hans de Goede <hdegoede@redhat.com>
17 Link: https://patchwork.freedesktop.org/patch/msgid/20191118155134.30468-6-hdegoede@redhat.com
18 ---
19 drivers/gpu/drm/drm_modes.c | 5 +++++
20 1 file changed, 5 insertions(+)
21
22 --- a/drivers/gpu/drm/drm_modes.c
23 +++ b/drivers/gpu/drm/drm_modes.c
24 @@ -1592,6 +1592,7 @@ static int drm_mode_parse_cmdline_int(co
25 }
26
27 static int drm_mode_parse_cmdline_options(const char *str,
28 + bool freestanding,
29 const struct drm_connector *connector,
30 struct drm_cmdline_mode *mode)
31 {
32 @@ -1670,6 +1671,9 @@ static int drm_mode_parse_cmdline_option
33 if (!is_power_of_2(rotation & DRM_MODE_ROTATE_MASK))
34 return -EINVAL;
35
36 + if (rotation && freestanding)
37 + return -EINVAL;
38 +
39 mode->rotation_reflection = rotation;
40
41 return 0;
42 @@ -1862,6 +1866,7 @@ bool drm_mode_parse_command_line_for_con
43
44 if (options_ptr) {
45 ret = drm_mode_parse_cmdline_options(options_ptr + 1,
46 + false,
47 connector, mode);
48 if (ret)
49 return false;