diff options
Diffstat (limited to 'net/dsa')
| -rw-r--r-- | net/dsa/dsa.c | 47 | ||||
| -rw-r--r-- | net/dsa/dsa2.c | 4 | ||||
| -rw-r--r-- | net/dsa/legacy.c | 47 |
3 files changed, 50 insertions, 48 deletions
diff --git a/net/dsa/dsa.c b/net/dsa/dsa.c index 26130ae438da..90038d45a547 100644 --- a/net/dsa/dsa.c +++ b/net/dsa/dsa.c | |||
| @@ -223,6 +223,53 @@ static int dsa_switch_rcv(struct sk_buff *skb, struct net_device *dev, | |||
| 223 | return 0; | 223 | return 0; |
| 224 | } | 224 | } |
| 225 | 225 | ||
| 226 | #ifdef CONFIG_PM_SLEEP | ||
| 227 | int dsa_switch_suspend(struct dsa_switch *ds) | ||
| 228 | { | ||
| 229 | int i, ret = 0; | ||
| 230 | |||
| 231 | /* Suspend slave network devices */ | ||
| 232 | for (i = 0; i < ds->num_ports; i++) { | ||
| 233 | if (!dsa_is_port_initialized(ds, i)) | ||
| 234 | continue; | ||
| 235 | |||
| 236 | ret = dsa_slave_suspend(ds->ports[i].netdev); | ||
| 237 | if (ret) | ||
| 238 | return ret; | ||
| 239 | } | ||
| 240 | |||
| 241 | if (ds->ops->suspend) | ||
| 242 | ret = ds->ops->suspend(ds); | ||
| 243 | |||
| 244 | return ret; | ||
| 245 | } | ||
| 246 | EXPORT_SYMBOL_GPL(dsa_switch_suspend); | ||
| 247 | |||
| 248 | int dsa_switch_resume(struct dsa_switch *ds) | ||
| 249 | { | ||
| 250 | int i, ret = 0; | ||
| 251 | |||
| 252 | if (ds->ops->resume) | ||
| 253 | ret = ds->ops->resume(ds); | ||
| 254 | |||
| 255 | if (ret) | ||
| 256 | return ret; | ||
| 257 | |||
| 258 | /* Resume slave network devices */ | ||
| 259 | for (i = 0; i < ds->num_ports; i++) { | ||
| 260 | if (!dsa_is_port_initialized(ds, i)) | ||
| 261 | continue; | ||
| 262 | |||
| 263 | ret = dsa_slave_resume(ds->ports[i].netdev); | ||
| 264 | if (ret) | ||
| 265 | return ret; | ||
| 266 | } | ||
| 267 | |||
| 268 | return 0; | ||
| 269 | } | ||
| 270 | EXPORT_SYMBOL_GPL(dsa_switch_resume); | ||
| 271 | #endif | ||
| 272 | |||
| 226 | static struct packet_type dsa_pack_type __read_mostly = { | 273 | static struct packet_type dsa_pack_type __read_mostly = { |
| 227 | .type = cpu_to_be16(ETH_P_XDSA), | 274 | .type = cpu_to_be16(ETH_P_XDSA), |
| 228 | .func = dsa_switch_rcv, | 275 | .func = dsa_switch_rcv, |
diff --git a/net/dsa/dsa2.c b/net/dsa/dsa2.c index 033b3bfb63dc..7796580e99ee 100644 --- a/net/dsa/dsa2.c +++ b/net/dsa/dsa2.c | |||
| @@ -484,8 +484,10 @@ static void dsa_dst_unapply(struct dsa_switch_tree *dst) | |||
| 484 | dsa_ds_unapply(dst, ds); | 484 | dsa_ds_unapply(dst, ds); |
| 485 | } | 485 | } |
| 486 | 486 | ||
| 487 | if (dst->cpu_switch) | 487 | if (dst->cpu_switch) { |
| 488 | dsa_cpu_port_ethtool_restore(dst->cpu_switch); | 488 | dsa_cpu_port_ethtool_restore(dst->cpu_switch); |
| 489 | dst->cpu_switch = NULL; | ||
| 490 | } | ||
| 489 | 491 | ||
| 490 | pr_info("DSA: tree %d unapplied\n", dst->tree); | 492 | pr_info("DSA: tree %d unapplied\n", dst->tree); |
| 491 | dst->applied = false; | 493 | dst->applied = false; |
diff --git a/net/dsa/legacy.c b/net/dsa/legacy.c index ad345c8b0b06..7281098df04e 100644 --- a/net/dsa/legacy.c +++ b/net/dsa/legacy.c | |||
| @@ -289,53 +289,6 @@ static void dsa_switch_destroy(struct dsa_switch *ds) | |||
| 289 | dsa_switch_unregister_notifier(ds); | 289 | dsa_switch_unregister_notifier(ds); |
| 290 | } | 290 | } |
| 291 | 291 | ||
| 292 | #ifdef CONFIG_PM_SLEEP | ||
| 293 | int dsa_switch_suspend(struct dsa_switch *ds) | ||
| 294 | { | ||
| 295 | int i, ret = 0; | ||
| 296 | |||
| 297 | /* Suspend slave network devices */ | ||
| 298 | for (i = 0; i < ds->num_ports; i++) { | ||
| 299 | if (!dsa_is_port_initialized(ds, i)) | ||
| 300 | continue; | ||
| 301 | |||
| 302 | ret = dsa_slave_suspend(ds->ports[i].netdev); | ||
| 303 | if (ret) | ||
| 304 | return ret; | ||
| 305 | } | ||
| 306 | |||
| 307 | if (ds->ops->suspend) | ||
| 308 | ret = ds->ops->suspend(ds); | ||
| 309 | |||
| 310 | return ret; | ||
| 311 | } | ||
| 312 | EXPORT_SYMBOL_GPL(dsa_switch_suspend); | ||
| 313 | |||
| 314 | int dsa_switch_resume(struct dsa_switch *ds) | ||
| 315 | { | ||
| 316 | int i, ret = 0; | ||
| 317 | |||
| 318 | if (ds->ops->resume) | ||
| 319 | ret = ds->ops->resume(ds); | ||
| 320 | |||
| 321 | if (ret) | ||
| 322 | return ret; | ||
| 323 | |||
| 324 | /* Resume slave network devices */ | ||
| 325 | for (i = 0; i < ds->num_ports; i++) { | ||
| 326 | if (!dsa_is_port_initialized(ds, i)) | ||
| 327 | continue; | ||
| 328 | |||
| 329 | ret = dsa_slave_resume(ds->ports[i].netdev); | ||
| 330 | if (ret) | ||
| 331 | return ret; | ||
| 332 | } | ||
| 333 | |||
| 334 | return 0; | ||
| 335 | } | ||
| 336 | EXPORT_SYMBOL_GPL(dsa_switch_resume); | ||
| 337 | #endif | ||
| 338 | |||
| 339 | /* platform driver init and cleanup *****************************************/ | 292 | /* platform driver init and cleanup *****************************************/ |
| 340 | static int dev_is_class(struct device *dev, void *class) | 293 | static int dev_is_class(struct device *dev, void *class) |
| 341 | { | 294 | { |
