Skip to content

Commit

Permalink
net: dsa: Move dsa_switch_{suspend,resume} out of legacy.c
Browse files Browse the repository at this point in the history
dsa_switch_suspend() and dsa_switch_resume() are functions that belong in
net/dsa/dsa.c and are not part of the legacy platform support code.

Fixes: a6a71f1 ("net: dsa: isolate legacy code")
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Florian Fainelli authored and David S. Miller committed Jun 2, 2017
1 parent d31353c commit ac2629a
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 47 deletions.
47 changes: 47 additions & 0 deletions net/dsa/dsa.c
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,53 @@ static int dsa_switch_rcv(struct sk_buff *skb, struct net_device *dev,
return 0;
}

#ifdef CONFIG_PM_SLEEP
int dsa_switch_suspend(struct dsa_switch *ds)
{
int i, ret = 0;

/* Suspend slave network devices */
for (i = 0; i < ds->num_ports; i++) {
if (!dsa_is_port_initialized(ds, i))
continue;

ret = dsa_slave_suspend(ds->ports[i].netdev);
if (ret)
return ret;
}

if (ds->ops->suspend)
ret = ds->ops->suspend(ds);

return ret;
}
EXPORT_SYMBOL_GPL(dsa_switch_suspend);

int dsa_switch_resume(struct dsa_switch *ds)
{
int i, ret = 0;

if (ds->ops->resume)
ret = ds->ops->resume(ds);

if (ret)
return ret;

/* Resume slave network devices */
for (i = 0; i < ds->num_ports; i++) {
if (!dsa_is_port_initialized(ds, i))
continue;

ret = dsa_slave_resume(ds->ports[i].netdev);
if (ret)
return ret;
}

return 0;
}
EXPORT_SYMBOL_GPL(dsa_switch_resume);
#endif

static struct packet_type dsa_pack_type __read_mostly = {
.type = cpu_to_be16(ETH_P_XDSA),
.func = dsa_switch_rcv,
Expand Down
47 changes: 0 additions & 47 deletions net/dsa/legacy.c
Original file line number Diff line number Diff line change
Expand Up @@ -289,53 +289,6 @@ static void dsa_switch_destroy(struct dsa_switch *ds)
dsa_switch_unregister_notifier(ds);
}

#ifdef CONFIG_PM_SLEEP
int dsa_switch_suspend(struct dsa_switch *ds)
{
int i, ret = 0;

/* Suspend slave network devices */
for (i = 0; i < ds->num_ports; i++) {
if (!dsa_is_port_initialized(ds, i))
continue;

ret = dsa_slave_suspend(ds->ports[i].netdev);
if (ret)
return ret;
}

if (ds->ops->suspend)
ret = ds->ops->suspend(ds);

return ret;
}
EXPORT_SYMBOL_GPL(dsa_switch_suspend);

int dsa_switch_resume(struct dsa_switch *ds)
{
int i, ret = 0;

if (ds->ops->resume)
ret = ds->ops->resume(ds);

if (ret)
return ret;

/* Resume slave network devices */
for (i = 0; i < ds->num_ports; i++) {
if (!dsa_is_port_initialized(ds, i))
continue;

ret = dsa_slave_resume(ds->ports[i].netdev);
if (ret)
return ret;
}

return 0;
}
EXPORT_SYMBOL_GPL(dsa_switch_resume);
#endif

/* platform driver init and cleanup *****************************************/
static int dev_is_class(struct device *dev, void *class)
{
Expand Down

0 comments on commit ac2629a

Please sign in to comment.