summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Shtylyov <s.shtylyov@omp.ru>2022-02-17 18:38:29 +0300
committerDamien Le Moal <damien.lemoal@opensource.wdc.com>2022-02-20 09:06:05 +0900
commitffa92a7457555df6871cfb15c2fb3afcb02c4d2b (patch)
tree73ad158537e33cfa7d9707983b95a2990cf7be3b
parentefcef265fd83d9a68a68926abecb3e1dd3e260a8 (diff)
ata: libata-sff: use *switch* statement in ata_sff_dev_classify()
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> Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
-rw-r--r--drivers/ata/libata-sff.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/drivers/ata/libata-sff.c b/drivers/ata/libata-sff.c
index 1d28b1cd8baa..b3be7a8f5bea 100644
--- a/drivers/ata/libata-sff.c
+++ b/drivers/ata/libata-sff.c
@@ -1842,9 +1842,10 @@ unsigned int ata_sff_dev_classify(struct ata_device *dev, int present,
/* 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
@@ -1854,10 +1855,12 @@ unsigned int ata_sff_dev_classify(struct ata_device *dev, int present,
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);