diff options
Diffstat (limited to 'drivers/net/ethernet/micrel')
-rw-r--r-- | drivers/net/ethernet/micrel/ks8851.c | 50 |
1 files changed, 22 insertions, 28 deletions
diff --git a/drivers/net/ethernet/micrel/ks8851.c b/drivers/net/ethernet/micrel/ks8851.c index e72918970a58..66d4ab703f45 100644 --- a/drivers/net/ethernet/micrel/ks8851.c +++ b/drivers/net/ethernet/micrel/ks8851.c | |||
@@ -1441,32 +1441,30 @@ static int ks8851_probe(struct spi_device *spi) | |||
1441 | } | 1441 | } |
1442 | } | 1442 | } |
1443 | 1443 | ||
1444 | ks->vdd_io = devm_regulator_get_optional(&spi->dev, "vdd-io"); | 1444 | ks->vdd_io = devm_regulator_get(&spi->dev, "vdd-io"); |
1445 | if (IS_ERR(ks->vdd_io)) { | 1445 | if (IS_ERR(ks->vdd_io)) { |
1446 | ret = PTR_ERR(ks->vdd_io); | 1446 | ret = PTR_ERR(ks->vdd_io); |
1447 | if (ret == -EPROBE_DEFER) | 1447 | goto err_reg_io; |
1448 | goto err_reg_io; | 1448 | } |
1449 | } else { | 1449 | |
1450 | ret = regulator_enable(ks->vdd_io); | 1450 | ret = regulator_enable(ks->vdd_io); |
1451 | if (ret) { | 1451 | if (ret) { |
1452 | dev_err(&spi->dev, "regulator vdd_io enable fail: %d\n", | 1452 | dev_err(&spi->dev, "regulator vdd_io enable fail: %d\n", |
1453 | ret); | 1453 | ret); |
1454 | goto err_reg_io; | 1454 | goto err_reg_io; |
1455 | } | ||
1456 | } | 1455 | } |
1457 | 1456 | ||
1458 | ks->vdd_reg = devm_regulator_get_optional(&spi->dev, "vdd"); | 1457 | ks->vdd_reg = devm_regulator_get(&spi->dev, "vdd"); |
1459 | if (IS_ERR(ks->vdd_reg)) { | 1458 | if (IS_ERR(ks->vdd_reg)) { |
1460 | ret = PTR_ERR(ks->vdd_reg); | 1459 | ret = PTR_ERR(ks->vdd_reg); |
1461 | if (ret == -EPROBE_DEFER) | 1460 | goto err_reg; |
1462 | goto err_reg; | 1461 | } |
1463 | } else { | 1462 | |
1464 | ret = regulator_enable(ks->vdd_reg); | 1463 | ret = regulator_enable(ks->vdd_reg); |
1465 | if (ret) { | 1464 | if (ret) { |
1466 | dev_err(&spi->dev, "regulator vdd enable fail: %d\n", | 1465 | dev_err(&spi->dev, "regulator vdd enable fail: %d\n", |
1467 | ret); | 1466 | ret); |
1468 | goto err_reg; | 1467 | goto err_reg; |
1469 | } | ||
1470 | } | 1468 | } |
1471 | 1469 | ||
1472 | if (gpio_is_valid(gpio)) { | 1470 | if (gpio_is_valid(gpio)) { |
@@ -1572,11 +1570,9 @@ err_irq: | |||
1572 | if (gpio_is_valid(gpio)) | 1570 | if (gpio_is_valid(gpio)) |
1573 | gpio_set_value(gpio, 0); | 1571 | gpio_set_value(gpio, 0); |
1574 | err_id: | 1572 | err_id: |
1575 | if (!IS_ERR(ks->vdd_reg)) | 1573 | regulator_disable(ks->vdd_reg); |
1576 | regulator_disable(ks->vdd_reg); | ||
1577 | err_reg: | 1574 | err_reg: |
1578 | if (!IS_ERR(ks->vdd_io)) | 1575 | regulator_disable(ks->vdd_io); |
1579 | regulator_disable(ks->vdd_io); | ||
1580 | err_reg_io: | 1576 | err_reg_io: |
1581 | err_gpio: | 1577 | err_gpio: |
1582 | free_netdev(ndev); | 1578 | free_netdev(ndev); |
@@ -1594,10 +1590,8 @@ static int ks8851_remove(struct spi_device *spi) | |||
1594 | free_irq(spi->irq, priv); | 1590 | free_irq(spi->irq, priv); |
1595 | if (gpio_is_valid(priv->gpio)) | 1591 | if (gpio_is_valid(priv->gpio)) |
1596 | gpio_set_value(priv->gpio, 0); | 1592 | gpio_set_value(priv->gpio, 0); |
1597 | if (!IS_ERR(priv->vdd_reg)) | 1593 | regulator_disable(priv->vdd_reg); |
1598 | regulator_disable(priv->vdd_reg); | 1594 | regulator_disable(priv->vdd_io); |
1599 | if (!IS_ERR(priv->vdd_io)) | ||
1600 | regulator_disable(priv->vdd_io); | ||
1601 | free_netdev(priv->netdev); | 1595 | free_netdev(priv->netdev); |
1602 | 1596 | ||
1603 | return 0; | 1597 | return 0; |