]> xenbits.xensource.com Git - legacy/linux-2.6.18-xen.git/commitdiff
xen: miscellaneous adjustments (mostly missing from earlier upstream merges)
authorJan Beulich <jbeulich@novell.com>
Tue, 5 Apr 2011 11:39:33 +0000 (12:39 +0100)
committerJan Beulich <jbeulich@novell.com>
Tue, 5 Apr 2011 11:39:33 +0000 (12:39 +0100)
Remove unused bits, use kmem_cache_zalloc(), consistently constify
instances of struct file_operations, fix an error cleanup path.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
16 files changed:
arch/i386/mm/ioremap-xen.c
arch/x86_64/kernel/process-xen.c
drivers/char/agp/intel-agp.c
drivers/xen/balloon/balloon.c
drivers/xen/blkback/interface.c
drivers/xen/blktap/interface.c
drivers/xen/blktap2/control.c
drivers/xen/blktap2/ring.c
drivers/xen/core/xen_proc.c
drivers/xen/netback/common.h
drivers/xen/netback/interface.c
drivers/xen/scsiback/interface.c
drivers/xen/tpmback/interface.c
drivers/xen/xenbus/xenbus_probe.c
include/asm-i386/mach-xen/asm/pgtable.h
include/asm-x86_64/mach-xen/asm/pgtable.h

