Skip to contentSkip to conversation

scsi: ufs: convert probe to use dev_err_probe()

PATCH Applied Brian Masney 4 participants 9 messages Aug 14, 2023 – Aug 25, 2023

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

v3 cover scsi: ufs: convert probe to use dev_err_probe()

The following two log messages are shown on bootup due to an -EPROBE_DEFER when booting on a Qualcomm sa8775p development board:

ufshcd-qcom 1d84000.ufs: ufshcd_variant_hba_init: variant qcom init
failed err -517
ufshcd-qcom 1d84000.ufs: Initialization failed

This patch series converts the relevant two probe functions over to use dev_err_probe() so that these messages are not shown on bootup.

Changes since v2
https://lore.kernel.org/lkml/[email protected]/
- Add error code to message in second patch

Changes since v1
https://lore.kernel.org/lkml/[email protected]/
- Dropped code cleanup from first patch

Brian Masney (2):
scsi: ufs: core: convert to dev_err_probe() in hba_init
scsi: ufs: host: convert to dev_err_probe() in pltfrm_init

 drivers/ufs/core/ufshcd.c        | 5 +++--
 drivers/ufs/host/ufshcd-pltfrm.c | 3 ++-
 2 files changed, 5 insertions(+), 3 deletions(-)
Signature · 1 line
2.41.0
#1 lore raw

PATCH v3 1/2 scsi: ufs: core: convert to dev_err_probe() in hba_init

Convert ufshcd_variant_hba_init() over to use dev_err_probe() to avoid log messages like the following on bootup:

ufshcd-qcom 1d84000.ufs: ufshcd_variant_hba_init: variant qcom init
failed err -517

---
Changes since v2
- None

Changes since v1
- Dropped code cleanup

 drivers/ufs/core/ufshcd.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/ufs/core/ufshcd.c +3 -2
index 129446775796..409d176542e1 100644
@@ -9235,8 +9235,9 @@ static int ufshcd_variant_hba_init(struct ufs_hba *hba)
 
 	err = ufshcd_vops_init(hba);
 	if (err)
-		dev_err(hba->dev, "%s: variant %s init failed err %d\n",
-			__func__, ufshcd_get_var_name(hba), err);
+		dev_err_probe(hba->dev, err,
+			      "%s: variant %s init failed err %d\n",
+			      __func__, ufshcd_get_var_name(hba), err);
 out:
 	return err;
 }
Signature · 1 line
2.41.0
reviewer Reviewed-by on v3 1/2
#2 lore raw

Re: [PATCH v3 1/2] scsi: ufs: core: convert to dev_err_probe() in hba_init

Quoted 6 lines · Brian Masney
drivers/ufs/core/ufshcd.c +0 -0
index 129446775796..409d176542e1 100644
@@ -9235,8 +9235,9 @@ static int ufshcd_variant_hba_init(struct ufs_hba *hba)
 

drivers/ufs/core/ufshcd.c static int ufshcd_variant_hba_init(struct ufs_hba *hba) · line 9243

Quoted 10 lines
drivers/ufs/core/ufshcd.c +3 -2
  	err = ufshcd_vops_init(hba);
  	if (err)
-		dev_err(hba->dev, "%s: variant %s init failed err %d\n",
-			__func__, ufshcd_get_var_name(hba), err);
+		dev_err_probe(hba->dev, err,
+			      "%s: variant %s init failed err %d\n",
+			      __func__, ufshcd_get_var_name(hba), err);
  out:
  	return err;
  }

This opportunity could have been used to improve the grammar of the reported error message. Anyway:

#3 lore raw

Re: [PATCH v3 1/2] scsi: ufs: core: convert to dev_err_probe() in hba_init

Quoted 11 lines · Bart Van Assche
Quoted 10 lines · Brian Masney
drivers/ufs/core/ufshcd.c +1 -2
index 129446775796..409d176542e1 100644
@@ -9235,8 +9235,9 @@ static int ufshcd_variant_hba_init(struct ufs_hba *hba)
  	err = ufshcd_vops_init(hba);
  	if (err)
-		dev_err(hba->dev, "%s: variant %s init failed err %d\n",
-			__func__, ufshcd_get_var_name(hba), err);
+		dev_err_probe(hba->dev, err,
Quoted 8 lines

drivers/ufs/core/ufshcd.c static int ufshcd_variant_hba_init(struct ufs_hba *hba) · line 9243

Quoted 5 lines
drivers/ufs/core/ufshcd.c +2 -0
+			      "%s: variant %s init failed err %d\n",
+			      __func__, ufshcd_get_var_name(hba), err);
  out:
  	return err;
  }

This opportunity could have been used to improve the grammar of the reported error message. Anyway:

That's what I originally did in v1, however I was asked to split out the cleanup into a different patch. Split out, I think the cleanup on it's own isn't worth it's own patch, so that's why I dropped it.

https://lore.kernel.org/lkml/[email protected]/

Quoted 1 line

Thanks!

Brian

#4 lore raw

Re: [PATCH v3 1/2] scsi: ufs: core: convert to dev_err_probe() in hba_init

Quoted 21 lines · Brian Masney
Quoted 11 lines · Bart Van Assche
Quoted 10 lines · Brian Masney
drivers/ufs/core/ufshcd.c +1 -2
index 129446775796..409d176542e1 100644
@@ -9235,8 +9235,9 @@ static int ufshcd_variant_hba_init(struct ufs_hba *hba)
   	err = ufshcd_vops_init(hba);
   	if (err)
-		dev_err(hba->dev, "%s: variant %s init failed err %d\n",
-			__func__, ufshcd_get_var_name(hba), err);
+		dev_err_probe(hba->dev, err,
Quoted 8 lines

drivers/ufs/core/ufshcd.c static int ufshcd_variant_hba_init(struct ufs_hba *hba) · line 9243

Quoted 5 lines
drivers/ufs/core/ufshcd.c +2 -0
+			      "%s: variant %s init failed err %d\n",
+			      __func__, ufshcd_get_var_name(hba), err);
   out:
   	return err;
   }

This opportunity could have been used to improve the grammar of the reported error message. Anyway:

Quoted 5 lines

That's what I originally did in v1, however I was asked to split out the cleanup into a different patch. Split out, I think the cleanup on it's own isn't worth it's own patch, so that's why I dropped it.

https://lore.kernel.org/lkml/[email protected]/

Changing an error message and introducing dev_err_probe() at the same time is fine. I don't think that is what the reviewer complained about. The complaint probably was about renaming 'err' into 'ret' and about changing 'goto out' into 'return 0'?

Thanks,

Bart.

#5 lore raw

PATCH v3 2/2 scsi: ufs: host: convert to dev_err_probe() in pltfrm_init

In reply to Brian Masney

Convert ufshcd_pltfrm_init() over to use dev_err_probe() to avoid the following log message on bootup due to an -EPROBE_DEFER return code:

ufshcd-qcom 1d84000.ufs: Initialization failed

While this line is changed, let's also go ahead and add the error code to the message as well.

---
Changes since v2
- Add error code to message

Changes since v1
- None

 drivers/ufs/host/ufshcd-pltfrm.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/ufs/host/ufshcd-pltfrm.c +2 -1
index 0b7430033047..c81a14f9eaf5 100644
@@ -373,7 +373,8 @@ int ufshcd_pltfrm_init(struct platform_device *pdev,
 
 	err = ufshcd_init(hba, mmio_base, irq);
 	if (err) {
-		dev_err(dev, "Initialization failed\n");
+		dev_err_probe(dev, err, "Initialization failed with error %d\n",
+			      err);
 		goto dealloc_host;
 	}
 
Signature · 1 line
2.41.0
Reviewed-by on v3 2/2
#6 lore raw

Re: [PATCH v3 2/2] scsi: ufs: host: convert to dev_err_probe() in pltfrm_init

Quoted 5 lines
drivers/ufs/host/ufshcd-pltfrm.c +0 -0
index 0b7430033047..c81a14f9eaf5 100644

drivers/ufs/host/ufshcd-pltfrm.c int ufshcd_pltfrm_init(struct platform_device *pdev, · line 380

Quoted 9 lines
drivers/ufs/host/ufshcd-pltfrm.c +2 -1
@@ -373,7 +373,8 @@ int ufshcd_pltfrm_init(struct platform_device *pdev,
 
  	err = ufshcd_init(hba, mmio_base, irq);
  	if (err) {
-		dev_err(dev, "Initialization failed\n");
+		dev_err_probe(dev, err, "Initialization failed with error %d\n",
+			      err);
  		goto dealloc_host;
  	}
 
#7 lore raw
In reply to Brian Masney

Brian,

Quoted 9 lines

The following two log messages are shown on bootup due to an -EPROBE_DEFER when booting on a Qualcomm sa8775p development board:

ufshcd-qcom 1d84000.ufs: ufshcd_variant_hba_init: variant qcom init
failed err -517
ufshcd-qcom 1d84000.ufs: Initialization failed

This patch series converts the relevant two probe functions over to use dev_err_probe() so that these messages are not shown on bootup.

Applied to 6.6/scsi-staging, thanks!

Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering
#8 lore raw
In reply to Brian Masney
Quoted 8 lines · Brian Masney

The following two log messages are shown on bootup due to an -EPROBE_DEFER when booting on a Qualcomm sa8775p development board:

ufshcd-qcom 1d84000.ufs: ufshcd_variant_hba_init: variant qcom init
failed err -517
ufshcd-qcom 1d84000.ufs: Initialization failed

[...]

Applied to 6.6/scsi-queue, thanks!

[1/2] scsi: ufs: core: convert to dev_err_probe() in hba_init

      https://git.kernel.org/mkp/scsi/c/137523237172
[2/2] scsi: ufs: host: convert to dev_err_probe() in pltfrm_init
      https://git.kernel.org/mkp/scsi/c/517f8eb3fa64
Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering