[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] A few cleanups based on comments from Arjan van de Ven.
# HG changeset patch # User kaf24@xxxxxxxxxxxxxxxxxxxx # Node ID ecb99d1ce57d6adb3169b38cc57219a9b98144f3 # Parent b8cc4df90187d98b358e029c542d9c7a54a523e3 A few cleanups based on comments from Arjan van de Ven. Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx> diff -r b8cc4df90187 -r ecb99d1ce57d linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c --- a/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c Wed Mar 22 10:55:43 2006 +++ b/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c Wed Mar 22 11:21:44 2006 @@ -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 -r b8cc4df90187 -r ecb99d1ce57d linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c --- a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c Wed Mar 22 10:55:43 2006 +++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c Wed Mar 22 11:21:44 2006 @@ -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; @@ -106,6 +104,23 @@ } *strchr(bus_id, '/') = '-'; return 0; +} + + +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; + } } @@ -126,8 +141,7 @@ !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; } @@ -144,23 +158,6 @@ static int read_frontend_details(struct xenbus_device *xendev) { return read_otherend_details(xendev, "frontend-id", "frontend"); -} - - -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; - } } @@ -438,7 +435,7 @@ 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 @@ } 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 @@ return 0; fail: - xenbus_dev_free(xendev); + kfree(xendev); return err; } @@ -1021,10 +1013,6 @@ page = get_zeroed_page(GFP_KERNEL); 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) >> diff -r b8cc4df90187 -r ecb99d1ce57d linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_xs.c --- a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_xs.c Wed Mar 22 10:55:43 2006 +++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_xs.c Wed Mar 22 11:21:44 2006 @@ -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 @@ { 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", _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |