From 02ca8e522880f5d022416144d42f45615b2f4eba Mon Sep 17 00:00:00 2001 From: George Sapountzis Date: Tue, 11 Jul 2006 01:21:12 +0300 Subject: [PATCH] Merge atii2c.c in atimach64i2c.c, part #1. Move Init/Free functions. --- src/aticonsole.c | 5 ++--- src/atii2c.c | 44 +------------------------------------------- src/atii2c.h | 2 -- src/atimach64i2c.c | 37 ++++++++++++++++++++++++++++++++++--- src/atimach64i2c.h | 4 ++-- src/atipreinit.c | 6 ++---- 6 files changed, 41 insertions(+), 57 deletions(-) diff --git a/src/aticonsole.c b/src/aticonsole.c index 57d5a94..6e45cbc 100644 --- a/src/aticonsole.c +++ b/src/aticonsole.c @@ -1,4 +1,3 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/aticonsole.c,v 1.22 2003/11/13 18:42:47 tsi Exp $ */ /* * Copyright 1997 through 2004 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * @@ -32,9 +31,9 @@ #include "ati.h" #include "aticonsole.h" #include "aticrtc.h" -#include "atii2c.h" #include "atilock.h" #include "atimach64.h" +#include "atimach64i2c.h" #include "atimach64io.h" #include "atimode.h" #include "atistruct.h" @@ -817,7 +816,7 @@ ATIFreeScreen ATIPtr pATI = ATIPTR(pScreenInfo); if (pATI->Closeable || (serverGeneration > 1)) - ATII2CFreeScreen(iScreen); + Mach64I2CFreeScreen(iScreen); if (pATI->Closeable) (void)(*pScreen->CloseScreen)(iScreen, pScreen); diff --git a/src/atii2c.c b/src/atii2c.c index 1712d93..13a9f37 100644 --- a/src/atii2c.c +++ b/src/atii2c.c @@ -26,8 +26,6 @@ #endif #include "atii2c.h" -#include "atiload.h" -#include "atimach64i2c.h" #include "atistruct.h" #include "xf86.h" @@ -154,7 +152,7 @@ ATII2CStart /* * ATII2CAddress -- * - * This function puts a Start bit and an 8-bit address on the I2C bus. + * This function puts an 8-bit address on the I2C bus. */ static Bool ATII2CAddress @@ -353,43 +351,3 @@ ATICreateI2CBusRec xfree(pATII2C); return NULL; } - -/* - * ATII2CPreInit -- - * - * This is called by ATIPreInit() to create I2C bus record(s) for the adapter. - */ -void -ATII2CPreInit(ScrnInfoPtr pScreenInfo, ATIPtr pATI) -{ - if (ATILoadModule(pScreenInfo, "i2c", ATIi2cSymbols)) - ATIMach64I2CPreInit(pScreenInfo, pATI); -} - -/* - * ATII2CFreeScreen -- - * - * This is called by ATIFreeScreen() to remove the driver's I2C interface. - */ -void -ATII2CFreeScreen -( - int iScreen -) -{ - I2CBusPtr pI2CBus, *ppI2CBus; - ATII2CPtr pATII2C; - int nI2CBus; - - nI2CBus = xf86I2CGetScreenBuses(iScreen, &ppI2CBus); - while (--nI2CBus >= 0) - { - pI2CBus = ppI2CBus[nI2CBus]; - pATII2C = pI2CBus->DriverPrivate.ptr; - - xf86DestroyI2CBusRec(pI2CBus, TRUE, TRUE); - xfree(pATII2C); - } - - xfree(ppI2CBus); -} diff --git a/src/atii2c.h b/src/atii2c.h index 59125bf..49708c4 100644 --- a/src/atii2c.h +++ b/src/atii2c.h @@ -42,8 +42,6 @@ struct _ATII2CRec CARD32 I2CCur; }; -extern void ATII2CPreInit(ScrnInfoPtr, ATIPtr); extern I2CBusPtr ATICreateI2CBusRec(int, ATIPtr, char *); -extern void ATII2CFreeScreen(int); #endif /* ___ATII2C_H___ */ diff --git a/src/atimach64i2c.c b/src/atimach64i2c.c index 2eced72..fe372e0 100644 --- a/src/atimach64i2c.c +++ b/src/atimach64i2c.c @@ -1,4 +1,3 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atimach64i2c.c,v 1.1 2003/07/24 22:08:28 tsi Exp $ */ /* * Copyright 2003 through 2004 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * @@ -30,6 +29,7 @@ #include "atichip.h" #include "atii2c.h" +#include "atiload.h" #include "atimach64i2c.h" #include "atimach64io.h" #include "atituner.h" @@ -355,13 +355,13 @@ ATITVAddOnProbe } /* - * ATIMach64I2CPreInit -- + * Mach64I2CPreInit -- * * This function potentially allocates an I2CBusRec and initialises it with * ATI-specific and Mach64-specific information. */ void -ATIMach64I2CPreInit +Mach64I2CPreInit ( ScrnInfoPtr pScreenInfo, ATIPtr pATI @@ -370,6 +370,9 @@ ATIMach64I2CPreInit I2CBusPtr pI2CBus; ATII2CPtr pATII2C; + if (!ATILoadModule(pScreenInfo, "i2c", ATIi2cSymbols)) + return; + if (pATI->Chip < ATI_CHIP_264CT) return; @@ -470,3 +473,31 @@ ATIMach64I2CPreInit break; } } + +/* + * Mach64I2CFreeScreen -- + * + * This is called by ATIFreeScreen() to remove the driver's I2C interface. + */ +void +Mach64I2CFreeScreen +( + int iScreen +) +{ + I2CBusPtr pI2CBus, *ppI2CBus; + ATII2CPtr pATII2C; + int nI2CBus; + + nI2CBus = xf86I2CGetScreenBuses(iScreen, &ppI2CBus); + while (--nI2CBus >= 0) + { + pI2CBus = ppI2CBus[nI2CBus]; + pATII2C = pI2CBus->DriverPrivate.ptr; + + xf86DestroyI2CBusRec(pI2CBus, TRUE, TRUE); + xfree(pATII2C); + } + + xfree(ppI2CBus); +} diff --git a/src/atimach64i2c.h b/src/atimach64i2c.h index 33ad75a..d9f56f8 100644 --- a/src/atimach64i2c.h +++ b/src/atimach64i2c.h @@ -1,4 +1,3 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atimach64i2c.h,v 1.1 2003/07/24 22:08:28 tsi Exp $ */ /* * Copyright 1997 through 2004 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * @@ -28,6 +27,7 @@ #include "xf86str.h" -extern void ATIMach64I2CPreInit(ScrnInfoPtr, ATIPtr); +extern void Mach64I2CPreInit(ScrnInfoPtr, ATIPtr); +extern void Mach64I2CFreeScreen(int); #endif /* ___ATIMACH64I2C_H___ */ diff --git a/src/atipreinit.c b/src/atipreinit.c index 02f94c1..307507a 100644 --- a/src/atipreinit.c +++ b/src/atipreinit.c @@ -1,5 +1,3 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atipreinit.c,v 1.74 2003/12/22 17:48:09 tsi Exp $ */ -/* $XdotOrg: xc/programs/Xserver/hw/xfree86/drivers/ati/atipreinit.c,v 1.6 2005/06/26 04:38:12 ajax Exp $ */ /* * Copyright 1999 through 2004 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * @@ -39,12 +37,12 @@ #include "aticonfig.h" #include "atidac.h" #include "atidsp.h" -#include "atii2c.h" #include "atiload.h" #include "atilock.h" #include "atimach64.h" #include "atimach64accel.h" #include "atimach64cursor.h" +#include "atimach64i2c.h" #include "atimach64io.h" #include "atimach64xv.h" #include "atimode.h" @@ -2637,7 +2635,7 @@ ATIPreInit(ScrnInfoPtr pScreenInfo, int flags) ATIModePreInit(pScreenInfo, pATI, &pATI->NewHW); /* Set up for I2C */ - ATII2CPreInit(pScreenInfo, pATI); + Mach64I2CPreInit(pScreenInfo, pATI); if (!pScreenInfo->chipset || !*pScreenInfo->chipset) pScreenInfo->chipset = "mach64"; -- cgit v1.2.3