direct-io.hg

changeset 3725:0823f72cd071

bitkeeper revision 1.1159.223.80 (4208de05Xtv_u_3smJSRU6ex6bTAfA)

Some functions aren't static and could be (damn C language!).

I tried turning on -Wmissing-prototypes: unfortunately gives warnings
for functions used in asm, which means introducing gratuitous prototypes
for them. Not sure it's worth it.

1) keyhandler.c: keypress_softirq() and do_task_queues() can be static.
2) physdev.c: pcidev_dom0_hidden() can be static.
3) resource.c/resource.h: check_region is deprecated (racy): remove.
4) sched_bvt.c: lots of things can be static.
5) pci/compat.c: not required for Xen.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (authored)
Signed-off-by: ian.pratt@cl.cam.ac.uk
author iap10@freefall.cl.cam.ac.uk
date Tue Feb 08 15:43:01 2005 +0000 (2005-02-08)
parents 41be211173f0
children a00d7a994a59 6062bb54a227
files xen/common/keyhandler.c xen/common/physdev.c xen/common/resource.c xen/common/sched_bvt.c xen/drivers/pci/Makefile xen/drivers/pci/compat.c xen/include/xen/ioport.h
line diff
     1.1 --- a/xen/common/keyhandler.c	Tue Feb 08 03:14:41 2005 +0000
     1.2 +++ b/xen/common/keyhandler.c	Tue Feb 08 15:43:01 2005 +0000
     1.3 @@ -26,7 +26,7 @@ static struct {
     1.4  
     1.5  static unsigned char keypress_key;
     1.6  
     1.7 -void keypress_softirq(void)
     1.8 +static void keypress_softirq(void)
     1.9  {
    1.10      keyhandler_t *h;
    1.11      unsigned char key = keypress_key;
    1.12 @@ -93,7 +93,7 @@ static void halt_machine(unsigned char k
    1.13      machine_restart(NULL); 
    1.14  }
    1.15  
    1.16 -void do_task_queues(unsigned char key)
    1.17 +static void do_task_queues(unsigned char key)
    1.18  {
    1.19      struct domain *d;
    1.20      s_time_t       now = NOW();
     2.1 --- a/xen/common/physdev.c	Tue Feb 08 03:14:41 2005 +0000
     2.2 +++ b/xen/common/physdev.c	Tue Feb 08 15:43:01 2005 +0000
     2.3 @@ -704,7 +704,7 @@ string_param("physdev_dom0_hide", opt_ph
     2.4  
     2.5  /* Test if boot params specify this device should NOT be visible to DOM0
     2.6   * (e.g. so that another domain can control it instead) */
     2.7 -int pcidev_dom0_hidden(struct pci_dev *dev)
     2.8 +static int pcidev_dom0_hidden(struct pci_dev *dev)
     2.9  {
    2.10      char cmp[10] = "(.......)";
    2.11      
     3.1 --- a/xen/common/resource.c	Tue Feb 08 03:14:41 2005 +0000
     3.2 +++ b/xen/common/resource.c	Tue Feb 08 15:43:01 2005 +0000
     3.3 @@ -253,19 +253,6 @@ struct resource * __request_region(struc
     3.4  	return res;
     3.5  }
     3.6  
     3.7 -int __check_region(struct resource *parent, unsigned long start, unsigned long n)
     3.8 -{
     3.9 -	struct resource * res;
    3.10 -
    3.11 -	res = __request_region(parent, start, n, "check-region");
    3.12 -	if (!res)
    3.13 -		return -EBUSY;
    3.14 -
    3.15 -	release_resource(res);
    3.16 -	xfree(res);
    3.17 -	return 0;
    3.18 -}
    3.19 -
    3.20  void __release_region(struct resource *parent, unsigned long start, unsigned long n)
    3.21  {
    3.22  	struct resource **p;
     4.1 --- a/xen/common/sched_bvt.c	Tue Feb 08 03:14:41 2005 +0000
     4.2 +++ b/xen/common/sched_bvt.c	Tue Feb 08 15:43:01 2005 +0000
     4.3 @@ -159,7 +159,7 @@ static inline u32 calc_evt(struct domain
     4.4   *
     4.5   * Returns non-zero on failure.
     4.6   */
     4.7 -int bvt_alloc_task(struct domain *d)
     4.8 +static int bvt_alloc_task(struct domain *d)
     4.9  {
    4.10      if ( (d->sched_priv = xmem_cache_alloc(dom_info_cache)) == NULL )
    4.11          return -1;
    4.12 @@ -170,7 +170,7 @@ int bvt_alloc_task(struct domain *d)
    4.13  /*
    4.14   * Add and remove a domain
    4.15   */
    4.16 -void bvt_add_task(struct domain *d) 
    4.17 +static void bvt_add_task(struct domain *d) 
    4.18  {
    4.19      struct bvt_dom_info *inf = BVT_INFO(d);
    4.20      ASSERT(inf != NULL);
    4.21 @@ -206,7 +206,7 @@ void bvt_add_task(struct domain *d)
    4.22      }
    4.23  }
    4.24  
    4.25 -int bvt_init_idle_task(struct domain *p)
    4.26 +static int bvt_init_idle_task(struct domain *p)
    4.27  {
    4.28      if ( bvt_alloc_task(p) < 0 )
    4.29          return -1;
    4.30 @@ -220,7 +220,7 @@ int bvt_init_idle_task(struct domain *p)
    4.31      return 0;
    4.32  }
    4.33  
    4.34 -void bvt_wake(struct domain *d)
    4.35 +static void bvt_wake(struct domain *d)
    4.36  {
    4.37      struct bvt_dom_info *inf = BVT_INFO(d);
    4.38      struct domain       *curr;
    4.39 @@ -271,14 +271,14 @@ static void bvt_sleep(struct domain *d)
    4.40   * bvt_free_task - free BVT private structures for a task
    4.41   * @d:             task
    4.42   */
    4.43 -void bvt_free_task(struct domain *d)
    4.44 +static void bvt_free_task(struct domain *d)
    4.45  {
    4.46      ASSERT(d->sched_priv != NULL);
    4.47      xmem_cache_free(dom_info_cache, d->sched_priv);
    4.48  }
    4.49  
    4.50  /* Control the scheduler. */
    4.51 -int bvt_ctl(struct sched_ctl_cmd *cmd)
    4.52 +static int bvt_ctl(struct sched_ctl_cmd *cmd)
    4.53  {
    4.54      struct bvt_ctl *params = &cmd->u.bvt;
    4.55  
    4.56 @@ -291,7 +291,7 @@ int bvt_ctl(struct sched_ctl_cmd *cmd)
    4.57  }
    4.58  
    4.59  /* Adjust scheduling parameter for a given domain. */
    4.60 -int bvt_adjdom(
    4.61 +static int bvt_adjdom(
    4.62      struct domain *d, struct sched_adjdom_cmd *cmd)
    4.63  {
    4.64      struct bvt_adjdom *params = &cmd->u.bvt;
    4.65 @@ -526,7 +526,7 @@ static void bvt_dump_cpu_state(int i)
    4.66  }
    4.67  
    4.68  /* Initialise the data structures. */
    4.69 -int bvt_init_scheduler()
    4.70 +static int bvt_init_scheduler(void)
    4.71  {
    4.72      int i;
    4.73  
     5.1 --- a/xen/drivers/pci/Makefile	Tue Feb 08 03:14:41 2005 +0000
     5.2 +++ b/xen/drivers/pci/Makefile	Tue Feb 08 15:43:01 2005 +0000
     5.3 @@ -4,7 +4,7 @@
     5.4  
     5.5  include $(BASEDIR)/Rules.mk
     5.6  
     5.7 -OBJS := pci.o quirks.o compat.o names.o setup-res.o
     5.8 +OBJS := pci.o quirks.o names.o setup-res.o
     5.9  
    5.10  #obj-$(CONFIG_PCI) += pci.o quirks.o compat.o names.o
    5.11  #obj-$(CONFIG_PROC_FS) += proc.o
     6.1 --- a/xen/drivers/pci/compat.c	Tue Feb 08 03:14:41 2005 +0000
     6.2 +++ b/xen/drivers/pci/compat.c	Tue Feb 08 15:43:01 2005 +0000
     6.3 @@ -1,65 +0,0 @@
     6.4 -/*
     6.5 - *	$Id: compat.c,v 1.1 1998/02/16 10:35:50 mj Exp $
     6.6 - *
     6.7 - *	PCI Bus Services -- Function For Backward Compatibility
     6.8 - *
     6.9 - *	Copyright 1998--2000 Martin Mares <mj@ucw.cz>
    6.10 - */
    6.11 -
    6.12 -#include <xen/types.h>
    6.13 -//#include <xen/kernel.h>
    6.14 -#include <xen/pci.h>
    6.15 -
    6.16 -int
    6.17 -pcibios_present(void)
    6.18 -{
    6.19 -	return !list_empty(&pci_devices);
    6.20 -}
    6.21 -
    6.22 -int
    6.23 -pcibios_find_class(unsigned int class, unsigned short index, unsigned char *bus, unsigned char *devfn)
    6.24 -{
    6.25 -	const struct pci_dev *dev = NULL;
    6.26 -	int cnt = 0;
    6.27 -
    6.28 -	while ((dev = pci_find_class(class, dev)))
    6.29 -		if (index == cnt++) {
    6.30 -			*bus = dev->bus->number;
    6.31 -			*devfn = dev->devfn;
    6.32 -			return PCIBIOS_SUCCESSFUL;
    6.33 -		}
    6.34 -	return PCIBIOS_DEVICE_NOT_FOUND;
    6.35 -}
    6.36 -
    6.37 -
    6.38 -int
    6.39 -pcibios_find_device(unsigned short vendor, unsigned short device, unsigned short index,
    6.40 -		    unsigned char *bus, unsigned char *devfn)
    6.41 -{
    6.42 -	const struct pci_dev *dev = NULL;
    6.43 -	int cnt = 0;
    6.44 -
    6.45 -	while ((dev = pci_find_device(vendor, device, dev)))
    6.46 -		if (index == cnt++) {
    6.47 -			*bus = dev->bus->number;
    6.48 -			*devfn = dev->devfn;
    6.49 -			return PCIBIOS_SUCCESSFUL;
    6.50 -		}
    6.51 -	return PCIBIOS_DEVICE_NOT_FOUND;
    6.52 -}
    6.53 -
    6.54 -#define PCI_OP(rw,size,type)							\
    6.55 -int pcibios_##rw##_config_##size (unsigned char bus, unsigned char dev_fn,	\
    6.56 -				  unsigned char where, unsigned type val)	\
    6.57 -{										\
    6.58 -	struct pci_dev *dev = pci_find_slot(bus, dev_fn);			\
    6.59 -	if (!dev) return PCIBIOS_DEVICE_NOT_FOUND;				\
    6.60 -	return pci_##rw##_config_##size(dev, where, val);			\
    6.61 -}
    6.62 -
    6.63 -PCI_OP(read, byte, char *)
    6.64 -PCI_OP(read, word, short *)
    6.65 -PCI_OP(read, dword, int *)
    6.66 -PCI_OP(write, byte, char)
    6.67 -PCI_OP(write, word, short)
    6.68 -PCI_OP(write, dword, int)
     7.1 --- a/xen/include/xen/ioport.h	Tue Feb 08 03:14:41 2005 +0000
     7.2 +++ b/xen/include/xen/ioport.h	Tue Feb 08 15:43:01 2005 +0000
     7.3 @@ -100,17 +100,13 @@ extern int allocate_resource(struct reso
     7.4  #define request_region(start,n,name)	__request_region(&ioport_resource, (start), (n), (name))
     7.5  #define request_mem_region(start,n,name) __request_region(&iomem_resource, (start), (n), (name))
     7.6  
     7.7 -extern struct resource * __request_region(struct resource *, unsigned long start, unsigned long n, const char *name);
     7.8 -
     7.9 -/* Compatibility cruft */
    7.10 -#define check_region(start,n)	__check_region(&ioport_resource, (start), (n))
    7.11  #define release_region(start,n)	__release_region(&ioport_resource, (start), (n))
    7.12 -#define check_mem_region(start,n)	__check_region(&iomem_resource, (start), (n))
    7.13  #define release_mem_region(start,n)	__release_region(&iomem_resource, (start), (n))
    7.14  
    7.15 -extern int __check_region(struct resource *, unsigned long, unsigned long);
    7.16  extern void __release_region(struct resource *, unsigned long, unsigned long);
    7.17  
    7.18 +extern struct resource * __request_region(struct resource *, unsigned long start, unsigned long n, const char *name);
    7.19 +
    7.20  #define get_ioport_list(buf)	get_resource_list(&ioport_resource, buf, PAGE_SIZE)
    7.21  #define get_mem_list(buf)	get_resource_list(&iomem_resource, buf, PAGE_SIZE)
    7.22