From: Marc Kleine-Budde <mkl@pengutronix.de>
To: netdev@vger.kernel.org
Cc: davem@davemloft.net, kuba@kernel.org, linux-can@vger.kernel.org,
kernel@pengutronix.de,
Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>,
Vincent Mailhol <mailhol.vincent@wanadoo.fr>,
Marc Kleine-Budde <mkl@pengutronix.de>
Subject: [PATCH net-next 04/12] can: c_can: Use syscon_regmap_lookup_by_phandle_args
Date: Wed, 19 Feb 2025 12:21:09 +0100 [thread overview]
Message-ID: <20250219113354.529611-5-mkl@pengutronix.de> (raw)
In-Reply-To: <20250219113354.529611-1-mkl@pengutronix.de>
From: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Use syscon_regmap_lookup_by_phandle_args() which is a wrapper over
syscon_regmap_lookup_by_phandle() combined with getting the syscon
argument. Except simpler code this annotates within one line that given
phandle has arguments, so grepping for code would be easier.
There is also no real benefit in printing errors on missing syscon
argument, because this is done just too late: runtime check on
static/build-time data. Dtschema and Devicetree bindings offer the
static/build-time check for this already.
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Reviewed-by: Vincent Mailhol <mailhol.vincent@wanadoo.fr>
Link: https://patch.msgid.link/20250212-syscon-phandle-args-can-v2-4-ac9a1253396b@linaro.org
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
drivers/net/can/c_can/c_can_platform.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/drivers/net/can/c_can/c_can_platform.c b/drivers/net/can/c_can/c_can_platform.c
index 1acceb097c17..19c86b94a40e 100644
--- a/drivers/net/can/c_can/c_can_platform.c
+++ b/drivers/net/can/c_can/c_can_platform.c
@@ -317,30 +317,21 @@ static int c_can_plat_probe(struct platform_device *pdev)
* platforms. Only supported with DT boot.
*/
if (np && of_property_present(np, "syscon-raminit")) {
+ unsigned int args[2];
u32 id;
struct c_can_raminit *raminit = &priv->raminit_sys;
ret = -EINVAL;
- raminit->syscon = syscon_regmap_lookup_by_phandle(np,
- "syscon-raminit");
+ raminit->syscon = syscon_regmap_lookup_by_phandle_args(np,
+ "syscon-raminit",
+ 2, args);
if (IS_ERR(raminit->syscon)) {
ret = PTR_ERR(raminit->syscon);
goto exit_free_device;
}
- if (of_property_read_u32_index(np, "syscon-raminit", 1,
- &raminit->reg)) {
- dev_err(&pdev->dev,
- "couldn't get the RAMINIT reg. offset!\n");
- goto exit_free_device;
- }
-
- if (of_property_read_u32_index(np, "syscon-raminit", 2,
- &id)) {
- dev_err(&pdev->dev,
- "couldn't get the CAN instance ID\n");
- goto exit_free_device;
- }
+ raminit->reg = args[0];
+ id = args[1];
if (id >= drvdata->raminit_num) {
dev_err(&pdev->dev,
--
2.47.2
next prev parent reply other threads:[~2025-02-19 11:34 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-19 11:21 [PATCH net-next 0/12] pull-request: can-next 2025-02-19 Marc Kleine-Budde
2025-02-19 11:21 ` [PATCH net-next 01/12] can: c_can: Drop useless final probe failure message Marc Kleine-Budde
2025-02-20 9:40 ` patchwork-bot+netdevbpf
2025-02-19 11:21 ` [PATCH net-next 02/12] can: c_can: Simplify handling syscon error path Marc Kleine-Budde
2025-02-19 11:21 ` [PATCH net-next 03/12] can: c_can: Use of_property_present() to test existence of DT property Marc Kleine-Budde
2025-02-19 11:21 ` Marc Kleine-Budde [this message]
2025-02-19 11:21 ` [PATCH net-next 05/12] dt-bindings: can: fsl,flexcan: add S32G2/S32G3 SoC support Marc Kleine-Budde
2025-02-19 11:21 ` [PATCH net-next 06/12] can: flexcan: Add quirk to handle separate interrupt lines for mailboxes Marc Kleine-Budde
2025-02-19 11:21 ` [PATCH net-next 07/12] can: flexcan: add NXP S32G2/S32G3 SoC support Marc Kleine-Budde
2025-02-19 11:21 ` [PATCH net-next 08/12] dt-binding: can: mcp251xfd: remove duplicate word Marc Kleine-Budde
2025-02-19 11:21 ` [PATCH net-next 09/12] can: j1939: Extend stack documentation with buffer size behavior Marc Kleine-Budde
2025-02-19 11:21 ` [PATCH net-next 10/12] can: canxl: support Remote Request Substitution bit access Marc Kleine-Budde
2025-02-19 11:21 ` [PATCH net-next 11/12] can: gs_usb: add VID/PID for the CANnectivity firmware Marc Kleine-Budde
2025-02-19 11:21 ` [PATCH net-next 12/12] can: rockchip_canfd: rkcanfd_chip_fifo_setup(): remove duplicated setup of RX FIFO Marc Kleine-Budde
2025-02-20 9:23 ` [PATCH net-next 0/12] pull-request: can-next 2025-02-19 Paolo Abeni
2025-02-20 9:27 ` Marc Kleine-Budde
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250219113354.529611-5-mkl@pengutronix.de \
--to=mkl@pengutronix.de \
--cc=davem@davemloft.net \
--cc=kernel@pengutronix.de \
--cc=krzysztof.kozlowski@linaro.org \
--cc=kuba@kernel.org \
--cc=linux-can@vger.kernel.org \
--cc=mailhol.vincent@wanadoo.fr \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox