diff options
author | Mike Travis <travis@sgi.com> | 2008-05-02 19:43:08 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-05-02 19:43:08 -0400 |
commit | 0c0b0aca66b3a58e12a216d992a0b534eff210e0 (patch) | |
tree | 50fb0434425411b1b70f8ca2057ba8fd6a347315 | |
parent | d3e2ce3bcdbf4319dea308c79b5f72a8ecc8015c (diff) |
net: remove NR_CPUS arrays in net/core/dev.c
Remove the fixed size channels[NR_CPUS] array in net/core/dev.c and
dynamically allocate array based on nr_cpu_ids.
Signed-off-by: Mike Travis <travis@sgi.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | net/core/dev.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/net/core/dev.c b/net/core/dev.c index ed49da592051..a9500e6b3aa2 100644 --- a/net/core/dev.c +++ b/net/core/dev.c | |||
@@ -162,7 +162,7 @@ struct net_dma { | |||
162 | struct dma_client client; | 162 | struct dma_client client; |
163 | spinlock_t lock; | 163 | spinlock_t lock; |
164 | cpumask_t channel_mask; | 164 | cpumask_t channel_mask; |
165 | struct dma_chan *channels[NR_CPUS]; | 165 | struct dma_chan **channels; |
166 | }; | 166 | }; |
167 | 167 | ||
168 | static enum dma_state_client | 168 | static enum dma_state_client |
@@ -2444,7 +2444,7 @@ static struct netif_rx_stats *softnet_get_online(loff_t *pos) | |||
2444 | { | 2444 | { |
2445 | struct netif_rx_stats *rc = NULL; | 2445 | struct netif_rx_stats *rc = NULL; |
2446 | 2446 | ||
2447 | while (*pos < NR_CPUS) | 2447 | while (*pos < nr_cpu_ids) |
2448 | if (cpu_online(*pos)) { | 2448 | if (cpu_online(*pos)) { |
2449 | rc = &per_cpu(netdev_rx_stat, *pos); | 2449 | rc = &per_cpu(netdev_rx_stat, *pos); |
2450 | break; | 2450 | break; |
@@ -4324,7 +4324,7 @@ netdev_dma_event(struct dma_client *client, struct dma_chan *chan, | |||
4324 | spin_lock(&net_dma->lock); | 4324 | spin_lock(&net_dma->lock); |
4325 | switch (state) { | 4325 | switch (state) { |
4326 | case DMA_RESOURCE_AVAILABLE: | 4326 | case DMA_RESOURCE_AVAILABLE: |
4327 | for (i = 0; i < NR_CPUS; i++) | 4327 | for (i = 0; i < nr_cpu_ids; i++) |
4328 | if (net_dma->channels[i] == chan) { | 4328 | if (net_dma->channels[i] == chan) { |
4329 | found = 1; | 4329 | found = 1; |
4330 | break; | 4330 | break; |
@@ -4339,7 +4339,7 @@ netdev_dma_event(struct dma_client *client, struct dma_chan *chan, | |||
4339 | } | 4339 | } |
4340 | break; | 4340 | break; |
4341 | case DMA_RESOURCE_REMOVED: | 4341 | case DMA_RESOURCE_REMOVED: |
4342 | for (i = 0; i < NR_CPUS; i++) | 4342 | for (i = 0; i < nr_cpu_ids; i++) |
4343 | if (net_dma->channels[i] == chan) { | 4343 | if (net_dma->channels[i] == chan) { |
4344 | found = 1; | 4344 | found = 1; |
4345 | pos = i; | 4345 | pos = i; |
@@ -4366,6 +4366,13 @@ netdev_dma_event(struct dma_client *client, struct dma_chan *chan, | |||
4366 | */ | 4366 | */ |
4367 | static int __init netdev_dma_register(void) | 4367 | static int __init netdev_dma_register(void) |
4368 | { | 4368 | { |
4369 | net_dma.channels = kzalloc(nr_cpu_ids * sizeof(struct net_dma), | ||
4370 | GFP_KERNEL); | ||
4371 | if (unlikely(!net_dma.channels)) { | ||
4372 | printk(KERN_NOTICE | ||
4373 | "netdev_dma: no memory for net_dma.channels\n"); | ||
4374 | return -ENOMEM; | ||
4375 | } | ||
4369 | spin_lock_init(&net_dma.lock); | 4376 | spin_lock_init(&net_dma.lock); |
4370 | dma_cap_set(DMA_MEMCPY, net_dma.client.cap_mask); | 4377 | dma_cap_set(DMA_MEMCPY, net_dma.client.cap_mask); |
4371 | dma_async_client_register(&net_dma.client); | 4378 | dma_async_client_register(&net_dma.client); |