Skip to content
Commit d2f025b0 authored by Jisheng Zhang's avatar Jisheng Zhang Committed by Ulf Hansson
Browse files

mmc: sdhci: Use "mmc" directly rather than "host->mmc"



Clean up the code to use the "mmc" directly instead of "host->mmc".
If the code sits in hot code path, this clean up also brings trvial
performance improvement. Take the sdhci_post_req() for example:

before the patch:
     ...
     8d0:	a9be7bfd 	stp	x29, x30, [sp, #-32]!
     8d4:	910003fd 	mov	x29, sp
     8d8:	f9000bf3 	str	x19, [sp, #16]
     8dc:	f9400833 	ldr	x19, [x1, #16]
     8e0:	b9404261 	ldr	w1, [x19, #64]
     8e4:	34000161 	cbz	w1, 910 <sdhci_post_req+0x50>
     8e8:	f9424400 	ldr	x0, [x0, #1160]
     8ec:	d2800004 	mov	x4, #0x0                   	// #0
     8f0:	b9401a61 	ldr	w1, [x19, #24]
     8f4:	b9403262 	ldr	w2, [x19, #48]
     8f8:	f9400000 	ldr	x0, [x0]
     8fc:	f278003f 	tst	x1, #0x100
     900:	f9401e61 	ldr	x1, [x19, #56]
     904:	1a9f17e3 	cset	w3, eq  // eq = none
     908:	11000463 	add	w3, w3, #0x1
     90c:	94000000 	bl	0 <dma_unmap_sg_attrs>
     ...

After the patch:
     ...
     8d0:	a9be7bfd 	stp	x29, x30, [sp, #-32]!
     8d4:	910003fd 	mov	x29, sp
     8d8:	f9000bf3 	str	x19, [sp, #16]
     8dc:	f9400833 	ldr	x19, [x1, #16]
     8e0:	b9404261 	ldr	w1, [x19, #64]
     8e4:	34000141 	cbz	w1, 90c <sdhci_post_req+0x4c>
     8e8:	b9401a61 	ldr	w1, [x19, #24]
     8ec:	d2800004 	mov	x4, #0x0                   	// #0
     8f0:	b9403262 	ldr	w2, [x19, #48]
     8f4:	f9400000 	ldr	x0, [x0]
     8f8:	f278003f 	tst	x1, #0x100
     8fc:	f9401e61 	ldr	x1, [x19, #56]
     900:	1a9f17e3 	cset	w3, eq  // eq = none
     904:	11000463 	add	w3, w3, #0x1
     908:	94000000 	bl	0 <dma_unmap_sg_attrs>
     ...

We saved one ldr instruction: "ldr     x0, [x0, #1160]"

Signed-off-by: default avatarJisheng Zhang <Jisheng.Zhang@synaptics.com>
Acked-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
Link: https://lore.kernel.org/r/20210311174046.597d1951@xhacker.debian
Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
parent ba8734df
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment