Skip to contentSkip to conversation

rtc: max77686: use symbolic error messages

RFC In review Edmundo Carmona Antoranz 4 participants 11 messages May 9, 2021 – May 10, 2021 1 message not in the archive

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

RFC 1/2 rtc: max77686: use symbolic error messages

Modify some error messages so that the symbolic error value be printed instead of a numeric value.

---
 drivers/rtc/rtc-max77686.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/rtc/rtc-max77686.c +4 -2
index ce089ed934ad..470260478752 100644
@@ -711,7 +711,8 @@ static int max77686_init_rtc_regmap(struct max77686_rtc_info *info)
 						info->drv_data->regmap_config);
 	if (IS_ERR(info->rtc_regmap)) {
 		ret = PTR_ERR(info->rtc_regmap);
-		dev_err(info->dev, "Failed to allocate RTC regmap: %d\n", ret);
+		dev_err(info->dev, "Failed to allocate RTC regmap: %pe\n",
+			info->rtc_regmap);
 		return ret;
 	}
 
@@ -763,7 +764,8 @@ static int max77686_rtc_probe(struct platform_device *pdev)
 
 	if (IS_ERR(info->rtc_dev)) {
 		ret = PTR_ERR(info->rtc_dev);
-		dev_err(&pdev->dev, "Failed to register RTC device: %d\n", ret);
+		dev_err(&pdev->dev, "Failed to register RTC device: %pe\n",
+			info->rtc_dev);
 		goto err_rtc;
 	}
 
Signature · 1 line
2.30.2
#1 lore raw

RFC 2/2 staging: fbtft: use symbolic error messages

Modify some error messages so that the symbolic error value be printed instead of a numeric value.

---
 drivers/staging/fbtft/fb_ssd1351.c   | 3 +--
 drivers/staging/fbtft/fb_watterott.c | 3 +--
 drivers/staging/fbtft/fbtft-core.c   | 5 ++---
 3 files changed, 4 insertions(+), 7 deletions(-)
drivers/staging/fbtft/fb_ssd1351.c +1 -2
index 900b28d826b2..adf486b36289 100644
@@ -223,8 +223,7 @@ static void register_onboard_backlight(struct fbtft_par *par)
 				       &bl_props);
 	if (IS_ERR(bd)) {
 		dev_err(par->info->device,
-			"cannot register backlight device (%ld)\n",
-			PTR_ERR(bd));
+			"cannot register backlight device (%pe)\n", bd);
 		return;
 	}
 	par->info->bl_dev = bd;
drivers/staging/fbtft/fb_watterott.c +1 -2
index 76b25df376b8..f9ecc5202c47 100644
@@ -263,8 +263,7 @@ static void register_chip_backlight(struct fbtft_par *par)
 				       &bl_props);
 	if (IS_ERR(bd)) {
 		dev_err(par->info->device,
-			"cannot register backlight device (%ld)\n",
-			PTR_ERR(bd));
+			"cannot register backlight device (%pe)\n", bd);
 		return;
 	}
 	par->info->bl_dev = bd;
drivers/staging/fbtft/fbtft-core.c +2 -3
index 4f362dad4436..4d96ab2ea71c 100644
@@ -83,7 +83,7 @@ static int fbtft_request_one_gpio(struct fbtft_par *par,
 	if (IS_ERR(*gpiop)) {
 		ret = PTR_ERR(*gpiop);
 		dev_err(dev,
-			"Failed to request %s GPIO: %d\n", name, ret);
+			"Failed to request %s GPIO: %pe\n", name, *gpiop);
 		return ret;
 	}
 	fbtft_par_dbg(DEBUG_REQUEST_GPIOS, par, "%s: '%s' GPIO\n",
@@ -194,8 +194,7 @@ void fbtft_register_backlight(struct fbtft_par *par)
 				       &fbtft_bl_ops, &bl_props);
 	if (IS_ERR(bd)) {
 		dev_err(par->info->device,
-			"cannot register backlight device (%ld)\n",
-			PTR_ERR(bd));
+			"cannot register backlight device (%pe)\n", bd);
 		return;
 	}
 	par->info->bl_dev = bd;
