From nobody Mon Feb 9 17:35:04 2026 Received: from mail-dy1-f174.google.com (mail-dy1-f174.google.com [74.125.82.174]) (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 366FD369964 for ; Mon, 2 Feb 2026 13:34:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.82.174 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770039273; cv=none; b=jmgL3U7vJLZ7Y7kJGrzD5uodGZK8OM2oArb7mqosXvWj0htAxU2v7S1S7XdIIuN1nHtSDKRkGor9xDBhwnolIsvUsPaZlY1H60HLkLwW9SCpehMFlt157hCTDGhUqPTZhwLhoKPOzoBfuV2gYri2XSgljOFdWVTcweWGxWJZRy0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770039273; c=relaxed/simple; bh=FqohdCnNAx4WnMf0PB7ebL9iTd7WmrgZUOv0vcX+GEQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=IFNepDiapEgzODkA/AJhaUNrfbp7sn5wVQtE/jCvbcC9F2/HQhTNrJiyT1BPrt/FERz+2y5yjY2FZXPc1KhKtgvrGDf1NuU3M4E+2Oaxown6tSK7j9dXYF7M9xvmkXIpIncTe/98SpFNuEMJF7NRQ26Nelbz7aqSDWMLcLT59pg= 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=HJvs7CKP; arc=none smtp.client-ip=74.125.82.174 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="HJvs7CKP" Received: by mail-dy1-f174.google.com with SMTP id 5a478bee46e88-2ae2eb49b4bso8717025eec.0 for ; Mon, 02 Feb 2026 05:34:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1770039271; x=1770644071; 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=yge6lb5ZG7qLUrOkaknUBPOnrzubHT+OI5LgZ8GcDj4=; b=HJvs7CKP4Qs6wF95BFt/qxQrwI1PL/jA5kfn7oWOYL8H97Bmm8ueeobaBxHxPQxV1H awVmH4lkFTTzQ3mKXntmfhknw9CjCS/H+kdObViD8/tJmotjYuwydjZFKQj7B1O+eqc+ eDLAhHb/yyWvgHLVxc9cHPYtcuGGO5OliC64cOi6GGt8hqIIZj+BeHtbxcxgzjmI3vqp 5yqthn+wKA7Ze8XwzfzyT7UNtjcNaKq5iKweSxfOAmrcLgXFAjuYEPfjXSSkd7rwTlED LGYVPWGtceFWheINXb+/+crsln4JaeGoIRjlZA6J0Tc+aQKXLPEg1SeKYtUDQnPgOxag hkMQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1770039271; x=1770644071; 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=yge6lb5ZG7qLUrOkaknUBPOnrzubHT+OI5LgZ8GcDj4=; b=jp86AWctMD//lOMIjKlfiuwLgbb/syDW6wajwlmtiv0Xp/4jMnP4gzzbOQxXpu+/Lu DsPFiB/AKNIkCSb7E4V78IAk5ZcG8XVCFLLYKZ3LqMJ3e6kAqdCr5CX4oA9mbdZbhpiq Bjk4UOtiseCX/0Oi8VnkArPfGaz0hjtV+TrDO5HZWl8D4bbnWoKjTGDhW2uls12pkYzE sOrn2Km7kjcH1uzTLciz9gnuQ5QPIKin1qSBLMSnTRWDrCdqbysNT2ievUoRE9igZTNS F6b6PodcTLjJQ5pvcZOrAP4HQBnO/o2NQ6KttTczdboi//sPxKKXgc/rdr33Or2I0dp3 rCXQ== X-Forwarded-Encrypted: i=1; AJvYcCVfvBJhfW4oAwKM9ykqdcmgD3P3yZ/Fx0F5avuRaknchUOTNa27Am3lTiW2S2q6zU/KWDGnb2qLwTnjUn0=@vger.kernel.org X-Gm-Message-State: AOJu0YzAEKRR0M2kyKYQh44w2GzWTvbCKm14iwQf25JtlfvhHaYitumL OJVocXM69UuvWUf7BRSP0HC5ra37qbfZ2LN+09WNwqa7z457/Habq9o9 X-Gm-Gg: AZuq6aIAzSHLNVmigbTw73X1g5cITJZaelCuzl2rHmECZ8sD67XhE4FRURX7kq6c4j4 nisRMgYH4ntZnly++s92hXXIxGVB+R9aRJ7jBpSq41wF0Zbb/NJxY7HIQdCGlceRs4K9SbbRX21 W+JRC3Y5OBKMvax+BjYdEpDtrTex+kA4r89wUxRta1gyw2W1G0zQnUviodCyeR0g3Ebu28HckBf b4O2CovA7yEVo9FwxUfRGeDTMK2lFhI9Wvh66CXYyGzLFjNselrI963SxwLh7R/Ka3nLYnjuHAy FPJBHZj4t9Pd7EfaTQ8dn14VaGLaJh31R/zMJNVlC4L/hgF/8RpPZYfyME2lR1q3zEjP0B8h9LV FfrR9fG2FT18H0QxMGdBypyHfVlyos/eJsBVFi3vaqYaXNinZm38y6Mwpt1r1cWQVc+WdO7rW+G GVrcFYh0hhAqiMYQh1saXiQ2Vh5DEYROw0 X-Received: by 2002:a05:7300:a494:b0:2ae:5bde:a5c5 with SMTP id 5a478bee46e88-2b7c88ea6f2mr6048802eec.30.1770039271154; Mon, 02 Feb 2026 05:34:31 -0800 (PST) Received: from gustavo-arch ([2804:14c:f25a:845f:5b8d:2e7c:d238:2d28]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-2b7a1af8a7bsm20097282eec.34.2026.02.02.05.34.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Feb 2026 05:34:30 -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 v5 2/2] staging: axis-fifo: refactor device tree parsing Date: Mon, 2 Feb 2026 10:34:19 -0300 Message-ID: <20260202133419.20112-3-gustavopiazdasilva2102@gmail.com> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260202133419.20112-1-gustavopiazdasilva2102@gmail.com> References: <20260202133419.20112-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 Changes in v5: - Added missing newline at the end of the file. Changes in v4: - Removed extra blank lines in the commit message. - Added "rx" and "tx" prefixes to error messages to distinguish between re= ad and write width failures. Changes in v3: - Split the original v2 patch into two separate patches. drivers/staging/axis-fifo/axis-fifo.c | 75 +++++++++------------------ 1 file changed, 24 insertions(+), 51 deletions(-) diff --git a/drivers/staging/axis-fifo/axis-fifo.c b/drivers/staging/axis-f= ifo/axis-fifo.c index 7bc7bf191250..08717b48b1ce 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; - goto end; + if (axis_fifo_get_u32(fifo, "xlnx,axi-str-rxd-tdata-width", &width) || wi= dth !=3D 32) { + dev_err(fifo->dt_device, "rx 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, "tx 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