public inbox for linux-staging@lists.linux.dev
 help / color / mirror / Atom feed
* [PATCH v7 0/2] staging: axis-fifo: clean up probe logic
@ 2026-02-06 13:11 Gustavo Piaz da Silva
  2026-02-06 13:11 ` [PATCH v7 1/2] staging: axis-fifo: use u32 for fifo depth flags Gustavo Piaz da Silva
  2026-02-06 13:11 ` [PATCH v7 2/2] staging: axis-fifo: refactor device tree parsing Gustavo Piaz da Silva
  0 siblings, 2 replies; 4+ messages in thread
From: Gustavo Piaz da Silva @ 2026-02-06 13:11 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.

Changes in v7:
 - Rewrote Patch 1 description for better clarity and acknowledged 
   that the original code works.
 - Reverted variable name and type back to 'unsigned int value' to 
   minimize diff noise.
 - Removed unnecessary whitespace and extra blank lines between 
   function calls and error checks.

Changes in v6:
 - Removed axis_fifo_get_u32() helper function entirely.
 - Removed all dev_err() calls in parse_dt.
 - Kept 'node' local variable in parse_dt to avoid checkpatch 
   line length warnings.
 - Added missing "---" line after Signed-off-by.
 - Fixed checkpatch style warning (missing blank line after declarations).
 - Ensured newline at the end of the file.

Changes in v5:
 - Added missing newline at the end of axis-fifo.c file in Patch 2.

Changes in v4:
 - Removed extra blank lines in commit messages.
 - Added "rx" and "tx" prefixes to error messages (removed in v6).

Changes in v3:
 - Split the original v2 patch into two separate patches.

Changes in v2:
 - Fixed checkpatch.pl coding style issues.

Gustavo Piaz da Silva (2):
  staging: axis-fifo: use u32 for fifo depth flags
  staging: axis-fifo: refactor device tree parsing

 drivers/staging/axis-fifo/axis-fifo.c | 77 +++++++++------------------
 1 file changed, 25 insertions(+), 52 deletions(-)

-- 
2.52.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH v7 1/2] staging: axis-fifo: use u32 for fifo depth flags
  2026-02-06 13:11 [PATCH v7 0/2] staging: axis-fifo: clean up probe logic Gustavo Piaz da Silva
@ 2026-02-06 13:11 ` Gustavo Piaz da Silva
  2026-02-06 13:11 ` [PATCH v7 2/2] staging: axis-fifo: refactor device tree parsing Gustavo Piaz da Silva
  1 sibling, 0 replies; 4+ messages in thread
From: Gustavo Piaz da Silva @ 2026-02-06 13:11 UTC (permalink / raw)
  To: gregkh, dan.carpenter
  Cc: ovidiu.panait.oss, gshahrouzi, linux-staging, linux-kernel,
	Gustavo Piaz da Silva

Update has_rx_fifo and has_tx_fifo types from int to u32 in struct
axis_fifo.

The of_property_read_u32() function expects a pointer to u32. Although
the current code works correctly with int, using u32 aligns the data
structure with the Device Tree API and prevents potential
type-mismatch issues.

Signed-off-by: Gustavo Piaz da Silva <gustavopiazdasilva2102@gmail.com>
---
Changes in v7:
 - Rewrote description for better clarity and explicitly acknowledged 
   that the original code works correctly.

Changes in v6:
 - Added missing "---" line after Signed-off-by.
 - Updated subject prefix to staging: axis-fifo.

Changes in v3:
 - Split from a single patch into a two-patch series.
 
 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] 4+ messages in thread

