iommu/vt-d: Convert the return type of first_pte_in_page to bool
authorLongpeng(Mike) <longpeng2@huawei.com>
Thu, 14 Oct 2021 05:38:38 +0000 (13:38 +0800)
committerJoerg Roedel <jroedel@suse.de>
Mon, 18 Oct 2021 10:31:48 +0000 (12:31 +0200)
The first_pte_in_page() returns true or false, so let's convert its
return type to bool. In addition, use 'IS_ALIGNED' to make the
code more readable and neater.

Signed-off-by: Longpeng(Mike) <longpeng2@huawei.com>
Link: https://lore.kernel.org/r/20211008000433.1115-1-longpeng2@huawei.com
Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
Link: https://lore.kernel.org/r/20211014053839.727419-9-baolu.lu@linux.intel.com
Signed-off-by: Joerg Roedel <jroedel@suse.de>
include/linux/intel-iommu.h

index 65b15af3cf1aff645e053b0ac222dba8a5a26d95..52481625838c43b6c648402b8865b6f6a8a39674 100644 (file)
@@ -705,9 +705,9 @@ static inline bool dma_pte_superpage(struct dma_pte *pte)
        return (pte->val & DMA_PTE_LARGE_PAGE);
 }
 
-static inline int first_pte_in_page(struct dma_pte *pte)
+static inline bool first_pte_in_page(struct dma_pte *pte)
 {
-       return !((unsigned long)pte & ~VTD_PAGE_MASK);
+       return IS_ALIGNED((unsigned long)pte, VTD_PAGE_SIZE);
 }
 
 extern struct dmar_drhd_unit * dmar_find_matched_drhd_unit(struct pci_dev *dev);