mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-03 07:26:45 +07:00
net: ks8851: Don't use regulator_get_optional()
We shouldn't be using regulator_get_optional() here. These regulators are always present as part of the physical design and there isn't any way to use an internal regulator or change the source of the reference voltage via software. Given that the only users of this driver in the kernel are DT based, this change should be transparent to them even if they don't specify any supplies because the regulator framework will insert dummy supplies as needed. Cc: Nishanth Menon <nm@ti.com> Cc: Mark Brown <broonie@kernel.org> Signed-off-by: Stephen Boyd <sboyd@codeaurora.org> Reviewed-by: Mark Brown <broonie@linaro.org> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
c532cea97a
commit
d64eed1d9b
@ -1441,32 +1441,30 @@ static int ks8851_probe(struct spi_device *spi)
|
||||
}
|
||||
}
|
||||
|
||||
ks->vdd_io = devm_regulator_get_optional(&spi->dev, "vdd-io");
|
||||
ks->vdd_io = devm_regulator_get(&spi->dev, "vdd-io");
|
||||
if (IS_ERR(ks->vdd_io)) {
|
||||
ret = PTR_ERR(ks->vdd_io);
|
||||
if (ret == -EPROBE_DEFER)
|
||||
goto err_reg_io;
|
||||
} else {
|
||||
ret = regulator_enable(ks->vdd_io);
|
||||
if (ret) {
|
||||
dev_err(&spi->dev, "regulator vdd_io enable fail: %d\n",
|
||||
ret);
|
||||
goto err_reg_io;
|
||||
}
|
||||
goto err_reg_io;
|
||||
}
|
||||
|
||||
ks->vdd_reg = devm_regulator_get_optional(&spi->dev, "vdd");
|
||||
ret = regulator_enable(ks->vdd_io);
|
||||
if (ret) {
|
||||
dev_err(&spi->dev, "regulator vdd_io enable fail: %d\n",
|
||||
ret);
|
||||
goto err_reg_io;
|
||||
}
|
||||
|
||||
ks->vdd_reg = devm_regulator_get(&spi->dev, "vdd");
|
||||
if (IS_ERR(ks->vdd_reg)) {
|
||||
ret = PTR_ERR(ks->vdd_reg);
|
||||
if (ret == -EPROBE_DEFER)
|
||||
goto err_reg;
|
||||
} else {
|
||||
ret = regulator_enable(ks->vdd_reg);
|
||||
if (ret) {
|
||||
dev_err(&spi->dev, "regulator vdd enable fail: %d\n",
|
||||
ret);
|
||||
goto err_reg;
|
||||
}
|
||||
goto err_reg;
|
||||
}
|
||||
|
||||
ret = regulator_enable(ks->vdd_reg);
|
||||
if (ret) {
|
||||
dev_err(&spi->dev, "regulator vdd enable fail: %d\n",
|
||||
ret);
|
||||
goto err_reg;
|
||||
}
|
||||
|
||||
if (gpio_is_valid(gpio)) {
|
||||
@ -1572,11 +1570,9 @@ static int ks8851_probe(struct spi_device *spi)
|
||||
if (gpio_is_valid(gpio))
|
||||
gpio_set_value(gpio, 0);
|
||||
err_id:
|
||||
if (!IS_ERR(ks->vdd_reg))
|
||||
regulator_disable(ks->vdd_reg);
|
||||
regulator_disable(ks->vdd_reg);
|
||||
err_reg:
|
||||
if (!IS_ERR(ks->vdd_io))
|
||||
regulator_disable(ks->vdd_io);
|
||||
regulator_disable(ks->vdd_io);
|
||||
err_reg_io:
|
||||
err_gpio:
|
||||
free_netdev(ndev);
|
||||
@ -1594,10 +1590,8 @@ static int ks8851_remove(struct spi_device *spi)
|
||||
free_irq(spi->irq, priv);
|
||||
if (gpio_is_valid(priv->gpio))
|
||||
gpio_set_value(priv->gpio, 0);
|
||||
if (!IS_ERR(priv->vdd_reg))
|
||||
regulator_disable(priv->vdd_reg);
|
||||
if (!IS_ERR(priv->vdd_io))
|
||||
regulator_disable(priv->vdd_io);
|
||||
regulator_disable(priv->vdd_reg);
|
||||
regulator_disable(priv->vdd_io);
|
||||
free_netdev(priv->netdev);
|
||||
|
||||
return 0;
|
||||
|
Loading…
Reference in New Issue
Block a user