summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2023-04-25 10:54:49 -0600
committerTom Rini <trini@konsulko.com>2023-04-27 13:51:07 -0400
commit960831180380e8060d8a6af5317ae756b9f6d186 (patch)
treedfdb85b72e99aefac691c880cabc0e44bc288ce4
parent038590af89eee321ea5a28e97a8aba078a7af4e2 (diff)
ide: Move all blk_desc init into ide_ident()
Rather than having the caller fill some of this in, do it all in the ide_ident() function, since it knows all the values. Signed-off-by: Simon Glass <sjg@chromium.org>
-rw-r--r--drivers/block/ide.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/drivers/block/ide.c b/drivers/block/ide.c
index 16b119ecbe1..b1c897d6a41 100644
--- a/drivers/block/ide.c
+++ b/drivers/block/ide.c
@@ -548,13 +548,16 @@ static int ide_ident(int device, struct blk_desc *desc)
bool is_atapi = false;
int tries = 1;
+ memset(desc, '\0', sizeof(*desc));
desc->devnum = device;
+ desc->type = DEV_TYPE_UNKNOWN;
+ desc->uclass_id = UCLASS_IDE;
+ desc->log2blksz = LOG2_INVALID(typeof(desc->log2blksz));
printf(" Device %d: ", device);
/* Select device
*/
ide_outb(device, ATA_DEV_HD, ATA_LBA | ATA_DEVICE(device));
- desc->uclass_id = UCLASS_IDE;
if (IS_ENABLED(CONFIG_ATAPI))
tries = 2;
@@ -1035,13 +1038,6 @@ static int ide_probe(struct udevice *udev)
if (!bus_ok[IDE_BUS(i)])
continue;
- ide_dev_desc[i].type = DEV_TYPE_UNKNOWN;
- ide_dev_desc[i].uclass_id = UCLASS_IDE;
- ide_dev_desc[i].part_type = PART_TYPE_UNKNOWN;
- ide_dev_desc[i].blksz = 0;
- ide_dev_desc[i].log2blksz =
- LOG2_INVALID(typeof(ide_dev_desc[i].log2blksz));
- ide_dev_desc[i].lba = 0;
ret = ide_ident(i, &ide_dev_desc[i]);
dev_print(&ide_dev_desc[i]);