index 4df793cdd818f602cac1dbb48bd3faea46f997d9..d76d9184a468aa68eab0f8493e9263dd8eb00962 100644 (file)
@@ -154,21 +154,6 @@ int create_lookup_pte_addr(struct mm_struct *mm,
 
 EXPORT_SYMBOL(create_lookup_pte_addr);
 
-static int noop_fn(
-       pte_t *pte, struct page *pmd_page, unsigned long addr, void *data)
-{
-       return 0;
-}
-
-int touch_pte_range(struct mm_struct *mm,
-                   unsigned long address,
-                   unsigned long size)
-{
-       return apply_to_page_range(mm, address, size, noop_fn, NULL);
-} 
-
-EXPORT_SYMBOL(touch_pte_range);
-
 /*
  * Does @address reside within a non-highmem page that is local to this virtual
  * machine (i.e., not an I/O page, nor a memory page belonging to another VM).
index 90d83dcb66bbaad3c4b139c3444ce65a446aedad..890f46224ba6e809daabd1f51a685fda38f83032 100644 (file)
@@ -50,7 +50,6 @@
 #include <asm/pda.h>
 #include <asm/prctl.h>
 #include <asm/kdebug.h>
-#include <xen/interface/platform.h>
 #include <xen/interface/physdev.h>
 #include <xen/interface/vcpu.h>
 #include <asm/desc.h>
index b48b11bb96266eba214783fd7aa78562dd15cfd2..ed1c251805fd8a8676f908cb1ed48c93583e0b9a 100644 (file)
@@ -174,6 +174,10 @@ static void *i8xx_alloc_pages(void)
        if (change_page_attr(page, 4, PAGE_KERNEL_NOCACHE) < 0) {
                change_page_attr(page, 4, PAGE_KERNEL);
                global_flush_tlb();
+#ifdef CONFIG_XEN
+               xen_destroy_contiguous_region((unsigned long)page_address(page),
+                                             2);
+#endif
                __free_pages(page, 2);
                return NULL;
        }
index b7532bdba49eab1af88628c831ce9296e69fe881..f2ad1a560cb787c53d7496419050cb5d63d5dc44 100644 (file)
@@ -111,7 +111,6 @@ static LIST_HEAD(ballooned_pages);
 /* Main work function, always executed in process context. */
 static void balloon_process(void *unused);
 static DECLARE_WORK(balloon_worker, balloon_process, NULL);
-static struct timer_list balloon_timer;
 
 /* When ballooning out (allocating memory to return to Xen) we don't really 
    want the kernel to try too hard since that can trigger the oom killer. */
@@ -197,6 +196,7 @@ static void balloon_alarm(unsigned long unused)
 {
        schedule_work(&balloon_worker);
 }
+static DEFINE_TIMER(balloon_timer, balloon_alarm, 0, 0);
 
 static unsigned long current_target(void)
 {
@@ -563,10 +563,6 @@ static int __init balloon_init(void)
        bs.balloon_high  = 0;
        bs.driver_pages  = 0UL;
 
-       init_timer(&balloon_timer);
-       balloon_timer.data = 0;
-       balloon_timer.function = balloon_alarm;
-    
 #ifdef CONFIG_PROC_FS
        if ((balloon_pde = create_xen_proc_entry("balloon", 0644)) == NULL) {
                WPRINTK("Unable to create /proc/xen/balloon.\n");
index 70310e288bbbfc0907394e92452a7a672edc6d69..7ef97dbf7e7add0c07b4d226af20f53da10c9e4d 100644 (file)
@@ -41,11 +41,10 @@ blkif_t *blkif_alloc(domid_t domid)
 {
        blkif_t *blkif;
 
-       blkif = kmem_cache_alloc(blkif_cachep, GFP_KERNEL);
+       blkif = kmem_cache_zalloc(blkif_cachep, GFP_KERNEL);
        if (!blkif)
                return ERR_PTR(-ENOMEM);
 
-       memset(blkif, 0, sizeof(*blkif));
        blkif->domid = domid;
        spin_lock_init(&blkif->blk_ring_lock);
        atomic_set(&blkif->refcnt, 1);
index af363f3f1d2cc7f140e9e7cf56b47bdc339dbcdb..55754a9a4aa8520390abb02451d06b3b63ba4f1c 100644 (file)
@@ -41,11 +41,10 @@ blkif_t *tap_alloc_blkif(domid_t domid)
 {
        blkif_t *blkif;
 
-       blkif = kmem_cache_alloc(blkif_cachep, GFP_KERNEL);
+       blkif = kmem_cache_zalloc(blkif_cachep, GFP_KERNEL);
        if (!blkif)
                return ERR_PTR(-ENOMEM);
 
-       memset(blkif, 0, sizeof(*blkif));
        blkif->domid = domid;
        spin_lock_init(&blkif->blk_ring_lock);
        atomic_set(&blkif->refcnt, 1);
index dd3da95a553f0effdf97f7d9c86527306b7161b7..7d908a073b17d9674a178cfc8eab95ac9d7d90d5 100644 (file)
@@ -145,7 +145,7 @@ blktap_control_ioctl(struct inode *inode, struct file *filp,
        return -ENOIOCTLCMD;
 }
 
-static struct file_operations blktap_control_file_operations = {
+static const struct file_operations blktap_control_file_operations = {
        .owner    = THIS_MODULE,
        .ioctl    = blktap_control_ioctl,
 };
index 9c58ca01b53a6bfb2553591b04dafc93ecf64326..f352d26e57529038072464a14b0bbb0373c0da7c 100644 (file)
@@ -479,7 +479,7 @@ static unsigned int blktap_ring_poll(struct file *filp, poll_table *wait)
        return 0;
 }
 
-static struct file_operations blktap_ring_file_operations = {
+static const struct file_operations blktap_ring_file_operations = {
        .owner    = THIS_MODULE,
        .open     = blktap_ring_open,
        .release  = blktap_ring_release,
index 74242732eaf0642fde0b9cba421f83281380a3ca..fe24d7831b6c5ae93c45ffbf544d1c821713e4cd 100644 (file)
@@ -13,11 +13,13 @@ struct proc_dir_entry *create_xen_proc_entry(const char *name, mode_t mode)
        return create_proc_entry(name, mode, xen_base);
 }
 
+#ifdef MODULE
 EXPORT_SYMBOL_GPL(create_xen_proc_entry); 
+#else
 
 void remove_xen_proc_entry(const char *name)
 {
        remove_proc_entry(name, xen_base);
 }
 
-EXPORT_SYMBOL_GPL(remove_xen_proc_entry); 
+#endif
index d6efdae44cdf74f4ac6e3951274e17ce4849fcba..22a9faa8c2756905b039ab73d097453b8f8484b1 100644 (file)
@@ -91,7 +91,7 @@ typedef struct netif_st {
        struct timer_list tx_queue_timeout;
 
        /* Statistics */
-       int nr_copied_skbs;
+       unsigned long nr_copied_skbs;
 
        /* Miscellaneous private stuff. */
        struct list_head list;  /* scheduling list */
index b1759916a3876e85156b761e1ca2c1f7328d11b1..1adbf26f6a730213db7cca752026a1119202fa2a 100644 (file)
@@ -171,7 +171,7 @@ static const struct netif_stat {
        char name[ETH_GSTRING_LEN];
        u16 offset;
 } netbk_stats[] = {
-       { "copied_skbs", offsetof(netif_t, nr_copied_skbs) },
+       { "copied_skbs", offsetof(netif_t, nr_copied_skbs) / sizeof(long) },
 };
 
 static int netbk_get_stats_count(struct net_device *dev)
@@ -182,11 +182,11 @@ static int netbk_get_stats_count(struct net_device *dev)
 static void netbk_get_ethtool_stats(struct net_device *dev,
                                   struct ethtool_stats *stats, u64 * data)
 {
-       void *netif = netdev_priv(dev);
+       unsigned long *np = netdev_priv(dev);
        int i;
 
        for (i = 0; i < ARRAY_SIZE(netbk_stats); i++)
-               data[i] = *(int *)(netif + netbk_stats[i].offset);
+               data[i] = np[netbk_stats[i].offset];
 }
 
 static void netbk_get_strings(struct net_device *dev, u32 stringset, u8 * data)
index 4c1cb238ebd66e5b0cad99e80875ec22839a4017..0e5a7ca23c6cef8a494cdf7025048a9aa732a4ac 100644 (file)
@@ -47,11 +47,10 @@ struct vscsibk_info *vscsibk_info_alloc(domid_t domid)
 {
        struct vscsibk_info *info;
 
-       info = kmem_cache_alloc(scsiback_cachep, GFP_KERNEL);
+       info = kmem_cache_zalloc(scsiback_cachep, GFP_KERNEL);
        if (!info)
                return ERR_PTR(-ENOMEM);
 
-       memset(info, 0, sizeof(*info));
        info->domid = domid;
        spin_lock_init(&info->ring_lock);
        atomic_set(&info->nr_unreplied_reqs, 0);
index 79baf3134d959510d37dcb674e23844d6905cc02..d1ed03d252a63cf4cad444c7f19aa93dc86c3d04 100644 (file)
@@ -27,11 +27,10 @@ static tpmif_t *alloc_tpmif(domid_t domid, struct backend_info *bi)
 {
        tpmif_t *tpmif;
 
-       tpmif = kmem_cache_alloc(tpmif_cachep, GFP_KERNEL);
+       tpmif = kmem_cache_zalloc(tpmif_cachep, GFP_KERNEL);
        if (tpmif == NULL)
                goto out_of_memory;
 
-       memset(tpmif, 0, sizeof (*tpmif));
        tpmif->domid = domid;
        tpmif->status = DISCONNECTED;
        tpmif->bi = bi;
index 0c0f68877882a2c579b9c276875284a14f69be9e..9e6a67d3c08dd5d975fd8ce7b4394e4bdb7673d0 100644 (file)
@@ -813,7 +813,6 @@ void xenbus_suspend(void)
        xenbus_backend_suspend(suspend_dev);
        xs_suspend();
 }
-EXPORT_SYMBOL_GPL(xenbus_suspend);
 
 void xenbus_resume(void)
 {
@@ -823,7 +822,6 @@ void xenbus_resume(void)
                bus_for_each_dev(&xenbus_frontend.bus, NULL, NULL, resume_dev);
        xenbus_backend_resume(resume_dev);
 }
-EXPORT_SYMBOL_GPL(xenbus_resume);
 
 void xenbus_suspend_cancel(void)
 {
@@ -832,12 +830,15 @@ void xenbus_suspend_cancel(void)
                bus_for_each_dev(&xenbus_frontend.bus, NULL, NULL, suspend_cancel_dev);
        xenbus_backend_resume(suspend_cancel_dev);
 }
-EXPORT_SYMBOL_GPL(xenbus_suspend_cancel);
 
 /* A flag to determine if xenstored is 'ready' (i.e. has started) */
 atomic_t xenbus_xsd_state = ATOMIC_INIT(XENBUS_XSD_UNCOMMITTED);
 
-int register_xenstore_notifier(struct notifier_block *nb)
+int
+#ifdef CONFIG_XEN
+__init
+#endif
+register_xenstore_notifier(struct notifier_block *nb)
 {
        int ret = 0;
 
@@ -848,6 +849,7 @@ int register_xenstore_notifier(struct notifier_block *nb)
 
        return ret;
 }
+#ifndef CONFIG_XEN
 EXPORT_SYMBOL_GPL(register_xenstore_notifier);
 
 void unregister_xenstore_notifier(struct notifier_block *nb)
@@ -855,6 +857,7 @@ void unregister_xenstore_notifier(struct notifier_block *nb)
        blocking_notifier_chain_unregister(&xenstore_chain, nb);
 }
 EXPORT_SYMBOL_GPL(unregister_xenstore_notifier);
+#endif
 
 
 void xenbus_probe(void *unused)
index 207f8c070bac56bc1313d69de428ee94f7ae50b6..7f72712aab7e7f9fa3e0613f4b04d5c62bc444d2 100644 (file)
@@ -521,9 +521,6 @@ int direct_kernel_remap_pfn_range(unsigned long address,
 int create_lookup_pte_addr(struct mm_struct *mm,
                            unsigned long address,
                            uint64_t *ptep);
-int touch_pte_range(struct mm_struct *mm,
-                    unsigned long address,
-                    unsigned long size);
 
 int xen_change_pte_range(struct mm_struct *mm, pmd_t *pmd,
                unsigned long addr, unsigned long end, pgprot_t newprot);
index ea5fc556580ad0bf25242c2c6fb8a8d6453c7834..37ff7cef0173d4bffb7467ea18d44bc340c0dca4 100644 (file)
@@ -394,7 +394,6 @@ static inline int pmd_large(pmd_t pte) {
 
 /*
  * Level 4 access.
- * Never use these in the common code.
  */
 #define pgd_page(pgd) ((unsigned long) __va(pgd_val(pgd) & PTE_MASK))
 #define pgd_index(address) (((address) >> PGDIR_SHIFT) & (PTRS_PER_PGD-1))
@@ -543,10 +542,6 @@ int create_lookup_pte_addr(struct mm_struct *mm,
                            unsigned long address,
                            uint64_t *ptep);
 
-int touch_pte_range(struct mm_struct *mm,
-                    unsigned long address,
-                    unsigned long size);
-
 int xen_change_pte_range(struct mm_struct *mm, pmd_t *pmd,
                unsigned long addr, unsigned long end, pgprot_t newprot);