From patchwork Fri Mar 22 10:57:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sughosh Ganu X-Patchwork-Id: 781845 Delivered-To: patch@linaro.org Received: by 2002:adf:cf01:0:b0:33e:7753:30bd with SMTP id o1csp1274238wrj; Fri, 22 Mar 2024 04:00:47 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCU/m11dU+yrO2DpyrF1Q9RLFnlLn5oh20quAsMnKg+WLiWC49xwxilh2u6OkoSaNWo+WrwXvg0vQIXAk+Hd3tEr X-Google-Smtp-Source: AGHT+IE8IDMr3iKukoSV3T78QpZrp08BJYLmjEtKnNSwNJuUEeeFsdvd8Hug1znevJqA2XjZbNcB X-Received: by 2002:a05:600c:19d1:b0:414:81:f4c6 with SMTP id u17-20020a05600c19d100b004140081f4c6mr1182016wmq.9.1711105247148; Fri, 22 Mar 2024 04:00:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1711105247; cv=none; d=google.com; s=arc-20160816; b=IC4U0woUHLpdeR5NR9mxL7m3CdUfz4pROD74bLvyKUm4sxK4RV76WApMSSv+rysSbk KoQd1sfvkCkM/rmVpM14OHTTBZ6FVgPI1D1mQBwhsIp9FWTjRKM6W3YnM6Jm2OGaL6T5 MTgvZ+NDwixVriNDqaSzkprOJUTUeR25ItgZ0pYI1mNZJNsXYXsiiROb8FwhibeiZk5h J/DgyROi5DWCJwhgUOkdlYDwAswLSvQB4zjTWjoGK7XGba5ZA0UCl3G75yxGObRTjFtR MnxAUAmfpNXRrrW1XuBGKzKiF9u1WHAY7kIjQxkuIy7d7lijE00sjK0DpensGbW9buj4 cMdQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from; bh=GM8gh4vOmOCW1IQt+9TJMwQSXLLjghibfxYdJQBYXBE=; fh=0OBOeNvG1YwOz62VjCAPxJsyowuZOMIwtNTktJXXBMY=; b=GT6AScwO9ZhMvXfVOtfjH/YKsNJCSc9pY0OaGsU3r6BySXDkXzYt9WE9Y4s2bnsqXG vZTEQaPdqIGcLRmScDOs/pL+eJeVnAfLTNmExeRdxOJ1DanpMpDul0gUMvfXFjLVi/7F pmWZQw4yF9rB1PH2RoS2MWnjoG95Zw6aqMZSbOhB23Wp0c8soknKFwGUR+X0lWuQ9GXF UWLoYZn3YZXqxRFBDN0RKeb9vql9b72yTKfuTFOj294u9Xt3MfpRdZkGmVLhBI2QT9Ld hoqYd8p+WUCdVn8EntdiwaH3k1ZlYkJyAt28itTgZtcVmCc384KuBdXzFvQkb3XnigBp hG7Q==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id dx2-20020a05600c63c200b004146a1b081asi3356630wmb.69.2024.03.22.04.00.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Mar 2024 04:00:47 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 683D5881F7; Fri, 22 Mar 2024 11:58:54 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by phobos.denx.de (Postfix, from userid 109) id 5F12C881F8; Fri, 22 Mar 2024 11:58:52 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.2 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_SOFTFAIL autolearn=no autolearn_force=no version=3.4.2 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by phobos.denx.de (Postfix) with ESMTP id 6C6A1881F6 for ; Fri, 22 Mar 2024 11:58:50 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=fail smtp.mailfrom=sughosh.ganu@linaro.org Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 0A11D169E; Fri, 22 Mar 2024 03:59:24 -0700 (PDT) Received: from a079122.blr.arm.com (a079122.arm.com [10.162.17.48]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id E360F3F64C; Fri, 22 Mar 2024 03:58:46 -0700 (PDT) From: Sughosh Ganu To: u-boot@lists.denx.de Cc: Heinrich Schuchardt , Ilias Apalodimas , Yann GAUTIER , Etienne Carriere , Patrick DELAUNAY - foss , Michal Simek , Masahisa Kojima , Michal Simek , Sughosh Ganu Subject: [PATCH v3 12/20] fwu: mtd: get MTD partition specific info from driver Date: Fri, 22 Mar 2024 16:27:25 +0530 Message-Id: <20240322105733.203888-13-sughosh.ganu@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240322105733.203888-1-sughosh.ganu@linaro.org> References: <20240322105733.203888-1-sughosh.ganu@linaro.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean 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 --- Changes since V2: * New patch lib/fwu_updates/fwu_mtd.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/lib/fwu_updates/fwu_mtd.c b/lib/fwu_updates/fwu_mtd.c index d48de19009..f4e0e3107b 100644 --- a/lib/fwu_updates/fwu_mtd.c +++ b/lib/fwu_updates/fwu_mtd.c @@ -15,16 +15,21 @@ #include -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; }