Skip to contentSkip to conversation

YA trivial patch: statics, remove check_region, remove pci/compat.c

PATCH New Rusty Russell 1 participant 1 message Feb 8, 2005

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

xen/common/keyhandler.c +2 -2
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
@@ -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;
xen/common/physdev.c +1 -1
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
@@ -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] = "(.......)";
     
xen/common/resource.c +0 -13
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
@@ -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;
xen/common/sched_bvt.c +8 -8
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
@@ -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;
 
xen/drivers/pci/Makefile +1 -1
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
@@ -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
xen/drivers/pci/compat.c +0 -65

65 lines not on this page · raw message

xen/include/xen/ioport.h +2 -6
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
@@ -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)
 
Signature · 9 lines
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