diff options
author | Maxime Ripard <maxime@cerno.tech> | 2022-11-17 10:28:46 +0100 |
---|---|---|
committer | Maxime Ripard <maxime@cerno.tech> | 2022-11-24 12:42:39 +0100 |
commit | aab5aaa760a3305d188612dd4a6ff4cde1b153d8 (patch) | |
tree | c3ab74b37c9ad11b0bae4b057c69c9ba1bb0c314 /drivers/gpu/drm/drm_connector.c | |
parent | 1fd4a5a36f9f10aaad5d9b1b329c2c057d80a0e5 (diff) | |
download | lwn-aab5aaa760a3305d188612dd4a6ff4cde1b153d8.tar.gz lwn-aab5aaa760a3305d188612dd4a6ff4cde1b153d8.zip |
drm/connector: Only register TV mode property if present
The drm_create_tv_properties() will create the TV mode property
unconditionally.
However, since we'll gradually phase it out, let's register it only if we
have a list passed as an argument. This will make the transition easier.
Acked-by: Noralf Trønnes <noralf@tronnes.org>
Tested-by: Mateusz Kwiatkowski <kfyatek+publicgit@gmail.com>
Acked-in-principle-or-something-like-that-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://lore.kernel.org/r/20220728-rpi-analog-tv-properties-v10-3-256dad125326@cerno.tech
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
Diffstat (limited to 'drivers/gpu/drm/drm_connector.c')
-rw-r--r-- | drivers/gpu/drm/drm_connector.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c index 05edff79d312..78fcffae100b 100644 --- a/drivers/gpu/drm/drm_connector.c +++ b/drivers/gpu/drm/drm_connector.c @@ -1690,15 +1690,18 @@ int drm_mode_create_tv_properties(struct drm_device *dev, if (drm_mode_create_tv_margin_properties(dev)) goto nomem; - dev->mode_config.legacy_tv_mode_property = - drm_property_create(dev, DRM_MODE_PROP_ENUM, - "mode", num_modes); - if (!dev->mode_config.legacy_tv_mode_property) - goto nomem; - for (i = 0; i < num_modes; i++) - drm_property_add_enum(dev->mode_config.legacy_tv_mode_property, - i, modes[i]); + if (num_modes) { + dev->mode_config.legacy_tv_mode_property = + drm_property_create(dev, DRM_MODE_PROP_ENUM, + "mode", num_modes); + if (!dev->mode_config.legacy_tv_mode_property) + goto nomem; + + for (i = 0; i < num_modes; i++) + drm_property_add_enum(dev->mode_config.legacy_tv_mode_property, + i, modes[i]); + } dev->mode_config.tv_brightness_property = drm_property_create_range(dev, 0, "brightness", 0, 100); |