diff options
author | Vivien Didelot <vivien.didelot@savoirfairelinux.com> | 2016-08-23 12:38:56 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2016-08-25 00:45:39 -0400 |
commit | 9d490b4ee4d7d495a4f4908ea998d2a7355e0807 (patch) | |
tree | cb628c4a13aa0c6140d1eef84b64af7059659398 /drivers/net/dsa | |
parent | c7b7b483ccc9d64ae577a04d490aa9a975afe891 (diff) |
net: dsa: rename switch operations structure
Now that the dsa_switch_driver structure contains only function pointers
as it is supposed to, rename it to the more appropriate dsa_switch_ops,
uniformly to any other operations structure in the kernel.
No functional changes here, basically just the result of something like:
s/dsa_switch_driver *drv/dsa_switch_ops *ops/g
However keep the {un,}register_switch_driver functions and their
dsa_switch_drivers list as is, since they represent the -- likely to be
deprecated soon -- legacy DSA registration framework.
In the meantime, also fix the following checks from checkpatch.pl to
make it happy with this patch:
CHECK: Comparison to NULL could be written "!ops"
#403: FILE: net/dsa/dsa.c:470:
+ if (ops == NULL) {
CHECK: Comparison to NULL could be written "ds->ops->get_strings"
#773: FILE: net/dsa/slave.c:697:
+ if (ds->ops->get_strings != NULL)
CHECK: Comparison to NULL could be written "ds->ops->get_ethtool_stats"
#824: FILE: net/dsa/slave.c:785:
+ if (ds->ops->get_ethtool_stats != NULL)
CHECK: Comparison to NULL could be written "ds->ops->get_sset_count"
#835: FILE: net/dsa/slave.c:798:
+ if (ds->ops->get_sset_count != NULL)
total: 0 errors, 0 warnings, 4 checks, 784 lines checked
Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Acked-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/dsa')
-rw-r--r-- | drivers/net/dsa/b53/b53_common.c | 4 | ||||
-rw-r--r-- | drivers/net/dsa/bcm_sf2.c | 4 | ||||
-rw-r--r-- | drivers/net/dsa/mv88e6060.c | 6 | ||||
-rw-r--r-- | drivers/net/dsa/mv88e6xxx/chip.c | 8 |
4 files changed, 11 insertions, 11 deletions
diff --git a/drivers/net/dsa/b53/b53_common.c b/drivers/net/dsa/b53/b53_common.c index 65ecb51f99e5..6fb77cca78bb 100644 --- a/drivers/net/dsa/b53/b53_common.c +++ b/drivers/net/dsa/b53/b53_common.c | |||
@@ -1378,7 +1378,7 @@ static enum dsa_tag_protocol b53_get_tag_protocol(struct dsa_switch *ds) | |||
1378 | return DSA_TAG_PROTO_NONE; | 1378 | return DSA_TAG_PROTO_NONE; |
1379 | } | 1379 | } |
1380 | 1380 | ||
1381 | static struct dsa_switch_driver b53_switch_ops = { | 1381 | static struct dsa_switch_ops b53_switch_ops = { |
1382 | .get_tag_protocol = b53_get_tag_protocol, | 1382 | .get_tag_protocol = b53_get_tag_protocol, |
1383 | .setup = b53_setup, | 1383 | .setup = b53_setup, |
1384 | .set_addr = b53_set_addr, | 1384 | .set_addr = b53_set_addr, |
@@ -1618,7 +1618,7 @@ static int b53_switch_init(struct b53_device *dev) | |||
1618 | dev->vta_regs[1] = chip->vta_regs[1]; | 1618 | dev->vta_regs[1] = chip->vta_regs[1]; |
1619 | dev->vta_regs[2] = chip->vta_regs[2]; | 1619 | dev->vta_regs[2] = chip->vta_regs[2]; |
1620 | dev->jumbo_pm_reg = chip->jumbo_pm_reg; | 1620 | dev->jumbo_pm_reg = chip->jumbo_pm_reg; |
1621 | ds->drv = &b53_switch_ops; | 1621 | ds->ops = &b53_switch_ops; |
1622 | dev->cpu_port = chip->cpu_port; | 1622 | dev->cpu_port = chip->cpu_port; |
1623 | dev->num_vlans = chip->vlans; | 1623 | dev->num_vlans = chip->vlans; |
1624 | dev->num_arl_entries = chip->arl_entries; | 1624 | dev->num_arl_entries = chip->arl_entries; |
diff --git a/drivers/net/dsa/bcm_sf2.c b/drivers/net/dsa/bcm_sf2.c index b47a74b37a42..220e5d1948ca 100644 --- a/drivers/net/dsa/bcm_sf2.c +++ b/drivers/net/dsa/bcm_sf2.c | |||
@@ -1581,7 +1581,7 @@ static int bcm_sf2_sw_setup(struct dsa_switch *ds) | |||
1581 | return 0; | 1581 | return 0; |
1582 | } | 1582 | } |
1583 | 1583 | ||
1584 | static struct dsa_switch_driver bcm_sf2_switch_driver = { | 1584 | static struct dsa_switch_ops bcm_sf2_switch_ops = { |
1585 | .setup = bcm_sf2_sw_setup, | 1585 | .setup = bcm_sf2_sw_setup, |
1586 | .get_tag_protocol = bcm_sf2_sw_get_tag_protocol, | 1586 | .get_tag_protocol = bcm_sf2_sw_get_tag_protocol, |
1587 | .set_addr = bcm_sf2_sw_set_addr, | 1587 | .set_addr = bcm_sf2_sw_set_addr, |
@@ -1632,7 +1632,7 @@ static int bcm_sf2_sw_probe(struct platform_device *pdev) | |||
1632 | priv = (struct bcm_sf2_priv *)(ds + 1); | 1632 | priv = (struct bcm_sf2_priv *)(ds + 1); |
1633 | ds->priv = priv; | 1633 | ds->priv = priv; |
1634 | ds->dev = &pdev->dev; | 1634 | ds->dev = &pdev->dev; |
1635 | ds->drv = &bcm_sf2_switch_driver; | 1635 | ds->ops = &bcm_sf2_switch_ops; |
1636 | 1636 | ||
1637 | dev_set_drvdata(&pdev->dev, ds); | 1637 | dev_set_drvdata(&pdev->dev, ds); |
1638 | 1638 | ||
diff --git a/drivers/net/dsa/mv88e6060.c b/drivers/net/dsa/mv88e6060.c index 1fdfbf3a50bc..7ff9d373a9ee 100644 --- a/drivers/net/dsa/mv88e6060.c +++ b/drivers/net/dsa/mv88e6060.c | |||
@@ -252,7 +252,7 @@ mv88e6060_phy_write(struct dsa_switch *ds, int port, int regnum, u16 val) | |||
252 | return reg_write(ds, addr, regnum, val); | 252 | return reg_write(ds, addr, regnum, val); |
253 | } | 253 | } |
254 | 254 | ||
255 | static struct dsa_switch_driver mv88e6060_switch_driver = { | 255 | static struct dsa_switch_ops mv88e6060_switch_ops = { |
256 | .get_tag_protocol = mv88e6060_get_tag_protocol, | 256 | .get_tag_protocol = mv88e6060_get_tag_protocol, |
257 | .probe = mv88e6060_drv_probe, | 257 | .probe = mv88e6060_drv_probe, |
258 | .setup = mv88e6060_setup, | 258 | .setup = mv88e6060_setup, |
@@ -263,14 +263,14 @@ static struct dsa_switch_driver mv88e6060_switch_driver = { | |||
263 | 263 | ||
264 | static int __init mv88e6060_init(void) | 264 | static int __init mv88e6060_init(void) |
265 | { | 265 | { |
266 | register_switch_driver(&mv88e6060_switch_driver); | 266 | register_switch_driver(&mv88e6060_switch_ops); |
267 | return 0; | 267 | return 0; |
268 | } | 268 | } |
269 | module_init(mv88e6060_init); | 269 | module_init(mv88e6060_init); |
270 | 270 | ||
271 | static void __exit mv88e6060_cleanup(void) | 271 | static void __exit mv88e6060_cleanup(void) |
272 | { | 272 | { |
273 | unregister_switch_driver(&mv88e6060_switch_driver); | 273 | unregister_switch_driver(&mv88e6060_switch_ops); |
274 | } | 274 | } |
275 | module_exit(mv88e6060_cleanup); | 275 | module_exit(mv88e6060_cleanup); |
276 | 276 | ||
diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c index 82d45165803c..750d01d775e0 100644 --- a/drivers/net/dsa/mv88e6xxx/chip.c +++ b/drivers/net/dsa/mv88e6xxx/chip.c | |||
@@ -3976,7 +3976,7 @@ free: | |||
3976 | return NULL; | 3976 | return NULL; |
3977 | } | 3977 | } |
3978 | 3978 | ||
3979 | static struct dsa_switch_driver mv88e6xxx_switch_driver = { | 3979 | static struct dsa_switch_ops mv88e6xxx_switch_ops = { |
3980 | .probe = mv88e6xxx_drv_probe, | 3980 | .probe = mv88e6xxx_drv_probe, |
3981 | .get_tag_protocol = mv88e6xxx_get_tag_protocol, | 3981 | .get_tag_protocol = mv88e6xxx_get_tag_protocol, |
3982 | .setup = mv88e6xxx_setup, | 3982 | .setup = mv88e6xxx_setup, |
@@ -4025,7 +4025,7 @@ static int mv88e6xxx_register_switch(struct mv88e6xxx_chip *chip, | |||
4025 | 4025 | ||
4026 | ds->dev = dev; | 4026 | ds->dev = dev; |
4027 | ds->priv = chip; | 4027 | ds->priv = chip; |
4028 | ds->drv = &mv88e6xxx_switch_driver; | 4028 | ds->ops = &mv88e6xxx_switch_ops; |
4029 | 4029 | ||
4030 | dev_set_drvdata(dev, ds); | 4030 | dev_set_drvdata(dev, ds); |
4031 | 4031 | ||
@@ -4118,7 +4118,7 @@ static struct mdio_driver mv88e6xxx_driver = { | |||
4118 | 4118 | ||
4119 | static int __init mv88e6xxx_init(void) | 4119 | static int __init mv88e6xxx_init(void) |
4120 | { | 4120 | { |
4121 | register_switch_driver(&mv88e6xxx_switch_driver); | 4121 | register_switch_driver(&mv88e6xxx_switch_ops); |
4122 | return mdio_driver_register(&mv88e6xxx_driver); | 4122 | return mdio_driver_register(&mv88e6xxx_driver); |
4123 | } | 4123 | } |
4124 | module_init(mv88e6xxx_init); | 4124 | module_init(mv88e6xxx_init); |
@@ -4126,7 +4126,7 @@ module_init(mv88e6xxx_init); | |||
4126 | static void __exit mv88e6xxx_cleanup(void) | 4126 | static void __exit mv88e6xxx_cleanup(void) |
4127 | { | 4127 | { |
4128 | mdio_driver_unregister(&mv88e6xxx_driver); | 4128 | mdio_driver_unregister(&mv88e6xxx_driver); |
4129 | unregister_switch_driver(&mv88e6xxx_switch_driver); | 4129 | unregister_switch_driver(&mv88e6xxx_switch_ops); |
4130 | } | 4130 | } |
4131 | module_exit(mv88e6xxx_cleanup); | 4131 | module_exit(mv88e6xxx_cleanup); |
4132 | 4132 | ||