Commit 5dcb4152 authored by Kristian Høgsberg's avatar Kristian Høgsberg

Convert use of xf86fopen() and other xf86 wrapped libc symbols to use libc

    symbols directly. The xf86* versions aren't supposed to be used
    directly.
Drop libc wrapper; don't include xf86_ansic.h and add includes now missing.
parent 21acdf37
2006-03-22 Kristian Høgsberg <krh@redhat.com>
* src/theatre200.c: Convert use of xf86fopen() and other xf86
wrapped libc symbols to use libc symbols directly. The xf86*
versions aren't supposed to be used directly.
* src/*.c: Drop libc wrapper; don't include xf86_ansic.h and add
includes now missing.
2006-03-18 Benjamin Herrenschmidt <benh@kernel.crashing.org> 2006-03-18 Benjamin Herrenschmidt <benh@kernel.crashing.org>
* src/radeon_driver.c: (RADEONRestoreMemMapRegisters), * src/radeon_driver.c: (RADEONRestoreMemMapRegisters),
......
...@@ -29,7 +29,6 @@ ...@@ -29,7 +29,6 @@
#include "xf86.h" #include "xf86.h"
#include "xf86_ansic.h"
#include "xf86_OSproc.h" #include "xf86_OSproc.h"
extern DriverRec ATI; extern DriverRec ATI;
......
...@@ -25,6 +25,8 @@ ...@@ -25,6 +25,8 @@
#include "config.h" #include "config.h"
#endif #endif
#include <string.h>
#include "ati.h" #include "ati.h"
#include "atiadapter.h" #include "atiadapter.h"
#include "atibus.h" #include "atibus.h"
......
...@@ -28,6 +28,8 @@ ...@@ -28,6 +28,8 @@
#include "config.h" #include "config.h"
#endif #endif
#include <string.h>
#include "ati.h" #include "ati.h"
#include "atiadapter.h" #include "atiadapter.h"
#include "atichip.h" #include "atichip.h"
......
...@@ -25,6 +25,8 @@ ...@@ -25,6 +25,8 @@
#include "config.h" #include "config.h"
#endif #endif
#include <string.h>
#include "ati.h" #include "ati.h"
#include "atidac.h" #include "atidac.h"
#include "atimach64io.h" #include "atimach64io.h"
......
...@@ -26,6 +26,8 @@ ...@@ -26,6 +26,8 @@
#endif #endif
#ifndef AVOID_DGA #ifndef AVOID_DGA
#include <string.h>
#include "ati.h" #include "ati.h"
#include "atiadjust.h" #include "atiadjust.h"
#include "atichip.h" #include "atichip.h"
......
...@@ -31,6 +31,9 @@ ...@@ -31,6 +31,9 @@
* Leif Delgass <ldelgass@retinalburn.net> * Leif Delgass <ldelgass@retinalburn.net>
*/ */
#include <string.h>
#include <stdio.h>
/* Driver data structures */ /* Driver data structures */
#include "ati.h" #include "ati.h"
#include "atibus.h" #include "atibus.h"
......
...@@ -53,6 +53,8 @@ ...@@ -53,6 +53,8 @@
#include "config.h" #include "config.h"
#endif #endif
#include <string.h>
#include "ati.h" #include "ati.h"
#include "atibus.h" #include "atibus.h"
#include "atichip.h" #include "atichip.h"
......
...@@ -25,6 +25,8 @@ ...@@ -25,6 +25,8 @@
#include "config.h" #include "config.h"
#endif #endif
#include <string.h>
#include "ati.h" #include "ati.h"
#include "atiaccel.h" #include "atiaccel.h"
#include "atichip.h" #include "atichip.h"
......
...@@ -24,6 +24,8 @@ ...@@ -24,6 +24,8 @@
#include "config.h" #include "config.h"
#endif #endif
#include <string.h>
#include "ati.h" #include "ati.h"
#include "atiadapter.h" #include "atiadapter.h"
#include "atichip.h" #include "atichip.h"
......
/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atipreinit.c,v 1.74 2003/12/22 17:48:09 tsi Exp $ */ /* $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 $ */ /* $XdotOrg: driver/xf86-video-ati/src/atipreinit.c,v 1.9 2005/08/28 18:10:34 ajax Exp $ */
/* /*
* Copyright 1999 through 2004 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * Copyright 1999 through 2004 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org
* *
...@@ -26,6 +26,9 @@ ...@@ -26,6 +26,9 @@
#include "config.h" #include "config.h"
#endif #endif
#include <string.h>
#include <stdio.h>
#include "ati.h" #include "ati.h"
#include "atiadapter.h" #include "atiadapter.h"
#include "atiadjust.h" #include "atiadjust.h"
......
...@@ -25,6 +25,8 @@ ...@@ -25,6 +25,8 @@
#include "config.h" #include "config.h"
#endif #endif
#include <string.h>
#include "ati.h" #include "ati.h"
#include "atiadapter.h" #include "atiadapter.h"
#include "atichip.h" #include "atichip.h"
......
...@@ -25,6 +25,9 @@ ...@@ -25,6 +25,9 @@
#include "config.h" #include "config.h"
#endif #endif
#include <string.h>
#include <stdio.h>
#include "ati.h" #include "ati.h"
#include "atiadapter.h" #include "atiadapter.h"
#include "atiadjust.h" #include "atiadjust.h"
......
...@@ -30,6 +30,8 @@ ...@@ -30,6 +30,8 @@
#include "config.h" #include "config.h"
#endif #endif
#include <string.h>
#include "ati.h" #include "ati.h"
#include "atibus.h" #include "atibus.h"
#include "atichip.h" #include "atichip.h"
......
...@@ -84,6 +84,8 @@ ...@@ -84,6 +84,8 @@
#define R128_TRAPEZOIDS 0 /* Trapezoids don't work */ #define R128_TRAPEZOIDS 0 /* Trapezoids don't work */
/* Driver data structures */ /* Driver data structures */
#include <errno.h>
#include "r128.h" #include "r128.h"
#include "r128_reg.h" #include "r128_reg.h"
#include "r128_probe.h" #include "r128_probe.h"
......
...@@ -9,6 +9,8 @@ ...@@ -9,6 +9,8 @@
#include "config.h" #include "config.h"
#endif #endif
#include <string.h>
/* Driver data structures */ /* Driver data structures */
#include "r128.h" #include "r128.h"
#include "r128_probe.h" #include "r128_probe.h"
......
...@@ -32,6 +32,8 @@ ...@@ -32,6 +32,8 @@
#include "config.h" #include "config.h"
#endif #endif
#include <string.h>
/* /*
* Authors: * Authors:
* Kevin E. Martin <martin@valinux.com> * Kevin E. Martin <martin@valinux.com>
......
...@@ -63,6 +63,8 @@ ...@@ -63,6 +63,8 @@
* Dualhead support - Alex Deucher <agd5f@yahoo.com> * Dualhead support - Alex Deucher <agd5f@yahoo.com>
*/ */
#include <string.h>
#include <stdio.h>
/* Driver data structures */ /* Driver data structures */
#include "r128.h" #include "r128.h"
......
...@@ -32,6 +32,8 @@ ...@@ -32,6 +32,8 @@
#include "config.h" #include "config.h"
#endif #endif
#include <string.h>
/* /*
* Authors: * Authors:
* Rickard E. Faith <faith@valinux.com> * Rickard E. Faith <faith@valinux.com>
...@@ -48,7 +50,6 @@ ...@@ -48,7 +50,6 @@
#include "atipciids.h" #include "atipciids.h"
#include "xf86.h" #include "xf86.h"
#include "xf86_ansic.h"
#include "xf86Resources.h" #include "xf86Resources.h"
#include "r128_chipset.h" #include "r128_chipset.h"
......
...@@ -48,9 +48,6 @@ ...@@ -48,9 +48,6 @@
#ifndef _R128_REG_H_ #ifndef _R128_REG_H_
#define _R128_REG_H_ #define _R128_REG_H_
#ifdef XFree86Module
#include "xf86_ansic.h"
#endif
#include "compiler.h" #include "compiler.h"
/* Memory mapped register access macros */ /* Memory mapped register access macros */
......
...@@ -4,6 +4,8 @@ ...@@ -4,6 +4,8 @@
#include "config.h" #include "config.h"
#endif #endif
#include <string.h>
#include "r128.h" #include "r128.h"
#include "r128_reg.h" #include "r128_reg.h"
......
...@@ -39,7 +39,6 @@ ...@@ -39,7 +39,6 @@
#define _RADEON_H_ #define _RADEON_H_
#include "xf86str.h" #include "xf86str.h"
#include "xf86_ansic.h"
#include "compiler.h" #include "compiler.h"
#include "xf86fbman.h" #include "xf86fbman.h"
......
...@@ -74,6 +74,8 @@ ...@@ -74,6 +74,8 @@
* *
*/ */
#include <errno.h>
#include <string.h>
/* Driver data structures */ /* Driver data structures */
#include "radeon.h" #include "radeon.h"
#include "radeon_reg.h" #include "radeon_reg.h"
......
...@@ -30,6 +30,8 @@ ...@@ -30,6 +30,8 @@
#include "config.h" #include "config.h"
#endif #endif
#include <string.h>
#include "xf86.h" #include "xf86.h"
#include "xf86_OSproc.h" #include "xf86_OSproc.h"
......
...@@ -43,6 +43,8 @@ ...@@ -43,6 +43,8 @@
* *
*/ */
#include <string.h>
/* Driver data structures */ /* Driver data structures */
#include "radeon.h" #include "radeon.h"
#include "radeon_probe.h" #include "radeon_probe.h"
......
...@@ -39,6 +39,8 @@ ...@@ -39,6 +39,8 @@
* *
*/ */
#include <string.h>
#include <stdio.h>
/* Driver data structures */ /* Driver data structures */
#include "radeon.h" #include "radeon.h"
......
/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_driver.c,v 1.117 2004/02/19 22:38:12 tsi Exp $ */ /* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_driver.c,v 1.117 2004/02/19 22:38:12 tsi Exp $ */
/* $XdotOrg: driver/xf86-video-ati/src/radeon_driver.c,v 1.105 2006/03/17 03:00:53 sroland Exp $ */ /* $XdotOrg: driver/xf86-video-ati/src/radeon_driver.c,v 1.106 2006/03/18 00:08:24 benh Exp $ */
/* /*
* Copyright 2000 ATI Technologies Inc., Markham, Ontario, and * Copyright 2000 ATI Technologies Inc., Markham, Ontario, and
* VA Linux Systems Inc., Fremont, California. * VA Linux Systems Inc., Fremont, California.
...@@ -67,6 +67,9 @@ ...@@ -67,6 +67,9 @@
* *
*/ */
#include <string.h>
#include <stdio.h>
/* Driver data structures */ /* Driver data structures */
#include "radeon.h" #include "radeon.h"
#include "radeon_reg.h" #include "radeon_reg.h"
......
...@@ -49,6 +49,8 @@ ...@@ -49,6 +49,8 @@
#endif #endif
#endif #endif
#include <string.h>
#include "radeon.h" #include "radeon.h"
#include "atidri.h" #include "atidri.h"
......
...@@ -50,9 +50,6 @@ ...@@ -50,9 +50,6 @@
#ifndef _RADEON_MACROS_H_ #ifndef _RADEON_MACROS_H_
#define _RADEON_MACROS_H_ #define _RADEON_MACROS_H_
#ifdef XFree86Module
#include "xf86_ansic.h"
#endif
#include "compiler.h" #include "compiler.h"
#define RADEON_BIOS8(v) (info->VBIOS[v]) #define RADEON_BIOS8(v) (info->VBIOS[v])
......
...@@ -36,6 +36,9 @@ ...@@ -36,6 +36,9 @@
* Based, in large part, on the sis driver by Thomas Winischhofer. * Based, in large part, on the sis driver by Thomas Winischhofer.
*/ */
#include <string.h>
#include <stdio.h>
#include "xf86.h" #include "xf86.h"
#include "xf86Priv.h" #include "xf86Priv.h"
#include "xf86Resources.h" #include "xf86Resources.h"
......
...@@ -2,6 +2,8 @@ ...@@ -2,6 +2,8 @@
#include "config.h" #include "config.h"
#endif #endif
#include <math.h>
#include "radeon.h" #include "radeon.h"
#include "radeon_reg.h" #include "radeon_reg.h"
#include "radeon_macros.h" #include "radeon_macros.h"
......
...@@ -31,6 +31,8 @@ ...@@ -31,6 +31,8 @@
#include "config.h" #include "config.h"
#endif #endif
#include <string.h>
/* /*
* Authors: * Authors:
* Kevin E. Martin <martin@xfree86.org> * Kevin E. Martin <martin@xfree86.org>
...@@ -47,7 +49,6 @@ ...@@ -47,7 +49,6 @@
#include "atipciids.h" #include "atipciids.h"
#include "xf86.h" #include "xf86.h"
#include "xf86_ansic.h"
#define _XF86MISC_SERVER_ #define _XF86MISC_SERVER_
#include <X11/extensions/xf86misc.h> #include <X11/extensions/xf86misc.h>
#include "xf86Resources.h" #include "xf86Resources.h"
......
...@@ -31,6 +31,8 @@ ...@@ -31,6 +31,8 @@
#include "config.h" #include "config.h"
#endif #endif
#include <string.h>
#ifdef USE_XAA #ifdef USE_XAA
#include "dixstruct.h" #include "dixstruct.h"
......
...@@ -4,6 +4,11 @@ ...@@ -4,6 +4,11 @@
#include "config.h" #include "config.h"
#endif #endif
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <math.h>
#include "radeon.h" #include "radeon.h"
#include "radeon_reg.h" #include "radeon_reg.h"
#include "radeon_macros.h" #include "radeon_macros.h"
...@@ -1265,7 +1270,7 @@ static void RADEONSetupTheatre(ScrnInfoPtr pScrn, RADEONPortPrivPtr pPriv) ...@@ -1265,7 +1270,7 @@ static void RADEONSetupTheatre(ScrnInfoPtr pScrn, RADEONPortPrivPtr pPriv)
xf86DrvMsg(pScrn->scrnIndex, X_INFO, xf86DrvMsg(pScrn->scrnIndex, X_INFO,
"Unsupported reference clock frequency, Rage Theatre disabled\n"); "Unsupported reference clock frequency, Rage Theatre disabled\n");
t->theatre_num=-1; t->theatre_num=-1;
xf86free(pPriv->theatre); xfree(pPriv->theatre);
pPriv->theatre = NULL; pPriv->theatre = NULL;
return; return;
} }
......
...@@ -2,6 +2,8 @@ ...@@ -2,6 +2,8 @@
#include "config.h" #include "config.h"
#endif #endif
#include <string.h>
#include "radeon.h" #include "radeon.h"
#include "radeon_reg.h" #include "radeon_reg.h"
#include "radeon_macros.h" #include "radeon_macros.h"
......
...@@ -23,8 +23,15 @@ ...@@ -23,8 +23,15 @@
* authorization from the author. * authorization from the author.
* *
* $Log$ * $Log$
* Revision 1.5 2005/11/07 19:28:40 bogdand * Revision 1.6 2006/03/22 22:30:14 krh
* Replaced the variadic macros(gcc) by macros according to C99 standard * 2006-03-22 Kristian Høgsberg <krh@redhat.com>
*
* * src/theatre200.c: Convert use of xf86fopen() and other xf86
* wrapped libc symbols to use libc symbols directly. The xf86*
* versions aren't supposed to be used directly.
*
* * src/*.c: Drop libc wrapper; don't include xf86_ansic.h and add
* includes now missing.
* *
* Revision 1.4 2005/08/28 18:00:23 bogdand * Revision 1.4 2005/08/28 18:00:23 bogdand
* Modified the licens type from GPL to a X/MIT one * Modified the licens type from GPL to a X/MIT one
...@@ -42,9 +49,10 @@ ...@@ -42,9 +49,10 @@
#include "config.h" #include "config.h"
#endif #endif
#include <stdio.h>
#include "xf86.h" #include "xf86.h"
#include "generic_bus.h" #include "generic_bus.h"
#include "xf86_ansic.h"
#include "radeon_reg.h" #include "radeon_reg.h"
#include "radeon.h" #include "radeon.h"
#include "theatre_reg.h" #include "theatre_reg.h"
...@@ -131,15 +139,15 @@ static int microc_load (char* micro_path, char* micro_type, struct rt200_microc_ ...@@ -131,15 +139,15 @@ static int microc_load (char* micro_path, char* micro_type, struct rt200_microc_
if (micro_type == NULL) if (micro_type == NULL)
return -1; return -1;
file = xf86fopen(micro_path, "r"); file = fopen(micro_path, "r");
if (file == NULL) { if (file == NULL) {
ERROR_0("Cannot open microcode file\n"); ERROR_0("Cannot open microcode file\n");
return -1; return -1;
} }
if (!xf86strcmp(micro_type, "BINARY")) if (!strcmp(micro_type, "BINARY"))
{ {
if (xf86fread(microc_headp, sizeof(struct rt200_microc_head), 1, file) != 1) if (fread(microc_headp, sizeof(struct rt200_microc_head), 1, file) != 1)
{ {
ERROR("Cannot read header from file: %s\n", micro_path); ERROR("Cannot read header from file: %s\n", micro_path);
goto fail_exit; goto fail_exit;
...@@ -154,23 +162,23 @@ static int microc_load (char* micro_path, char* micro_type, struct rt200_microc_ ...@@ -154,23 +162,23 @@ static int microc_load (char* micro_path, char* micro_type, struct rt200_microc_
{ {
int ret; int ret;
curr_seg = (struct rt200_microc_seg*)xf86malloc(sizeof(struct rt200_microc_seg)); curr_seg = (struct rt200_microc_seg*)Xalloc(sizeof(struct rt200_microc_seg));
if (curr_seg == NULL) if (curr_seg == NULL)
{ {
ERROR_0("Cannot allocate memory\n"); ERROR_0("Cannot allocate memory\n");
goto fail_exit; goto fail_exit;
} }
ret = xf86fread(&curr_seg->num_bytes, 4, 1, file); ret = fread(&curr_seg->num_bytes, 4, 1, file);
ret += xf86fread(&curr_seg->download_dst, 4, 1, file); ret += fread(&curr_seg->download_dst, 4, 1, file);
ret += xf86fread(&curr_seg->crc_val, 4, 1, file); ret += fread(&curr_seg->crc_val, 4, 1, file);
if (ret != 3) if (ret != 3)
{ {
ERROR("Cannot read segment from microcode file: %s\n", micro_path); ERROR("Cannot read segment from microcode file: %s\n", micro_path);
goto fail_exit; goto fail_exit;
} }
curr_seg->data = (unsigned char*)xf86malloc(curr_seg->num_bytes); curr_seg->data = (unsigned char*)Xalloc(curr_seg->num_bytes);
if (curr_seg->data == NULL) if (curr_seg->data == NULL)
{ {
ERROR_0("cannot allocate memory\n"); ERROR_0("cannot allocate memory\n");
...@@ -196,7 +204,7 @@ static int microc_load (char* micro_path, char* micro_type, struct rt200_microc_ ...@@ -196,7 +204,7 @@ static int microc_load (char* micro_path, char* micro_type, struct rt200_microc_
curr_seg = seg_list; curr_seg = seg_list;
while (curr_seg) while (curr_seg)
{ {
if (xf86fread(curr_seg->data, curr_seg->num_bytes, 1, file) != 1) if (fread(curr_seg->data, curr_seg->num_bytes, 1, file) != 1)
{ {
ERROR_0("Cannot read segment data\n"); ERROR_0("Cannot read segment data\n");
goto fail_exit; goto fail_exit;
...@@ -205,20 +213,20 @@ static int microc_load (char* micro_path, char* micro_type, struct rt200_microc_ ...@@ -205,20 +213,20 @@ static int microc_load (char* micro_path, char* micro_type, struct rt200_microc_
curr_seg = curr_seg->next; curr_seg = curr_seg->next;
} }
} }
else if (!xf86strcmp(micro_type, "ASCII")) else if (!strcmp(micro_type, "ASCII"))
{ {
char tmp1[12], tmp2[12], tmp3[12], tmp4[12]; char tmp1[12], tmp2[12], tmp3[12], tmp4[12];
unsigned int ltmp; unsigned int ltmp;
if ((xf86fgets(tmp1, 12, file) != NULL) && if ((fgets(tmp1, 12, file) != NULL) &&
(xf86fgets(tmp2, 12, file) != NULL) && (fgets(tmp2, 12, file) != NULL) &&
(xf86fgets(tmp3, 12, file) != NULL) && (fgets(tmp3, 12, file) != NULL) &&
xf86fgets(tmp4, 12, file) != NULL) fgets(tmp4, 12, file) != NULL)
{ {
microc_headp->device_id = xf86strtoul(tmp1, NULL, 16); microc_headp->device_id = strtoul(tmp1, NULL, 16);
microc_headp->vendor_id = xf86strtoul(tmp2, NULL, 16); microc_headp->vendor_id = strtoul(tmp2, NULL, 16);
microc_headp->revision_id = xf86strtoul(tmp3, NULL, 16); microc_headp->revision_id = strtoul(tmp3, NULL, 16);
microc_headp->num_seg = xf86strtoul(tmp4, NULL, 16); microc_headp->num_seg = strtoul(tmp4, NULL, 16);
} }
else else
{ {
...@@ -233,20 +241,20 @@ static int microc_load (char* micro_path, char* micro_type, struct rt200_microc_ ...@@ -233,20 +241,20 @@ static int microc_load (char* micro_path, char* micro_type, struct rt200_microc_
for (i = 0; i < microc_headp->num_seg; i++) for (i = 0; i < microc_headp->num_seg; i++)
{ {
curr_seg = (struct rt200_microc_seg*)xf86malloc(sizeof(struct rt200_microc_seg)); curr_seg = (struct rt200_microc_seg*)Xalloc(sizeof(struct rt200_microc_seg));
if (curr_seg == NULL) if (curr_seg == NULL)
{ {
ERROR_0("Cannot allocate memory\n"); ERROR_0("Cannot allocate memory\n");
goto fail_exit; goto fail_exit;
} }
if (xf86fgets(tmp1, 12, file) != NULL && if (fgets(tmp1, 12, file) != NULL &&
xf86fgets(tmp2, 12, file) != NULL && fgets(tmp2, 12, file) != NULL &&
xf86fgets(tmp3, 12, file) != NULL) fgets(tmp3, 12, file) != NULL)
{ {
curr_seg->num_bytes = xf86strtoul(tmp1, NULL, 16); curr_seg->num_bytes = strtoul(tmp1, NULL, 16);
curr_seg->download_dst = xf86strtoul(tmp2, NULL, 16); curr_seg->download_dst = strtoul(tmp2, NULL, 16);
curr_seg->crc_val = xf86strtoul(tmp3, NULL, 16); curr_seg->crc_val = strtoul(tmp3, NULL, 16);
} }
else else
{ {
...@@ -254,7 +262,7 @@ static int microc_load (char* micro_path, char* micro_type, struct rt200_microc_ ...@@ -254,7 +262,7 @@ static int microc_load (char* micro_path, char* micro_type, struct rt200_microc_