Skip to content

Commit 0b2da3b

Browse files
sean-anderson-secoclaudiubeznea
authored andcommitted
net: convert users of bitmap_foo() to linkmode_foo()
This converts instances of bitmap_foo(args..., __ETHTOOL_LINK_MODE_MASK_NBITS) to linkmode_foo(args...) I manually fixed up some lines to prevent them from being excessively long. Otherwise, this change was generated with the following semantic patch: // Generated with // echo linux/linkmode.h > includes // git grep -Flf includes include/ | cut -f 2- -d / | cat includes - \ // | sort | uniq | tee new_includes | wc -l && mv new_includes includes // and repeating until the number stopped going up @i@ @@ ( #include <linux/acpi_mdio.h> | #include <linux/brcmphy.h> | #include <linux/dsa/loop.h> | #include <linux/dsa/sja1105.h> | #include <linux/ethtool.h> | #include <linux/ethtool_netlink.h> | #include <linux/fec.h> | #include <linux/fs_enet_pd.h> | #include <linux/fsl/enetc_mdio.h> | #include <linux/fwnode_mdio.h> | #include <linux/linkmode.h> | #include <linux/lsm_audit.h> | #include <linux/mdio-bitbang.h> | #include <linux/mdio.h> | #include <linux/mdio-mux.h> | #include <linux/mii.h> | #include <linux/mii_timestamper.h> | #include <linux/mlx5/accel.h> | #include <linux/mlx5/cq.h> | #include <linux/mlx5/device.h> | #include <linux/mlx5/driver.h> | #include <linux/mlx5/eswitch.h> | #include <linux/mlx5/fs.h> | #include <linux/mlx5/port.h> | #include <linux/mlx5/qp.h> | #include <linux/mlx5/rsc_dump.h> | #include <linux/mlx5/transobj.h> | #include <linux/mlx5/vport.h> | #include <linux/of_mdio.h> | #include <linux/of_net.h> | #include <linux/pcs-lynx.h> | #include <linux/pcs/pcs-xpcs.h> | #include <linux/phy.h> | #include <linux/phy_led_triggers.h> | #include <linux/phylink.h> | #include <linux/platform_data/bcmgenet.h> | #include <linux/platform_data/xilinx-ll-temac.h> | #include <linux/pxa168_eth.h> | #include <linux/qed/qed_eth_if.h> | #include <linux/qed/qed_fcoe_if.h> | #include <linux/qed/qed_if.h> | #include <linux/qed/qed_iov_if.h> | #include <linux/qed/qed_iscsi_if.h> | #include <linux/qed/qed_ll2_if.h> | #include <linux/qed/qed_nvmetcp_if.h> | #include <linux/qed/qed_rdma_if.h> | #include <linux/sfp.h> | #include <linux/sh_eth.h> | #include <linux/smsc911x.h> | #include <linux/soc/nxp/lpc32xx-misc.h> | #include <linux/stmmac.h> | #include <linux/sunrpc/svc_rdma.h> | #include <linux/sxgbe_platform.h> | #include <net/cfg80211.h> | #include <net/dsa.h> | #include <net/mac80211.h> | #include <net/selftests.h> | #include <rdma/ib_addr.h> | #include <rdma/ib_cache.h> | #include <rdma/ib_cm.h> | #include <rdma/ib_hdrs.h> | #include <rdma/ib_mad.h> | #include <rdma/ib_marshall.h> | #include <rdma/ib_pack.h> | #include <rdma/ib_pma.h> | #include <rdma/ib_sa.h> | #include <rdma/ib_smi.h> | #include <rdma/ib_umem.h> | #include <rdma/ib_umem_odp.h> | #include <rdma/ib_verbs.h> | #include <rdma/iw_cm.h> | #include <rdma/mr_pool.h> | #include <rdma/opa_addr.h> | #include <rdma/opa_port_info.h> | #include <rdma/opa_smi.h> | #include <rdma/opa_vnic.h> | #include <rdma/rdma_cm.h> | #include <rdma/rdma_cm_ib.h> | #include <rdma/rdmavt_cq.h> | #include <rdma/rdma_vt.h> | #include <rdma/rdmavt_qp.h> | #include <rdma/rw.h> | #include <rdma/tid_rdma_defs.h> | #include <rdma/uverbs_ioctl.h> | #include <rdma/uverbs_named_ioctl.h> | #include <rdma/uverbs_std_types.h> | #include <rdma/uverbs_types.h> | #include <soc/mscc/ocelot.h> | #include <soc/mscc/ocelot_ptp.h> | #include <soc/mscc/ocelot_vcap.h> | #include <trace/events/ib_mad.h> | #include <trace/events/rdma_core.h> | #include <trace/events/rdma.h> | #include <trace/events/rpcrdma.h> | #include <uapi/linux/ethtool.h> | #include <uapi/linux/ethtool_netlink.h> | #include <uapi/linux/mdio.h> | #include <uapi/linux/mii.h> ) @Depends on i@ expression list args; @@ ( - bitmap_zero(args, __ETHTOOL_LINK_MODE_MASK_NBITS) + linkmode_zero(args) | - bitmap_copy(args, __ETHTOOL_LINK_MODE_MASK_NBITS) + linkmode_copy(args) | - bitmap_and(args, __ETHTOOL_LINK_MODE_MASK_NBITS) + linkmode_and(args) | - bitmap_or(args, __ETHTOOL_LINK_MODE_MASK_NBITS) + linkmode_or(args) | - bitmap_empty(args, ETHTOOL_LINK_MODE_MASK_NBITS) + linkmode_empty(args) | - bitmap_andnot(args, __ETHTOOL_LINK_MODE_MASK_NBITS) + linkmode_andnot(args) | - bitmap_equal(args, __ETHTOOL_LINK_MODE_MASK_NBITS) + linkmode_equal(args) | - bitmap_intersects(args, __ETHTOOL_LINK_MODE_MASK_NBITS) + linkmode_intersects(args) | - bitmap_subset(args, __ETHTOOL_LINK_MODE_MASK_NBITS) + linkmode_subset(args) ) Add missing linux/mii.h include to mellanox. -DaveM Signed-off-by: Sean Anderson <sean.anderson@seco.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent f647d64 commit 0b2da3b

