* [PATCH v4 0/2] staging: axis-fifo: refactor and cleanup
@ 2026-02-02 12:23 Gustavo Piaz da Silva
2026-02-02 12:23 ` [PATCH v4 1/2] staging: axis-fifo: align fifo depth types with OF API Gustavo Piaz da Silva
2026-02-02 12:23 ` [PATCH v4 2/2] staging: axis-fifo: refactor device tree parsing Gustavo Piaz da Silva
0 siblings, 2 replies; 6+ messages in thread
From: Gustavo Piaz da Silva @ 2026-02-02 12:23 UTC (permalink / raw)
To: gregkh, dan.carpenter
Cc: ovidiu.panait.oss, gshahrouzi, linux-staging, linux-kernel,
Gustavo Piaz da Silva
This series cleans up the axis-fifo driver probe function logic.
Patch 1 aligns the struct types with the OF API.
Patch 2 refactors the parsing logic.
Changes in v4:
- Removed extra blank lines in commit messages.
- Added "rx" and "tx" prefixes to error messages in Patch 2 to distinguish failures.
- Explicitly listed changes in individual patches.
Changes in v3:
- Split into two patches as requested.
Gustavo Piaz da Silva (2):
staging: axis-fifo: align fifo depth types with OF API
staging: axis-fifo: refactor device tree parsing
drivers/staging/axis-fifo/axis-fifo.c | 81 +++++++++------------------
1 file changed, 27 insertions(+), 54 deletions(-)
--
2.52.0
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v4 1/2] staging: axis-fifo: align fifo depth types with OF API
2026-02-02 12:23 [PATCH v4 0/2] staging: axis-fifo: refactor and cleanup Gustavo Piaz da Silva
@ 2026-02-02 12:23 ` Gustavo Piaz da Silva
2026-02-02 12:23 ` [PATCH v4 2/2] staging: axis-fifo: refactor device tree parsing Gustavo Piaz da Silva
1 sibling, 0 replies; 6+ messages in thread
From: Gustavo Piaz da Silva @ 2026-02-02 12:23 UTC (permalink / raw)
To: gregkh, dan.carpenter
Cc: ovidiu.panait.oss, gshahrouzi, linux-staging, linux-kernel,
Gustavo Piaz da Silva
Change has_rx_fifo and has_tx_fifo types from int to u32 in struct
axis_fifo.
The of_property_read_u32() function expects a u32 pointer. While the
current code might work, aligning the types avoids potential mixed-type
issues and clarifies the data structure.
Signed-off-by: Gustavo Piaz da Silva <gustavopiazdasilva2102@gmail.com>
---
drivers/staging/axis-fifo/axis-fifo.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/staging/axis-fifo/axis-fifo.c b/drivers/staging/axis-fifo/axis-fifo.c
index 509d620d6ce7..7bc7bf191250 100644
--- a/drivers/staging/axis-fifo/axis-fifo.c
+++ b/drivers/staging/axis-fifo/axis-fifo.c
@@ -121,8 +121,8 @@ struct axis_fifo {
unsigned int rx_fifo_depth; /* max words in the receive fifo */
unsigned int tx_fifo_depth; /* max words in the transmit fifo */
- int has_rx_fifo; /* whether the IP has the rx fifo enabled */
- int has_tx_fifo; /* whether the IP has the tx fifo enabled */
+ u32 has_rx_fifo; /* whether the IP has the rx fifo enabled */
+ u32 has_tx_fifo; /* whether the IP has the tx fifo enabled */
wait_queue_head_t read_queue; /* wait queue for asynchronos read */
struct mutex read_lock; /* lock for reading */
--
2.52.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH v4 2/2] staging: axis-fifo: refactor device tree parsing
2026-02-02 12:23 [PATCH v4 0/2] staging: axis-fifo: refactor and cleanup Gustavo Piaz da Silva
2026-02-02 12:23 ` [PATCH v4 1/2] staging: axis-fifo: align fifo depth types with OF API Gustavo Piaz da Silva
@ 2026-02-02 12:23 ` Gustavo Piaz da Silva
2026-02-02 12:37 ` Dan Carpenter
2026-02-02 13:36 ` Greg KH
1 sibling, 2 replies; 6+ messages in thread
From: Gustavo Piaz da Silva @ 2026-02-02 12:23 UTC (permalink / raw)
To: gregkh, dan.carpenter
Cc: ovidiu.panait.oss, gshahrouzi, linux-staging, linux-kernel,
Gustavo Piaz da Silva
Refactor the device tree parsing logic in axis_fifo_probe() to reduce
code duplication and improve readability.
Create a helper function axis_fifo_get_u32() to handle property reading
and error checking, replacing repetitive of_property_read_u32() calls.
This eliminates the goto logic for error handling in the probe path and
consolidates error logging.
Signed-off-by: Gustavo Piaz da Silva <gustavopiazdasilva2102@gmail.com>
Changes in v4:
- Removed extra blank lines in the commit message.
- Added "rx" and "tx" prefixes to error messages to distinguish between read and write width failures.
Changes in v3:
- Split the original v2 patch into two separate patches.
drivers/staging/axis-fifo/axis-fifo.c | 77 +++++++++------------------
1 file changed, 25 insertions(+), 52 deletions(-)
diff --git a/drivers/staging/axis-fifo/axis-fifo.c b/drivers/staging/axis-fifo/axis-fifo.c
index 7bc7bf191250..779de1b22ef5 100644
--- a/drivers/staging/axis-fifo/axis-fifo.c
+++ b/drivers/staging/axis-fifo/axis-fifo.c
@@ -482,68 +482,41 @@ static void axis_fifo_debugfs_init(struct axis_fifo *fifo)
&axis_fifo_debugfs_regs_fops);
}
-static int axis_fifo_parse_dt(struct axis_fifo *fifo)
+static int axis_fifo_get_u32(struct axis_fifo *fifo, const char *prop, u32 *val)
{
- int ret;
- unsigned int value;
- struct device_node *node = fifo->dt_device->of_node;
+ int ret = of_property_read_u32(fifo->dt_device->of_node, prop, val);
- ret = of_property_read_u32(node, "xlnx,axi-str-rxd-tdata-width",
- &value);
if (ret) {
- dev_err(fifo->dt_device, "missing xlnx,axi-str-rxd-tdata-width property\n");
- goto end;
- } else if (value != 32) {
- dev_err(fifo->dt_device, "xlnx,axi-str-rxd-tdata-width only supports 32 bits\n");
- ret = -EIO;
- goto end;
+ dev_err(fifo->dt_device, "missing %s property\n", prop);
+ return ret;
}
+ return 0;
+}
- 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;
- } else if (value != 32) {
- dev_err(fifo->dt_device, "xlnx,axi-str-txd-tdata-width only supports 32 bits\n");
- ret = -EIO;
- goto end;
- }
+static int axis_fifo_parse_dt(struct axis_fifo *fifo)
+{
+ u32 width;
- 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;
- goto end;
+ if (axis_fifo_get_u32(fifo, "xlnx,axi-str-rxd-tdata-width", &width) || width != 32) {
+ dev_err(fifo->dt_device, "rx tdata-width only supports 32 bits\n");
+ 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;
- goto end;
+ if (axis_fifo_get_u32(fifo, "xlnx,axi-str-txd-tdata-width", &width) || width != 32) {
+ dev_err(fifo->dt_device, "tx tdata-width only supports 32 bits\n");
+ 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;
- goto end;
- }
+ if (axis_fifo_get_u32(fifo, "xlnx,rx-fifo-depth", &fifo->rx_fifo_depth))
+ return -EIO;
+ if (axis_fifo_get_u32(fifo, "xlnx,tx-fifo-depth", &fifo->tx_fifo_depth))
+ 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;
- goto end;
- }
+ if (axis_fifo_get_u32(fifo, "xlnx,use-rx-data", &fifo->has_rx_fifo))
+ return -EIO;
+ if (axis_fifo_get_u32(fifo, "xlnx,use-tx-data", &fifo->has_tx_fifo))
+ return -EIO;
-end:
- return ret;
+ return 0;
}
static int axis_fifo_probe(struct platform_device *pdev)
@@ -700,4 +673,4 @@ module_exit(axis_fifo_exit);
MODULE_LICENSE("GPL");
MODULE_AUTHOR("Jacob Feder <jacobsfeder@gmail.com>");
-MODULE_DESCRIPTION("Xilinx AXI-Stream FIFO IP core driver");
+MODULE_DESCRIPTION("Xilinx AXI-Stream FIFO IP core driver");
\ No newline at end of file
--
2.52.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH v4 2/2] staging: axis-fifo: refactor device tree parsing
2026-02-02 12:23 ` [PATCH v4 2/2] staging: axis-fifo: refactor device tree parsing Gustavo Piaz da Silva
@ 2026-02-02 12:37 ` Dan Carpenter
2026-02-02 13:36 ` Greg KH
1 sibling, 0 replies; 6+ messages in thread
From: Dan Carpenter @ 2026-02-02 12:37 UTC (permalink / raw)
To: Gustavo Piaz da Silva
Cc: gregkh, ovidiu.panait.oss, gshahrouzi, linux-staging,
linux-kernel
On Mon, Feb 02, 2026 at 09:23:17AM -0300, Gustavo Piaz da Silva wrote:
> @@ -700,4 +673,4 @@ module_exit(axis_fifo_exit);
>
> MODULE_LICENSE("GPL");
> MODULE_AUTHOR("Jacob Feder <jacobsfeder@gmail.com>");
> -MODULE_DESCRIPTION("Xilinx AXI-Stream FIFO IP core driver");
> +MODULE_DESCRIPTION("Xilinx AXI-Stream FIFO IP core driver");
> \ No newline at end of file
I guess you accidentally deleted the newline?
regards,
dan carpenter
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v4 2/2] staging: axis-fifo: refactor device tree parsing
2026-02-02 12:23 ` [PATCH v4 2/2] staging: axis-fifo: refactor device tree parsing Gustavo Piaz da Silva
2026-02-02 12:37 ` Dan Carpenter
@ 2026-02-02 13:36 ` Greg KH
[not found] ` <CABpvFwKsBqstoiyriN6Vcx4D2Mszd1w=F6YvLRHiLK=jaYZNpQ@mail.gmail.com>
1 sibling, 1 reply; 6+ messages in thread
From: Greg KH @ 2026-02-02 13:36 UTC (permalink / raw)
To: Gustavo Piaz da Silva
Cc: dan.carpenter, ovidiu.panait.oss, gshahrouzi, linux-staging,
linux-kernel
On Mon, Feb 02, 2026 at 09:23:17AM -0300, Gustavo Piaz da Silva wrote:
> Refactor the device tree parsing logic in axis_fifo_probe() to reduce
> code duplication and improve readability.
>
> Create a helper function axis_fifo_get_u32() to handle property reading
> and error checking, replacing repetitive of_property_read_u32() calls.
>
> This eliminates the goto logic for error handling in the probe path and
> consolidates error logging.
>
> Signed-off-by: Gustavo Piaz da Silva <gustavopiazdasilva2102@gmail.com>
>
> Changes in v4:
> - Removed extra blank lines in the commit message.
> - Added "rx" and "tx" prefixes to error messages to distinguish between read and write width failures.
>
> Changes in v3:
> - Split the original v2 patch into two separate patches.
> drivers/staging/axis-fifo/axis-fifo.c | 77 +++++++++------------------
> 1 file changed, 25 insertions(+), 52 deletions(-)
You are missing a --- line after the signed-off-by :(
> +static int axis_fifo_parse_dt(struct axis_fifo *fifo)
> +{
> + u32 width;
>
> - 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;
> - goto end;
> + if (axis_fifo_get_u32(fifo, "xlnx,axi-str-rxd-tdata-width", &width) || width != 32) {
> + dev_err(fifo->dt_device, "rx tdata-width only supports 32 bits\n");
> + 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;
> - goto end;
> + if (axis_fifo_get_u32(fifo, "xlnx,axi-str-txd-tdata-width", &width) || width != 32) {
> + dev_err(fifo->dt_device, "tx tdata-width only supports 32 bits\n");
Now you have 2 errors printed out?
And really, the helper function isn't needed, just get rid of the
dev_err() lines, why would they be needed anymore? No other driver uses
this type of error reporting that I have noticed.
Also, do you have this hardware to test this with?
thanks,
greg k-h
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v4 2/2] staging: axis-fifo: refactor device tree parsing
[not found] ` <CABpvFwKsBqstoiyriN6Vcx4D2Mszd1w=F6YvLRHiLK=jaYZNpQ@mail.gmail.com>
@ 2026-02-02 13:53 ` Gustavo Piaz
0 siblings, 0 replies; 6+ messages in thread
From: Gustavo Piaz @ 2026-02-02 13:53 UTC (permalink / raw)
To: Greg KH
Cc: dan.carpenter, ovidiu.panait.oss, gshahrouzi, linux-staging,
linux-kernel
Hi Greg,
Our emails crossed paths. I had just sent v5 to fix a missing newline
pointed out by Dan Carpenter when your review arrived.
Since v5 still contains the helper function you asked to remove,
please ignore it.
I will prepare and send v6 shortly to address your feedback: I'll
remove the helper function and the dev_err() calls, and fix the
missing separator line.
Regarding the hardware: No, I don't have it. I am build-testing only.
Regards,
Gustavo
Gustavo Piaz <gustavopiazdasilva2102@gmail.com> escreveu (segunda,
2/02/2026 à(s) 10:49):
>>
>>
>> Hi Greg,
>>
>> Our emails crossed paths. I had just sent v5 to fix a missing newline pointed out by Dan Carpenter when your review arrived.
>>
>> Since v5 still contains the helper function you asked to remove, please ignore it.
>>
>> I will prepare and send v6 shortly to address your feedback: I'll remove the helper function and the dev_err() calls, and fix the missing separator line.
>>
>> Regarding the hardware: No, I don't have it. I am build-testing only.
>>
>> Regards,
>> Gustavo
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2026-02-02 13:53 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-02 12:23 [PATCH v4 0/2] staging: axis-fifo: refactor and cleanup Gustavo Piaz da Silva
2026-02-02 12:23 ` [PATCH v4 1/2] staging: axis-fifo: align fifo depth types with OF API Gustavo Piaz da Silva
2026-02-02 12:23 ` [PATCH v4 2/2] staging: axis-fifo: refactor device tree parsing Gustavo Piaz da Silva
2026-02-02 12:37 ` Dan Carpenter
2026-02-02 13:36 ` Greg KH
[not found] ` <CABpvFwKsBqstoiyriN6Vcx4D2Mszd1w=F6YvLRHiLK=jaYZNpQ@mail.gmail.com>
2026-02-02 13:53 ` Gustavo Piaz
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox