Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'staging-4.15-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging

Pull staging fixes from Greg KH:
"Here are three staging driver fixes for 4.15-rc6

The first resolves a bug in the lustre driver that came about due to a
broken cleanup patch, due to crazy list usage in that codebase.

The remaining two are ion driver fixes, finally getting the CMA
interaction to work properly, resolving two regressions in that area
of the code.

All have been in linux-next with no reported issues for a while"

* tag 'staging-4.15-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging:
staging: android: ion: Fix dma direction for dma_sync_sg_for_cpu/device
staging: ion: Fix ion_cma_heap allocations
staging: lustre: lnet: Fix recent breakage from list_for_each conversion

+24 -20
+1 -1
drivers/staging/android/ion/Kconfig
··· 37 37 38 38 config ION_CMA_HEAP 39 39 bool "Ion CMA heap support" 40 - depends on ION && CMA 40 + depends on ION && DMA_CMA 41 41 help 42 42 Choose this option to enable CMA heaps with Ion. This heap is backed 43 43 by the Contiguous Memory Allocator (CMA). If your system has these
+2 -2
drivers/staging/android/ion/ion.c
··· 346 346 mutex_lock(&buffer->lock); 347 347 list_for_each_entry(a, &buffer->attachments, list) { 348 348 dma_sync_sg_for_cpu(a->dev, a->table->sgl, a->table->nents, 349 - DMA_BIDIRECTIONAL); 349 + direction); 350 350 } 351 351 mutex_unlock(&buffer->lock); 352 352 ··· 368 368 mutex_lock(&buffer->lock); 369 369 list_for_each_entry(a, &buffer->attachments, list) { 370 370 dma_sync_sg_for_device(a->dev, a->table->sgl, a->table->nents, 371 - DMA_BIDIRECTIONAL); 371 + direction); 372 372 } 373 373 mutex_unlock(&buffer->lock); 374 374
+11 -4
drivers/staging/android/ion/ion_cma_heap.c
··· 39 39 struct ion_cma_heap *cma_heap = to_cma_heap(heap); 40 40 struct sg_table *table; 41 41 struct page *pages; 42 + unsigned long size = PAGE_ALIGN(len); 43 + unsigned long nr_pages = size >> PAGE_SHIFT; 44 + unsigned long align = get_order(size); 42 45 int ret; 43 46 44 - pages = cma_alloc(cma_heap->cma, len, 0, GFP_KERNEL); 47 + if (align > CONFIG_CMA_ALIGNMENT) 48 + align = CONFIG_CMA_ALIGNMENT; 49 + 50 + pages = cma_alloc(cma_heap->cma, nr_pages, align, GFP_KERNEL); 45 51 if (!pages) 46 52 return -ENOMEM; 47 53 ··· 59 53 if (ret) 60 54 goto free_mem; 61 55 62 - sg_set_page(table->sgl, pages, len, 0); 56 + sg_set_page(table->sgl, pages, size, 0); 63 57 64 58 buffer->priv_virt = pages; 65 59 buffer->sg_table = table; ··· 68 62 free_mem: 69 63 kfree(table); 70 64 err: 71 - cma_release(cma_heap->cma, pages, buffer->size); 65 + cma_release(cma_heap->cma, pages, nr_pages); 72 66 return -ENOMEM; 73 67 } 74 68 ··· 76 70 { 77 71 struct ion_cma_heap *cma_heap = to_cma_heap(buffer->heap); 78 72 struct page *pages = buffer->priv_virt; 73 + unsigned long nr_pages = PAGE_ALIGN(buffer->size) >> PAGE_SHIFT; 79 74 80 75 /* release memory */ 81 - cma_release(cma_heap->cma, pages, buffer->size); 76 + cma_release(cma_heap->cma, pages, nr_pages); 82 77 /* release sg table */ 83 78 sg_free_table(buffer->sg_table); 84 79 kfree(buffer->sg_table);
+10 -13
drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c
··· 487 487 ksocknal_nid2peerlist(id.nid)); 488 488 } 489 489 490 - route2 = NULL; 491 490 list_for_each_entry(route2, &peer->ksnp_routes, ksnr_list) { 492 - if (route2->ksnr_ipaddr == ipaddr) 493 - break; 494 - 495 - route2 = NULL; 491 + if (route2->ksnr_ipaddr == ipaddr) { 492 + /* Route already exists, use the old one */ 493 + ksocknal_route_decref(route); 494 + route2->ksnr_share_count++; 495 + goto out; 496 + } 496 497 } 497 - if (!route2) { 498 - ksocknal_add_route_locked(peer, route); 499 - route->ksnr_share_count++; 500 - } else { 501 - ksocknal_route_decref(route); 502 - route2->ksnr_share_count++; 503 - } 504 - 498 + /* Route doesn't already exist, add the new one */ 499 + ksocknal_add_route_locked(peer, route); 500 + route->ksnr_share_count++; 501 + out: 505 502 write_unlock_bh(&ksocknal_data.ksnd_global_lock); 506 503 507 504 return 0;