From: Jakub Kicinski <kuba@kernel.org>
To: Sebastian Reichel <sebastian.reichel@collabora.com>
Cc: Giuseppe Cavallaro <peppe.cavallaro@st.com>,
Alexandre Torgue <alexandre.torgue@foss.st.com>,
Jose Abreu <joabreu@synopsys.com>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Paolo Abeni <pabeni@redhat.com>,
Maxime Coquelin <mcoquelin.stm32@gmail.com>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
kernel@collabora.com
Subject: Re: [PATCHv1 1/2] net: ethernet: stmmac: dwmac-rk: fix optional clock handling
Date: Tue, 21 Mar 2023 20:10:12 -0700 [thread overview]
Message-ID: <20230321201012.74487996@kernel.org> (raw)
In-Reply-To: <20230317174243.61500-2-sebastian.reichel@collabora.com>
On Fri, 17 Mar 2023 18:42:42 +0100 Sebastian Reichel wrote:
> - bsp_priv->mac_clk_rx = devm_clk_get(dev, "mac_clk_rx");
> + bsp_priv->mac_clk_rx = devm_clk_get_optional(dev, "mac_clk_rx");
> if (IS_ERR(bsp_priv->mac_clk_rx))
> - dev_err(dev, "cannot get clock %s\n",
> - "mac_clk_rx");
> + return dev_err_probe(dev, PTR_ERR(bsp_priv->mac_clk_rx),
> + "cannot get clock %s\n", "mac_clk_rx");
>
> - bsp_priv->mac_clk_tx = devm_clk_get(dev, "mac_clk_tx");
> + bsp_priv->mac_clk_tx = devm_clk_get_optional(dev, "mac_clk_tx");
> if (IS_ERR(bsp_priv->mac_clk_tx))
> - dev_err(dev, "cannot get clock %s\n",
> - "mac_clk_tx");
> + return dev_err_probe(dev, PTR_ERR(bsp_priv->mac_clk_tx),
> + "cannot get clock %s\n", "mac_clk_tx");
>
> - bsp_priv->aclk_mac = devm_clk_get(dev, "aclk_mac");
> + bsp_priv->aclk_mac = devm_clk_get_optional(dev, "aclk_mac");
> if (IS_ERR(bsp_priv->aclk_mac))
> - dev_err(dev, "cannot get clock %s\n",
> - "aclk_mac");
> + return dev_err_probe(dev, PTR_ERR(bsp_priv->aclk_mac),
> + "cannot get clock %s\n", "aclk_mac");
Can we turn this into a loop
struct {
struct whatever **ptr;
const char *name;
} clocks[] = {
{ &bsp_priv->mac_clk_rx, "mac_clk_rx" },
{ &bsp_priv->mac_clk_tx, "mac_clk_tx" },
...
}
for (i=0; i < ARRAY_SIZE...) {
*clocks[i]->ptr = devm_clk_get_optional(dev, clocks[i]->name);
if (IS_ERR(*clocks[i]->ptr))
return dev_err_probe(dev, PTR_ERR(*clocks[i]->ptr),
"cannot get clock %s\n",
*clocks[i]->name);
}
?
Or alternatively inline the name of the clock into the error message?
Right now the %s format printing looks neither here nor there, and also
the continuation line is misaligned (should start right under "dev").
FWIW seems like it should be fine for net-next without the fixes tag.
next prev parent reply other threads:[~2023-03-22 3:10 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-17 17:42 [PATCHv1 0/2] Fix RK3588 error prints Sebastian Reichel
2023-03-17 17:42 ` [PATCHv1 1/2] net: ethernet: stmmac: dwmac-rk: fix optional clock handling Sebastian Reichel
2023-03-17 18:24 ` Piotr Raczynski
2023-03-17 20:04 ` Sebastian Reichel
2023-03-22 3:10 ` Jakub Kicinski [this message]
2023-03-17 17:42 ` [PATCHv1 2/2] net: ethernet: stmmac: dwmac-rk: fix optional phy regulator handling Sebastian Reichel
2023-03-17 18:16 ` Piotr Raczynski
2023-03-17 20:12 ` Sebastian Reichel
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=20230321201012.74487996@kernel.org \
--to=kuba@kernel.org \
--cc=alexandre.torgue@foss.st.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=joabreu@synopsys.com \
--cc=kernel@collabora.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mcoquelin.stm32@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=peppe.cavallaro@st.com \
--cc=sebastian.reichel@collabora.com \
/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;
as well as URLs for NNTP newsgroup(s).