diff options
author | Simon Glass | 2023-04-25 10:54:37 -0600 |
---|---|---|
committer | Tom Rini | 2023-04-27 13:51:06 -0400 |
commit | 2a165956ac804ebd825ba9eaf4fe26c9bbfb8925 (patch) | |
tree | 2d43b7c43791f82313c05cd4698bd2442771a1c1 /drivers/block/ide.c | |
parent | 1b33fd83179c8f09b79930c9ffca6e8b9dfa37cf (diff) |
ide: Change the retries variable
Use a 'tries' variable which starts at the number of tries we want to do,
rather than a 'retries' one that stops at either 1 or 2. This will make it
easier to refactor the code to avoid the horrible #ifdefs
Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'drivers/block/ide.c')
-rw-r--r-- | drivers/block/ide.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/drivers/block/ide.c b/drivers/block/ide.c index 1d5e54d6eb9..782780fd302 100644 --- a/drivers/block/ide.c +++ b/drivers/block/ide.c @@ -557,7 +557,7 @@ static void ide_ident(struct blk_desc *dev_desc) hd_driveid_t iop; #ifdef CONFIG_ATAPI bool is_atapi = false; - int retries = 0; + int tries = 1; #endif int device; @@ -570,10 +570,10 @@ static void ide_ident(struct blk_desc *dev_desc) dev_desc->uclass_id = UCLASS_IDE; #ifdef CONFIG_ATAPI - retries = 0; + tries = 2; /* Warning: This will be tricky to read */ - while (retries <= 1) { + while (tries) { /* check signature */ if ((ide_inb(device, ATA_SECT_CNT) == 0x01) && (ide_inb(device, ATA_SECT_NUM) == 0x01) && @@ -624,7 +624,7 @@ static void ide_ident(struct blk_desc *dev_desc) */ ide_outb(device, ATA_DEV_HD, ATA_LBA | ATA_DEVICE(device)); - retries++; + tries--; #else return; #endif @@ -634,7 +634,7 @@ static void ide_ident(struct blk_desc *dev_desc) break; } /* see above - ugly to read */ - if (retries == 2) /* Not found */ + if (!tries) /* Not found */ return; #endif |