Skip to contentSkip to conversation

serial: sc16is7xx: Extend IRQ check for negative values

PATCH In review Andre Werner 4 participants 8 messages Jan 17, 2025 – Jan 19, 2025 TTY layer and serial drivers

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 serial: sc16is7xx: Extend IRQ check for negative values

Fix the IRQ check to treat the negative values as No IRQ.

---
V2:
There are no changes to the patch itself. The previous patch submission had a very weird structure within the discussion thread:
https://lkml.org/lkml/2025/1/16/398
This is simply a new thread opened for better handling.

---
 drivers/tty/serial/sc16is7xx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/tty/serial/sc16is7xx.c +1 -1
index 7b51cdc274fd..560f45ed19ae 100644
@@ -1561,7 +1561,7 @@ int sc16is7xx_probe(struct device *dev, const struct sc16is7xx_devtype *devtype,
 	/* Always ask for fixed clock rate from a property. */
 	device_property_read_u32(dev, "clock-frequency", &uartclk);
 
-	s->polling = !!irq;
+	s->polling = (irq <= 0);
 	if (s->polling)
 		dev_dbg(dev,
 			"No interrupt pin definition, falling back to polling mode\n");
Signature · 1 line
2.48.0
maintainer
#1 lore raw
Quoted 30 lines · Andre Werner

Fix the IRQ check to treat the negative values as No IRQ.

---
V2:
There are no changes to the patch itself. The previous patch submission had a very weird structure within the discussion thread:
https://lkml.org/lkml/2025/1/16/398
This is simply a new thread opened for better handling.

---
 drivers/tty/serial/sc16is7xx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/tty/serial/sc16is7xx.c +1 -1
index 7b51cdc274fd..560f45ed19ae 100644
@@ -1561,7 +1561,7 @@ int sc16is7xx_probe(struct device *dev, const struct sc16is7xx_devtype *devtype,
 	/* Always ask for fixed clock rate from a property. */
 	device_property_read_u32(dev, "clock-frequency", &uartclk);
 
-	s->polling = !!irq;
+	s->polling = (irq <= 0);
 	if (s->polling)
 		dev_dbg(dev,
 			"No interrupt pin definition, falling back to polling mode\n");
Signature · 1 line
2.48.0

What commit id does this "fix"?

thanks,

greg k-h

maintainer
#2 lore raw
Quoted 22 lines · Greg KH
Quoted 21 lines · Andre Werner

Fix the IRQ check to treat the negative values as No IRQ.

---
V2:
There are no changes to the patch itself. The previous patch submission had a very weird structure within the discussion thread:
https://lkml.org/lkml/2025/1/16/398
This is simply a new thread opened for better handling.

---
  drivers/tty/serial/sc16is7xx.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/tty/serial/sc16is7xx.c +0 -0
index 7b51cdc274fd..560f45ed19ae 100644
@@ -1561,7 +1561,7 @@ int sc16is7xx_probe(struct device *dev, const struct sc16is7xx_devtype *devtype,
  	/* Always ask for fixed clock rate from a property. */
  	device_property_read_u32(dev, "clock-frequency", &uartclk);
 
Quoted 11 lines
Quoted 9 lines
drivers/tty/serial/sc16is7xx.c +1 -1
-	s->polling = !!irq;
+	s->polling = (irq <= 0);
  	if (s->polling)
  		dev_dbg(dev,
  			"No interrupt pin definition, falling back to polling mode\n");
Signature · 1 line
2.48.0

What commit id does this "fix"?

And yet, it's worth noting (in the commit log) that it actually does not fix any real problem. It's only a sanity check, right?

Signature · 2 lines
js
suse labs
#3 lore raw
In reply to Greg KH

Dear Greg,

Quoted 22 lines · Andre Werner
Quoted 21 lines

Fix the IRQ check to treat the negative values as No IRQ.

---
V2:
There are no changes to the patch itself. The previous patch submission had a very weird structure within the discussion thread:
https://lkml.org/lkml/2025/1/16/398
This is simply a new thread opened for better handling.

---
 drivers/tty/serial/sc16is7xx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/tty/serial/sc16is7xx.c +0 -0
index 7b51cdc274fd..560f45ed19ae 100644
@@ -1561,7 +1561,7 @@ int sc16is7xx_probe(struct device *dev, const struct sc16is7xx_devtype *devtype,
 	/* Always ask for fixed clock rate from a property. */
 	device_property_read_u32(dev, "clock-frequency", &uartclk);
 
Quoted 11 lines
Quoted 9 lines
drivers/tty/serial/sc16is7xx.c +1 -2
-	s->polling = !!irq;
+	s->polling = (irq <= 0);
 	if (s->polling)
 		dev_dbg(dev,
 			"No interrupt pin definition, falling back to polling mode\n");
--

2.48.0

What commit id does this "fix"?

104c1b9dde9d859dd01bd2d71a2755a2fae43e15

https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty.git/commit/?h=tty-next&id=104c1b9dde9d859dd01bd2d71a2755a2fae43e15

Quoted 5 lines

thanks,

greg k-h

Regards,
André

maintainer
#4 lore raw
Quoted 36 lines · Andre Werner

Dear Greg,

Quoted 22 lines · Andre Werner
Quoted 21 lines

Fix the IRQ check to treat the negative values as No IRQ.

---
V2:
There are no changes to the patch itself. The previous patch submission had a very weird structure within the discussion thread:
https://lkml.org/lkml/2025/1/16/398
This is simply a new thread opened for better handling.

---
 drivers/tty/serial/sc16is7xx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/tty/serial/sc16is7xx.c +0 -0
index 7b51cdc274fd..560f45ed19ae 100644
@@ -1561,7 +1561,7 @@ int sc16is7xx_probe(struct device *dev, const struct sc16is7xx_devtype *devtype,
 	/* Always ask for fixed clock rate from a property. */
 	device_property_read_u32(dev, "clock-frequency", &uartclk);
 
Quoted 11 lines
Quoted 9 lines
drivers/tty/serial/sc16is7xx.c +1 -2
-	s->polling = !!irq;
+	s->polling = (irq <= 0);
 	if (s->polling)
 		dev_dbg(dev,
 			"No interrupt pin definition, falling back to polling mode\n");
--

2.48.0

What commit id does this "fix"?

Quoted 4 lines

104c1b9dde9d859dd01bd2d71a2755a2fae43e15

https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty.git/commit/?h=tty-next&id=104c1b9dde9d859dd01bd2d71a2755a2fae43e15

Great, then properly document that with a Fixes: tag when you resend this please.

thanks,

greg k-h

#5 lore raw
In reply to Andre Werner
Quoted 2 lines

-----Original Message-----
Fix the IRQ check to treat the negative values as No IRQ.

It seems to me that this is a real fix and needs a Fixes tag. See below.

drivers/tty/serial/sc16is7xx.c int sc16is7xx_probe(struct device *dev, const struct · line 1565

Quoted 13 lines

---

drivers/tty/serial/sc16is7xx.c +1 -1
index 7b51cdc274fd..560f45ed19ae 100644
@@ -1561,7 +1561,7 @@ int sc16is7xx_probe(struct device *dev, const struct
 sc16is7xx_devtype *devtype,
 	/* Always ask for fixed clock rate from a property. */
 	device_property_read_u32(dev, "clock-frequency", &uartclk);
 
-	s->polling = !!irq;
+	s->polling = (irq <= 0);

When irq>=0 these two lines above have a different outcome!

irq==0   =>   !!irq==false   <=>   (irq<=0)==true
irq==1   =>   !!irq==true   <=>   (irq<=0)==false
Quoted 3 lines
drivers/tty/serial/sc16is7xx.c +0 -0
 	if (s->polling)
 		dev_dbg(dev,

"No interrupt pin definition, falling back to polling mode\n");

Kind regards,
Maarten

#6 lore raw

Dear Maarten,

Quoted 17 lines
Quoted 2 lines

-----Original Message-----
Fix the IRQ check to treat the negative values as No IRQ.

It seems to me that this is a real fix and needs a Fixes tag. See below.

Quoted 11 lines

---

drivers/tty/serial/sc16is7xx.c +0 -0
index 7b51cdc274fd..560f45ed19ae 100644
@@ -1561,7 +1561,7 @@ int sc16is7xx_probe(struct device *dev, const struct
 sc16is7xx_devtype *devtype,
 	/* Always ask for fixed clock rate from a property. */
 	device_property_read_u32(dev, "clock-frequency", &uartclk);
 
Quoted 6 lines

drivers/tty/serial/sc16is7xx.c int sc16is7xx_probe(struct device *dev, const struct sc16is7xx_devtype *devtype, · line 1564

Quoted 2 lines
drivers/tty/serial/sc16is7xx.c +1 -1
-	s->polling = !!irq;
+	s->polling = (irq <= 0);

When irq>=0 these two lines above have a different outcome!

irq==0   =>   !!irq==false   <=>   (irq<=0)==true
irq==1   =>   !!irq==true   <=>   (irq<=0)==false

Thanks for the advice. I have not seen this all the time I looked at the code. I accidentally forget to delete the second '!' as I did with the code tested at the embedded device. Thanks for the advice.

Should I need to submit this patch again with a Fixup prefix or what needs to be done?

Quoted 8 lines
Quoted 4 lines
drivers/tty/serial/sc16is7xx.c +0 -0
 	if (s->polling)
 		dev_dbg(dev,

"No interrupt pin definition, falling back to polling mode\n");

Kind regards,
Maarten

Regards,
André

maintainer
#7 lore raw
Quoted 26 lines · Andre Werner

Dear Maarten,

Quoted 17 lines
Quoted 2 lines

-----Original Message-----
Fix the IRQ check to treat the negative values as No IRQ.

It seems to me that this is a real fix and needs a Fixes tag. See below.

Quoted 11 lines

---

drivers/tty/serial/sc16is7xx.c +0 -0
index 7b51cdc274fd..560f45ed19ae 100644
@@ -1561,7 +1561,7 @@ int sc16is7xx_probe(struct device *dev, const struct
 sc16is7xx_devtype *devtype,
  	/* Always ask for fixed clock rate from a property. */
  	device_property_read_u32(dev, "clock-frequency", &uartclk);
 
Quoted 6 lines

drivers/tty/serial/sc16is7xx.c int sc16is7xx_probe(struct device *dev, const struct sc16is7xx_devtype *devtype, · line 1564

Quoted 2 lines
drivers/tty/serial/sc16is7xx.c +1 -1
-	s->polling = !!irq;
+	s->polling = (irq <= 0);

When irq>=0 these two lines above have a different outcome!

irq==0   =>   !!irq==false   <=>   (irq<=0)==true
irq==1   =>   !!irq==true   <=>   (irq<=0)==false
Quoted 6 lines

Thanks for the advice. I have not seen this all the time I looked at the code. I accidentally forget to delete the second '!' as I did with the code tested at the embedded device. Thanks for the advice.

Should I need to submit this patch again with a Fixup prefix or what needs to be done?

Resubmit with complete description on what is broken and when. Incl. the Fixes: tag. The comment from Maarten suggests that it is broken in a completely different way than you describe in the commit log.

thanks,

Signature · 2 lines
js
suse labs