This is a note to let you know that I've just added the patch titled swiotlb: clean up swiotlb_tbl_unmap_single to the 5.10-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: swiotlb-clean-up-swiotlb_tbl_unmap_single.patch and it can be found in the queue-5.10 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From foo@baz Wed May 5 09:27:45 AM CEST 2021 From: Jianxiong Gao <jxgao@xxxxxxxxxx> Date: Thu, 29 Apr 2021 17:33:11 +0000 Subject: swiotlb: clean up swiotlb_tbl_unmap_single To: stable@xxxxxxxxxxxxxxx, hch@xxxxxx, marcorr@xxxxxxxxxx, sashal@xxxxxxxxxx Cc: Jianxiong Gao <jxgao@xxxxxxxxxx>, Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx> Message-ID: <20210429173315.1252465-6-jxgao@xxxxxxxxxx> From: Jianxiong Gao <jxgao@xxxxxxxxxx> commit: ca10d0f8e530600ec63c603dbace2c30927d70b7 swiotlb: clean up swiotlb_tbl_unmap_single Remove a layer of pointless indentation, replace a hard to follow ternary expression with a plain if/else. Signed-off-by: Christoph Hellwig <hch@xxxxxx> Acked-by: Jianxiong Gao <jxgao@xxxxxxxxxx> Tested-by: Jianxiong Gao <jxgao@xxxxxxxxxx> Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx> Signed-off-by: Jianxiong Gao <jxgao@xxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- kernel/dma/swiotlb.c | 41 +++++++++++++++++++++-------------------- 1 file changed, 21 insertions(+), 20 deletions(-) --- a/kernel/dma/swiotlb.c +++ b/kernel/dma/swiotlb.c @@ -610,28 +610,29 @@ void swiotlb_tbl_unmap_single(struct dev * with slots below and above the pool being returned. */ spin_lock_irqsave(&io_tlb_lock, flags); - { - count = ((index + nslots) < ALIGN(index + 1, IO_TLB_SEGSIZE) ? - io_tlb_list[index + nslots] : 0); - /* - * Step 1: return the slots to the free list, merging the - * slots with superceeding slots - */ - for (i = index + nslots - 1; i >= index; i--) { - io_tlb_list[i] = ++count; - io_tlb_orig_addr[i] = INVALID_PHYS_ADDR; - } - /* - * Step 2: merge the returned slots with the preceding slots, - * if available (non zero) - */ - for (i = index - 1; - io_tlb_offset(i) != IO_TLB_SEGSIZE - 1 && - io_tlb_list[i]; i--) - io_tlb_list[i] = ++count; + if (index + nslots < ALIGN(index + 1, IO_TLB_SEGSIZE)) + count = io_tlb_list[index + nslots]; + else + count = 0; - io_tlb_used -= nslots; + /* + * Step 1: return the slots to the free list, merging the slots with + * superceeding slots + */ + for (i = index + nslots - 1; i >= index; i--) { + io_tlb_list[i] = ++count; + io_tlb_orig_addr[i] = INVALID_PHYS_ADDR; } + + /* + * Step 2: merge the returned slots with the preceding slots, if + * available (non zero) + */ + for (i = index - 1; + io_tlb_offset(i) != IO_TLB_SEGSIZE - 1 && io_tlb_list[i]; + i--) + io_tlb_list[i] = ++count; + io_tlb_used -= nslots; spin_unlock_irqrestore(&io_tlb_lock, flags); } Patches currently in stable-queue which might be from jxgao@xxxxxxxxxx are queue-5.10/swiotlb-respect-min_align_mask.patch queue-5.10/swiotlb-factor-out-a-nr_slots-helper.patch queue-5.10/swiotlb-add-a-io_tlb_size-define.patch queue-5.10/swiotlb-clean-up-swiotlb_tbl_unmap_single.patch queue-5.10/swiotlb-factor-out-an-io_tlb_offset-helper.patch queue-5.10/swiotlb-don-t-modify-orig_addr-in-swiotlb_tbl_sync_single.patch queue-5.10/swiotlb-refactor-swiotlb_tbl_map_single.patch queue-5.10/driver-core-add-a-min_align_mask-field-to-struct-device_dma_parameters.patch queue-5.10/nvme-pci-set-min_align_mask.patch