staging: axis-fifo: fix alignment and line length in wait_event_interruptible
PATCH v2 1/10 staging: axis-fifo: fix alignment and line length in wait_event_interruptible
From: Josh Law <[email protected]>
--- drivers/staging/axis-fifo/axis-fifo.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/staging/axis-fifo/axis-fifo.c +2 -1
@@ -246,7 +246,8 @@ static ssize_t axis_fifo_write(struct file *f, const char __user *buf,mutex_lock (&fifo->write_lock); ret =wait_event_interruptible (fifo->write_queue, -ioread32 (fifo->base_addr +XLLF_TDFV_OFFSET ) >= words_to_write); +ioread32 (fifo->base_addr +XLLF_TDFV_OFFSET ) >= + words_to_write);if (ret) goto end_unlock; }
Signature · 1 line
2.43.0
PATCH v2 2/10 staging: axis-fifo: remove redundant goto end
From: Josh Law <[email protected]>
--- drivers/staging/axis-fifo/axis-fifo.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-)
drivers/staging/axis-fifo/axis-fifo.c +8 -9
@@ -395,22 +395,22 @@ static int axis_fifo_parse_dt(struct axis_fifo *fifo) &value);if (ret) {dev_err (fifo->dt_device,"missing xlnx,axi-str-rxd-tdata-width property\n" ); - goto end; +return ret; }else if (value !=32 ) {dev_err (fifo->dt_device,"xlnx,axi-str-rxd-tdata-width only supports 32 bits\n" ); ret = -EIO ; - goto end; +return ret; } ret =of_property_read_u32 (node,"xlnx,axi-str-txd-tdata-width" , &value);if (ret) {dev_err (fifo->dt_device,"missing xlnx,axi-str-txd-tdata-width property\n" ); - goto end; +return ret; }else if (value !=32 ) {dev_err (fifo->dt_device,"xlnx,axi-str-txd-tdata-width only supports 32 bits\n" ); ret = -EIO ; - goto end; +return ret; } ret = of_property_read_u32(node, "xlnx,rx-fifo-depth",
@@ -418,7 +418,7 @@ static int axis_fifo_parse_dt(struct axis_fifo *fifo)if (ret) {dev_err (fifo->dt_device,"missing xlnx,rx-fifo-depth property\n" ); ret = -EIO ; - goto end; +return ret; } ret = of_property_read_u32(node, "xlnx,tx-fifo-depth",
@@ -426,7 +426,7 @@ static int axis_fifo_parse_dt(struct axis_fifo *fifo)if (ret) {dev_err (fifo->dt_device,"missing xlnx,tx-fifo-depth property\n" ); ret = -EIO ; - goto end; +return ret; } ret = of_property_read_u32(node, "xlnx,use-rx-data",
@@ -434,7 +434,7 @@ static int axis_fifo_parse_dt(struct axis_fifo *fifo)if (ret) {dev_err (fifo->dt_device,"missing xlnx,use-rx-data property\n" ); ret = -EIO ; - goto end; +return ret; } ret = of_property_read_u32(node, "xlnx,use-tx-data",
@@ -442,10 +442,9 @@ static int axis_fifo_parse_dt(struct axis_fifo *fifo)if (ret) {dev_err (fifo->dt_device,"missing xlnx,use-tx-data property\n" ); ret = -EIO ; - goto end; +return ret; } -end:return ret; }
Signature · 1 line
2.43.0
PATCH v2 3/10 staging: axis-fifo: simplify resource mapping
In reply to Josh LawFrom: Josh Law <[email protected]>
Use devm_platform_ioremap_resource() to simplify the code and remove the unused struct resource pointer.
--- drivers/staging/axis-fifo/axis-fifo.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/staging/axis-fifo/axis-fifo.c +1 -2
@@ -450,7 +450,6 @@ static int axis_fifo_parse_dt(struct axis_fifo *fifo)static int axis_fifo_probe (struct platform_device *pdev) { -struct resource *r_mem;struct device *dev = &pdev->dev;struct axis_fifo *fifo =NULL ;int rc =0 ;/* error return value */
@@ -469,7 +468,7 @@ static int axis_fifo_probe(struct platform_device *pdev)mutex_init (&fifo->read_lock);mutex_init (&fifo->write_lock); - fifo->base_addr =devm_platform_get_and_ioremap_resource (pdev,0 , &r_mem); + fifo->base_addr =devm_platform_ioremap_resource (pdev,0 );if (IS_ERR (fifo->base_addr))return PTR_ERR (fifo->base_addr);
Signature · 1 line
2.43.0
PATCH v2 4/10 staging: axis-fifo: use dev_err_probe() for IRQ error handling
In reply to Josh LawFrom: Josh Law <[email protected]>
Simplify the error handling in the probe function by using dev_err_probe() instead of dev_err() when devm_request_irq() fails.
--- drivers/staging/axis-fifo/axis-fifo.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/staging/axis-fifo/axis-fifo.c +3 -5
@@ -484,11 +484,9 @@ static int axis_fifo_probe(struct platform_device *pdev) rc =devm_request_irq (fifo->dt_device, irq, &axis_fifo_irq,0 ,DRIVER_NAME , fifo); -if (rc) { -dev_err (fifo->dt_device,"couldn't allocate interrupt %i\n" , - irq); -return rc; - } +if (rc) +return dev_err_probe (fifo->dt_device, rc, +"couldn't allocate interrupt %i\n" , irq); fifo->id =ida_alloc (&axis_fifo_ida,GFP_KERNEL );if (fifo->id <0 )
Signature · 1 line
2.43.0
PATCH v2 5/10 staging: axis-fifo: improve IRQ handler
In reply to Josh LawFrom: Josh Law <[email protected]>
Return IRQ_NONE when no interrupts were triggered to avoid spurious interrupt storms, and only clear the active interrupts instead of blindly clearing all interrupts by writing 'intr' to the ISR instead of XLLF_INT_CLEAR_ALL.
--- drivers/staging/axis-fifo/axis-fifo.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/staging/axis-fifo/axis-fifo.c +4 -1
@@ -302,6 +302,9 @@ static irqreturn_t axis_fifo_irq(int irq, void *dw) isr =ioread32 (fifo->base_addr +XLLF_ISR_OFFSET ); intr = ier & isr; +if (!intr) +return IRQ_NONE ; +if (intr &XLLF_INT_RC_MASK )wake_up (&fifo->read_queue);
@@ -324,7 +327,7 @@ static irqreturn_t axis_fifo_irq(int irq, void *dw)dev_err (fifo->dt_device,"transmit length mismatch error interrupt\n" ); -iowrite32 (XLLF_INT_CLEAR_ALL , fifo->base_addr +XLLF_ISR_OFFSET ); +iowrite32 (intr, fifo->base_addr +XLLF_ISR_OFFSET );return IRQ_HANDLED ; }
Signature · 1 line
2.43.0
Re: [PATCH v2 05/10] staging: axis-fifo: improve IRQ handler
Quoted 7 lines · Josh Law
From: Josh Law <[email protected]>
Return
IRQ_NONEwhen no interrupts were triggered to avoid spurious interrupt storms, and only clear the active interrupts instead of blindly clearing all interrupts by writing 'intr' to the ISR instead ofXLLF_INT_CLEAR_ALL.
Is this something you actually experienced in real life? The commit message needs to be clearer about that.
regards,
dan carpenter
Re: [PATCH v2 05/10] staging: axis-fifo: improve IRQ handler
2 Mar 2026 08:14:53 Dan Carpenter <[email protected]>:
Quoted 9 lines · Josh Law
Quoted 7 lines
From: Josh Law <[email protected]>
Return
IRQ_NONEwhen no interrupts were triggered to avoid spurious interrupt storms, and only clear the active interrupts instead of blindly clearing all interrupts by writing 'intr' to the ISR instead ofXLLF_INT_CLEAR_ALL.
Quoted 5 lines
Is this something you actually experienced in real life? The commit message needs to be clearer about that.
regards,
dan carpenter
Hello Dan, It's just code optimizations, making it cleaner, etc, I also ran all of these latest V2 commits through check patch, to make sure they are compliant, I own this device so I hope I can be the maintainer of it one day, I'm learning this Linux system day by day, so I am sorry I have to annoy a professional linaro dev like you haha
V/R
V/R
Josh law
Re: [PATCH v2 05/10] staging: axis-fifo: improve IRQ handler
Quoted 14 lines · Josh Law
2 Mar 2026 08:14:53 Dan Carpenter <[email protected]>:
Quoted 12 lines · Josh Law
Quoted 7 lines
From: Josh Law <[email protected]>
Return
IRQ_NONEwhen no interrupts were triggered to avoid spurious interrupt storms, and only clear the active interrupts instead of blindly clearing all interrupts by writing 'intr' to the ISR instead ofXLLF_INT_CLEAR_ALL.Is this something you actually experienced in real life? The commit message needs to be clearer about that.
Quoted 9 lines
Quoted 2 lines
regards,
dan carpenterHello Dan, It's just code optimizations, making it cleaner, etc, I also ran all of these latest V2 commits through check patch, to make sure they are compliant, I own this device so I hope I can be the maintainer of it one day, I'm learning this Linux system day by day, so I am sorry I have to annoy a professional linaro dev like you haha
I don't mind reviewing patches. The cleanups are easy to review. In this case it's a behavior change and so I would want a clearer picture the motivation and of how well these have been tested for that.
regards,
dan carpenter
Re: [PATCH v2 05/10] staging: axis-fifo: improve IRQ handler
3 Mar 2026 06:10:13 Dan Carpenter <[email protected]>:
Quoted 25 lines · Josh Law
Quoted 14 lines
2 Mar 2026 08:14:53 Dan Carpenter <[email protected]>:
Quoted 12 lines · Josh Law
Quoted 7 lines
From: Josh Law <[email protected]>
Return
IRQ_NONEwhen no interrupts were triggered to avoid spurious interrupt storms, and only clear the active interrupts instead of blindly clearing all interrupts by writing 'intr' to the ISR instead ofXLLF_INT_CLEAR_ALL.Is this something you actually experienced in real life? The commit message needs to be clearer about that.
Quoted 9 lines
Quoted 2 lines
regards,
dan carpenterHello Dan, It's just code optimizations, making it cleaner, etc, I also ran all of these latest V2 commits through check patch, to make sure they are compliant, I own this device so I hope I can be the maintainer of it one day, I'm learning this Linux system day by day, so I am sorry I have to annoy a professional linaro dev like you haha
Quoted 6 lines
I don't mind reviewing patches. The cleanups are easy to review. In this case it's a behavior change and so I would want a clearer picture the motivation and of how well these have been tested for that.
regards,
dan carpenter
Lol, are you gonna approve ANY of my patches haha
V/R
Re: [PATCH v2 05/10] staging: axis-fifo: improve IRQ handler
Quoted 3 lines · Josh Law
Lol, are you gonna approve ANY of my patches haha
The life of a kernel developer is full of heart-ache. I recently had to redo a v5 patchset because there was a O vs 0 typo in the documentation.
I believe you resent all your patchse in this set, right? But the first patch is obviously auto-NAKed for not having a commit message so that kills the whole thing.
regards,
dan carpenter
Re: [PATCH v2 05/10] staging: axis-fifo: improve IRQ handler
3 Mar 2026 07:27:39 Dan Carpenter <[email protected]>:
Quoted 9 lines · Josh Law
Quoted 3 lines
Lol, are you gonna approve ANY of my patches haha
The life of a kernel developer is full of heart-ache. I recently had to redo a v5 patchset because there was a O vs 0 typo in the documentation.
Quoted 6 lines
I believe you resent all your patchse in this set, right? But the first patch is obviously auto-NAKed for not having a commit message so that kills the whole thing.
regards,
dan carpenter
If you tell me the patch number I can do a commit message
V/R
Re: [PATCH v2 05/10] staging: axis-fifo: improve IRQ handler
Quoted 11 lines · Josh Law
3 Mar 2026 07:27:39 Dan Carpenter <[email protected]>:
Quoted 9 lines · Josh Law
Quoted 3 lines
Lol, are you gonna approve ANY of my patches haha
The life of a kernel developer is full of heart-ache. I recently had to redo a v5 patchset because there was a O vs 0 typo in the documentation.
Quoted 8 lines
Quoted 6 lines
I believe you resent all your patchse in this set, right? But the first patch is obviously auto-NAKed for not having a commit message so that kills the whole thing.
regards,
dan carpenterIf you tell me the patch number I can do a commit message
Heh.
I mean you sent this patchset as a lot of individual patches and I replied to those as well so the discussion is all spread out. I can't find all the things I said.
regards,
dan carpenter
Re: [PATCH v2 05/10] staging: axis-fifo: improve IRQ handler
In reply to Josh LawQuoted 7 lines · Josh Law
From: Josh Law <[email protected]>
Return
IRQ_NONEwhen no interrupts were triggered to avoid spurious interrupt storms, and only clear the active interrupts instead of blindly clearing all interrupts by writing 'intr' to the ISR instead ofXLLF_INT_CLEAR_ALL.
XLLF_ISR_OFFSET is the IRQs which are triggered and XLLF_IER_OFFSET are the IRQs that we care about. The intr variable is the IRQs which are both, they are triggered and we care about them. In the original code it clears out all the IRQs that have triggered regardless of whether or not we care about them. You're saying clearing all the IRQs "blindly" is wrong, but to me it feels like the correct behavior. In real life it probably doesn't matter at all since we probably care about all the IRQs. And apparently in your testing it makes no difference either way...
I feel like leaving the flags set feels like it would be more likely to trigger and IRQ storm. But we're debating the number of angels dancing on a pin.
Let's just leave it as-is unless we can show it helps.
regards,
dan carpenter
PATCH v2 6/10 staging: axis-fifo: minimize lock duration in write
In reply to Josh LawFrom: Josh Law <[email protected]>
Memory allocation and copy from user space with vmemdup_user() is relatively slow and can sleep. Move it outside the lock to minimize the time the mutex is held, reducing contention for concurrent accesses.
--- drivers/staging/axis-fifo/axis-fifo.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-)
drivers/staging/axis-fifo/axis-fifo.c +11 -9
@@ -233,9 +233,15 @@ static ssize_t axis_fifo_write(struct file *f, const char __user *buf, (words_to_write > (fifo->tx_fifo_depth - 4)))return -EINVAL ; + txbuf =vmemdup_user (buf, len); +if (IS_ERR (txbuf)) +return PTR_ERR (txbuf); +if (f->f_flags &O_NONBLOCK ) { -if (!mutex_trylock (&fifo->write_lock)) -return -EAGAIN ; +if (!mutex_trylock (&fifo->write_lock)) { + ret = -EAGAIN ; + goto err_free; + }if (words_to_write >ioread32 (fifo->base_addr +XLLF_TDFV_OFFSET )) {
@@ -252,21 +258,17 @@ static ssize_t axis_fifo_write(struct file *f, const char __user *buf, goto end_unlock; } - txbuf =vmemdup_user (buf, len); -if (IS_ERR (txbuf)) { - ret =PTR_ERR (txbuf); - goto end_unlock; - } -for (int i =0 ; i < words_to_write; ++i)iowrite32 (txbuf[i], fifo->base_addr +XLLF_TDFD_OFFSET );iowrite32 (len, fifo->base_addr +XLLF_TLR_OFFSET ); ret = len; -kvfree (txbuf); + end_unlock:mutex_unlock (&fifo->write_lock); +err_free: +kvfree (txbuf);return ret; }
Signature · 1 line
2.43.0
PATCH v2 7/10 staging: axis-fifo: fix grammar in Kconfig help text
In reply to Josh LawFrom: Josh Law <[email protected]>
Use 'an' instead of 'a' before 'AXI' since it begins with a vowel sound.
--- drivers/staging/axis-fifo/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/axis-fifo/Kconfig +1 -1
@@ -7,6 +7,6 @@ config XIL_AXIS_FIFO depends on OF && HAS_IOMEM help This adds support for the Xilinx AXI-Stream FIFO IP core driver. - The AXI Streaming FIFO allows memory mapped access to a AXI Streaming + The AXI Streaming FIFO allows memory mapped access to an AXI Streaming interface. The Xilinx AXI-Stream FIFO IP core can be used to interface to the AXI Ethernet without the need to use DMA.
Signature · 1 line
2.43.0
PATCH v2 8/10 staging: axis-fifo: use lowercase hex constant for consistency
In reply to Josh LawFrom: Josh Law <[email protected]>
All other register offset defines use lowercase hex digits. Change 0x2C to 0x2c for XLLF_TDR_OFFSET to match the rest of the file.
--- drivers/staging/axis-fifo/axis-fifo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/axis-fifo/axis-fifo.c +1 -1
@@ -46,7 +46,7 @@#define XLLF_RDFD_OFFSET 0x20/* Receive Data */ #define XLLF_RLR_OFFSET 0x24/* Receive Length */ #define XLLF_SRR_OFFSET 0x28/* Local Link Reset */ -#define XLLF_TDR_OFFSET 0x2C/* Transmit Destination */ +#define XLLF_TDR_OFFSET 0x2c/* Transmit Destination */ #define XLLF_RDR_OFFSET 0x30/* Receive Destination */ #define XLLF_RDFR_RESET_MASK 0xa5/* Receive reset value */
Signature · 1 line
2.43.0
PATCH v2 9/10 staging: axis-fifo: remove unnecessary variable initializations
In reply to Josh LawFrom: Josh Law <[email protected]>
Remove the unnecessary initialization of 'fifo' to NULL and 'rc' to 0 in axis_fifo_probe(), as both variables are assigned before their first use.
--- drivers/staging/axis-fifo/axis-fifo.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/axis-fifo/axis-fifo.c +2 -2
@@ -456,8 +456,8 @@ static int axis_fifo_parse_dt(struct axis_fifo *fifo)static int axis_fifo_probe (struct platform_device *pdev) {struct device *dev = &pdev->dev; -struct axis_fifo *fifo =NULL ; -int rc =0 ;/* error return value */ +struct axis_fifo *fifo; +int rc;int irq; fifo =devm_kzalloc (dev,sizeof (*fifo),GFP_KERNEL );
Signature · 1 line
2.43.0
PATCH v2 10/10 staging: axis-fifo: simplify error returns in axis_fifo_parse_dt()
In reply to Josh LawFrom: Josh Law <[email protected]>
Replace redundant 'ret = -EIO; return ret;' patterns with direct 'return -EIO;' statements, and change the final 'return ret;' to 'return 0;' since success is the only path that reaches it.
--- drivers/staging/axis-fifo/axis-fifo.c | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-)
drivers/staging/axis-fifo/axis-fifo.c +7 -13
@@ -403,8 +403,7 @@ static int axis_fifo_parse_dt(struct axis_fifo *fifo)return ret; }else if (value !=32 ) {dev_err (fifo->dt_device,"xlnx,axi-str-rxd-tdata-width only supports 32 bits\n" ); - ret = -EIO ; -return ret; +return -EIO ; } ret = of_property_read_u32(node, "xlnx,axi-str-txd-tdata-width",
@@ -414,43 +413,38 @@ static int axis_fifo_parse_dt(struct axis_fifo *fifo)return ret; }else if (value !=32 ) {dev_err (fifo->dt_device,"xlnx,axi-str-txd-tdata-width only supports 32 bits\n" ); - ret = -EIO ; -return ret; +return -EIO ; } ret =of_property_read_u32 (node,"xlnx,rx-fifo-depth" , &fifo->rx_fifo_depth);if (ret) {dev_err (fifo->dt_device,"missing xlnx,rx-fifo-depth property\n" ); - ret = -EIO ; -return ret; +return -EIO ; } ret =of_property_read_u32 (node,"xlnx,tx-fifo-depth" , &fifo->tx_fifo_depth);if (ret) {dev_err (fifo->dt_device,"missing xlnx,tx-fifo-depth property\n" ); - ret = -EIO ; -return ret; +return -EIO ; } ret =of_property_read_u32 (node,"xlnx,use-rx-data" , &fifo->has_rx_fifo);if (ret) {dev_err (fifo->dt_device,"missing xlnx,use-rx-data property\n" ); - ret = -EIO ; -return ret; +return -EIO ; } ret =of_property_read_u32 (node,"xlnx,use-tx-data" , &fifo->has_tx_fifo);if (ret) {dev_err (fifo->dt_device,"missing xlnx,use-tx-data property\n" ); - ret = -EIO ; -return ret; +return -EIO ; } -return ret; +return 0 ; }static int axis_fifo_probe (struct platform_device *pdev)
Signature · 1 line
2.43.0
Quoted 4 lines · Josh Law
From: Josh Law <[email protected]>
Signed-off-by Josh Law <[email protected]>---
There isn't a commit message here so we can't merge it. But also I would like to see a 0/10 header email which talks about how you have tested these.
Most of these are straight forward to review but a couple are more complicated.
regards,
dan carpenter
Quoted 12 lines · Josh Law
From: Josh Law <[email protected]>
Signed-off-by Josh Law <[email protected]>--- drivers/staging/axis-fifo/axis-fifo.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/staging/axis-fifo/axis-fifo.c +0
-0
drivers/staging/axis-fifo/axis-fifo.c static ssize_t axis_fifo_write(struct file *f, const char __user *buf, · line 253
Quoted 9 lines
drivers/staging/axis-fifo/axis-fifo.c +2
-1@@ -246,7 +246,8 @@ static ssize_t axis_fifo_write(struct file *f, const char __user *buf,mutex_lock (&fifo->write_lock); ret =wait_event_interruptible (fifo->write_queue, -ioread32 (fifo->base_addr +XLLF_TDFV_OFFSET ) >= words_to_write); +ioread32 (fifo->base_addr +XLLF_TDFV_OFFSET ) >= + words_to_write);if (ret) goto end_unlock; }
Btw, Greg already NAKed this patch from someone else.
https://lore.kernel.org/all/2026022711-showoff-bakery-8235@gregkh/
regards,
dan carpenter
Quoted 3 lines
Signature · 1 line
2.43.0