Skip to content

Commit 4497288

Browse files
ovpanaitgregkh
authored andcommitted
staging: axis-fifo: remove get_dts_property() helper
The get_dts_property() wrapper around of_property_read_u32() adds no real value and duplicates error handling. Inline the calls directly in axis_fifo_parse_dt() to reduce indirection and simplify the code. Signed-off-by: Ovidiu Panait <ovidiu.panait.oss@gmail.com> Link: https://lore.kernel.org/r/20250919195400.3180039-4-ovidiu.panait.oss@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent b10f676 commit 4497288

1 file changed

Lines changed: 13 additions & 26 deletions

File tree

drivers/staging/axis-fifo/axis-fifo.c

Lines changed: 13 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -496,30 +496,14 @@ static void axis_fifo_debugfs_init(struct axis_fifo *fifo)
496496
&axis_fifo_debugfs_regs_fops);
497497
}
498498

499-
/* read named property from the device tree */
500-
static int get_dts_property(struct axis_fifo *fifo,
501-
char *name, unsigned int *var)
502-
{
503-
int rc;
504-
505-
rc = of_property_read_u32(fifo->dt_device->of_node, name, var);
506-
if (rc) {
507-
dev_err(fifo->dt_device, "couldn't read IP dts property '%s'",
508-
name);
509-
return rc;
510-
}
511-
dev_dbg(fifo->dt_device, "dts property '%s' = %u\n",
512-
name, *var);
513-
514-
return 0;
515-
}
516-
517499
static int axis_fifo_parse_dt(struct axis_fifo *fifo)
518500
{
519501
int ret;
520502
unsigned int value;
503+
struct device_node *node = fifo->dt_device->of_node;
521504

522-
ret = get_dts_property(fifo, "xlnx,axi-str-rxd-tdata-width", &value);
505+
ret = of_property_read_u32(node, "xlnx,axi-str-rxd-tdata-width",
506+
&value);
523507
if (ret) {
524508
dev_err(fifo->dt_device, "missing xlnx,axi-str-rxd-tdata-width property\n");
525509
goto end;
@@ -529,7 +513,8 @@ static int axis_fifo_parse_dt(struct axis_fifo *fifo)
529513
goto end;
530514
}
531515

532-
ret = get_dts_property(fifo, "xlnx,axi-str-txd-tdata-width", &value);
516+
ret = of_property_read_u32(node, "xlnx,axi-str-txd-tdata-width",
517+
&value);
533518
if (ret) {
534519
dev_err(fifo->dt_device, "missing xlnx,axi-str-txd-tdata-width property\n");
535520
goto end;
@@ -539,30 +524,32 @@ static int axis_fifo_parse_dt(struct axis_fifo *fifo)
539524
goto end;
540525
}
541526

542-
ret = get_dts_property(fifo, "xlnx,rx-fifo-depth",
543-
&fifo->rx_fifo_depth);
527+
ret = of_property_read_u32(node, "xlnx,rx-fifo-depth",
528+
&fifo->rx_fifo_depth);
544529
if (ret) {
545530
dev_err(fifo->dt_device, "missing xlnx,rx-fifo-depth property\n");
546531
ret = -EIO;
547532
goto end;
548533
}
549534

550-
ret = get_dts_property(fifo, "xlnx,tx-fifo-depth",
551-
&fifo->tx_fifo_depth);
535+
ret = of_property_read_u32(node, "xlnx,tx-fifo-depth",
536+
&fifo->tx_fifo_depth);
552537
if (ret) {
553538
dev_err(fifo->dt_device, "missing xlnx,tx-fifo-depth property\n");
554539
ret = -EIO;
555540
goto end;
556541
}
557542

558-
ret = get_dts_property(fifo, "xlnx,use-rx-data", &fifo->has_rx_fifo);
543+
ret = of_property_read_u32(node, "xlnx,use-rx-data",
544+
&fifo->has_rx_fifo);
559545
if (ret) {
560546
dev_err(fifo->dt_device, "missing xlnx,use-rx-data property\n");
561547
ret = -EIO;
562548
goto end;
563549
}
564550

565-
ret = get_dts_property(fifo, "xlnx,use-tx-data", &fifo->has_tx_fifo);
551+
ret = of_property_read_u32(node, "xlnx,use-tx-data",
552+
&fifo->has_tx_fifo);
566553
if (ret) {
567554
dev_err(fifo->dt_device, "missing xlnx,use-tx-data property\n");
568555
ret = -EIO;

0 commit comments

Comments
 (0)