29 files changed

Lines changed: 87 additions & 133 deletions

File tree

drivers/net/dsa/b53/b53_common.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1349,10 +1349,8 @@ void b53_phylink_validate(struct dsa_switch *ds, int port,
13491349
phylink_set(mask, 100baseT_Full);
13501350
}
13511351

1352-
bitmap_and(supported, supported, mask,
1353-
__ETHTOOL_LINK_MODE_MASK_NBITS);
1354-
bitmap_and(state->advertising, state->advertising, mask,
1355-
__ETHTOOL_LINK_MODE_MASK_NBITS);
1352+
linkmode_and(supported, supported, mask);
1353+
linkmode_and(state->advertising, state->advertising, mask);
13561354

13571355
phylink_helper_basex_speed(state);
13581356
}

drivers/net/dsa/bcm_sf2.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -683,7 +683,7 @@ static void bcm_sf2_sw_validate(struct dsa_switch *ds, int port,
683683
state->interface != PHY_INTERFACE_MODE_GMII &&
684684
state->interface != PHY_INTERFACE_MODE_INTERNAL &&
685685
state->interface != PHY_INTERFACE_MODE_MOCA) {
686-
bitmap_zero(supported, __ETHTOOL_LINK_MODE_MASK_NBITS);
686+
linkmode_zero(supported);
687687
if (port != core_readl(priv, CORE_IMP0_PRT_ID))
688688
dev_err(ds->dev,
689689
"Unsupported interface: %d for port %d\n",
@@ -711,10 +711,8 @@ static void bcm_sf2_sw_validate(struct dsa_switch *ds, int port,
711711
phylink_set(mask, 100baseT_Half);
712712
phylink_set(mask, 100baseT_Full);
713713

714-
bitmap_and(supported, supported, mask,
715-
__ETHTOOL_LINK_MODE_MASK_NBITS);
716-
bitmap_and(state->advertising, state->advertising, mask,
717-
__ETHTOOL_LINK_MODE_MASK_NBITS);
714+
linkmode_and(supported, supported, mask);
715+
linkmode_and(state->advertising, state->advertising, mask);
718716
}
719717

720718
static void bcm_sf2_sw_mac_config(struct dsa_switch *ds, int port,

drivers/net/dsa/hirschmann/hellcreek.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1403,10 +1403,8 @@ static void hellcreek_phylink_validate(struct dsa_switch *ds, int port,
14031403
else
14041404
phylink_set(mask, 1000baseT_Full);
14051405

1406-
bitmap_and(supported, supported, mask,
1407-
__ETHTOOL_LINK_MODE_MASK_NBITS);
1408-
bitmap_and(state->advertising, state->advertising, mask,
1409-
__ETHTOOL_LINK_MODE_MASK_NBITS);
1406+
linkmode_and(supported, supported, mask);
1407+
linkmode_and(state->advertising, state->advertising, mask);
14101408
}
14111409

14121410
static int

drivers/net/dsa/lantiq_gswip.c

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1447,10 +1447,8 @@ static void gswip_phylink_set_capab(unsigned long *supported,
14471447
phylink_set(mask, 100baseT_Half);
14481448
phylink_set(mask, 100baseT_Full);
14491449

1450-
bitmap_and(supported, supported, mask,
1451-
__ETHTOOL_LINK_MODE_MASK_NBITS);
1452-
bitmap_and(state->advertising, state->advertising, mask,
1453-
__ETHTOOL_LINK_MODE_MASK_NBITS);
1450+
linkmode_and(supported, supported, mask);
1451+
linkmode_and(state->advertising, state->advertising, mask);
14541452
}
14551453

14561454
static void gswip_xrx200_phylink_validate(struct dsa_switch *ds, int port,
@@ -1478,7 +1476,7 @@ static void gswip_xrx200_phylink_validate(struct dsa_switch *ds, int port,
14781476
goto unsupported;
14791477
break;
14801478
default:
1481-
bitmap_zero(supported, __ETHTOOL_LINK_MODE_MASK_NBITS);
1479+
linkmode_zero(supported);
14821480
dev_err(ds->dev, "Unsupported port: %i\n", port);
14831481
return;
14841482
}
@@ -1488,7 +1486,7 @@ static void gswip_xrx200_phylink_validate(struct dsa_switch *ds, int port,
14881486
return;
14891487

14901488
unsupported:
1491-
bitmap_zero(supported, __ETHTOOL_LINK_MODE_MASK_NBITS);
1489+
linkmode_zero(supported);
14921490
dev_err(ds->dev, "Unsupported interface '%s' for port %d\n",
14931491
phy_modes(state->interface), port);
14941492
}
@@ -1518,7 +1516,7 @@ static void gswip_xrx300_phylink_validate(struct dsa_switch *ds, int port,
15181516
goto unsupported;
15191517
break;
15201518
default:
1521-
bitmap_zero(supported, __ETHTOOL_LINK_MODE_MASK_NBITS);
1519+
linkmode_zero(supported);
15221520
dev_err(ds->dev, "Unsupported port: %i\n", port);
15231521
return;
15241522
}
@@ -1528,7 +1526,7 @@ static void gswip_xrx300_phylink_validate(struct dsa_switch *ds, int port,
15281526
return;
15291527

15301528
unsupported:
1531-
bitmap_zero(supported, __ETHTOOL_LINK_MODE_MASK_NBITS);
1529+
linkmode_zero(supported);
15321530
dev_err(ds->dev, "Unsupported interface '%s' for port %d\n",
15331531
phy_modes(state->interface), port);
15341532
}

drivers/net/dsa/microchip/ksz8795.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1542,15 +1542,13 @@ static void ksz8_validate(struct dsa_switch *ds, int port,
15421542
phylink_set(mask, 100baseT_Half);
15431543
phylink_set(mask, 100baseT_Full);
15441544

1545-
bitmap_and(supported, supported, mask,
1546-
__ETHTOOL_LINK_MODE_MASK_NBITS);
1547-
bitmap_and(state->advertising, state->advertising, mask,
1548-
__ETHTOOL_LINK_MODE_MASK_NBITS);
1545+
linkmode_and(supported, supported, mask);
1546+
linkmode_and(state->advertising, state->advertising, mask);
15491547

15501548
return;
15511549

15521550
unsupported:
1553-
bitmap_zero(supported, __ETHTOOL_LINK_MODE_MASK_NBITS);
1551+
linkmode_zero(supported);
15541552
dev_err(ds->dev, "Unsupported interface: %s, port: %d\n",
15551553
phy_modes(state->interface), port);
15561554
}

drivers/net/dsa/mv88e6xxx/chip.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -683,9 +683,8 @@ static void mv88e6xxx_validate(struct dsa_switch *ds, int port,
683683
if (chip->info->ops->phylink_validate)
684684
chip->info->ops->phylink_validate(chip, port, mask, state);
685685

686-
bitmap_and(supported, supported, mask, __ETHTOOL_LINK_MODE_MASK_NBITS);
687-
bitmap_and(state->advertising, state->advertising, mask,
688-
__ETHTOOL_LINK_MODE_MASK_NBITS);
686+
linkmode_and(supported, supported, mask);
687+
linkmode_and(state->advertising, state->advertising, mask);
689688

690689
/* We can only operate at 2500BaseX or 1000BaseX. If requested
691690
* to advertise both, only report advertising at 2500BaseX.

drivers/net/dsa/ocelot/felix_vsc9959.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -943,7 +943,7 @@ static void vsc9959_phylink_validate(struct ocelot *ocelot, int port,
943943

944944
if (state->interface != PHY_INTERFACE_MODE_NA &&
945945
state->interface != ocelot_port->phy_mode) {
946-
bitmap_zero(supported, __ETHTOOL_LINK_MODE_MASK_NBITS);
946+
linkmode_zero(supported);
947947
return;
948948
}
949949

@@ -965,10 +965,8 @@ static void vsc9959_phylink_validate(struct ocelot *ocelot, int port,
965965
phylink_set(mask, 2500baseX_Full);
966966
}
967967

968-
bitmap_and(supported, supported, mask,
969-
__ETHTOOL_LINK_MODE_MASK_NBITS);
970-
bitmap_and(state->advertising, state->advertising, mask,
971-
__ETHTOOL_LINK_MODE_MASK_NBITS);
968+
linkmode_and(supported, supported, mask);
969+
linkmode_and(state->advertising, state->advertising, mask);
972970
}
973971

974972
static int vsc9959_prevalidate_phy_mode(struct ocelot *ocelot, int port,

drivers/net/dsa/ocelot/seville_vsc9953.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -999,7 +999,7 @@ static void vsc9953_phylink_validate(struct ocelot *ocelot, int port,
999999

10001000
if (state->interface != PHY_INTERFACE_MODE_NA &&
10011001
state->interface != ocelot_port->phy_mode) {
1002-
bitmap_zero(supported, __ETHTOOL_LINK_MODE_MASK_NBITS);
1002+
linkmode_zero(supported);
10031003
return;
10041004
}
10051005

@@ -1018,10 +1018,8 @@ static void vsc9953_phylink_validate(struct ocelot *ocelot, int port,
10181018
phylink_set(mask, 2500baseX_Full);
10191019
}
10201020

1021-
bitmap_and(supported, supported, mask,
1022-
__ETHTOOL_LINK_MODE_MASK_NBITS);
1023-
bitmap_and(state->advertising, state->advertising, mask,
1024-
__ETHTOOL_LINK_MODE_MASK_NBITS);
1021+
linkmode_and(supported, supported, mask);
1022+
linkmode_and(state->advertising, state->advertising, mask);
10251023
}
10261024

10271025
static int vsc9953_prevalidate_phy_mode(struct ocelot *ocelot, int port,

drivers/net/dsa/qca/ar9331.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -522,7 +522,7 @@ static void ar9331_sw_phylink_validate(struct dsa_switch *ds, int port,
522522
goto unsupported;
523523
break;
524524
default:
525-
bitmap_zero(supported, __ETHTOOL_LINK_MODE_MASK_NBITS);
525+
linkmode_zero(supported);
526526
dev_err(ds->dev, "Unsupported port: %i\n", port);
527527
return;
528528
}
@@ -536,15 +536,13 @@ static void ar9331_sw_phylink_validate(struct dsa_switch *ds, int port,
536536
phylink_set(mask, 100baseT_Half);
537537
phylink_set(mask, 100baseT_Full);
538538

539-
bitmap_and(supported, supported, mask,
540-
__ETHTOOL_LINK_MODE_MASK_NBITS);
541-
bitmap_and(state->advertising, state->advertising, mask,
542-
__ETHTOOL_LINK_MODE_MASK_NBITS);
539+
linkmode_and(supported, supported, mask);
540+
linkmode_and(state->advertising, state->advertising, mask);
543541

544542
return;
545543

546544
unsupported:
547-
bitmap_zero(supported, __ETHTOOL_LINK_MODE_MASK_NBITS);
545+
linkmode_zero(supported);
548546
dev_err(ds->dev, "Unsupported interface: %d, port: %d\n",
549547
state->interface, port);
550548
}

drivers/net/dsa/sja1105/sja1105_main.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1360,7 +1360,7 @@ static void sja1105_phylink_validate(struct dsa_switch *ds, int port,
13601360
*/
13611361
if (state->interface != PHY_INTERFACE_MODE_NA &&
13621362
sja1105_phy_mode_mismatch(priv, port, state->interface)) {
1363-
bitmap_zero(supported, __ETHTOOL_LINK_MODE_MASK_NBITS);
1363+
linkmode_zero(supported);
13641364
return;
13651365
}
13661366

@@ -1380,9 +1380,8 @@ static void sja1105_phylink_validate(struct dsa_switch *ds, int port,
13801380
phylink_set(mask, 2500baseX_Full);
13811381
}
13821382

1383-
bitmap_and(supported, supported, mask, __ETHTOOL_LINK_MODE_MASK_NBITS);
1384-
bitmap_and(state->advertising, state->advertising, mask,
1385-
__ETHTOOL_LINK_MODE_MASK_NBITS);
1383+
linkmode_and(supported, supported, mask);
1384+
linkmode_and(state->advertising, state->advertising, mask);
13861385
}
13871386

13881387
static int

0 commit comments

Comments
 (0)