[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH] YA trivial patch: statics, remove check_region, remove pci/compat.c



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@xxxxxxxxxxxxxxx> (authored)

diff -urpN --exclude TAGS -X 
/home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal 
xen-unstable/xen/common/keyhandler.c 
xen-unstable-working/xen/common/keyhandler.c
--- xen-unstable/xen/common/keyhandler.c        2005-02-07 15:12:18.000000000 
+1100
+++ xen-unstable-working/xen/common/keyhandler.c        2005-02-08 
14:52:26.000000000 +1100
@@ -27,7 +27,7 @@ static struct {
 
 static unsigned char keypress_key;
 
-void keypress_softirq(void)
+static void keypress_softirq(void)
 {
     keyhandler_t *h;
     unsigned char key = keypress_key;
@@ -94,7 +94,7 @@ static void halt_machine(unsigned char k
     machine_restart(NULL); 
 }
 
-void do_task_queues(unsigned char key)
+static void do_task_queues(unsigned char key)
 {
     struct domain *d;
     struct exec_domain *ed;
diff -urpN --exclude TAGS -X 
/home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal 
xen-unstable/xen/common/physdev.c xen-unstable-working/xen/common/physdev.c
--- xen-unstable/xen/common/physdev.c   2005-02-07 15:12:18.000000000 +1100
+++ xen-unstable-working/xen/common/physdev.c   2005-02-08 14:53:23.000000000 
+1100
@@ -720,7 +720,7 @@ string_param("physdev_dom0_hide", opt_ph
 
 /* Test if boot params specify this device should NOT be visible to DOM0
  * (e.g. so that another domain can control it instead) */
-int pcidev_dom0_hidden(struct pci_dev *dev)
+static int pcidev_dom0_hidden(struct pci_dev *dev)
 {
     char cmp[10] = "(.......)";
     
diff -urpN --exclude TAGS -X 
/home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal 
xen-unstable/xen/common/resource.c xen-unstable-working/xen/common/resource.c
--- xen-unstable/xen/common/resource.c  2005-02-07 15:12:18.000000000 +1100
+++ xen-unstable-working/xen/common/resource.c  2005-02-08 14:50:43.000000000 
+1100
@@ -254,19 +254,6 @@ struct resource * __request_region(struc
        return res;
 }
 
-int __check_region(struct resource *parent, unsigned long start, unsigned long 
n)
-{
-       struct resource * res;
-
-       res = __request_region(parent, start, n, "check-region");
-       if (!res)
-               return -EBUSY;
-
-       release_resource(res);
-       xfree(res);
-       return 0;
-}
-
 void __release_region(struct resource *parent, unsigned long start, unsigned 
long n)
 {
        struct resource **p;
diff -urpN --exclude TAGS -X 
/home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal 
xen-unstable/xen/common/sched_bvt.c xen-unstable-working/xen/common/sched_bvt.c
--- xen-unstable/xen/common/sched_bvt.c 2005-02-07 15:12:22.000000000 +1100
+++ xen-unstable-working/xen/common/sched_bvt.c 2005-02-08 15:13:17.000000000 
+1100
@@ -167,7 +167,7 @@ static inline u32 calc_evt(struct exec_d
  *
  * Returns non-zero on failure.
  */
-int bvt_alloc_task(struct exec_domain *ed)
+static int bvt_alloc_task(struct exec_domain *ed)
 {
     struct domain *d = ed->domain;
     if ( (d->sched_priv == NULL) ) {
@@ -184,7 +184,7 @@ int bvt_alloc_task(struct exec_domain *e
 /*
  * Add and remove a domain
  */
-void bvt_add_task(struct exec_domain *d) 
+static void bvt_add_task(struct exec_domain *d) 
 {
     struct bvt_dom_info *inf = BVT_INFO(d->domain);
     struct bvt_edom_info *einf = EBVT_INFO(d);
@@ -225,7 +225,7 @@ void bvt_add_task(struct exec_domain *d)
     }
 }
 
-int bvt_init_idle_task(struct exec_domain *p)
+static int bvt_init_idle_task(struct exec_domain *p)
 {
     if ( bvt_alloc_task(p) < 0 )
         return -1;
@@ -239,7 +239,7 @@ int bvt_init_idle_task(struct exec_domai
     return 0;
 }
 
-void bvt_wake(struct exec_domain *d)
+static void bvt_wake(struct exec_domain *d)
 {
     struct bvt_edom_info *einf = EBVT_INFO(d);
     struct exec_domain  *curr;
@@ -290,14 +290,14 @@ static void bvt_sleep(struct exec_domain
  * bvt_free_task - free BVT private structures for a task
  * @d:             task
  */
-void bvt_free_task(struct domain *d)
+static void bvt_free_task(struct domain *d)
 {
     ASSERT(d->sched_priv != NULL);
     xfree(d->sched_priv);
 }
 
 /* Control the scheduler. */
-int bvt_ctl(struct sched_ctl_cmd *cmd)
+static int bvt_ctl(struct sched_ctl_cmd *cmd)
 {
     struct bvt_ctl *params = &cmd->u.bvt;
 
@@ -310,7 +310,7 @@ int bvt_ctl(struct sched_ctl_cmd *cmd)
 }
 
 /* Adjust scheduling parameter for a given domain. */
-int bvt_adjdom(
+static int bvt_adjdom(
     struct domain *d, struct sched_adjdom_cmd *cmd)
 {
     struct bvt_adjdom *params = &cmd->u.bvt;
@@ -549,7 +549,7 @@ static void bvt_dump_cpu_state(int i)
 }
 
 /* Initialise the data structures. */
-int bvt_init_scheduler()
+static int bvt_init_scheduler(void)
 {
     int i;
 
diff -urpN --exclude TAGS -X 
/home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal 
xen-unstable/xen/drivers/pci/Makefile 
xen-unstable-working/xen/drivers/pci/Makefile
--- xen-unstable/xen/drivers/pci/Makefile       2005-02-07 15:12:21.000000000 
+1100
+++ xen-unstable-working/xen/drivers/pci/Makefile       2005-02-08 
14:57:46.000000000 +1100
@@ -4,7 +4,7 @@
 
 include $(BASEDIR)/Rules.mk
 
-OBJS := pci.o quirks.o compat.o names.o setup-res.o
+OBJS := pci.o quirks.o names.o setup-res.o
 
 #obj-$(CONFIG_PCI) += pci.o quirks.o compat.o names.o
 #obj-$(CONFIG_PROC_FS) += proc.o
diff -urpN --exclude TAGS -X 
/home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal 
xen-unstable/xen/drivers/pci/compat.c 
xen-unstable-working/xen/drivers/pci/compat.c
--- xen-unstable/xen/drivers/pci/compat.c       2005-02-07 15:12:20.000000000 
+1100
+++ xen-unstable-working/xen/drivers/pci/compat.c       1970-01-01 
10:00:00.000000000 +1000
@@ -1,65 +0,0 @@
-/*
- *     $Id: compat.c,v 1.1 1998/02/16 10:35:50 mj Exp $
- *
- *     PCI Bus Services -- Function For Backward Compatibility
- *
- *     Copyright 1998--2000 Martin Mares <mj@xxxxxx>
- */
-
-#include <xen/types.h>
-//#include <xen/kernel.h>
-#include <xen/pci.h>
-
-int
-pcibios_present(void)
-{
-       return !list_empty(&pci_devices);
-}
-
-int
-pcibios_find_class(unsigned int class, unsigned short index, unsigned char 
*bus, unsigned char *devfn)
-{
-       const struct pci_dev *dev = NULL;
-       int cnt = 0;
-
-       while ((dev = pci_find_class(class, dev)))
-               if (index == cnt++) {
-                       *bus = dev->bus->number;
-                       *devfn = dev->devfn;
-                       return PCIBIOS_SUCCESSFUL;
-               }
-       return PCIBIOS_DEVICE_NOT_FOUND;
-}
-
-
-int
-pcibios_find_device(unsigned short vendor, unsigned short device, unsigned 
short index,
-                   unsigned char *bus, unsigned char *devfn)
-{
-       const struct pci_dev *dev = NULL;
-       int cnt = 0;
-
-       while ((dev = pci_find_device(vendor, device, dev)))
-               if (index == cnt++) {
-                       *bus = dev->bus->number;
-                       *devfn = dev->devfn;
-                       return PCIBIOS_SUCCESSFUL;
-               }
-       return PCIBIOS_DEVICE_NOT_FOUND;
-}
-
-#define PCI_OP(rw,size,type)                                                   
\
-int pcibios_##rw##_config_##size (unsigned char bus, unsigned char dev_fn,     
\
-                                 unsigned char where, unsigned type val)       
\
-{                                                                              
\
-       struct pci_dev *dev = pci_find_slot(bus, dev_fn);                       
\
-       if (!dev) return PCIBIOS_DEVICE_NOT_FOUND;                              
\
-       return pci_##rw##_config_##size(dev, where, val);                       
\
-}
-
-PCI_OP(read, byte, char *)
-PCI_OP(read, word, short *)
-PCI_OP(read, dword, int *)
-PCI_OP(write, byte, char)
-PCI_OP(write, word, short)
-PCI_OP(write, dword, int)
diff -urpN --exclude TAGS -X 
/home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal 
xen-unstable/xen/include/xen/ioport.h 
xen-unstable-working/xen/include/xen/ioport.h
--- xen-unstable/xen/include/xen/ioport.h       2005-02-07 15:12:22.000000000 
+1100
+++ xen-unstable-working/xen/include/xen/ioport.h       2005-02-08 
14:50:28.000000000 +1100
@@ -100,17 +100,13 @@ extern int allocate_resource(struct reso
 #define request_region(start,n,name)   __request_region(&ioport_resource, 
(start), (n), (name))
 #define request_mem_region(start,n,name) __request_region(&iomem_resource, 
(start), (n), (name))
 
-extern struct resource * __request_region(struct resource *, unsigned long 
start, unsigned long n, const char *name);
-
-/* Compatibility cruft */
-#define check_region(start,n)  __check_region(&ioport_resource, (start), (n))
 #define release_region(start,n)        __release_region(&ioport_resource, 
(start), (n))
-#define check_mem_region(start,n)      __check_region(&iomem_resource, 
(start), (n))
 #define release_mem_region(start,n)    __release_region(&iomem_resource, 
(start), (n))
 
-extern int __check_region(struct resource *, unsigned long, unsigned long);
 extern void __release_region(struct resource *, unsigned long, unsigned long);
 
+extern struct resource * __request_region(struct resource *, unsigned long 
start, unsigned long n, const char *name);
+
 #define get_ioport_list(buf)   get_resource_list(&ioport_resource, buf, 
PAGE_SIZE)
 #define get_mem_list(buf)      get_resource_list(&iomem_resource, buf, 
PAGE_SIZE)
 

-- 
A bad analogy is like a leaky screwdriver -- Richard Braakman



-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.