[PATCH 7/9] modesetting: Return the output created in drmmode_output_init()

Daniel Martin daniel.martin at secunet.com
Mon Dec 8 03:03:06 PST 2014


From: Daniel Martin <consume.noise at gmail.com>

So, we can re-use the function for output hotplugging later.

Signed-off-by: Daniel Martin <consume.noise at gmail.com>
Reviewed-by: Keith Packard <keithp at keithp.com>
---
 hw/xfree86/drivers/modesetting/drmmode_display.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/hw/xfree86/drivers/modesetting/drmmode_display.c b/hw/xfree86/drivers/modesetting/drmmode_display.c
index f1ef9bc..ea701f1 100644
--- a/hw/xfree86/drivers/modesetting/drmmode_display.c
+++ b/hw/xfree86/drivers/modesetting/drmmode_display.c
@@ -1023,10 +1023,10 @@ static const char *const output_names[] = {
     "DSI",
 };
 
-static void
+static xf86OutputPtr
 drmmode_output_init(ScrnInfoPtr pScrn, drmmode_ptr drmmode, int num)
 {
-    xf86OutputPtr output;
+    xf86OutputPtr output = NULL;
     drmModeConnectorPtr koutput;
     drmModeEncoderPtr *kencoders = NULL;
     drmmode_output_private_ptr drmmode_output;
@@ -1037,7 +1037,7 @@ drmmode_output_init(ScrnInfoPtr pScrn, drmmode_ptr drmmode, int num)
     koutput =
         drmModeGetConnector(drmmode->fd, drmmode->mode_res->connectors[num]);
     if (!koutput)
-        return;
+        return NULL;
 
     kencoders = calloc(sizeof(drmModeEncoderPtr), koutput->count_encoders);
     if (!kencoders) {
@@ -1104,7 +1104,7 @@ drmmode_output_init(ScrnInfoPtr pScrn, drmmode_ptr drmmode, int num)
         }
     }
 
-    return;
+    return output;
  out_free_encoders:
     if (kencoders) {
         for (i = 0; i < koutput->count_encoders; i++)
@@ -1113,6 +1113,7 @@ drmmode_output_init(ScrnInfoPtr pScrn, drmmode_ptr drmmode, int num)
     }
     drmModeFreeConnector(koutput);
 
+    return NULL;
 }
 
 static uint32_t
-- 
2.1.3



More information about the xorg-devel mailing list