[PATCH] [kdrive] Remove unused LinuxFindPci and LinuxGetPciCfg

Mikhail Gusarov dottedmag at dottedmag.net
Mon Oct 19 14:18:01 PDT 2009


These two functions are not referenced from inside xserver.
Remove now-empty klinux.h too.
---
 hw/kdrive/linux/Makefile.am |    1 -
 hw/kdrive/linux/klinux.h    |   32 -------------
 hw/kdrive/linux/linux.c     |  105 -------------------------------------------
 3 files changed, 0 insertions(+), 138 deletions(-)
 delete mode 100644 hw/kdrive/linux/klinux.h

diff --git a/hw/kdrive/linux/Makefile.am b/hw/kdrive/linux/Makefile.am
index be07561..13df142 100644
--- a/hw/kdrive/linux/Makefile.am
+++ b/hw/kdrive/linux/Makefile.am
@@ -17,7 +17,6 @@ KDRIVE_HW_SOURCES =	\
 
 liblinux_la_SOURCES = 	\
 	bus.c		\
-	klinux.h	\
 	mouse.c		\
 	ms.c		\
 	ps2.c		\
diff --git a/hw/kdrive/linux/klinux.h b/hw/kdrive/linux/klinux.h
deleted file mode 100644
index 3496852..0000000
--- a/hw/kdrive/linux/klinux.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Copyright © 2003 Keith Packard
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of Keith Packard not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission.  Keith Packard makes no
- * representations about the suitability of this software for any purpose.  It
- * is provided "as is" without express or implied warranty.
- *
- * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- */
-
-#ifndef _KLINUX_H_
-#define _KLINUX_H_
- 
-Bool
-LinuxFindPci (CARD16 vendor, CARD16 device, CARD32 count, KdCardAttr *attr);
-
-unsigned char *
-LinuxGetPciCfg(KdCardAttr *attr);
-    
-#endif /* _KLINUX_H_ */
diff --git a/hw/kdrive/linux/linux.c b/hw/kdrive/linux/linux.c
index 3fba056..f76c2cb 100644
--- a/hw/kdrive/linux/linux.c
+++ b/hw/kdrive/linux/linux.c
@@ -24,7 +24,6 @@
 #include <kdrive-config.h>
 #endif
 #include "kdrive.h"
-#include "klinux.h"
 #include <errno.h>
 #include <signal.h>
 #include <linux/vt.h>
@@ -125,110 +124,6 @@ LinuxInit (void)
     return 1;
 }
 
-Bool
-LinuxFindPci (CARD16 vendor, CARD16 device, CARD32 count, KdCardAttr *attr)
-{
-    FILE    *f;
-    char    line[2048], *l, *end;
-    CARD32  bus, id, addr;
-    int	    n;
-    CARD32  ven_dev;
-    Bool    ret = FALSE;
-    int	    i;
-
-    attr->vendorID = vendor;
-    attr->deviceID = device;
-    ven_dev = (((CARD32) vendor) << 16) | ((CARD32) device);
-    f = fopen ("/proc/bus/pci/devices", "r");
-    if (!f)
-	return FALSE;
-    attr->io = 0;
-    while (fgets (line, sizeof (line)-1, f))
-    {
-	line[sizeof(line)-1] = '\0';
-	l = line;
-	bus = strtoul (l, &end, 16);
-	if (end == l)
-	    continue;
-	l = end;
-	id = strtoul (l, &end, 16);
-	if (end == l)
-	    continue;
-	l = end;
-	if (id != ven_dev)
-	    continue;
-	if (count--)
-	    continue;
-	(void) strtoul (l, &end, 16);	/* IRQ */
-	if (end == l)
-	    continue;
-	l = end;
-	n = 0;
-	for (i = 0; i < 6; i++)
-	{
-	    addr = strtoul (l, &end, 16);
-	    if (end == l)
-		break;
-	    if (addr & 1)
-		attr->io = addr & ~0xf;
-	    else
-	    {
-		if (n == KD_MAX_CARD_ADDRESS)
-		    break;
-		attr->address[n++] = addr & ~0xf;
-	    }
-	    l = end;
-	}
-	while (n > 0)
-	{
-	    if (attr->address[n-1] != 0)
-		break;
-	    n--;
-	}
-	attr->naddr = n;
-	attr->domain = 0; /* XXX */
-	attr->bus = (bus >> 8) & 0xff;
-	attr->slot = (bus >> 3) & 0x1f;
-	attr->func = bus & 0x07;
-	ret = TRUE;
-	break;
-    }
-    fclose (f);
-    return ret;
-}
-
-unsigned char *
-LinuxGetPciCfg(KdCardAttr *attr) 
-{
-    char filename[256];
-    FILE *f;
-    unsigned char *cfg;
-    int r;
-
-    snprintf(filename, 255, "/proc/bus/pci/%02x/%02x.%x",
-             attr->bus >> 8, (attr->bus & 0xff) >> 3, attr->bus & 7);
-/*     fprintf(stderr,"Find card on path %s\n",filename); */
-
-    if (!(f=fopen(filename,"r"))) 
-        return NULL;
-
-    if (!(cfg=xalloc(256))) 
-    {
-        fclose(f);
-        return NULL;
-    }
-
-    if (256 != (r=fread(cfg, 1, 256, f)))
-    {
-        fprintf(stderr,"LinuxGetPciCfg: read %d, expected 256\n",r);
-        free(cfg);
-        cfg=NULL;
-    }
-    fclose(f);
-/*     fprintf(stderr,"LinuxGetPciCfg: success, returning %p\n",cfg); */
-    return cfg;
-}
-
 static void
 LinuxSetSwitchMode (int mode)
 {
-- 
1.6.3.3



More information about the xorg-devel mailing list