[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH] linux-2.6.18: miscellaneous adjustments (mostly missing from earlier upstream merges)



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@xxxxxxxxxx>

--- a/arch/i386/mm/ioremap-xen.c
+++ b/arch/i386/mm/ioremap-xen.c
@@ -154,21 +154,6 @@ int create_lookup_pte_addr(struct mm_str
 
 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).
--- a/arch/x86_64/kernel/process-xen.c
+++ b/arch/x86_64/kernel/process-xen.c
@@ -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>
--- a/drivers/char/agp/intel-agp.c
+++ b/drivers/char/agp/intel-agp.c
@@ -156,6 +156,10 @@ static struct page *i8xx_alloc_pages(voi
        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;
        }
--- a/drivers/xen/balloon/balloon.c
+++ b/drivers/xen/balloon/balloon.c
@@ -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 
 {
        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");
--- a/drivers/xen/blkback/interface.c
+++ b/drivers/xen/blkback/interface.c
@@ -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);
--- a/drivers/xen/blktap/interface.c
+++ b/drivers/xen/blktap/interface.c
@@ -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);
--- a/drivers/xen/blktap2/control.c
+++ b/drivers/xen/blktap2/control.c
@@ -145,7 +145,7 @@ blktap_control_ioctl(struct inode *inode
        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,
 };
--- a/drivers/xen/blktap2/ring.c
+++ b/drivers/xen/blktap2/ring.c
@@ -479,7 +479,7 @@ static unsigned int blktap_ring_poll(str
        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,
--- a/drivers/xen/core/xen_proc.c
+++ b/drivers/xen/core/xen_proc.c
@@ -13,11 +13,13 @@ struct proc_dir_entry *create_xen_proc_e
        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
--- a/drivers/xen/netback/common.h
+++ b/drivers/xen/netback/common.h
@@ -100,7 +100,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 */
--- a/drivers/xen/netback/interface.c
+++ b/drivers/xen/netback/interface.c
@@ -169,7 +169,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)
@@ -180,11 +180,11 @@ static int netbk_get_stats_count(struct 
 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)
--- a/drivers/xen/scsiback/interface.c
+++ b/drivers/xen/scsiback/interface.c
@@ -46,11 +46,10 @@ struct vscsibk_info *vscsibk_info_alloc(
 {
        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);
--- a/drivers/xen/tpmback/interface.c
+++ b/drivers/xen/tpmback/interface.c
@@ -25,11 +25,10 @@ static tpmif_t *alloc_tpmif(domid_t domi
 {
        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;
--- a/drivers/xen/xenbus/xenbus_probe.c
+++ b/drivers/xen/xenbus/xenbus_probe.c
@@ -815,7 +815,6 @@ void xenbus_suspend(void)
        xenbus_backend_suspend(suspend_dev);
        xs_suspend();
 }
-EXPORT_SYMBOL_GPL(xenbus_suspend);
 
 void xenbus_resume(void)
 {
@@ -825,7 +824,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)
 {
@@ -834,12 +832,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;
 
@@ -851,6 +852,7 @@ int register_xenstore_notifier(struct no
 
        return ret;
 }
+#ifndef CONFIG_XEN
 EXPORT_SYMBOL_GPL(register_xenstore_notifier);
 
 void unregister_xenstore_notifier(struct notifier_block *nb)
@@ -858,6 +860,7 @@ void unregister_xenstore_notifier(struct
        blocking_notifier_chain_unregister(&xenstore_chain, nb);
 }
 EXPORT_SYMBOL_GPL(unregister_xenstore_notifier);
+#endif
 
 
 void xenbus_probe(void *unused)
--- a/include/asm-i386/mach-xen/asm/pgtable.h
+++ b/include/asm-i386/mach-xen/asm/pgtable.h
@@ -521,9 +521,6 @@ int direct_kernel_remap_pfn_range(unsign
 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);
--- a/include/asm-x86_64/mach-xen/asm/pgtable.h
+++ b/include/asm-x86_64/mach-xen/asm/pgtable.h
@@ -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_str
                            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);
 


Attachment: xen-cleanup-misc.patch
Description: Text document

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.