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

amdgpu/dc: inline dal grph object id functions.

This is worth 400 bytes.

Signed-off-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

authored by

Dave Airlie and committed by
Alex Deucher
48aa3ddf d8c893b4

+55 -76
+1 -60
drivers/gpu/drm/amd/display/dc/basics/grph_object_id.c
··· 26 26 #include "dm_services.h" 27 27 #include "include/grph_object_id.h" 28 28 29 - bool dal_graphics_object_id_is_valid(struct graphics_object_id id) 29 + static bool dal_graphics_object_id_is_valid(struct graphics_object_id id) 30 30 { 31 31 bool rc = true; 32 32 ··· 72 72 return false; 73 73 } 74 74 75 - /* Based on internal data members memory layout */ 76 - uint32_t dal_graphics_object_id_to_uint(struct graphics_object_id id) 77 - { 78 - uint32_t object_id = 0; 79 - 80 - object_id = id.id + (id.enum_id << 0x8) + (id.type << 0xc); 81 - return object_id; 82 - } 83 - 84 - /* 85 - * ******* get specific ID - internal safe cast into specific type ******* 86 - */ 87 - 88 - enum controller_id dal_graphics_object_id_get_controller_id( 89 - struct graphics_object_id id) 90 - { 91 - if (id.type == OBJECT_TYPE_CONTROLLER) 92 - return id.id; 93 - return CONTROLLER_ID_UNDEFINED; 94 - } 95 - 96 - enum clock_source_id dal_graphics_object_id_get_clock_source_id( 97 - struct graphics_object_id id) 98 - { 99 - if (id.type == OBJECT_TYPE_CLOCK_SOURCE) 100 - return id.id; 101 - return CLOCK_SOURCE_ID_UNDEFINED; 102 - } 103 - 104 - enum encoder_id dal_graphics_object_id_get_encoder_id( 105 - struct graphics_object_id id) 106 - { 107 - if (id.type == OBJECT_TYPE_ENCODER) 108 - return id.id; 109 - return ENCODER_ID_UNKNOWN; 110 - } 111 - 112 - enum connector_id dal_graphics_object_id_get_connector_id( 113 - struct graphics_object_id id) 114 - { 115 - if (id.type == OBJECT_TYPE_CONNECTOR) 116 - return id.id; 117 - return CONNECTOR_ID_UNKNOWN; 118 - } 119 - 120 - enum audio_id dal_graphics_object_id_get_audio_id(struct graphics_object_id id) 121 - { 122 - if (id.type == OBJECT_TYPE_AUDIO) 123 - return id.id; 124 - return AUDIO_ID_UNKNOWN; 125 - } 126 - 127 - enum engine_id dal_graphics_object_id_get_engine_id( 128 - struct graphics_object_id id) 129 - { 130 - if (id.type == OBJECT_TYPE_ENGINE) 131 - return id.id; 132 - return ENGINE_ID_UNKNOWN; 133 - } 134 75
+54 -16
drivers/gpu/drm/amd/display/include/grph_object_id.h
··· 233 233 return result; 234 234 } 235 235 236 - bool dal_graphics_object_id_is_valid( 237 - struct graphics_object_id id); 238 236 bool dal_graphics_object_id_is_equal( 239 237 struct graphics_object_id id1, 240 238 struct graphics_object_id id2); 241 - uint32_t dal_graphics_object_id_to_uint( 242 - struct graphics_object_id id); 243 239 244 - enum controller_id dal_graphics_object_id_get_controller_id( 245 - struct graphics_object_id id); 246 - enum clock_source_id dal_graphics_object_id_get_clock_source_id( 247 - struct graphics_object_id id); 248 - enum encoder_id dal_graphics_object_id_get_encoder_id( 249 - struct graphics_object_id id); 250 - enum connector_id dal_graphics_object_id_get_connector_id( 251 - struct graphics_object_id id); 252 - enum audio_id dal_graphics_object_id_get_audio_id( 253 - struct graphics_object_id id); 254 - enum engine_id dal_graphics_object_id_get_engine_id( 255 - struct graphics_object_id id); 240 + /* Based on internal data members memory layout */ 241 + static inline uint32_t dal_graphics_object_id_to_uint( 242 + struct graphics_object_id id) 243 + { 244 + return id.id + (id.enum_id << 0x8) + (id.type << 0xc); 245 + } 246 + 247 + static inline enum controller_id dal_graphics_object_id_get_controller_id( 248 + struct graphics_object_id id) 249 + { 250 + if (id.type == OBJECT_TYPE_CONTROLLER) 251 + return id.id; 252 + return CONTROLLER_ID_UNDEFINED; 253 + } 254 + 255 + static inline enum clock_source_id dal_graphics_object_id_get_clock_source_id( 256 + struct graphics_object_id id) 257 + { 258 + if (id.type == OBJECT_TYPE_CLOCK_SOURCE) 259 + return id.id; 260 + return CLOCK_SOURCE_ID_UNDEFINED; 261 + } 262 + 263 + static inline enum encoder_id dal_graphics_object_id_get_encoder_id( 264 + struct graphics_object_id id) 265 + { 266 + if (id.type == OBJECT_TYPE_ENCODER) 267 + return id.id; 268 + return ENCODER_ID_UNKNOWN; 269 + } 270 + 271 + static inline enum connector_id dal_graphics_object_id_get_connector_id( 272 + struct graphics_object_id id) 273 + { 274 + if (id.type == OBJECT_TYPE_CONNECTOR) 275 + return id.id; 276 + return CONNECTOR_ID_UNKNOWN; 277 + } 278 + 279 + static inline enum audio_id dal_graphics_object_id_get_audio_id( 280 + struct graphics_object_id id) 281 + { 282 + if (id.type == OBJECT_TYPE_AUDIO) 283 + return id.id; 284 + return AUDIO_ID_UNKNOWN; 285 + } 286 + 287 + static inline enum engine_id dal_graphics_object_id_get_engine_id( 288 + struct graphics_object_id id) 289 + { 290 + if (id.type == OBJECT_TYPE_ENGINE) 291 + return id.id; 292 + return ENGINE_ID_UNKNOWN; 293 + } 256 294 #endif