[PATCH 15/30] ide: Avoid preprocessor for CONFIG_ATAPI

Simon Glass sjg at chromium.org
Mon Mar 27 21:07:02 CEST 2023


Use IS_ENABLED() instead for all conditions.

Signed-off-by: Simon Glass <sjg at chromium.org>
---

 drivers/block/ide.c | 13 +++----------
 1 file changed, 3 insertions(+), 10 deletions(-)

diff --git a/drivers/block/ide.c b/drivers/block/ide.c
index a51a0008cae4..6c5227a5c0e2 100644
--- a/drivers/block/ide.c
+++ b/drivers/block/ide.c
@@ -465,8 +465,6 @@ static ulong atapi_read(struct udevice *dev, lbaint_t blknr, lbaint_t blkcnt,
 	return n;
 }
 
-#ifdef CONFIG_ATAPI
-
 static void atapi_inquiry(struct blk_desc *dev_desc)
 {
 	unsigned char ccb[12];	/* Command descriptor block */
@@ -549,8 +547,6 @@ static void atapi_inquiry(struct blk_desc *dev_desc)
 	return;
 }
 
-#endif /* CONFIG_ATAPI */
-
 static void ide_ident(struct blk_desc *dev_desc)
 {
 	unsigned char c;
@@ -637,13 +633,11 @@ static void ide_ident(struct blk_desc *dev_desc)
 	else
 		dev_desc->removable = 0;
 
-#ifdef CONFIG_ATAPI
-	if (is_atapi) {
+	if (IS_ENABLED(CONFIG_ATAPI) && is_atapi) {
 		dev_desc->atapi = true;
 		atapi_inquiry(dev_desc);
 		return;
 	}
-#endif /* CONFIG_ATAPI */
 
 	iop.lba_capacity[0] = be16_to_cpu(iop.lba_capacity[0]);
 	iop.lba_capacity[1] = be16_to_cpu(iop.lba_capacity[1]);
@@ -732,11 +726,10 @@ static void ide_init(void)
 		if (c & (ATA_STAT_BUSY | ATA_STAT_FAULT)) {
 			puts("not available  ");
 			debug("Status = 0x%02X ", c);
-#ifndef CONFIG_ATAPI		/* ATAPI Devices do not set DRDY */
-		} else if ((c & ATA_STAT_READY) == 0) {
+		} else if (IS_ENABLED(CONFIG_ATAPI) && !(c & ATA_STAT_READY)) {
+			/* ATAPI Devices do not set DRDY */
 			puts("not available  ");
 			debug("Status = 0x%02X ", c);
-#endif
 		} else {
 			puts("OK ");
 			ide_bus_ok[bus] = 1;
-- 
2.40.0.348.gf938b09366-goog



More information about the U-Boot mailing list