From: Jianxiong Gao <jxgao@google.com>
To: stable@vger.kernel.org
Cc: Jianxiong Gao <jxgao@google.com>, Christoph Hellwig <hch@lst.de>
Subject: [PATCH v5.10 4/8] swiotlb: clean up swiotlb_tbl_unmap_single
Date: Mon, 5 Apr 2021 21:02:26 +0000 [thread overview]
Message-ID: <20210405210230.1707074-5-jxgao@google.com> (raw)
In-Reply-To: <20210405210230.1707074-1-jxgao@google.com>
From: Christoph Hellwig <hch@lst.de>
'commit ca10d0f8e530 ("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@lst.de>
Signed-off-by: Jianxiong Gao <jxgao@google.com>
---
kernel/dma/swiotlb.c | 42 +++++++++++++++++++++---------------------
1 file changed, 21 insertions(+), 21 deletions(-)
diff --git a/kernel/dma/swiotlb.c b/kernel/dma/swiotlb.c
index 1ba8e1095dfc..47d5dfeffd0a 100644
--- a/kernel/dma/swiotlb.c
+++ b/kernel/dma/swiotlb.c
@@ -610,28 +610,28 @@ void swiotlb_tbl_unmap_single(struct device *hwdev, phys_addr_t tlb_addr,
* 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;
-
- io_tlb_used -= nslots;
+ if (index + nslots < ALIGN(index + 1, IO_TLB_SEGSIZE))
+ count = io_tlb_list[index + nslots];
+ else
+ count = 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;
+ io_tlb_used -= nslots;
spin_unlock_irqrestore(&io_tlb_lock, flags);
}
--
2.27.0
next prev parent reply other threads:[~2021-04-05 21:03 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-05 21:02 [PATCH v5.10 0/8] preserve DMA offsets when using swiotlb Jianxiong Gao
2021-04-05 21:02 ` [PATCH v5.10 1/8] driver core: add a min_align_mask field to struct device_dma_parameters Jianxiong Gao
2021-04-07 12:50 ` Greg KH
2021-04-05 21:02 ` [PATCH v5.10 2/8] swiotlb: factor out an io_tlb_offset helper Jianxiong Gao
2021-04-05 21:02 ` [PATCH v5.10 3/8] swiotlb: factor out a nr_slots helper Jianxiong Gao
2021-04-05 21:02 ` Jianxiong Gao [this message]
2021-04-05 21:02 ` [PATCH v5.10 5/8] swiotlb: refactor swiotlb_tbl_map_single Jianxiong Gao
2021-04-05 21:02 ` [PATCH v5.10 6/8] swiotlb: don't modify orig_addr in swiotlb_tbl_sync_single Jianxiong Gao
2021-04-05 21:02 ` [PATCH v5.10 7/8] swiotlb: respect min_align_mask Jianxiong Gao
2021-04-05 21:02 ` [PATCH v5.10 8/8] nvme-pci: set min_align_mask Jianxiong Gao
2021-04-07 12:51 ` [PATCH v5.10 0/8] preserve DMA offsets when using swiotlb Greg KH
2021-04-20 23:38 ` Jianxiong Gao
2021-04-23 15:14 ` Greg KH
2021-04-23 17:28 ` Jianxiong Gao
2021-04-23 22:10 ` Jianxiong Gao
2021-04-23 22:33 ` Marc Orr
2021-04-24 14:43 ` Greg KH
2021-04-26 18:00 ` Jianxiong Gao
2021-04-28 16:18 ` Sasha Levin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210405210230.1707074-5-jxgao@google.com \
--to=jxgao@google.com \
--cc=hch@lst.de \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).