diff options
author | kaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk> | 2006-03-22 12:21:44 +0100 |
---|---|---|
committer | kaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk> | 2006-03-22 12:21:44 +0100 |
commit | 6d10e95f6fd6f4c8284648649fe939878c2e5cfe (patch) | |
tree | ff0328ad243aa6d09370e24a91b9f49e4bdf1d21 | |
parent | ea509d3a44c36e91766edff2ffbc5715f05ff449 (diff) | |
download | xen-6d10e95f6fd6f4c8284648649fe939878c2e5cfe.tar.gz xen-6d10e95f6fd6f4c8284648649fe939878c2e5cfe.tar.bz2 xen-6d10e95f6fd6f4c8284648649fe939878c2e5cfe.zip |
A few cleanups based on comments from Arjan van de Ven.
Signed-off-by: Keir Fraser <keir@xensource.com>
-rw-r--r-- | linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c | 3 | ||||
-rw-r--r-- | linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c | 58 | ||||
-rw-r--r-- | linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_xs.c | 4 |
3 files changed, 24 insertions, 41 deletions
diff --git a/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c b/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c index 2f52c52a33..903532ff39 100644 --- a/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c +++ b/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c @@ -68,9 +68,6 @@ #define NET_TX_RING_SIZE __RING_SIZE((netif_tx_sring_t *)0, PAGE_SIZE) #define NET_RX_RING_SIZE __RING_SIZE((netif_rx_sring_t *)0, PAGE_SIZE) -#ifndef __GFP_NOWARN -#define __GFP_NOWARN 0 -#endif #define alloc_xen_skb(_l) __dev_alloc_skb((_l), GFP_ATOMIC|__GFP_NOWARN) #define init_skb_shinfo(_skb) \ diff --git a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c index 89060dde9e..84f35c8841 100644 --- a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c +++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c @@ -54,16 +54,14 @@ extern struct mutex xenwatch_mutex; -#define streq(a, b) (strcmp((a), (b)) == 0) - static struct notifier_block *xenstore_chain; /* If something in array of ids matches this device, return it. */ static const struct xenbus_device_id * match_device(const struct xenbus_device_id *arr, struct xenbus_device *dev) { - for (; !streq(arr->devicetype, ""); arr++) { - if (streq(arr->devicetype, dev->devicetype)) + for (; *arr->devicetype != '\0'; arr++) { + if (!strcmp(arr->devicetype, dev->devicetype)) return arr; } return NULL; @@ -109,6 +107,23 @@ static int frontend_bus_id(char bus_id[BUS_ID_SIZE], const char *nodename) } +static void free_otherend_details(struct xenbus_device *dev) +{ + kfree(dev->otherend); + dev->otherend = NULL; +} + + +static void free_otherend_watch(struct xenbus_device *dev) +{ + if (dev->otherend_watch.node) { + unregister_xenbus_watch(&dev->otherend_watch); + kfree(dev->otherend_watch.node); + dev->otherend_watch.node = NULL; + } +} + + static int read_otherend_details(struct xenbus_device *xendev, char *id_node, char *path_node) { @@ -126,8 +141,7 @@ static int read_otherend_details(struct xenbus_device *xendev, !xenbus_exists(XBT_NULL, xendev->otherend, "")) { xenbus_dev_fatal(xendev, -ENOENT, "missing other end from %s", xendev->nodename); - kfree(xendev->otherend); - xendev->otherend = NULL; + free_otherend_details(xendev); return -ENOENT; } @@ -147,23 +161,6 @@ static int read_frontend_details(struct xenbus_device *xendev) } -static void free_otherend_details(struct xenbus_device *dev) -{ - kfree(dev->otherend); - dev->otherend = NULL; -} - - -static void free_otherend_watch(struct xenbus_device *dev) -{ - if (dev->otherend_watch.node) { - unregister_xenbus_watch(&dev->otherend_watch); - kfree(dev->otherend_watch.node); - dev->otherend_watch.node = NULL; - } -} - - /* Bus type for frontend drivers. */ static int xenbus_probe_frontend(const char *type, const char *name); static struct xen_bus_type xenbus_frontend = { @@ -438,7 +435,7 @@ static int cmp_dev(struct device *dev, void *data) struct xenbus_device *xendev = to_xenbus_device(dev); struct xb_find_info *info = data; - if (streq(xendev->nodename, info->nodename)) { + if (!strcmp(xendev->nodename, info->nodename)) { info->dev = xendev; get_device(dev); return 1; @@ -490,15 +487,10 @@ static void xenbus_cleanup_devices(const char *path, struct bus_type *bus) } while (info.dev); } -static void xenbus_dev_free(struct xenbus_device *xendev) -{ - kfree(xendev); -} - static void xenbus_dev_release(struct device *dev) { if (dev) - xenbus_dev_free(to_xenbus_device(dev)); + kfree(to_xenbus_device(dev)); } /* Simplified asprintf. */ @@ -587,7 +579,7 @@ static int xenbus_probe_node(struct xen_bus_type *bus, return 0; fail: - xenbus_dev_free(xendev); + kfree(xendev); return err; } @@ -1022,10 +1014,6 @@ static int __init xenbus_probe_init(void) if (!page) return -ENOMEM; - /* We don't refcnt properly, so set reserved on page. - * (this allocation is permanent) */ - SetPageReserved(virt_to_page(page)); - xen_start_info->store_mfn = pfn_to_mfn(virt_to_phys((void *)page) >> PAGE_SHIFT); diff --git a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_xs.c b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_xs.c index 3016b81753..7e343eff21 100644 --- a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_xs.c +++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_xs.c @@ -48,8 +48,6 @@ /* xenbus_probe.c */ extern char *kasprintf(const char *fmt, ...); -#define streq(a, b) (strcmp((a), (b)) == 0) - struct xs_stored_msg { struct list_head list; @@ -107,7 +105,7 @@ static int get_error(const char *errorstring) { unsigned int i; - for (i = 0; !streq(errorstring, xsd_errors[i].errstring); i++) { + for (i = 0; strcmp(errorstring, xsd_errors[i].errstring) != 0; i++) { if (i == ARRAY_SIZE(xsd_errors) - 1) { printk(KERN_WARNING "XENBUS xen store gave: unknown error %s", |