From 3eebb91317c64864b86cea21ae07ab84d4f4bcc1 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Rafa=C5=82=20Mi=C5=82ecki?= Date: Sun, 30 Jul 2023 01:00:09 +0200 Subject: [PATCH] kernel: backport proper fix for mtd preventing devices probing MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Improper of_platform_populate() call caused issue with probing devices drivers. Fixes: 41e1e838fbbb ("kernel: backport mtd patch adding of_platform_populate() calls") Fixes: #10232 Ref: 79af0593a30b ("kernel: switch back 5.15 to fw_devlink=permissive") Signed-off-by: Rafał Miłecki --- ...t-create-platform-device-that-ll-nev.patch | 54 +++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 target/linux/generic/backport-5.15/409-v6.3-mtd-mtdpart-Don-t-create-platform-device-that-ll-nev.patch diff --git a/target/linux/generic/backport-5.15/409-v6.3-mtd-mtdpart-Don-t-create-platform-device-that-ll-nev.patch b/target/linux/generic/backport-5.15/409-v6.3-mtd-mtdpart-Don-t-create-platform-device-that-ll-nev.patch new file mode 100644 index 000000000000..ba14ae01785a --- /dev/null +++ b/target/linux/generic/backport-5.15/409-v6.3-mtd-mtdpart-Don-t-create-platform-device-that-ll-nev.patch @@ -0,0 +1,54 @@ +From fb42378dcc7f247df56f0ecddfdae85487495fbc Mon Sep 17 00:00:00 2001 +From: Saravana Kannan +Date: Mon, 6 Feb 2023 17:42:04 -0800 +Subject: [PATCH] mtd: mtdpart: Don't create platform device that'll never + probe + +These "nvmem-cells" platform devices never get probed because there's no +platform driver for it and it's never used anywhere else. So it's a +waste of memory. These devices also cause fw_devlink to block nvmem +consumers of "nvmem-cells" partition from probing because the supplier +device never probes. + +So stop creating platform devices for nvmem-cells partitions to avoid +wasting memory and to avoid blocking probing of consumers. + +Reported-by: Maxim Kiselev +Fixes: bcdf0315a61a ("mtd: call of_platform_populate() for MTD partitions") +Signed-off-by: Saravana Kannan +Tested-by: Maksim Kiselev +Tested-by: Douglas Anderson +Tested-by: Geert Uytterhoeven +Tested-by: Luca Weiss # qcom/sm7225-fairphone-fp4 +Link: https://lore.kernel.org/r/20230207014207.1678715-13-saravanak@google.com +Signed-off-by: Greg Kroah-Hartman +--- + drivers/mtd/mtdpart.c | 10 ++++++++++ + 1 file changed, 10 insertions(+) + +--- a/drivers/mtd/mtdpart.c ++++ b/drivers/mtd/mtdpart.c +@@ -577,6 +577,7 @@ static int mtd_part_of_parse(struct mtd_ + { + struct mtd_part_parser *parser; + struct device_node *np; ++ struct device_node *child; + struct property *prop; + struct device *dev; + const char *compat; +@@ -594,6 +595,15 @@ static int mtd_part_of_parse(struct mtd_ + else + np = of_get_child_by_name(np, "partitions"); + ++ /* ++ * Don't create devices that are added to a bus but will never get ++ * probed. That'll cause fw_devlink to block probing of consumers of ++ * this partition until the partition device is probed. ++ */ ++ for_each_child_of_node(np, child) ++ if (of_device_is_compatible(child, "nvmem-cells")) ++ of_node_set_flag(child, OF_POPULATED); ++ + of_property_for_each_string(np, "compatible", prop, compat) { + parser = mtd_part_get_compatible_parser(compat); + if (!parser) -- 2.30.2