Skip to contentSkip to conversation

ata: libata-sff: make ata_resources_present() return 'bool'

PATCH Applied Sergey Shtylyov 2 participants 2 messages Feb 13, 2022 – Feb 16, 2022 libata

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ata: libata-sff: make ata_resources_present() return 'bool'

ata_resources_present() returns 1 if the primary/secondary channel's PCI resources are present, 0 if not -- the 'bool' type fits somewhat better here than 'int'...

Use the *= operator, while at it...

---
This patch is against the 'for-next' branch of Damien Le Moal's 'libata.git' repo.

 drivers/ata/libata-sff.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/ata/libata-sff.c +4 -4
Index: libata/drivers/ata/libata-sff.c
===================================================================
@@ -2174,18 +2174,18 @@ EXPORT_SYMBOL_GPL(ata_sff_std_ports);
 
 #ifdef CONFIG_PCI
 
-static int ata_resources_present(struct pci_dev *pdev, int port)
+static bool ata_resources_present(struct pci_dev *pdev, int port)
 {
 	int i;
 
 	/* Check the PCI resources for this channel are enabled */
-	port = port * 2;
+	port *= 2;
 	for (i = 0; i < 2; i++) {
 		if (pci_resource_start(pdev, port + i) == 0 ||
 		    pci_resource_len(pdev, port + i) == 0)
-			return 0;
+			return false;
 	}
-	return 1;
+	return true;
 }
 
 /**
#1 lore raw
Quoted 7 lines · Sergey Shtylyov

ata_resources_present() returns 1 if the primary/secondary channel's PCI resources are present, 0 if not -- the 'bool' type fits somewhat better here than 'int'...

Use the *= operator, while at it...

Applied to for-5.18. Thanks !

Signature · 2 lines
Damien Le Moal
Western Digital Research