From: Jan Beulich Date: Tue, 5 Apr 2011 11:39:33 +0000 (+0100) Subject: xen: miscellaneous adjustments (mostly missing from earlier upstream merges) X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=5344bc199c2076d788b6fd78734d37232beeb0d2;p=legacy%2Flinux-2.6.18-xen.git xen: 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 --- diff --git a/arch/i386/mm/ioremap-xen.c b/arch/i386/mm/ioremap-xen.c index 4df793cd..d76d9184 100644 --- 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_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). diff --git a/arch/x86_64/kernel/process-xen.c b/arch/x86_64/kernel/process-xen.c index 90d83dcb..890f4622 100644 --- a/arch/x86_64/kernel/process-xen.c +++ b/arch/x86_64/kernel/process-xen.c @@ -50,7 +50,6 @@ #include #include #include -#include #include #include #include diff --git a/drivers/char/agp/intel-agp.c b/drivers/char/agp/intel-agp.c index b48b11bb..ed1c2518 100644 --- a/drivers/char/agp/intel-agp.c +++ b/drivers/char/agp/intel-agp.c @@ -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; } diff --git a/drivers/xen/balloon/balloon.c b/drivers/xen/balloon/balloon.c index b7532bdb..f2ad1a56 100644 --- 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 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"); diff --git a/drivers/xen/blkback/interface.c b/drivers/xen/blkback/interface.c index 70310e28..7ef97dbf 100644 --- 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); diff --git a/drivers/xen/blktap/interface.c b/drivers/xen/blktap/interface.c index af363f3f..55754a9a 100644 --- 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); diff --git a/drivers/xen/blktap2/control.c b/drivers/xen/blktap2/control.c index dd3da95a..7d908a07 100644 --- a/drivers/xen/blktap2/control.c +++ b/drivers/xen/blktap2/control.c @@ -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, }; diff --git a/drivers/xen/blktap2/ring.c b/drivers/xen/blktap2/ring.c index 9c58ca01..f352d26e 100644 --- a/drivers/xen/blktap2/ring.c +++ b/drivers/xen/blktap2/ring.c @@ -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, diff --git a/drivers/xen/core/xen_proc.c b/drivers/xen/core/xen_proc.c index 74242732..fe24d783 100644 --- 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_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 diff --git a/drivers/xen/netback/common.h b/drivers/xen/netback/common.h index d6efdae4..22a9faa8 100644 --- a/drivers/xen/netback/common.h +++ b/drivers/xen/netback/common.h @@ -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 */ diff --git a/drivers/xen/netback/interface.c b/drivers/xen/netback/interface.c index b1759916..1adbf26f 100644 --- a/drivers/xen/netback/interface.c +++ b/drivers/xen/netback/interface.c @@ -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) diff --git a/drivers/xen/scsiback/interface.c b/drivers/xen/scsiback/interface.c index 4c1cb238..0e5a7ca2 100644 --- a/drivers/xen/scsiback/interface.c +++ b/drivers/xen/scsiback/interface.c @@ -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); diff --git a/drivers/xen/tpmback/interface.c b/drivers/xen/tpmback/interface.c index 79baf313..d1ed03d2 100644 --- a/drivers/xen/tpmback/interface.c +++ b/drivers/xen/tpmback/interface.c @@ -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; diff --git a/drivers/xen/xenbus/xenbus_probe.c b/drivers/xen/xenbus/xenbus_probe.c index 0c0f6887..9e6a67d3 100644 --- a/drivers/xen/xenbus/xenbus_probe.c +++ b/drivers/xen/xenbus/xenbus_probe.c @@ -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) diff --git a/include/asm-i386/mach-xen/asm/pgtable.h b/include/asm-i386/mach-xen/asm/pgtable.h index 207f8c07..7f72712a 100644 --- 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(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); diff --git a/include/asm-x86_64/mach-xen/asm/pgtable.h b/include/asm-x86_64/mach-xen/asm/pgtable.h index ea5fc556..37ff7cef 100644 --- 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_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);