From nobody Sun Feb 8 17:47:03 2026 Received: from mail-dl1-f42.google.com (mail-dl1-f42.google.com [74.125.82.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AC8CE72627 for ; Sat, 31 Jan 2026 14:05:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.82.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769868327; cv=none; b=q4r3yQWd7XHW0wzSRSe2sU+12Hki1SG/jYH5CBuP0NNhaBjr3oko4AL85tEZaAmXBHxfMsegrdtjb5r7YdsVZb9PhAGrri3Lqet1Q5tBbM7wF2gODxQJqtOeMx6tIbpvedx1jl0X7BOv8TblhdbUQNedQNPfB4IJK5flVZO8PwY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769868327; c=relaxed/simple; bh=EeGYiCuIw0qW63Qm6X9O4YJ+/7Q+IiScgdzQQVQ7LHU=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=dX8ec7urGOPKjbEIbc24i/yOijGL4Ctc+CiZNgBXewIEnecUAiu6x2Sdh6ToXHgjdca4WdWHEsrzo3nUpBzSs1lRTiJ+bid3ebN49Xq1SjlwgAgyAii2JCNRKvUhYjgO4FO5Yd29Jf1yleaQj5SjlvIyBbRfq0pLdBomCCSt0LY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=J2IMwyZa; arc=none smtp.client-ip=74.125.82.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="J2IMwyZa" Received: by mail-dl1-f42.google.com with SMTP id a92af1059eb24-124a1b4dd40so3505265c88.0 for ; Sat, 31 Jan 2026 06:05:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1769868325; x=1770473125; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=Y39p1Bs3v6Mcy5NEY0qveLmYL8nGeXAC5idb6QgWBkY=; b=J2IMwyZamcH/b+HPSIhYZ2HR/PMB20s1MqdoESz3HuROAeCZNbHJ0yZW1xfkEjxylY P8nF14JSYScO1tRdbGriU+ZNkwut2HVfEizyQPok+bNLHcNH4QWeQPUy5q+sczELOFam +PTrmXz25anerdKhBqSwwjWvcsRKBxTGT+Fa8RCeNq2JH7QdQwc6G8DvFdMtTHdtQsPf lU1VY8J5WZoBS3TCr+7W4kxcHpc9bCCNCJvkw4At7t/ss2OciBMbPuCoyTlIZon6DR23 41Uzv23BmyWKvtVMe5EBI7AdWGZGAsgbA1PC8R6t+IiRtidaMHHsjgNp6ecBcGelUHTK AhMw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769868325; x=1770473125; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=Y39p1Bs3v6Mcy5NEY0qveLmYL8nGeXAC5idb6QgWBkY=; b=ObbbahvtTKB1HfKNS6ndy7ACx7PfELpAMK2NyyCY1lFmNofgdcUzcRxz5N2JY50FuU 5zUiJpimEAT8z06vyMJ2ZGmJRAKmJoaooT7lk1B5+wbrpDQWCoc4JT0lJhXPRYzspo7w 9PmFV/WaWwRznClmcpaTzR2LOa0yz6FR445Inak4kY/looPKmJ6svUI8m6chsirvYOYM ivTJmAwkeF4UPa0qCE5eK0QNPygCAgbGQCW2Yv0tvmCK8r74PSGKELA1OhCUzlCV3iRp PwsLzXb5qEgHyt+IY8J29xvbU9cqhOEZHEI0XpgFzsGY3rtBU/CJehdxqX1ccbb9YbfE Nsgg== X-Forwarded-Encrypted: i=1; AJvYcCWKQFz1sc7xZYqZrTOCN3K3QIqNVVLVPq+RxwvoF1NPb6hUzsVTbfUeLjM0zfwSRrstrjIexnmqlp6v75c=@vger.kernel.org X-Gm-Message-State: AOJu0Yw0bZNjNkfVRlSZEkK0BkC8CAVMzjEXpUMiVqmFz20wMbb+YXs6 RllGfFHcjgZkyFXqrdGmrJuX3D13ptNQoDh5zjhzT+zANJYSCIMSoUeA26WypQ== X-Gm-Gg: AZuq6aLTS/PO9x3AeoYsuH9iXz3MYePYWObnNM7ginSlhAY6uY5b9mM9y+0E+Eklccn W9Cq7N9f++0X2L4ha5tutkzLSjDlkr5szIN0CWZmNcDamF9e1qqUe2DUW6jVS7gkGYQO/X9GhAY MmiznSv8+beFz9GaDYFr700upaj4DrniUnaQPxMYeMpgH+xvcTAiMOwB7GBS9i94HgEuW1AQ2ae hq6EgDbwzX8p12TvFzE/1OmFh8YwVpRBdB+/pf4rdA2/WpTnv1aYNtNEU1BTuaZsmzGlWxiboZo Sjs9oHD9D/xCyx0sPc3Z/oWNQdNnuNkvyppEO+5Dz5duAmLeTwJ9+ouLvgYAKXDNPoyKguJeXXM GMdA6RcfDIpTs8O4+AF9SJQg9j4OcPABvEHcjGeSTXJb1YB7KB7RdDUuO+zErqa7OgJQCaLS4Kc agjVzeGjIFYS1A9Ia9klGmokWEwAXcqawc X-Received: by 2002:a05:7022:61aa:b0:123:2d62:2e8d with SMTP id a92af1059eb24-125c0f79c9amr3140457c88.3.1769868324638; Sat, 31 Jan 2026 06:05:24 -0800 (PST) Received: from gustavo-arch ([2804:14c:f25a:845f:5b8d:2e7c:d238:2d28]) by smtp.gmail.com with ESMTPSA id a92af1059eb24-124a9de948esm15567134c88.9.2026.01.31.06.05.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 31 Jan 2026 06:05:24 -0800 (PST) From: Gustavo Piaz da Silva To: gregkh@linuxfoundation.org Cc: ovidiu.panait.oss@gmail.com, gshahrouzi@gmail.com, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org, Gustavo Piaz da Silva Subject: [PATCH] staging: axis-fifo: refactor device tree parsing Date: Sat, 31 Jan 2026 11:05:17 -0300 Message-ID: <20260131140517.29771-1-gustavopiazdasilva2102@gmail.com> X-Mailer: git-send-email 2.52.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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 change reduces the verbosity of the probe function and consolidates er= ror logging for missing properties. Signed-off-by: Gustavo Piaz da Silva --- drivers/staging/axis-fifo/axis-fifo.c | 76 +++++++++------------------ 1 file changed, 24 insertions(+), 52 deletions(-) diff --git a/drivers/staging/axis-fifo/axis-fifo.c b/drivers/staging/axis-f= ifo/axis-fifo.c index 509d620d6ce7..258bb95f03d4 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); } =20 -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 =3D fifo->dt_device->of_node; + int ret =3D of_property_read_u32(fifo->dt_device->of_node, prop, val); =20 - ret =3D 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 !=3D 32) { - dev_err(fifo->dt_device, "xlnx,axi-str-rxd-tdata-width only supports 32 = bits\n"); - ret =3D -EIO; - goto end; + dev_err(fifo->dt_device, "missing %s property\n", prop); + return ret; } + return 0; +} =20 - ret =3D 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 !=3D 32) { - dev_err(fifo->dt_device, "xlnx,axi-str-txd-tdata-width only supports 32 = bits\n"); - ret =3D -EIO; - goto end; - } +static int axis_fifo_parse_dt(struct axis_fifo *fifo) +{ + u32 width; =20 - ret =3D 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 =3D -EIO; + if (axis_fifo_get_u32(fifo, "xlnx,axi-str-rxd-tdata-width", &width) || wi= dth !=3D 32) goto end; - } - - ret =3D 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 =3D -EIO; + if (axis_fifo_get_u32(fifo, "xlnx,axi-str-txd-tdata-width", &width) || wi= dth !=3D 32) goto end; - } =20 - ret =3D 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 =3D -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; =20 - ret =3D 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 =3D -EIO; - goto end; - } + if (axis_fifo_get_u32(fifo, "xlnx,use-rx-data", (u32 *)&fifo->has_rx_fifo= )) + return -EIO; + if (axis_fifo_get_u32(fifo, "xlnx,use-tx-data", (u32 *)&fifo->has_tx_fifo= )) + return -EIO; + + return 0; =20 end: - return ret; + dev_err(fifo->dt_device, "tdata-width only supports 32 bits\n"); + return -EIO; } =20 static int axis_fifo_probe(struct platform_device *pdev) @@ -646,8 +619,7 @@ static int axis_fifo_probe(struct platform_device *pdev) =20 static void axis_fifo_remove(struct platform_device *pdev) { - struct device *dev =3D &pdev->dev; - struct axis_fifo *fifo =3D dev_get_drvdata(dev); + struct axis_fifo *fifo =3D platform_get_drvdata(pdev); =20 debugfs_remove(fifo->debugfs_dir); misc_deregister(&fifo->miscdev); --=20 2.52.0