mmc: sdhci: Use "mmc" directly rather than "host->mmc"
authorJisheng Zhang <Jisheng.Zhang@synaptics.com>
Thu, 11 Mar 2021 09:40:46 +0000 (17:40 +0800)
committerUlf Hansson <ulf.hansson@linaro.org>
Tue, 30 Mar 2021 09:42:03 +0000 (11:42 +0200)
commitd2f025b08e9eb5e8e96c65c2b5dc01318801059a
treee1a7848fae7d69d82450fce6b20d2c01237927e2
parentba8734dfbe87b9dd68c9d525c0a3a52e8da42167
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: Jisheng Zhang <Jisheng.Zhang@synaptics.com>
Acked-by: Adrian Hunter <adrian.hunter@intel.com>
Link: https://lore.kernel.org/r/20210311174046.597d1951@xhacker.debian
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
drivers/mmc/host/sdhci.c