amdgpu/dc: inline dal grph object id functions.
authorDave Airlie <airlied@redhat.com>
Tue, 3 Oct 2017 02:36:54 +0000 (12:36 +1000)
committerAlex Deucher <alexander.deucher@amd.com>
Fri, 6 Oct 2017 16:58:50 +0000 (12:58 -0400)
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>
drivers/gpu/drm/amd/display/dc/basics/grph_object_id.c
drivers/gpu/drm/amd/display/include/grph_object_id.h

index 9c80847d03a9a7e2193707e12907b4b853151d7b..147822545252ed129c694aa5e7bf870aab4955f2 100644 (file)
@@ -26,7 +26,7 @@
 #include "dm_services.h"
 #include "include/grph_object_id.h"
 
-bool dal_graphics_object_id_is_valid(struct graphics_object_id id)
+static bool dal_graphics_object_id_is_valid(struct graphics_object_id id)
 {
        bool rc = true;
 
@@ -72,63 +72,4 @@ bool dal_graphics_object_id_is_equal(
        return false;
 }
 
-/* Based on internal data members memory layout */
-uint32_t dal_graphics_object_id_to_uint(struct graphics_object_id id)
-{
-       uint32_t object_id = 0;
-
-       object_id = id.id + (id.enum_id << 0x8) + (id.type << 0xc);
-       return object_id;
-}
-
-/*
- * ******* get specific ID - internal safe cast into specific type *******
- */
-
-enum controller_id dal_graphics_object_id_get_controller_id(
-       struct graphics_object_id id)
-{
-       if (id.type == OBJECT_TYPE_CONTROLLER)
-               return id.id;
-       return CONTROLLER_ID_UNDEFINED;
-}
-
-enum clock_source_id dal_graphics_object_id_get_clock_source_id(
-       struct graphics_object_id id)
-{
-       if (id.type == OBJECT_TYPE_CLOCK_SOURCE)
-               return id.id;
-       return CLOCK_SOURCE_ID_UNDEFINED;
-}
-
-enum encoder_id dal_graphics_object_id_get_encoder_id(
-       struct graphics_object_id id)
-{
-       if (id.type == OBJECT_TYPE_ENCODER)
-               return id.id;
-       return ENCODER_ID_UNKNOWN;
-}
-
-enum connector_id dal_graphics_object_id_get_connector_id(
-       struct graphics_object_id id)
-{
-       if (id.type == OBJECT_TYPE_CONNECTOR)
-               return id.id;
-       return CONNECTOR_ID_UNKNOWN;
-}
-
-enum audio_id dal_graphics_object_id_get_audio_id(struct graphics_object_id id)
-{
-       if (id.type == OBJECT_TYPE_AUDIO)
-               return id.id;
-       return AUDIO_ID_UNKNOWN;
-}
-
-enum engine_id dal_graphics_object_id_get_engine_id(
-       struct graphics_object_id id)
-{
-       if (id.type == OBJECT_TYPE_ENGINE)
-               return id.id;
-       return ENGINE_ID_UNKNOWN;
-}
 
index e4aa4ddf9d2a55da4df1b040b5d25a70b89d0bfb..5eb2b4dc7b9c2bec9edbb5b9b338bd2192405744 100644 (file)
@@ -233,24 +233,62 @@ static inline struct graphics_object_id dal_graphics_object_id_init(
        return result;
 }
 
-bool dal_graphics_object_id_is_valid(
-       struct graphics_object_id id);
 bool dal_graphics_object_id_is_equal(
        struct graphics_object_id id1,
        struct graphics_object_id id2);
-uint32_t dal_graphics_object_id_to_uint(
-       struct graphics_object_id id);
-
-enum controller_id dal_graphics_object_id_get_controller_id(
-       struct graphics_object_id id);
-enum clock_source_id dal_graphics_object_id_get_clock_source_id(
-       struct graphics_object_id id);
-enum encoder_id dal_graphics_object_id_get_encoder_id(
-       struct graphics_object_id id);
-enum connector_id dal_graphics_object_id_get_connector_id(
-       struct graphics_object_id id);
-enum audio_id dal_graphics_object_id_get_audio_id(
-       struct graphics_object_id id);
-enum engine_id dal_graphics_object_id_get_engine_id(
-       struct graphics_object_id id);
+
+/* Based on internal data members memory layout */
+static inline uint32_t dal_graphics_object_id_to_uint(
+       struct graphics_object_id id)
+{
+       return id.id + (id.enum_id << 0x8) + (id.type << 0xc);
+}
+
+static inline enum controller_id dal_graphics_object_id_get_controller_id(
+       struct graphics_object_id id)
+{
+       if (id.type == OBJECT_TYPE_CONTROLLER)
+               return id.id;
+       return CONTROLLER_ID_UNDEFINED;
+}
+
+static inline enum clock_source_id dal_graphics_object_id_get_clock_source_id(
+       struct graphics_object_id id)
+{
+       if (id.type == OBJECT_TYPE_CLOCK_SOURCE)
+               return id.id;
+       return CLOCK_SOURCE_ID_UNDEFINED;
+}
+
+static inline enum encoder_id dal_graphics_object_id_get_encoder_id(
+       struct graphics_object_id id)
+{
+       if (id.type == OBJECT_TYPE_ENCODER)
+               return id.id;
+       return ENCODER_ID_UNKNOWN;
+}
+
+static inline enum connector_id dal_graphics_object_id_get_connector_id(
+       struct graphics_object_id id)
+{
+       if (id.type == OBJECT_TYPE_CONNECTOR)
+               return id.id;
+       return CONNECTOR_ID_UNKNOWN;
+}
+
+static inline enum audio_id dal_graphics_object_id_get_audio_id(
+       struct graphics_object_id id)
+{
+       if (id.type == OBJECT_TYPE_AUDIO)
+               return id.id;
+       return AUDIO_ID_UNKNOWN;
+}
+
+static inline enum engine_id dal_graphics_object_id_get_engine_id(
+       struct graphics_object_id id)
+{
+       if (id.type == OBJECT_TYPE_ENGINE)
+               return id.id;
+       return ENGINE_ID_UNKNOWN;
+}
 #endif