[PATCH xf86-video-cirrus] Tab to spaces conversion for lg_i2c.c
Signed-off-by: Kevin Brace --- src/lg_i2c.c | 108 ++- 1 file changed, 56 insertions(+), 52 deletions(-) diff --git a/src/lg_i2c.c b/src/lg_i2c.c index 3e8c962..b6fcc28 100644 --- a/src/lg_i2c.c +++ b/src/lg_i2c.c @@ -17,80 +17,84 @@ #include "lg.h" static void -LgI2CPutBits(I2CBusPtr b, int clock, int data) +LgI2CPutBits(I2CBusPtr b, int clock, int data) { - unsigned int regval, regno; - CirPtr pCir = ((CirPtr)b->DriverPrivate.ptr); - if (b == pCir->I2CPtr1) - regno = 0x280; - else if (b == pCir->I2CPtr2) - regno = 0x282; - else - return; - - regval = 0xff7e; - if (clock) regval |= 0x0080; - if (data) regval |= 0x0001; - memww(regno, regval); - /* ErrorF("LgI2CPutBits: %d %d\n", clock, data); */ +unsigned int regval, regno; +CirPtr pCir = ((CirPtr) b->DriverPrivate.ptr); +if (b == pCir->I2CPtr1) +regno = 0x280; +else if (b == pCir->I2CPtr2) +regno = 0x282; +else +return; + +regval = 0xff7e; +if (clock) +regval |= 0x0080; +if (data) +regval |= 0x0001; +memww(regno, regval); +/* ErrorF("LgI2CPutBits: %d %d\n", clock, data); */ } static void LgI2CGetBits(I2CBusPtr b, int *clock, int *data) { - unsigned int regval, regno; - CirPtr pCir = ((CirPtr)b->DriverPrivate.ptr); - if (b == pCir->I2CPtr1) - regno = 0x280; - else if (b == pCir->I2CPtr2) - regno = 0x282; - else - return; - - regval = memrw(regno); - *clock = (regval & 0x8000) != 0; - *data = (regval & 0x0100) != 0; - /* ErrorF("LgI2CGetBits: %d %d\n", *clock, *data); */ +unsigned int regval, regno; +CirPtr pCir = ((CirPtr) b->DriverPrivate.ptr); +if (b == pCir->I2CPtr1) +regno = 0x280; +else if (b == pCir->I2CPtr2) +regno = 0x282; +else +return; + +regval = memrw(regno); +*clock = (regval & 0x8000) != 0; +*data = (regval & 0x0100) != 0; +/* ErrorF("LgI2CGetBits: %d %d\n", *clock, *data); */ } Bool LgI2CInit(ScrnInfoPtr pScrn) { - CirPtr pCir = CIRPTR(pScrn); - I2CBusPtr I2CPtr; +CirPtr pCir = CIRPTR(pScrn); +I2CBusPtr I2CPtr; #ifdef LG_DEBUG - ErrorF("LgI2CInit\n"); +ErrorF("LgI2CInit\n"); #endif - I2CPtr = xf86CreateI2CBusRec(); - if (!I2CPtr) return FALSE; +I2CPtr = xf86CreateI2CBusRec(); +if (!I2CPtr) +return FALSE; - pCir->I2CPtr1 = I2CPtr; +pCir->I2CPtr1 = I2CPtr; - I2CPtr->BusName = "I2C bus 1"; - I2CPtr->scrnIndex = pScrn->scrnIndex; - I2CPtr->I2CPutBits = LgI2CPutBits; - I2CPtr->I2CGetBits = LgI2CGetBits; - I2CPtr->DriverPrivate.ptr = pCir; +I2CPtr->BusName = "I2C bus 1"; +I2CPtr->scrnIndex = pScrn->scrnIndex; +I2CPtr->I2CPutBits = LgI2CPutBits; +I2CPtr->I2CGetBits = LgI2CGetBits; +I2CPtr->DriverPrivate.ptr = pCir; - if (!xf86I2CBusInit(I2CPtr)) - return FALSE; +if (!xf86I2CBusInit(I2CPtr)) +return FALSE; - I2CPtr = xf86CreateI2CBusRec(); - if (!I2CPtr) return FALSE; +I2CPtr = xf86CreateI2CBusRec(); +if (!I2CPtr) +return FALSE; - pCir->I2CPtr2 = I2CPtr; +pCir->I2CPtr2 = I2CPtr; - I2CPtr->BusName = "I2C bus 2"; - I2CPtr->scrnIndex = pScrn->scrnIndex; - I2CPtr->I2CPutBits = LgI2CPutBits; - I2CPtr->I2CGetBits = LgI2CGetBits; - I2CPtr->DriverPrivate.ptr = pCir; +I2CPtr->BusName = "I2C bus 2"; +I2CPtr->scrnIndex = pScrn->scrnIndex; +I2CPtr->I2CPutBits = LgI2CPutBits; +I2CPtr->I2CGetBits = LgI2CGetBits; +I2CPtr->DriverPrivate.ptr = pCir; - if (!xf86I2CBusInit(I2CPtr)) - return FALSE; +if (!xf86I2CBusInit(I2CPtr)) +return FALSE; - return TRUE; +return TRUE; } -- 2.17.1 ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: https://lists.x.org/mailman/listinfo/xorg-devel
Would any Apple user be kind enough to check this trivial X server patch?
Hi. The attached patch fixes three places in hw/xquartz/darwin.c that relied on side effects in assert parameters. That is, they would fail if assert() were replaced with a macro that did not evaluate its parameters. I would appreciate it if anyone with an appropriate Apple system would try this trivial patch and let me know the results. Critiques of this patch are also welcome, of course. If I do not get a response to this in the next day or two, I expect I will submit the patch on the gitlab server, but having someone actually build and run it first would be much better. Thanks in advance for any responses. Adam diff --git a/hw/xquartz/darwin.c b/hw/xquartz/darwin.c index 5c7e96e87..1026bcf02 100644 --- a/hw/xquartz/darwin.c +++ b/hw/xquartz/darwin.c @@ -517,13 +517,15 @@ InitInput(int argc, char **argv) .rules = "base", .model = "empty", .layout = "empty", .variant = NULL, .options = NULL }; +int result; /* We need to really have rules... or something... */ XkbSetRulesDflts(&rmlvo); -assert(Success == AllocDevicePair(serverClient, "xquartz virtual", - &darwinPointer, &darwinKeyboard, - DarwinMouseProc, DarwinKeybdProc, FALSE)); +result = AllocDevicePair(serverClient, "xquartz virtual", + &darwinPointer, &darwinKeyboard, + DarwinMouseProc, DarwinKeybdProc, FALSE); +assert(result == Success); /* here's the snippet from the current gdk sources: if (!strcmp (tmp_name, "pointer")) @@ -677,8 +679,12 @@ OsVendorInit(void) if (serverGeneration == 1) { char *lf; char *home = getenv("HOME"); +int nbytes; + assert(home); -assert(0 < asprintf(&lf, "%s/Library/Logs/X11", home)); + +nbytes = asprintf(&lf, "%s/Library/Logs/X11", home); +assert(nbytes > 0); /* Ignore errors. If EEXIST, we don't care. If anything else, * LogInit will handle it for us. @@ -686,9 +692,9 @@ OsVendorInit(void) (void)mkdir(lf, S_IRWXU | S_IRWXG | S_IRWXO); free(lf); -assert(0 < - asprintf(&lf, "%s/Library/Logs/X11/%s.log", home, -bundle_id_prefix)); +nbytes = asprintf(&lf, "%s/Library/Logs/X11/%s.log", home, + bundle_id_prefix); +assert(nbytes > 0); LogInit(lf, ".old"); free(lf); ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: https://lists.x.org/mailman/listinfo/xorg-devel