PCI/ATS: tidy {en,dis}able_ats_device() a little

Use appropriate types for the control register value as well as the
capability position. Constify a pointer. Use "else" in favor of encoding
the opposite condition of the earlier if().

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Roger Pau Monné <roger.pau@citrix.com>
This commit is contained in:
Jan Beulich committed 2026-01-08 08:07:19 +01:00
1 parent 673d9dd8a5
commit 31bebd739b
1 file changed
+5 -7
+5 -7
View File
@@ -23,10 +23,9 @@ boolean_param("ats", ats_enabled);
int enable_ats_device(struct pci_dev *pdev, struct list_head *ats_list)
{
u32 value;
int pos;
uint16_t value;
unsigned int pos = pci_find_ext_capability(pdev->sbdf, PCI_EXT_CAP_ID_ATS);
pos = pci_find_ext_capability(pdev->sbdf, PCI_EXT_CAP_ID_ATS);
BUG_ON(!pos);
if ( iommu_verbose )
@@ -35,7 +34,7 @@ int enable_ats_device(struct pci_dev *pdev, struct list_head *ats_list)
value = pci_conf_read16(pdev->sbdf, pos + ATS_REG_CTL);
if ( value & ATS_ENABLE )
{
struct pci_dev *other;
const struct pci_dev *other;
list_for_each_entry ( other, ats_list, ats.list )
if ( other == pdev )
@@ -44,8 +43,7 @@ int enable_ats_device(struct pci_dev *pdev, struct list_head *ats_list)
break;
}
}
if ( !(value & ATS_ENABLE) )
else
{
value |= ATS_ENABLE;
pci_conf_write16(pdev->sbdf, pos + ATS_REG_CTL, value);
@@ -69,7 +67,7 @@ int enable_ats_device(struct pci_dev *pdev, struct list_head *ats_list)
void disable_ats_device(struct pci_dev *pdev)
{
u32 value;
uint16_t value;
BUG_ON(!pdev->ats.cap_pos);
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.