dt-bindings: serial: sc16is7xx: Add description for polling mode
Subsystems (2)
PATCH v7 1/2 dt-bindings: serial: sc16is7xx: Add description for polling mode
Polling mode is enabled if the "interrupts" property is missing. Thus, this commit deletes "interrupts" entry from "required" section and adds a description for the fallback to polling mode at the "interrupts" entry.
---
V3:
- No changes on source.
- Add Acked-By to commit message.
V4:
- No changes
V5:
- No changes
V6:
- No changes
V7:
- No changes
--- Documentation/devicetree/bindings/serial/nxp,sc16is7xx.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/serial/nxp,sc16is7xx.yaml +2 -1
@@ -23,6 +23,8 @@ properties: maxItems: 1 interrupts: + description: + When missing, device driver uses polling instead. maxItems: 1 clocks:
@@ -76,7 +78,6 @@ properties: required: - compatible - reg - - interrupts allOf: - $ref: /schemas/spi/spi-peripheral-props.yaml#
Signature · 1 line
2.48.0
PATCH v7 2/2 serial: sc16is7xx: Add polling mode if no IRQ pin is available
Fall back to polling mode if no interrupt is configured because there is no possibility to connect the interrupt pin.
If no interrupt pin is available the driver uses a delayed worker to poll the state of interrupt status registers (IIR).
---
V2:
- Change warning for polling mode to debug log entry
- Correct typo: Resuse -> Reuse
- Format define with missing tabs for SC16IS7XX_POLL_PERIOD
- Format struct declaration sc16is7xx_one_config with missing tabs for polling and shutdown
- Adapt dtbinding with new polling feature
V3:
- Use suffix with units and drop a comment SC16IS7XX_POLL_PERIOD_MS. Sorry for that miss.
- Make Kernel lowercase.
V4:
- Reword commit messages for better understanding.
- Remove 'shutdown' property for canceling delayed worker.
- Rename worker function: sc16is7xx_transmission_poll -> sc16is7xx_poll_proc
- Unify argument for worker functions: kthread_work *work -> kthread_work *ws V5:
- Replace of_property check with IRQ number check to set polling
property. This will add support for usage without device tree
definitions. Thanks for that advice.
- Add blank line es requested.
V6:
- Use polling mode for IRQ numbers <= 0 which encounter no valid IRQ
were found/defined.
V7:
- Try to improve and unify comments as requested.
- Fix typo in commit message: pull -> poll
--- drivers/tty/serial/sc16is7xx.c | 39 ++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+)
drivers/tty/serial/sc16is7xx.c +39 -0
@@ -314,6 +314,7 @@#define SC16IS7XX_FIFO_SIZE (64)#define SC16IS7XX_GPIOS_PER_BANK 4 +#define SC16IS7XX_POLL_PERIOD_MS 10#define SC16IS7XX_RECONF_MD BIT(0)#define SC16IS7XX_RECONF_IER BIT(1)#define SC16IS7XX_RECONF_RS485 BIT(2)
@@ -348,6 +349,8 @@ struct sc16is7xx_port {u8 mctrl_mask;struct kthread_worker kworker;struct task_struct *kworker_task; +struct kthread_delayed_work poll_work; +bool polling;struct sc16is7xx_one p[]; };
@@ -861,6 +864,20 @@ static irqreturn_t sc16is7xx_irq(int irq, void *dev_id)return IRQ_HANDLED ; } +static void sc16is7xx_poll_proc (struct kthread_work *ws) +{ + struct sc16is7xx_port *s = container_of(ws, struct sc16is7xx_port, poll_work.work); + +/* +* Reuse standard IRQ handler. Interrupt ID is unused in this +* context and set to zero. +*/ +sc16is7xx_irq (0 , s); + +kthread_queue_delayed_work (&s->kworker, &s->poll_work, +msecs_to_jiffies (SC16IS7XX_POLL_PERIOD_MS )); +} +static void sc16is7xx_tx_proc (struct kthread_work *ws) {struct uart_port *port = &(to_sc16is7xx_one (ws, tx_work)->port);
@@ -1149,6 +1166,7 @@ static int sc16is7xx_config_rs485(struct uart_port *port, struct ktermios *termistatic int sc16is7xx_startup (struct uart_port *port) {struct sc16is7xx_one *one =to_sc16is7xx_one (port, port); +struct sc16is7xx_port *s =dev_get_drvdata (port->dev);unsigned int val;unsigned long flags;
@@ -1211,6 +1229,10 @@ static int sc16is7xx_startup(struct uart_port *port)sc16is7xx_enable_ms (port);uart_port_unlock_irqrestore (port, flags); +if (s->polling) +kthread_queue_delayed_work (&s->kworker, &s->poll_work, +msecs_to_jiffies (SC16IS7XX_POLL_PERIOD_MS )); +return 0 ; }
@@ -1232,6 +1254,9 @@ static void sc16is7xx_shutdown(struct uart_port *port)sc16is7xx_power (port,0 ); +if (s->polling) +kthread_cancel_delayed_work_sync (&s->poll_work); +kthread_flush_worker (&s->kworker); }
@@ -1538,6 +1563,11 @@ 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 <=0 ); +if (s->polling) +dev_dbg (dev, +"No interrupt pin definition, falling back to polling mode\n" ); + s->clk =devm_clk_get_optional (dev,NULL );if (IS_ERR (s->clk))return PTR_ERR (s->clk);
@@ -1665,6 +1695,12 @@ int sc16is7xx_probe(struct device *dev, const struct sc16is7xx_devtype *devtype, goto out_ports;#endif +if (s->polling) { +/* Initialize a kthread work struct that is dedicated to polling */ +kthread_init_delayed_work (&s->poll_work, sc16is7xx_poll_proc); +return 0 ; + } +/* * Setup interrupt. We first try to acquire the IRQ line as level IRQ. * If that succeeds, we can allow sharing the interrupt as well.
@@ -1724,6 +1760,9 @@ void sc16is7xx_remove(struct device *dev)sc16is7xx_power (&s->p[i].port,0 ); } +if (s->polling) +kthread_cancel_delayed_work_sync (&s->poll_work); +kthread_flush_worker (&s->kworker);kthread_stop (s->kworker_task);
Signature · 1 line
2.48.0
Re: [PATCH v7 2/2] serial: sc16is7xx: Add polling mode if no IRQ pin is available
Quoted 5 lines · Andre Werner
Fall back to polling mode if no interrupt is configured because there is no possibility to connect the interrupt pin.
If no interrupt pin is available the driver uses a delayed worker to poll the state of interrupt status registers (IIR).
...
Quoted 6 lines
V6:
- Use polling mode for IRQ numbers <= 0 which encounter no valid IRQ were found/defined.
V7:
- Try to improve and unify comments as requested.
- Fix typo in commit message: pull -> poll
Please, rebase your series on top of the recent Linux Next.
Signature · 2 lines
With Best Regards, Andy Shevchenko
Re: [External Email] Re: [PATCH v7 2/2] serial: sc16is7xx: Add polling mode if no IRQ pin is available
Dear Andy,
Quoted 9 lines · Andy Shevchenko
Quoted 5 lines · Andre Werner
Fall back to polling mode if no interrupt is configured because there is no possibility to connect the interrupt pin.
If no interrupt pin is available the driver uses a delayed worker to poll the state of interrupt status registers (IIR).
...
Quoted 8 lines
Quoted 6 lines
V6:
- Use polling mode for IRQ numbers <= 0 which encounter no valid IRQ were found/defined.
V7:
- Try to improve and unify comments as requested.
- Fix typo in commit message: pull -> pollPlease, rebase your series on top of the recent Linux Next.
I performed the rebase and get a single new commit to fix the merge conflicts. How do you expect the submission? Is it a new commit or should I mark it as a fixup? Shall it have new version number v8 or is it a full new commit series?
Quoted 7 lines
--
With Best Regards,
Andy Shevchenko
Thanks and best regards,
André
Re: [External Email] Re: [PATCH v7 2/2] serial: sc16is7xx: Add polling mode if no IRQ pin is available
Quoted 2 lines · Andre Werner
Quoted 1 line · Andy Shevchenko
On Tue, Jan 14, 2025 at 08:04:49AM +0100, Andre Werner wrote:
...
Quoted 7 lines
Quoted 7 lines
Quoted 6 lines
V6:
- Use polling mode for IRQ numbers <= 0 which encounter no valid IRQ were found/defined.
V7:
- Try to improve and unify comments as requested.
- Fix typo in commit message: pull -> poll
Quoted 6 lines
Quoted 1 line
Please, rebase your series on top of the recent Linux Next.
I performed the rebase and get a single new commit to fix the merge conflicts. How do you expect the submission? Is it a new commit or should I mark it as a fixup? Shall it have new version number v8 or is it a full new commit series?
When you rebase you should not get _merge_ conflicts.
What is expected is that the first (DT binding) commit will be gone from your local branch, followed by the shrunken / conflicting second one.
Signature · 2 lines
With Best Regards, Andy Shevchenko
PATCH v7 1/1 serial: sc16is7xx: Add polling mode if no IRQ pin is available
Fall back to polling mode if no interrupt is configured because there is no possibility to connect the interrupt pin.
If no interrupt pin is available the driver uses a delayed worker to poll the state of interrupt status registers (IIR).
---
V2:
- Change warning for polling mode to debug log entry
- Correct typo: Resuse -> Reuse
- Format define with missing tabs for SC16IS7XX_POLL_PERIOD
- Format struct declaration sc16is7xx_one_config with missing tabs for polling and shutdown
- Adapt dtbinding with new polling feature
V3:
- Use suffix with units and drop a comment SC16IS7XX_POLL_PERIOD_MS. Sorry for that miss.
- Make Kernel lowercase.
V4:
- Reword commit messages for better understanding.
- Remove 'shutdown' property for canceling delayed worker.
- Rename worker function: sc16is7xx_transmission_poll -> sc16is7xx_poll_proc
- Unify argument for worker functions: kthread_work *work -> kthread_work *ws V5:
- Replace of_property check with IRQ number check to set polling
property. This will add support for usage without device tree
definitions. Thanks for that advice.
- Add blank line es requested.
V6:
- Use polling mode for IRQ numbers <= 0 which encounter no valid IRQ
were found/defined.
V7:
- Try to improve and unify comments as requested.
- Fix typo in commit message: pull -> poll
--- drivers/tty/serial/sc16is7xx.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
drivers/tty/serial/sc16is7xx.c +6 -4
@@ -868,10 +868,12 @@ static void sc16is7xx_poll_proc(struct kthread_work *ws) { struct sc16is7xx_port *s = container_of(ws, struct sc16is7xx_port, poll_work.work); -/* Reuse standard IRQ handler. Interrupt ID is unused in this context. */ +/* +* Reuse standard IRQ handler. Interrupt ID is unused in this +* context and set to zero. +*/ sc16is7xx_irq (0 , s); -/* Setup delay based on SC16IS7XX_POLL_PERIOD_MS */ kthread_queue_delayed_work (&s->kworker, &s->poll_work,msecs_to_jiffies (SC16IS7XX_POLL_PERIOD_MS )); }
@@ -1561,7 +1563,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" );
@@ -1694,7 +1696,7 @@ int sc16is7xx_probe(struct device *dev, const struct sc16is7xx_devtype *devtype,#endif if (s->polling) { -/* Initialize kernel thread for polling */ +/* Initialize a kthread work struct that is dedicated to polling */ kthread_init_delayed_work (&s->poll_work, sc16is7xx_poll_proc);return 0 ; }
Signature · 1 line
2.48.0
Re: [PATCH v7] serial: sc16is7xx: Add polling mode if no IRQ pin is available
Dear Andy,
I hope this is what you expected and is what I have understood so far. I performed the rebase togit://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master branch. This is a commit that has been created due to the rebase. The commit message title is the same as from the previous commit already in linux-next and the commit message body differs, because there was a typo in the message and the description was still including the "interrupts" property from dt to use to select polling mode that is not directly used anymore in the latest version of the patch.
Sorry if I still did something wrong, but this is what I thought I had to do.
Best regards,
André
Quoted 80 lines · Andre Werner
Fall back to polling mode if no interrupt is configured because there is no possibility to connect the interrupt pin.
If no interrupt pin is available the driver uses a delayed worker to poll the state of interrupt status registers (IIR).
Signed-off-by Andre Werner <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>---
V2:
- Change warning for polling mode to debug log entry
- Correct typo: Resuse -> Reuse
- Format define with missing tabs forSC16IS7XX_POLL_PERIOD
- Format struct declarationsc16is7xx_one_configwith missing tabs for polling and shutdown
- Adapt dtbinding with new polling feature
V3:
- Use suffix with units and drop a commentSC16IS7XX_POLL_PERIOD_MS. Sorry for that miss.
- Make Kernel lowercase.
V4:
- Reword commit messages for better understanding.
- Remove 'shutdown' property for canceling delayed worker.
- Rename worker function:sc16is7xx_transmission_poll->sc16is7xx_poll_proc
- Unify argument for worker functions:kthread_work*work ->kthread_work*ws V5:
- Replaceof_propertycheck with IRQ number check to set polling
property. This will add support for usage without device tree
definitions. Thanks for that advice.
- Add blank line es requested.
V6:
- Use polling mode for IRQ numbers <= 0 which encounter no valid IRQ
were found/defined.
V7:
- Try to improve and unify comments as requested.
- Fix typo in commit message: pull -> poll--- drivers/tty/serial/sc16is7xx.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)drivers/tty/serial/sc16is7xx.c +6
-5@@ -868,10 +868,12 @@ static void sc16is7xx_poll_proc(struct kthread_work *ws) { struct sc16is7xx_port *s = container_of(ws, struct sc16is7xx_port, poll_work.work); -/* Reuse standard IRQ handler. Interrupt ID is unused in this context. */ +/* +* Reuse standard IRQ handler. Interrupt ID is unused in this +* context and set to zero. +*/ sc16is7xx_irq (0 , s); -/* Setup delay based on SC16IS7XX_POLL_PERIOD_MS */ kthread_queue_delayed_work (&s->kworker, &s->poll_work,msecs_to_jiffies (SC16IS7XX_POLL_PERIOD_MS )); }@@ -1561,7 +1563,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" );@@ -1694,7 +1696,7 @@ int sc16is7xx_probe(struct device *dev, const struct sc16is7xx_devtype *devtype,#endif if (s->polling) { -/* Initialize kernel thread for polling */ +/* Initialize a kthread work struct that is dedicated to polling */ kthread_init_delayed_work (&s->poll_work, sc16is7xx_poll_proc);return 0 ; } --2.48.0
Re: [PATCH v7] serial: sc16is7xx: Add polling mode if no IRQ pin is available
In reply to Andre WernerQuoted 5 lines · Andre Werner
Fall back to polling mode if no interrupt is configured because there is no possibility to connect the interrupt pin.
If no interrupt pin is available the driver uses a delayed worker to poll the state of interrupt status registers (IIR).
The commit message should be changed to reflect the code. I.e. "Fix the IRQ check to treat the negative values as No IRQ."
Quoted 3 lines
Signed-off-by Andre Werner <[email protected]>
This should not be here.
Quoted 1 line
Signed-off-by Greg Kroah-Hartman <[email protected]>
It's not signed by Greg.
Quoted 3 lines
V7:
- Try to improve and unify comments as requested.
- Fix typo in commit message: pull -> poll
Version should be 1 and Subject has to be changed accordingly.
...
drivers/tty/serial/sc16is7xx.c int sc16is7xx_probe(struct device *dev, const struct sc16is7xx_devtype *devtype, · line 1566
Quoted 2 lines
drivers/tty/serial/sc16is7xx.c +1
-1- s->polling = !!irq; + s->polling = (irq <=0 );
This is the only line has to be changed in the patch.
Signature · 2 lines
With Best Regards, Andy Shevchenko
Re: [PATCH v7] serial: sc16is7xx: Add polling mode if no IRQ pin is available
In reply to Andre WernerQuoted 3 lines · Andre Werner
Dear Andy,
I hope this is what you expected and is what I have understood so far.
Nope. Please, find my replies there.
Quoted 11 lines
I performed the rebase to
git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.gitmaster branch. This is a commit that has been created due to the rebase. The commit message title is the same as from the previous commit already in linux-next and the commit message body differs, because there was a typo in the message and the description was still including the "interrupts" property from dt to use to select polling mode that is not directly used anymore in the latest version of the patch.Sorry if I still did something wrong, but this is what I thought I had to do.
Signature · 2 lines
With Best Regards, Andy Shevchenko
PATCH 1/1 serial: sc16is7xx: Extend IRQ check for negative valus
Fix the IRQ check to treat the negative values as No IRQ.
--- drivers/tty/serial/sc16is7xx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/tty/serial/sc16is7xx.c +1 -1
@@ -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
Jiri Slaby
maintainerRe: [PATCH v1] serial: sc16is7xx: Extend IRQ check for negative valus
This is threaded weirdly.
Quoted 1 line · Andre Werner
Fix the IRQ check to treat the negative values as No IRQ.
Care to describe on what HW that can happen?
Quoted 18 lines
Signed-off-by Andre Werner <[email protected]>--- drivers/tty/serial/sc16is7xx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/tty/serial/sc16is7xx.c +1
-1@@ -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 · 2 lines
js suse labs
Re: [External Email] Re: [PATCH v1] serial: sc16is7xx: Extend IRQ check for negative valus
Quoted 1 line · Jiri Slaby
This is threaded weirdly.
Sorry for that.
Quoted 5 lines · Andre Werner
Quoted 1 line
Fix the IRQ check to treat the negative values as No IRQ.
Care to describe on what HW that can happen?
I have no example on that. In the previous thread it was mentioned that it is not absolutely sure that the API is not called with negative values. Thus, negative values shall also be treated as no IRQ.
Quoted 16 lines
Quoted 16 lines
Signed-off-by Andre Werner <[email protected]>--- drivers/tty/serial/sc16is7xx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/tty/serial/sc16is7xx.c +1
-0@@ -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 );
Quoted 10 lines
drivers/tty/serial/sc16is7xx.c int sc16is7xx_probe(struct device *dev, const struct sc16is7xx_devtype *devtype, · line 1567
Quoted 3 lines
drivers/tty/serial/sc16is7xx.c +0
-0if (s->polling)dev_dbg (dev,"No interrupt pin definition, falling back to polling mode\n" );--
js
suse labs
Regards,
André
Re: [PATCH v1] serial: sc16is7xx: Extend IRQ check for negative valus
In reply to Jiri SlabyQuoted 1 line · Jiri Slaby
This is threaded weirdly.
Yeah, new patch (version) — new email thread.
Quoted 4 lines · Andre Werner
Quoted 1 line
Fix the IRQ check to treat the negative values as No IRQ.
Care to describe on what HW that can happen?
But how does this relevant? The whole idea is that neither I²C nor SPI frameworks do not guarantee the IRQ field never be negative. This is the fix to the previously submitted patch.
...
Quoted 2 lines
Quoted 2 lines
drivers/tty/serial/sc16is7xx.c +1
-1- s->polling = !!irq; + s->polling = (irq <=0 );
Signature · 2 lines
With Best Regards, Andy Shevchenko
Jiri Slaby
maintainerRe: [External Email] Re: [PATCH v1] serial: sc16is7xx: Extend IRQ check for negative valus
In reply to Andre WernerQuoted 7 lines · Andre Werner
Quoted 1 line · Jiri Slaby
This is threaded weirdly.
Sorry for that.
Quoted 1 line
Quoted 8 lines
Quoted 4 lines · Andre Werner
Quoted 1 line
Fix the IRQ check to treat the negative values as No IRQ.
Care to describe on what HW that can happen?
I have no example on that. In the previous thread it was mentioned that it is not absolutely sure that the API is not called with negative values. Thus, negative values shall also be treated as no IRQ.
SPI:
if (spi->irq < 0)
spi->irq = 0;I2C:
if (irq < 0)
irq = 0;So unlikely :).
Quoted 29 lines
Quoted 15 lines
Quoted 15 lines
Signed-off-by Andre Werner <[email protected]>--- drivers/tty/serial/sc16is7xx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/tty/serial/sc16is7xx.c +1
-0@@ -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 );Quoted 10 lines
drivers/tty/serial/sc16is7xx.c int sc16is7xx_probe(struct device *dev, const struct sc16is7xx_devtype *devtype, · line 1567
Quoted 3 lines
drivers/tty/serial/sc16is7xx.c +0
-0if (s->polling)dev_dbg (dev,"No interrupt pin definition, falling back to polling mode\n" );--
js
suse labsRegards,
André
Signature · 2 lines
js suse labs
Jiri Slaby
maintainerRe: [PATCH v1] serial: sc16is7xx: Extend IRQ check for negative valus
In reply to Andy ShevchenkoQuoted 5 lines · Andy Shevchenko
Quoted 1 line · Jiri Slaby
This is threaded weirdly.
Yeah, new patch (version) — new email thread.
Quoted 8 lines
Quoted 4 lines · Andre Werner
Quoted 1 line
Fix the IRQ check to treat the negative values as No IRQ.
Care to describe on what HW that can happen?
But how does this relevant? The whole idea is that neither I²C nor SPI frameworks do not guarantee the IRQ field never be negative. This is the fix to the previously submitted patch.
They do AFAICS. Could you be more specific?
Signature · 2 lines
js suse labs
Re: [External Email] Re: [PATCH v1] serial: sc16is7xx: Extend IRQ check for negative valus
In reply to Jiri SlabyQuoted 7 lines · Jiri Slaby
Quoted 6 lines · Andre Werner
Quoted 4 lines · Jiri Slaby
Quoted 1 line · Andre Werner
Fix the IRQ check to treat the negative values as No IRQ.
Care to describe on what HW that can happen?
Quoted 7 lines
Quoted 3 lines
I have no example on that. In the previous thread it was mentioned that it is not absolutely sure that the API is not called with negative values. Thus, negative values shall also be treated as no IRQ.
SPI:
if (spi->irq < 0) spi->irq = 0;
In all cases of how SPI target device is instantiated? I haven't checked myself all those (three or four? or even five?) ways.
Quoted 5 lines
I2C:
if (irq < 0) irq = 0;So unlikely :).
Yes, but none of them _guarantees_ that (looking at the documentation and the field type in the respective data structures).
Until there no guarantees, I would consider this patch as robustness increase.
Signature · 2 lines
With Best Regards, Andy Shevchenko
Re: [PATCH v1] serial: sc16is7xx: Extend IRQ check for negative valus
In reply to Jiri SlabyQuoted 9 lines · Jiri Slaby
Quoted 8 lines · Andy Shevchenko
Quoted 1 line · Jiri Slaby
This is threaded weirdly.
Yeah, new patch (version) — new email thread.
Quoted 3 lines · Andre Werner
Quoted 1 line
Fix the IRQ check to treat the negative values as No IRQ.
Quoted 7 lines
Quoted 5 lines
Quoted 1 line
Care to describe on what HW that can happen?
But how does this relevant? The whole idea is that neither I²C nor SPI frameworks do not guarantee the IRQ field never be negative. This is the fix to the previously submitted patch.
They do AFAICS.
They don't AFAICT.
Quoted 1 line
Could you be more specific?
The documentation of the fields and their types suggests my way of perception.
Signature · 2 lines
With Best Regards, Andy Shevchenko
Re: [PATCH v1] serial: sc16is7xx: Extend IRQ check for negative valus
In reply to Jiri SlabyQuoted 9 lines · Jiri Slaby
Quoted 8 lines · Andy Shevchenko
Quoted 1 line · Jiri Slaby
This is threaded weirdly.
Yeah, new patch (version) — new email thread.
Quoted 3 lines · Andre Werner
Quoted 1 line
Fix the IRQ check to treat the negative values as No IRQ.
Quoted 7 lines
Quoted 5 lines
Quoted 1 line
Care to describe on what HW that can happen?
But how does this relevant? The whole idea is that neither I²C nor SPI frameworks do not guarantee the IRQ field never be negative. This is the fix to the previously submitted patch.
They do AFAICS. Could you be more specific?
Hmm... I have looked into the SPI core and this behaviour seems quite new. Documentation still says the same as before where it's not guaranteed.
Signature · 2 lines
With Best Regards, Andy Shevchenko
Greg KH
maintainerRe: [PATCH v7] serial: sc16is7xx: Add polling mode if no IRQ pin is available
In reply to Andre WernerQuoted 9 lines · Andre Werner
Fall back to polling mode if no interrupt is configured because there is no possibility to connect the interrupt pin.
If no interrupt pin is available the driver uses a delayed worker to poll the state of interrupt status registers (IIR).
Signed-off-by Andre Werner <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>
This whole commit is already in my tree, why is it submitted again?
confused,
greg k-h
Re: [External Email] Re: [PATCH v7] serial: sc16is7xx: Add polling mode if no IRQ pin is available
Dear Greg,
Quoted 12 lines · Andre Werner
Quoted 9 lines
Fall back to polling mode if no interrupt is configured because there is no possibility to connect the interrupt pin.
If no interrupt pin is available the driver uses a delayed worker to poll the state of interrupt status registers (IIR).
Signed-off-by Andre Werner <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>This whole commit is already in my tree, why is it submitted again?
This is my fault. I misunderstood a comment from a reviewer. There is a patch that i still discussed in this thread:
https://lkml.org/lkml/2025/1/16/398
Also the thread has a weird structure. Sorry!
Quoted 5 lines
confused,
greg k-h
Regards,
André
Greg KH
maintainerRe: [External Email] Re: [PATCH v7] serial: sc16is7xx: Add polling mode if no IRQ pin is available
Quoted 13 lines · Andre Werner
Dear Greg,
Quoted 11 lines · Andre Werner
Quoted 9 lines
Fall back to polling mode if no interrupt is configured because there is no possibility to connect the interrupt pin.
If no interrupt pin is available the driver uses a delayed worker to poll the state of interrupt status registers (IIR).
Signed-off-by Andre Werner <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>
Quoted 8 lines
Quoted 1 line
This whole commit is already in my tree, why is it submitted again?
This is my fault. I misunderstood a comment from a reviewer. There is a patch that i still discussed in this thread:
https://lkml.org/lkml/2025/1/16/398
Also the thread has a weird structure. Sorry!
Yes, please send a new version so that it can be considered to be applied properly, I can't dig it out of that thread easily, could you if you had to do it? :)
thanks,
greg k-h