ia64/xen-unstable

changeset 9388:ecb99d1ce57d

A few cleanups based on comments from Arjan van de Ven.

Signed-off-by: Keir Fraser <keir@xensource.com>
author kaf24@firebug.cl.cam.ac.uk
date Wed Mar 22 12:21:44 2006 +0100 (2006-03-22)
parents b8cc4df90187
children b2828004f131 4080ec91a014
files linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_xs.c
line diff
     1.1 --- a/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c	Wed Mar 22 11:55:43 2006 +0100
     1.2 +++ b/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c	Wed Mar 22 12:21:44 2006 +0100
     1.3 @@ -68,9 +68,6 @@
     1.4  #define NET_TX_RING_SIZE __RING_SIZE((netif_tx_sring_t *)0, PAGE_SIZE)
     1.5  #define NET_RX_RING_SIZE __RING_SIZE((netif_rx_sring_t *)0, PAGE_SIZE)
     1.6  
     1.7 -#ifndef __GFP_NOWARN
     1.8 -#define __GFP_NOWARN 0
     1.9 -#endif
    1.10  #define alloc_xen_skb(_l) __dev_alloc_skb((_l), GFP_ATOMIC|__GFP_NOWARN)
    1.11  
    1.12  #define init_skb_shinfo(_skb)                         \
     2.1 --- a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c	Wed Mar 22 11:55:43 2006 +0100
     2.2 +++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c	Wed Mar 22 12:21:44 2006 +0100
     2.3 @@ -54,16 +54,14 @@
     2.4  
     2.5  extern struct mutex xenwatch_mutex;
     2.6  
     2.7 -#define streq(a, b) (strcmp((a), (b)) == 0)
     2.8 -
     2.9  static struct notifier_block *xenstore_chain;
    2.10  
    2.11  /* If something in array of ids matches this device, return it. */
    2.12  static const struct xenbus_device_id *
    2.13  match_device(const struct xenbus_device_id *arr, struct xenbus_device *dev)
    2.14  {
    2.15 -	for (; !streq(arr->devicetype, ""); arr++) {
    2.16 -		if (streq(arr->devicetype, dev->devicetype))
    2.17 +	for (; *arr->devicetype != '\0'; arr++) {
    2.18 +		if (!strcmp(arr->devicetype, dev->devicetype))
    2.19  			return arr;
    2.20  	}
    2.21  	return NULL;
    2.22 @@ -109,6 +107,23 @@ static int frontend_bus_id(char bus_id[B
    2.23  }
    2.24  
    2.25  
    2.26 +static void free_otherend_details(struct xenbus_device *dev)
    2.27 +{
    2.28 +	kfree(dev->otherend);
    2.29 +	dev->otherend = NULL;
    2.30 +}
    2.31 +
    2.32 +
    2.33 +static void free_otherend_watch(struct xenbus_device *dev)
    2.34 +{
    2.35 +	if (dev->otherend_watch.node) {
    2.36 +		unregister_xenbus_watch(&dev->otherend_watch);
    2.37 +		kfree(dev->otherend_watch.node);
    2.38 +		dev->otherend_watch.node = NULL;
    2.39 +	}
    2.40 +}
    2.41 +
    2.42 +
    2.43  static int read_otherend_details(struct xenbus_device *xendev,
    2.44  				 char *id_node, char *path_node)
    2.45  {
    2.46 @@ -126,8 +141,7 @@ static int read_otherend_details(struct 
    2.47  	    !xenbus_exists(XBT_NULL, xendev->otherend, "")) {
    2.48  		xenbus_dev_fatal(xendev, -ENOENT, "missing other end from %s",
    2.49  				 xendev->nodename);
    2.50 -		kfree(xendev->otherend);
    2.51 -		xendev->otherend = NULL;
    2.52 +		free_otherend_details(xendev);
    2.53  		return -ENOENT;
    2.54  	}
    2.55  
    2.56 @@ -147,23 +161,6 @@ static int read_frontend_details(struct 
    2.57  }
    2.58  
    2.59  
    2.60 -static void free_otherend_details(struct xenbus_device *dev)
    2.61 -{
    2.62 -	kfree(dev->otherend);
    2.63 -	dev->otherend = NULL;
    2.64 -}
    2.65 -
    2.66 -
    2.67 -static void free_otherend_watch(struct xenbus_device *dev)
    2.68 -{
    2.69 -	if (dev->otherend_watch.node) {
    2.70 -		unregister_xenbus_watch(&dev->otherend_watch);
    2.71 -		kfree(dev->otherend_watch.node);
    2.72 -		dev->otherend_watch.node = NULL;
    2.73 -	}
    2.74 -}
    2.75 -
    2.76 -
    2.77  /* Bus type for frontend drivers. */
    2.78  static int xenbus_probe_frontend(const char *type, const char *name);
    2.79  static struct xen_bus_type xenbus_frontend = {
    2.80 @@ -438,7 +435,7 @@ static int cmp_dev(struct device *dev, v
    2.81  	struct xenbus_device *xendev = to_xenbus_device(dev);
    2.82  	struct xb_find_info *info = data;
    2.83  
    2.84 -	if (streq(xendev->nodename, info->nodename)) {
    2.85 +	if (!strcmp(xendev->nodename, info->nodename)) {
    2.86  		info->dev = xendev;
    2.87  		get_device(dev);
    2.88  		return 1;
    2.89 @@ -490,15 +487,10 @@ static void xenbus_cleanup_devices(const
    2.90  	} while (info.dev);
    2.91  }
    2.92  
    2.93 -static void xenbus_dev_free(struct xenbus_device *xendev)
    2.94 -{
    2.95 -	kfree(xendev);
    2.96 -}
    2.97 -
    2.98  static void xenbus_dev_release(struct device *dev)
    2.99  {
   2.100  	if (dev)
   2.101 -		xenbus_dev_free(to_xenbus_device(dev));
   2.102 +		kfree(to_xenbus_device(dev));
   2.103  }
   2.104  
   2.105  /* Simplified asprintf. */
   2.106 @@ -587,7 +579,7 @@ static int xenbus_probe_node(struct xen_
   2.107  
   2.108  	return 0;
   2.109  fail:
   2.110 -	xenbus_dev_free(xendev);
   2.111 +	kfree(xendev);
   2.112  	return err;
   2.113  }
   2.114  
   2.115 @@ -1022,10 +1014,6 @@ static int __init xenbus_probe_init(void
   2.116  		if (!page)
   2.117  			return -ENOMEM;
   2.118  
   2.119 -		/* We don't refcnt properly, so set reserved on page.
   2.120 -		 * (this allocation is permanent) */
   2.121 -		SetPageReserved(virt_to_page(page));
   2.122 -
   2.123  		xen_start_info->store_mfn =
   2.124  			pfn_to_mfn(virt_to_phys((void *)page) >>
   2.125  				   PAGE_SHIFT);
     3.1 --- a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_xs.c	Wed Mar 22 11:55:43 2006 +0100
     3.2 +++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_xs.c	Wed Mar 22 12:21:44 2006 +0100
     3.3 @@ -48,8 +48,6 @@
     3.4  /* xenbus_probe.c */
     3.5  extern char *kasprintf(const char *fmt, ...);
     3.6  
     3.7 -#define streq(a, b) (strcmp((a), (b)) == 0)
     3.8 -
     3.9  struct xs_stored_msg {
    3.10  	struct list_head list;
    3.11  
    3.12 @@ -107,7 +105,7 @@ static int get_error(const char *errorst
    3.13  {
    3.14  	unsigned int i;
    3.15  
    3.16 -	for (i = 0; !streq(errorstring, xsd_errors[i].errstring); i++) {
    3.17 +	for (i = 0; strcmp(errorstring, xsd_errors[i].errstring) != 0; i++) {
    3.18  		if (i == ARRAY_SIZE(xsd_errors) - 1) {
    3.19  			printk(KERN_WARNING
    3.20  			       "XENBUS xen store gave: unknown error %s",