]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
fwu: mtd: get MTD partition specific info from driver
authorSughosh Ganu <sughosh.ganu@linaro.org>
Fri, 22 Mar 2024 10:57:25 +0000 (16:27 +0530)
committerTom Rini <trini@konsulko.com>
Fri, 24 May 2024 19:40:04 +0000 (13:40 -0600)
Information about FWU images on MTD partitions is now stored with the
corresponding driver instead of a global variable. Get this
information from the driver.

Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
Tested-by: Michal Simek <michal.simek@amd.com>
lib/fwu_updates/fwu_mtd.c

index d48de19009b05f27f1c601c8a9d17ca72b74221a..f4e0e3107be0ea6f523ed9e7aa04c72a8cb69de7 100644 (file)
 
 #include <dm/ofnode.h>
 
-struct fwu_mtd_image_info
-fwu_mtd_images[CONFIG_FWU_NUM_BANKS * CONFIG_FWU_NUM_IMAGES_PER_BANK];
-
 static struct fwu_mtd_image_info *mtd_img_by_uuid(const char *uuidbuf)
 {
-       int num_images = ARRAY_SIZE(fwu_mtd_images);
+       int num_images;
+       struct fwu_mdata_mtd_priv *mtd_priv = dev_get_priv(fwu_get_dev());
+       struct fwu_mtd_image_info *image_info = mtd_priv->fwu_mtd_images;
+
+       if (!image_info)
+               return NULL;
+
+       num_images = CONFIG_FWU_NUM_BANKS *
+               CONFIG_FWU_NUM_IMAGES_PER_BANK;
 
        for (int i = 0; i < num_images; i++)
-               if (!strcmp(uuidbuf, fwu_mtd_images[i].uuidbuf))
-                       return &fwu_mtd_images[i];
+               if (!strcmp(uuidbuf, image_info[i].uuidbuf))
+                       return &image_info[i];
 
        return NULL;
 }