diff options
Diffstat (limited to 'drivers/dma')
-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 bd0b248de2cf..51d7480d3a92 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 | ||
@@ -847,7 +840,6 @@ dma_async_memcpy_buf_to_buf(struct dma_chan *chan, void *dest, | |||
847 | struct dma_async_tx_descriptor *tx; | 840 | struct dma_async_tx_descriptor *tx; |
848 | dma_addr_t dma_dest, dma_src; | 841 | dma_addr_t dma_dest, dma_src; |
849 | dma_cookie_t cookie; | 842 | dma_cookie_t cookie; |
850 | int cpu; | ||
851 | unsigned long flags; | 843 | unsigned long flags; |
852 | 844 | ||
853 | dma_src = dma_map_single(dev->dev, src, len, DMA_TO_DEVICE); | 845 | dma_src = dma_map_single(dev->dev, src, len, DMA_TO_DEVICE); |
@@ -866,10 +858,10 @@ dma_async_memcpy_buf_to_buf(struct dma_chan *chan, void *dest, | |||
866 | tx->callback = NULL; | 858 | tx->callback = NULL; |
867 | cookie = tx->tx_submit(tx); | 859 | cookie = tx->tx_submit(tx); |
868 | 860 | ||
869 | cpu = get_cpu(); | 861 | preempt_disable(); |
870 | per_cpu_ptr(chan->local, cpu)->bytes_transferred += len; | 862 | __this_cpu_add(chan->local->bytes_transferred, len); |
871 | per_cpu_ptr(chan->local, cpu)->memcpy_count++; | 863 | __this_cpu_inc(chan->local->memcpy_count); |
872 | put_cpu(); | 864 | preempt_enable(); |
873 | 865 | ||
874 | return cookie; | 866 | return cookie; |
875 | } | 867 | } |
@@ -896,7 +888,6 @@ dma_async_memcpy_buf_to_pg(struct dma_chan *chan, struct page *page, | |||
896 | struct dma_async_tx_descriptor *tx; | 888 | struct dma_async_tx_descriptor *tx; |
897 | dma_addr_t dma_dest, dma_src; | 889 | dma_addr_t dma_dest, dma_src; |
898 | dma_cookie_t cookie; | 890 | dma_cookie_t cookie; |
899 | int cpu; | ||
900 | unsigned long flags; | 891 | unsigned long flags; |
901 | 892 | ||
902 | dma_src = dma_map_single(dev->dev, kdata, len, DMA_TO_DEVICE); | 893 | dma_src = dma_map_single(dev->dev, kdata, len, DMA_TO_DEVICE); |
@@ -913,10 +904,10 @@ dma_async_memcpy_buf_to_pg(struct dma_chan *chan, struct page *page, | |||
913 | tx->callback = NULL; | 904 | tx->callback = NULL; |
914 | cookie = tx->tx_submit(tx); | 905 | cookie = tx->tx_submit(tx); |
915 | 906 | ||
916 | cpu = get_cpu(); | 907 | preempt_disable(); |
917 | per_cpu_ptr(chan->local, cpu)->bytes_transferred += len; | 908 | __this_cpu_add(chan->local->bytes_transferred, len); |
918 | per_cpu_ptr(chan->local, cpu)->memcpy_count++; | 909 | __this_cpu_inc(chan->local->memcpy_count); |
919 | put_cpu(); | 910 | preempt_enable(); |
920 | 911 | ||
921 | return cookie; | 912 | return cookie; |
922 | } | 913 | } |
@@ -945,7 +936,6 @@ dma_async_memcpy_pg_to_pg(struct dma_chan *chan, struct page *dest_pg, | |||
945 | struct dma_async_tx_descriptor *tx; | 936 | struct dma_async_tx_descriptor *tx; |
946 | dma_addr_t dma_dest, dma_src; | 937 | dma_addr_t dma_dest, dma_src; |
947 | dma_cookie_t cookie; | 938 | dma_cookie_t cookie; |
948 | int cpu; | ||
949 | unsigned long flags; | 939 | unsigned long flags; |
950 | 940 | ||
951 | dma_src = dma_map_page(dev->dev, src_pg, src_off, len, DMA_TO_DEVICE); | 941 | dma_src = dma_map_page(dev->dev, src_pg, src_off, len, DMA_TO_DEVICE); |
@@ -963,10 +953,10 @@ dma_async_memcpy_pg_to_pg(struct dma_chan *chan, struct page *dest_pg, | |||
963 | tx->callback = NULL; | 953 | tx->callback = NULL; |
964 | cookie = tx->tx_submit(tx); | 954 | cookie = tx->tx_submit(tx); |
965 | 955 | ||
966 | cpu = get_cpu(); | 956 | preempt_disable(); |
967 | per_cpu_ptr(chan->local, cpu)->bytes_transferred += len; | 957 | __this_cpu_add(chan->local->bytes_transferred, len); |
968 | per_cpu_ptr(chan->local, cpu)->memcpy_count++; | 958 | __this_cpu_inc(chan->local->memcpy_count); |
969 | put_cpu(); | 959 | preempt_enable(); |
970 | 960 | ||
971 | return cookie; | 961 | return cookie; |
972 | } | 962 | } |