Loading drivers/bus/mhi/core/mhi_boot.c +3 −3 Original line number Diff line number Diff line Loading @@ -306,7 +306,7 @@ void mhi_free_bhie_table(struct mhi_controller *mhi_cntrl, struct mhi_buf *mhi_buf = image_info->mhi_buf; for (i = 0; i < image_info->entries; i++, mhi_buf++) mhi_free_coherent(mhi_cntrl, mhi_buf->len, mhi_buf->buf, mhi_free_contig_coherent(mhi_cntrl, mhi_buf->len, mhi_buf->buf, mhi_buf->dma_addr); kfree(image_info->mhi_buf); Loading Loading @@ -347,7 +347,7 @@ int mhi_alloc_bhie_table(struct mhi_controller *mhi_cntrl, vec_size = sizeof(struct bhi_vec_entry) * i; mhi_buf->len = vec_size; mhi_buf->buf = mhi_alloc_coherent(mhi_cntrl, vec_size, mhi_buf->buf = mhi_alloc_contig_coherent(mhi_cntrl, vec_size, &mhi_buf->dma_addr, GFP_KERNEL); if (!mhi_buf->buf) goto error_alloc_segment; Loading @@ -366,7 +366,7 @@ int mhi_alloc_bhie_table(struct mhi_controller *mhi_cntrl, error_alloc_segment: for (--i, --mhi_buf; i >= 0; i--, mhi_buf--) mhi_free_coherent(mhi_cntrl, mhi_buf->len, mhi_buf->buf, mhi_free_contig_coherent(mhi_cntrl, mhi_buf->len, mhi_buf->buf, mhi_buf->dma_addr); error_alloc_mhi_buf: Loading drivers/bus/mhi/core/mhi_internal.h +24 −0 Original line number Diff line number Diff line Loading @@ -847,6 +847,30 @@ static inline void mhi_free_coherent(struct mhi_controller *mhi_cntrl, atomic_sub(size, &mhi_cntrl->alloc_size); dma_free_coherent(mhi_cntrl->dev, size, vaddr, dma_handle); } static inline void *mhi_alloc_contig_coherent( struct mhi_controller *mhi_cntrl, size_t size, dma_addr_t *dma_handle, gfp_t gfp) { void *buf = dma_alloc_attrs(mhi_cntrl->dev, size, dma_handle, gfp, DMA_ATTR_FORCE_CONTIGUOUS); if (buf) atomic_add(size, &mhi_cntrl->alloc_size); return buf; } static inline void mhi_free_contig_coherent( struct mhi_controller *mhi_cntrl, size_t size, void *vaddr, dma_addr_t dma_handle) { atomic_sub(size, &mhi_cntrl->alloc_size); dma_free_attrs(mhi_cntrl->dev, size, vaddr, dma_handle, DMA_ATTR_FORCE_CONTIGUOUS); } struct mhi_device *mhi_alloc_device(struct mhi_controller *mhi_cntrl); static inline void mhi_dealloc_device(struct mhi_controller *mhi_cntrl, struct mhi_device *mhi_dev) Loading Loading
drivers/bus/mhi/core/mhi_boot.c +3 −3 Original line number Diff line number Diff line Loading @@ -306,7 +306,7 @@ void mhi_free_bhie_table(struct mhi_controller *mhi_cntrl, struct mhi_buf *mhi_buf = image_info->mhi_buf; for (i = 0; i < image_info->entries; i++, mhi_buf++) mhi_free_coherent(mhi_cntrl, mhi_buf->len, mhi_buf->buf, mhi_free_contig_coherent(mhi_cntrl, mhi_buf->len, mhi_buf->buf, mhi_buf->dma_addr); kfree(image_info->mhi_buf); Loading Loading @@ -347,7 +347,7 @@ int mhi_alloc_bhie_table(struct mhi_controller *mhi_cntrl, vec_size = sizeof(struct bhi_vec_entry) * i; mhi_buf->len = vec_size; mhi_buf->buf = mhi_alloc_coherent(mhi_cntrl, vec_size, mhi_buf->buf = mhi_alloc_contig_coherent(mhi_cntrl, vec_size, &mhi_buf->dma_addr, GFP_KERNEL); if (!mhi_buf->buf) goto error_alloc_segment; Loading @@ -366,7 +366,7 @@ int mhi_alloc_bhie_table(struct mhi_controller *mhi_cntrl, error_alloc_segment: for (--i, --mhi_buf; i >= 0; i--, mhi_buf--) mhi_free_coherent(mhi_cntrl, mhi_buf->len, mhi_buf->buf, mhi_free_contig_coherent(mhi_cntrl, mhi_buf->len, mhi_buf->buf, mhi_buf->dma_addr); error_alloc_mhi_buf: Loading
drivers/bus/mhi/core/mhi_internal.h +24 −0 Original line number Diff line number Diff line Loading @@ -847,6 +847,30 @@ static inline void mhi_free_coherent(struct mhi_controller *mhi_cntrl, atomic_sub(size, &mhi_cntrl->alloc_size); dma_free_coherent(mhi_cntrl->dev, size, vaddr, dma_handle); } static inline void *mhi_alloc_contig_coherent( struct mhi_controller *mhi_cntrl, size_t size, dma_addr_t *dma_handle, gfp_t gfp) { void *buf = dma_alloc_attrs(mhi_cntrl->dev, size, dma_handle, gfp, DMA_ATTR_FORCE_CONTIGUOUS); if (buf) atomic_add(size, &mhi_cntrl->alloc_size); return buf; } static inline void mhi_free_contig_coherent( struct mhi_controller *mhi_cntrl, size_t size, void *vaddr, dma_addr_t dma_handle) { atomic_sub(size, &mhi_cntrl->alloc_size); dma_free_attrs(mhi_cntrl->dev, size, vaddr, dma_handle, DMA_ATTR_FORCE_CONTIGUOUS); } struct mhi_device *mhi_alloc_device(struct mhi_controller *mhi_cntrl); static inline void mhi_dealloc_device(struct mhi_controller *mhi_cntrl, struct mhi_device *mhi_dev) Loading