[PATCH net-next 00/12] net: stmmac: replace boolean fields in plat_stmmacenet_data with flags

Bartosz Golaszewski posted 12 patches 1 year, 4 months ago
There is a newer version of this series
.../stmicro/stmmac/dwmac-dwc-qos-eth.c        |  4 +-
.../net/ethernet/stmicro/stmmac/dwmac-intel.c | 23 +++++------
.../ethernet/stmicro/stmmac/dwmac-mediatek.c  |  5 ++-
.../stmicro/stmmac/dwmac-qcom-ethqos.c        |  8 ++--
.../net/ethernet/stmicro/stmmac/dwmac-sun8i.c |  2 +-
.../net/ethernet/stmicro/stmmac/dwmac-tegra.c |  4 +-
.../ethernet/stmicro/stmmac/stmmac_hwtstamp.c |  4 +-
.../net/ethernet/stmicro/stmmac/stmmac_main.c | 40 +++++++++++--------
.../net/ethernet/stmicro/stmmac/stmmac_pci.c  |  2 +-
.../ethernet/stmicro/stmmac/stmmac_platform.c | 10 +++--
.../net/ethernet/stmicro/stmmac/stmmac_ptp.c  |  5 ++-
include/linux/stmmac.h                        | 26 ++++++------
12 files changed, 76 insertions(+), 57 deletions(-)
[PATCH net-next 00/12] net: stmmac: replace boolean fields in plat_stmmacenet_data with flags
Posted by Bartosz Golaszewski 1 year, 4 months ago
From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>

As suggested by Jose Abreu: let's drop all 12 boolean fields in
plat_stmmacenet_data and replace them with a common bitfield.

Bartosz Golaszewski (12):
  net: stmmac: replace has_integrated_pcs field with a flag
  net: stmmac: replace the sph_disable field with a flag
  net: stmmac: replace the use_phy_wol field with a flag
  net: stmmac: replace the has_sun8i field with a flag
  net: stmmac: replace the tso_en field with a flag
  net: stmmac: replace the serdes_up_after_phy_linkup field with a flag
  net: stmmac: replace the vlan_fail_q_en field with a flag
  net: stmmac: replace the multi_msi_en field with a flag
  net: stmmac: replace the ext_snapshot_en field with a flag
  net: stmmac: replace the int_snapshot_en field with a flag
  net: stmmac: replace the rx_clk_runs_in_lpi field with a flag
  net: stmmac: replace the en_tx_lpi_clockgating field with a flag

 .../stmicro/stmmac/dwmac-dwc-qos-eth.c        |  4 +-
 .../net/ethernet/stmicro/stmmac/dwmac-intel.c | 23 +++++------
 .../ethernet/stmicro/stmmac/dwmac-mediatek.c  |  5 ++-
 .../stmicro/stmmac/dwmac-qcom-ethqos.c        |  8 ++--
 .../net/ethernet/stmicro/stmmac/dwmac-sun8i.c |  2 +-
 .../net/ethernet/stmicro/stmmac/dwmac-tegra.c |  4 +-
 .../ethernet/stmicro/stmmac/stmmac_hwtstamp.c |  4 +-
 .../net/ethernet/stmicro/stmmac/stmmac_main.c | 40 +++++++++++--------
 .../net/ethernet/stmicro/stmmac/stmmac_pci.c  |  2 +-
 .../ethernet/stmicro/stmmac/stmmac_platform.c | 10 +++--
 .../net/ethernet/stmicro/stmmac/stmmac_ptp.c  |  5 ++-
 include/linux/stmmac.h                        | 26 ++++++------
 12 files changed, 76 insertions(+), 57 deletions(-)

-- 
2.39.2
Re: [PATCH net-next 00/12] net: stmmac: replace boolean fields in plat_stmmacenet_data with flags
Posted by Jakub Kicinski 1 year, 4 months ago
On Wed, 21 Jun 2023 20:25:46 +0200 Bartosz Golaszewski wrote:
> As suggested by Jose Abreu: let's drop all 12 boolean fields in
> plat_stmmacenet_data and replace them with a common bitfield.

Is that what Jose meant, or:

-	bool has_integrated_pcs;
+	u32 has_integrated_pcs:1;

?
Re: [PATCH net-next 00/12] net: stmmac: replace boolean fields in plat_stmmacenet_data with flags
Posted by Bartosz Golaszewski 1 year, 4 months ago
On Wed, Jun 21, 2023 at 10:12 PM Jakub Kicinski <kuba@kernel.org> wrote:
>
> On Wed, 21 Jun 2023 20:25:46 +0200 Bartosz Golaszewski wrote:
> > As suggested by Jose Abreu: let's drop all 12 boolean fields in
> > plat_stmmacenet_data and replace them with a common bitfield.
>
> Is that what Jose meant, or:
>
> -       bool has_integrated_pcs;
> +       u32 has_integrated_pcs:1;
>
> ?

For that to work all fields would need to be gathered together (unless
the structure is __packed - not a good idea) and all future fields
would need to be added in a specific place in the structure definition
as well. I think a bit field is clearer and harder to get wrong here.

Bart