From nobody Sun Feb 8 13:39:11 2026 Received: from mail-dy1-f172.google.com (mail-dy1-f172.google.com [74.125.82.172]) (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 428CC301704 for ; Sat, 31 Jan 2026 15:56:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.82.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769875000; cv=none; b=uZ14dbsXqjG6Jz7iifXXEE3KlUHsjqsjdVuBiR1xC8EiAlTJX5uOP4ac1ArdZ6TS2dVelGQLbBr09O1HyGMMG5V2g3ErjcAJdqUAkeNDiwWosuOZolKaBlBqGXP60wnoNSADp9wkhUR6u7ikSzTb+jJ2DnAXeW3RfTvNYnGStNI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769875000; c=relaxed/simple; bh=yvmZQEEdgEXz9hJWAVyiozQa2g1OrdJcTkk+GH959oc=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=r2PrV7+3igF4MQK73QSizi32BZ3JrtW0r1DQu82/0iUv+RNTqLk2vVl25kjb1XbMhF4tWAA4Cw7V4oSN5cIDL9pi0HNxk3/edkkqrsJ1VbrqIAi+U/8gOrhqqFi8ZcKyDSWGCrqgiha4n9b7xkSFRXqyLrQDymsmLf3XhKU22Sg= 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=e2bCCVcm; arc=none smtp.client-ip=74.125.82.172 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="e2bCCVcm" Received: by mail-dy1-f172.google.com with SMTP id 5a478bee46e88-2b71557299dso3261542eec.1 for ; Sat, 31 Jan 2026 07:56:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1769874998; x=1770479798; 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=dUxsKVUxLbL7CRhW7Ytg5YIJOI1tbDjzyj7qQazcMAk=; b=e2bCCVcmo8e2oNsznpJyql0Q06ie6EqR/8Amku2Q69vONjKOzoqVGndp0Our38BdZU d4nbf1VUYPVnbGAXiBxIfXJjotP3lzLJTgjRXbd1Ey/1TSoZIOuiNMXuwUdBOJ5mvwlZ QZaajHsQiIDYxopfXIRx+NODIPKOEFOeKGbZO1Gv1vFGe8i5vzJmxx8vQ5yA/8RgDSM/ AVFT9rJ9izXF0Qs17gdua3oBT4VzZKTAk/K/ZLmtZsE/dTpaB75QX3W8nDxAXeTUp73b Qe8GZa5rrqX9Qq/cmls2jOOWnOv6oshWs7ddrcUXuNL+SxLKFC703X/J+Ds77GGYJSly s3/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769874998; x=1770479798; 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=dUxsKVUxLbL7CRhW7Ytg5YIJOI1tbDjzyj7qQazcMAk=; b=DPvZrIrXZ+4U0D1AjlbnUo2vUvP/iS/8u+eprSYsTwAGBJGUVBPcqEL3w5RFSZm269 flXo90JLTfkUmBZScIOZRV5ht+V+E81fI4EI6ftKp3jKl2AfaDHq3aUDOvGmEaOaQxaB 1DKFp6m2cIiS/kRC6Ep58Z+0l1jusyMeONoFsV8ybzrruu4+jC3MB4M0Asd+rM6Hk5jK RZSgLdZZcWtIlfrDNvWCGDzqu0/FHz6jr0PnSRDViPDIBRKWLc+dVgKVgu4UZE2mpYcD r3T9cL+UUnTD4ulCq3+k3FMLxvi8e5hOA9cIYO30JYdhjRbB3IQY/FS3t+d7Y1EHgNqo ftcw== X-Forwarded-Encrypted: i=1; AJvYcCW6Fp+QJeNoKETuyQnrj/RdnysXLZbr7WXKt9V6fbGCljIV8rNGa3OWiSe+BucTSoRn/JYIbQ4Idluu0TA=@vger.kernel.org X-Gm-Message-State: AOJu0Yx9mmuvByuRN5SCFM4NxyGql6BloPj57hKiIOX0ph1wYHhC60+g YiKpAdzUO0jKnPN+X9mLacnGrtUkHgifauTNFQEgxBCNAfneNz130ICi X-Gm-Gg: AZuq6aIpMb5ODhvYuVr1/zIXBl5lU83KfZaf26iKttwIJLuZMTqeEdslYOO2a4KU/Zq H/dYhLCEYK7EygJLkiHyoDXTsASEYYWozooQTpjArV0vIrc8wCmcE7rh6F0tvt+7PCRqjtE5wvI LK2Lr294Lx3fyEyMnHOk1qCAGNScHoZJn0TfO9VkfEFAAQVk8nIyBE44Wzqc6/z9U0ME+HJzz10 vHfACysIZSQkxHXmlTBDKfkgjqbIaR4xRBbkeriZUM/th4VnzE5IcZuYqXZUIG4hkv3zGwWxHyu R5B6RlYGSXr63e7hW7dN5rFcimTfguDqAkv/dvsDl9MMRNj8roDObMHiI5+v7nzgnIiExNZ7vTH nRZSE6j1BgIxZykln+6+gpUxm/K5VOGhiaofKmcBChGmdg0EBDYsHE+8r5JPdihTBpEGXwPxCRi SZQS1QUsCP5bcA6dc8BsnWvDKl2HrpLyBp X-Received: by 2002:a05:7301:1688:b0:2b7:fcb:765e with SMTP id 5a478bee46e88-2b7c8940cddmr3184805eec.39.1769874998170; Sat, 31 Jan 2026 07:56:38 -0800 (PST) Received: from gustavo-arch ([2804:14c:f25a:845f:5b8d:2e7c:d238:2d28]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-2b7a170ca0esm15881717eec.15.2026.01.31.07.56.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 31 Jan 2026 07:56:37 -0800 (PST) From: Gustavo Piaz da Silva To: gregkh@linuxfoundation.org Cc: dan.carpenter@linaro.org, ovidiu.panait.oss@gmail.com, gshahrouzi@gmail.com, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org, Gustavo Piaz da Silva Subject: [PATCH v2] staging: axis-fifo: refactor device tree parsing Date: Sat, 31 Jan 2026 12:56:30 -0300 Message-ID: <20260131155630.41587-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. Also change has_rx_fifo and has_tx_fifo types from int to u32 in struct axi= s_fifo to avoid pointer type mismatch warnings, as of_property_read_u32 exp= ects u32 pointers. This change reduces the verbosity of the probe function and consolidates er= ror logging for missing properties. Signed-off-by: Gustavo Piaz da Silva --- Changes in v2: - Changed has_rx_fifo and has_tx_fifo to u32 in struct axis_fifo to avoid = casting. - Removed goto logic in axis_fifo_parse_dt() to simplify error handling. - Reverted unrelated changes in axis_fifo_remove(). - Wrapped commit message to 72 characters. drivers/staging/axis-fifo/axis-fifo.c | 79 +++++++++------------------ 1 file changed, 26 insertions(+), 53 deletions(-) diff --git a/drivers/staging/axis-fifo/axis-fifo.c b/drivers/staging/axis-f= ifo/axis-fifo.c index 509d620d6ce7..f46cd211d359 100644 --- a/drivers/staging/axis-fifo/axis-fifo.c +++ b/drivers/staging/axis-fifo/axis-fifo.c @@ -121,8 +121,8 @@ struct axis_fifo { =20 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 */ =20 wait_queue_head_t read_queue; /* wait queue for asynchronos read */ struct mutex read_lock; /* lock for reading */ @@ -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, "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