From patchwork Thu Apr 11 22:08:22 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Raul Rangel X-Patchwork-Id: 10897007 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id AF0C3139A for ; Thu, 11 Apr 2019 22:09:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 984F928A1B for ; Thu, 11 Apr 2019 22:09:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8C84D28B05; Thu, 11 Apr 2019 22:09:20 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E613F28A1B for ; Thu, 11 Apr 2019 22:09:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727015AbfDKWJS (ORCPT ); Thu, 11 Apr 2019 18:09:18 -0400 Received: from mail-io1-f68.google.com ([209.85.166.68]:36704 "EHLO mail-io1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727050AbfDKWJS (ORCPT ); Thu, 11 Apr 2019 18:09:18 -0400 Received: by mail-io1-f68.google.com with SMTP id f6so6784246iop.3 for ; Thu, 11 Apr 2019 15:09:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=N+KHzpPEzxiX0Ro0ISDWs6yLhJrXHxEIc70pati1wqs=; b=FeYTKpFszOooF+/VXmGwfotFmY6sJjBJgnEw8svTmrSBBHwzbiFTO6v/mrOiGed1Cw /G6E25Z2LmpBH4gNc2CNAEa/9GYdk1IDDxciHbuLdKx70RtfF/+ro028wJ9eMlP/mCyC jGD2RhdiRsP51Y6TJ/JtvHNwAZ46PLUDQ9CYg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=N+KHzpPEzxiX0Ro0ISDWs6yLhJrXHxEIc70pati1wqs=; b=mui76vPtDWxRYxYdT0WdxNhSHlgfOs7u7iLUqgKEPFOEfeKaTCVYDsID2i+U1+yCWl iubaVEdVDrTsZuui+URF8Gm2KRthN0F0mG/Iqi470H8QE+H++kY3/F7K2bt2s7GVVytj 7lXx4pYwo+tutthDwwCRCbgTxyn6hmm5dqLNt5HyA3l+tkDN7yNROgKHgXP9IqY5HKjM DipPU+7xrrEkelTlJMFLNeyPV7Rt1I1HgBoVldtVZJv7VQ6dvEcHDjYoKg/B6L1idIB3 hylPx0DwQHsTOrabIKCgA4RSK2SVmQiX9AAhX5xOuJ0mVmiwOwNjmbCL6MEiD4/QszP0 q68A== X-Gm-Message-State: APjAAAXXgwsYIZ2LUHiaE+yfMwX5Pbxj5gr6NUSU7m0K6sjinf+gLmKL wFRbEJEvsnHW1aBWIusECZBh1A== X-Google-Smtp-Source: APXvYqzZvqo2Fa50VZvneu8l4Ia4IBaVyJuX+A7oLhdoPC0oid4xoRz96FTFJ4LlnFDP6yZL7pr/7A== X-Received: by 2002:a5e:c019:: with SMTP id u25mr34184557iol.104.1555020556664; Thu, 11 Apr 2019 15:09:16 -0700 (PDT) Received: from localhost ([2620:15c:183:0:20b8:dee7:5447:d05]) by smtp.gmail.com with ESMTPSA id m81sm3327620itm.33.2019.04.11.15.09.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 11 Apr 2019 15:09:16 -0700 (PDT) From: Raul E Rangel To: linux-trace-devel@vger.kernel.org, linux-mmc@vger.kernel.org Cc: djkurtz@chromium.org, zwisler@chromium.org, Raul E Rangel , linux-kernel@vger.kernel.org, Adrian Hunter , Ulf Hansson Subject: [PATCH v1 4/4] mmc/host/sdhci: Make sdhci_read/sdhci_write call trace functions Date: Thu, 11 Apr 2019 16:08:22 -0600 Message-Id: <20190411220822.81845-5-rrangel@chromium.org> X-Mailer: git-send-email 2.21.0.392.gf8f6787159e-goog In-Reply-To: <20190411220822.81845-1-rrangel@chromium.org> References: <20190411220822.81845-1-rrangel@chromium.org> MIME-Version: 1.0 Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP An example trace can be seen here: https://pastebin.com/x73d5cvL I was unable to leave sdhci_readX and sdhci_writeX as macros because they are used in other modules (i.e., sdhci-pci). This means they can't call the trace_sdhci_XXX functions without explicitly exporting the private trace function name. Signed-off-by: Raul E Rangel --- drivers/mmc/host/sdhci-core.c | 136 ++++++++++++++++++++++++++++++++++ drivers/mmc/host/sdhci.h | 89 ++-------------------- 2 files changed, 142 insertions(+), 83 deletions(-) diff --git a/drivers/mmc/host/sdhci-core.c b/drivers/mmc/host/sdhci-core.c index a8141ff9be03..9e3f114629d9 100644 --- a/drivers/mmc/host/sdhci-core.c +++ b/drivers/mmc/host/sdhci-core.c @@ -36,6 +36,7 @@ #include #include "sdhci.h" +#include "sdhci-trace.h" #define DRIVER_NAME "sdhci" @@ -54,6 +55,141 @@ static void sdhci_finish_data(struct sdhci_host *); static void sdhci_enable_preset_value(struct sdhci_host *host, bool enable); +#ifdef CONFIG_MMC_SDHCI_IO_ACCESSORS + +void sdhci_writel(struct sdhci_host *host, u32 val, int reg) +{ + trace_sdhci_write(host, reg, val, U32_MAX); + + if (unlikely(host->ops->write_l)) + host->ops->write_l(host, val, reg); + else + writel(val, host->ioaddr + reg); +} +EXPORT_SYMBOL(sdhci_writel); + +void sdhci_writew(struct sdhci_host *host, u16 val, int reg) +{ + trace_sdhci_write(host, reg, val, U16_MAX); + + if (unlikely(host->ops->write_w)) + host->ops->write_w(host, val, reg); + else + writew(val, host->ioaddr + reg); +} +EXPORT_SYMBOL(sdhci_writew); + +void sdhci_writeb(struct sdhci_host *host, u8 val, int reg) +{ + trace_sdhci_write(host, reg, val, U8_MAX); + + if (unlikely(host->ops->write_b)) + host->ops->write_b(host, val, reg); + else + writeb(val, host->ioaddr + reg); +} +EXPORT_SYMBOL(sdhci_writeb); + +u32 sdhci_readl(struct sdhci_host *host, int reg) +{ + u32 val; + + if (unlikely(host->ops->read_l)) + val = host->ops->read_l(host, reg); + else + val = readl(host->ioaddr + reg); + + trace_sdhci_read(host, reg, val, U32_MAX); + + return val; +} +EXPORT_SYMBOL(sdhci_readl); + +u16 sdhci_readw(struct sdhci_host *host, int reg) +{ + u16 val; + + if (unlikely(host->ops->read_w)) + val = host->ops->read_w(host, reg); + else + val = readw(host->ioaddr + reg); + + trace_sdhci_read(host, reg, val, U16_MAX); + + return val; +} +EXPORT_SYMBOL(sdhci_readw); + +u8 sdhci_readb(struct sdhci_host *host, int reg) +{ + u8 val; + + if (unlikely(host->ops->read_b)) + val = host->ops->read_b(host, reg); + else + val = readb(host->ioaddr + reg); + + trace_sdhci_read(host, reg, val, U8_MAX); + + return val; +} +EXPORT_SYMBOL(sdhci_readb); + +#else + +void sdhci_writel(struct sdhci_host *host, u32 val, int reg) +{ + trace_sdhci_write(host, reg, val, U32_MAX); + writel(val, host->ioaddr + reg); +} +EXPORT_SYMBOL(sdhci_writel); + +void sdhci_writew(struct sdhci_host *host, u16 val, int reg) +{ + trace_sdhci_write(host, reg, val, U16_MAX); + writew(val, host->ioaddr + reg); +} +EXPORT_SYMBOL(sdhci_writew); + +void sdhci_writeb(struct sdhci_host *host, u8 val, int reg) +{ + trace_sdhci_write(host, reg, val, U8_MAX); + writeb(val, host->ioaddr + reg); +} +EXPORT_SYMBOL(sdhci_writeb); + +u32 sdhci_readl(struct sdhci_host *host, int reg) +{ + u32 val = readl(host->ioaddr + reg); + + trace_sdhci_read(host, reg, val, U32_MAX); + + return val; +} +EXPORT_SYMBOL(sdhci_readl); + +u16 sdhci_readw(struct sdhci_host *host, int reg) +{ + u16 val = readw(host->ioaddr + reg); + + trace_sdhci_read(host, reg, val, U16_MAX); + + return val; +} +EXPORT_SYMBOL(sdhci_readw); + +u8 sdhci_readb(struct sdhci_host *host, int reg) +{ + u8 val = readb(host->ioaddr + reg); + + trace_sdhci_read(host, reg, val, U8_MAX); + + return val; +} +EXPORT_SYMBOL(sdhci_readb); + +#endif /* CONFIG_MMC_SDHCI_IO_ACCESSORS */ + void sdhci_dumpregs(struct sdhci_host *host) { SDHCI_DUMP("============ SDHCI REGISTER DUMP ===========\n"); diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h index 01002cba1359..052361f27ec0 100644 --- a/drivers/mmc/host/sdhci.h +++ b/drivers/mmc/host/sdhci.h @@ -647,89 +647,12 @@ struct sdhci_ops { dma_addr_t addr, int len, unsigned int cmd); }; -#ifdef CONFIG_MMC_SDHCI_IO_ACCESSORS - -static inline void sdhci_writel(struct sdhci_host *host, u32 val, int reg) -{ - if (unlikely(host->ops->write_l)) - host->ops->write_l(host, val, reg); - else - writel(val, host->ioaddr + reg); -} - -static inline void sdhci_writew(struct sdhci_host *host, u16 val, int reg) -{ - if (unlikely(host->ops->write_w)) - host->ops->write_w(host, val, reg); - else - writew(val, host->ioaddr + reg); -} - -static inline void sdhci_writeb(struct sdhci_host *host, u8 val, int reg) -{ - if (unlikely(host->ops->write_b)) - host->ops->write_b(host, val, reg); - else - writeb(val, host->ioaddr + reg); -} - -static inline u32 sdhci_readl(struct sdhci_host *host, int reg) -{ - if (unlikely(host->ops->read_l)) - return host->ops->read_l(host, reg); - else - return readl(host->ioaddr + reg); -} - -static inline u16 sdhci_readw(struct sdhci_host *host, int reg) -{ - if (unlikely(host->ops->read_w)) - return host->ops->read_w(host, reg); - else - return readw(host->ioaddr + reg); -} - -static inline u8 sdhci_readb(struct sdhci_host *host, int reg) -{ - if (unlikely(host->ops->read_b)) - return host->ops->read_b(host, reg); - else - return readb(host->ioaddr + reg); -} - -#else - -static inline void sdhci_writel(struct sdhci_host *host, u32 val, int reg) -{ - writel(val, host->ioaddr + reg); -} - -static inline void sdhci_writew(struct sdhci_host *host, u16 val, int reg) -{ - writew(val, host->ioaddr + reg); -} - -static inline void sdhci_writeb(struct sdhci_host *host, u8 val, int reg) -{ - writeb(val, host->ioaddr + reg); -} - -static inline u32 sdhci_readl(struct sdhci_host *host, int reg) -{ - return readl(host->ioaddr + reg); -} - -static inline u16 sdhci_readw(struct sdhci_host *host, int reg) -{ - return readw(host->ioaddr + reg); -} - -static inline u8 sdhci_readb(struct sdhci_host *host, int reg) -{ - return readb(host->ioaddr + reg); -} - -#endif /* CONFIG_MMC_SDHCI_IO_ACCESSORS */ +void sdhci_writel(struct sdhci_host *host, u32 val, int reg); +void sdhci_writew(struct sdhci_host *host, u16 val, int reg); +void sdhci_writeb(struct sdhci_host *host, u8 val, int reg); +u32 sdhci_readl(struct sdhci_host *host, int reg); +u16 sdhci_readw(struct sdhci_host *host, int reg); +u8 sdhci_readb(struct sdhci_host *host, int reg); struct sdhci_host *sdhci_alloc_host(struct device *dev, size_t priv_size); void sdhci_free_host(struct sdhci_host *host);