dsa.c (d71a756ad542c013e3ed5348db89f43ad105392e) dsa.c (f8b8b1cd5aadd221742b45eb0ee3c8a80abf036a)
1/*
2 * net/dsa/dsa.c - Hardware switch handling
3 * Copyright (c) 2008-2009 Marvell Semiconductor
4 * Copyright (c) 2013 Florian Fainelli <florian@openwrt.org>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or

--- 187 unchanged lines hidden (view full) ---

196 netif_receive_skb(skb);
197
198 return 0;
199}
200
201#ifdef CONFIG_PM_SLEEP
202static bool dsa_is_port_initialized(struct dsa_switch *ds, int p)
203{
1/*
2 * net/dsa/dsa.c - Hardware switch handling
3 * Copyright (c) 2008-2009 Marvell Semiconductor
4 * Copyright (c) 2013 Florian Fainelli <florian@openwrt.org>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or

--- 187 unchanged lines hidden (view full) ---

196 netif_receive_skb(skb);
197
198 return 0;
199}
200
201#ifdef CONFIG_PM_SLEEP
202static bool dsa_is_port_initialized(struct dsa_switch *ds, int p)
203{
204 return ds->enabled_port_mask & (1 << p) && ds->ports[p].netdev;
204 return ds->enabled_port_mask & (1 << p) && ds->ports[p].slave;
205}
206
207int dsa_switch_suspend(struct dsa_switch *ds)
208{
209 int i, ret = 0;
210
211 /* Suspend slave network devices */
212 for (i = 0; i < ds->num_ports; i++) {
213 if (!dsa_is_port_initialized(ds, i))
214 continue;
215
205}
206
207int dsa_switch_suspend(struct dsa_switch *ds)
208{
209 int i, ret = 0;
210
211 /* Suspend slave network devices */
212 for (i = 0; i < ds->num_ports; i++) {
213 if (!dsa_is_port_initialized(ds, i))
214 continue;
215
216 ret = dsa_slave_suspend(ds->ports[i].netdev);
216 ret = dsa_slave_suspend(ds->ports[i].slave);
217 if (ret)
218 return ret;
219 }
220
221 if (ds->ops->suspend)
222 ret = ds->ops->suspend(ds);
223
224 return ret;

--- 10 unchanged lines hidden (view full) ---

235 if (ret)
236 return ret;
237
238 /* Resume slave network devices */
239 for (i = 0; i < ds->num_ports; i++) {
240 if (!dsa_is_port_initialized(ds, i))
241 continue;
242
217 if (ret)
218 return ret;
219 }
220
221 if (ds->ops->suspend)
222 ret = ds->ops->suspend(ds);
223
224 return ret;

--- 10 unchanged lines hidden (view full) ---

235 if (ret)
236 return ret;
237
238 /* Resume slave network devices */
239 for (i = 0; i < ds->num_ports; i++) {
240 if (!dsa_is_port_initialized(ds, i))
241 continue;
242
243 ret = dsa_slave_resume(ds->ports[i].netdev);
243 ret = dsa_slave_resume(ds->ports[i].slave);
244 if (ret)
245 return ret;
246 }
247
248 return 0;
249}
250EXPORT_SYMBOL_GPL(dsa_switch_resume);
251#endif

--- 71 unchanged lines hidden ---
244 if (ret)
245 return ret;
246 }
247
248 return 0;
249}
250EXPORT_SYMBOL_GPL(dsa_switch_resume);
251#endif

--- 71 unchanged lines hidden ---