net: dsa: remove dsa_switch_alloc helper

Now that ports are dynamically listed in the fabric, there is no need
to provide a special helper to allocate the dsa_switch structure. This
will give more flexibility to drivers to embed this structure as they
wish in their private structure.

Signed-off-by: Vivien Didelot <vivien.didelot@gmail.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
This commit is contained in:
Vivien Didelot 2019-10-21 16:51:30 -04:00 committed by Jakub Kicinski
parent 05f294a852
commit 7e99e34701
14 changed files with 49 additions and 28 deletions

View file

@ -846,6 +846,12 @@ static int dsa_switch_probe(struct dsa_switch *ds)
struct device_node *np = ds->dev->of_node;
int err;
if (!ds->dev)
return -ENODEV;
if (!ds->num_ports)
return -EINVAL;
if (np)
err = dsa_switch_parse_of(ds, np);
else if (pdata)
@ -859,21 +865,6 @@ static int dsa_switch_probe(struct dsa_switch *ds)
return dsa_switch_add(ds);
}
struct dsa_switch *dsa_switch_alloc(struct device *dev, size_t n)
{
struct dsa_switch *ds;
ds = devm_kzalloc(dev, sizeof(*ds), GFP_KERNEL);
if (!ds)
return NULL;
ds->dev = dev;
ds->num_ports = n;
return ds;
}
EXPORT_SYMBOL_GPL(dsa_switch_alloc);
int dsa_register_switch(struct dsa_switch *ds)
{
int err;