diff options
author | Joe Perches <joe@perches.com> | 2013-03-15 03:23:58 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-03-17 12:50:24 -0400 |
commit | 1f9061d27d3d2028805549c4a306324a48209057 (patch) | |
tree | 7cfb1a92933f5a9bba6745b68b6a964d9e757ef9 /drivers/net/irda | |
parent | 7f9421c264f8a6e6137027a45ae576517f66fa56 (diff) |
drivers:net: dma_alloc_coherent: use __GFP_ZERO instead of memset(, 0)
Reduce the number of calls required to alloc
a zeroed block of memory.
Trivially reduces overall object size.
Other changes around these removals
o Neaten call argument alignment
o Remove an unnecessary OOM message after dma_alloc_coherent failure
o Remove unnecessary gfp_t stack variable
Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/irda')
-rw-r--r-- | drivers/net/irda/ali-ircc.c | 6 | ||||
-rw-r--r-- | drivers/net/irda/nsc-ircc.c | 6 | ||||
-rw-r--r-- | drivers/net/irda/pxaficp_ir.c | 4 | ||||
-rw-r--r-- | drivers/net/irda/smsc-ircc2.c | 7 | ||||
-rw-r--r-- | drivers/net/irda/via-ircc.c | 6 | ||||
-rw-r--r-- | drivers/net/irda/w83977af_ir.c | 7 |
6 files changed, 12 insertions, 24 deletions
diff --git a/drivers/net/irda/ali-ircc.c b/drivers/net/irda/ali-ircc.c index 9cea451a6081..3adb43ce138f 100644 --- a/drivers/net/irda/ali-ircc.c +++ b/drivers/net/irda/ali-ircc.c | |||
@@ -352,21 +352,19 @@ static int ali_ircc_open(int i, chipio_t *info) | |||
352 | /* Allocate memory if needed */ | 352 | /* Allocate memory if needed */ |
353 | self->rx_buff.head = | 353 | self->rx_buff.head = |
354 | dma_alloc_coherent(NULL, self->rx_buff.truesize, | 354 | dma_alloc_coherent(NULL, self->rx_buff.truesize, |
355 | &self->rx_buff_dma, GFP_KERNEL); | 355 | &self->rx_buff_dma, GFP_KERNEL | __GFP_ZERO); |
356 | if (self->rx_buff.head == NULL) { | 356 | if (self->rx_buff.head == NULL) { |
357 | err = -ENOMEM; | 357 | err = -ENOMEM; |
358 | goto err_out2; | 358 | goto err_out2; |
359 | } | 359 | } |
360 | memset(self->rx_buff.head, 0, self->rx_buff.truesize); | ||
361 | 360 | ||
362 | self->tx_buff.head = | 361 | self->tx_buff.head = |
363 | dma_alloc_coherent(NULL, self->tx_buff.truesize, | 362 | dma_alloc_coherent(NULL, self->tx_buff.truesize, |
364 | &self->tx_buff_dma, GFP_KERNEL); | 363 | &self->tx_buff_dma, GFP_KERNEL | __GFP_ZERO); |
365 | if (self->tx_buff.head == NULL) { | 364 | if (self->tx_buff.head == NULL) { |
366 | err = -ENOMEM; | 365 | err = -ENOMEM; |
367 | goto err_out3; | 366 | goto err_out3; |
368 | } | 367 | } |
369 | memset(self->tx_buff.head, 0, self->tx_buff.truesize); | ||
370 | 368 | ||
371 | self->rx_buff.in_frame = FALSE; | 369 | self->rx_buff.in_frame = FALSE; |
372 | self->rx_buff.state = OUTSIDE_FRAME; | 370 | self->rx_buff.state = OUTSIDE_FRAME; |
diff --git a/drivers/net/irda/nsc-ircc.c b/drivers/net/irda/nsc-ircc.c index 2a4f2f153244..9cf836b57c49 100644 --- a/drivers/net/irda/nsc-ircc.c +++ b/drivers/net/irda/nsc-ircc.c | |||
@@ -431,22 +431,20 @@ static int __init nsc_ircc_open(chipio_t *info) | |||
431 | /* Allocate memory if needed */ | 431 | /* Allocate memory if needed */ |
432 | self->rx_buff.head = | 432 | self->rx_buff.head = |
433 | dma_alloc_coherent(NULL, self->rx_buff.truesize, | 433 | dma_alloc_coherent(NULL, self->rx_buff.truesize, |
434 | &self->rx_buff_dma, GFP_KERNEL); | 434 | &self->rx_buff_dma, GFP_KERNEL | __GFP_ZERO); |
435 | if (self->rx_buff.head == NULL) { | 435 | if (self->rx_buff.head == NULL) { |
436 | err = -ENOMEM; | 436 | err = -ENOMEM; |
437 | goto out2; | 437 | goto out2; |
438 | 438 | ||
439 | } | 439 | } |
440 | memset(self->rx_buff.head, 0, self->rx_buff.truesize); | ||
441 | 440 | ||
442 | self->tx_buff.head = | 441 | self->tx_buff.head = |
443 | dma_alloc_coherent(NULL, self->tx_buff.truesize, | 442 | dma_alloc_coherent(NULL, self->tx_buff.truesize, |
444 | &self->tx_buff_dma, GFP_KERNEL); | 443 | &self->tx_buff_dma, GFP_KERNEL | __GFP_ZERO); |
445 | if (self->tx_buff.head == NULL) { | 444 | if (self->tx_buff.head == NULL) { |
446 | err = -ENOMEM; | 445 | err = -ENOMEM; |
447 | goto out3; | 446 | goto out3; |
448 | } | 447 | } |
449 | memset(self->tx_buff.head, 0, self->tx_buff.truesize); | ||
450 | 448 | ||
451 | self->rx_buff.in_frame = FALSE; | 449 | self->rx_buff.in_frame = FALSE; |
452 | self->rx_buff.state = OUTSIDE_FRAME; | 450 | self->rx_buff.state = OUTSIDE_FRAME; |
diff --git a/drivers/net/irda/pxaficp_ir.c b/drivers/net/irda/pxaficp_ir.c index 858de05bdb7d..964b116a0ab7 100644 --- a/drivers/net/irda/pxaficp_ir.c +++ b/drivers/net/irda/pxaficp_ir.c | |||
@@ -700,12 +700,12 @@ static int pxa_irda_start(struct net_device *dev) | |||
700 | 700 | ||
701 | err = -ENOMEM; | 701 | err = -ENOMEM; |
702 | si->dma_rx_buff = dma_alloc_coherent(si->dev, IRDA_FRAME_SIZE_LIMIT, | 702 | si->dma_rx_buff = dma_alloc_coherent(si->dev, IRDA_FRAME_SIZE_LIMIT, |
703 | &si->dma_rx_buff_phy, GFP_KERNEL ); | 703 | &si->dma_rx_buff_phy, GFP_KERNEL); |
704 | if (!si->dma_rx_buff) | 704 | if (!si->dma_rx_buff) |
705 | goto err_dma_rx_buff; | 705 | goto err_dma_rx_buff; |
706 | 706 | ||
707 | si->dma_tx_buff = dma_alloc_coherent(si->dev, IRDA_FRAME_SIZE_LIMIT, | 707 | si->dma_tx_buff = dma_alloc_coherent(si->dev, IRDA_FRAME_SIZE_LIMIT, |
708 | &si->dma_tx_buff_phy, GFP_KERNEL ); | 708 | &si->dma_tx_buff_phy, GFP_KERNEL); |
709 | if (!si->dma_tx_buff) | 709 | if (!si->dma_tx_buff) |
710 | goto err_dma_tx_buff; | 710 | goto err_dma_tx_buff; |
711 | 711 | ||
diff --git a/drivers/net/irda/smsc-ircc2.c b/drivers/net/irda/smsc-ircc2.c index 59b45c10adbc..aa05dad75335 100644 --- a/drivers/net/irda/smsc-ircc2.c +++ b/drivers/net/irda/smsc-ircc2.c | |||
@@ -563,19 +563,16 @@ static int smsc_ircc_open(unsigned int fir_base, unsigned int sir_base, u8 dma, | |||
563 | 563 | ||
564 | self->rx_buff.head = | 564 | self->rx_buff.head = |
565 | dma_alloc_coherent(NULL, self->rx_buff.truesize, | 565 | dma_alloc_coherent(NULL, self->rx_buff.truesize, |
566 | &self->rx_buff_dma, GFP_KERNEL); | 566 | &self->rx_buff_dma, GFP_KERNEL | __GFP_ZERO); |
567 | if (self->rx_buff.head == NULL) | 567 | if (self->rx_buff.head == NULL) |
568 | goto err_out2; | 568 | goto err_out2; |
569 | 569 | ||
570 | self->tx_buff.head = | 570 | self->tx_buff.head = |
571 | dma_alloc_coherent(NULL, self->tx_buff.truesize, | 571 | dma_alloc_coherent(NULL, self->tx_buff.truesize, |
572 | &self->tx_buff_dma, GFP_KERNEL); | 572 | &self->tx_buff_dma, GFP_KERNEL | __GFP_ZERO); |
573 | if (self->tx_buff.head == NULL) | 573 | if (self->tx_buff.head == NULL) |
574 | goto err_out3; | 574 | goto err_out3; |
575 | 575 | ||
576 | memset(self->rx_buff.head, 0, self->rx_buff.truesize); | ||
577 | memset(self->tx_buff.head, 0, self->tx_buff.truesize); | ||
578 | |||
579 | self->rx_buff.in_frame = FALSE; | 576 | self->rx_buff.in_frame = FALSE; |
580 | self->rx_buff.state = OUTSIDE_FRAME; | 577 | self->rx_buff.state = OUTSIDE_FRAME; |
581 | self->tx_buff.data = self->tx_buff.head; | 578 | self->tx_buff.data = self->tx_buff.head; |
diff --git a/drivers/net/irda/via-ircc.c b/drivers/net/irda/via-ircc.c index f9033c6a888c..51f2bc376101 100644 --- a/drivers/net/irda/via-ircc.c +++ b/drivers/net/irda/via-ircc.c | |||
@@ -364,21 +364,19 @@ static int via_ircc_open(struct pci_dev *pdev, chipio_t *info, unsigned int id) | |||
364 | /* Allocate memory if needed */ | 364 | /* Allocate memory if needed */ |
365 | self->rx_buff.head = | 365 | self->rx_buff.head = |
366 | dma_alloc_coherent(&pdev->dev, self->rx_buff.truesize, | 366 | dma_alloc_coherent(&pdev->dev, self->rx_buff.truesize, |
367 | &self->rx_buff_dma, GFP_KERNEL); | 367 | &self->rx_buff_dma, GFP_KERNEL | __GFP_ZERO); |
368 | if (self->rx_buff.head == NULL) { | 368 | if (self->rx_buff.head == NULL) { |
369 | err = -ENOMEM; | 369 | err = -ENOMEM; |
370 | goto err_out2; | 370 | goto err_out2; |
371 | } | 371 | } |
372 | memset(self->rx_buff.head, 0, self->rx_buff.truesize); | ||
373 | 372 | ||
374 | self->tx_buff.head = | 373 | self->tx_buff.head = |
375 | dma_alloc_coherent(&pdev->dev, self->tx_buff.truesize, | 374 | dma_alloc_coherent(&pdev->dev, self->tx_buff.truesize, |
376 | &self->tx_buff_dma, GFP_KERNEL); | 375 | &self->tx_buff_dma, GFP_KERNEL | __GFP_ZERO); |
377 | if (self->tx_buff.head == NULL) { | 376 | if (self->tx_buff.head == NULL) { |
378 | err = -ENOMEM; | 377 | err = -ENOMEM; |
379 | goto err_out3; | 378 | goto err_out3; |
380 | } | 379 | } |
381 | memset(self->tx_buff.head, 0, self->tx_buff.truesize); | ||
382 | 380 | ||
383 | self->rx_buff.in_frame = FALSE; | 381 | self->rx_buff.in_frame = FALSE; |
384 | self->rx_buff.state = OUTSIDE_FRAME; | 382 | self->rx_buff.state = OUTSIDE_FRAME; |
diff --git a/drivers/net/irda/w83977af_ir.c b/drivers/net/irda/w83977af_ir.c index f5bb92f15880..bb8857a158a6 100644 --- a/drivers/net/irda/w83977af_ir.c +++ b/drivers/net/irda/w83977af_ir.c | |||
@@ -216,22 +216,19 @@ static int w83977af_open(int i, unsigned int iobase, unsigned int irq, | |||
216 | /* Allocate memory if needed */ | 216 | /* Allocate memory if needed */ |
217 | self->rx_buff.head = | 217 | self->rx_buff.head = |
218 | dma_alloc_coherent(NULL, self->rx_buff.truesize, | 218 | dma_alloc_coherent(NULL, self->rx_buff.truesize, |
219 | &self->rx_buff_dma, GFP_KERNEL); | 219 | &self->rx_buff_dma, GFP_KERNEL | __GFP_ZERO); |
220 | if (self->rx_buff.head == NULL) { | 220 | if (self->rx_buff.head == NULL) { |
221 | err = -ENOMEM; | 221 | err = -ENOMEM; |
222 | goto err_out1; | 222 | goto err_out1; |
223 | } | 223 | } |
224 | 224 | ||
225 | memset(self->rx_buff.head, 0, self->rx_buff.truesize); | ||
226 | |||
227 | self->tx_buff.head = | 225 | self->tx_buff.head = |
228 | dma_alloc_coherent(NULL, self->tx_buff.truesize, | 226 | dma_alloc_coherent(NULL, self->tx_buff.truesize, |
229 | &self->tx_buff_dma, GFP_KERNEL); | 227 | &self->tx_buff_dma, GFP_KERNEL | __GFP_ZERO); |
230 | if (self->tx_buff.head == NULL) { | 228 | if (self->tx_buff.head == NULL) { |
231 | err = -ENOMEM; | 229 | err = -ENOMEM; |
232 | goto err_out2; | 230 | goto err_out2; |
233 | } | 231 | } |
234 | memset(self->tx_buff.head, 0, self->tx_buff.truesize); | ||
235 | 232 | ||
236 | self->rx_buff.in_frame = FALSE; | 233 | self->rx_buff.in_frame = FALSE; |
237 | self->rx_buff.state = OUTSIDE_FRAME; | 234 | self->rx_buff.state = OUTSIDE_FRAME; |