From nobody Sat Feb 7 17:19:55 2026 Received: from mail-pj1-f51.google.com (mail-pj1-f51.google.com [209.85.216.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6F7FF226CF1 for ; Sun, 4 Jan 2026 10:02:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767520927; cv=none; b=o3210SdlWBh7CU/9qdrFwyUF8uZaQJ4J8xZ4i1K1OPhoyOupwkigcYl2tv5Rpqx0/696RCGD22EWdGU4GqsaHvA6pCEeijHHVVKJ6d4rtArv20Q7ybo+HYkAiMPYP85FJY4FJKmsjg5z5E7jystkRaj1ho2VlXldTecxem5MbQk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767520927; c=relaxed/simple; bh=h6VN4y0NVAHPNdi94mv7RGWFJJGZSW4sFQ5IT8rjGps=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=QmWVYtfuA6t+wjQe3LiRQgh9cQGF0lATlZbmbLUMtKzGANp5oxjnbTGOkaJtreAkEx0lbCwheclitk22JM3g+fGuqpAQd0yPflaHBc18/kgPBHvyuYIaOXnKhlNapwQpJl+K0weJsk4hOlmdQ7Qs2y9GX117VGwsfW3rhqnY560= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=thingy.jp; spf=pass smtp.mailfrom=0x0f.com; dkim=pass (1024-bit key) header.d=thingy.jp header.i=@thingy.jp header.b=Pp14O01z; arc=none smtp.client-ip=209.85.216.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=thingy.jp Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=0x0f.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=thingy.jp header.i=@thingy.jp header.b="Pp14O01z" Received: by mail-pj1-f51.google.com with SMTP id 98e67ed59e1d1-34c27d14559so10453855a91.2 for ; Sun, 04 Jan 2026 02:02:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=thingy.jp; s=google; t=1767520924; x=1768125724; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=LxO4CmHvbs5IX2zszHvbq/kpDg48hQV47bQLUQlGXrQ=; b=Pp14O01z6gD+gCT6qJmaKjHkh0lRf2dr9H9Q0pfMsD6aMo0dYxd5aSIPe6UdvdfbAf P+LcrRmEIz9CZOH9OjJJ493+6WH/yVliiPwomn3dwnCYXuq97Ah/kKu9oMWffKznw8Ij WZ8lXIVoRtpOP/biEaXCnbvncYsi00DLyVmwA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1767520924; x=1768125724; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=LxO4CmHvbs5IX2zszHvbq/kpDg48hQV47bQLUQlGXrQ=; b=npjzmIeeTFQ39JpHMxCfkYuTJcDJCGKEfMalVL9C/QYmq+mqcYKZqbR/yxZFusdORs hSecR3Lt6BLfDZtq7uexFx0rOzZFTzPBVxRFmDQk3iwLoO7IQrJJmsaaMk3c3vh0ROIo L3ovesFukFAEfR9NBJndPvkfCSRrItDwEjUb11T4W4JXD/GjEU3BcxlS/D5tV26RT4vM A00N7EaYNoLH//ziWg91Lurg56spB2sVrFhhFFWTOw14SGimlieRNRFOv7RZu2oXVuDW AaK4V0mPFQ+mLgwWmomKzrTzve1McTjnWoul1HBbUhQaSunZsD5j4pTamM9TVpmTRENL gvXQ== X-Gm-Message-State: AOJu0YxB5yTN4vAV1XRxzc4PSYrIQUdDgKixW525OUMZppc/7sdgzYby Lgu+oR8f1EznH0jVW07aiNkK8RQI/TNKxc7aGuDZZfR8kwHBGQHJnhOumeGTdqH76ZLeCOu6cs9 MzNpjRzg= X-Gm-Gg: AY/fxX7dOVcCsRumFwdHsyXZghWhW1Egu6HIAHf/FnHWS1WqnWbhU6ISlk6P8OWPblF ipOnx+dYg8NOoDvteyFEZpuzE0cRDLp0HEBhpBlmgtexkltPoaV8KMuHtskISvJvHXcIB6dwyIs 00VCfH+DWKzcd1eOiyTaELkQI/qAHVVUGtVpy2l3GDVOGZVM7Lrtd0aOB7Q70jBWvvMegRFrgsU 5UydfESb4CC2Ef7Fss+MlKtqyYA7OEfGS8p+iA7lZ9KqmEM1nS0CN5MO7Q/tpXkGWJdZ83Z00lL JPwZNUlWhC4+/mWN7tGS7YyDESKry8GSIuY1meORBES8KRJfPqlOcJ0GozPi/VUpp897ch9NWLm jnOoQEd/4TfbOZMRqS8ME25r0y7IpTEoCpcSzd12sQgqtJoRTNyKLRC/rdRhTODPUDVr/dFbsR+ 4uT5L1zI7mUpcKLRnmVyzoLdtnPxS+Rw9/gvIIdFS7PoNXJZByXT8GWAGs0ExTuITKjAXYW2BFe +8= X-Google-Smtp-Source: AGHT+IHoffS/7yWJB4nhd2QWoukImGAGgvYz07KAWU1mQA/srAsoHCH79yzY4kDbBdUFKRZOCq1CXw== X-Received: by 2002:a17:90a:d64b:b0:33f:f22c:8602 with SMTP id 98e67ed59e1d1-34e921cba61mr40911683a91.26.1767520923615; Sun, 04 Jan 2026 02:02:03 -0800 (PST) Received: from kinako.work.home.arpa (p1536247-ipxg00c01sizuokaden.shizuoka.ocn.ne.jp. [122.26.212.247]) by smtp.googlemail.com with ESMTPSA id 98e67ed59e1d1-34f4775df7bsm3458539a91.10.2026.01.04.02.02.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 04 Jan 2026 02:02:03 -0800 (PST) From: Daniel Palmer To: miquel.raynal@bootlin.com, richard@nod.at, vigneshr@ti.com, linux-mtd@lists.infradead.org Cc: linux-kernel@vger.kernel.org, Daniel Palmer Subject: [PATCH] mtd: parsers: ofpart: Remove code/data for disabled custom parsers Date: Sun, 4 Jan 2026 19:01:51 +0900 Message-ID: <20260104100151.1400182-1-daniel@thingy.jp> X-Mailer: git-send-email 2.51.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Currently even if none of the custom parsers are selected a struct of_device_id and a dummy function that just returns -EOPNOTSUPP is compiled in for each of them. Its not obvious from the code but struct of_device_id is massive, 196 or 200 bytes (see link), so this is a lot more wasteful than you'd think just skimming the code and assuming the wasted size is just the length of the string with some small overhead. If they aren't enabled use ifdef's to avoid anything being compiled in and remove the dummy functions. Link: https://lore.kernel.org/all/ef59d6fd3b2201b912d5eaa7f7a037d8f9adb744.= 1636561068.git.geert+renesas@glider.be/ Signed-off-by: Daniel Palmer --- drivers/mtd/parsers/ofpart_bcm4908.h | 6 ------ drivers/mtd/parsers/ofpart_core.c | 8 ++++++++ drivers/mtd/parsers/ofpart_linksys_ns.h | 7 ------- 3 files changed, 8 insertions(+), 13 deletions(-) diff --git a/drivers/mtd/parsers/ofpart_bcm4908.h b/drivers/mtd/parsers/ofp= art_bcm4908.h index 80f8c086641f..f96dcd5275a7 100644 --- a/drivers/mtd/parsers/ofpart_bcm4908.h +++ b/drivers/mtd/parsers/ofpart_bcm4908.h @@ -4,12 +4,6 @@ =20 #ifdef CONFIG_MTD_OF_PARTS_BCM4908 int bcm4908_partitions_post_parse(struct mtd_info *mtd, struct mtd_partiti= on *parts, int nr_parts); -#else -static inline int bcm4908_partitions_post_parse(struct mtd_info *mtd, stru= ct mtd_partition *parts, - int nr_parts) -{ - return -EOPNOTSUPP; -} #endif =20 #endif diff --git a/drivers/mtd/parsers/ofpart_core.c b/drivers/mtd/parsers/ofpart= _core.c index abfa68798918..e04eee028f63 100644 --- a/drivers/mtd/parsers/ofpart_core.c +++ b/drivers/mtd/parsers/ofpart_core.c @@ -23,13 +23,17 @@ struct fixed_partitions_quirks { int (*post_parse)(struct mtd_info *mtd, struct mtd_partition *parts, int = nr_parts); }; =20 +#ifdef CONFIG_MTD_OF_PARTS_BCM4908 static struct fixed_partitions_quirks bcm4908_partitions_quirks =3D { .post_parse =3D bcm4908_partitions_post_parse, }; +#endif =20 +#ifdef CONFIG_MTD_OF_PARTS_LINKSYS_NS static struct fixed_partitions_quirks linksys_ns_partitions_quirks =3D { .post_parse =3D linksys_ns_partitions_post_parse, }; +#endif =20 static const struct of_device_id parse_ofpart_match_table[]; =20 @@ -192,8 +196,12 @@ static const struct of_device_id parse_ofpart_match_ta= ble[] =3D { /* Generic */ { .compatible =3D "fixed-partitions" }, /* Customized */ +#ifdef CONFIG_MTD_OF_PARTS_BCM4908 { .compatible =3D "brcm,bcm4908-partitions", .data =3D &bcm4908_partition= s_quirks, }, +#endif +#ifdef CONFIG_MTD_OF_PARTS_LINKSYS_NS { .compatible =3D "linksys,ns-partitions", .data =3D &linksys_ns_partitio= ns_quirks, }, +#endif {}, }; MODULE_DEVICE_TABLE(of, parse_ofpart_match_table); diff --git a/drivers/mtd/parsers/ofpart_linksys_ns.h b/drivers/mtd/parsers/= ofpart_linksys_ns.h index 730c46812ebf..6537aa37c0aa 100644 --- a/drivers/mtd/parsers/ofpart_linksys_ns.h +++ b/drivers/mtd/parsers/ofpart_linksys_ns.h @@ -6,13 +6,6 @@ int linksys_ns_partitions_post_parse(struct mtd_info *mtd, struct mtd_partition *parts, int nr_parts); -#else -static inline int linksys_ns_partitions_post_parse(struct mtd_info *mtd, - struct mtd_partition *parts, - int nr_parts) -{ - return -EOPNOTSUPP; -} #endif =20 #endif --=20 2.51.0