Skip to content

Commit a7ab155

Browse files
committed
drm/modes: Switch to named mode descriptors
The current named mode parsing relies only on the mode name, and doesn't allow to specify any other parameter. Let's convert that string list to an array of a custom structure that will hold the name and some additional parameters in the future. Reviewed-by: Noralf Trønnes <[email protected]> Tested-by: Mateusz Kwiatkowski <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Maxime Ripard <[email protected]>
1 parent a631bf3 commit a7ab155

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

drivers/gpu/drm/drm_modes.c

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1750,9 +1750,13 @@ static int drm_mode_parse_cmdline_options(const char *str,
17501750
return 0;
17511751
}
17521752

1753-
static const char * const drm_named_modes_whitelist[] = {
1754-
"NTSC",
1755-
"PAL",
1753+
struct drm_named_mode {
1754+
const char *name;
1755+
};
1756+
1757+
static const struct drm_named_mode drm_named_modes[] = {
1758+
{ "NTSC", },
1759+
{ "PAL", },
17561760
};
17571761

17581762
static int drm_mode_parse_cmdline_named_mode(const char *name,
@@ -1784,14 +1788,15 @@ static int drm_mode_parse_cmdline_named_mode(const char *name,
17841788
* We're sure we're a named mode at this point, iterate over the
17851789
* list of modes we're aware of.
17861790
*/
1787-
for (i = 0; i < ARRAY_SIZE(drm_named_modes_whitelist); i++) {
1791+
for (i = 0; i < ARRAY_SIZE(drm_named_modes); i++) {
1792+
const struct drm_named_mode *mode = &drm_named_modes[i];
17881793
int ret;
17891794

1790-
ret = str_has_prefix(name, drm_named_modes_whitelist[i]);
1795+
ret = str_has_prefix(name, mode->name);
17911796
if (ret != name_end)
17921797
continue;
17931798

1794-
strcpy(cmdline_mode->name, drm_named_modes_whitelist[i]);
1799+
strcpy(cmdline_mode->name, mode->name);
17951800
cmdline_mode->specified = true;
17961801

17971802
return 1;

0 commit comments

Comments
 (0)