+ Yinbo Zhu On Wed, 2 Sep 2020 at 06:06, Chris Packham <chris.packham@xxxxxxxxxxxxxxxxxxx> wrote: > > Commit b214fe592ab7 ("mmc: sdhci-of-esdhc: add erratum eSDHC7 support") > added code to check for a specific compatible string in the device-tree > on every esdhc interrupt. We know that if it's present the compatible > string will be found on the sdhc host. Instead of walking the > device-tree, go directly to the sdhc host's device and use > of_device_is_compatible(). > > Signed-off-by: Chris Packham <chris.packham@xxxxxxxxxxxxxxxxxxx> Thanks for the patch. Indeed, this isn't the way we should implement quirks. However, could you perhaps do the OF parsing in esdhc_init() and assign a quirk flag that you check in esdhc_irq() instead? Along the lines of how we do it for "quirk_delay_before_data_reset". Kind regards Uffe > --- > > I found this in passing while trying to track down another issue using ftrace. > I found it odd that I was seeing a lot of calls to __of_device_is_compatible() > coming from esdhc_irq() (the fact that this interrupt is going off on my board > is also odd, but that's a different story). > > drivers/mmc/host/sdhci-of-esdhc.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/drivers/mmc/host/sdhci-of-esdhc.c b/drivers/mmc/host/sdhci-of-esdhc.c > index 7c73d243dc6c..11c8c522d623 100644 > --- a/drivers/mmc/host/sdhci-of-esdhc.c > +++ b/drivers/mmc/host/sdhci-of-esdhc.c > @@ -1177,10 +1177,11 @@ static void esdhc_set_uhs_signaling(struct sdhci_host *host, > > static u32 esdhc_irq(struct sdhci_host *host, u32 intmask) > { > + struct device *dev = mmc_dev(host->mmc); > + struct device_node *np = dev->of_node; > u32 command; > > - if (of_find_compatible_node(NULL, NULL, > - "fsl,p2020-esdhc")) { > + if (of_device_is_compatible(np, "fsl,p2020-esdhc")) { > command = SDHCI_GET_CMD(sdhci_readw(host, > SDHCI_COMMAND)); > if (command == MMC_WRITE_MULTIPLE_BLOCK && > -- > 2.28.0 >