summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorJonathan Gray <jsg@cvs.openbsd.org>2015-04-08 03:21:14 +0000
committerJonathan Gray <jsg@cvs.openbsd.org>2015-04-08 03:21:14 +0000
commit1141ae399de1e06403651554bc05b951bea2c8a7 (patch)
treef983ac414e1d30b586c0f8986c6507ffc3db5587 /sys/dev
parent348d40200984234819c240eea6304f306a678871 (diff)
change back to using min_t
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/pci/drm/i915/intel_display.c9
-rw-r--r--sys/dev/pci/drm/i915/intel_sdvo.c8
-rw-r--r--sys/dev/pci/drm/radeon/radeon_combios.c5
3 files changed, 9 insertions, 13 deletions
diff --git a/sys/dev/pci/drm/i915/intel_display.c b/sys/dev/pci/drm/i915/intel_display.c
index 023b093afed..41bd3583725 100644
--- a/sys/dev/pci/drm/i915/intel_display.c
+++ b/sys/dev/pci/drm/i915/intel_display.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: intel_display.c,v 1.45 2015/04/06 10:03:34 jsg Exp $ */
+/* $OpenBSD: intel_display.c,v 1.46 2015/04/08 03:21:13 jsg Exp $ */
/*
* Copyright © 2006-2007 Intel Corporation
*
@@ -6168,8 +6168,7 @@ static void g4x_write_eld(struct drm_connector *connector,
if (!eld[0])
return;
- if (eld[2] < (uint8_t)len)
- len = eld[2];
+ len = min_t(uint8_t, eld[2], len);
DRM_DEBUG_DRIVER("ELD size %d\n", len);
for (i = 0; i < len; i++)
I915_WRITE(G4X_HDMIW_HDMIEDID, *((uint32_t *)eld + i));
@@ -6253,7 +6252,7 @@ static void haswell_write_eld(struct drm_connector *connector,
i = (i >> 29) & DIP_PORT_SEL_MASK; /* DIP_Port_Select, 0x1 = PortB */
DRM_DEBUG_DRIVER("port num:%d\n", i);
- len = eld[2] < 21 ? eld[2] : 21; /* 84 bytes of hw ELD buffer */
+ len = min_t(uint8_t, eld[2], 21); /* 84 bytes of hw ELD buffer */
DRM_DEBUG_DRIVER("ELD size %d\n", len);
for (i = 0; i < len; i++)
I915_WRITE(hdmiw_hdmiedid, *((uint32_t *)eld + i));
@@ -6329,7 +6328,7 @@ static void ironlake_write_eld(struct drm_connector *connector,
i &= ~IBX_ELD_ADDRESS;
I915_WRITE(aud_cntl_st, i);
- len = eld[2] < 21 ? eld[2] : 21; /* 84 bytes of hw ELD buffer */
+ len = min_t(uint8_t, eld[2], 21); /* 84 bytes of hw ELD buffer */
DRM_DEBUG_DRIVER("ELD size %d\n", len);
for (i = 0; i < len; i++)
I915_WRITE(hdmiw_hdmiedid, *((uint32_t *)eld + i));
diff --git a/sys/dev/pci/drm/i915/intel_sdvo.c b/sys/dev/pci/drm/i915/intel_sdvo.c
index f6e51c16d14..b25955bca13 100644
--- a/sys/dev/pci/drm/i915/intel_sdvo.c
+++ b/sys/dev/pci/drm/i915/intel_sdvo.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: intel_sdvo.c,v 1.17 2015/04/06 12:25:10 jsg Exp $ */
+/* $OpenBSD: intel_sdvo.c,v 1.18 2015/04/08 03:21:13 jsg Exp $ */
/*
* Copyright 2006 Dave Airlie <airlied@linux.ie>
* Copyright © 2006-2007 Intel Corporation
@@ -931,10 +931,8 @@ static bool intel_sdvo_write_infoframe(struct intel_sdvo *intel_sdvo,
for (i = 0; i < hbuf_size; i += 8) {
memset(tmp, 0, 8);
- if (i < length) {
- unsigned min = 8 < length - i ? 8 : length - i;
- memcpy(tmp, data + i, min);
- }
+ if (i < length)
+ memcpy(tmp, data + i, min_t(unsigned, 8, length - i));
if (!intel_sdvo_set_value(intel_sdvo,
SDVO_CMD_SET_HBUF_DATA,
diff --git a/sys/dev/pci/drm/radeon/radeon_combios.c b/sys/dev/pci/drm/radeon/radeon_combios.c
index 2a8a064d3d2..1171892b1b5 100644
--- a/sys/dev/pci/drm/radeon/radeon_combios.c
+++ b/sys/dev/pci/drm/radeon/radeon_combios.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: radeon_combios.c,v 1.6 2015/02/11 07:01:37 jsg Exp $ */
+/* $OpenBSD: radeon_combios.c,v 1.7 2015/04/08 03:21:13 jsg Exp $ */
/*
* Copyright 2004 ATI Technologies Inc., Markham, Ontario
* Copyright 2007-8 Advanced Micro Devices, Inc.
@@ -1211,8 +1211,7 @@ struct radeon_encoder_lvds *radeon_combios_get_lvds_info(struct radeon_encoder
lvds->native_mode.vdisplay);
lvds->panel_vcc_delay = RBIOS16(lcd_info + 0x2c);
- if (2000 < lvds->panel_vcc_delay)
- lvds->panel_vcc_delay = 2000;
+ lvds->panel_vcc_delay = min_t(u16, lvds->panel_vcc_delay, 2000);
lvds->panel_pwr_delay = RBIOS8(lcd_info + 0x24);
lvds->panel_digon_delay = RBIOS16(lcd_info + 0x38) & 0xf;