diff options
-rw-r--r-- | drivers/gpu/drm/drm_modes.c | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/drivers/gpu/drm/drm_modes.c b/drivers/gpu/drm/drm_modes.c index 3d10425f6b18..27fe410bba5c 100644 --- a/drivers/gpu/drm/drm_modes.c +++ b/drivers/gpu/drm/drm_modes.c | |||
@@ -1733,16 +1733,30 @@ bool drm_mode_parse_command_line_for_connector(const char *mode_option, | |||
1733 | * bunch of things: | 1733 | * bunch of things: |
1734 | * - We need to make sure that the first character (which | 1734 | * - We need to make sure that the first character (which |
1735 | * would be our resolution in X) is a digit. | 1735 | * would be our resolution in X) is a digit. |
1736 | * - However, if the X resolution is missing, then we end up | 1736 | * - If not, then it's either a named mode or a force on/off. |
1737 | * with something like x<yres>, with our first character | 1737 | * To distinguish between the two, we need to run the |
1738 | * being an alpha-numerical character, which would be | 1738 | * extra parsing function, and if not, then we consider it |
1739 | * considered a named mode. | 1739 | * a named mode. |
1740 | * | 1740 | * |
1741 | * If this isn't enough, we should add more heuristics here, | 1741 | * If this isn't enough, we should add more heuristics here, |
1742 | * and matching unit-tests. | 1742 | * and matching unit-tests. |
1743 | */ | 1743 | */ |
1744 | if (!isdigit(name[0]) && name[0] != 'x') | 1744 | if (!isdigit(name[0]) && name[0] != 'x') { |
1745 | unsigned int namelen = strlen(name); | ||
1746 | |||
1747 | /* | ||
1748 | * Only the force on/off options can be in that case, | ||
1749 | * and they all take a single character. | ||
1750 | */ | ||
1751 | if (namelen == 1) { | ||
1752 | ret = drm_mode_parse_cmdline_extra(name, namelen, true, | ||
1753 | connector, mode); | ||
1754 | if (!ret) | ||
1755 | return true; | ||
1756 | } | ||
1757 | |||
1745 | named_mode = true; | 1758 | named_mode = true; |
1759 | } | ||
1746 | 1760 | ||
1747 | /* Try to locate the bpp and refresh specifiers, if any */ | 1761 | /* Try to locate the bpp and refresh specifiers, if any */ |
1748 | bpp_ptr = strchr(name, '-'); | 1762 | bpp_ptr = strchr(name, '-'); |