Signature · 1 line
2.30.2
#2 lore raw

Re: [RFC 2/2] staging: fbtft: use symbolic error messages

Quoted 4 lines · Edmundo Carmona Antoranz

Modify some error messages so that the symbolic error value be printed instead of a numeric value.
---

I wonder if this is more or less what Dan and Christophe were talking about.

#3 lore raw
In reply to Edmundo Carmona Antoranz

Le 09/05/2021 à 02:41, Edmundo Carmona Antoranz a écrit :

Quoted 22 lines

Modify some error messages so that the symbolic error value be printed instead of a numeric value.

---
  drivers/rtc/rtc-max77686.c | 6 ++++--
  1 file changed, 4 insertions(+), 2 deletions(-)
drivers/rtc/rtc-max77686.c +2 -1
index ce089ed934ad..470260478752 100644
@@ -711,7 +711,8 @@ static int max77686_init_rtc_regmap(struct max77686_rtc_info *info)
  						info->drv_data->regmap_config);
  	if (IS_ERR(info->rtc_regmap)) {
  		ret = PTR_ERR(info->rtc_regmap);
-		dev_err(info->dev, "Failed to allocate RTC regmap: %d\n", ret);
+		dev_err(info->dev, "Failed to allocate RTC regmap: %pe\n",
+			info->rtc_regmap);
  		return ret;
  	}
 

drivers/rtc/rtc-max77686.c static int max77686_rtc_probe(struct platform_device *pdev) · line 771

Quoted 9 lines
drivers/rtc/rtc-max77686.c +2 -1
@@ -763,7 +764,8 @@ static int max77686_rtc_probe(struct platform_device *pdev)
 
  	if (IS_ERR(info->rtc_dev)) {
  		ret = PTR_ERR(info->rtc_dev);
-		dev_err(&pdev->dev, "Failed to register RTC device: %d\n", ret);
+		dev_err(&pdev->dev, "Failed to register RTC device: %pe\n",
+			info->rtc_dev);
  		goto err_rtc;
  	}
 

Hi,
both patches LGTM.

CJ

#4 lore raw
In reply to Edmundo Carmona Antoranz
Quoted 3 lines · Edmundo Carmona Antoranz

Modify some error messages so that the symbolic error value be printed instead of a numeric value.
---

No Signed-off-by. I feel like we should hold off on this for existing code until the %pe patches get backported to more -stable kernels. Otherwise if we backport a driver which uses %pe and the kernel doesn't support it then that's a headache. I think it gets treated like vanilla %p.

regards,
dan carpenter

#5 lore raw
Quoted 6 lines · Dan Carpenter
Quoted 3 lines · Edmundo Carmona Antoranz

Modify some error messages so that the symbolic error value be printed instead of a numeric value.
---

No Signed-off-by.

It wasn't meant as a patch to be applied. Just to show the opportunities.

Quoted 5 lines

I feel like we should hold off on this for existing
code until the %pe patches get backported to more -stable kernels. Otherwise if we backport a driver which uses %pe and the kernel doesn't support it then that's a headache. I think it gets treated like vanilla %p.

OK, that seems like a reasonable strategy.

Any idea what %i is? Does it actually exist?

julia

A message that is not in the archive (sent off-list or not yet received): alpine.DEB.2.22.394.2105092315330.24280@hadrien

#8 lore raw
Quoted 9 lines · Julia Lawall

---------------------------

Patch of a recent linux next:

arch/arm/mach-pxa/cm-x300.c +0 -0
index 2e35354b61f5..ff75e928772a 100644

arch/arm/mach-pxa/cm-x300.c static int cm_x300_u2d_init(struct device *dev) · line 534

