From patchwork Thu Jul 7 16:36:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= X-Patchwork-Id: 588123 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:bb16:0:0:0:0 with SMTP id jd22csp740050mab; Thu, 7 Jul 2022 09:37:01 -0700 (PDT) X-Google-Smtp-Source: AGRyM1ulKMOcKYpraSd0NpLdCZprUmlYE74L56014JIC0iPQgehN+cu+srgrbG5YJXYw903OFUge X-Received: by 2002:a05:6a00:1a16:b0:528:692e:6637 with SMTP id g22-20020a056a001a1600b00528692e6637mr23310166pfv.69.1657211820964; Thu, 07 Jul 2022 09:37:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657211820; cv=none; d=google.com; s=arc-20160816; b=G3FKUeagz5S3LnbeH0YLBkAwZfXDf2/2bkplftE/aeI39+FdtqtGQd2BywHfGIGWpd 1xiTaPwGVITPiq1AS02sszAe1BRS7BQCzD/23q14mob5AGxj8my8zI4k/Pt/54/LX4Xu XEiN9XtBqdm+ALxDSwfzcnL/JDV5y+ffbldrzEIhTXTIXhmhdZNYoy2JMTNijfW76ssT Tl98pCkEzOsuCo1DUSi79zXSpnk8ocyciDFRoursrO1gsvPrcXIDLUuA5kPu1BeeRNTK Qp+fs1HUAraKFvDXGRCi8W/UHa122K7hg++TYevSNIpO4XSdLr5zq2iBYPnWllpU4Q64 evVg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:sender:content-transfer-encoding:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature:dkim-signature; bh=UYOUSxaVnke56HjCgHGXz1VwgH5NP+RVR5WfV86B8lc=; b=NXEgx6Ox/YnK4E+LxuiLSjsh/ttwwlo4tgYtzLgGpOXlX24CxAZdrW0f7cIjPC/AbY f8Dk1irPlb1rhzfoSPrp/jSRvF/frnm4Lain1ff0GGHxddCz3O3g0xvH1yb/uJ6VwkhY 8oQnlIWDW53IhBa8zJBipJSYNyG7wQ5uYVAGIH3LubIYXv8vXTnJyVhxch1ITxbAOoBk U43YK9FQPnUuu2bV0HTe+COvdZJV47QiFN6+hTYJIHxY/8NCmdW+37oltB3rybuOO45m Yp+sFuLvopo3XcvHUdyA4p2TPBa+PzbvMBA49L2G2XCsnbteENeSalntUeO5UfypKWcS +udQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lists.infradead.org header.s=bombadil.20210309 header.b=Avmji7rD; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20210112 header.b="EMKT4/3o"; spf=pass (google.com: best guess record for domain of linux-mtd-bounces+patch=linaro.org@lists.infradead.org designates 2607:7c80:54:3::133 as permitted sender) smtp.mailfrom="linux-mtd-bounces+patch=linaro.org@lists.infradead.org"; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from bombadil.infradead.org (bombadil.infradead.org. [2607:7c80:54:3::133]) by mx.google.com with ESMTPS id h11-20020a17090ac38b00b001ef9099d441si12664725pjt.110.2022.07.07.09.37.00 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Jul 2022 09:37:00 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-mtd-bounces+patch=linaro.org@lists.infradead.org designates 2607:7c80:54:3::133 as permitted sender) client-ip=2607:7c80:54:3::133; Authentication-Results: mx.google.com; dkim=pass header.i=@lists.infradead.org header.s=bombadil.20210309 header.b=Avmji7rD; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20210112 header.b="EMKT4/3o"; spf=pass (google.com: best guess record for domain of linux-mtd-bounces+patch=linaro.org@lists.infradead.org designates 2607:7c80:54:3::133 as permitted sender) smtp.mailfrom="linux-mtd-bounces+patch=linaro.org@lists.infradead.org"; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=UYOUSxaVnke56HjCgHGXz1VwgH5NP+RVR5WfV86B8lc=; b=Avmji7rDQ7tAvf /6zYqiNz0FoWWZ5Fx7qdzUZ8iwcj7iQtcHSmtJx4S5M7VmwshXSinFEIgSvZWiNasDfc4jX5Va/jI MuKLBmlgRsqIJG8+B1W02t5hVQ3XKzexsNp3UWELcsnUNpK51vG2X/LP2Li0GRBTe9kQnyydoBdVI OritnQ4J+BSUCZ0q4UUxEpuz/+uwGJDY5TiFuuu5bCovTYaVEJKqfRfvpaJ5CkCZ37RqjUHXyQzAR 33n/xSCmK7DYbG7RAj2FlfoTa269h6ONyH8x4EjkIE1pg+ESmkjhwQKw8Q0G0KEcGdXC0y0/JHTNI 5pEz7JmDvFiqp7Lw4BGQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1o9UUM-00H0Fz-PO; Thu, 07 Jul 2022 16:36:26 +0000 Received: from mail-ed1-x536.google.com ([2a00:1450:4864:20::536]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1o9UUH-00H0Cs-FI for linux-mtd@lists.infradead.org; Thu, 07 Jul 2022 16:36:23 +0000 Received: by mail-ed1-x536.google.com with SMTP id k30so15725040edk.8 for ; Thu, 07 Jul 2022 09:36:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=EpRFRQjTAtTr1M5DmE/x/HJDwd5mR/vVrtLFwi8k4Rc=; b=EMKT4/3otjt8/rvpIKCJ1b2up/bgSsRt4nctE5sS6+lnuOSbOyoeg/ktEO4LC2wrW7 Q99cck/TGy6MosOLQ75QZs/hGRX1dUfvsEr5F7N1QUKjI9uEwQb7rmyaaSlWtf8JrC0c DCSkH/e1WiRqMJ28VaobSI+VKrzLSssbI65UVRvM91xUA2iL3wO6q9S5rcuuhDpc64tv HK4bp1IrDrQWV7+oPb+9c7tdAJyd4OlbN8lvFtEzEIt1q1YVrEcEj2gzUgZHN2Xx5dZf JP0wpwymGrtRbjexM9FvahGJJnJDx9bWiqRuKCf7bdZb1XEC4v0Utps82E/SOutECnjk pcPw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=EpRFRQjTAtTr1M5DmE/x/HJDwd5mR/vVrtLFwi8k4Rc=; b=kORM1tBwxq9sKhHef6wkOEgw1OWI2/C2ZsHPYUXWqAyPvwch2rhi1/3iXJWrqoarSF rwE4YXHFzjlCUjotFAioXLq1bZHT0LTb2iykLRX6ft3iWE8vuxIuKn3Q0yl4+ZJQJD2o /4eNdnf8b1biE9WYo7bNm8gORuhXJSC4vujrwmrhuod38BEeJSnTEfiIqEvMNLt9z2RF SFSwIcwpxpYqBlTJd6RRW+CN2PTdZYn1yMIddL7Z/wo0oovdrhrETQTr9dpeEdWIaswx BdNn4etx1u81NszJFD0bZlFSLw89M45wkgN/86H1foAprYuw+WoCOZh8bYy9LuI3XHIg cZiA== X-Gm-Message-State: AJIora9QadfCVOeLBPUwmsoR7mdYCm3538FpgNkKGFvGTNiDLR1x5/Jy xcX/hCi9RxiF/T9PL2vnB9k= X-Received: by 2002:aa7:d555:0:b0:43a:1be7:9e17 with SMTP id u21-20020aa7d555000000b0043a1be79e17mr37347794edr.183.1657211779662; Thu, 07 Jul 2022 09:36:19 -0700 (PDT) Received: from localhost.lan (ip-194-187-74-233.konfederacka.maverick.com.pl. [194.187.74.233]) by smtp.gmail.com with ESMTPSA id t27-20020a17090616db00b0071cbc7487e1sm19009030ejd.69.2022.07.07.09.36.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Jul 2022 09:36:19 -0700 (PDT) From: =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= To: Miquel Raynal , Richard Weinberger , Vignesh Raghavendra Cc: ansuelsmth@gmail.com, linux-mtd@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, =?utf-8?b?UmFm?= =?utf-8?b?YcWCIE1pxYJlY2tp?= Subject: [PATCH 2/2] mtd: core: find OF node for every MTD partition Date: Thu, 7 Jul 2022 18:36:07 +0200 Message-Id: <20220707163607.20729-2-zajec5@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220707163607.20729-1-zajec5@gmail.com> References: <20220707163607.20729-1-zajec5@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220707_093621_566371_669DDA03 X-CRM114-Status: GOOD ( 15.05 ) X-Spam-Score: 0.1 (/) X-Spam-Report: =?utf-8?q?Spam_detection_software=2C_running_on_the_system_?= =?utf-8?q?=22bombadil=2Einfradead=2Eorg=22=2C?= =?utf-8?q?_has_NOT_identified_this_incoming_email_as_spam=2E__The_original?= =?utf-8?q?_message_has_been_attached_to_this_so_you_can_view_it_or_label?= =?utf-8?q?_similar_future_email=2E__If_you_have_any_questions=2C_see?= =?utf-8?q?_the_administrator_of_that_system_for_details=2E?= =?utf-8?q?_?= =?utf-8?q?_Content_preview=3A__From=3A_Rafa=C3=85=C2=82_Mi=C3=85=C2=82ecki_D?= =?utf-8?q?on=27t_limit_this_feature_to_the_=22nvmem-cells=22=2E?= =?utf-8?q?_There_are_more_cases_to_this=2E_1=2E_Dynamic_partitions_may_need_?= =?utf-8?q?to_be_handled?= =?utf-8?q?_with_parsers_This_applies_to_=22fixed-partitions=22_parser_and_al?= =?utf-8?q?l_custom_ones=2E?= =?utf-8?b?IDIuIFsuLi5dIA==?= =?utf-8?q?_?= =?utf-8?q?_Content_analysis_details=3A___=280=2E1_points=2C_5=2E0_required?= =?utf-8?q?=29?= =?utf-8?q?_?= =?utf-8?q?_pts_rule_name______________description?= =?utf-8?q?_----_----------------------_-------------------------------------?= =?utf-8?q?-------------?= =?utf-8?q?_-0=2E0_RCVD=5FIN=5FDNSWL=5FNONE_____RBL=3A_Sender_listed_at_https?= =?utf-8?q?=3A//www=2Ednswl=2Eorg/=2C?= =?utf-8?q?_no_trust?= =?utf-8?b?IFsyYTAwOjE0NTA6NDg2NDoyMDowOjA6MDo1MzYgbGlzdGVkIGluXQ==?= =?utf-8?b?IFtsaXN0LmRuc3dsLm9yZ10=?= =?utf-8?q?_-0=2E0_SPF=5FPASS_______________SPF=3A_sender_matches_SPF_record?= =?utf-8?q?_0=2E0_SPF=5FHELO=5FNONE__________SPF=3A_HELO_does_not_publish_an_?= =?utf-8?q?SPF_Record?= =?utf-8?q?_0=2E0_FREEMAIL=5FFROM__________Sender_email_is_commonly_abused_en?= =?utf-8?q?duser_mail?= =?utf-8?q?_provider?= =?utf-8?q?_=5Bzajec5=5Bat=5Dgmail=2Ecom=5D?= =?utf-8?q?_0=2E2_FREEMAIL=5FENVFROM=5FEND=5FDIGIT_Envelope-from_freemail_use?= =?utf-8?q?rname_ends?= =?utf-8?q?_in_digit?= =?utf-8?q?_=5Bzajec5=5Bat=5Dgmail=2Ecom=5D?= =?utf-8?q?_-0=2E1_DKIM=5FVALID=5FAU__________Message_has_a_valid_DKIM_or_DK_?= =?utf-8?q?signature_from?= =?utf-8?q?_author=27s_domain?= =?utf-8?q?_-0=2E1_DKIM=5FVALID_____________Message_has_at_least_one_valid_DK?= =?utf-8?q?IM_or_DK_signature?= =?utf-8?q?_0=2E1_DKIM=5FSIGNED____________Message_has_a_DKIM_or_DK_signature?= =?utf-8?q?=2C_not_necessarily?= =?utf-8?q?_valid?= =?utf-8?q?_-0=2E1_DKIM=5FVALID=5FEF__________Message_has_a_valid_DKIM_or_DK_?= =?utf-8?q?signature_from?= =?utf-8?q?_envelope-from_domain?= X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-mtd" Errors-To: linux-mtd-bounces+patch=linaro.org@lists.infradead.org From: Rafał Miłecki Don't limit this feature to the "nvmem-cells". There are more cases to this. 1. Dynamic partitions may need to be handled with parsers This applies to "fixed-partitions" parser and all custom ones. 2. Dynamic partitions can be handled with specific drivers Consider "u-boot,env" as specified in the u-boot,env.yaml. Signed-off-by: Rafał Miłecki --- drivers/mtd/mtdcore.c | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/drivers/mtd/mtdcore.c b/drivers/mtd/mtdcore.c index 79c447fe30b4..f7693736dde4 100644 --- a/drivers/mtd/mtdcore.c +++ b/drivers/mtd/mtdcore.c @@ -552,7 +552,6 @@ static void mtd_check_of_node(struct mtd_info *mtd) const char *pname, *prefix = "partition-"; int plen, mtd_name_len, offset, prefix_len; struct mtd_info *parent; - bool found = false; /* Check if MTD already has a device node */ if (dev_of_node(&mtd->dev)) @@ -588,19 +587,11 @@ static void mtd_check_of_node(struct mtd_info *mtd) plen = strlen(pname) - offset; if (plen == mtd_name_len && !strncmp(mtd->name, pname + offset, plen)) { - found = true; + mtd_set_of_node(mtd, mtd_dn); break; } } - if (!found) - goto exit_partitions; - - /* Set of_node only for nvmem */ - if (of_device_is_compatible(mtd_dn, "nvmem-cells")) - mtd_set_of_node(mtd, mtd_dn); - -exit_partitions: of_node_put(partitions); exit_parent: of_node_put(parent_dn);