From nobody Mon Feb 9 17:34:51 2026 Received: from mail-dl1-f46.google.com (mail-dl1-f46.google.com [74.125.82.46]) (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 871AB33E377 for ; Sat, 31 Jan 2026 18:27:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.82.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769884075; cv=none; b=ndl8v9ySzMPQAb3ToNeCNVyghz8QWbfeQ/7RCWfXcz/D+PFDVllLYtXipTeiZE6jdGJvCXQJxrN2spwu1JwQymv87Y+aPfmDR9tVcHK01miYviU2iRl6HSMJLwXgeeDq3kT5db+ZfUW0U3RcBszNH+6wjv9QLu2LvOnVlejP1NM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769884075; c=relaxed/simple; bh=xLzXKkc8Szv1bnEzPfrf3KYJ/WlAtIUwB2HsIiTkSoQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=q9rVav8CIWKBK7l5QQVLzviCjV7kxbmdhpUMb3YYFxXUzAZ5rYG8K5HvDgwPO9BfkUwRHhuB7Wz3WCa3AEVk0ZUZ4Kor5LocE4UetIuSnsQqcYrV7b5Mk3Imf9C3fNJuQ08kz8jRLbrlzo3YOy5U9C27WGwS/iK+SDewRTGIGJg= 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=mlGQeES6; arc=none smtp.client-ip=74.125.82.46 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="mlGQeES6" Received: by mail-dl1-f46.google.com with SMTP id a92af1059eb24-11f36012fb2so3934457c88.1 for ; Sat, 31 Jan 2026 10:27:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1769884074; x=1770488874; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=pJkcfXhz9FYUNr4TQrjyMkEeIDXF/HSRncJSJNXfcRg=; b=mlGQeES6If//T+e4Cz40V+c3wwRCVyFdD/Ab0Fqiv90FThqZvhzHfMW08yJ4+KdPK3 ptpjJS3E0ji4lcnDCVzPQoVFet1pc2NveBgiDwuCVdoLVa6DEBNLtkQ/p58Oaj974Fcs FeBH9pRCn3S99hgnjUv6q2siMsJhqTOXSG6g1huNvmUlXEhTmZ90k+PBezZA4HujAbii mBcY3lM8wkKJuZSbhgn4FxmrfdMuKR2otYZ0GZxUQdV7+6LsWJleg1YntQTDKrLtupJY yLd7APoPJ+sNDinXokPci4wdW3fMYT2oxr53lufQ/subxWqA4YSdOGDLheuiDyCLX+Qy 8O2A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769884074; x=1770488874; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=pJkcfXhz9FYUNr4TQrjyMkEeIDXF/HSRncJSJNXfcRg=; b=f912qJthyfM0TbjvLSoqDPmYFntw77SDWMybXLLi77Jstzf9ls+l5TYmF2u1mvRRSN mpGDDjKuL6Q5A3VG3N18FagSVclgXhC2YBp/3MgNNUJCcoT1Ou2LJoRVPOTmMqoKpuNV V89VA5mxekm0/ipjqd2N3PbDb60hIZI2oiFo2E78nJmn4nBr3aGnxA7bh1x0+Ry6LNIf IwOjSeOACsYI3Q0zqUfhZtlOpRn/xTsXYghFzb067o7+tnRK/RXs2RdEs5nrwEylFZ+5 tEG03FXD5ijWcdJHCJE3Us0/42trtDy3pW7Sa7dmhkC3zzpnoWfcurHghAqW9FErpRQY DHSw== X-Forwarded-Encrypted: i=1; AJvYcCXjrkFFcqOJd2Jz+7TXi/ATOcj5KYuNzTfzF43f+n/TBTVI2PVdToumzQhle+JVVmI6NfPM21YyQQRNt4E=@vger.kernel.org X-Gm-Message-State: AOJu0YwZkPc8xIvHrZNmcVaOUbkU1fZxlx09tMzjpTSa+Dp6ehFfB3o/ IKzEapgvB0+BBnq+Rch71JyJ/0oSqjivV5CZamnobAxaZfHcZ1OuM4TdEz69NQ== X-Gm-Gg: AZuq6aLNqhn4eDwj4OYgIjKSHh3LEU1G9BS8tndlIV/Gz0C3/SUOWSjTQIUTqpFlB14 g5baTXPDkf6Xq+iTFoPehUSH8iyNZmz2qrzlziM7fukOZTKzGcoq17Y/2usfNgVdy3+zpljRX+Y K7NVki9wSoa5zvMgNk0XhFiIfbwPEFD+QAi9d0yRf4qA90L7iDkpRrTNRZWIRXX8bdrwYnxLwkL cmuDMUtIV8ROR+QzttDPX6LuwFz2p8H8qRQmXyvsQC1CEoak5etBN5YNChzf7oQo/YYS1BXQEzz IpnWjw0exFP7hBASxqBSBYDJ6PToblv0R4Fo7ELJcJQWh2A1l/DmERtiIiMqeMRDmwYxSPyoC6X b0cBa4h9+bby48XXA1aGWTGT8olyHdtD0/1vYM5vjWw9dtjG6Qf0pCY0JMMylPMSdz1WM7YXUiC 3nBdNPIWAy4E1CUFjkqIn4kK+Iz9Q5PN7K X-Received: by 2002:a05:7301:9bc9:b0:2ab:ca55:89ab with SMTP id 5a478bee46e88-2b7c894bafamr2627178eec.42.1769884073597; Sat, 31 Jan 2026 10:27:53 -0800 (PST) Received: from gustavo-arch ([2804:14c:f25a:845f:5b8d:2e7c:d238:2d28]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-2b7a16ef3b3sm16105513eec.12.2026.01.31.10.27.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 31 Jan 2026 10:27:53 -0800 (PST) From: Gustavo Piaz da Silva To: gregkh@linuxfoundation.org, dan.carpenter@linaro.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 v3 2/2] staging: axis-fifo: refactor device tree parsing Date: Sat, 31 Jan 2026 15:27:32 -0300 Message-ID: <20260131182732.62857-3-gustavopiazdasilva2102@gmail.com> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260131182732.62857-1-gustavopiazdasilva2102@gmail.com> References: <20260131182732.62857-1-gustavopiazdasilva2102@gmail.com> 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 eliminates the goto logic for error handling in the probe path and consolidates error logging. Signed-off-by: Gustavo Piaz da Silva --- drivers/staging/axis-fifo/axis-fifo.c | 76 +++++++++------------------ 1 file changed, 25 insertions(+), 51 deletions(-) diff --git a/drivers/staging/axis-fifo/axis-fifo.c b/drivers/staging/axis-f= ifo/axis-fifo.c index 7bc7bf191250..1e3059ec4fbd 100644 --- a/drivers/staging/axis-fifo/axis-fifo.c +++ b/drivers/staging/axis-fifo/axis-fifo.c @@ -482,68 +482,42 @@ 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; - goto end; + if (axis_fifo_get_u32(fifo, "xlnx,axi-str-rxd-tdata-width", &width) || wi= dth !=3D 32) { + dev_err(fifo->dt_device, "tdata-width only supports 32 bits\n"); + return -EIO; } - - 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; - goto end; + if (axis_fifo_get_u32(fifo, "xlnx,axi-str-txd-tdata-width", &width) || wi= dth !=3D 32) { + dev_err(fifo->dt_device, "tdata-width only supports 32 bits\n"); + return -EIO; } =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", &fifo->has_rx_fifo)) + return -EIO; + if (axis_fifo_get_u32(fifo, "xlnx,use-tx-data", &fifo->has_tx_fifo)) + return -EIO; =20 -end: - return ret; + return 0; } =20 static int axis_fifo_probe(struct platform_device *pdev) --=20 2.52.0