aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYi Li <yi.li@analog.com>2009-12-29 23:04:07 -0500
committerMike Frysinger <vapier@gentoo.org>2010-03-09 00:30:48 -0500
commit54536c5c6a807d0db7252c3b33638b88f34650ff (patch)
treeb176e6c63c78a3c46086a0510ce461f6f4440ad3
parent0b39db28b953945232719e7ff6fb802aa8a2be5f (diff)
Blackfin: simplify SMP handling in SRAM code
There is no need to use {get,put}_cpu() when we already have a spinlock to protect against multiple processors running simultaneously. Signed-off-by: Yi Li <yi.li@analog.com> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
-rw-r--r--arch/blackfin/mm/sram-alloc.c27
1 files changed, 9 insertions, 18 deletions
diff --git a/arch/blackfin/mm/sram-alloc.c b/arch/blackfin/mm/sram-alloc.c
index f068c11ea98f..5732da25ee2d 100644
--- a/arch/blackfin/mm/sram-alloc.c
+++ b/arch/blackfin/mm/sram-alloc.c
@@ -402,7 +402,7 @@ void *l1_data_A_sram_alloc(size_t size)
402 void *addr; 402 void *addr;
403 unsigned int cpu; 403 unsigned int cpu;
404 404
405 cpu = get_cpu(); 405 cpu = smp_processor_id();
406 /* add mutex operation */ 406 /* add mutex operation */
407 spin_lock_irqsave(&per_cpu(l1_data_sram_lock, cpu), flags); 407 spin_lock_irqsave(&per_cpu(l1_data_sram_lock, cpu), flags);
408 408
@@ -411,7 +411,6 @@ void *l1_data_A_sram_alloc(size_t size)
411 411
412 /* add mutex operation */ 412 /* add mutex operation */
413 spin_unlock_irqrestore(&per_cpu(l1_data_sram_lock, cpu), flags); 413 spin_unlock_irqrestore(&per_cpu(l1_data_sram_lock, cpu), flags);
414 put_cpu();
415 414
416 pr_debug("Allocated address in l1_data_A_sram_alloc is 0x%lx+0x%lx\n", 415 pr_debug("Allocated address in l1_data_A_sram_alloc is 0x%lx+0x%lx\n",
417 (long unsigned int)addr, size); 416 (long unsigned int)addr, size);
@@ -430,7 +429,7 @@ int l1_data_A_sram_free(const void *addr)
430 int ret; 429 int ret;
431 unsigned int cpu; 430 unsigned int cpu;
432 431
433 cpu = get_cpu(); 432 cpu = smp_processor_id();
434 /* add mutex operation */ 433 /* add mutex operation */
435 spin_lock_irqsave(&per_cpu(l1_data_sram_lock, cpu), flags); 434 spin_lock_irqsave(&per_cpu(l1_data_sram_lock, cpu), flags);
436 435
@@ -439,7 +438,6 @@ int l1_data_A_sram_free(const void *addr)
439 438
440 /* add mutex operation */ 439 /* add mutex operation */
441 spin_unlock_irqrestore(&per_cpu(l1_data_sram_lock, cpu), flags); 440 spin_unlock_irqrestore(&per_cpu(l1_data_sram_lock, cpu), flags);
442 put_cpu();
443 441
444 return ret; 442 return ret;
445#else 443#else
@@ -455,7 +453,7 @@ void *l1_data_B_sram_alloc(size_t size)
455 void *addr; 453 void *addr;
456 unsigned int cpu; 454 unsigned int cpu;
457 455
458 cpu = get_cpu(); 456 cpu = smp_processor_id();
459 /* add mutex operation */ 457 /* add mutex operation */
460 spin_lock_irqsave(&per_cpu(l1_data_sram_lock, cpu), flags); 458 spin_lock_irqsave(&per_cpu(l1_data_sram_lock, cpu), flags);
461 459
@@ -464,7 +462,6 @@ void *l1_data_B_sram_alloc(size_t size)
464 462
465 /* add mutex operation */ 463 /* add mutex operation */
466 spin_unlock_irqrestore(&per_cpu(l1_data_sram_lock, cpu), flags); 464 spin_unlock_irqrestore(&per_cpu(l1_data_sram_lock, cpu), flags);
467 put_cpu();
468 465
469 pr_debug("Allocated address in l1_data_B_sram_alloc is 0x%lx+0x%lx\n", 466 pr_debug("Allocated address in l1_data_B_sram_alloc is 0x%lx+0x%lx\n",
470 (long unsigned int)addr, size); 467 (long unsigned int)addr, size);
@@ -483,7 +480,7 @@ int l1_data_B_sram_free(const void *addr)
483 int ret; 480 int ret;
484 unsigned int cpu; 481 unsigned int cpu;
485 482
486 cpu = get_cpu(); 483 cpu = smp_processor_id();
487 /* add mutex operation */ 484 /* add mutex operation */
488 spin_lock_irqsave(&per_cpu(l1_data_sram_lock, cpu), flags); 485 spin_lock_irqsave(&per_cpu(l1_data_sram_lock, cpu), flags);
489 486
@@ -492,7 +489,6 @@ int l1_data_B_sram_free(const void *addr)
492 489
493 /* add mutex operation */ 490 /* add mutex operation */
494 spin_unlock_irqrestore(&per_cpu(l1_data_sram_lock, cpu), flags); 491 spin_unlock_irqrestore(&per_cpu(l1_data_sram_lock, cpu), flags);
495 put_cpu();
496 492
497 return ret; 493 return ret;
498#else 494#else
@@ -540,7 +536,7 @@ void *l1_inst_sram_alloc(size_t size)
540 void *addr; 536 void *addr;
541 unsigned int cpu; 537 unsigned int cpu;
542 538
543 cpu = get_cpu(); 539 cpu = smp_processor_id();
544 /* add mutex operation */ 540 /* add mutex operation */
545 spin_lock_irqsave(&per_cpu(l1_inst_sram_lock, cpu), flags); 541 spin_lock_irqsave(&per_cpu(l1_inst_sram_lock, cpu), flags);
546 542
@@ -549,7 +545,6 @@ void *l1_inst_sram_alloc(size_t size)
549 545
550 /* add mutex operation */ 546 /* add mutex operation */
551 spin_unlock_irqrestore(&per_cpu(l1_inst_sram_lock, cpu), flags); 547 spin_unlock_irqrestore(&per_cpu(l1_inst_sram_lock, cpu), flags);
552 put_cpu();
553 548
554 pr_debug("Allocated address in l1_inst_sram_alloc is 0x%lx+0x%lx\n", 549 pr_debug("Allocated address in l1_inst_sram_alloc is 0x%lx+0x%lx\n",
555 (long unsigned int)addr, size); 550 (long unsigned int)addr, size);
@@ -568,7 +563,7 @@ int l1_inst_sram_free(const void *addr)
568 int ret; 563 int ret;
569 unsigned int cpu; 564 unsigned int cpu;
570 565
571 cpu = get_cpu(); 566 cpu = smp_processor_id();
572 /* add mutex operation */ 567 /* add mutex operation */
573 spin_lock_irqsave(&per_cpu(l1_inst_sram_lock, cpu), flags); 568 spin_lock_irqsave(&per_cpu(l1_inst_sram_lock, cpu), flags);
574 569
@@ -577,7 +572,6 @@ int l1_inst_sram_free(const void *addr)
577 572
578 /* add mutex operation */ 573 /* add mutex operation */
579 spin_unlock_irqrestore(&per_cpu(l1_inst_sram_lock, cpu), flags); 574 spin_unlock_irqrestore(&per_cpu(l1_inst_sram_lock, cpu), flags);
580 put_cpu();
581 575
582 return ret; 576 return ret;
583#else 577#else
@@ -593,7 +587,7 @@ void *l1sram_alloc(size_t size)
593 void *addr; 587 void *addr;
594 unsigned int cpu; 588 unsigned int cpu;
595 589
596 cpu = get_cpu(); 590 cpu = smp_processor_id();
597 /* add mutex operation */ 591 /* add mutex operation */
598 spin_lock_irqsave(&per_cpu(l1sram_lock, cpu), flags); 592 spin_lock_irqsave(&per_cpu(l1sram_lock, cpu), flags);
599 593
@@ -602,7 +596,6 @@ void *l1sram_alloc(size_t size)
602 596
603 /* add mutex operation */ 597 /* add mutex operation */
604 spin_unlock_irqrestore(&per_cpu(l1sram_lock, cpu), flags); 598 spin_unlock_irqrestore(&per_cpu(l1sram_lock, cpu), flags);
605 put_cpu();
606 599
607 return addr; 600 return addr;
608} 601}
@@ -614,7 +607,7 @@ void *l1sram_alloc_max(size_t *psize)
614 void *addr; 607 void *addr;
615 unsigned int cpu; 608 unsigned int cpu;
616 609
617 cpu = get_cpu(); 610 cpu = smp_processor_id();
618 /* add mutex operation */ 611 /* add mutex operation */
619 spin_lock_irqsave(&per_cpu(l1sram_lock, cpu), flags); 612 spin_lock_irqsave(&per_cpu(l1sram_lock, cpu), flags);
620 613
@@ -623,7 +616,6 @@ void *l1sram_alloc_max(size_t *psize)
623 616
624 /* add mutex operation */ 617 /* add mutex operation */
625 spin_unlock_irqrestore(&per_cpu(l1sram_lock, cpu), flags); 618 spin_unlock_irqrestore(&per_cpu(l1sram_lock, cpu), flags);
626 put_cpu();
627 619
628 return addr; 620 return addr;
629} 621}
@@ -635,7 +627,7 @@ int l1sram_free(const void *addr)
635 int ret; 627 int ret;
636 unsigned int cpu; 628 unsigned int cpu;
637 629
638 cpu = get_cpu(); 630 cpu = smp_processor_id();
639 /* add mutex operation */ 631 /* add mutex operation */
640 spin_lock_irqsave(&per_cpu(l1sram_lock, cpu), flags); 632 spin_lock_irqsave(&per_cpu(l1sram_lock, cpu), flags);
641 633
@@ -644,7 +636,6 @@ int l1sram_free(const void *addr)
644 636
645 /* add mutex operation */ 637 /* add mutex operation */
646 spin_unlock_irqrestore(&per_cpu(l1sram_lock, cpu), flags); 638 spin_unlock_irqrestore(&per_cpu(l1sram_lock, cpu), flags);
647 put_cpu();
648 639
649 return ret; 640 return ret;
650} 641}