* [PATCH 1/2] serial: 8250: Simplify with dev_err_probe()
@ 2020-09-01 15:30 Krzysztof Kozlowski
2020-09-01 15:31 ` [PATCH 2/2] serial: core: " Krzysztof Kozlowski
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Krzysztof Kozlowski @ 2020-09-01 15:30 UTC (permalink / raw)
To: Greg Kroah-Hartman, Jiri Slaby, Florian Fainelli, Ray Jui,
Scott Branden, bcm-kernel-feedback-list, Nicolas Saenz Julienne,
Paul Cercueil, Lukas Wunner, linux-serial, linux-rpi-kernel,
linux-arm-kernel, linux-kernel
Cc: Krzysztof Kozlowski
Common pattern of handling deferred probe can be simplified with
dev_err_probe(). Less code and the error value gets printed.
Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
---
drivers/tty/serial/8250/8250_bcm2835aux.c | 12 +++---------
drivers/tty/serial/8250/8250_ingenic.c | 20 ++++++--------------
2 files changed, 9 insertions(+), 23 deletions(-)
diff --git a/drivers/tty/serial/8250/8250_bcm2835aux.c b/drivers/tty/serial/8250/8250_bcm2835aux.c
index 12d03e678295..fd95860cd661 100644
--- a/drivers/tty/serial/8250/8250_bcm2835aux.c
+++ b/drivers/tty/serial/8250/8250_bcm2835aux.c
@@ -110,12 +110,8 @@ static int bcm2835aux_serial_probe(struct platform_device *pdev)
/* get the clock - this also enables the HW */
data->clk = devm_clk_get(&pdev->dev, NULL);
- ret = PTR_ERR_OR_ZERO(data->clk);
- if (ret) {
- if (ret != -EPROBE_DEFER)
- dev_err(&pdev->dev, "could not get clk: %d\n", ret);
- return ret;
- }
+ if (IS_ERR(data->clk))
+ return dev_err_probe(&pdev->dev, PTR_ERR(data->clk), "could not get clk\n");
/* get the interrupt */
ret = platform_get_irq(pdev, 0);
@@ -155,9 +151,7 @@ static int bcm2835aux_serial_probe(struct platform_device *pdev)
/* register the port */
ret = serial8250_register_8250_port(&up);
if (ret < 0) {
- if (ret != -EPROBE_DEFER)
- dev_err(&pdev->dev,
- "unable to register 8250 port - %d\n", ret);
+ dev_err_probe(&pdev->dev, ret, "unable to register 8250 port\n");
goto dis_clk;
}
data->line = ret;
diff --git a/drivers/tty/serial/8250/8250_ingenic.c b/drivers/tty/serial/8250/8250_ingenic.c
index dde766fa465f..988bf6bcce42 100644
--- a/drivers/tty/serial/8250/8250_ingenic.c
+++ b/drivers/tty/serial/8250/8250_ingenic.c
@@ -259,22 +259,14 @@ static int ingenic_uart_probe(struct platform_device *pdev)
return -ENOMEM;
data->clk_module = devm_clk_get(&pdev->dev, "module");
- if (IS_ERR(data->clk_module)) {
- err = PTR_ERR(data->clk_module);
- if (err != -EPROBE_DEFER)
- dev_err(&pdev->dev,
- "unable to get module clock: %d\n", err);
- return err;
- }
+ if (IS_ERR(data->clk_module))
+ return dev_err_probe(&pdev->dev, PTR_ERR(data->clk_module),
+ "unable to get module clock\n");
data->clk_baud = devm_clk_get(&pdev->dev, "baud");
- if (IS_ERR(data->clk_baud)) {
- err = PTR_ERR(data->clk_baud);
- if (err != -EPROBE_DEFER)
- dev_err(&pdev->dev,
- "unable to get baud clock: %d\n", err);
- return err;
- }
+ if (IS_ERR(data->clk_baud))
+ return dev_err_probe(&pdev->dev, PTR_ERR(data->clk_baud),
+ "unable to get baud clock\n");
err = clk_prepare_enable(data->clk_module);
if (err) {
--
2.17.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/2] serial: core: Simplify with dev_err_probe()
2020-09-01 15:30 [PATCH 1/2] serial: 8250: Simplify with dev_err_probe() Krzysztof Kozlowski
@ 2020-09-01 15:31 ` Krzysztof Kozlowski
2020-09-02 10:02 ` Lukas Wunner
2020-09-01 16:10 ` [PATCH 1/2] serial: 8250: " Florian Fainelli
2020-09-02 10:07 ` Lukas Wunner
2 siblings, 1 reply; 5+ messages in thread
From: Krzysztof Kozlowski @ 2020-09-01 15:31 UTC (permalink / raw)
To: Greg Kroah-Hartman, Jiri Slaby, Florian Fainelli, Ray Jui,
Scott Branden, bcm-kernel-feedback-list, Nicolas Saenz Julienne,
Paul Cercueil, Lukas Wunner, linux-serial, linux-rpi-kernel,
linux-arm-kernel, linux-kernel
Cc: Krzysztof Kozlowski
Common pattern of handling deferred probe can be simplified with
dev_err_probe(). Less code and the error value gets printed.
Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
---
drivers/tty/serial/serial_core.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c
index f797c971cd82..2c52e0457faf 100644
--- a/drivers/tty/serial/serial_core.c
+++ b/drivers/tty/serial/serial_core.c
@@ -3264,9 +3264,7 @@ int uart_get_rs485_mode(struct uart_port *port)
if (IS_ERR(port->rs485_term_gpio)) {
ret = PTR_ERR(port->rs485_term_gpio);
port->rs485_term_gpio = NULL;
- if (ret != -EPROBE_DEFER)
- dev_err(dev, "Cannot get rs485-term-gpios\n");
- return ret;
+ return dev_err_probe(dev, ret, "Cannot get rs485-term-gpios\n");
}
return 0;
--
2.17.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 2/2] serial: core: Simplify with dev_err_probe()
2020-09-01 15:31 ` [PATCH 2/2] serial: core: " Krzysztof Kozlowski
@ 2020-09-02 10:02 ` Lukas Wunner
0 siblings, 0 replies; 5+ messages in thread
From: Lukas Wunner @ 2020-09-02 10:02 UTC (permalink / raw)
To: Krzysztof Kozlowski
Cc: Greg Kroah-Hartman, Jiri Slaby, Florian Fainelli, Ray Jui,
Scott Branden, bcm-kernel-feedback-list, Nicolas Saenz Julienne,
Paul Cercueil, linux-serial, linux-rpi-kernel, linux-arm-kernel,
linux-kernel
On Tue, Sep 01, 2020 at 05:31:00PM +0200, Krzysztof Kozlowski wrote:
> Common pattern of handling deferred probe can be simplified with
> dev_err_probe(). Less code and the error value gets printed.
>
> Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
Reviewed-by: Lukas Wunner <lukas@wunner.de>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/2] serial: 8250: Simplify with dev_err_probe()
2020-09-01 15:30 [PATCH 1/2] serial: 8250: Simplify with dev_err_probe() Krzysztof Kozlowski
2020-09-01 15:31 ` [PATCH 2/2] serial: core: " Krzysztof Kozlowski
@ 2020-09-01 16:10 ` Florian Fainelli
2020-09-02 10:07 ` Lukas Wunner
2 siblings, 0 replies; 5+ messages in thread
From: Florian Fainelli @ 2020-09-01 16:10 UTC (permalink / raw)
To: Krzysztof Kozlowski, Greg Kroah-Hartman, Jiri Slaby,
Florian Fainelli, Ray Jui, Scott Branden,
bcm-kernel-feedback-list, Nicolas Saenz Julienne, Paul Cercueil,
Lukas Wunner, linux-serial, linux-rpi-kernel, linux-arm-kernel,
linux-kernel
On 9/1/2020 8:30 AM, Krzysztof Kozlowski wrote:
> Common pattern of handling deferred probe can be simplified with
> dev_err_probe(). Less code and the error value gets printed.
>
> Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
> ---
> drivers/tty/serial/8250/8250_bcm2835aux.c | 12 +++---------
> drivers/tty/serial/8250/8250_ingenic.c | 20 ++++++--------------
> 2 files changed, 9 insertions(+), 23 deletions(-)
>
> diff --git a/drivers/tty/serial/8250/8250_bcm2835aux.c b/drivers/tty/serial/8250/8250_bcm2835aux.c
> index 12d03e678295..fd95860cd661 100644
> --- a/drivers/tty/serial/8250/8250_bcm2835aux.c
> +++ b/drivers/tty/serial/8250/8250_bcm2835aux.c
> @@ -110,12 +110,8 @@ static int bcm2835aux_serial_probe(struct platform_device *pdev)
>
> /* get the clock - this also enables the HW */
> data->clk = devm_clk_get(&pdev->dev, NULL);
> - ret = PTR_ERR_OR_ZERO(data->clk);
> - if (ret) {
> - if (ret != -EPROBE_DEFER)
> - dev_err(&pdev->dev, "could not get clk: %d\n", ret);
> - return ret;
> - }
> + if (IS_ERR(data->clk))
> + return dev_err_probe(&pdev->dev, PTR_ERR(data->clk), "could not get clk\n");
For 8250_bcm2835aux.c:
Acked-by: Florian Fainelli <f.fainelli@gmail.com>
--
Florian
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/2] serial: 8250: Simplify with dev_err_probe()
2020-09-01 15:30 [PATCH 1/2] serial: 8250: Simplify with dev_err_probe() Krzysztof Kozlowski
2020-09-01 15:31 ` [PATCH 2/2] serial: core: " Krzysztof Kozlowski
2020-09-01 16:10 ` [PATCH 1/2] serial: 8250: " Florian Fainelli
@ 2020-09-02 10:07 ` Lukas Wunner
2 siblings, 0 replies; 5+ messages in thread
From: Lukas Wunner @ 2020-09-02 10:07 UTC (permalink / raw)
To: Krzysztof Kozlowski
Cc: Greg Kroah-Hartman, Jiri Slaby, Florian Fainelli, Ray Jui,
Scott Branden, bcm-kernel-feedback-list, Nicolas Saenz Julienne,
Paul Cercueil, linux-serial, linux-rpi-kernel, linux-arm-kernel,
linux-kernel
On Tue, Sep 01, 2020 at 05:30:59PM +0200, Krzysztof Kozlowski wrote:
> Common pattern of handling deferred probe can be simplified with
> dev_err_probe(). Less code and the error value gets printed.
>
> Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
Reviewed-by: Lukas Wunner <lukas@wunner.de>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2020-09-02 10:07 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-01 15:30 [PATCH 1/2] serial: 8250: Simplify with dev_err_probe() Krzysztof Kozlowski
2020-09-01 15:31 ` [PATCH 2/2] serial: core: " Krzysztof Kozlowski
2020-09-02 10:02 ` Lukas Wunner
2020-09-01 16:10 ` [PATCH 1/2] serial: 8250: " Florian Fainelli
2020-09-02 10:07 ` Lukas Wunner
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).