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>
This commit is contained in:
committed by
David S. Miller
parent
c7b7b483cc
commit
9d490b4ee4
@ -1378,7 +1378,7 @@ static enum dsa_tag_protocol b53_get_tag_protocol(struct dsa_switch *ds)
|
||||
return DSA_TAG_PROTO_NONE;
|
||||
}
|
||||
|
||||
static struct dsa_switch_driver b53_switch_ops = {
|
||||
static struct dsa_switch_ops b53_switch_ops = {
|
||||
.get_tag_protocol = b53_get_tag_protocol,
|
||||
.setup = b53_setup,
|
||||
.set_addr = b53_set_addr,
|
||||
@ -1618,7 +1618,7 @@ static int b53_switch_init(struct b53_device *dev)
|
||||
dev->vta_regs[1] = chip->vta_regs[1];
|
||||
dev->vta_regs[2] = chip->vta_regs[2];
|
||||
dev->jumbo_pm_reg = chip->jumbo_pm_reg;
|
||||
ds->drv = &b53_switch_ops;
|
||||
ds->ops = &b53_switch_ops;
|
||||
dev->cpu_port = chip->cpu_port;
|
||||
dev->num_vlans = chip->vlans;
|
||||
dev->num_arl_entries = chip->arl_entries;
|
||||
|
@ -1581,7 +1581,7 @@ static int bcm_sf2_sw_setup(struct dsa_switch *ds)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct dsa_switch_driver bcm_sf2_switch_driver = {
|
||||
static struct dsa_switch_ops bcm_sf2_switch_ops = {
|
||||
.setup = bcm_sf2_sw_setup,
|
||||
.get_tag_protocol = bcm_sf2_sw_get_tag_protocol,
|
||||
.set_addr = bcm_sf2_sw_set_addr,
|
||||
@ -1632,7 +1632,7 @@ static int bcm_sf2_sw_probe(struct platform_device *pdev)
|
||||
priv = (struct bcm_sf2_priv *)(ds + 1);
|
||||
ds->priv = priv;
|
||||
ds->dev = &pdev->dev;
|
||||
ds->drv = &bcm_sf2_switch_driver;
|
||||
ds->ops = &bcm_sf2_switch_ops;
|
||||
|
||||
dev_set_drvdata(&pdev->dev, ds);
|
||||
|
||||
|
@ -252,7 +252,7 @@ mv88e6060_phy_write(struct dsa_switch *ds, int port, int regnum, u16 val)
|
||||
return reg_write(ds, addr, regnum, val);
|
||||
}
|
||||
|
||||
static struct dsa_switch_driver mv88e6060_switch_driver = {
|
||||
static struct dsa_switch_ops mv88e6060_switch_ops = {
|
||||
.get_tag_protocol = mv88e6060_get_tag_protocol,
|
||||
.probe = mv88e6060_drv_probe,
|
||||
.setup = mv88e6060_setup,
|
||||
@ -263,14 +263,14 @@ static struct dsa_switch_driver mv88e6060_switch_driver = {
|
||||
|
||||
static int __init mv88e6060_init(void)
|
||||
{
|
||||
register_switch_driver(&mv88e6060_switch_driver);
|
||||
register_switch_driver(&mv88e6060_switch_ops);
|
||||
return 0;
|
||||
}
|
||||
module_init(mv88e6060_init);
|
||||
|
||||
static void __exit mv88e6060_cleanup(void)
|
||||
{
|
||||
unregister_switch_driver(&mv88e6060_switch_driver);
|
||||
unregister_switch_driver(&mv88e6060_switch_ops);
|
||||
}
|
||||
module_exit(mv88e6060_cleanup);
|
||||
|
||||
|
@ -3976,7 +3976,7 @@ free:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static struct dsa_switch_driver mv88e6xxx_switch_driver = {
|
||||
static struct dsa_switch_ops mv88e6xxx_switch_ops = {
|
||||
.probe = mv88e6xxx_drv_probe,
|
||||
.get_tag_protocol = mv88e6xxx_get_tag_protocol,
|
||||
.setup = mv88e6xxx_setup,
|
||||
@ -4025,7 +4025,7 @@ static int mv88e6xxx_register_switch(struct mv88e6xxx_chip *chip,
|
||||
|
||||
ds->dev = dev;
|
||||
ds->priv = chip;
|
||||
ds->drv = &mv88e6xxx_switch_driver;
|
||||
ds->ops = &mv88e6xxx_switch_ops;
|
||||
|
||||
dev_set_drvdata(dev, ds);
|
||||
|
||||
@ -4118,7 +4118,7 @@ static struct mdio_driver mv88e6xxx_driver = {
|
||||
|
||||
static int __init mv88e6xxx_init(void)
|
||||
{
|
||||
register_switch_driver(&mv88e6xxx_switch_driver);
|
||||
register_switch_driver(&mv88e6xxx_switch_ops);
|
||||
return mdio_driver_register(&mv88e6xxx_driver);
|
||||
}
|
||||
module_init(mv88e6xxx_init);
|
||||
@ -4126,7 +4126,7 @@ module_init(mv88e6xxx_init);
|
||||
static void __exit mv88e6xxx_cleanup(void)
|
||||
{
|
||||
mdio_driver_unregister(&mv88e6xxx_driver);
|
||||
unregister_switch_driver(&mv88e6xxx_switch_driver);
|
||||
unregister_switch_driver(&mv88e6xxx_switch_ops);
|
||||
}
|
||||
module_exit(mv88e6xxx_cleanup);
|
||||
|
||||
|
Reference in New Issue
Block a user