* [PATCH v7 2/2] staging: axis-fifo: refactor device tree parsing
  2026-02-06 13:11 [PATCH v7 0/2] staging: axis-fifo: clean up probe logic Gustavo Piaz da Silva
  2026-02-06 13:11 ` [PATCH v7 1/2] staging: axis-fifo: use u32 for fifo depth flags Gustavo Piaz da Silva
@ 2026-02-06 13:11 ` Gustavo Piaz da Silva
  2026-02-06 13:48   ` Dan Carpenter
  1 sibling, 1 reply; 4+ messages in thread
From: Gustavo Piaz da Silva @ 2026-02-06 13:11 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
verbosity and simplify error handling.

Remove the verbose error logging and goto logic. Instead, check
of_property_read_u32() return values directly and propagate error codes
immediately. This aligns the driver with modern kernel standards by
removing unnecessary error messages during probe.

Signed-off-by: Gustavo Piaz da Silva <gustavopiazdasilva2102@gmail.com>
---
Changes in v7:
 - Reverted variable name and type from 'u32 width' back to the 
   original 'unsigned int value' to minimize unnecessary diff noise.
 - Removed extra blank lines between function calls and error 
   checks to keep the diff as compact as possible.

Changes in v6:
 - Removed the axis_fifo_get_u32() helper function entirely.
 - Removed all dev_err() calls in axis_fifo_parse_dt() as the 
   driver core already reports probe failures.
 - Kept the 'node' local variable to avoid checkpatch line 
   length warnings.
 - Fixed checkpatch style warning (missing blank line after 
   declarations).
 - Ensured a newline exists at the end of the file.

Changes in v5:
 - Added missing newline at the end of axis-fifo.c.

Changes in v4:
 - Removed extra blank lines in the commit message.
 - Added "rx" and "tx" prefixes to error messages (these 
   messages were later removed in v6).

Changes in v3:
 - Split the original monolithic v2 patch into two separate 
   patches to isolate logic refactoring from type alignment.

Changes in v2:
 - Fixed checkpatch.pl coding style issues regarding 
   indents and line formatting.

Changes in v1:
 - Initial submission.

 drivers/staging/axis-fifo/axis-fifo.c | 73 +++++++++------------------
 1 file changed, 23 insertions(+), 50 deletions(-)

diff --git a/drivers/staging/axis-fifo/axis-fifo.c b/drivers/staging/axis-fifo/axis-fifo.c
index 7bc7bf191250..8141f8d02a98 100644
--- a/drivers/staging/axis-fifo/axis-fifo.c
+++ b/drivers/staging/axis-fifo/axis-fifo.c
@@ -488,62 +488,35 @@ static int axis_fifo_parse_dt(struct axis_fifo *fifo)
 	unsigned int value;
 	struct device_node *node = fifo->dt_device->of_node;
 
-	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;
-	}
+	ret = of_property_read_u32(node, "xlnx,axi-str-rxd-tdata-width", &value);
+	if (ret)
+		return ret;
+	if (value != 32)
+		return -EINVAL;
 
-	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;
-	}
+	ret = of_property_read_u32(node, "xlnx,axi-str-txd-tdata-width", &value);
+	if (ret)
+		return ret;
+	if (value != 32)
+		return -EINVAL;
 
-	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;
-	}
+	ret = of_property_read_u32(node, "xlnx,rx-fifo-depth", &fifo->rx_fifo_depth);
+	if (ret)
+		return ret;
 
-	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;
-	}
+	ret = of_property_read_u32(node, "xlnx,tx-fifo-depth", &fifo->tx_fifo_depth);
+	if (ret)
+		return ret;
 
-	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;
-	}
+	ret = of_property_read_u32(node, "xlnx,use-rx-data", &fifo->has_rx_fifo);
+	if (ret)
+		return ret;
 
-	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;
-	}
+	ret = of_property_read_u32(node, "xlnx,use-tx-data", &fifo->has_tx_fifo);
+	if (ret)
+		return ret;
 
-end:
-	return ret;
+	return 0;
 }
 
 static int axis_fifo_probe(struct platform_device *pdev)
-- 
2.52.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v7 2/2] staging: axis-fifo: refactor device tree parsing
  2026-02-06 13:11 ` [PATCH v7 2/2] staging: axis-fifo: refactor device tree parsing Gustavo Piaz da Silva
@ 2026-02-06 13:48   ` Dan Carpenter
  0 siblings, 0 replies; 4+ messages in thread
From: Dan Carpenter @ 2026-02-06 13:48 UTC (permalink / raw)
  To: Gustavo Piaz da Silva
  Cc: gregkh, ovidiu.panait.oss, gshahrouzi, linux-staging,
	linux-kernel

On Fri, Feb 06, 2026 at 10:11:48AM -0300, Gustavo Piaz da Silva wrote:
> -	ret = of_property_read_u32(node, "xlnx,axi-str-rxd-tdata-width",
> -				   &value);
> +	ret = of_property_read_u32(node, "xlnx,axi-str-rxd-tdata-width", &value);

You moved &value to the previous line which is the right thing.  But,
please, don't make these unrelated white space changes in the same patch.
You can do it in a separate patch but they make the diff harder to
review.

regards,
dan carpenter



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-02-06 13:48 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-06 13:11 [PATCH v7 0/2] staging: axis-fifo: clean up probe logic Gustavo Piaz da Silva
2026-02-06 13:11 ` [PATCH v7 1/2] staging: axis-fifo: use u32 for fifo depth flags Gustavo Piaz da Silva
2026-02-06 13:11 ` [PATCH v7 2/2] staging: axis-fifo: refactor device tree parsing Gustavo Piaz da Silva
2026-02-06 13:48   ` Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox