[PATCH] xf86i2c: add pscrn for drivers to use

Dave Airlie airlied at gmail.com
Wed May 23 23:28:24 PDT 2012


From: Dave Airlie <airlied at redhat.com>

This just adds a pScrn pointer into the struct for the drivers to use
instead of scrnIndex. Mostly scrnIndex is used for logging, but some
drivers use it to lookup xf86Screens, so let them stash a pScrn instead.

Removing the scrnIndex is a bit more involved and I'm not sure its worth
the effort. Doing i2c in the X server is legacy code as far as I'm concerned.

Signed-off-by: Dave Airlie <airlied at redhat.com>
---
 hw/xfree86/i2c/xf86i2c.c |    1 +
 hw/xfree86/i2c/xf86i2c.h |    2 ++
 2 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/hw/xfree86/i2c/xf86i2c.c b/hw/xfree86/i2c/xf86i2c.c
index 1273f4b..2d261d4 100644
--- a/hw/xfree86/i2c/xf86i2c.c
+++ b/hw/xfree86/i2c/xf86i2c.c
@@ -709,6 +709,7 @@ xf86CreateI2CBusRec(void)
 
     if (b != NULL) {
         b->scrnIndex = -1;
+        b->pScrn = NULL;
         b->HoldTime = 5;        /* 100 kHz bus */
         b->BitTimeout = 5;
         b->ByteTimeout = 5;
diff --git a/hw/xfree86/i2c/xf86i2c.h b/hw/xfree86/i2c/xf86i2c.h
index 9a8fb21..e296d7d 100644
--- a/hw/xfree86/i2c/xf86i2c.h
+++ b/hw/xfree86/i2c/xf86i2c.h
@@ -6,6 +6,7 @@
 #define _XF86I2C_H
 
 #include "regionstr.h"
+#include "xf86.h"
 
 typedef unsigned char I2CByte;
 typedef unsigned short I2CSlaveAddr;
@@ -18,6 +19,7 @@ typedef struct _I2CDevRec *I2CDevPtr;
 typedef struct _I2CBusRec {
     char *BusName;
     int scrnIndex;
+    ScrnInfoPtr pScrn;
 
     void (*I2CUDelay) (I2CBusPtr b, int usec);
 
-- 
1.7.6



More information about the xorg-devel mailing list