aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2014-06-02 00:58:02 -0400
committerDavid S. Miller <davem@davemloft.net>2014-06-02 00:58:02 -0400
commitee39facbf82e73e468c504d2b40e83e2d223c28c (patch)
tree802451ae11344f94f66a8b922a5418095707517e
parent2a82e40d6b66373498bf937e31b249f17dc1105a (diff)
net: Revert mlx4 cpumask changes.
This reverts commit 70a640d0dae3a9b1b222ce673eb5d92c263ddd61 ("net/mlx4_en: Use affinity hint") and commit c8865b64b05b2f4eeefd369373e9c8aeb069e7a1 ("cpumask: Utility function to set n'th cpu - local cpu first") because these changes break the build when SMP is disabled amongst other things. Reported-by: Eric Dumazet <eric.dumazet@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-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)
1441 } 1441 }
1442 } 1442 }
1443 1443
1444 ks->vdd_io = devm_regulator_get(&spi->dev, "vdd-io"); 1444 ks->vdd_io = devm_regulator_get_optional(&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 goto err_reg_io; 1447 if (ret == -EPROBE_DEFER)
1448 } 1448 goto err_reg_io;
1449 1449 } else {
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 }
1455 } 1456 }
1456 1457
1457 ks->vdd_reg = devm_regulator_get(&spi->dev, "vdd"); 1458 ks->vdd_reg = devm_regulator_get_optional(&spi->dev, "vdd");
1458 if (IS_ERR(ks->vdd_reg)) { 1459 if (IS_ERR(ks->vdd_reg)) {
1459 ret = PTR_ERR(ks->vdd_reg); 1460 ret = PTR_ERR(ks->vdd_reg);
1460 goto err_reg; 1461 if (ret == -EPROBE_DEFER)
1461 } 1462 goto err_reg;
1462 1463 } else {
1463 ret = regulator_enable(ks->vdd_reg); 1464 ret = regulator_enable(ks->vdd_reg);
1464 if (ret) { 1465 if (ret) {
1465 dev_err(&spi->dev, "regulator vdd enable fail: %d\n", 1466 dev_err(&spi->dev, "regulator vdd enable fail: %d\n",
1466 ret); 1467 ret);
1467 goto err_reg; 1468 goto err_reg;
1469 }
1468 } 1470 }
1469 1471
1470 if (gpio_is_valid(gpio)) { 1472 if (gpio_is_valid(gpio)) {
@@ -1570,9 +1572,11 @@ err_irq:
1570 if (gpio_is_valid(gpio)) 1572 if (gpio_is_valid(gpio))
1571 gpio_set_value(gpio, 0); 1573 gpio_set_value(gpio, 0);
1572err_id: 1574err_id:
1573 regulator_disable(ks->vdd_reg); 1575 if (!IS_ERR(ks->vdd_reg))
1576 regulator_disable(ks->vdd_reg);
1574err_reg: 1577err_reg:
1575 regulator_disable(ks->vdd_io); 1578 if (!IS_ERR(ks->vdd_io))
1579 regulator_disable(ks->vdd_io);
1576err_reg_io: 1580err_reg_io:
1577err_gpio: 1581err_gpio:
1578 free_netdev(ndev); 1582 free_netdev(ndev);
@@ -1590,8 +1594,10 @@ static int ks8851_remove(struct spi_device *spi)
1590 free_irq(spi->irq, priv); 1594 free_irq(spi->irq, priv);
1591 if (gpio_is_valid(priv->gpio)) 1595 if (gpio_is_valid(priv->gpio))
1592 gpio_set_value(priv->gpio, 0); 1596 gpio_set_value(priv->gpio, 0);
1593 regulator_disable(priv->vdd_reg); 1597 if (!IS_ERR(priv->vdd_reg))
1594 regulator_disable(priv->vdd_io); 1598 regulator_disable(priv->vdd_reg);
1599 if (!IS_ERR(priv->vdd_io))
1600 regulator_disable(priv->vdd_io);
1595 free_netdev(priv->netdev); 1601 free_netdev(priv->netdev);
1596 1602
1597 return 0; 1603 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)
257 set_bit(cpumask_check(cpu), cpumask_bits(dstp)); 257 set_bit(cpumask_check(cpu), cpumask_bits(dstp));
258} 258}
259 259
260int cpumask_set_cpu_local_first(int i, int numa_node, cpumask_t *dstp);
261
262/** 260/**
263 * cpumask_clear_cpu - clear a cpu in a cpumask 261 * cpumask_clear_cpu - clear a cpu in a cpumask
264 * @cpu: cpu number (< nr_cpu_ids) 262 * @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)
163{ 163{
164 memblock_free_early(__pa(mask), cpumask_size()); 164 memblock_free_early(__pa(mask), cpumask_size());
165} 165}
166
167/**
168 * cpumask_set_cpu_local_first - set i'th cpu with local numa cpu's first
169 *
170 * @i: index number
171 * @numa_node: local numa_node
172 * @dstp: cpumask with the relevant cpu bit set according to the policy
173 *
174 * This function sets the cpumask according to a numa aware policy.
175 * cpumask could be used as an affinity hint for the IRQ related to a
176 * queue. When the policy is to spread queues across cores - local cores
177 * first.
178 *
179 * Returns 0 on success, -ENOMEM for no memory, and -EAGAIN when failed to set
180 * the cpu bit and need to re-call the function.
181 */
182int cpumask_set_cpu_local_first(int i, int numa_node, cpumask_t *dstp)
183{
184 cpumask_var_t mask;
185 int cpu;
186 int ret = 0;
187
188 if (!zalloc_cpumask_var(&mask, GFP_KERNEL))
189 return -ENOMEM;
190
191 i %= num_online_cpus();
192
193 if (!cpumask_of_node(numa_node)) {
194 /* Use all online cpu's for non numa aware system */
195 cpumask_copy(mask, cpu_online_mask);
196 } else {
197 int n;
198
199 cpumask_and(mask,
200 cpumask_of_node(numa_node), cpu_online_mask);
201
202 n = cpumask_weight(mask);
203 if (i >= n) {
204 i -= n;
205
206 /* If index > number of local cpu's, mask out local
207 * cpu's
208 */
209 cpumask_andnot(mask, cpu_online_mask, mask);
210 }
211 }
212
213 for_each_cpu(cpu, mask) {
214 if (--i < 0)
215 goto out;
216 }
217
218 ret = -EAGAIN;
219
220out:
221 free_cpumask_var(mask);
222
223 if (!ret)
224 cpumask_set_cpu(cpu, dstp);
225
226 return ret;
227}
228EXPORT_SYMBOL(cpumask_set_cpu_local_first);
229
230#endif 166#endif