From: Wei Wang <wei.w.wang@intel.com>
To: dwmw2@infradead.org, baolu.lu@linux.intel.com,
kevin.tian@intel.com, yi.l.liu@intel.com, jroedel@suse.de,
linux-kernel@vger.kernel.org, iommu@lists.linux.dev
Cc: Wei Wang <wei.w.wang@intel.com>
Subject: [PATCH v1 2/3] iommu/vt-d: Change dmar_ats_supported() to return boolean
Date: Fri, 9 May 2025 22:00:20 +0800 [thread overview]
Message-ID: <20250509140021.4029303-3-wei.w.wang@intel.com> (raw)
In-Reply-To: <20250509140021.4029303-1-wei.w.wang@intel.com>
According to "Function return values and names" in coding-style.rst, the
dmar_ats_supported() function should return a boolean instead of an
integer. Also, rename "ret" to "supported" to be more straightforward.
Signed-off-by: Wei Wang <wei.w.wang@intel.com>
---
drivers/iommu/intel/iommu.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/drivers/iommu/intel/iommu.c b/drivers/iommu/intel/iommu.c
index d8aa71305509..2778bfe14f36 100644
--- a/drivers/iommu/intel/iommu.c
+++ b/drivers/iommu/intel/iommu.c
@@ -2760,10 +2760,11 @@ static struct dmar_satc_unit *dmar_find_matched_satc_unit(struct pci_dev *dev)
return satcu;
}
-static int dmar_ats_supported(struct pci_dev *dev, struct intel_iommu *iommu)
+static bool dmar_ats_supported(struct pci_dev *dev, struct intel_iommu *iommu)
{
- int i, ret = 1;
+ int i;
struct pci_bus *bus;
+ bool supported = true;
struct pci_dev *bridge = NULL;
struct device *tmp;
struct acpi_dmar_atsr *atsr;
@@ -2786,11 +2787,11 @@ static int dmar_ats_supported(struct pci_dev *dev, struct intel_iommu *iommu)
bridge = bus->self;
/* If it's an integrated device, allow ATS */
if (!bridge)
- return 1;
+ return true;
/* Connected via non-PCIe: no ATS */
if (!pci_is_pcie(bridge) ||
pci_pcie_type(bridge) == PCI_EXP_TYPE_PCI_BRIDGE)
- return 0;
+ return false;
/* If we found the root port, look it up in the ATSR */
if (pci_pcie_type(bridge) == PCI_EXP_TYPE_ROOT_PORT)
break;
@@ -2809,11 +2810,11 @@ static int dmar_ats_supported(struct pci_dev *dev, struct intel_iommu *iommu)
if (atsru->include_all)
goto out;
}
- ret = 0;
+ supported = false;
out:
rcu_read_unlock();
- return ret;
+ return supported;
}
int dmar_iommu_notify_scope_dev(struct dmar_pci_notify_info *info)
--
2.43.0
next prev parent reply other threads:[~2025-05-09 6:12 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-09 14:00 [PATCH v1 0/3] Improve ATS Support Check in IOMMU/VT-d Wei Wang
2025-05-09 14:00 ` [PATCH v1 1/3] iommu/vt-d: Eliminate pci_physfn() in dmar_find_matched_satc_unit() Wei Wang
2025-05-09 9:15 ` Yi Liu
2025-05-09 11:39 ` Wang, Wei W
2025-05-09 14:00 ` Wei Wang [this message]
2025-05-09 9:27 ` [PATCH v1 2/3] iommu/vt-d: Change dmar_ats_supported() to return boolean Yi Liu
2025-05-09 11:21 ` Wang, Wei W
2025-05-09 14:00 ` [PATCH v1 3/3] iommu/vt-d: Fix ATS support check for integrated endpoints Wei Wang
2025-05-09 9:32 ` Yi Liu
2025-05-09 11:12 ` Wang, Wei W
2025-05-12 2:43 ` Baolu Lu
2025-05-12 3:45 ` Wang, Wei W
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250509140021.4029303-3-wei.w.wang@intel.com \
--to=wei.w.wang@intel.com \
--cc=baolu.lu@linux.intel.com \
--cc=dwmw2@infradead.org \
--cc=iommu@lists.linux.dev \
--cc=jroedel@suse.de \
--cc=kevin.tian@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=yi.l.liu@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®