All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] ata: libata-sff: use *switch* statement in ata_sff_dev_classify()
@ 2022-02-17 15:38 Sergey Shtylyov
  2022-02-19  2:21 ` Damien Le Moal
  0 siblings, 1 reply; 2+ messages in thread
From: Sergey Shtylyov @ 2022-02-17 15:38 UTC (permalink / raw)
  To: Damien Le Moal, linux-ide

In ata_sff_dev_classify(), replace a string of the *if* statements checking
the device's class with the *switch* statement that fits better here...

While at it, fix the multi-line comment style in the vicinity...

Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>

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

Changes in version 2:
- fixed the multi-line comment style, updating the patch description.

 drivers/ata/libata-sff.c |   17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

Index: libata/drivers/ata/libata-sff.c
===================================================================
--- libata.orig/drivers/ata/libata-sff.c
+++ libata/drivers/ata/libata-sff.c
@@ -1841,9 +1841,10 @@ unsigned int ata_sff_dev_classify(struct
 
 	/* determine if device is ATA or ATAPI */
 	class = ata_port_classify(ap, &tf);
-
-	if (class == ATA_DEV_UNKNOWN) {
-		/* If the device failed diagnostic, it's likely to
+	switch (class) {
+	case ATA_DEV_UNKNOWN:
+		/*
+		 * If the device failed diagnostic, it's likely to
 		 * have reported incorrect device signature too.
 		 * Assume ATA device if the device seems present but
 		 * device signature is invalid with diagnostic
@@ -1853,10 +1854,12 @@ unsigned int ata_sff_dev_classify(struct
 			class = ATA_DEV_ATA;
 		else
 			class = ATA_DEV_NONE;
-	} else if ((class == ATA_DEV_ATA) &&
-		   (ap->ops->sff_check_status(ap) == 0))
-		class = ATA_DEV_NONE;
-
+		break;
+	case ATA_DEV_ATA:
+		if (ap->ops->sff_check_status(ap) == 0)
+			class = ATA_DEV_NONE;
+		break;
+	}
 	return class;
 }
 EXPORT_SYMBOL_GPL(ata_sff_dev_classify);

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH v2] ata: libata-sff: use *switch* statement in ata_sff_dev_classify()
  2022-02-17 15:38 [PATCH v2] ata: libata-sff: use *switch* statement in ata_sff_dev_classify() Sergey Shtylyov
@ 2022-02-19  2:21 ` Damien Le Moal
  0 siblings, 0 replies; 2+ messages in thread
From: Damien Le Moal @ 2022-02-19  2:21 UTC (permalink / raw)
  To: Sergey Shtylyov, linux-ide

On 2/18/22 00:38, Sergey Shtylyov wrote:
> In ata_sff_dev_classify(), replace a string of the *if* statements checking
> the device's class with the *switch* statement that fits better here...
> 
> While at it, fix the multi-line comment style in the vicinity...
> 
> Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>

Applied to for-5.18. Thanks !


-- 
Damien Le Moal
Western Digital Research

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-02-19  2:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-17 15:38 [PATCH v2] ata: libata-sff: use *switch* statement in ata_sff_dev_classify() Sergey Shtylyov
2022-02-19  2:21 ` Damien Le Moal

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.