Skip to contentSkip to conversation

Make all the devchk() functions return 'bool`

PATCH Applied Sergey Shtylyov 2 participants 5 messages Feb 9, 2022 – Feb 10, 2022

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover Make all the devchk() functions return 'bool`

Here are 3 patches against the 'for-next' branch of Damien Le Moal's 'libata.git' repo. Make all the devchk() functions return 'bool` inbstead of 'unsigned int'.

Sergey Shtylyov (3):
ata: libata-sff: make ata_devchk() return 'bool'
ata: pata_samsung_cf: make pata_s3c_devchk() return 'bool'
ata: sata_rcar: make sata_rcar_ata_devchk() return 'bool'

 drivers/ata/libata-sff.c      | 9 ++++++---
 drivers/ata/pata_samsung_cf.c | 7 +++----
 drivers/ata/sata_rcar.c       | 7 +++----
 3 files changed, 12 insertions(+), 11 deletions(-)
Signature · 1 line
2.26.3
#1 lore raw

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

ata_devchk() returns 1 if a device is present, 0 if not -- the 'bool' type clearly fits better here than 'unsigned int'...

---
 drivers/ata/libata-sff.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/ata/libata-sff.c +6 -3
index c9dbfb3641fc..546b1f73ede5 100644
@@ -1751,10 +1751,13 @@ EXPORT_SYMBOL_GPL(ata_sff_prereset);
  *	correctly storing and echoing back the
  *	ATA shadow register contents.
  *
+ *	RETURN:
+ *	true if device is present, false if not.
+ *
  *	LOCKING:
  *	caller.
  */
-static unsigned int ata_devchk(struct ata_port *ap, unsigned int device)
+static bool ata_devchk(struct ata_port *ap, unsigned int device)
 {
 	struct ata_ioports *ioaddr = &ap->ioaddr;
 	u8 nsect, lbal;
@@ -1774,9 +1777,9 @@ static unsigned int ata_devchk(struct ata_port *ap, unsigned int device)
 	lbal = ioread8(ioaddr->lbal_addr);
 
 	if ((nsect == 0x55) && (lbal == 0xaa))
-		return 1;	/* we found a device */
+		return true;	/* we found a device */
 
-	return 0;		/* nothing found */
+	return false;		/* nothing found */
 }
 
 /**
Signature · 1 line
2.26.3
#2 lore raw

PATCH 2/3 ata: pata_samsung_cf: make pata_s3c_devchk() return 'bool'

In reply to Sergey Shtylyov

pata_s3c_devchk() returns 1 if a device is present, 0 if not -- the 'bool' type clearly fits better here than 'unsigned int'...

---
 drivers/ata/pata_samsung_cf.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/ata/pata_samsung_cf.c +3 -4
index 377cd6bd87ac..bdd2178c4a61 100644
@@ -308,8 +308,7 @@ static void pata_s3c_dev_select(struct ata_port *ap, unsigned int device)
 /*
  * pata_s3c_devchk - PATA device presence detection
  */
-static unsigned int pata_s3c_devchk(struct ata_port *ap,
-				unsigned int device)
+static bool pata_s3c_devchk(struct ata_port *ap, unsigned int device)
 {
 	struct ata_ioports *ioaddr = &ap->ioaddr;
 	u8 nsect, lbal;
@@ -329,9 +328,9 @@ static unsigned int pata_s3c_devchk(struct ata_port *ap,
 	lbal = ata_inb(ap->host, ioaddr->lbal_addr);
 
 	if ((nsect == 0x55) && (lbal == 0xaa))
-		return 1;	/* we found a device */
+		return true;	/* we found a device */
 
-	return 0;		/* nothing found */
+	return false;		/* nothing found */
 }
 
 /*
Signature · 1 line
2.26.3
#3 lore raw

PATCH 3/3 ata: sata_rcar: make sata_rcar_ata_devchk() return 'bool'

In reply to Sergey Shtylyov

sata_rcar_ata_devchk() returns 1 if a device is present, 0 if not -- the 'bool' type clearly fits better here than 'unsigned int'...

---
 drivers/ata/sata_rcar.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/ata/sata_rcar.c +3 -4
index be8bfefed663..20263c1113df 100644
@@ -283,8 +283,7 @@ static void sata_rcar_dev_select(struct ata_port *ap, unsigned int device)
 	ata_sff_pause(ap);	/* needed; also flushes, for mmio */
 }
 
-static unsigned int sata_rcar_ata_devchk(struct ata_port *ap,
-					 unsigned int device)
+static bool sata_rcar_ata_devchk(struct ata_port *ap, unsigned int device)
 {
 	struct ata_ioports *ioaddr = &ap->ioaddr;
 	u8 nsect, lbal;
@@ -304,9 +303,9 @@ static unsigned int sata_rcar_ata_devchk(struct ata_port *ap,
 	lbal  = ioread32(ioaddr->lbal_addr);
 
 	if (nsect == 0x55 && lbal == 0xaa)
-		return 1;	/* found a device */
+		return true;	/* found a device */
 
-	return 0;		/* nothing found */
+	return false;		/* nothing found */
 }
 
 static int sata_rcar_wait_after_reset(struct ata_link *link,
Signature · 1 line
2.26.3
#4 lore raw
In reply to Sergey Shtylyov
Quoted 9 lines · Sergey Shtylyov

Here are 3 patches against the 'for-next' branch of Damien Le Moal's 'libata.git' repo. Make all the devchk() functions return 'bool` inbstead of 'unsigned int'.

Sergey Shtylyov (3):
ata: libata-sff: make ata_devchk() return 'bool'
ata: pata_samsung_cf: make pata_s3c_devchk() return 'bool'
ata: sata_rcar: make sata_rcar_ata_devchk() return 'bool'

Quoted 5 lines
 drivers/ata/libata-sff.c      | 9 ++++++---
 drivers/ata/pata_samsung_cf.c | 7 +++----
 drivers/ata/sata_rcar.c       | 7 +++----
 3 files changed, 12 insertions(+), 11 deletions(-)

Applied to for-5.18. Thanks !

Signature · 2 lines
Damien Le Moal
Western Digital Research