[PATCH] tty: evh_bytechan: Replace NO_IRQ by 0

Christophe Leroy posted 1 patch 3 years, 6 months ago
drivers/tty/ehv_bytechan.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
[PATCH] tty: evh_bytechan: Replace NO_IRQ by 0
Posted by Christophe Leroy 3 years, 6 months ago
NO_IRQ is used to check the return of irq_of_parse_and_map().

On some architecture NO_IRQ is 0, on other architectures it is -1.

irq_of_parse_and_map() returns 0 on error, independent of NO_IRQ.

So use 0 instead of using NO_IRQ.

Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
---
 drivers/tty/ehv_bytechan.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/tty/ehv_bytechan.c b/drivers/tty/ehv_bytechan.c
index 19d32cb6af84..8595483f4697 100644
--- a/drivers/tty/ehv_bytechan.c
+++ b/drivers/tty/ehv_bytechan.c
@@ -118,7 +118,7 @@ static int find_console_handle(void)
 		return 0;
 
 	stdout_irq = irq_of_parse_and_map(np, 0);
-	if (stdout_irq == NO_IRQ) {
+	if (!stdout_irq) {
 		pr_err("ehv-bc: no 'interrupts' property in %pOF node\n", np);
 		return 0;
 	}
@@ -696,7 +696,7 @@ static int ehv_bc_tty_probe(struct platform_device *pdev)
 
 	bc->rx_irq = irq_of_parse_and_map(np, 0);
 	bc->tx_irq = irq_of_parse_and_map(np, 1);
-	if ((bc->rx_irq == NO_IRQ) || (bc->tx_irq == NO_IRQ)) {
+	if (!bc->rx_irq || !bc->tx_irq) {
 		dev_err(&pdev->dev, "no 'interrupts' property in %pOFn node\n",
 			np);
 		ret = -ENODEV;
-- 
2.37.1
Re: [PATCH] tty: evh_bytechan: Replace NO_IRQ by 0
Posted by Laurentiu Tudor 3 years, 6 months ago

On 10/6/2022 8:20 AM, Christophe Leroy wrote:
> NO_IRQ is used to check the return of irq_of_parse_and_map().
> 
> On some architecture NO_IRQ is 0, on other architectures it is -1.
> 
> irq_of_parse_and_map() returns 0 on error, independent of NO_IRQ.
> 
> So use 0 instead of using NO_IRQ.
> 
> Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>

Acked-by: Laurentiu Tudor <laurentiu.tudor@nxp.com>

> ---
>   drivers/tty/ehv_bytechan.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/tty/ehv_bytechan.c b/drivers/tty/ehv_bytechan.c
> index 19d32cb6af84..8595483f4697 100644
> --- a/drivers/tty/ehv_bytechan.c
> +++ b/drivers/tty/ehv_bytechan.c
> @@ -118,7 +118,7 @@ static int find_console_handle(void)
>   		return 0;
>   
>   	stdout_irq = irq_of_parse_and_map(np, 0);
> -	if (stdout_irq == NO_IRQ) {
> +	if (!stdout_irq) {
>   		pr_err("ehv-bc: no 'interrupts' property in %pOF node\n", np);
>   		return 0;
>   	}
> @@ -696,7 +696,7 @@ static int ehv_bc_tty_probe(struct platform_device *pdev)
>   
>   	bc->rx_irq = irq_of_parse_and_map(np, 0);
>   	bc->tx_irq = irq_of_parse_and_map(np, 1);
> -	if ((bc->rx_irq == NO_IRQ) || (bc->tx_irq == NO_IRQ)) {
> +	if (!bc->rx_irq || !bc->tx_irq) {
>   		dev_err(&pdev->dev, "no 'interrupts' property in %pOFn node\n",
>   			np);
>   		ret = -ENODEV;
Re: [PATCH] tty: evh_bytechan: Replace NO_IRQ by 0
Posted by Jiri Slaby 3 years, 6 months ago
On 06. 10. 22, 7:20, Christophe Leroy wrote:
> NO_IRQ is used to check the return of irq_of_parse_and_map().
> 
> On some architecture NO_IRQ is 0, on other architectures it is -1.
> 
> irq_of_parse_and_map() returns 0 on error, independent of NO_IRQ.
> 
> So use 0 instead of using NO_IRQ.
> 
> Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>

Reviewed-by: Jiri Slaby <jirislaby@kernel.org>

> ---
>   drivers/tty/ehv_bytechan.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/tty/ehv_bytechan.c b/drivers/tty/ehv_bytechan.c
> index 19d32cb6af84..8595483f4697 100644
> --- a/drivers/tty/ehv_bytechan.c
> +++ b/drivers/tty/ehv_bytechan.c
> @@ -118,7 +118,7 @@ static int find_console_handle(void)
>   		return 0;
>   
>   	stdout_irq = irq_of_parse_and_map(np, 0);
> -	if (stdout_irq == NO_IRQ) {
> +	if (!stdout_irq) {
>   		pr_err("ehv-bc: no 'interrupts' property in %pOF node\n", np);
>   		return 0;
>   	}
> @@ -696,7 +696,7 @@ static int ehv_bc_tty_probe(struct platform_device *pdev)
>   
>   	bc->rx_irq = irq_of_parse_and_map(np, 0);
>   	bc->tx_irq = irq_of_parse_and_map(np, 1);
> -	if ((bc->rx_irq == NO_IRQ) || (bc->tx_irq == NO_IRQ)) {
> +	if (!bc->rx_irq || !bc->tx_irq) {
>   		dev_err(&pdev->dev, "no 'interrupts' property in %pOFn node\n",
>   			np);
>   		ret = -ENODEV;

-- 
js
suse labs