Received: by 2002:a05:6a10:d5a5:0:0:0:0 with SMTP id gn37csp1857214pxb; Thu, 7 Oct 2021 17:07:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy7wydPY8wqVNA3cDodUo8MYYWaZXrJ2SZmORu/hU/33n/v16x+LpIHORacZB35q9cTqnn7 X-Received: by 2002:a17:90b:946:: with SMTP id dw6mr9033856pjb.49.1633651642213; Thu, 07 Oct 2021 17:07:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633651642; cv=none; d=google.com; s=arc-20160816; b=KG1ilF3P/WDCe9JMySQvzyAZkmkiJD2L7jAlaCojAJddqKDBNOwpMxn9jG+7pTjNgQ TUNcziMRY6MKyKKjonUiI7l4Y0pKhRBD5SxjbkufX7SV0ikpfUmbeY96kVn5bShMqboB szw+2XsU67r6Ah5vVUue+TJGgrtAxUInMyyc+LWIsCX9m9uIBtaeO/S+lW1RvIFWOj7m 0v3e10DNqiQiGWYvYqdFhS9f2YCvd7XKWe7T6FC42qsDxe5MsuNunVtv4n8Kl9EkKIzr Vc9K2GpJxj53Sm3FDDRirkrqCFxhtgmGJ4CVSvq9q/n+nAO8G4/yfpdO2gh07dk37Fov YlPQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=EFfOvPbeTnDs9nu6p4KZvmITcZw1ogWltMC4mwfXe4c=; b=Adbkmndn24b+ld3KO1E5fuBp45LDLtVy4R4AexqBMQ6PKZS6BIgUmHVcVlzXqNtvB/ SkjsdPK5LDG9+BxulPu3mSv3yQ5N2nkCRyguVzLbcaFyudkVOR2gjI761es+qURVuEP+ DnsPzqLZZKkpnZEGvIPaBEK63KgrFTC2+69n1yU9OcPCLkskt891Ck1mp5zuCQNGYu0J /j0v+qHY83kpabXTGviYrCO3sgNxxtOI7kFK7rDC+u+aUFLz8GE9ht1OgbJnd8YW7WtH B9JHCS9H2abmX51/UmbPPJfeIRyLPWrSZ3FHcfqvzyflpPTRGb3URHl3N0f85Xu/ohcc yL1A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s16si962942pgj.207.2021.10.07.17.07.08; Thu, 07 Oct 2021 17:07:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238345AbhJHAGu (ORCPT + 99 others); Thu, 7 Oct 2021 20:06:50 -0400 Received: from szxga01-in.huawei.com ([45.249.212.187]:27961 "EHLO szxga01-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232682AbhJHAGu (ORCPT ); Thu, 7 Oct 2021 20:06:50 -0400 Received: from dggemv704-chm.china.huawei.com (unknown [172.30.72.57]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4HQSxp5ksLzbn6R; Fri, 8 Oct 2021 08:00:30 +0800 (CST) Received: from dggpeml100016.china.huawei.com (7.185.36.216) by dggemv704-chm.china.huawei.com (10.3.19.47) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.8; Fri, 8 Oct 2021 08:04:46 +0800 Received: from DESKTOP-27KDQMV.china.huawei.com (10.174.148.223) by dggpeml100016.china.huawei.com (7.185.36.216) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.8; Fri, 8 Oct 2021 08:04:45 +0800 From: "Longpeng(Mike)" To: , , , CC: , , , "Longpeng(Mike)" Subject: [PATCH v3 1/2] iommu/vt-d: convert the return type of first_pte_in_page to bool Date: Fri, 8 Oct 2021 08:04:32 +0800 Message-ID: <20211008000433.1115-2-longpeng2@huawei.com> X-Mailer: git-send-email 2.25.0.windows.1 In-Reply-To: <20211008000433.1115-1-longpeng2@huawei.com> References: <20211008000433.1115-1-longpeng2@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.174.148.223] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To dggpeml100016.china.huawei.com (7.185.36.216) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org first_pte_in_page() returns boolean value, 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) --- include/linux/intel-iommu.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/linux/intel-iommu.h b/include/linux/intel-iommu.h index 05a65eb..9bcabc7 100644 --- a/include/linux/intel-iommu.h +++ b/include/linux/intel-iommu.h @@ -708,9 +708,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); -- 1.8.3.1