Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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 <noralf@tronnes.org>
Tested-by: Mateusz Kwiatkowski <kfyatek+publicgit@gmail.com>
Link: https://lore.kernel.org/r/20220728-rpi-analog-tv-properties-v9-10-24b168e5bcd5@cerno.tech
Signed-off-by: Maxime Ripard <maxime@cerno.tech>

+11 -6
+11 -6
drivers/gpu/drm/drm_modes.c
··· 1750 1750 return 0; 1751 1751 } 1752 1752 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", }, 1756 1760 }; 1757 1761 1758 1762 static int drm_mode_parse_cmdline_named_mode(const char *name, ··· 1788 1784 * We're sure we're a named mode at this point, iterate over the 1789 1785 * list of modes we're aware of. 1790 1786 */ 1791 - for (i = 0; i < ARRAY_SIZE(drm_named_modes_whitelist); i++) { 1787 + for (i = 0; i < ARRAY_SIZE(drm_named_modes); i++) { 1788 + const struct drm_named_mode *mode = &drm_named_modes[i]; 1792 1789 int ret; 1793 1790 1794 - ret = str_has_prefix(name, drm_named_modes_whitelist[i]); 1791 + ret = str_has_prefix(name, mode->name); 1795 1792 if (ret != name_end) 1796 1793 continue; 1797 1794 1798 - strcpy(cmdline_mode->name, drm_named_modes_whitelist[i]); 1795 + strcpy(cmdline_mode->name, mode->name); 1799 1796 cmdline_mode->specified = true; 1800 1797 1801 1798 return 1;