linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/2] pinctrl: pinmux: Update error reporting in pin_request()
@ 2023-09-09 14:34 Jernej Skrabec
  2023-09-09 14:34 ` [PATCH v2 1/2] pinctrl: pinmux: Remove duplicate error message " Jernej Skrabec
  2023-09-09 14:34 ` [PATCH v2 2/2] pinctrl: pinmux: Use dev_err_probe() " Jernej Skrabec
  0 siblings, 2 replies; 3+ messages in thread
From: Jernej Skrabec @ 2023-09-09 14:34 UTC (permalink / raw)
  To: linus.walleij; +Cc: linux-gpio, linux-kernel, Jernej Skrabec

Currently pin_request() may prints two error messages for same error.
Additionally, it also prints error message when status is -EPROBE_DEFER.

Fix that by removing duplicate error reporting and use dev_err_probe()
instead of ordinary dev_err().

Best regards,
Jernej

Changes from v1:
- fixed dev_err_probe() arguments

Jernej Skrabec (2):
  pinctrl: pinmux: Remove duplicate error message in pin_request()
  pinctrl: pinmux: Use dev_err_probe() in pin_request()

 drivers/pinctrl/pinmux.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

-- 
2.42.0


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

* [PATCH v2 1/2] pinctrl: pinmux: Remove duplicate error message in pin_request()
  2023-09-09 14:34 [PATCH v2 0/2] pinctrl: pinmux: Update error reporting in pin_request() Jernej Skrabec
@ 2023-09-09 14:34 ` Jernej Skrabec
  2023-09-09 14:34 ` [PATCH v2 2/2] pinctrl: pinmux: Use dev_err_probe() " Jernej Skrabec
  1 sibling, 0 replies; 3+ messages in thread
From: Jernej Skrabec @ 2023-09-09 14:34 UTC (permalink / raw)
  To: linus.walleij; +Cc: linux-gpio, linux-kernel, Jernej Skrabec

Detailed error message is already printed at the end of the function, so
drop redundant one a few lines earlier.

Signed-off-by: Jernej Skrabec <jernej.skrabec@gmail.com>
---
 drivers/pinctrl/pinmux.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/pinctrl/pinmux.c b/drivers/pinctrl/pinmux.c
index 2a180a5d64a4..301fe0157b02 100644
--- a/drivers/pinctrl/pinmux.c
+++ b/drivers/pinctrl/pinmux.c
@@ -173,10 +173,8 @@ static int pin_request(struct pinctrl_dev *pctldev,
 	else
 		status = 0;
 
-	if (status) {
-		dev_err(pctldev->dev, "request() failed for pin %d\n", pin);
+	if (status)
 		module_put(pctldev->owner);
-	}
 
 out_free_pin:
 	if (status) {
-- 
2.42.0


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

* [PATCH v2 2/2] pinctrl: pinmux: Use dev_err_probe() in pin_request()
  2023-09-09 14:34 [PATCH v2 0/2] pinctrl: pinmux: Update error reporting in pin_request() Jernej Skrabec
  2023-09-09 14:34 ` [PATCH v2 1/2] pinctrl: pinmux: Remove duplicate error message " Jernej Skrabec
@ 2023-09-09 14:34 ` Jernej Skrabec
  1 sibling, 0 replies; 3+ messages in thread
From: Jernej Skrabec @ 2023-09-09 14:34 UTC (permalink / raw)
  To: linus.walleij; +Cc: linux-gpio, linux-kernel, Jernej Skrabec

Use dev_err_probe() when printing error message in pin_request() since
it may fail with -EPROBE_DEFER.

Signed-off-by: Jernej Skrabec <jernej.skrabec@gmail.com>
---
 drivers/pinctrl/pinmux.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/pinctrl/pinmux.c b/drivers/pinctrl/pinmux.c
index 301fe0157b02..0ecd74ce5890 100644
--- a/drivers/pinctrl/pinmux.c
+++ b/drivers/pinctrl/pinmux.c
@@ -188,8 +188,8 @@ static int pin_request(struct pinctrl_dev *pctldev,
 	}
 out:
 	if (status)
-		dev_err(pctldev->dev, "pin-%d (%s) status %d\n",
-			pin, owner, status);
+		dev_err_probe(pctldev->dev, status, "pin-%d (%s)\n",
+			      pin, owner);
 
 	return status;
 }
-- 
2.42.0


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

end of thread, other threads:[~2023-09-09 16:25 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-09-09 14:34 [PATCH v2 0/2] pinctrl: pinmux: Update error reporting in pin_request() Jernej Skrabec
2023-09-09 14:34 ` [PATCH v2 1/2] pinctrl: pinmux: Remove duplicate error message " Jernej Skrabec
2023-09-09 14:34 ` [PATCH v2 2/2] pinctrl: pinmux: Use dev_err_probe() " Jernej Skrabec

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).