summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/net/ethernet/micrel/ks8851.c50
-rw-r--r--include/linux/cpumask.h2
-rw-r--r--lib/cpumask.c64
3 files changed, 28 insertions, 88 deletions
diff --git a/drivers/net/ethernet/micrel/ks8851.c b/drivers/net/ethernet/micrel/ks8851.c
index 66d4ab703f45..e72918970a58 100644
--- a/drivers/net/ethernet/micrel/ks8851.c
+++ b/drivers/net/ethernet/micrel/ks8851.c
@@ -1441,30 +1441,32 @@ static int ks8851_probe(struct spi_device *spi)
}
}
- ks->vdd_io = devm_regulator_get(&spi->dev, "vdd-io");
+ ks->vdd_io = devm_regulator_get_optional(&spi->dev, "vdd-io");
if (IS_ERR(ks->vdd_io)) {
ret = PTR_ERR(ks->vdd_io);
- goto err_reg_io;
- }
-
- ret = regulator_enable(ks->vdd_io);
- if (ret) {
- dev_err(&spi->dev, "regulator vdd_io enable fail: %d\n",
- ret);
- goto err_reg_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;
+ }
}
- ks->vdd_reg = devm_regulator_get(&spi->dev, "vdd");
+ ks->vdd_reg = devm_regulator_get_optional(&spi->dev, "vdd");
if (IS_ERR(ks->vdd_reg)) {
ret = PTR_ERR(ks->vdd_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 (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;
+ }
}
if (gpio_is_valid(gpio)) {
@@ -1570,9 +1572,11 @@ err_irq:
if (gpio_is_valid(gpio))
gpio_set_value(gpio, 0);
err_id:
- regulator_disable(ks->vdd_reg);
+ if (!IS_ERR(ks->vdd_reg))
+ regulator_disable(ks->vdd_reg);
err_reg:
- regulator_disable(ks->vdd_io);
+ if (!IS_ERR(ks->vdd_io))
+ regulator_disable(ks->vdd_io);
err_reg_io:
err_gpio:
free_netdev(ndev);
@@ -1590,8 +1594,10 @@ 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);
- regulator_disable(priv->vdd_reg);
- regulator_disable(priv->vdd_io);
+ if (!IS_ERR(priv->vdd_reg))
+ regulator_disable(priv->vdd_reg);
+ if (!IS_ERR(priv->vdd_io))
+ regulator_disable(priv->vdd_io);
free_netdev(priv->netdev);
return 0;
diff --git a/include/linux/cpumask.h b/include/linux/cpumask.h
index 3551d667ef9f..d08e4d2a9b92 100644
--- a/include/linux/cpumask.h
+++ b/include/linux/cpumask.h
@@ -257,8 +257,6 @@ static inline void cpumask_set_cpu(unsigned int cpu, struct cpumask *dstp)
set_bit(cpumask_check(cpu), cpumask_bits(dstp));
}
-int cpumask_set_cpu_local_first(int i, int numa_node, cpumask_t *dstp);
-
/**
* cpumask_clear_cpu - clear a cpu in a cpumask
* @cpu: cpu number (< nr_cpu_ids)
diff --git a/lib/cpumask.c b/lib/cpumask.c
index 14049a96f04a..b810b753c607 100644
--- a/lib/cpumask.c
+++ b/lib/cpumask.c
@@ -163,68 +163,4 @@ void __init free_bootmem_cpumask_var(cpumask_var_t mask)
{
memblock_free_early(__pa(mask), cpumask_size());
}
-
-/**
- * cpumask_set_cpu_local_first - set i'th cpu with local numa cpu's first
- *
- * @i: index number
- * @numa_node: local numa_node
- * @dstp: cpumask with the relevant cpu bit set according to the policy
- *
- * This function sets the cpumask according to a numa aware policy.
- * cpumask could be used as an affinity hint for the IRQ related to a
- * queue. When the policy is to spread queues across cores - local cores
- * first.
- *
- * Returns 0 on success, -ENOMEM for no memory, and -EAGAIN when failed to set
- * the cpu bit and need to re-call the function.
- */
-int cpumask_set_cpu_local_first(int i, int numa_node, cpumask_t *dstp)
-{
- cpumask_var_t mask;
- int cpu;
- int ret = 0;
-
- if (!zalloc_cpumask_var(&mask, GFP_KERNEL))
- return -ENOMEM;
-
- i %= num_online_cpus();
-
- if (!cpumask_of_node(numa_node)) {
- /* Use all online cpu's for non numa aware system */
- cpumask_copy(mask, cpu_online_mask);
- } else {
- int n;
-
- cpumask_and(mask,
- cpumask_of_node(numa_node), cpu_online_mask);
-
- n = cpumask_weight(mask);
- if (i >= n) {
- i -= n;
-
- /* If index > number of local cpu's, mask out local
- * cpu's
- */
- cpumask_andnot(mask, cpu_online_mask, mask);
- }
- }
-
- for_each_cpu(cpu, mask) {
- if (--i < 0)
- goto out;
- }
-
- ret = -EAGAIN;
-
-out:
- free_cpumask_var(mask);
-
- if (!ret)
- cpumask_set_cpu(cpu, dstp);
-
- return ret;
-}
-EXPORT_SYMBOL(cpumask_set_cpu_local_first);
-
#endif