net: dsa: Make dsa_switch_ops const
authorFlorian Fainelli <f.fainelli@gmail.com>
Sun, 8 Jan 2017 22:52:08 +0000 (14:52 -0800)
committerDavid S. Miller <davem@davemloft.net>
Mon, 9 Jan 2017 20:44:50 +0000 (15:44 -0500)
Now that we have properly encapsulated and made drivers utilize exported
functions, we can switch dsa_switch_ops to be a annotated with const.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/dsa/b53/b53_common.c
drivers/net/dsa/bcm_sf2.c
drivers/net/dsa/mv88e6060.c
drivers/net/dsa/mv88e6xxx/chip.c
drivers/net/dsa/qca8k.c
include/net/dsa.h
net/dsa/dsa.c
net/dsa/hwmon.c

index a448661b55c602c6f913438eed83906781429f24..5102a3701a1a790c49d3d3841d1abcf4d3865c1d 100644 (file)
@@ -1453,7 +1453,7 @@ static enum dsa_tag_protocol b53_get_tag_protocol(struct dsa_switch *ds)
        return DSA_TAG_PROTO_NONE;
 }
 
-static struct dsa_switch_ops b53_switch_ops = {
+static const struct dsa_switch_ops b53_switch_ops = {
        .get_tag_protocol       = b53_get_tag_protocol,
        .setup                  = b53_setup,
        .get_strings            = b53_get_strings,
index 52027718d06facf8f14faa6e9f977fe8cfc8cfce..31d017086f8b39508d176778e8b0836b4fbf5a37 100644 (file)
@@ -977,7 +977,7 @@ static struct b53_io_ops bcm_sf2_io_ops = {
        .write64 = bcm_sf2_core_write64,
 };
 
-static struct dsa_switch_ops bcm_sf2_ops = {
+static const struct dsa_switch_ops bcm_sf2_ops = {
        .get_tag_protocol       = bcm_sf2_sw_get_tag_protocol,
        .setup                  = bcm_sf2_sw_setup,
        .get_strings            = b53_get_strings,
index bcbd6dcbd8e816160fa2b332d5ec864653180cc1..5934b7a4c448e9654c1a8ea5ef147756d5d56fe1 100644 (file)
@@ -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_ops mv88e6060_switch_ops = {
+static const struct dsa_switch_ops mv88e6060_switch_ops = {
        .get_tag_protocol = mv88e6060_get_tag_protocol,
        .probe          = mv88e6060_drv_probe,
        .setup          = mv88e6060_setup,
index d43d12c281b3942f632c7d449e650d6c8004a993..eea8e0176e33819fdf2dcdf2191f390ad5c0f52b 100644 (file)
@@ -4361,7 +4361,7 @@ static int mv88e6xxx_port_mdb_dump(struct dsa_switch *ds, int port,
        return err;
 }
 
-static struct dsa_switch_ops mv88e6xxx_switch_ops = {
+static const struct dsa_switch_ops mv88e6xxx_switch_ops = {
        .probe                  = mv88e6xxx_drv_probe,
        .get_tag_protocol       = mv88e6xxx_get_tag_protocol,
        .setup                  = mv88e6xxx_setup,
index b3df70d07ff632f85517968716248f751ce59836..54d270d59eb0d920aed9fd5b706a0951f364179e 100644 (file)
@@ -911,7 +911,7 @@ qca8k_get_tag_protocol(struct dsa_switch *ds)
        return DSA_TAG_PROTO_QCA;
 }
 
-static struct dsa_switch_ops qca8k_switch_ops = {
+static const struct dsa_switch_ops qca8k_switch_ops = {
        .get_tag_protocol       = qca8k_get_tag_protocol,
        .setup                  = qca8k_setup,
        .get_strings            = qca8k_get_strings,
index edfa9b130953288808d7840954003347cc971ea6..b94d1f2ef9127f267a8fa01722c638208e8a169c 100644 (file)
@@ -169,7 +169,7 @@ struct dsa_switch {
        /*
         * The switch operations.
         */
-       struct dsa_switch_ops   *ops;
+       const struct dsa_switch_ops     *ops;
 
        /*
         * An array of which element [a] indicates which port on this
@@ -390,7 +390,7 @@ struct dsa_switch_ops {
 
 struct dsa_switch_driver {
        struct list_head        list;
-       struct dsa_switch_ops   *ops;
+       const struct dsa_switch_ops *ops;
 };
 
 void register_switch_driver(struct dsa_switch_driver *type);
index 4e7bc57cdae53273e3db45e0f6563ee685da6671..fd532487dfdfd16979288d20bcad6a47c7b33850 100644 (file)
@@ -76,11 +76,11 @@ void unregister_switch_driver(struct dsa_switch_driver *drv)
 }
 EXPORT_SYMBOL_GPL(unregister_switch_driver);
 
-static struct dsa_switch_ops *
+static const struct dsa_switch_ops *
 dsa_switch_probe(struct device *parent, struct device *host_dev, int sw_addr,
                 const char **_name, void **priv)
 {
-       struct dsa_switch_ops *ret;
+       const struct dsa_switch_ops *ret;
        struct list_head *list;
        const char *name;
 
@@ -89,7 +89,7 @@ dsa_switch_probe(struct device *parent, struct device *host_dev, int sw_addr,
 
        mutex_lock(&dsa_switch_drivers_mutex);
        list_for_each(list, &dsa_switch_drivers) {
-               struct dsa_switch_ops *ops;
+               const struct dsa_switch_ops *ops;
                struct dsa_switch_driver *drv;
 
                drv = list_entry(list, struct dsa_switch_driver, list);
@@ -207,7 +207,7 @@ void dsa_cpu_port_ethtool_restore(struct dsa_switch *ds)
 
 static int dsa_switch_setup_one(struct dsa_switch *ds, struct device *parent)
 {
-       struct dsa_switch_ops *ops = ds->ops;
+       const struct dsa_switch_ops *ops = ds->ops;
        struct dsa_switch_tree *dst = ds->dst;
        struct dsa_chip_data *cd = ds->cd;
        bool valid_name_found = false;
@@ -326,7 +326,7 @@ dsa_switch_setup(struct dsa_switch_tree *dst, int index,
                 struct device *parent, struct device *host_dev)
 {
        struct dsa_chip_data *cd = dst->pd->chip + index;
-       struct dsa_switch_ops *ops;
+       const struct dsa_switch_ops *ops;
        struct dsa_switch *ds;
        int ret;
        const char *name;
index 3a9cdf0b22b8d363cf443c3c6d8c47f7b521f5c3..08831a81127815bc4beb1c949f86f72fa363b3ef 100644 (file)
@@ -86,7 +86,7 @@ static umode_t dsa_hwmon_attrs_visible(struct kobject *kobj,
 {
        struct device *dev = container_of(kobj, struct device, kobj);
        struct dsa_switch *ds = dev_get_drvdata(dev);
-       struct dsa_switch_ops *ops = ds->ops;
+       const struct dsa_switch_ops *ops = ds->ops;
        umode_t mode = attr->mode;
 
        if (index == 1) {