diff options
Diffstat (limited to 'drivers/dma/dmaengine.c')
-rw-r--r-- | drivers/dma/dmaengine.c | 36 |
1 files changed, 13 insertions, 23 deletions
diff --git a/drivers/dma/dmaengine.c b/drivers/dma/dmaengine.c index 8f99354082ce..6f51a0a7a8bb 100644 --- a/drivers/dma/dmaengine.c +++ b/drivers/dma/dmaengine.c | |||
@@ -326,14 +326,7 @@ arch_initcall(dma_channel_table_init); | |||
326 | */ | 326 | */ |
327 | struct dma_chan *dma_find_channel(enum dma_transaction_type tx_type) | 327 | struct dma_chan *dma_find_channel(enum dma_transaction_type tx_type) |
328 | { | 328 | { |
329 | struct dma_chan *chan; | 329 | return this_cpu_read(channel_table[tx_type]->chan); |
330 | int cpu; | ||
331 | |||
332 | cpu = get_cpu(); | ||
333 | chan = per_cpu_ptr(channel_table[tx_type], cpu)->chan; | ||
334 | put_cpu(); | ||
335 | |||
336 | return chan; | ||
337 | } | 330 | } |
338 | EXPORT_SYMBOL(dma_find_channel); | 331 | EXPORT_SYMBOL(dma_find_channel); |
339 | 332 | ||
@@ -857,7 +850,6 @@ dma_async_memcpy_buf_to_buf(struct dma_chan *chan, void *dest, | |||
857 | struct dma_async_tx_descriptor *tx; | 850 | struct dma_async_tx_descriptor *tx; |
858 | dma_addr_t dma_dest, dma_src; | 851 | dma_addr_t dma_dest, dma_src; |
859 | dma_cookie_t cookie; | 852 | dma_cookie_t cookie; |
860 | int cpu; | ||
861 | unsigned long flags; | 853 | unsigned long flags; |
862 | 854 | ||
863 | dma_src = dma_map_single(dev->dev, src, len, DMA_TO_DEVICE); | 855 | dma_src = dma_map_single(dev->dev, src, len, DMA_TO_DEVICE); |
@@ -876,10 +868,10 @@ dma_async_memcpy_buf_to_buf(struct dma_chan *chan, void *dest, | |||
876 | tx->callback = NULL; | 868 | tx->callback = NULL; |
877 | cookie = tx->tx_submit(tx); | 869 | cookie = tx->tx_submit(tx); |
878 | 870 | ||
879 | cpu = get_cpu(); | 871 | preempt_disable(); |
880 | per_cpu_ptr(chan->local, cpu)->bytes_transferred += len; | 872 | __this_cpu_add(chan->local->bytes_transferred, len); |
881 | per_cpu_ptr(chan->local, cpu)->memcpy_count++; | 873 | __this_cpu_inc(chan->local->memcpy_count); |
882 | put_cpu(); | 874 | preempt_enable(); |
883 | 875 | ||
884 | return cookie; | 876 | return cookie; |
885 | } | 877 | } |
@@ -906,7 +898,6 @@ dma_async_memcpy_buf_to_pg(struct dma_chan *chan, struct page *page, | |||
906 | struct dma_async_tx_descriptor *tx; | 898 | struct dma_async_tx_descriptor *tx; |
907 | dma_addr_t dma_dest, dma_src; | 899 | dma_addr_t dma_dest, dma_src; |
908 | dma_cookie_t cookie; | 900 | dma_cookie_t cookie; |
909 | int cpu; | ||
910 | unsigned long flags; | 901 | unsigned long flags; |
911 | 902 | ||
912 | dma_src = dma_map_single(dev->dev, kdata, len, DMA_TO_DEVICE); | 903 | dma_src = dma_map_single(dev->dev, kdata, len, DMA_TO_DEVICE); |
@@ -923,10 +914,10 @@ dma_async_memcpy_buf_to_pg(struct dma_chan *chan, struct page *page, | |||
923 | tx->callback = NULL; | 914 | tx->callback = NULL; |
924 | cookie = tx->tx_submit(tx); | 915 | cookie = tx->tx_submit(tx); |
925 | 916 | ||
926 | cpu = get_cpu(); | 917 | preempt_disable(); |
927 | per_cpu_ptr(chan->local, cpu)->bytes_transferred += len; | 918 | __this_cpu_add(chan->local->bytes_transferred, len); |
928 | per_cpu_ptr(chan->local, cpu)->memcpy_count++; | 919 | __this_cpu_inc(chan->local->memcpy_count); |
929 | put_cpu(); | 920 | preempt_enable(); |
930 | 921 | ||
931 | return cookie; | 922 | return cookie; |
932 | } | 923 | } |
@@ -955,7 +946,6 @@ dma_async_memcpy_pg_to_pg(struct dma_chan *chan, struct page *dest_pg, | |||
955 | struct dma_async_tx_descriptor *tx; | 946 | struct dma_async_tx_descriptor *tx; |
956 | dma_addr_t dma_dest, dma_src; | 947 | dma_addr_t dma_dest, dma_src; |
957 | dma_cookie_t cookie; | 948 | dma_cookie_t cookie; |
958 | int cpu; | ||
959 | unsigned long flags; | 949 | unsigned long flags; |
960 | 950 | ||
961 | dma_src = dma_map_page(dev->dev, src_pg, src_off, len, DMA_TO_DEVICE); | 951 | dma_src = dma_map_page(dev->dev, src_pg, src_off, len, DMA_TO_DEVICE); |
@@ -973,10 +963,10 @@ dma_async_memcpy_pg_to_pg(struct dma_chan *chan, struct page *dest_pg, | |||
973 | tx->callback = NULL; | 963 | tx->callback = NULL; |
974 | cookie = tx->tx_submit(tx); | 964 | cookie = tx->tx_submit(tx); |
975 | 965 | ||
976 | cpu = get_cpu(); | 966 | preempt_disable(); |
977 | per_cpu_ptr(chan->local, cpu)->bytes_transferred += len; | 967 | __this_cpu_add(chan->local->bytes_transferred, len); |
978 | per_cpu_ptr(chan->local, cpu)->memcpy_count++; | 968 | __this_cpu_inc(chan->local->memcpy_count); |
979 | put_cpu(); | 969 | preempt_enable(); |
980 | 970 | ||
981 | return cookie; | 971 | return cookie; |
982 | } | 972 | } |