Quoted 5 lines
arch/arm/mach-pxa/cm-x300.c +1 -1
@@ -531,7 +531,7 @@ static int cm_x300_u2d_init(struct device *dev)
 		pout_clk = clk_get(NULL, "CLK_POUT");
 		if (IS_ERR(pout_clk)) {
 			err = PTR_ERR(pout_clk);
-			pr_err("failed to get CLK_POUT: %d\n", err);
+			pr_err("failed to get CLK_POUT: %pe\n", err);

It has to print the pointer and not the err. So it should be:

			pr_err("failed to get CLK_POUT: %pe\n", pout_clk);

But really someone needs to introduce an %e (and everyone can see the need for %e but it's just a matter of finding someone who is feeling motivated).

regards,
dan carpenter

#9 lore raw
Quoted 18 lines · Dan Carpenter
Quoted 9 lines · Julia Lawall

---------------------------

Patch of a recent linux next:

arch/arm/mach-pxa/cm-x300.c +0 -0
index 2e35354b61f5..ff75e928772a 100644

arch/arm/mach-pxa/cm-x300.c static int cm_x300_u2d_init(struct device *dev) · line 534

Quoted 5 lines
arch/arm/mach-pxa/cm-x300.c +1 -1
@@ -531,7 +531,7 @@ static int cm_x300_u2d_init(struct device *dev)
 		pout_clk = clk_get(NULL, "CLK_POUT");
 		if (IS_ERR(pout_clk)) {
 			err = PTR_ERR(pout_clk);
-			pr_err("failed to get CLK_POUT: %d\n", err);
+			pr_err("failed to get CLK_POUT: %pe\n", err);

It has to print the pointer and not the err. So it should be:

Quoted 1 line
			pr_err("failed to get CLK_POUT: %pe\n", pout_clk);

Oops! Thanks. That is easy to fix.

julia

Quoted 9 lines

But really someone needs to introduce an %e (and everyone can see the need for %e but it's just a matter of finding someone who is feeling motivated).

regards,
dan carpenter

#10 lore raw
Quoted 22 lines · Julia Lawall
Quoted 18 lines · Dan Carpenter
Quoted 9 lines · Julia Lawall

---------------------------

Patch of a recent linux next:

arch/arm/mach-pxa/cm-x300.c +0 -0
index 2e35354b61f5..ff75e928772a 100644

arch/arm/mach-pxa/cm-x300.c static int cm_x300_u2d_init(struct device *dev) · line 534

Quoted 5 lines
arch/arm/mach-pxa/cm-x300.c +1 -1
@@ -531,7 +531,7 @@ static int cm_x300_u2d_init(struct device *dev)
 		pout_clk = clk_get(NULL, "CLK_POUT");
 		if (IS_ERR(pout_clk)) {
 			err = PTR_ERR(pout_clk);
-			pr_err("failed to get CLK_POUT: %d\n", err);
+			pr_err("failed to get CLK_POUT: %pe\n", err);

It has to print the pointer and not the err. So it should be:

Quoted 3 lines
Quoted 1 line
			pr_err("failed to get CLK_POUT: %pe\n", pout_clk);

Oops! Thanks. That is easy to fix.

Yeah, but I would prefer to wait until %e exists and use that instead.

regards,
dan carpenter

#11 lore raw
Quoted 23 lines · Dan Carpenter
Quoted 22 lines · Julia Lawall
Quoted 18 lines · Dan Carpenter
Quoted 9 lines · Julia Lawall

---------------------------

Patch of a recent linux next:

arch/arm/mach-pxa/cm-x300.c +0 -0
index 2e35354b61f5..ff75e928772a 100644

arch/arm/mach-pxa/cm-x300.c static int cm_x300_u2d_init(struct device *dev) · line 534

Quoted 5 lines
arch/arm/mach-pxa/cm-x300.c +1 -1
@@ -531,7 +531,7 @@ static int cm_x300_u2d_init(struct device *dev)
 		pout_clk = clk_get(NULL, "CLK_POUT");
 		if (IS_ERR(pout_clk)) {
 			err = PTR_ERR(pout_clk);
-			pr_err("failed to get CLK_POUT: %d\n", err);
+			pr_err("failed to get CLK_POUT: %pe\n", err);

It has to print the pointer and not the err. So it should be:

Quoted 5 lines
Quoted 3 lines
Quoted 1 line
			pr_err("failed to get CLK_POUT: %pe\n", pout_clk);

Oops! Thanks. That is easy to fix.

Yeah, but I would prefer to wait until %e exists and use that instead.

OK.

thanks,
julia