diff options
author | Jonathan Gray <jsg@cvs.openbsd.org> | 2015-04-08 03:21:14 +0000 |
---|---|---|
committer | Jonathan Gray <jsg@cvs.openbsd.org> | 2015-04-08 03:21:14 +0000 |
commit | 1141ae399de1e06403651554bc05b951bea2c8a7 (patch) | |
tree | f983ac414e1d30b586c0f8986c6507ffc3db5587 /sys/dev/pci/drm/i915 | |
parent | 348d40200984234819c240eea6304f306a678871 (diff) |
change back to using min_t
Diffstat (limited to 'sys/dev/pci/drm/i915')
-rw-r--r-- | sys/dev/pci/drm/i915/intel_display.c | 9 | ||||
-rw-r--r-- | sys/dev/pci/drm/i915/intel_sdvo.c | 8 |
2 files changed, 7 insertions, 10 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, |