diff options
Diffstat (limited to 'drivers/net/dsa/bcm_sf2.c')
| -rw-r--r-- | drivers/net/dsa/bcm_sf2.c | 14 | 
1 files changed, 13 insertions, 1 deletions
diff --git a/drivers/net/dsa/bcm_sf2.c b/drivers/net/dsa/bcm_sf2.c index 6ce9ec1283e0..7578a5c38df5 100644 --- a/drivers/net/dsa/bcm_sf2.c +++ b/drivers/net/dsa/bcm_sf2.c @@ -68,7 +68,7 @@ static unsigned int bcm_sf2_num_active_ports(struct dsa_switch *ds)  	struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds);  	unsigned int port, count = 0; -	for (port = 0; port < ARRAY_SIZE(priv->port_sts); port++) { +	for (port = 0; port < ds->num_ports; port++) {  		if (dsa_is_cpu_port(ds, port))  			continue;  		if (priv->port_sts[port].enabled) @@ -1512,6 +1512,9 @@ static int bcm_sf2_sw_remove(struct platform_device *pdev)  {  	struct bcm_sf2_priv *priv = platform_get_drvdata(pdev); +	if (!priv) +		return 0; +  	priv->wol_ports_mask = 0;  	/* Disable interrupts */  	bcm_sf2_intr_disable(priv); @@ -1523,6 +1526,8 @@ static int bcm_sf2_sw_remove(struct platform_device *pdev)  	if (priv->type == BCM7278_DEVICE_ID)  		reset_control_assert(priv->rcdev); +	platform_set_drvdata(pdev, NULL); +  	return 0;  } @@ -1530,6 +1535,9 @@ static void bcm_sf2_sw_shutdown(struct platform_device *pdev)  {  	struct bcm_sf2_priv *priv = platform_get_drvdata(pdev); +	if (!priv) +		return; +  	/* For a kernel about to be kexec'd we want to keep the GPHY on for a  	 * successful MDIO bus scan to occur. If we did turn off the GPHY  	 * before (e.g: port_disable), this will also power it back on. @@ -1538,6 +1546,10 @@ static void bcm_sf2_sw_shutdown(struct platform_device *pdev)  	 */  	if (priv->hw_params.num_gphy == 1)  		bcm_sf2_gphy_enable_set(priv->dev->ds, true); + +	dsa_switch_shutdown(priv->dev->ds); + +	platform_set_drvdata(pdev, NULL);  }  #ifdef CONFIG_PM_SLEEP  | 
