aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2012-02-06 04:58:18 -0500
committerDave Airlie <airlied@redhat.com>2012-02-09 05:15:25 -0500
commitd9bc3c02e36d844c2d980e65ddda5c7699e073f8 (patch)
tree95de33796245ca8c4e7629ddf22629bcc89f1403 /drivers/gpu
parent4a67d39190315558631d944b1cea4466ed4c86d8 (diff)
drm: add convenience function to create an range property
Creating a range property is a common pattern, so create a convenience function for this and use it where appropriate. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu')
-rw-r--r--drivers/gpu/drm/drm_crtc.c69
-rw-r--r--drivers/gpu/drm/gma500/framebuffer.c5
-rw-r--r--drivers/gpu/drm/gma500/psb_intel_sdvo.c28
-rw-r--r--drivers/gpu/drm/i2c/ch7006_drv.c5
-rw-r--r--drivers/gpu/drm/i915/intel_sdvo.c30
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_display.c10
-rw-r--r--drivers/gpu/drm/radeon/radeon_display.c27
7 files changed, 53 insertions, 121 deletions
diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
index 3fe99c456a19..6fdaf6fe94eb 100644
--- a/drivers/gpu/drm/drm_crtc.c
+++ b/drivers/gpu/drm/drm_crtc.c
@@ -742,28 +742,16 @@ int drm_mode_create_tv_properties(struct drm_device *dev, int num_modes,
742 * Other, TV specific properties: margins & TV modes. 742 * Other, TV specific properties: margins & TV modes.
743 */ 743 */
744 dev->mode_config.tv_left_margin_property = 744 dev->mode_config.tv_left_margin_property =
745 drm_property_create(dev, DRM_MODE_PROP_RANGE, 745 drm_property_create_range(dev, 0, "left margin", 0, 100);
746 "left margin", 2);
747 dev->mode_config.tv_left_margin_property->values[0] = 0;
748 dev->mode_config.tv_left_margin_property->values[1] = 100;
749 746
750 dev->mode_config.tv_right_margin_property = 747 dev->mode_config.tv_right_margin_property =
751 drm_property_create(dev, DRM_MODE_PROP_RANGE, 748 drm_property_create_range(dev, 0, "right margin", 0, 100);
752 "right margin", 2);
753 dev->mode_config.tv_right_margin_property->values[0] = 0;
754 dev->mode_config.tv_right_margin_property->values[1] = 100;
755 749
756 dev->mode_config.tv_top_margin_property = 750 dev->mode_config.tv_top_margin_property =
757 drm_property_create(dev, DRM_MODE_PROP_RANGE, 751 drm_property_create_range(dev, 0, "top margin", 0, 100);
758 "top margin", 2);
759 dev->mode_config.tv_top_margin_property->values[0] = 0;
760 dev->mode_config.tv_top_margin_property->values[1] = 100;
761 752
762 dev->mode_config.tv_bottom_margin_property = 753 dev->mode_config.tv_bottom_margin_property =
763 drm_property_create(dev, DRM_MODE_PROP_RANGE, 754 drm_property_create_range(dev, 0, "bottom margin", 0, 100);
764 "bottom margin", 2);
765 dev->mode_config.tv_bottom_margin_property->values[0] = 0;
766 dev->mode_config.tv_bottom_margin_property->values[1] = 100;
767 755
768 dev->mode_config.tv_mode_property = 756 dev->mode_config.tv_mode_property =
769 drm_property_create(dev, DRM_MODE_PROP_ENUM, 757 drm_property_create(dev, DRM_MODE_PROP_ENUM,
@@ -773,40 +761,22 @@ int drm_mode_create_tv_properties(struct drm_device *dev, int num_modes,
773 i, modes[i]); 761 i, modes[i]);
774 762
775 dev->mode_config.tv_brightness_property = 763 dev->mode_config.tv_brightness_property =
776 drm_property_create(dev, DRM_MODE_PROP_RANGE, 764 drm_property_create_range(dev, 0, "brightness", 0, 100);
777 "brightness", 2);
778 dev->mode_config.tv_brightness_property->values[0] = 0;
779 dev->mode_config.tv_brightness_property->values[1] = 100;
780 765
781 dev->mode_config.tv_contrast_property = 766 dev->mode_config.tv_contrast_property =
782 drm_property_create(dev, DRM_MODE_PROP_RANGE, 767 drm_property_create_range(dev, 0, "contrast", 0, 100);
783 "contrast", 2);
784 dev->mode_config.tv_contrast_property->values[0] = 0;
785 dev->mode_config.tv_contrast_property->values[1] = 100;
786 768
787 dev->mode_config.tv_flicker_reduction_property = 769 dev->mode_config.tv_flicker_reduction_property =
788 drm_property_create(dev, DRM_MODE_PROP_RANGE, 770 drm_property_create_range(dev, 0, "flicker reduction", 0, 100);
789 "flicker reduction", 2);
790 dev->mode_config.tv_flicker_reduction_property->values[0] = 0;
791 dev->mode_config.tv_flicker_reduction_property->values[1] = 100;
792 771
793 dev->mode_config.tv_overscan_property = 772 dev->mode_config.tv_overscan_property =
794 drm_property_create(dev, DRM_MODE_PROP_RANGE, 773 drm_property_create_range(dev, 0, "overscan", 0, 100);
795 "overscan", 2);
796 dev->mode_config.tv_overscan_property->values[0] = 0;
797 dev->mode_config.tv_overscan_property->values[1] = 100;
798 774
799 dev->mode_config.tv_saturation_property = 775 dev->mode_config.tv_saturation_property =
800 drm_property_create(dev, DRM_MODE_PROP_RANGE, 776 drm_property_create_range(dev, 0, "saturation", 0, 100);
801 "saturation", 2);
802 dev->mode_config.tv_saturation_property->values[0] = 0;
803 dev->mode_config.tv_saturation_property->values[1] = 100;
804 777
805 dev->mode_config.tv_hue_property = 778 dev->mode_config.tv_hue_property =
806 drm_property_create(dev, DRM_MODE_PROP_RANGE, 779 drm_property_create_range(dev, 0, "hue", 0, 100);
807 "hue", 2);
808 dev->mode_config.tv_hue_property->values[0] = 0;
809 dev->mode_config.tv_hue_property->values[1] = 100;
810 780
811 return 0; 781 return 0;
812} 782}
@@ -2621,6 +2591,25 @@ struct drm_property *drm_property_create_enum(struct drm_device *dev, int flags,
2621} 2591}
2622EXPORT_SYMBOL(drm_property_create_enum); 2592EXPORT_SYMBOL(drm_property_create_enum);
2623 2593
2594struct drm_property *drm_property_create_range(struct drm_device *dev, int flags,
2595 const char *name,
2596 uint64_t min, uint64_t max)
2597{
2598 struct drm_property *property;
2599
2600 flags |= DRM_MODE_PROP_RANGE;
2601
2602 property = drm_property_create(dev, flags, name, 2);
2603 if (!property)
2604 return NULL;
2605
2606 property->values[0] = min;
2607 property->values[1] = max;
2608
2609 return property;
2610}
2611EXPORT_SYMBOL(drm_property_create_range);
2612
2624int drm_property_add_enum(struct drm_property *property, int index, 2613int drm_property_add_enum(struct drm_property *property, int index,
2625 uint64_t value, const char *name) 2614 uint64_t value, const char *name)
2626{ 2615{
diff --git a/drivers/gpu/drm/gma500/framebuffer.c b/drivers/gpu/drm/gma500/framebuffer.c
index 830dfdd6bf15..78733b5fd3fb 100644
--- a/drivers/gpu/drm/gma500/framebuffer.c
+++ b/drivers/gpu/drm/gma500/framebuffer.c
@@ -725,10 +725,7 @@ static int psb_create_backlight_property(struct drm_device *dev)
725 if (dev_priv->backlight_property) 725 if (dev_priv->backlight_property)
726 return 0; 726 return 0;
727 727
728 backlight = drm_property_create(dev, DRM_MODE_PROP_RANGE, 728 backlight = drm_property_create_range(dev, 0, "backlight", 0, 100);
729 "backlight", 2);
730 backlight->values[0] = 0;
731 backlight->values[1] = 100;
732 729
733 dev_priv->backlight_property = backlight; 730 dev_priv->backlight_property = backlight;
734 731
diff --git a/drivers/gpu/drm/gma500/psb_intel_sdvo.c b/drivers/gpu/drm/gma500/psb_intel_sdvo.c
index 88b42971c0fd..41b55d7a7bf8 100644
--- a/drivers/gpu/drm/gma500/psb_intel_sdvo.c
+++ b/drivers/gpu/drm/gma500/psb_intel_sdvo.c
@@ -2312,10 +2312,8 @@ static bool psb_intel_sdvo_tv_create_property(struct psb_intel_sdvo *psb_intel_s
2312 psb_intel_sdvo_connector->max_##name = data_value[0]; \ 2312 psb_intel_sdvo_connector->max_##name = data_value[0]; \
2313 psb_intel_sdvo_connector->cur_##name = response; \ 2313 psb_intel_sdvo_connector->cur_##name = response; \
2314 psb_intel_sdvo_connector->name = \ 2314 psb_intel_sdvo_connector->name = \
2315 drm_property_create(dev, DRM_MODE_PROP_RANGE, #name, 2); \ 2315 drm_property_create_range(dev, 0, #name, 0, data_value[0]); \
2316 if (!psb_intel_sdvo_connector->name) return false; \ 2316 if (!psb_intel_sdvo_connector->name) return false; \
2317 psb_intel_sdvo_connector->name->values[0] = 0; \
2318 psb_intel_sdvo_connector->name->values[1] = data_value[0]; \
2319 drm_connector_attach_property(connector, \ 2317 drm_connector_attach_property(connector, \
2320 psb_intel_sdvo_connector->name, \ 2318 psb_intel_sdvo_connector->name, \
2321 psb_intel_sdvo_connector->cur_##name); \ 2319 psb_intel_sdvo_connector->cur_##name); \
@@ -2349,25 +2347,19 @@ psb_intel_sdvo_create_enhance_property_tv(struct psb_intel_sdvo *psb_intel_sdvo,
2349 psb_intel_sdvo_connector->left_margin = data_value[0] - response; 2347 psb_intel_sdvo_connector->left_margin = data_value[0] - response;
2350 psb_intel_sdvo_connector->right_margin = psb_intel_sdvo_connector->left_margin; 2348 psb_intel_sdvo_connector->right_margin = psb_intel_sdvo_connector->left_margin;
2351 psb_intel_sdvo_connector->left = 2349 psb_intel_sdvo_connector->left =
2352 drm_property_create(dev, DRM_MODE_PROP_RANGE, 2350 drm_property_create_range(dev, 0, "left_margin", 0, data_value[0]);
2353 "left_margin", 2);
2354 if (!psb_intel_sdvo_connector->left) 2351 if (!psb_intel_sdvo_connector->left)
2355 return false; 2352 return false;
2356 2353
2357 psb_intel_sdvo_connector->left->values[0] = 0;
2358 psb_intel_sdvo_connector->left->values[1] = data_value[0];
2359 drm_connector_attach_property(connector, 2354 drm_connector_attach_property(connector,
2360 psb_intel_sdvo_connector->left, 2355 psb_intel_sdvo_connector->left,
2361 psb_intel_sdvo_connector->left_margin); 2356 psb_intel_sdvo_connector->left_margin);
2362 2357
2363 psb_intel_sdvo_connector->right = 2358 psb_intel_sdvo_connector->right =
2364 drm_property_create(dev, DRM_MODE_PROP_RANGE, 2359 drm_property_create_range(dev, 0, "right_margin", 0, data_value[0]);
2365 "right_margin", 2);
2366 if (!psb_intel_sdvo_connector->right) 2360 if (!psb_intel_sdvo_connector->right)
2367 return false; 2361 return false;
2368 2362
2369 psb_intel_sdvo_connector->right->values[0] = 0;
2370 psb_intel_sdvo_connector->right->values[1] = data_value[0];
2371 drm_connector_attach_property(connector, 2363 drm_connector_attach_property(connector,
2372 psb_intel_sdvo_connector->right, 2364 psb_intel_sdvo_connector->right,
2373 psb_intel_sdvo_connector->right_margin); 2365 psb_intel_sdvo_connector->right_margin);
@@ -2391,25 +2383,19 @@ psb_intel_sdvo_create_enhance_property_tv(struct psb_intel_sdvo *psb_intel_sdvo,
2391 psb_intel_sdvo_connector->top_margin = data_value[0] - response; 2383 psb_intel_sdvo_connector->top_margin = data_value[0] - response;
2392 psb_intel_sdvo_connector->bottom_margin = psb_intel_sdvo_connector->top_margin; 2384 psb_intel_sdvo_connector->bottom_margin = psb_intel_sdvo_connector->top_margin;
2393 psb_intel_sdvo_connector->top = 2385 psb_intel_sdvo_connector->top =
2394 drm_property_create(dev, DRM_MODE_PROP_RANGE, 2386 drm_property_create_range(dev, 0, "top_margin", 0, data_value[0]);
2395 "top_margin", 2);
2396 if (!psb_intel_sdvo_connector->top) 2387 if (!psb_intel_sdvo_connector->top)
2397 return false; 2388 return false;
2398 2389
2399 psb_intel_sdvo_connector->top->values[0] = 0;
2400 psb_intel_sdvo_connector->top->values[1] = data_value[0];
2401 drm_connector_attach_property(connector, 2390 drm_connector_attach_property(connector,
2402 psb_intel_sdvo_connector->top, 2391 psb_intel_sdvo_connector->top,
2403 psb_intel_sdvo_connector->top_margin); 2392 psb_intel_sdvo_connector->top_margin);
2404 2393
2405 psb_intel_sdvo_connector->bottom = 2394 psb_intel_sdvo_connector->bottom =
2406 drm_property_create(dev, DRM_MODE_PROP_RANGE, 2395 drm_property_create_range(dev, 0, "bottom_margin", 0, data_value[0]);
2407 "bottom_margin", 2);
2408 if (!psb_intel_sdvo_connector->bottom) 2396 if (!psb_intel_sdvo_connector->bottom)
2409 return false; 2397 return false;
2410 2398
2411 psb_intel_sdvo_connector->bottom->values[0] = 0;
2412 psb_intel_sdvo_connector->bottom->values[1] = data_value[0];
2413 drm_connector_attach_property(connector, 2399 drm_connector_attach_property(connector,
2414 psb_intel_sdvo_connector->bottom, 2400 psb_intel_sdvo_connector->bottom,
2415 psb_intel_sdvo_connector->bottom_margin); 2401 psb_intel_sdvo_connector->bottom_margin);
@@ -2438,12 +2424,10 @@ psb_intel_sdvo_create_enhance_property_tv(struct psb_intel_sdvo *psb_intel_sdvo,
2438 psb_intel_sdvo_connector->max_dot_crawl = 1; 2424 psb_intel_sdvo_connector->max_dot_crawl = 1;
2439 psb_intel_sdvo_connector->cur_dot_crawl = response & 0x1; 2425 psb_intel_sdvo_connector->cur_dot_crawl = response & 0x1;
2440 psb_intel_sdvo_connector->dot_crawl = 2426 psb_intel_sdvo_connector->dot_crawl =
2441 drm_property_create(dev, DRM_MODE_PROP_RANGE, "dot_crawl", 2); 2427 drm_property_create_range(dev, 0, "dot_crawl", 0, 1);
2442 if (!psb_intel_sdvo_connector->dot_crawl) 2428 if (!psb_intel_sdvo_connector->dot_crawl)
2443 return false; 2429 return false;
2444 2430
2445 psb_intel_sdvo_connector->dot_crawl->values[0] = 0;
2446 psb_intel_sdvo_connector->dot_crawl->values[1] = 1;
2447 drm_connector_attach_property(connector, 2431 drm_connector_attach_property(connector,
2448 psb_intel_sdvo_connector->dot_crawl, 2432 psb_intel_sdvo_connector->dot_crawl,
2449 psb_intel_sdvo_connector->cur_dot_crawl); 2433 psb_intel_sdvo_connector->cur_dot_crawl);
diff --git a/drivers/gpu/drm/i2c/ch7006_drv.c b/drivers/gpu/drm/i2c/ch7006_drv.c
index 07d55df6623e..d3f2e8785010 100644
--- a/drivers/gpu/drm/i2c/ch7006_drv.c
+++ b/drivers/gpu/drm/i2c/ch7006_drv.c
@@ -252,10 +252,7 @@ static int ch7006_encoder_create_resources(struct drm_encoder *encoder,
252 252
253 drm_mode_create_tv_properties(dev, NUM_TV_NORMS, ch7006_tv_norm_names); 253 drm_mode_create_tv_properties(dev, NUM_TV_NORMS, ch7006_tv_norm_names);
254 254
255 priv->scale_property = drm_property_create(dev, DRM_MODE_PROP_RANGE, 255 priv->scale_property = drm_property_create_range(dev, 0, "scale", 0, 2);
256 "scale", 2);
257 priv->scale_property->values[0] = 0;
258 priv->scale_property->values[1] = 2;
259 256
260 drm_connector_attach_property(connector, conf->tv_select_subconnector_property, 257 drm_connector_attach_property(connector, conf->tv_select_subconnector_property,
261 priv->select_subconnector); 258 priv->select_subconnector);
diff --git a/drivers/gpu/drm/i915/intel_sdvo.c b/drivers/gpu/drm/i915/intel_sdvo.c
index e334ec33a47d..80acc3f241ef 100644
--- a/drivers/gpu/drm/i915/intel_sdvo.c
+++ b/drivers/gpu/drm/i915/intel_sdvo.c
@@ -2277,10 +2277,8 @@ static bool intel_sdvo_tv_create_property(struct intel_sdvo *intel_sdvo,
2277 intel_sdvo_connector->max_##name = data_value[0]; \ 2277 intel_sdvo_connector->max_##name = data_value[0]; \
2278 intel_sdvo_connector->cur_##name = response; \ 2278 intel_sdvo_connector->cur_##name = response; \
2279 intel_sdvo_connector->name = \ 2279 intel_sdvo_connector->name = \
2280 drm_property_create(dev, DRM_MODE_PROP_RANGE, #name, 2); \ 2280 drm_property_create_range(dev, 0, #name, 0, data_value[0]); \
2281 if (!intel_sdvo_connector->name) return false; \ 2281 if (!intel_sdvo_connector->name) return false; \
2282 intel_sdvo_connector->name->values[0] = 0; \
2283 intel_sdvo_connector->name->values[1] = data_value[0]; \
2284 drm_connector_attach_property(connector, \ 2282 drm_connector_attach_property(connector, \
2285 intel_sdvo_connector->name, \ 2283 intel_sdvo_connector->name, \
2286 intel_sdvo_connector->cur_##name); \ 2284 intel_sdvo_connector->cur_##name); \
@@ -2314,25 +2312,19 @@ intel_sdvo_create_enhance_property_tv(struct intel_sdvo *intel_sdvo,
2314 intel_sdvo_connector->left_margin = data_value[0] - response; 2312 intel_sdvo_connector->left_margin = data_value[0] - response;
2315 intel_sdvo_connector->right_margin = intel_sdvo_connector->left_margin; 2313 intel_sdvo_connector->right_margin = intel_sdvo_connector->left_margin;
2316 intel_sdvo_connector->left = 2314 intel_sdvo_connector->left =
2317 drm_property_create(dev, DRM_MODE_PROP_RANGE, 2315 drm_property_create_range(dev, 0, "left_margin", 0, data_value[0]);
2318 "left_margin", 2);
2319 if (!intel_sdvo_connector->left) 2316 if (!intel_sdvo_connector->left)
2320 return false; 2317 return false;
2321 2318
2322 intel_sdvo_connector->left->values[0] = 0;
2323 intel_sdvo_connector->left->values[1] = data_value[0];
2324 drm_connector_attach_property(connector, 2319 drm_connector_attach_property(connector,
2325 intel_sdvo_connector->left, 2320 intel_sdvo_connector->left,
2326 intel_sdvo_connector->left_margin); 2321 intel_sdvo_connector->left_margin);
2327 2322
2328 intel_sdvo_connector->right = 2323 intel_sdvo_connector->right =
2329 drm_property_create(dev, DRM_MODE_PROP_RANGE, 2324 drm_property_create_range(dev, 0, "right_margin", 0, data_value[0]);
2330 "right_margin", 2);
2331 if (!intel_sdvo_connector->right) 2325 if (!intel_sdvo_connector->right)
2332 return false; 2326 return false;
2333 2327
2334 intel_sdvo_connector->right->values[0] = 0;
2335 intel_sdvo_connector->right->values[1] = data_value[0];
2336 drm_connector_attach_property(connector, 2328 drm_connector_attach_property(connector,
2337 intel_sdvo_connector->right, 2329 intel_sdvo_connector->right,
2338 intel_sdvo_connector->right_margin); 2330 intel_sdvo_connector->right_margin);
@@ -2356,25 +2348,21 @@ intel_sdvo_create_enhance_property_tv(struct intel_sdvo *intel_sdvo,
2356 intel_sdvo_connector->top_margin = data_value[0] - response; 2348 intel_sdvo_connector->top_margin = data_value[0] - response;
2357 intel_sdvo_connector->bottom_margin = intel_sdvo_connector->top_margin; 2349 intel_sdvo_connector->bottom_margin = intel_sdvo_connector->top_margin;
2358 intel_sdvo_connector->top = 2350 intel_sdvo_connector->top =
2359 drm_property_create(dev, DRM_MODE_PROP_RANGE, 2351 drm_property_create_range(dev, 0,
2360 "top_margin", 2); 2352 "top_margin", 0, data_value[0]);
2361 if (!intel_sdvo_connector->top) 2353 if (!intel_sdvo_connector->top)
2362 return false; 2354 return false;
2363 2355
2364 intel_sdvo_connector->top->values[0] = 0;
2365 intel_sdvo_connector->top->values[1] = data_value[0];
2366 drm_connector_attach_property(connector, 2356 drm_connector_attach_property(connector,
2367 intel_sdvo_connector->top, 2357 intel_sdvo_connector->top,
2368 intel_sdvo_connector->top_margin); 2358 intel_sdvo_connector->top_margin);
2369 2359
2370 intel_sdvo_connector->bottom = 2360 intel_sdvo_connector->bottom =
2371 drm_property_create(dev, DRM_MODE_PROP_RANGE, 2361 drm_property_create_range(dev, 0,
2372 "bottom_margin", 2); 2362 "bottom_margin", 0, data_value[0]);
2373 if (!intel_sdvo_connector->bottom) 2363 if (!intel_sdvo_connector->bottom)
2374 return false; 2364 return false;
2375 2365
2376 intel_sdvo_connector->bottom->values[0] = 0;
2377 intel_sdvo_connector->bottom->values[1] = data_value[0];
2378 drm_connector_attach_property(connector, 2366 drm_connector_attach_property(connector,
2379 intel_sdvo_connector->bottom, 2367 intel_sdvo_connector->bottom,
2380 intel_sdvo_connector->bottom_margin); 2368 intel_sdvo_connector->bottom_margin);
@@ -2403,12 +2391,10 @@ intel_sdvo_create_enhance_property_tv(struct intel_sdvo *intel_sdvo,
2403 intel_sdvo_connector->max_dot_crawl = 1; 2391 intel_sdvo_connector->max_dot_crawl = 1;
2404 intel_sdvo_connector->cur_dot_crawl = response & 0x1; 2392 intel_sdvo_connector->cur_dot_crawl = response & 0x1;
2405 intel_sdvo_connector->dot_crawl = 2393 intel_sdvo_connector->dot_crawl =
2406 drm_property_create(dev, DRM_MODE_PROP_RANGE, "dot_crawl", 2); 2394 drm_property_create_range(dev, 0, "dot_crawl", 0, 1);
2407 if (!intel_sdvo_connector->dot_crawl) 2395 if (!intel_sdvo_connector->dot_crawl)
2408 return false; 2396 return false;
2409 2397
2410 intel_sdvo_connector->dot_crawl->values[0] = 0;
2411 intel_sdvo_connector->dot_crawl->values[1] = 1;
2412 drm_connector_attach_property(connector, 2398 drm_connector_attach_property(connector,
2413 intel_sdvo_connector->dot_crawl, 2399 intel_sdvo_connector->dot_crawl,
2414 intel_sdvo_connector->cur_dot_crawl); 2400 intel_sdvo_connector->cur_dot_crawl);
diff --git a/drivers/gpu/drm/nouveau/nouveau_display.c b/drivers/gpu/drm/nouveau/nouveau_display.c
index cc94f3cbd5af..5565e5056ba1 100644
--- a/drivers/gpu/drm/nouveau/nouveau_display.c
+++ b/drivers/gpu/drm/nouveau/nouveau_display.c
@@ -281,16 +281,10 @@ nouveau_display_create(struct drm_device *dev)
281 PROP_ENUM(disp->underscan_property, gen, "underscan", underscan); 281 PROP_ENUM(disp->underscan_property, gen, "underscan", underscan);
282 282
283 disp->underscan_hborder_property = 283 disp->underscan_hborder_property =
284 drm_property_create(dev, DRM_MODE_PROP_RANGE, 284 drm_property_create_range(dev, 0, "underscan hborder", 0, 128);
285 "underscan hborder", 2);
286 disp->underscan_hborder_property->values[0] = 0;
287 disp->underscan_hborder_property->values[1] = 128;
288 285
289 disp->underscan_vborder_property = 286 disp->underscan_vborder_property =
290 drm_property_create(dev, DRM_MODE_PROP_RANGE, 287 drm_property_create_range(dev, 0, "underscan vborder", 0, 128);
291 "underscan vborder", 2);
292 disp->underscan_vborder_property->values[0] = 0;
293 disp->underscan_vborder_property->values[1] = 128;
294 288
295 dev->mode_config.funcs = (void *)&nouveau_mode_config_funcs; 289 dev->mode_config.funcs = (void *)&nouveau_mode_config_funcs;
296 dev->mode_config.fb_base = pci_resource_start(dev->pdev, 1); 290 dev->mode_config.fb_base = pci_resource_start(dev->pdev, 1);
diff --git a/drivers/gpu/drm/radeon/radeon_display.c b/drivers/gpu/drm/radeon/radeon_display.c
index 54629faf2846..5515f1054b29 100644
--- a/drivers/gpu/drm/radeon/radeon_display.c
+++ b/drivers/gpu/drm/radeon/radeon_display.c
@@ -1152,14 +1152,9 @@ static int radeon_modeset_create_props(struct radeon_device *rdev)
1152 1152
1153 if (rdev->is_atom_bios) { 1153 if (rdev->is_atom_bios) {
1154 rdev->mode_info.coherent_mode_property = 1154 rdev->mode_info.coherent_mode_property =
1155 drm_property_create(rdev->ddev, 1155 drm_property_create_range(rdev->ddev, 0 , "coherent", 0, 1);
1156 DRM_MODE_PROP_RANGE,
1157 "coherent", 2);
1158 if (!rdev->mode_info.coherent_mode_property) 1156 if (!rdev->mode_info.coherent_mode_property)
1159 return -ENOMEM; 1157 return -ENOMEM;
1160
1161 rdev->mode_info.coherent_mode_property->values[0] = 0;
1162 rdev->mode_info.coherent_mode_property->values[1] = 1;
1163 } 1158 }
1164 1159
1165 if (!ASIC_IS_AVIVO(rdev)) { 1160 if (!ASIC_IS_AVIVO(rdev)) {
@@ -1171,13 +1166,9 @@ static int radeon_modeset_create_props(struct radeon_device *rdev)
1171 } 1166 }
1172 1167
1173 rdev->mode_info.load_detect_property = 1168 rdev->mode_info.load_detect_property =
1174 drm_property_create(rdev->ddev, 1169 drm_property_create_range(rdev->ddev, 0, "load detection", 0, 1);
1175 DRM_MODE_PROP_RANGE,
1176 "load detection", 2);
1177 if (!rdev->mode_info.load_detect_property) 1170 if (!rdev->mode_info.load_detect_property)
1178 return -ENOMEM; 1171 return -ENOMEM;
1179 rdev->mode_info.load_detect_property->values[0] = 0;
1180 rdev->mode_info.load_detect_property->values[1] = 1;
1181 1172
1182 drm_mode_create_scaling_mode_property(rdev->ddev); 1173 drm_mode_create_scaling_mode_property(rdev->ddev);
1183 1174
@@ -1194,22 +1185,16 @@ static int radeon_modeset_create_props(struct radeon_device *rdev)
1194 radeon_underscan_enum_list, sz); 1185 radeon_underscan_enum_list, sz);
1195 1186
1196 rdev->mode_info.underscan_hborder_property = 1187 rdev->mode_info.underscan_hborder_property =
1197 drm_property_create(rdev->ddev, 1188 drm_property_create_range(rdev->ddev, 0,
1198 DRM_MODE_PROP_RANGE, 1189 "underscan hborder", 0, 128);
1199 "underscan hborder", 2);
1200 if (!rdev->mode_info.underscan_hborder_property) 1190 if (!rdev->mode_info.underscan_hborder_property)
1201 return -ENOMEM; 1191 return -ENOMEM;
1202 rdev->mode_info.underscan_hborder_property->values[0] = 0;
1203 rdev->mode_info.underscan_hborder_property->values[1] = 128;
1204 1192
1205 rdev->mode_info.underscan_vborder_property = 1193 rdev->mode_info.underscan_vborder_property =
1206 drm_property_create(rdev->ddev, 1194 drm_property_create_range(rdev->ddev, 0,
1207 DRM_MODE_PROP_RANGE, 1195 "underscan vborder", 0, 128);
1208 "underscan vborder", 2);
1209 if (!rdev->mode_info.underscan_vborder_property) 1196 if (!rdev->mode_info.underscan_vborder_property)
1210 return -ENOMEM; 1197 return -ENOMEM;
1211 rdev->mode_info.underscan_vborder_property->values[0] = 0;
1212 rdev->mode_info.underscan_vborder_property->values[1] = 128;
1213 1198
1214 return 0; 1199 return 0;
1215} 1200}