Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm: Add drm/drm_util.h header file

We have a bunch of neat little macros all over the place which should
move to kernel.h. But some of them died in bikesheds on lkml, and we
need a decent home for them.

Start out by moving the for_each_if macro there.

v2: Rename to drm_util.h instead (Dave&Sean)

Cc: Sean Paul <seanpaul@chromium.org>
Acked-by: Sean Paul <seanpaul@chromium.org>
Cc: Dave Airlie <airlied@gmail.com>
Acked-by: Dave Airlie <airlied@gmail.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20180905135711.28370-1-daniel.vetter@ffwll.ch

+44 -3
+1
drivers/gpu/drm/i915/i915_drv.h
··· 52 52 #include <drm/drm_gem.h> 53 53 #include <drm/drm_auth.h> 54 54 #include <drm/drm_cache.h> 55 + #include <drm/drm_util.h> 55 56 56 57 #include "i915_params.h" 57 58 #include "i915_reg.h"
+2
drivers/gpu/drm/i915/intel_display.h
··· 25 25 #ifndef _INTEL_DISPLAY_H_ 26 26 #define _INTEL_DISPLAY_H_ 27 27 28 + #include <drm/drm_util.h> 29 + 28 30 enum pipe { 29 31 INVALID_PIPE = -1, 30 32
+2
drivers/gpu/drm/i915/intel_ringbuffer.h
··· 2 2 #ifndef _INTEL_RINGBUFFER_H_ 3 3 #define _INTEL_RINGBUFFER_H_ 4 4 5 + #include <drm/drm_util.h> 6 + 5 7 #include <linux/hashtable.h> 6 8 #include <linux/seqlock.h> 7 9
+2
drivers/gpu/drm/nouveau/nouveau_connector.h
··· 32 32 #include <drm/drm_edid.h> 33 33 #include <drm/drm_encoder.h> 34 34 #include <drm/drm_dp_helper.h> 35 + #include <drm/drm_util.h> 36 + 35 37 #include "nouveau_crtc.h" 36 38 #include "nouveau_encoder.h" 37 39
-3
include/drm/drmP.h
··· 110 110 return true; 111 111 } 112 112 113 - /* helper for handling conditionals in various for_each macros */ 114 - #define for_each_if(condition) if (!(condition)) {} else 115 - 116 113 #endif
+1
include/drm/drm_atomic.h
··· 29 29 #define DRM_ATOMIC_H_ 30 30 31 31 #include <drm/drm_crtc.h> 32 + #include <drm/drm_util.h> 32 33 33 34 /** 34 35 * struct drm_crtc_commit - track modeset commits on a CRTC
+1
include/drm/drm_atomic_helper.h
··· 31 31 #include <drm/drm_crtc.h> 32 32 #include <drm/drm_modeset_helper_vtables.h> 33 33 #include <drm/drm_modeset_helper.h> 34 + #include <drm/drm_util.h> 34 35 35 36 struct drm_atomic_state; 36 37 struct drm_private_obj;
+1
include/drm/drm_connector.h
··· 28 28 #include <linux/ctype.h> 29 29 #include <linux/hdmi.h> 30 30 #include <drm/drm_mode_object.h> 31 + #include <drm/drm_util.h> 31 32 32 33 #include <uapi/drm/drm_mode.h> 33 34
+1
include/drm/drm_encoder.h
··· 28 28 #include <drm/drm_crtc.h> 29 29 #include <drm/drm_mode.h> 30 30 #include <drm/drm_mode_object.h> 31 + #include <drm/drm_util.h> 31 32 32 33 struct drm_encoder; 33 34
+1
include/drm/drm_plane.h
··· 27 27 #include <linux/ctype.h> 28 28 #include <drm/drm_mode_object.h> 29 29 #include <drm/drm_color_mgmt.h> 30 + #include <drm/drm_util.h> 30 31 31 32 struct drm_crtc; 32 33 struct drm_printer;
+32
include/drm/drm_util.h
··· 1 + /* 2 + * Internal Header for the Direct Rendering Manager 3 + * 4 + * Copyright 2018 Intel Corporation 5 + * 6 + * Permission is hereby granted, free of charge, to any person obtaining a 7 + * copy of this software and associated documentation files (the "Software"), 8 + * to deal in the Software without restriction, including without limitation 9 + * the rights to use, copy, modify, merge, publish, distribute, sublicense, 10 + * and/or sell copies of the Software, and to permit persons to whom the 11 + * Software is furnished to do so, subject to the following conditions: 12 + * 13 + * The above copyright notice and this permission notice (including the next 14 + * paragraph) shall be included in all copies or substantial portions of the 15 + * Software. 16 + * 17 + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 20 + * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR 21 + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 22 + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 + * OTHER DEALINGS IN THE SOFTWARE. 24 + */ 25 + 26 + #ifndef _DRM_UTIL_H_ 27 + #define _DRM_UTIL_H_ 28 + 29 + /* helper for handling conditionals in various for_each macros */ 30 + #define for_each_if(condition) if (!(condition)) {} else 31 + 32 + #endif