From: Bartosz Golaszewski <brgl@bgdev.pl>
To: 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>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Maxime Coquelin <mcoquelin.stm32@gmail.com>,
Vinod Koul <vkoul@kernel.org>,
Bhupesh Sharma <bhupesh.sharma@linaro.org>,
Chen-Yu Tsai <wens@csie.org>,
Jernej Skrabec <jernej.skrabec@gmail.com>,
Samuel Holland <samuel@sholland.org>,
Thierry Reding <thierry.reding@gmail.com>,
Jonathan Hunter <jonathanh@nvidia.com>,
Richard Cochran <richardcochran@gmail.com>,
Matthias Brugger <matthias.bgg@gmail.com>,
AngeloGioacchino Del Regno
<angelogioacchino.delregno@collabora.com>
Cc: netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, linux-sunxi@lists.linux.dev,
linux-tegra@vger.kernel.org, linux-mediatek@lists.infradead.org,
Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Subject: [PATCH net-next 01/12] net: stmmac: replace has_integrated_pcs field with a flag
Date: Wed, 21 Jun 2023 20:25:47 +0200 [thread overview]
Message-ID: <20230621182558.544417-2-brgl@bgdev.pl> (raw)
In-Reply-To: <20230621182558.544417-1-brgl@bgdev.pl>
From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
struct plat_stmmacenet_data contains several boolean fields that could be
easily replaced with a common integer 'flags' bitfield and bit defines.
Start the process with the has_integrated_pcs field.
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
---
drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c | 3 ++-
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 3 ++-
include/linux/stmmac.h | 4 +++-
3 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c
index fa0fc53c56a3..44151e69f9ce 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c
@@ -790,7 +790,8 @@ static int qcom_ethqos_probe(struct platform_device *pdev)
plat_dat->tso_en = of_property_read_bool(np, "snps,tso");
if (of_device_is_compatible(np, "qcom,qcs404-ethqos"))
plat_dat->rx_clk_runs_in_lpi = 1;
- plat_dat->has_integrated_pcs = data->has_integrated_pcs;
+ if (data->has_integrated_pcs)
+ plat_dat->flags |= STMMAC_FLAG_HAS_INTEGRATED_PCS;
if (ethqos->serdes_phy) {
plat_dat->serdes_powerup = qcom_ethqos_serdes_powerup;
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 4727f7be4f86..38b6cbd8a133 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -5798,7 +5798,8 @@ static void stmmac_common_interrupt(struct stmmac_priv *priv)
}
/* PCS link status */
- if (priv->hw->pcs && !priv->plat->has_integrated_pcs) {
+ if (priv->hw->pcs &&
+ !(priv->plat->flags & STMMAC_FLAG_HAS_INTEGRATED_PCS)) {
if (priv->xstats.pcs_link)
netif_carrier_on(priv->dev);
else
diff --git a/include/linux/stmmac.h b/include/linux/stmmac.h
index 06090538fe2d..8e7511071ef1 100644
--- a/include/linux/stmmac.h
+++ b/include/linux/stmmac.h
@@ -204,6 +204,8 @@ struct dwmac4_addrs {
u32 mtl_low_cred_offset;
};
+#define STMMAC_FLAG_HAS_INTEGRATED_PCS BIT(0)
+
struct plat_stmmacenet_data {
int bus_id;
int phy_addr;
@@ -293,6 +295,6 @@ struct plat_stmmacenet_data {
bool sph_disable;
bool serdes_up_after_phy_linkup;
const struct dwmac4_addrs *dwmac4_addrs;
- bool has_integrated_pcs;
+ unsigned int flags;
};
#endif
--
2.39.2
next prev parent reply other threads:[~2023-06-21 18:26 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-21 18:25 [PATCH net-next 00/12] net: stmmac: replace boolean fields in plat_stmmacenet_data with flags Bartosz Golaszewski
2023-06-21 18:25 ` Bartosz Golaszewski [this message]
2023-06-21 18:25 ` [PATCH net-next 02/12] net: stmmac: replace the sph_disable field with a flag Bartosz Golaszewski
2023-06-21 18:25 ` [PATCH net-next 03/12] net: stmmac: replace the use_phy_wol " Bartosz Golaszewski
2023-06-21 18:25 ` [PATCH net-next 04/12] net: stmmac: replace the has_sun8i " Bartosz Golaszewski
2023-06-21 18:25 ` [PATCH net-next 05/12] net: stmmac: replace the tso_en " Bartosz Golaszewski
2023-06-21 18:25 ` [PATCH net-next 06/12] net: stmmac: replace the serdes_up_after_phy_linkup " Bartosz Golaszewski
2023-06-21 18:25 ` [PATCH net-next 07/12] net: stmmac: replace the vlan_fail_q_en " Bartosz Golaszewski
2023-06-21 18:25 ` [PATCH net-next 08/12] net: stmmac: replace the multi_msi_en " Bartosz Golaszewski
2023-06-21 18:25 ` [PATCH net-next 09/12] net: stmmac: replace the ext_snapshot_en " Bartosz Golaszewski
2023-06-21 18:25 ` [PATCH net-next 10/12] net: stmmac: replace the int_snapshot_en " Bartosz Golaszewski
2023-06-21 23:30 ` kernel test robot
2023-06-22 13:10 ` Bartosz Golaszewski
2023-06-21 18:25 ` [PATCH net-next 11/12] net: stmmac: replace the rx_clk_runs_in_lpi " Bartosz Golaszewski
2023-06-21 18:25 ` [PATCH net-next 12/12] net: stmmac: replace the en_tx_lpi_clockgating " Bartosz Golaszewski
2023-06-21 20:12 ` [PATCH net-next 00/12] net: stmmac: replace boolean fields in plat_stmmacenet_data with flags Jakub Kicinski
2023-06-22 7:07 ` Bartosz Golaszewski
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=20230621182558.544417-2-brgl@bgdev.pl \
--to=brgl@bgdev.pl \
--cc=alexandre.torgue@foss.st.com \
--cc=angelogioacchino.delregno@collabora.com \
--cc=bartosz.golaszewski@linaro.org \
--cc=bhupesh.sharma@linaro.org \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=jernej.skrabec@gmail.com \
--cc=joabreu@synopsys.com \
--cc=jonathanh@nvidia.com \
--cc=kuba@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=linux-stm32@st-md-mailman.stormreply.com \
--cc=linux-sunxi@lists.linux.dev \
--cc=linux-tegra@vger.kernel.org \
--cc=matthias.bgg@gmail.com \
--cc=mcoquelin.stm32@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=peppe.cavallaro@st.com \
--cc=richardcochran@gmail.com \
--cc=samuel@sholland.org \
--cc=thierry.reding@gmail.com \
--cc=vkoul@kernel.org \
--cc=wens@csie.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;
as well as URLs for NNTP newsgroup(s).