[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen master] AMD/IOMMU: Clean up the allocation helpers
commit d0bc4cd3ae6b9f48e7fc782cdf0cc1073cf8cec1 Author: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> AuthorDate: Thu Sep 20 16:37:42 2018 +0100 Commit: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> CommitDate: Fri Feb 14 18:01:52 2020 +0000 AMD/IOMMU: Clean up the allocation helpers Conform to style, drop unnecessary local variables, and avoid opencoding clear_domain_page(). Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> Reviewed-by: Paul Durrant <pdurrant@xxxxxxxxxx> Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx> --- xen/drivers/passthrough/amd/iommu.h | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/xen/drivers/passthrough/amd/iommu.h b/xen/drivers/passthrough/amd/iommu.h index 2297ac8e73..5dfa0d88d5 100644 --- a/xen/drivers/passthrough/amd/iommu.h +++ b/xen/drivers/passthrough/amd/iommu.h @@ -341,34 +341,28 @@ static inline unsigned long region_to_pages(unsigned long addr, unsigned long si return (PAGE_ALIGN(addr + size) - (addr & PAGE_MASK)) >> PAGE_SHIFT; } -static inline struct page_info* alloc_amd_iommu_pgtable(void) +static inline struct page_info *alloc_amd_iommu_pgtable(void) { - struct page_info *pg; - void *vaddr; - - pg = alloc_domheap_page(NULL, 0); - if ( pg == NULL ) - return 0; - vaddr = __map_domain_page(pg); - memset(vaddr, 0, PAGE_SIZE); - unmap_domain_page(vaddr); + struct page_info *pg = alloc_domheap_page(NULL, 0); + + if ( pg ) + clear_domain_page(page_to_mfn(pg)); + return pg; } static inline void free_amd_iommu_pgtable(struct page_info *pg) { - if ( pg != 0 ) + if ( pg ) free_domheap_page(pg); } -static inline void* __alloc_amd_iommu_tables(int order) +static inline void *__alloc_amd_iommu_tables(unsigned int order) { - void *buf; - buf = alloc_xenheap_pages(order, 0); - return buf; + return alloc_xenheap_pages(order, 0); } -static inline void __free_amd_iommu_tables(void *table, int order) +static inline void __free_amd_iommu_tables(void *table, unsigned int order) { free_xenheap_pages(table, order); } -- generated by git-patchbot for /home/xen/git/xen.git#master _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |