All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] Handle probe defer properly in MTD core
@ 2021-03-02 13:27 ` Manivannan Sadhasivam
  0 siblings, 0 replies; 9+ messages in thread
From: Manivannan Sadhasivam @ 2021-03-02 13:27 UTC (permalink / raw)
  To: miquel.raynal, richard, vigneshr
  Cc: linux-arm-msm, linux-mtd, linux-kernel, boris.brezillon,
	Daniele.Palmas, bjorn.andersson, Manivannan Sadhasivam

Hello,

These two patches aims at fixing the -EPROBE_DEFER handling in the MTD
core and also in the Qcom nand driver. The "qcomsmem" parser depends on
the QCOM_SMEM driver to parse the partitions defined in the shared
memory. Due to the DT layout, the SMEM driver might probe after the NAND
driver. In that case, the -EPROBE_DEFER returned by qcom_smem_get() in
the parser will fail to propagate till the driver core. So this will
result in the partitions not getting parsed even after the SMEM driver is
available.

So fix this issue by handling the -EPROBE_DEFER error properly in both
MTD core and in the Qcom nand driver. This issue is observed on Qcom SDX55
based Telit FN980 EVB and in SDX55-MTP.

Thanks,
Mani

Manivannan Sadhasivam (2):
  mtd: Handle possible -EPROBE_DEFER from parse_mtd_partitions()
  mtd: rawnand: qcom: Return actual error code instead of -ENODEV

 drivers/mtd/mtdcore.c             | 3 +++
 drivers/mtd/nand/raw/qcom_nandc.c | 7 ++-----
 2 files changed, 5 insertions(+), 5 deletions(-)

-- 
2.25.1


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 0/2] Handle probe defer properly in MTD core
@ 2021-03-02 13:27 ` Manivannan Sadhasivam
  0 siblings, 0 replies; 9+ messages in thread
From: Manivannan Sadhasivam @ 2021-03-02 13:27 UTC (permalink / raw)
  To: miquel.raynal, richard, vigneshr
  Cc: linux-arm-msm, linux-mtd, linux-kernel, boris.brezillon,
	Daniele.Palmas, bjorn.andersson, Manivannan Sadhasivam

Hello,

These two patches aims at fixing the -EPROBE_DEFER handling in the MTD
core and also in the Qcom nand driver. The "qcomsmem" parser depends on
the QCOM_SMEM driver to parse the partitions defined in the shared
memory. Due to the DT layout, the SMEM driver might probe after the NAND
driver. In that case, the -EPROBE_DEFER returned by qcom_smem_get() in
the parser will fail to propagate till the driver core. So this will
result in the partitions not getting parsed even after the SMEM driver is
available.

So fix this issue by handling the -EPROBE_DEFER error properly in both
MTD core and in the Qcom nand driver. This issue is observed on Qcom SDX55
based Telit FN980 EVB and in SDX55-MTP.

Thanks,
Mani

Manivannan Sadhasivam (2):
  mtd: Handle possible -EPROBE_DEFER from parse_mtd_partitions()
  mtd: rawnand: qcom: Return actual error code instead of -ENODEV

 drivers/mtd/mtdcore.c             | 3 +++
 drivers/mtd/nand/raw/qcom_nandc.c | 7 ++-----
 2 files changed, 5 insertions(+), 5 deletions(-)

-- 
2.25.1


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 1/2] mtd: Handle possible -EPROBE_DEFER from parse_mtd_partitions()
  2021-03-02 13:27 ` Manivannan Sadhasivam
@ 2021-03-02 13:27   ` Manivannan Sadhasivam
  -1 siblings, 0 replies; 9+ messages in thread
From: Manivannan Sadhasivam @ 2021-03-02 13:27 UTC (permalink / raw)
  To: miquel.raynal, richard, vigneshr
  Cc: linux-arm-msm, linux-mtd, linux-kernel, boris.brezillon,
	Daniele.Palmas, bjorn.andersson, Manivannan Sadhasivam

There are chances that the parse_mtd_partitions() function will return
-EPROBE_DEFER in mtd_device_parse_register(). This might happen when
the dependency is not available for the parser. For instance, on SDX55
the MTD_QCOMSMEM_PARTS parser depends on the QCOM_SMEM driver to parse
the partitions defined in the shared memory region. With the current
flow, the error returned from parse_mtd_partitions() will be discarded
in favor of trying to add the fallback partition.

This will prevent the driver to end up in probe deferred pool and the
partitions won't be parsed even after the QCOM_SMEM driver is available.

Fix this issue by bailing out of mtd_device_parse_register() when
-EPROBE_DEFER error is returned from parse_mtd_partitions() function and
propagate the error code to the driver core for probing later.

Fixes: 5ac67ce36cfe ("mtd: move code adding (registering) partitions to the parse_mtd_partitions()")
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
---
 drivers/mtd/mtdcore.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/mtd/mtdcore.c b/drivers/mtd/mtdcore.c
index 2d6423d89a17..d97ddc65b5d4 100644
--- a/drivers/mtd/mtdcore.c
+++ b/drivers/mtd/mtdcore.c
@@ -820,6 +820,9 @@ int mtd_device_parse_register(struct mtd_info *mtd, const char * const *types,
 
 	/* Prefer parsed partitions over driver-provided fallback */
 	ret = parse_mtd_partitions(mtd, types, parser_data);
+	if (ret == -EPROBE_DEFER)
+		goto out;
+
 	if (ret > 0)
 		ret = 0;
 	else if (nr_parts)
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 1/2] mtd: Handle possible -EPROBE_DEFER from parse_mtd_partitions()
@ 2021-03-02 13:27   ` Manivannan Sadhasivam
  0 siblings, 0 replies; 9+ messages in thread
From: Manivannan Sadhasivam @ 2021-03-02 13:27 UTC (permalink / raw)
  To: miquel.raynal, richard, vigneshr
  Cc: linux-arm-msm, linux-mtd, linux-kernel, boris.brezillon,
	Daniele.Palmas, bjorn.andersson, Manivannan Sadhasivam

There are chances that the parse_mtd_partitions() function will return
-EPROBE_DEFER in mtd_device_parse_register(). This might happen when
the dependency is not available for the parser. For instance, on SDX55
the MTD_QCOMSMEM_PARTS parser depends on the QCOM_SMEM driver to parse
the partitions defined in the shared memory region. With the current
flow, the error returned from parse_mtd_partitions() will be discarded
in favor of trying to add the fallback partition.

This will prevent the driver to end up in probe deferred pool and the
partitions won't be parsed even after the QCOM_SMEM driver is available.

Fix this issue by bailing out of mtd_device_parse_register() when
-EPROBE_DEFER error is returned from parse_mtd_partitions() function and
propagate the error code to the driver core for probing later.

Fixes: 5ac67ce36cfe ("mtd: move code adding (registering) partitions to the parse_mtd_partitions()")
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
---
 drivers/mtd/mtdcore.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/mtd/mtdcore.c b/drivers/mtd/mtdcore.c
index 2d6423d89a17..d97ddc65b5d4 100644
--- a/drivers/mtd/mtdcore.c
+++ b/drivers/mtd/mtdcore.c
@@ -820,6 +820,9 @@ int mtd_device_parse_register(struct mtd_info *mtd, const char * const *types,
 
 	/* Prefer parsed partitions over driver-provided fallback */
 	ret = parse_mtd_partitions(mtd, types, parser_data);
+	if (ret == -EPROBE_DEFER)
+		goto out;
+
 	if (ret > 0)
 		ret = 0;
 	else if (nr_parts)
-- 
2.25.1


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 2/2] mtd: rawnand: qcom: Return actual error code instead of -ENODEV
  2021-03-02 13:27 ` Manivannan Sadhasivam
@ 2021-03-02 13:27   ` Manivannan Sadhasivam
  -1 siblings, 0 replies; 9+ messages in thread
From: Manivannan Sadhasivam @ 2021-03-02 13:27 UTC (permalink / raw)
  To: miquel.raynal, richard, vigneshr
  Cc: linux-arm-msm, linux-mtd, linux-kernel, boris.brezillon,
	Daniele.Palmas, bjorn.andersson, Manivannan Sadhasivam

In qcom_probe_nand_devices() function, the error code returned by
qcom_nand_host_init_and_register() is converted to -ENODEV in the case
of failure. This poses issue if -EPROBE_DEFER is returned when the
dependency is not available for a component like parser.

So let's restructure the error handling logic a bit and return the
actual error code in case of qcom_nand_host_init_and_register() failure.

Fixes: c76b78d8ec05 ("mtd: nand: Qualcomm NAND controller driver")
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
---
 drivers/mtd/nand/raw/qcom_nandc.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/mtd/nand/raw/qcom_nandc.c b/drivers/mtd/nand/raw/qcom_nandc.c
index c2dc99c1b2f1..54230f2c1a3f 100644
--- a/drivers/mtd/nand/raw/qcom_nandc.c
+++ b/drivers/mtd/nand/raw/qcom_nandc.c
@@ -2952,7 +2952,7 @@ static int qcom_probe_nand_devices(struct qcom_nand_controller *nandc)
 	struct device *dev = nandc->dev;
 	struct device_node *dn = dev->of_node, *child;
 	struct qcom_nand_host *host;
-	int ret;
+	int ret = -ENODEV;
 
 	for_each_available_child_of_node(dn, child) {
 		host = devm_kzalloc(dev, sizeof(*host), GFP_KERNEL);
@@ -2970,10 +2970,7 @@ static int qcom_probe_nand_devices(struct qcom_nand_controller *nandc)
 		list_add_tail(&host->node, &nandc->host_list);
 	}
 
-	if (list_empty(&nandc->host_list))
-		return -ENODEV;
-
-	return 0;
+	return ret;
 }
 
 /* parse custom DT properties here */
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 2/2] mtd: rawnand: qcom: Return actual error code instead of -ENODEV
@ 2021-03-02 13:27   ` Manivannan Sadhasivam
  0 siblings, 0 replies; 9+ messages in thread
From: Manivannan Sadhasivam @ 2021-03-02 13:27 UTC (permalink / raw)
  To: miquel.raynal, richard, vigneshr
  Cc: linux-arm-msm, linux-mtd, linux-kernel, boris.brezillon,
	Daniele.Palmas, bjorn.andersson, Manivannan Sadhasivam

In qcom_probe_nand_devices() function, the error code returned by
qcom_nand_host_init_and_register() is converted to -ENODEV in the case
of failure. This poses issue if -EPROBE_DEFER is returned when the
dependency is not available for a component like parser.

So let's restructure the error handling logic a bit and return the
actual error code in case of qcom_nand_host_init_and_register() failure.

Fixes: c76b78d8ec05 ("mtd: nand: Qualcomm NAND controller driver")
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
---
 drivers/mtd/nand/raw/qcom_nandc.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/mtd/nand/raw/qcom_nandc.c b/drivers/mtd/nand/raw/qcom_nandc.c
index c2dc99c1b2f1..54230f2c1a3f 100644
--- a/drivers/mtd/nand/raw/qcom_nandc.c
+++ b/drivers/mtd/nand/raw/qcom_nandc.c
@@ -2952,7 +2952,7 @@ static int qcom_probe_nand_devices(struct qcom_nand_controller *nandc)
 	struct device *dev = nandc->dev;
 	struct device_node *dn = dev->of_node, *child;
 	struct qcom_nand_host *host;
-	int ret;
+	int ret = -ENODEV;
 
 	for_each_available_child_of_node(dn, child) {
 		host = devm_kzalloc(dev, sizeof(*host), GFP_KERNEL);
@@ -2970,10 +2970,7 @@ static int qcom_probe_nand_devices(struct qcom_nand_controller *nandc)
 		list_add_tail(&host->node, &nandc->host_list);
 	}
 
-	if (list_empty(&nandc->host_list))
-		return -ENODEV;
-
-	return 0;
+	return ret;
 }
 
 /* parse custom DT properties here */
-- 
2.25.1


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH 0/2] Handle probe defer properly in MTD core
  2021-03-02 13:27 ` Manivannan Sadhasivam
@ 2021-03-03  8:03   ` Miquel Raynal
  -1 siblings, 0 replies; 9+ messages in thread
From: Miquel Raynal @ 2021-03-03  8:03 UTC (permalink / raw)
  To: Manivannan Sadhasivam
  Cc: richard, vigneshr, linux-arm-msm, linux-mtd, linux-kernel,
	boris.brezillon, Daniele.Palmas, bjorn.andersson

Hi Manivannan,

Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> wrote on Tue,
2 Mar 2021 18:57:55 +0530:

> Hello,
> 
> These two patches aims at fixing the -EPROBE_DEFER handling in the MTD
> core and also in the Qcom nand driver. The "qcomsmem" parser depends on
> the QCOM_SMEM driver to parse the partitions defined in the shared
> memory. Due to the DT layout, the SMEM driver might probe after the NAND
> driver. In that case, the -EPROBE_DEFER returned by qcom_smem_get() in
> the parser will fail to propagate till the driver core. So this will
> result in the partitions not getting parsed even after the SMEM driver is
> available.
> 
> So fix this issue by handling the -EPROBE_DEFER error properly in both
> MTD core and in the Qcom nand driver. This issue is observed on Qcom SDX55
> based Telit FN980 EVB and in SDX55-MTP.

Applied manually on top of nand/next as infradead.org is dead at the
moment and the patches were not collected by patchwork.

Thanks,
Miquèl

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 0/2] Handle probe defer properly in MTD core
@ 2021-03-03  8:03   ` Miquel Raynal
  0 siblings, 0 replies; 9+ messages in thread
From: Miquel Raynal @ 2021-03-03  8:03 UTC (permalink / raw)
  To: Manivannan Sadhasivam
  Cc: richard, vigneshr, linux-arm-msm, linux-mtd, linux-kernel,
	boris.brezillon, Daniele.Palmas, bjorn.andersson

Hi Manivannan,

Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> wrote on Tue,
2 Mar 2021 18:57:55 +0530:

> Hello,
> 
> These two patches aims at fixing the -EPROBE_DEFER handling in the MTD
> core and also in the Qcom nand driver. The "qcomsmem" parser depends on
> the QCOM_SMEM driver to parse the partitions defined in the shared
> memory. Due to the DT layout, the SMEM driver might probe after the NAND
> driver. In that case, the -EPROBE_DEFER returned by qcom_smem_get() in
> the parser will fail to propagate till the driver core. So this will
> result in the partitions not getting parsed even after the SMEM driver is
> available.
> 
> So fix this issue by handling the -EPROBE_DEFER error properly in both
> MTD core and in the Qcom nand driver. This issue is observed on Qcom SDX55
> based Telit FN980 EVB and in SDX55-MTP.

Applied manually on top of nand/next as infradead.org is dead at the
moment and the patches were not collected by patchwork.

Thanks,
Miquèl

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 0/2] Handle probe defer properly in MTD core
  2021-03-02 13:27 ` Manivannan Sadhasivam
                   ` (3 preceding siblings ...)
  (?)
@ 2021-05-26 19:03 ` patchwork-bot+linux-arm-msm
  -1 siblings, 0 replies; 9+ messages in thread
From: patchwork-bot+linux-arm-msm @ 2021-05-26 19:03 UTC (permalink / raw)
  To: Manivannan Sadhasivam; +Cc: linux-arm-msm

Hello:

This series was applied to qcom/linux.git (refs/heads/for-next):

On Tue,  2 Mar 2021 18:57:55 +0530 you wrote:
> Hello,
> 
> These two patches aims at fixing the -EPROBE_DEFER handling in the MTD
> core and also in the Qcom nand driver. The "qcomsmem" parser depends on
> the QCOM_SMEM driver to parse the partitions defined in the shared
> memory. Due to the DT layout, the SMEM driver might probe after the NAND
> driver. In that case, the -EPROBE_DEFER returned by qcom_smem_get() in
> the parser will fail to propagate till the driver core. So this will
> result in the partitions not getting parsed even after the SMEM driver is
> available.
> 
> [...]

Here is the summary with links:
  - [1/2] mtd: Handle possible -EPROBE_DEFER from parse_mtd_partitions()
    https://git.kernel.org/qcom/c/08608adb520e
  - [2/2] mtd: rawnand: qcom: Return actual error code instead of -ENODEV
    https://git.kernel.org/qcom/c/55fbb9ba4f06

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2021-05-26 19:03 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-02 13:27 [PATCH 0/2] Handle probe defer properly in MTD core Manivannan Sadhasivam
2021-03-02 13:27 ` Manivannan Sadhasivam
2021-03-02 13:27 ` [PATCH 1/2] mtd: Handle possible -EPROBE_DEFER from parse_mtd_partitions() Manivannan Sadhasivam
2021-03-02 13:27   ` Manivannan Sadhasivam
2021-03-02 13:27 ` [PATCH 2/2] mtd: rawnand: qcom: Return actual error code instead of -ENODEV Manivannan Sadhasivam
2021-03-02 13:27   ` Manivannan Sadhasivam
2021-03-03  8:03 ` [PATCH 0/2] Handle probe defer properly in MTD core Miquel Raynal
2021-03-03  8:03   ` Miquel Raynal
2021-05-26 19:03 ` patchwork-bot+linux-arm-msm

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.